commit
stringlengths
40
40
subject
stringlengths
1
1.49k
old_file
stringlengths
4
311
new_file
stringlengths
4
311
new_contents
stringlengths
1
29.8k
old_contents
stringlengths
0
9.9k
lang
stringclasses
3 values
proba
float64
0
1
4e57f73597f8d5dc3ccee9d815657a774dc52d62
Handle package dirs correctly
src/setuptools_epydoc/__init__.py
src/setuptools_epydoc/__init__.py
import os import sys import re from setuptools import Command class EpydocCommand(Command): ''' Setuptools command used to build an API documentation with epydoc. @author: jwienke ''' user_options = [('format=', 'f', 'the output format to use (html and pdf)'), ...
import os import sys import re from setuptools import Command class EpydocCommand(Command): ''' Setuptools command used to build an API documentation with epydoc. @author: jwienke ''' user_options = [('format=', 'f', 'the output format to use (html and pdf)'), ...
Python
0
48cd6af0e138dd28b18ca3a71f41976c71483445
Add --forceuninstall option
Python/brewcaskupgrade.py
Python/brewcaskupgrade.py
#! /usr/bin/env python3 # -*- coding: utf8 -*- import argparse import shutil from subprocess import check_output, run parser = argparse.ArgumentParser(description='Update every entries found in cask folder.') parser.add_argument('--pretend', dest='pretend', action='store_true', help='Pretend to t...
#! /usr/bin/env python3 # -*- coding: utf8 -*- import argparse import shutil from subprocess import check_output, run parser = argparse.ArgumentParser(description='Update every entries found in cask folder.') parser.add_argument('--pretend', dest='pretend', action='store_true', help='Pretend to t...
Python
0
a4bc6c0c4d13629dbdfef30edcba262efce0eaff
fix up config for heroku
colorsearchtest/settings.py
colorsearchtest/settings.py
# -*- coding: utf-8 -*- import os os_env = os.environ class Config(object): SECRET_KEY = os_env.get('COLORSEARCHTEST_SECRET', 'secret-key') # TODO: Change me APP_DIR = os.path.abspath(os.path.dirname(__file__)) # This directory PROJECT_ROOT = os.path.abspath(os.path.join(APP_DIR, os.pardir)) SQLALC...
# -*- coding: utf-8 -*- import os os_env = os.environ class Config(object): SECRET_KEY = os_env.get('COLORSEARCHTEST_SECRET', 'secret-key') # TODO: Change me APP_DIR = os.path.abspath(os.path.dirname(__file__)) # This directory PROJECT_ROOT = os.path.abspath(os.path.join(APP_DIR, os.pardir)) SQLALC...
Python
0.000001
f20eb91dcf04bc8e33fbb48ebfbef1b56acbf02d
Make functions that pull a number of tweets and pics
web.py
web.py
""" Heroku/Python Quickstart: https://blog.heroku.com/archives/2011/9/28/python_and_django""" import os import random import requests from flask import Flask import tweepy import settings app = Flask(__name__) @app.route('/') def home_page(): return 'Hello from the SPARK learn-a-thon!' def get_instagram_im...
""" Heroku/Python Quickstart: https://blog.heroku.com/archives/2011/9/28/python_and_django""" import os from flask import Flask app = Flask(__name__) @app.route('/') def home_page(): return 'Hello from the SPARK learn-a-thon!' if __name__ == '__main__': port = int(os.environ.get("PORT", 5000)) app.run(h...
Python
0.000002
2a87ed1772a530b07c69e1d2086cd54160dd440a
fix sample test
samples/snippets/speech_adaptation_beta.py
samples/snippets/speech_adaptation_beta.py
# -*- coding: utf-8 -*- # # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
# -*- coding: utf-8 -*- # # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
Python
0.000729
74a5836d41386a847d2e69e2335e0825fb64972f
Add CPU_ONLY tag for sparse_feature_hash layer
caffe2/python/layers/sparse_feature_hash.py
caffe2/python/layers/sparse_feature_hash.py
# Copyright (c) 2016-present, Facebook, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
# Copyright (c) 2016-present, Facebook, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
Python
0.000001
0d58c2ffc8ec6afc353a242f942f668b0b7f362c
Correct shipping repository method calls
sandbox/apps/shipping/repository.py
sandbox/apps/shipping/repository.py
from decimal import Decimal as D from oscar.apps.shipping.methods import Free, FixedPrice from oscar.apps.shipping.repository import Repository as CoreRepository class Repository(CoreRepository): """ This class is included so that there is a choice of shipping methods. Oscar's default behaviour is to onl...
from decimal import Decimal as D from oscar.apps.shipping.methods import Free, FixedPrice from oscar.apps.shipping.repository import Repository as CoreRepository class Repository(CoreRepository): """ This class is included so that there is a choice of shipping methods. Oscar's default behaviour is to onl...
Python
0
edec18a82d6027c8a011fbef84c8aa3b80e18826
Update forward_device1.py
Server/forward_device1.py
Server/forward_device1.py
import zmq def main(): print "\nServer for ProBot is running..." try: context = zmq.Context(1) # Socket facing clients frontend = context.socket(zmq.SUB) frontend.bind("tcp://*:5559") frontend.setsockopt(zmq.SUBSCRIBE, "") # Socket facing services backen...
import zmq def main(): print "\nServer for ProBot is running..." try: context = zmq.Context(1) # Socket facing clients frontend = context.socket(zmq.SUB) frontend.bind("tcp://*:5559") frontend.setsockopt(zmq.SUBSCRIBE, "") # Socket facing services backe...
Python
0.000006
2100b512ffb188374e1d883cd2f359586182596b
ADD migration name
packages/grid/backend/alembic/versions/2021-09-20_916812f40fb4.py
packages/grid/backend/alembic/versions/2021-09-20_916812f40fb4.py
"""ADD daa_document column at setup table Revision ID: 916812f40fb4 Revises: 5796f6ceb314 Create Date: 2021-09-20 01:07:37.239186 """ # third party from alembic import op # type: ignore import sqlalchemy as sa # revision identifiers, used by Alembic. revision = "916812f40fb4" down_revision = "5796f6ceb314" branch_l...
"""empty message Revision ID: 916812f40fb4 Revises: 5796f6ceb314 Create Date: 2021-09-20 01:07:37.239186 """ # third party from alembic import op # type: ignore import sqlalchemy as sa # revision identifiers, used by Alembic. revision = "916812f40fb4" down_revision = "5796f6ceb314" branch_labels = None depends_on =...
Python
0.000003
80ede493f698395176d3c67dd1e4f3723b0d5859
Add initial pass at writing the git commit hook
mothermayi/hook.py
mothermayi/hook.py
import logging import os LOGGER = logging.getLogger(__name__) class NoRepoFoundError(Exception): pass class PreCommitExists(Exception): pass def find_git_repo(): location = os.path.abspath('.') while location != '/': check = os.path.join(location, '.git') if os.path.exists(check) and...
import logging import os LOGGER = logging.getLogger(__name__) class NoRepoFoundError(Exception): pass def find_git_repo(): location = os.path.abspath('.') while location != '/': check = os.path.join(location, '.git') if os.path.exists(check) and os.path.isdir(check): return ch...
Python
0
5d5f73ac411873c0ec82e233b74ce70f4de4ab03
Optimize migration process
openprocurement/planning/api/migration.py
openprocurement/planning/api/migration.py
# -*- coding: utf-8 -*- import logging from openprocurement.planning.api.traversal import Root from openprocurement.planning.api.models import Plan LOGGER = logging.getLogger(__name__) SCHEMA_VERSION = 1 SCHEMA_DOC = 'openprocurement_plans_schema' def get_db_schema_version(db): schema_doc = db.get(SCHEMA_DOC, {"...
# -*- coding: utf-8 -*- import logging from openprocurement.planning.api.traversal import Root from openprocurement.planning.api.models import Plan LOGGER = logging.getLogger(__name__) SCHEMA_VERSION = 1 SCHEMA_DOC = 'openprocurement_plans_schema' def get_db_schema_version(db): schema_doc = db.get(SCHEMA_DOC, {"...
Python
0.000004
47e2f60c8e10b6b2c87f2df40f362b70cb09fade
this should be a tuple
cyder/core/system/models.py
cyder/core/system/models.py
from django.db import models from cyder.base.mixins import ObjectUrlMixin from cyder.base.models import BaseModel from cyder.cydhcp.keyvalue.models import KeyValue class System(BaseModel, ObjectUrlMixin): name = models.CharField(max_length=255, unique=False) search_fields = ('name',) display_fields = ('...
from django.db import models from cyder.base.mixins import ObjectUrlMixin from cyder.base.models import BaseModel from cyder.cydhcp.keyvalue.models import KeyValue class System(BaseModel, ObjectUrlMixin): name = models.CharField(max_length=255, unique=False) search_fields = ('name') display_fields = ('n...
Python
1
310f1d32bf4edcd3046d6648d5133c8ef7a4a8d6
Fix issue with system ctnr change not propagating correctly to its interfaces
cyder/core/system/models.py
cyder/core/system/models.py
from django.db import models from django.db.models import Q from django.db.models.loading import get_model from cyder.base.eav.constants import ATTRIBUTE_INVENTORY from cyder.base.eav.fields import EAVAttributeField from cyder.base.eav.models import Attribute, EAVBase from cyder.base.mixins import ObjectUrlMixin from ...
from django.db import models from django.db.models import Q from django.db.models.loading import get_model from cyder.base.eav.constants import ATTRIBUTE_INVENTORY from cyder.base.eav.fields import EAVAttributeField from cyder.base.eav.models import Attribute, EAVBase from cyder.base.mixins import ObjectUrlMixin from ...
Python
0
d0a9d10d0df25de670e8bf9a1e603ed1fbe5ca29
use helpers
py3status/modules/taskwarrior.py
py3status/modules/taskwarrior.py
# -*- coding: utf-8 -*- """ Display tasks currently running in taskwarrior. Configuration parameters: cache_timeout: refresh interval for this module (default 5) format: display format for this module (default '{task}') Format placeholders: {task} active tasks Requires task: https://taskwarrior.org/d...
# -*- coding: utf-8 -*- """ Display tasks currently running in taskwarrior. Configuration parameters: cache_timeout: how often we refresh this module in seconds (default 5) format: display format for taskwarrior (default '{task}') Format placeholders: {task} active tasks Requires task: https://taskwa...
Python
0.001805
c9b7e886f9276079fc79fbe394f5b15595f04603
Test fixes
ownblock/ownblock/apps/messaging/tests.py
ownblock/ownblock/apps/messaging/tests.py
from unittest.mock import Mock from django.test import TestCase from rest_framework import serializers from apps.accounts.tests import ResidentFactory from apps.buildings.tests import ApartmentFactory from .serializers import MessageSerializer class SerializerTests(TestCase): def test_validate_recipient_if_s...
from unittest.mock import Mock from django.test import TestCase from rest_framework import serializers from apps.accounts.tests import ResidentFactory from apps.buildings.tests import ApartmentFactory from .serializers import MessageSerializer class SerializerTests(TestCase): def test_validate_recipient_if_s...
Python
0.000001
5e9eda407832d9b97e7f78219f20236e04306a32
fix test, probably broken by a epydoc change this code is dead though so i don't much care
pydoctor/test/test_formatting.py
pydoctor/test/test_formatting.py
from pydoctor import html, model from py import test def test_signatures(): argspec = [['a', 'b', 'c'], None, None, (1,2)] assert html.getBetterThanArgspec(argspec) == (['a'], [('b', 1), ('c', 2)]) def test_strsig(): argspec = [['a', 'b', 'c'], None, None, (1,2)] assert html.signature(argspec) == "a, ...
from pydoctor import html, model from py import test def test_signatures(): argspec = [['a', 'b', 'c'], None, None, (1,2)] assert html.getBetterThanArgspec(argspec) == (['a'], [('b', 1), ('c', 2)]) def test_strsig(): argspec = [['a', 'b', 'c'], None, None, (1,2)] assert html.signature(argspec) == "a, ...
Python
0
d9189f91370abd1e20e5010bb70d9c47efd58215
Change read_chrom_sizes to read from a FAIDX index if available
muver/reference.py
muver/reference.py
import os from wrappers import bowtie2, picard, samtools def create_reference_indices(ref_fn): ''' For a given reference FASTA file, generate several indices. ''' bowtie2.build(ref_fn) samtools.faidx_index(ref_fn) picard.create_sequence_dictionary(ref_fn) def read_chrom_sizes(...
from wrappers import bowtie2, picard, samtools def create_reference_indices(ref_fn): ''' For a given reference FASTA file, generate several indices. ''' bowtie2.build(ref_fn) samtools.faidx_index(ref_fn) picard.create_sequence_dictionary(ref_fn) def read_chrom_sizes(reference_ass...
Python
0
8e1610570a50282594a5516ee473cf13bec2ce71
fix typo
core/drivers/count/count.py
core/drivers/count/count.py
keywords = ['SELECT', 'INSERT', 'UPDATE', 'DELETE'] def count_query(queries): ret = {} for keyword in keywords: ret[keyword] = 0 for query in queries: for keyword in keywords: if query.startswith(keyword): ret[keyword] += 1 break return ret
keywords = ['SET', 'INSERT', 'UPDATE', 'DELETE'] def count_query(queries): ret = {} for keyword in keywords: ret[keyword] = 0 for query in queries: for keyword in keywords: if query.startswith(keyword): ret[keyword] += 1 break return ret
Python
0.999991
4657acf6408b2fb416e2c9577ac09d18d81f8a68
Remove unused NHS database mockup
nameless/config.py
nameless/config.py
import os _basedir = os.path.abspath(os.path.dirname(__file__)) # Plugin settings DATABASE_NAMES = ['atc', 'sms'] # Using sqlite for local development, will be SQL on production. SQLALCHEMY_BINDS = { 'atc': 'sqlite:///' + os.path.join(_basedir, 'db/atc.db'), 'sms': 'sqlite:///' + os.path.join(_basedir, 'db/sms....
import os _basedir = os.path.abspath(os.path.dirname(__file__)) # Plugin settings DATABASE_NAMES = ['atc', 'nhs', 'sms'] # Using sqlite for local development, will be SQL on production. SQLALCHEMY_BINDS = { 'atc': 'sqlite:///' + os.path.join(_basedir, 'db/atc.db'), 'nhs': 'sqlite:///' + os.path.join(_basedir, '...
Python
0
10801bca03c03d6b6bb7b6108733178dcf5a8b53
Revert 87dbc5eb9665b5a145a3c2a190f64e2ce4c09fd4^..HEAD
shop/views.py
shop/views.py
from django.http import HttpResponse, Http404, HttpResponseRedirect from django.views.generic.simple import direct_to_template from shop.forms import OrderForm from shop.models import EmailEntry, Order from datetime import datetime import urllib from xml.dom import minidom def index(request): print request.META['H...
from django.http import HttpResponse, Http404, HttpResponseRedirect from django.views.generic.simple import direct_to_template from shop.forms import OrderForm from shop.models import EmailEntry, Order from datetime import datetime import urllib from xml.dom import minidom def index(request): print request.META['H...
Python
0.000001
c81f4d0659366e1512a4b64f0cce65d50de25927
update to 3.29.0
packages/dependencies/sqlite3.py
packages/dependencies/sqlite3.py
{ 'repo_type' : 'archive', 'custom_cflag' : '-O2', # make sure we build it without -ffast-math 'download_locations' : [ { 'url' : 'https://www.sqlite.org/2019/sqlite-autoconf-3290000.tar.gz', 'hashes' : [ { 'type' : 'sha256', 'sum' : '8e7c1e2950b5b04c5944a981cb31fffbf9d2ddda939d536838ebc854481afd5b' }, ], }, { '...
{ 'repo_type' : 'archive', 'custom_cflag' : '-O2', # make sure we build it without -ffast-math 'download_locations' : [ { 'url' : 'https://www.sqlite.org/2019/sqlite-autoconf-3280000.tar.gz', 'hashes' : [ { 'type' : 'sha256', 'sum' : 'd61b5286f062adfce5125eaf544d495300656908e61fca143517afcc0a89b7c3' }, ], }, { '...
Python
0
0fee973ea7a4ca7b79c84ed55fa1d327c754beee
Add tests and some fixes for class extension pattern
readthedocs/core/utils/extend.py
readthedocs/core/utils/extend.py
"""Patterns for extending Read the Docs""" import inspect from django.conf import settings from django.utils.module_loading import import_by_path from django.utils.functional import LazyObject class SettingsOverrideObject(LazyObject): """Base class for creating class that can be overridden This is used fo...
"""Patterns for extending Read the Docs""" from django.conf import settings from django.utils.module_loading import import_by_path from django.utils.functional import LazyObject class SettingsOverrideObject(LazyObject): """Base class for creating class that can be overridden This is used for extension poin...
Python
0
252da1473643916dd10e7a250d64c8bedb8ae5a9
Use username as id too; #35
judge/views/select2.py
judge/views/select2.py
from django.db.models import Q from django.http import JsonResponse from django.utils.encoding import smart_text from django.views.generic.list import BaseListView from judge.models import Profile, Organization, Problem, Comment, Contest from judge.templatetags.gravatar import get_gravatar_url class Select2View(Base...
from django.db.models import Q from django.http import JsonResponse from django.utils.encoding import smart_text from django.views.generic.list import BaseListView from judge.models import Profile, Organization, Problem, Comment, Contest from judge.templatetags.gravatar import get_gravatar_url class Select2View(Base...
Python
0.00001
f1c49d33c829c56f0dff12a20563ca7a1b3fbc41
Print the other way around (makes more sense)
Toolkit/AimlessSurface.py
Toolkit/AimlessSurface.py
from __future__ import division def work(): from scitbx import math from scitbx.array_family import flex N=15 lfg = math.log_factorial_generator(N) nsssphe = math.nss_spherical_harmonics(6,50000,lfg) l = 2 m = 1 t = 1 p = 1 print nsssphe.spherical_harmonic(2, 1, 1, 1) def n_terms(): orders = ...
from __future__ import division def work(): from scitbx import math from scitbx.array_family import flex N=15 lfg = math.log_factorial_generator(N) nsssphe = math.nss_spherical_harmonics(6,50000,lfg) l = 2 m = 1 t = 1 p = 1 print nsssphe.spherical_harmonic(2, 1, 1, 1) def n_terms(): orders = ...
Python
0.000078
f1e071957214e787521c7de887ca1fe369671bc7
Add constants
UI/resources/constants.py
UI/resources/constants.py
# -*- coding: utf-8 -*- SAVE_PASSWORD_HASHED = True MAX_RETRIES_DOWNLOAD_FROM_SAME_FARMER = 3 MAX_RETRIES_UPLOAD_TO_SAME_FARMER = 3 MAX_RETRIES_NEGOTIATE_CONTRACT = 1000 MAX_RETRIES_GET_FILE_POINTERS = 100 GET_DEFAULT_TMP_PATH_FROM_ENV_VARIABLES = True GET_HOME_PATH_FROM_ENV_VARIABLES = True FILE_POINTERS_REQUEST_DE...
# -*- coding: utf-8 -*- SAVE_PASSWORD_HASHED = True MAX_RETRIES_DOWNLOAD_FROM_SAME_FARMER = 3 MAX_RETRIES_UPLOAD_TO_SAME_FARMER = 3 MAX_RETRIES_NEGOTIATE_CONTRACT = 1000 MAX_RETRIES_GET_FILE_POINTERS = 100 GET_DEFAULT_TMP_PATH_FROM_ENV_VARIABLES = True GET_HOME_PATH_FROM_ENV_VARIABLES = True FILE_POINTERS_REQUEST_DE...
Python
0.000228
f2a0bbee61a144bf0d1de77dd4b41393fe7428bf
fix Ntests in simuNtests
simuNtests.py
simuNtests.py
# lance simulations pour different nombre d'electeurs import multiprocessing import os, sys import shutil import time import numpy as np from randomSets import * def worker(((Ncandidats,q, Nwinners))): """worker function""" sys.stdout.write('\nSTART -- %i candidats -- \n' % Ncandidats) sys.stdout.flush() ...
# lance simulations pour different nombre d'electeurs import multiprocessing import os, sys import shutil import time import numpy as np from randomSets import * def worker(((Ncandidats,q, Nwinners))): """worker function""" sys.stdout.write('\nSTART -- %i candidats -- \n' % Ncandidats) sys.stdout.flush() ...
Python
0.000006
3bf9ab0da4b06b8b0383fb6db64947886742899c
Add newline in log of builds after successful rebuild of website.
site/build.py
site/build.py
#!/usr/bin/env python # -*- coding: ascii -*- """ This script can be used to build the website. It is also run on each commit to github. Example: ./build public_html """ from __future__ import print_function import datetime import os import shutil import subprocess import sys import time BUILD_DIR = 'build' de...
#!/usr/bin/env python # -*- coding: ascii -*- """ This script can be used to build the website. It is also run on each commit to github. Example: ./build public_html """ import datetime import os import shutil import subprocess import sys import time BUILD_DIR = 'build' def get_build_dir(): try: bui...
Python
0
50a6ac219a3ff9f9b6ed6614c8a54ab5e93b525a
set phid_valid to yes since received from phi [skip ci]
custom/icds/repeaters/generators/phi.py
custom/icds/repeaters/generators/phi.py
import json from django.core.serializers.json import DjangoJSONEncoder from corehq import toggles from corehq.apps.hqcase.utils import update_case from corehq.motech.repeaters.repeater_generators import ( CaseRepeaterJsonPayloadGenerator, ) class BasePayloadGenerator(CaseRepeaterJsonPayloadGenerator): @stat...
import json from django.core.serializers.json import DjangoJSONEncoder from corehq import toggles from corehq.apps.hqcase.utils import update_case from corehq.motech.repeaters.repeater_generators import ( CaseRepeaterJsonPayloadGenerator, ) class BasePayloadGenerator(CaseRepeaterJsonPayloadGenerator): @stat...
Python
0
798f80c3efe06869194adf7073af574cc94481b9
add to init
km3modules/__init__.py
km3modules/__init__.py
# coding=utf-8 # Filename: __init__.py # pylint: disable=locally-disabled """ A collection of commonly used modules. """ from km3modules.common import (Dump, Delete, HitCounter, BlobIndexer, Keep, StatusBar, MemoryObserver, Wrap, Cut) from km3modules.reco import SvdFit as PrimFit from km...
# coding=utf-8 # Filename: __init__.py # pylint: disable=locally-disabled """ A collection of commonly used modules. """ from km3modules.common import (Dump, Delete, HitCounter, BlobIndexer, Keep, StatusBar, MemoryObserver, Wrap) from km3modules.reco import SvdFit as PrimFit from km3modu...
Python
0.000006
b5f8e3f8dd8d2d99494be83bdddbc1a6078c3161
Test cleanup connectivity test added.
package/tests/test_connectivity/test_cleanup_connectivity.py
package/tests/test_connectivity/test_cleanup_connectivity.py
from unittest import TestCase from mock import Mock from cloudshell.cp.azure.domain.services.network_service import NetworkService from cloudshell.cp.azure.domain.services.tags import TagService from cloudshell.cp.azure.domain.services.virtual_machine_service import VirtualMachineService from cloudshell.cp.azure.doma...
from unittest import TestCase from mock import Mock from cloudshell.cp.azure.domain.services.network_service import NetworkService from cloudshell.cp.azure.domain.services.tags import TagService from cloudshell.cp.azure.domain.services.virtual_machine_service import VirtualMachineService from cloudshell.cp.azure.doma...
Python
0
e5ed0e4e6dea58a1412e3c596612e647bd22c619
Update __init__.py
krempelair/__init__.py
krempelair/__init__.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import jinja2 import flask import views class Krempelair(flask.Flask): jinja_options = { 'extensions': ['jinja2.ext.autoescape'], 'undefined': jinja2.StrictUndefined } def __init__(self): """(See `make_app` for parameter descripti...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import jinja2 import flask import views class Krempelair(flask.Flask): jinja_options = { 'extensions': ['jinja2.ext.autoescape'], 'undefined': jinja2.StrictUndefined } def __init__(self): """(See `make_app` for parameter descripti...
Python
0.000072
3f725f25b0896237b71f68993d9ffa24329f47fe
Keep the same format with other usage: capitalize the head letter
kuryr/common/config.py
kuryr/common/config.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
Python
0.999999
f751f0bc4ea5466052fdd11a674ddb9a0a3303a4
Fix pylint
dataset/models/tf/layers/core.py
dataset/models/tf/layers/core.py
""" Contains common layers """ import numpy as np import tensorflow as tf def flatten2d(inputs, name=None): """ Flatten tensor to two dimensions (batch_size, item_vector_size) """ x = tf.convert_to_tensor(inputs) dims = tf.reduce_prod(tf.shape(x)[1:]) x = tf.reshape(x, [-1, dims], name=name) retur...
""" Contains common layers """ import numpy as np import tensorflow as tf def flatten2d(inputs, name=None): """ Flatten tensor to two dimensions (batch_size, item_vector_size) """ x = tf.convert_to_tensor(inputs) dims = tf.reduce_prod(tf.shape(x)[1:]) x = tf.reshape(x, [-1, dims], name=name) retur...
Python
0.000099
130663a47fe3c497aedd39acd12de70bab230dec
make things login free
src/datahub/browser/views.py
src/datahub/browser/views.py
import json, sys, re, hashlib, smtplib, base64, urllib, os from auth import * from django.http import * from django.shortcuts import render_to_response from django.views.decorators.csrf import csrf_exempt from django.core.context_processors import csrf from django.core.validators import email_re from django.db.utils i...
import json, sys, re, hashlib, smtplib, base64, urllib, os from auth import * from django.http import * from django.shortcuts import render_to_response from django.views.decorators.csrf import csrf_exempt from django.core.context_processors import csrf from django.core.validators import email_re from django.db.utils i...
Python
0
8712b50048b3fe42fbeb725f92f20bda08cfcc28
update output string formatting
sknano/structure_io/_xyz_structure_data.py
sknano/structure_io/_xyz_structure_data.py
# -*- coding: utf-8 -*- """ ============================================================================== XYZ format (:mod:`sknano.structure_io._xyz_structure_data`) ============================================================================== .. currentmodule:: sknano.structure_io._xyz_structure_data """ from __fu...
# -*- coding: utf-8 -*- """ ============================================================================== XYZ format (:mod:`sknano.structure_io._xyz_structure_data`) ============================================================================== .. currentmodule:: sknano.structure_io._xyz_structure_data """ from __fu...
Python
0.000003
29a5ec45e76681865c62163e2580c0bfd4a6e241
Enhance comments
lc0045_jump_game_ii.py
lc0045_jump_game_ii.py
"""Leetcode 45. Jump Game II Hard URL: https://leetcode.com/problems/jump-game-ii/ Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Your goal is to reach the last index in the minimu...
"""Leetcode 45. Jump Game II Hard URL: https://leetcode.com/problems/jump-game-ii/ Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Your goal is to reach the last index in the minimu...
Python
0
87dd116aea6e3c8d9d436ce6b5bf1fbbe0ff0788
Fix incorrect role assignment in migration.
keystone/common/sql/migrate_repo/versions/020_migrate_metadata_table_roles.py
keystone/common/sql/migrate_repo/versions/020_migrate_metadata_table_roles.py
import json import sqlalchemy as sql from keystone import config CONF = config.CONF def upgrade(migrate_engine): meta = sql.MetaData() meta.bind = migrate_engine sql.Table('user', meta, autoload=True) sql.Table('role', meta, autoload=True) sql.Table('project', meta, autoload=True) new_met...
import json import sqlalchemy as sql from keystone import config CONF = config.CONF def upgrade(migrate_engine): meta = sql.MetaData() meta.bind = migrate_engine sql.Table('user', meta, autoload=True) sql.Table('role', meta, autoload=True) sql.Table('project', meta, autoload=True) new_met...
Python
0.000729
00ca89242b64d29a034aa03b1e76abef617f1b26
put validation back
application/frontend/forms.py
application/frontend/forms.py
from datetime import date from flask import request from flask_wtf import Form from wtforms import ( StringField, HiddenField, BooleanField, DateField, PasswordField, SubmitField, SelectField, RadioField, TextAreaField ) from wtforms.validators import DataRequired, ValidationError,...
from datetime import date from flask import request from flask_wtf import Form from wtforms import ( StringField, HiddenField, BooleanField, DateField, PasswordField, SubmitField, SelectField, RadioField, TextAreaField ) from wtforms.validators import DataRequired, ValidationError,...
Python
0
c9187cecbdb196343586378ca637d76079ff058f
Improve sub-package imports
src/minerva/storage/notification/__init__.py
src/minerva/storage/notification/__init__.py
# -*- coding: utf-8 -*- __docformat__ = "restructuredtext en" __copyright__ = """ Copyright (C) 2011-2013 Hendrikx-ITC B.V. Distributed under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. The full license is in the f...
# -*- coding: utf-8 -*- __docformat__ = "restructuredtext en" __copyright__ = """ Copyright (C) 2011-2013 Hendrikx-ITC B.V. Distributed under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. The full license is in the f...
Python
0.000017
2c17f8997bbfb5f6a943b29bb9ef024fff304302
hard-negative-mine
4_hard_negative_mine.py
4_hard_negative_mine.py
import object_detector.file_io as file_io import object_detector.detector as detector import object_detector.factory as factory import argparse as ap DEFAULT_CONFIG_FILE = "conf/svhn.json" if __name__ == "__main__": parser = ap.ArgumentParser() parser.add_argument('-c', "--config", help="Configurat...
import object_detector.file_io as file_io import object_detector.detector as detector import object_detector.factory as factory import argparse as ap DEFAULT_CONFIG_FILE = "conf/car_side.json" if __name__ == "__main__": parser = ap.ArgumentParser() parser.add_argument('-c', "--config", help="Config...
Python
0.999416
334334c95a543de3e92c96ef807b2cad684f4362
Update URL construction from FPLX db_refs
indra/databases/__init__.py
indra/databases/__init__.py
import logging logger = logging.getLogger('databases') def get_identifiers_url(db_name, db_id): """Return an identifiers.org URL for a given database name and ID. Parameters ---------- db_name : str An internal database name: HGNC, UP, CHEBI, etc. db_id : str An identifier in the ...
import logging logger = logging.getLogger('databases') def get_identifiers_url(db_name, db_id): """Return an identifiers.org URL for a given database name and ID. Parameters ---------- db_name : str An internal database name: HGNC, UP, CHEBI, etc. db_id : str An identifier in the ...
Python
0
e8293bd1365c759d940297e48609ee69251b0d62
split grant code for better suggestion
invenio_openaire/indexer.py
invenio_openaire/indexer.py
# -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2016-2019 CERN. # # Invenio is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """Record modification prior to indexing.""" from __future__ import absolute_import,...
# -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2016-2019 CERN. # # Invenio is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """Record modification prior to indexing.""" from __future__ import absolute_import,...
Python
0
d60dea7b7b1fb073eef2c350177b3920f32de748
Add comments indicating source of formulae..
6/e6.py
6/e6.py
#!/usr/bin/env python # http://www.proofwiki.org/wiki/Sum_of_Sequence_of_Squares def sum_seq_squares(n): return (n * (n+1) * ((2*n)+1)) / 6 # http://www.regentsprep.org/regents/math/algtrig/ATP2/ArithSeq.htm def sum_seq(n): return (n * (n + 1)) / 2 def main(): sum_seq_sq_100 = sum_seq_squares(100) sum_seq_...
#!/usr/bin/env python def sum_seq_squares(n): return (n * (n+1) * ((2*n)+1)) / 6 def sum_seq(n): return (n * (n + 1)) / 2 def main(): sum_seq_sq_100 = sum_seq_squares(100) sum_seq_100 = sum_seq(100) sq_sum_seq_100 = sum_seq_100**2 diff = sq_sum_seq_100 - sum_seq_sq_100 print('diff is {0}'.format(diff)) ...
Python
0
36e8549053d28f51cc1e846e86bbdc8b32527cbe
Make app.py localhost only
app.py
app.py
#!/usr/bin/python3 from json import dumps from datetime import datetime import os from bottle import app as bottleapp from bottle import route, run, static_file, template from pymongo import MongoClient import sprout os.chdir(os.path.dirname(os.path.abspath(__file__))) mongo = MongoClient('localhost', 27017) col = mo...
#!/usr/bin/python3 from json import dumps from datetime import datetime import os from bottle import app as bottleapp from bottle import route, run, static_file, template from pymongo import MongoClient import sprout os.chdir(os.path.dirname(os.path.abspath(__file__))) mongo = MongoClient('localhost', 27017) col = mo...
Python
0.000004
91ff11cde50ce2485c0a6725651931f88a085ca7
Update get_time to handle timeout errors.
app.py
app.py
""" app.py """ from flask import Flask, render_template import requests app = Flask(__name__) def get_time(): try: response = requests.get('http://localhost:3001/time', timeout=3.0) except (requests.exceptions.ConnectionError, requests.exceptions.Timeout): return 'Unavailable' ...
""" app.py """ from flask import Flask, render_template import requests app = Flask(__name__) def get_time(): try: response = requests.get('http://localhost:3001/time') except requests.exceptions.ConnectionError: return 'Unavailable' return response.json().get('datetime') def get_user...
Python
0
b2a1dcd25ecc9d50a975a41330a1620b52312857
add docstring
letmecreate/click/motion.py
letmecreate/click/motion.py
#!/usr/bin/env python3 """Python binding of Motion Click wrapper of LetMeCreate library.""" import ctypes _lib = ctypes.CDLL('libletmecreate_click.so') callback_type = ctypes.CFUNCTYPE(None, ctypes.c_uint8) callbacks = [None, None] def enable(mikrobus_index): """Enable the motion click. Configures the EN p...
#!/usr/bin/env python3 import ctypes _lib = ctypes.CDLL('libletmecreate_click.so') callback_type = ctypes.CFUNCTYPE(None, ctypes.c_uint8) callbacks = [None, None] def enable(mikrobus_index): ret = _lib.motion_click_enable(mikrobus_index) if ret < 0: raise Exception("motion click enable failed") de...
Python
0
460b48c10461df264a30ac26630d7299370988cd
Support alternative URLs
gsl.py
gsl.py
#!/usr/bin/python from urlparse import urlparse import urllib import urllib2 import click import os import hashlib PACKAGE_SERVER = 'https://server-to-be-determined/' @click.command() @click.option('--package_id', help='Package ID', required=True) @click.option('--download_location', default='./', help=...
#!/usr/bin/python from urlparse import urlparse import urllib import urllib2 import click import os import hashlib PACKAGE_SERVER = 'https://server-to-be-determined/' @click.command() @click.option('--package_id', help='Package ID', required=True) @click.option('--download_location', default='./', help=...
Python
0.000001
9c012f3b5609b557b9d14059f2b2a6412283e0ed
support option ax='new'
src/pyquickhelper/helpgen/graphviz_helper.py
src/pyquickhelper/helpgen/graphviz_helper.py
""" @file @brief Helper about graphviz. """ import os from ..loghelper import run_cmd from .conf_path_tools import find_graphviz_dot def plot_graphviz(dot, ax=None, temp_dot=None, temp_img=None, dpi=300): """ Plots a dot graph into a :epkg:`matplotlib` plot. @param dot dot language @param a...
""" @file @brief Helper about graphviz. """ import os from ..loghelper import run_cmd from .conf_path_tools import find_graphviz_dot def plot_graphviz(dot, ax=None, temp_dot=None, temp_img=None, dpi=300): """ Plots a dot graph into a :epkg:`matplotlib` plot. @param dot dot language @param a...
Python
0.000036
cbe379efeb7592e9c918fc4d092098b74a3b8c1a
Update Deck.py - Add shuffle method to shuffle the deck and then return the shuffled cards.
Deck.py
Deck.py
#Deck class Deck: '''Definition of a card deck.''' from random import shuffle as rShuffle def __init__(self,hasJoker=False): self.suits = ['H','D','S','C'] self.values = [str(x) for x in range(2,10)] #2-9 cards self.values.extend(['T','J','Q','K','A']) #Face cards (including the 10s) #Assemble deck self....
#Deck class Deck: '''Definition of a card deck.''' def __init__(self,hasJoker=False): self.suits = ['H','D','S','C'] self.values = [str(x) for x in range(2,10)] #2-9 cards self.values.extend(['T','J','Q','K','A']) #Face cards (including the 10s) #Assemble deck self.cards = [(v,s) for v in self.values for ...
Python
0
3bd37ff8b91787da22f925ab858157bffa5698d7
Remove unnecessary import
Fibo.py
Fibo.py
import sys def Fibo(num): if num <= 2: return 1 else: return Fibo(num-1)+Fibo(num-2) print(Fibo(int(sys.argv[1])))
import math import sys def Fibo(num): if num <= 2: return 1 else: return Fibo(num-1)+Fibo(num-2) print(Fibo(int(sys.argv[1])))
Python
0
6855564716827546a5b68c154b0d95daba969119
add more user tests
src/inventory/tests/tests.py
src/inventory/tests/tests.py
from django.test import TestCase from inventory.models import * class UserTests(TestCase): def test_for_fields(self): """ saving and loading users""" initial_user = User(id=10, username="user", password="pass", email="email", f_name="f_name", l_name="l_name", active=True).save() ...
from django.test import TestCase from inventory.models import * class UserTests(TestCase): def test_for_fields(self): """ saving and loading users""" initial_user = User(username="user", password="pass", email="email", f_name="fname", l_name="lname", active=True).save() loaded...
Python
0
457642b37cf84f789530d7466eff2fb810f560fc
Add tests for Router.start/stop/run as well as call_at.
lib/rapidsms/tests/test_router.py
lib/rapidsms/tests/test_router.py
#!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 import unittest, threading, time, datetime from rapidsms.router import Router from rapidsms.connection import Connection from rapidsms.message import Message from rapidsms.backends.backend import Backend from rapidsms.tests.harness import MockApp, MockLogger class Te...
#!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 import unittest, threading from rapidsms.router import Router from rapidsms.backends.backend import Backend from rapidsms.tests.harness import MockApp, MockLogger class TestRouter(unittest.TestCase): def test_log(self): r = Router() r.logger = Moc...
Python
0
237b9d4577f004401c2385163b060c785692c8b6
add when_over and when_over_guessed fields to Event (db change)
src/knesset/events/models.py
src/knesset/events/models.py
from datetime import datetime from django.db import models from django.contrib.contenttypes import generic from django.contrib.contenttypes.models import ContentType from django.utils.translation import ugettext_lazy as _ from knesset.persons.models import Person class Event(models.Model): ''' hold the when, who, ...
from datetime import datetime from django.db import models from django.contrib.contenttypes import generic from django.contrib.contenttypes.models import ContentType from django.utils.translation import ugettext_lazy as _ from knesset.persons.models import Person class Event(models.Model): ''' hold the when, who, ...
Python
0
d53dc67fc002448c7b94758843223a17d4623483
Allow IP to be blank
lingcod/bookmarks/models.py
lingcod/bookmarks/models.py
from django.contrib.gis.db import models from lingcod.features import register from lingcod.features.models import Feature from django.utils.html import escape from django.conf import settings class Bookmark(Feature): description = models.TextField(default="", null=True, blank=True) latitude = models.FloatFiel...
from django.contrib.gis.db import models from lingcod.features import register from lingcod.features.models import Feature from django.utils.html import escape from django.conf import settings class Bookmark(Feature): description = models.TextField(default="", null=True, blank=True) latitude = models.FloatFiel...
Python
0.000009
d8d6ce50c6fef9157f76e1dfefef24d15532a4d9
Add missing contexts to integration tests
test/integration/ggrc/__init__.py
test/integration/ggrc/__init__.py
# Copyright (C) 2016 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> """Base test case for all ggrc integration tests.""" import logging from sqlalchemy import exc from flask.ext.testing import TestCase as BaseTestCase from ggrc import db from ggrc.app import app # Hide err...
# Copyright (C) 2016 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> """Base test case for all ggrc integration tests.""" import logging from sqlalchemy import exc from flask.ext.testing import TestCase as BaseTestCase from ggrc import db from ggrc.app import app # Hide err...
Python
0.000057
d137005229e180b509f0a2f83f5d2472b40d8890
Set up Sentry if we're configured for it (so I don't lose this code again)
run.py
run.py
import os from os.path import abspath, dirname, join from makerbase import app if 'MAKERBASE_SETTINGS' not in os.environ: os.environ['MAKERBASE_SETTINGS'] = join(dirname(abspath(__file__)), 'settings.py') app.config.from_envvar('MAKERBASE_SETTINGS') if 'SENTRY_DSN' in app.config: from raven.contrib.flask i...
import os from os.path import abspath, dirname, join from makerbase import app if 'MAKERBASE_SETTINGS' not in os.environ: os.environ['MAKERBASE_SETTINGS'] = join(dirname(abspath(__file__)), 'settings.py') app.config.from_envvar('MAKERBASE_SETTINGS') if __name__ == '__main__': app.run(debug=True)
Python
0
a4656021f6a97bf5ffccb3d6e522515769ba0d21
Remove unnecessary calls to disable_continuous_mode
run.py
run.py
import argparse import serial import threading from io import BufferedRWPair, TextIOWrapper from time import sleep temp_usb = '/dev/ttyAMA0' BAUD_RATE = 9600 parser = argparse.ArgumentParser() parser.add_argument('oxygen', help='The USB port of the oxygen sensor.') parser.add_argument('salinity', help='The USB port o...
import argparse import serial import threading from io import BufferedRWPair, TextIOWrapper from time import sleep temp_usb = '/dev/ttyAMA0' BAUD_RATE = 9600 parser = argparse.ArgumentParser() parser.add_argument('oxygen', help='The USB port of the oxygen sensor.') parser.add_argument('salinity', help='The USB port o...
Python
0.000003
68d465988378f24e74f8dd098919031d3fcfa2f4
fix source reinsertion bug
run.py
run.py
import spider import sys import os import json ''' requires spider.py be in the same directory as this module spider.py can be found at http://github.com/shariq/notion-on-firebase ''' def get_firebase_json_path(firebase_path): return os.path.abspath(os.path.join(firebase_path, 'firebase.json')) def add_to_fir...
import spider import sys import os import json ''' requires spider.py be in the same directory as this module spider.py can be found at http://github.com/shariq/notion-on-firebase ''' def get_firebase_json_path(firebase_path): return os.path.abspath(os.path.join(firebase_path, 'firebase.json')) def add_to_fir...
Python
0
1c8a1bfeef8206267a45562d4932cece1cbea1b4
Fix some pylint issues
Trie.py
Trie.py
#! /usr/bin/env python # vim: set encoding=utf-8 from ctypes import cdll, c_char_p, c_void_p, create_string_buffer libtrie = cdll.LoadLibrary("./libtrie.so") libtrie.trie_load.argtypes = [c_char_p] libtrie.trie_load.restype = c_void_p libtrie.trie_lookup.argtypes = [c_void_p, c_char_p, c_char_p] libtrie.trie_lookup.r...
#! /usr/bin/env python # vim: set encoding=utf-8 from ctypes import * libtrie = cdll.LoadLibrary("./libtrie.so") libtrie.trie_load.argtypes = [c_char_p] libtrie.trie_load.restype = c_void_p libtrie.trie_lookup.argtypes = [ c_void_p, c_char_p, c_char_p ] libtrie.trie_lookup.restype = c_void_p libtrie.trie_get_last_err...
Python
0.000077
e62db9661295ff3912dbaaaff0d9f267f0b7ffe1
Add url callback on custom login
auth.py
auth.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from bottle.ext import auth from utils import conf try: auth_import = conf('auth')['engine'].split('.')[-1] auth_from = u".".join(conf('auth')['engine'].split('.')[:-1]) auth_engine = getattr(__import__(auth_from, fromlist=[auth_import]), ...
#!/usr/bin/env python # -*- coding: utf-8 -*- from bottle.ext import auth from utils import conf try: auth_import = conf('auth')['engine'].split('.')[-1] auth_from = u".".join(conf('auth')['engine'].split('.')[:-1]) auth_engine = getattr(__import__(auth_from, fromlist=[auth_import]), ...
Python
0
95723719050aa08119ed2478c0bb40253a2b0b3e
Remove methods with unnecessary super delegation.
libqtile/layout/max.py
libqtile/layout/max.py
# Copyright (c) 2008, Aldo Cortesi. All rights reserved. # Copyright (c) 2017, Dirk Hartmann. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitati...
# Copyright (c) 2008, Aldo Cortesi. All rights reserved. # Copyright (c) 2017, Dirk Hartmann. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitati...
Python
0
b5ee1f3dfccd3a18698ada03442854479e406d37
Update expression-add-operators.py
Python/expression-add-operators.py
Python/expression-add-operators.py
# Time: O(3^n) # Space: O(n) # # Given a string that contains only digits 0-9 # and a target value, return all possibilities # to add operators +, -, or * between the digits # so they evaluate to the target value. # # Examples: # "123", 6 -> ["1+2+3", "1*2*3"] # "232", 8 -> ["2*3+2", "2+3*2"] # "00", 0 -> ["0+0", ...
# Time: O(3^n) # Space: O(n) # # Given a string that contains only digits 0-9 # and a target value, return all possibilities # to add operators +, -, or * between the digits # so they evaluate to the target value. # # Examples: # "123", 6 -> ["1+2+3", "1*2*3"] # "232", 8 -> ["2*3+2", "2+3*2"] # "00", 0 -> ["0+0", ...
Python
0.000002
5ebf34e1c572e5db9012af4228eaca2a8461b8d9
add some extra debug logging to smr-reduce
smr/reduce.py
smr/reduce.py
#!/usr/bin/env python import sys from .shared import get_config, configure_logging def main(): if len(sys.argv) < 2: sys.stderr.write("usage: smr-reduce config.py\n") sys.exit(1) config = get_config(sys.argv[1]) configure_logging(config) try: for result in iter(sys.stdin.read...
#!/usr/bin/env python import sys from .shared import get_config, configure_logging def main(): if len(sys.argv) < 2: sys.stderr.write("usage: smr-reduce config.py\n") sys.exit(1) config = get_config(sys.argv[1]) configure_logging(config) try: for result in iter(sys.stdin.read...
Python
0
dd020b279f011ff78a6a41571a839e4c57333e93
Rename username field to userspec (#196).
devilry/apps/core/models/relateduser.py
devilry/apps/core/models/relateduser.py
import re from django.db import models from django.db.models import Q from django.core.exceptions import ValidationError from period import Period from node import Node from abstract_is_admin import AbstractIsAdmin class RelatedUserBase(models.Model, AbstractIsAdmin): """ Base class for :cls:`RelatedExamine...
import re from django.db import models from django.db.models import Q from django.core.exceptions import ValidationError from period import Period from node import Node from abstract_is_admin import AbstractIsAdmin class RelatedUserBase(models.Model, AbstractIsAdmin): """ Base class for :cls:`RelatedExamine...
Python
0
4b330755edab7a57de6d39a7e365c5f79df81065
Update config.py
blaspy/config.py
blaspy/config.py
""" Copyright (c) 2014, The University of Texas at Austin. All rights reserved. This file is part of BLASpy and is available under the 3-Clause BSD License, which can be found in the LICENSE file at the top-level directory or at http://opensource.org/licenses/BSD-3-Clause """ from .errors import...
""" Copyright (c) 2014, The University of Texas at Austin. All rights reserved. This file is part of BLASpy and is available under the 3-Clause BSD License, which can be found in the LICENSE file at the top-level directory or at http://opensource.org/licenses/BSD-3-Clause """ from .errors import...
Python
0
290a1f0cb301a6a4f4be2e218e8d97a5644cc2d3
Remove old Ensembl domain
rnacentral_pipeline/databases/ensembl/metadata/karyotypes.py
rnacentral_pipeline/databases/ensembl/metadata/karyotypes.py
# -*- coding: utf-8 -*- """ Copyright [2009-2018] EMBL-European Bioinformatics Institute Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by...
# -*- coding: utf-8 -*- """ Copyright [2009-2018] EMBL-European Bioinformatics Institute Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by...
Python
0
e4b2f5eed4c169792812ee82fa1f65cdc9516fb0
Add first/lastname to project search
lims/projects/views.py
lims/projects/views.py
import django_filters from rest_framework import viewsets from rest_framework.validators import ValidationError from rest_framework.filters import (OrderingFilter, SearchFilter, DjangoFilterBackend) from guardian.shortcuts import get_group_perms ...
import django_filters from rest_framework import viewsets from rest_framework.validators import ValidationError from rest_framework.filters import (OrderingFilter, SearchFilter, DjangoFilterBackend) from guardian.shortcuts import get_group_perms ...
Python
0
1809df6d5886ac6c0c35c8e879d9eda334606f4e
Simplify handling from_db_value across django versions
django_unixdatetimefield/fields.py
django_unixdatetimefield/fields.py
import datetime import time import django.db.models as models class UnixDateTimeField(models.DateTimeField): # TODO(niklas9): # * should we take care of transforming between time zones in any way here ? # * get default datetime format from settings ? DEFAULT_DATETIME_FMT = '%Y-%m-%d %H:%M:%S' TZ...
import datetime import time import django import django.db.models as models class UnixDateTimeField(models.DateTimeField): # TODO(niklas9): # * should we take care of transforming between time zones in any way here ? # * get default datetime format from settings ? DEFAULT_DATETIME_FMT = '%Y-%m-%d %H...
Python
0.000017
20053951b3036d0ae49f7f1ae25d600848872c82
Bump version
lintreview/__init__.py
lintreview/__init__.py
__version__ = '2.36.2'
__version__ = '2.36.1'
Python
0
f426d44f82a4f1855cb180b5aff98221c14537f1
Update version.py
nltools/version.py
nltools/version.py
"""Specifies current version of nltools to be used by setup.py and __init__.py """ __version__ = '0.3.7'
"""Specifies current version of nltools to be used by setup.py and __init__.py """ __version__ = '0.3.6'
Python
0.000001
fcf5d1f33026069d69690c67f7ddcc8c77f15626
add exception handingling for debug
opreturnninja/views.py
opreturnninja/views.py
import json import random from pyramid.view import view_config from .constants import ELECTRUM_SERVERS from bitcoin.rpc import RawProxy, DEFAULT_USER_AGENT import socket @view_config(route_name='api', renderer='json') def api_view(request): global rpc assert hasattr(request, 'json_body') assert 'meth...
import json import random from pyramid.view import view_config from .constants import ELECTRUM_SERVERS from bitcoin.rpc import RawProxy, DEFAULT_USER_AGENT import socket @view_config(route_name='api', renderer='json') def api_view(request): global rpc assert hasattr(request, 'json_body') assert 'meth...
Python
0
43d7850403e1e98951909bcb0c441098c3221bde
Update ipc_lista1.4.py
lista1/ipc_lista1.4.py
lista1/ipc_lista1.4.py
#ipc_lista1.4 #Professor: Jucimar Junior #Any Mendes Carvalho - 1615310044 # # # # #Faça um Programa que peça as 4 notas bimestrais e mostre a media nota1 = int(input("Digite a primeira nota do bimestre: ")) nota2 = int(input("Digite a segunda nota do bimestre: ")) nota3 = int(input("Digite a terceira nota do bismestr...
#ipc_lista1.4 #Professor: Jucimar Junior #Any Mendes Carvalho - 1615310044 # # # # #Faça um Programa que peça as 4 notas bimestrais e mostre a media nota1 = int(input("Digite a primeira nota do bimestre: ")) nota2 = int(input("Digite a segunda nota do bimestre: ")) nota3 = int(input("Digite a terceira nota do bismestr...
Python
0
fb772e5e597082a119348efa68f70e60c11506cd
clean up
lists/gift_exchange.py
lists/gift_exchange.py
import random import itertools givers = [('tim', 'shirt'), ('jim', 'shoe'), ('john', 'ball'), ('joe', 'fruit')] if len(givers) < 2: print "must have more than 1 givers" else: a = list(givers) b = list(givers) while a == b: random.shuffle(a) random.shuffle(b) for i, j in iter...
import random import itertools givers = [('tim', 'shirt'), ('jim', 'shoe'), ('joe', 'fruit'), ('john', 'ball')] def valid(a, b): if a == b: return False else: return True if len(givers) < 2: print "must have more than 1 givers" else: a = list(givers) b = list(givers) whi...
Python
0.000001
b76e1697b92565ca3fc8a7ee2961adf894095e04
Add User as foreign key in Bill
billing/models.py
billing/models.py
from django.db import models from django.dispatch import receiver from django.contrib.auth.models import User from django.db.models.signals import pre_save, pre_init import datetime class Bill(models.Model): user = models.ForeignKey(User) number = models.CharField(max_length=10, unique=True, blank=True) ...
from django.db import models from django.dispatch import receiver from django.contrib.auth.models import User from django.db.models.signals import pre_save, pre_init import datetime class Bill(models.Model): number = models.CharField(max_length=10, unique=True, blank=True) isPaid = models.BooleanField(defaul...
Python
0.000001
17d3d63564798cd03788ce579227d5425cd866c0
Make fake uploader use zlib compression
bin/fake_order.py
bin/fake_order.py
#!/usr/bin/env python """ A fake order upload script, used to manually test the whole stack. """ import simplejson import requests import zlib data = """ { "resultType" : "orders", "version" : "0.1alpha", "uploadKeys" : [ { "name" : "emk", "key" : "abc" }, { "name" : "ec" , "key" : "def" } ], "genera...
#!/usr/bin/env python """ A fake order upload script, used to manually test the whole stack. """ import simplejson import requests data = """ { "resultType" : "orders", "version" : "0.1alpha", "uploadKeys" : [ { "name" : "emk", "key" : "abc" }, { "name" : "ec" , "key" : "def" } ], "generator" : { "na...
Python
0.000003
f7a86cec72e4b5ff017013561f4fd3f3f59bfde5
Fix typos
AutoSetNewFileSyntax.py
AutoSetNewFileSyntax.py
import sublime import sublime_plugin import sys import os import logging sys.path.insert(0, os.path.dirname(__file__)) from SyntaxMappings import * PLUGIN_NAME = 'AutoSetNewFileSyntax' LOG_LEVEL = logging.INFO LOG_FORMAT = "%(name)s: [%(levelname)s] %(message)s" settings = None syntaxMappings = None loggingStreamHa...
import sublime import sublime_plugin import sys import os import logging sys.path.insert(0, os.path.dirname(__file__)) from SyntaxMappings import * PLUGIN_NAME = 'AutoSetNewFileSyntax' LOG_LEVEL = logging.INFO LOG_FORMAT = "%(name)s: [%(levelname)s] %(message)s" settings = None syntaxMappings = None loggingStreamHa...
Python
0.999999
348896e6f9318755d9bbefdf94de18ed32b17d1d
Update item.py
item.py
item.py
import pygame class Item(pygame.sprite.Sprite): def __init__(self, level, *groups): super(Item, self).__init__(*groups) #the game level self.level = level #base image self.level.animator.set_Img(0,5) self.image = self.level.animator.get_Img().convert() self.image.set_colorkey((255,0,0)) self.level.ani...
import pygame class Item(pygame.sprite.Sprite): def __init__(self, level, *groups): super(Item, self).__init__(*groups) #the game level self.level = level #base image self.level.animator.set_Img(6,0) self.image = self.level.animator.get_Img().convert() self.image.set_colorkey((255,0,0)) #type sel...
Python
0
e74420b90e83ade7956023eaf4ef2613e441a9ca
Fix linter error with ambiguous variable name 'l'.
bitfield/forms.py
bitfield/forms.py
from __future__ import absolute_import from django.forms import CheckboxSelectMultiple, IntegerField, ValidationError try: from django.utils.encoding import force_text except ImportError: from django.utils.encoding import force_unicode as force_text from bitfield.types import BitHandler class BitFieldCheck...
from __future__ import absolute_import from django.forms import CheckboxSelectMultiple, IntegerField, ValidationError try: from django.utils.encoding import force_text except ImportError: from django.utils.encoding import force_unicode as force_text from bitfield.types import BitHandler class BitFieldCheck...
Python
0
1725036d83f001493ff2c2d443c6814e0c491dfc
implement load_setting_file and get_weather_information
iwrs.py
iwrs.py
#! /usr/bin/env python # -*- coding:utf-8 -*- """ [NAME] YOLP(気象情報) を使用して指定時間後(設定ファイル)に雨が降るかどうかを知らせる. [DESCRIPTION] YOLP(気象情報) から降水強度を取得し, 指定時間後(設定ファイル)の降水強度が閾値(設定ファイル)以上である場合に, 指定の音声ファイル(設定ファイル)を再生する. YOLP(気象情報): https://developer.yahoo.co.jp/webapi/map/openlocalplatform/v1/weather.html """ from datetime import...
#! /usr/bin/env python # -*- coding:utf-8 -*- """ [NAME] YOLP(気象情報) を使用して指定時間後(設定ファイル)に雨が降るかどうかを知らせる. [DESCRIPTION] YOLP(気象情報) から降水強度を取得し, 指定時間後(設定ファイル)の降水強度が閾値(設定ファイル)以上である場合に, 指定の音声ファイル(設定ファイル)を再生する. YOLP(気象情報): https://developer.yahoo.co.jp/webapi/map/openlocalplatform/v1/weather.html """ import requests de...
Python
0
2368d4ae7f49f5e4ea97d3ce8fab57e17c385246
Change how keypoller checks for input
locust/input_events.py
locust/input_events.py
import gevent import logging import os if os.name == "nt": from win32api import STD_INPUT_HANDLE from win32console import ( GetStdHandle, KEY_EVENT, ENABLE_ECHO_INPUT, ENABLE_LINE_INPUT, ENABLE_PROCESSED_INPUT, ) else: import sys import select import term...
import gevent import logging import os if os.name == "nt": from win32api import STD_INPUT_HANDLE from win32console import ( GetStdHandle, KEY_EVENT, ENABLE_ECHO_INPUT, ENABLE_LINE_INPUT, ENABLE_PROCESSED_INPUT, ) else: import sys import select import term...
Python
0.000005
5fc8258c4d3819b6a4b23819fd3c4578510dd633
Allow www.lunahealing.ca as a domain
lunahealing/site_settings/prod.py
lunahealing/site_settings/prod.py
# Django settings for quotations project. import os from lunahealing.site_settings.common import * # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY') # Parse database configuration from $DATABASE_URL import dj_database_url DATABASES = { 'default': ...
# Django settings for quotations project. import os from lunahealing.site_settings.common import * # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY') # Parse database configuration from $DATABASE_URL import dj_database_url DATABASES = { 'default': ...
Python
0
ed472902f71f39cf09eca5ee9193bcf99283b566
Remove unused code
room.py
room.py
# Each PS room joined creates an object here. # Objects control settings on a room-per-room basis, meaning every room can # be treated differently. from plugins.tournaments import Tournament class Room: def __init__(self, room, data): if not data: # This is a hack to support both strings and di...
# Each PS room joined creates an object here. # Objects control settings on a room-per-room basis, meaning every room can # be treated differently. from plugins.tournaments import Tournament class Room: def __init__(self, room, data): if not data: # This is a hack to support both strings and di...
Python
0.000006
bd313ff4ce69e7b9a9765672442ef6cf9fa00dba
Fix parameter validation tests
tests/core/parameter_validation/test_parameter_clone.py
tests/core/parameter_validation/test_parameter_clone.py
import os from openfisca_core.parameters import ParameterNode BASE_DIR = os.path.dirname(os.path.abspath(__file__)) year = 2016 def test_clone(): path = os.path.join(BASE_DIR, 'filesystem_hierarchy') parameters = ParameterNode('', directory_path = path) parameters_at_instant = parameters('2016-01-01') ...
# -*- coding: utf-8 -*- from ..test_countries import tax_benefit_system import os from openfisca_core.parameters import ParameterNode BASE_DIR = os.path.dirname(os.path.abspath(__file__)) year = 2016 def test_clone(): path = os.path.join(BASE_DIR, 'filesystem_hierarchy') parameters = ParameterNode('', direct...
Python
0.000003
9bbef1ca463f0f83841c6b61ea8aa56c5454dadc
increment stop_id.....
ipa_db.py
ipa_db.py
import sqlite3 class Db: def __init__(self, db_name): self.conn = sqlite3.connect(db_name) def __del__(self): self.conn.close() def __execute(self, sql, args = tuple()): c = self.conn.cursor() c.execute(sql, args) return c def __commit(self): self.conn...
import sqlite3 class Db: def __init__(self, db_name): self.conn = sqlite3.connect(db_name) def __del__(self): self.conn.close() def __execute(self, sql, args = tuple()): c = self.conn.cursor() c.execute(sql, args) return c def __commit(self): self.conn...
Python
0
175a8007ef06bbf3a01943c161a162adbf23d7fd
Use tf.gfile instead of os.path in sequence_generator.py for internal compatibility. (#178)
magenta/lib/sequence_generator.py
magenta/lib/sequence_generator.py
# Copyright 2016 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
# Copyright 2016 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
Python
0
1f752237d83c486b94ddcc7f5e3b42eb5951a60b
remove unused imports
pabot/SharedLibrary.py
pabot/SharedLibrary.py
from robot.libraries.BuiltIn import BuiltIn from robot.libraries.Remote import Remote from robot.api import logger from robot.running.testlibraries import TestLibrary from robotremoteserver import RemoteLibraryFactory from .pabotlib import PABOT_QUEUE_INDEX class SharedLibrary(object): ROBOT_LIBRARY_SCOPE = 'GLOB...
from robot.libraries.BuiltIn import BuiltIn from robot.libraries.Remote import Remote from robot.api import logger from robot.running.testlibraries import TestLibrary from robot.running.context import EXECUTION_CONTEXTS from robot.running.model import Keyword from robotremoteserver import RemoteLibraryFactory from .pab...
Python
0.000001
140543f86b3947514c199ca770ee4799d2fe96a6
clean up
jsol.py
jsol.py
#!/usr/bin/env python import json def _add(args, env): args = map(lambda x: _Eval(x, env), args) return sum(args) def _sub(args, env): args = map(lambda x: _Eval(x, env), args) return reduce(lambda x, y: x - y, args) def _mult(args, env): args = map(lambda x: _Eval(x, env), args) return reduce(lam...
#!/usr/bin/env python import json def add(args, env): args = map(lambda x: eval(x, env), args) return sum(args) def sub(args, env): args = map(lambda x: eval(x, env), args) return reduce(lambda x, y: x - y, args) def mult(args, env): args = map(lambda x: eval(x, env), args) return reduce(lambda x,...
Python
0.000001
1f4ef496f932ec2a12d348b0c90b1f57d6ef9e20
update version number
nutils/__init__.py
nutils/__init__.py
import numpy from distutils.version import LooseVersion assert LooseVersion(numpy.version.version) >= LooseVersion('1.8'), 'nutils requires numpy 1.8 or higher, got %s' % numpy.version.version version = '2.0beta' _ = numpy.newaxis __all__ = [ '_', 'numpy', 'core', 'numeric', 'element', 'function', 'mesh', 'plot', ...
import numpy from distutils.version import LooseVersion assert LooseVersion(numpy.version.version) >= LooseVersion('1.8'), 'nutils requires numpy 1.8 or higher, got %s' % numpy.version.version version = '1.dev' _ = numpy.newaxis __all__ = [ '_', 'numpy', 'core', 'numeric', 'element', 'function', 'mesh', 'plot', 'l...
Python
0.000002
577697301f8682293a00a793807687df9d0ce679
Fix fetch_ceph_keys to run in python3
docker/ceph/ceph-mon/fetch_ceph_keys.py
docker/ceph/ceph-mon/fetch_ceph_keys.py
#!/usr/bin/python # Copyright 2015 Sam Yaple # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
#!/usr/bin/python # Copyright 2015 Sam Yaple # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
Python
0.000016
b4acd028b613a721ffbe5a3136700f190635f7c9
Fix import.
tests/basics/class_store_class.py
tests/basics/class_store_class.py
# Inspired by urlparse.py from CPython 3.3 stdlib # There was a bug in MicroPython that under some conditions class stored # in instance attribute later was returned "bound" as if it was a method, # which caused class constructor to receive extra argument. from _collections import namedtuple _DefragResultBase = namedt...
# Inspired by urlparse.py from CPython 3.3 stdlib # There was a bug in MicroPython that under some conditions class stored # in instance attribute later was returned "bound" as if it was a method, # which caused class constructor to receive extra argument. from collections import namedtuple _DefragResultBase = namedtu...
Python
0
7a331edf955d914c82751eb7ec1dd20896e25f83
Use SequenceEqual because we care about maintaining order.
tests/cases/stats/tests/kmeans.py
tests/cases/stats/tests/kmeans.py
import os from django.test import TestCase from avocado.stats import cluster, kmeans from scipy.cluster import vq import numpy from itertools import chain __all__ = ('KmeansTestCase',) random_points_file = open(os.path.join(os.path.dirname(__file__), '../fixtures/random_points.txt')) random_points_3d_file = open(os.p...
import os from django.test import TestCase from avocado.stats import cluster, kmeans from scipy.cluster import vq import numpy from itertools import chain __all__ = ('KmeansTestCase',) random_points_file = open(os.path.join(os.path.dirname(__file__), '../fixtures/random_points.txt')) random_points_3d_file = open(os.p...
Python
0
268914e7a29231da882457a6e4744c9661526a73
Add latest version of py-tabulate (#14138)
var/spack/repos/builtin/packages/py-tabulate/package.py
var/spack/repos/builtin/packages/py-tabulate/package.py
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PyTabulate(PythonPackage): """Pretty-print tabular data""" homepage = "https://bitbuc...
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PyTabulate(PythonPackage): """Pretty-print tabular data""" homepage = "https://bitbuc...
Python
0
b286e10d7d7c43ceea80cd4025105851ebb9bd8f
Comment out save statement
s4v3.py
s4v3.py
from s4v2 import * import openpyxl from openpyxl import Workbook from openpyxl.writer.excel import ExcelWriter from openpyxl.cell import get_column_letter def save_spreadsheet(filename, data_sample): wb = Workbook() # shortcut for typing Workbook function ws = wb.active # shortcut for typing active workbook function...
from s4v2 import * import openpyxl from openpyxl import Workbook from openpyxl.writer.excel import ExcelWriter from openpyxl.cell import get_column_letter def save_spreadsheet(filename, data_sample): wb = Workbook() # shortcut for typing Workbook function ws = wb.active # shortcut for typing active workbook function...
Python
0
5dd61d20f14ecbe1bc20fe8db3fd73a78707485a
Refactor partition.
lazy.py
lazy.py
import operator as op import itertools as it from functools import partial from collections import deque class Wrapper(object): def __init__(self, data): self.data = data def __lt__(self, other): print 'comparing', self.data, other.data return self.data < other.data def partition(pre...
import operator as op import itertools as it from functools import partial class Wrapper(object): def __init__(self, data): self.data = data def __lt__(self, other): print 'comparing', self.data, other.data return self.data < other.data def partition(predicate, iterable): pack = ...
Python
0
14f0afc20c9d6c200c6e9fa52a4121c98d349be7
Set version 0.2.5
pages/__init__.py
pages/__init__.py
# -*- coding: utf-8 -*- VERSION = (0, 2, 5) __version__ = '.'.join(map(str, VERSION))
# -*- coding: utf-8 -*- VERSION = (0, 2, 4) __version__ = '.'.join(map(str, VERSION))
Python
0.000001
d282d5525c4d965dbe0a6ee4967a14f1f412f2b4
update version number from 1.4 to 1.5
oauth2/_version.py
oauth2/_version.py
# This is the version of this source code. manual_verstr = "1.5" auto_build_num = "143" verstr = manual_verstr + "." + auto_build_num try: from pyutil.version_class import Version as pyutil_Version __version__ = pyutil_Version(verstr) except (ImportError, ValueError): # Maybe there is no pyutil insta...
# This is the version of this source code. manual_verstr = "1.4" auto_build_num = "143" verstr = manual_verstr + "." + auto_build_num try: from pyutil.version_class import Version as pyutil_Version __version__ = pyutil_Version(verstr) except (ImportError, ValueError): # Maybe there is no pyutil insta...
Python
0.000009
7bfc2287d15198d9e37b4def4632481c8446a932
bump version
bread/__init__.py
bread/__init__.py
VERSION = '0.6.0'
VERSION = '0.5.1'
Python
0
928c3bb38f4fa24d082ea18db09ff4542b78466c
remove units from x gt 1 example
docs/source/examples/x_greaterthan_1.py
docs/source/examples/x_greaterthan_1.py
from gpkit import Variable, GP # Decision variable x = Variable('x') # Constraint constraints = [x >= 1] # Objective (to minimize) objective = x # Formulate the GP gp = GP(objective, constraints) # Solve the GP sol = gp.solve() # Print results table print sol.table()
from gpkit import Variable, GP # Decision variable x = Variable("x", "m", "A really useful variable called x with units of meters") # Constraint constraint = [1/x <= 1] # Objective (to minimize) objective = x # Formulate the GP gp = GP(objective, constraint) # Solve the GP sol = gp.solve() # Print results table p...
Python
0
5d30c02f9adb7de3ce9eebef5178466711d96c64
Remove unused import: `RelatedField`
rest_framework_json_api/utils.py
rest_framework_json_api/utils.py
from django.utils.encoding import force_text from django.utils.text import slugify try: from rest_framework.serializers import ManyRelatedField except ImportError: ManyRelatedField = type(None) try: from rest_framework.serializers import ListSerializer except ImportError: ListSerializer = type(None) ...
from django.utils.encoding import force_text from django.utils.text import slugify from rest_framework.serializers import RelatedField try: from rest_framework.serializers import ManyRelatedField except ImportError: ManyRelatedField = type(None) try: from rest_framework.serializers import ListSerializer ...
Python
0
07ac69ef3f722ae57bc0cc61c30a2378c8c53c2e
Fix mutable default argument problem
live.py
live.py
""" Parses http://www.live-footballontv.com for info about live matches """ import re import requests from bs4 import BeautifulSoup from datetime import datetime, timedelta url = 'http://www.live-footballontv.com' headers = {'User-Agent': 'Football Push Notifications'} def convert_date(date): """Returns datetime...
""" Parses http://www.live-footballontv.com for info about live matches """ import re import requests from bs4 import BeautifulSoup from datetime import datetime, timedelta url = 'http://www.live-footballontv.com' headers = {'User-Agent': 'Football Push Notifications'} def convert_date(date): """Returns datetime...
Python
0.000007