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
54296c607b735ce06b3420efecb312f52876e012
Replace warning message with deprecation warning
django_react_templatetags/context_processors.py
django_react_templatetags/context_processors.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import warnings def react_context_processor(request): """Expose a global list of react components to be processed""" warnings.warn( "react_context_processor is no longer required.", DeprecationWarning ) return { 'REACT_COMPONENTS': [], ...
#!/usr/bin/env python # -*- coding: utf-8 -*- def react_context_processor(request): """Expose a global list of react components to be processed""" print("react_context_processor is no longer required.") return { 'REACT_COMPONENTS': [], }
Python
0.999999
1a301f19a754e8bb3dfb1d7697193ccc90d82c33
Fix unit tests
django_tenants/tests/test_filesystem_storage.py
django_tenants/tests/test_filesystem_storage.py
import warnings from django.db import connection from django.core.files.base import ContentFile from django.test import override_settings from django_tenants import utils from django_tenants.files.storage import TenantFileSystemStorage from django_tenants.files.storages import TenantFileSystemStorage as OldTenantFile...
import warnings from django.db import connection from django.core.files.base import ContentFile from django.test import override_settings from django_tenants import utils from django_tenants.files.storage import TenantFileSystemStorage from django_tenants.files.storages import TenantFileSystemStorage as OldTenantFile...
Python
0.000005
2b7e0d52a8a8764b66d8698800bf18e8adc9dae7
fix crash when running fix_loop_duplicates.py
dojo/management/commands/fix_loop_duplicates.py
dojo/management/commands/fix_loop_duplicates.py
from django.core.management.base import BaseCommand from dojo.utils import fix_loop_duplicates """ Author: Marian Gawron This script will identify loop dependencies in findings """ class Command(BaseCommand): help = 'No input commands for fixing Loop findings.' def handle(self, *args, **options): fi...
from django.core.management.base import BaseCommand from pytz import timezone from dojo.utils import fix_loop_duplicates locale = timezone(get_system_setting('time_zone')) """ Author: Marian Gawron This script will identify loop dependencies in findings """ class Command(BaseCommand): help = 'No input commands ...
Python
0.000003
e776ac5b08fa2a7ce299ec68697d330fb8a02fd5
upgrade __version__ in __init__.py to 1.4.0
django_nose/__init__.py
django_nose/__init__.py
VERSION = (1, 4, 0) __version__ = '.'.join(map(str, VERSION)) from django_nose.runner import * from django_nose.testcases import * # Django < 1.2 compatibility. run_tests = run_gis_tests = NoseTestSuiteRunner
VERSION = (1, 3, 0) __version__ = '.'.join(map(str, VERSION)) from django_nose.runner import * from django_nose.testcases import * # Django < 1.2 compatibility. run_tests = run_gis_tests = NoseTestSuiteRunner
Python
0.00002
eec67d43d208b490c9d219b3c38e586597b1fa73
Refactor generate_module_objects
pytest_wish.py
pytest_wish.py
# -*- coding: utf-8 -*- import importlib import inspect import re import sys import pytest def pytest_addoption(parser): group = parser.getgroup('wish') group.addoption('--wish-modules', default=(), nargs='+', help="Space separated list of module names.") group.addoption('--wish-incl...
# -*- coding: utf-8 -*- import importlib import inspect import re import sys import pytest def pytest_addoption(parser): group = parser.getgroup('wish') group.addoption('--wish-modules', default=(), nargs='+', help="Space separated list of module names.") group.addoption('--wish-incl...
Python
0.000002
93e12746d19161b30e2dade0d71f22242603b0bd
Address fix
python/test.py
python/test.py
import math from roboclaw import Roboclaw address = 0x80 rc = Roboclaw("/dev/roboclaw",115200) rc.Open() version = rc.ReadVersion(address) if version[0]==False: print "GETVERSION Failed" else: print repr(version[1]) rc.SetM1VelocityPID(address,3000,300,0,708) rc.SetM2VelocityPID(address,3000,300,0,720) rc.WriteNVM(ad...
import math from roboclaw import Roboclaw address = 0x80 rc = Roboclaw("/dev/roboclaw",115200) rc.Open() version = rc.ReadVersion(address) if version[0]==False: print "GETVERSION Failed" else: print repr(version[1]) rc.SetM1VelocityPID(rc_address,3000,300,0,708) rc.SetM2VelocityPID(rc_address,3000,300,0,720) rc.Write...
Python
0.000001
b860606c2ce654044131228ddfb741c517ab282e
make QLibraryInfo.location works
qtpy/QtCore.py
qtpy/QtCore.py
# # Copyright © 2014-2015 Colin Duquesnoy # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) """ Provides QtCore classes and functions. """ from . import PYQT6, PYQT5, PYSIDE2, PYSIDE6, PythonQtError if PYQT6: from PyQt6 import QtCore ...
# # Copyright © 2014-2015 Colin Duquesnoy # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) """ Provides QtCore classes and functions. """ from . import PYQT6, PYQT5, PYSIDE2, PYSIDE6, PythonQtError if PYQT6: from PyQt6 import QtCore ...
Python
0
34b6d5c04e51e95874141d746dbfc6e16fcca967
Use capital letters in all view name words
reddit/urls.py
reddit/urls.py
"""django_reddit URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.8/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Cla...
"""django_reddit URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.8/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Cla...
Python
0.00001
4394515cd5632a7f110993ff75033d407d10861d
Fix stray '.' in import statement.
doc/cdoc/numpyfilter.py
doc/cdoc/numpyfilter.py
#!/usr/bin/env python """ numpyfilter.py INPUTFILE Interpret C comments as ReStructuredText, and replace them by the HTML output. Also, add Doxygen /** and /**< syntax automatically where appropriate. """ from __future__ import division, absolute_import import sys import re import os import textwrap import optparse ...
#!/usr/bin/env python """ numpyfilter.py INPUTFILE Interpret C comments as ReStructuredText, and replace them by the HTML output. Also, add Doxygen /** and /**< syntax automatically where appropriate. """ from __future__ import division, absolute_import import sys import re import os import textwrap import optparse ...
Python
0
21102267231fbdc171b670d62f5ee8baf7d4d4c4
Add multiplication operation
calc.py
calc.py
import sys def add_all(nums): return sum(nums) def multiply_all(nums): return reduce(lambda a, b: a * b, nums) if __name__ == '__main__': command = sys.argv[1] nums = map(float, sys.argv[2:]) if command == 'add': print(add_all(nums)) elif command == 'multiply': print(multiply_...
import sys def add_all(nums): return sum(nums) if __name__ == '__main__': command = sys.argv[1] nums = map(float, sys.argv[2:]) if command == 'add': print(add_all(nums))
Python
0.999777
f6fdbdc1176cffa0a145170cab583387f26f8649
Add module docstring
calc.py
calc.py
"""calc.py: A simple python calculator.""" import sys if __name__ == '__main__': print(sum(map(int, sys.argv[1:])))
import sys if __name__ == '__main__': print(sum(map(int, sys.argv[1:])))
Python
0.000001
5fd51adbbc136adc28725688c7bf1ecf56e978c1
Develop (#105)
auth/auth_backend.py
auth/auth_backend.py
""" auth_backend.py Peter Zujko (@zujko) Defines Django authentication backend for shibboleth. 04/05/17 """ from django.contrib.auth.models import User class Attributes(): EDU_AFFILIATION = 'urn:oid:1.3.6.1.4.1.4447.1.41' FIRST_NAME = 'urn:oid:2.5.4.42' LAST_NAME = 'urn:oid:2.5.4.4' USERNAME = 'urn:...
""" auth_backend.py Peter Zujko (@zujko) Defines Django authentication backend for shibboleth. 04/05/17 """ from django.contrib.auth.models import User class Attributes(): EDU_AFFILIATION = 'urn:oid:1.3.6.1.4.1.4447.1.41' FIRST_NAME = 'urn:oid:2.5.4.42' LAST_NAME = 'urn:oid:2.5.4.4' USERNAME = 'urn:...
Python
0
b8f63a7517d6c6189bda0d213ae797c8905868b4
add visualization method to see tissue outline in DSA
histomicstk/saliency/tests/tissue_detection_test.py
histomicstk/saliency/tests/tissue_detection_test.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Sep 18 00:06:28 2019. @author: mtageld """ import unittest import os import tempfile import shutil from imageio import imread, imwrite import girder_client import numpy as np # from matplotlib import pylab as plt # from matplotlib.colors import Listed...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Sep 18 00:06:28 2019. @author: mtageld """ import unittest import os import tempfile import shutil from imageio import imread, imwrite import girder_client import numpy as np # from matplotlib import pylab as plt # from matplotlib.colors import Listed...
Python
0
95ead630018870f293613febc599a50e8c69c792
Change in field length
hs_core/migrations/0030_resourcefile_file_folder.py
hs_core/migrations/0030_resourcefile_file_folder.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('hs_core', '0029_auto_20161123_1858'), ] operations = [ migrations.AddField( model_name='resourcefile', ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('hs_core', '0029_auto_20161123_1858'), ] operations = [ migrations.AddField( model_name='resourcefile', ...
Python
0.000001
0fc84d4cefde2446f3fbb2ab77d48c0f557d2496
Complete pyinstaller hooks.
kivy/tools/packaging/pyinstaller_hooks/hook-kivy.py
kivy/tools/packaging/pyinstaller_hooks/hook-kivy.py
''' Kivy hook for PyInstaller ========================= Kivy load itself in a complete dynamic way. PyImported don't see most of the import cause of the Factory and Core. In addition, the data and missing module are not copied automatically. With this hook, everything needed for running kivy is correctly copied. Che...
''' Kivy hook for PyInstaller ========================= Kivy load itself in a complete dynamic way. PyImported don't see most of the import cause of the Factory and Core. In addition, the data and missing module are not copied automatically. With this hook, everything needed for running kivy is correctly copied. Che...
Python
0
9b9d6db9d99bec69e61070a743d0b2194c35e375
Mark as dead
module/plugins/hoster/FreevideoCz.py
module/plugins/hoster/FreevideoCz.py
# -*- coding: utf-8 -*- from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class FreevideoCz(DeadHoster): __name__ = "FreevideoCz" __version__ = "0.3" __type__ = "hoster" __pattern__ = r'http://(?:www\.)?freevideo\.cz/vase-videa/.+' __description__ = """Freevideo.cz hoste...
# -*- coding: utf-8 -*- """ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in...
Python
0.00004
1fed9f26010f24af14abff9444862ed0861adb63
Add simplification between parsing and execution
thinglang/runner.py
thinglang/runner.py
from thinglang.execution.execution import ExecutionEngine from thinglang.lexer.lexer import lexer from thinglang.parser.parser import parse from thinglang.parser.simplifier import simplify def run(source): if not source: raise ValueError('Source cannot be empty') source = source.strip().replace(' ' *...
from thinglang.execution.execution import ExecutionEngine from thinglang.lexer.lexer import lexer from thinglang.parser.parser import parse def run(source): if not source: raise ValueError('Got empty source') source = source.strip().replace(' ' * 4, '\t') lexical_groups = list(lexer(source)) ...
Python
0.000066
e57e003b85f0a88ac6e3c19d5765144f95ac9959
Increase version to 0.3.2rc
tmserver/version.py
tmserver/version.py
# TmServer - TissueMAPS server application. # Copyright (C) 2016 Markus D. Herrmann, University of Zurich and Robin Hafen # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version...
# TmServer - TissueMAPS server application. # Copyright (C) 2016 Markus D. Herrmann, University of Zurich and Robin Hafen # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version...
Python
0.000002
c09bfe422d6dd705e5e38402dd8754f461fabe59
Support filtering by list of jobNo
tools/accounting.py
tools/accounting.py
#!/usr/bin/env python3 """ collection: gisds.accountinglogs """ #--- standard library imports # from argparse import ArgumentParser from datetime import datetime import os from pprint import PrettyPrinter import sys from time import gmtime, strftime #--- project specific imports # # add lib dir for this pipeline ins...
#!/usr/bin/env python3 """ collection: gisds.accountinglogs """ #--- standard library imports # from argparse import ArgumentParser from datetime import datetime import os from pprint import PrettyPrinter import sys from time import gmtime, strftime #--- project specific imports # # add lib dir for this pipeline ins...
Python
0.000001
5ac6c93073c98ea17a0786e6e1a1de3837e460d9
Handle RSS feeds for blogs that don't have dates
observatory/dashboard/models/Blog.py
observatory/dashboard/models/Blog.py
# Copyright (c) 2010, Nate Stedman <natesm@gmail.com> # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUT...
# Copyright (c) 2010, Nate Stedman <natesm@gmail.com> # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUT...
Python
0
ff30fbd3adef0de27c7b3f690fff1c47c6d42b6a
set tree self.depth to minDepth
DecisionTree.py
DecisionTree.py
class Node: def __init__(self, data=None): self.data = data self.left = None self.right = None class Tree: def __init__(self, dataset, minDepth): self.root = None self.left = None self.right = None self.data = dataset self.depth = minDepth ...
class Node: def __init__(self, data=None): self.data = data self.left = None self.right = None class Tree: # passing (object ) into class is no longer needed in python3 def __init__(self, dataset, minDepth, depth = 3): self.root = None self.left = None self.rig...
Python
0
3976ad2e9d1ded6d36bced785b88ea186af5b01f
add urlencode
ItasaFlexGet.py
ItasaFlexGet.py
import urllib, urllib2, cookielib,urlparse import os from contextlib import closing from flexget.plugin import register_plugin from BeautifulSoup import BeautifulSoup BASE_PATH = 'http://www.italiansubs.net/index.php' class Itasa(object): """ rss: http://www.italiansubs.net/index.php?option=com_rsssub... #...
import urllib, urllib2, cookielib,urlparse import os from contextlib import closing from flexget.plugin import register_plugin from BeautifulSoup import BeautifulSoup BASE_PATH = 'http://www.italiansubs.net/index.php' class Itasa(object): """ rss: http://www.italiansubs.net/index.php?option=com_rsssub... #...
Python
0.000042
6ea2a6cf6af7dfdb7767c7961a3fd192d4739f2f
Add rudimentary encryption
seedbox/models.py
seedbox/models.py
import bz2 import os import pickle import click import paramiko class SeedBox(): """Simple interface to view recently available files.""" def __init__(self): self.home_dir = os.path.expanduser('~') self.config_file = os.path.join(self.home_dir, '.sbconfig') if not self._has_creds():...
import os import pickle import click import paramiko class SeedBox(): """Simple interface to view recently available files.""" def __init__(self): self.home_dir = os.path.expanduser('~') self.config_file = os.path.join(self.home_dir, '.sbconfig') if not self._has_creds(): ...
Python
0.999993
2fd677035118b80e4dfb04e380b526b3264492eb
Remove debugger (oops)
holmes/material.py
holmes/material.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys from uuid import uuid4 from functools import partial from collections import defaultdict from holmes.cli import BaseCLI from holmes.models.domain import Domain from holmes.models.page import Page from holmes.models.violation import Violation from holmes.utils i...
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys from uuid import uuid4 from functools import partial from collections import defaultdict from holmes.cli import BaseCLI from holmes.models.domain import Domain from holmes.models.page import Page from holmes.models.violation import Violation from holmes.utils i...
Python
0
b1d83fc13ec2d71e78fea406f76c48d5cc528f46
Fix imports
spacy/ml/models/parser.py
spacy/ml/models/parser.py
from typing import Optional, List from thinc.api import Model, chain, list2array, Linear, zero_init, use_ops from thinc.types import Floats2d from ...util import registry from .._precomputable_affine import PrecomputableAffine from ..tb_framework import TransitionModel @registry.architectures.register("spacy.Transit...
from typing import Optional from thinc.api import Model, chain, list2array, Linear, zero_init, use_ops from ...util import registry from .._precomputable_affine import PrecomputableAffine from ..tb_framework import TransitionModel @registry.architectures.register("spacy.TransitionBasedParser.v1") def build_tb_parser...
Python
0.000002
a5bef7ac44a688b9d4493c28210a1a3fbcb64ffe
Fix channel comparison with # prefix
slackclient/_channel.py
slackclient/_channel.py
class Channel(object): def __init__(self, server, name, channel_id, members=None): self.server = server self.name = name self.id = channel_id self.members = [] if members is None else members def __eq__(self, compare_str): if self.name == compare_str or "#" + self.name =...
class Channel(object): def __init__(self, server, name, channel_id, members=None): self.server = server self.name = name self.id = channel_id self.members = [] if members is None else members def __eq__(self, compare_str): if self.name == compare_str or self.name == "#" ...
Python
0
a2a652620fa4d7504baa42f08fc80bd2a7db1341
Make frozendict peristently-hasheable
edgedb/lang/common/datastructures/immutables.py
edgedb/lang/common/datastructures/immutables.py
## # Copyright (c) 2008-2010, 2014 Sprymix Inc. # All rights reserved. # # See LICENSE for details. ## import abc import collections from metamagic.utils.algos.persistent_hash import persistent_hash class ImmutableMeta(type): def __new__(mcls, name, bases, dct): if '_shadowed_methods_' in dct: ...
## # Copyright (c) 2008-2010 Sprymix Inc. # All rights reserved. # # See LICENSE for details. ## import abc import collections class ImmutableMeta(type): def __new__(mcls, name, bases, dct): if '_shadowed_methods_' in dct: shadowed = dct['_shadowed_methods_'] del dct['_shadowed_m...
Python
0.000004
4cda993213fce2b4567ba31f2dc6a116445ce664
rollback on dummy database now has no effect (previously raised an error). This means that custom 500 error pages (and e-mailed exceptions) now work even if a database has not been configured. Fixes #4429.
django/db/backends/dummy/base.py
django/db/backends/dummy/base.py
""" Dummy database backend for Django. Django uses this if the DATABASE_ENGINE setting is empty (None or empty string). Each of these API functions, except connection.close(), raises ImproperlyConfigured. """ from django.core.exceptions import ImproperlyConfigured def complain(*args, **kwargs): raise Improperly...
""" Dummy database backend for Django. Django uses this if the DATABASE_ENGINE setting is empty (None or empty string). Each of these API functions, except connection.close(), raises ImproperlyConfigured. """ from django.core.exceptions import ImproperlyConfigured def complain(*args, **kwargs): raise Improperly...
Python
0.000004
1ec9d3b5d7a2fdfd6e7d0e763c95e1a3117cd96d
Update middleware to be django1.10-compatible
django_user_agents/middleware.py
django_user_agents/middleware.py
from django.utils.functional import SimpleLazyObject from django.utils.deprecation import MiddlewareMixin from .utils import get_user_agent class UserAgentMiddleware(MiddlewareMixin): # A middleware that adds a "user_agent" object to request def process_request(self, request): request.user_agent = Si...
from django.utils.functional import SimpleLazyObject from .utils import get_user_agent class UserAgentMiddleware(object): # A middleware that adds a "user_agent" object to request def process_request(self, request): request.user_agent = SimpleLazyObject(lambda: get_user_agent(request))
Python
0.000603
9fe4b5fee790b7e21eb5810176a2cfa49abde7b2
Create author obj only for active users
doc/deployer/create_auth_objs.py
doc/deployer/create_auth_objs.py
from gnowsys_ndf.ndf.models import * from django.contrib.auth.models import User all_users = User.objects.all() auth_gst = node_collection.one({'_type': u'GSystemType', 'name': u'Author'}) new_auth_instances = 0 for each_user in all_users: auth = node_collection.one({'_type': u"Author", 'created_by': int(each_user.id)...
from gnowsys_ndf.ndf.models import * from django.contrib.auth.models import User all_users = User.objects.all() auth_gst = node_collection.one({'_type': u'GSystemType', 'name': u'Author'}) new_auth_instances = 0 for each_user in all_users: auth = node_collection.one({'_type': u"Author", 'created_by': int(each_user.id)...
Python
0
69f28c471935d5e8136a4b32f51310f1f46046f0
set lower for envvar keys
docku/build/__init__.py
docku/build/__init__.py
import json import os class BuildConfig(dict): def __init__(self, path): cc = {} with open(path) as fh: cc = json.load(fh) super().__init__(cc) self.populate_envvars() def populate_envvars(self): keys = ['BINTRAY_TOKEN', 'BINTRAY_USER', 'BINTRAY_REPO'] ...
import json import os class BuildConfig(dict): def __init__(self, path): cc = {} with open(path) as fh: cc = json.load(fh) super().__init__(cc) self.populate_envvars() def populate_envvars(self): keys = ['BINTRAY_TOKEN', 'BINTRAY_USER', 'BINTRAY_REPO'] ...
Python
0.000002
b289569a228ff574f2c469d0d2a7fbb019c19c9e
Update version
snipsskills/__init__.py
snipsskills/__init__.py
# -*-: coding utf-8 -*- """ snipsskills module """ __version__ = '0.1.4.935'
# -*-: coding utf-8 -*- """ snipsskills module """ __version__ = '0.1.4.934'
Python
0
45e515efbe7242f3f8871242cd1ddb7ceb29ae32
fix file perms
src/main/python/netkraken/__init__.py
src/main/python/netkraken/__init__.py
from datetime import datetime, timedelta import os settings = { "stagedir": "/tmp/netconns/__stage__", "finaldir": "/tmp/netconns/final"} formats = { "day": "%Y-%m-%d", "hour": "%Y-%m-%dT%H", "minute": "%Y-%m-%dT%H:%M"} thresholds = { "day": timedelta(days=14), "hour": timedelta(hours=4*...
from datetime import datetime, timedelta import os settings = { "stagedir": "/tmp/netconns/__stage__", "finaldir": "/tmp/netconns/final"} formats = { "day": "%Y-%m-%d", "hour": "%Y-%m-%dT%H", "minute": "%Y-%m-%dT%H:%M"} thresholds = { "day": timedelta(days=14), "hour": timedelta(hours=4*...
Python
0.000001
bc7c3322e027578f79119e6836111244ba1445cc
revert out
autonetkit/config.py
autonetkit/config.py
import pkg_resources import ConfigParser from configobj import ConfigObj, flatten_errors import os import validate validator = validate.Validator() import os.path # from http://stackoverflow.com/questions/4028904 ank_user_dir = os.path.join(os.path.expanduser("~"), ".autonetkit") def load_config(): settings = C...
import pkg_resources import ConfigParser from configobj import ConfigObj, flatten_errors import os import validate validator = validate.Validator() import os.path #TODO: check this works on Windows ank_user_dir = os.path.join(os.environ['HOME'], ".autonetkit") def load_config(): settings = ConfigParser.RawConfi...
Python
0.000001
d6a229deb0db1b8ef050e2271b25da73d1117cc8
add element properties
library/pyjamas/ui/__init__.py
library/pyjamas/ui/__init__.py
# Copyright 2006 James Tauber and contributors # Copyright 2009 Luke Kenneth Casson Leighton # # 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...
# Copyright 2006 James Tauber and contributors # Copyright 2009 Luke Kenneth Casson Leighton # # 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...
Python
0.000001
cba6caf0eed1efce421926abaa14742893dd1bbd
remove trailing empty line (PEP8 conformance)
debsources/tests/test_filetype.py
debsources/tests/test_filetype.py
# Copyright (C) 2013-2015 The Debsources developers <info@sources.debian.net>. # See the AUTHORS file at the top-level directory of this distribution and at # https://anonscm.debian.org/gitweb/?p=qa/debsources.git;a=blob;f=AUTHORS;hb=HEAD # # This file is part of Debsources. Debsources is free software: you can # redi...
# Copyright (C) 2013-2015 The Debsources developers <info@sources.debian.net>. # See the AUTHORS file at the top-level directory of this distribution and at # https://anonscm.debian.org/gitweb/?p=qa/debsources.git;a=blob;f=AUTHORS;hb=HEAD # # This file is part of Debsources. Debsources is free software: you can # redi...
Python
0
080b967c0854d416532449dba96bbbd8f0318d8a
remove time_per_record since it does not make real sense
pikos/benchmark/monitors.py
pikos/benchmark/monitors.py
# -*- coding: utf-8 -*- #------------------------------------------------------------------------------ # Package: Pikos toolkit # File: benchmark/monitors.py # License: LICENSE.TXT # # Copyright (c) 2012, Enthought, Inc. # All rights reserved. #---------------------------------------------------------------------...
# -*- coding: utf-8 -*- #------------------------------------------------------------------------------ # Package: Pikos toolkit # File: benchmark/monitors.py # License: LICENSE.TXT # # Copyright (c) 2012, Enthought, Inc. # All rights reserved. #---------------------------------------------------------------------...
Python
0.000181
9b52967bd0b4fcf411ce4303170fa77d1d417669
fix repr exception when using raven
dpark/task.py
dpark/task.py
import os,os.path import socket import marshal import cPickle import logging import struct from dpark.util import compress, decompress, atomic_file from dpark.serialize import marshalable, load_func, dump_func, dumps, loads from dpark.shuffle import LocalFileShuffle logger = logging.getLogger(__name__) class Task: ...
import os,os.path import socket import marshal import cPickle import logging import struct from dpark.util import compress, decompress, atomic_file from dpark.serialize import marshalable, load_func, dump_func, dumps, loads from dpark.shuffle import LocalFileShuffle logger = logging.getLogger(__name__) class Task: ...
Python
0.000001
a477de34625f9fc4076eaa093b606463063e33b3
add check if TwitterAPI was installed and installed it if not
gimp_be/network/twitter.py
gimp_be/network/twitter.py
from gimp_be.settings.settings import * from gimp_be.utils.string_tools import * from gimp_be.utils.pip import * try: import TwitterAPI except: pipInstall("TwitterAPI") def tweetImage(message,image_file): """ Tweet image with message :param message: :param image_file: :return: """ f...
from gimp_be.settings.settings import * from gimp_be.utils.string_tools import * def tweetImage(message,image_file): """ Tweet image with message :param message: :param image_file: :return: """ from TwitterAPI import TwitterAPI global settings_data CONSUMER_KEY = settings_data['twi...
Python
0
6138f02896bc865a98480be36300bf670a6defa8
Replace re by os.path utils
plugin/complete_database.py
plugin/complete_database.py
import vim import re import json from os import path curr_file = vim.eval("expand('%:p')") curr_file_noext = path.splitext(curr_file)[0] ccd = vim.eval("l:ccd") opts = [] with open(ccd) as database: # Search for the right entry in the database matching file names for d in json.load(database): # This ...
import vim import re import json from os import path current = vim.eval("expand('%:p')") ccd = vim.eval("l:ccd") opts = [] with open(ccd) as database: data = json.load(database) for d in data: # hax for headers fmatch = re.search(r'(.*)\.(\w+)$', current) dmatch = re.search(r'(.*)\.(\...
Python
0
cf056c8840e224a1f15478832434c7df33fa97f8
Limit Urban Dictionary definition to 300 characters
plugins/urbandict/plugin.py
plugins/urbandict/plugin.py
import logging from cardinal.decorators import command, help import requests from twisted.internet import defer from twisted.internet.threads import deferToThread URBANDICT_API_PREFIX = 'http://api.urbandictionary.com/v0/define' class UrbanDictPlugin: def __init__(self): self.logger = logging.getLogger...
import logging from cardinal.decorators import command, help import requests from twisted.internet import defer from twisted.internet.threads import deferToThread URBANDICT_API_PREFIX = 'http://api.urbandictionary.com/v0/define' class UrbanDictPlugin: def __init__(self): self.logger = logging.getLogger...
Python
0.998394
7903c7604a54a8786a5d4b658c224b6d28ed43af
Add iterator for lists
popeui/widgets/structure.py
popeui/widgets/structure.py
from .base import BaseContainer from .abstract import HeadLink class Document(BaseContainer): """ A document. Analogous to the HTML ``<html>`` element. """ html_tag = "html" def __init__(self, id, view, classname=None, parent=None, **kwargs): """ :param view: :class:`~.application.View` in which t...
from .base import BaseContainer from .abstract import HeadLink class Document(BaseContainer): """ A document. Analogous to the HTML ``<html>`` element. """ html_tag = "html" def __init__(self, id, view, classname=None, parent=None, **kwargs): """ :param view: :class:`~.application.View` in which t...
Python
0.000002
19b6aecd0cc2a1447c0f659d3aa5565e66c4a7e7
Handle uniqueness in generators
populous/generators/base.py
populous/generators/base.py
import random from cached_property import cached_property from faker import Factory from populous.exceptions import ValidationError from populous.generators.vars import Expression fake = Factory.create() class BaseGenerator(object): def __init__(self, item, field_name, **kwargs): self.item = item ...
import random from cached_property import cached_property from faker import Factory from populous.exceptions import ValidationError from populous.generators.vars import Expression fake = Factory.create() class BaseGenerator(object): def __init__(self, item, field_name, **kwargs): self.item = item ...
Python
0.000001
e43d0190c00e9b0b0f2cc72900ac288d33fae435
add missing names to easy:consume_args, PavementError
trunk/paver/easy.py
trunk/paver/easy.py
import subprocess import sys from paver import tasks from paver.options import Bunch def dry(message, func, *args, **kw): """Wraps a function that performs a destructive operation, so that nothing will happen when a dry run is requested. Runs func with the given arguments and keyword arguments. If this ...
import subprocess import sys from paver import tasks from paver.options import Bunch def dry(message, func, *args, **kw): """Wraps a function that performs a destructive operation, so that nothing will happen when a dry run is requested. Runs func with the given arguments and keyword arguments. If this ...
Python
0.99623
c4b408bdf84333a5e41d10ee3d46f926069b5548
Delete deprecated with_coverage task
lutrisweb/settings/test.py
lutrisweb/settings/test.py
from base import * # noqa DEBUG = False DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', } } INSTALLED_APPS += ( 'django_jenkins', ) JENKINS_TASKS = ( 'django_jenkins.tasks.run_pylint', 'django_jenkins.tasks.run_pep8', ) PROJECT_APPS = ( ...
from base import * # noqa DEBUG = False DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', } } INSTALLED_APPS += ( 'django_jenkins', ) JENKINS_TASKS = ( 'django_jenkins.tasks.with_coverage', 'django_jenkins.tasks.run_pylint', 'django_jenkin...
Python
0.000012
421ace15d779cc686aa83489c0e965bbeabe49b9
Update script to repeat test set experiment 10 times
cptm/experiment_testset_without_perspectives.py
cptm/experiment_testset_without_perspectives.py
"""Script to extract a document/topic matrix for a set of text documents. The corpus is not divided in perspectives. Used to calculate theta for the CAP vragenuurtje data. """ import logging import argparse import pandas as pd import os from CPTCorpus import CPTCorpus from cptm.utils.experiment import get_sampler, t...
"""Script to extract a document/topic matrix for a set of text documents. The corpus is not divided in perspectives. Used to calculate theta for the CAP vragenuurtje data. """ import logging import argparse import pandas as pd import os from CPTCorpus import CPTCorpus from cptm.utils.experiment import get_sampler, t...
Python
0
0fe7cd8cf316dc6d4ef547d733b634de64fc768c
Add more options on filters
dbaas/dbaas_services/analyzing/admin/analyze.py
dbaas/dbaas_services/analyzing/admin/analyze.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from django_services import admin from dbaas_services.analyzing.service import AnalyzeRepositoryService from dbaas_services.analyzing.forms import AnalyzeRepositoryForm class AnalyzeRepositoryAdmin(admin.DjangoServicesAdmin): form = ...
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from django_services import admin from dbaas_services.analyzing.service import AnalyzeRepositoryService from dbaas_services.analyzing.forms import AnalyzeRepositoryForm class AnalyzeRepositoryAdmin(admin.DjangoServicesAdmin): form = ...
Python
0
4605dfb434d7a934e2fce39f96d73e66f17a682b
Handle missing settings file
i2vbot/settings.py
i2vbot/settings.py
#!/usr/bin/env python2 # Ampuni aku... :( import pickle SETTINGS_FILE = "data/settings.pickle" def loadSettings(settingsFile = SETTINGS_FILE): try: with open(settingsFile, 'r') as f: return pickle.load(f) except: return {} def saveSettings(settings, settingsFile = SETTINGS_FILE):...
#!/usr/bin/env python2 # Ampuni aku... :( import pickle SETTINGS_FILE = "data/settings.pickle" def loadSettings(settingsFile = SETTINGS_FILE): with open(settingsFile, 'r') as f: try: return pickle.load(f) except: return {} def saveSettings(settings, settingsFile = SETTING...
Python
0.000001
8bc3e371690ef28609f1999a4a3dabc0dd453850
Correct serve() to call serve_one() not listen_one()
uhttpsrv/uhttpsrv.py
uhttpsrv/uhttpsrv.py
import socket class uHTTPsrv: PROTECTED = [b'__init__', b'listen_once', b'listen', b'response_header', b'__qualname__', b'__module__', b'address', b'port', b'backlog', b'in_buffer_len', b'debug'] def __init__(self, address='', port=80, backlog=1, in_buffer_len=1024, debug=False): self.address = address self.po...
import socket class uHTTPsrv: PROTECTED = [b'__init__', b'listen_once', b'listen', b'response_header', b'__qualname__', b'__module__', b'address', b'port', b'backlog', b'in_buffer_len', b'debug'] def __init__(self, address='', port=80, backlog=1, in_buffer_len=1024, debug=False): self.address = address self.po...
Python
0.000169
d69aa85c74482354ff8788fb7b9692f0aee6d311
Fix it.
iepy/preprocess.py
iepy/preprocess.py
import logging logger = logging.getLogger(__name__) class PreProcessPipeline(object): """Coordinates the pre-processing tasks on a set of documents""" def __init__(self, step_runners, documents_manager): """Takes a list of callables and a documents-manager. Step Runners may be any calla...
import logging logger = logging.getLogger(__name__) class PreProcessPipeline(object): """Coordinates the pre-processing tasks on a set of documents""" def __init__(self, step_runners, documents_manager): """Takes a list of callables and a documents-manager. Step Runners may be any calla...
Python
0.999982
42743ac90ede1d9d78c892f1cee033c5e5a66c9b
fix typo in docker update script
.travis/docker/update_image.py
.travis/docker/update_image.py
#!/usr/bin/env python3 import os import subprocess import sys cc_mapping = {'gcc': 'g++', 'clang': 'clang++'} thisdir = os.path.dirname(os.path.abspath(__file__)) def update(commit, cc): gdt_super_dir = os.path.join(thisdir, '..', '..',) dockerfile = os.path.join(thisdir, 'dune-gdt-testing', 'Dockerfile') ...
#!/usr/bin/env python3 import os import subprocess import sys cc_mapping = {'gcc': 'g++', 'clang': 'clang++'} thisdir = os.path.dirname(os.path.abspath(__file__)) def update(commit, cc): gdt_super_dir = os.path.join(thisdir, '..', '..',) dockerfile = os.path.join(thisdir, 'dune-gdt-testing', 'Dockerfile') ...
Python
0.000005
4bddcadd7b177b764d2ee12370b635ec31f12288
change jumping
server/server1.py
server/server1.py
import socket, sys, commands, re import random, time, math import xlrd #controller default PORT and IP UDP_IP = 'controller-host' UDP_PORT_HELLO = 7777 UDP_PORT_INFO = 7778 UDP_OUT_PORT=5005 def getGreenEnergyValue(location_id, worksheet, row): energyValue = worksheet.cell(row,location_id).value return float(en...
import socket, sys, commands, re import random, time, math import xlrd #controller default PORT and IP UDP_IP = 'controller-host' UDP_PORT_HELLO = 7777 UDP_PORT_INFO = 7778 UDP_OUT_PORT=5005 def getGreenEnergyValue(location_id, worksheet, row): energyValue = worksheet.cell(row,location_id).value return float(en...
Python
0.000003
45ee385204d4a38ea904228d2648d266309332ab
fix shutdown command
server/sockets.py
server/sockets.py
import asyncio from aiohttp import web import socketio import hexdump from log import logname import frame from hardware import Hardware from version import version_info import os import subprocess logger = logname("sockets") class WSnamespace(socketio.AsyncNamespace): def __init__(self, namespace='/sockets'): ...
import asyncio from aiohttp import web import socketio import hexdump from log import logname import frame from hardware import Hardware from version import version_info import os logger = logname("sockets") class WSnamespace(socketio.AsyncNamespace): def __init__(self, namespace='/sockets'): super().__in...
Python
0.000005
c93b2ba0ed45aeeb8d82c8e04f6a2f5197ba732b
refactor rabbitmq consumer
spider/rpc.py
spider/rpc.py
# -*- coding: utf-8 -*- import logging import sys from time import sleep import json from functools import partial import threading from multiprocessing import Process import pika from scrapy.utils.project import get_project_settings from task import crawl, gen_lxmlspider, gen_blogspider settings = get_project_s...
# -*- coding: utf-8 -*- import logging import sys import time import json from multiprocessing import Process import pika from scrapy.utils.project import get_project_settings from task import crawl, gen_lxmlspider, gen_blogspider settings = get_project_settings() def cron(ch, method, properties, body): lo...
Python
0.999999
d4a2632a0dcdd6731a5930f321135ec7f9864460
Use new API, which requires being explicit about tracking ODF model.
AFQ/tests/test_tractography.py
AFQ/tests/test_tractography.py
import os.path as op import numpy as np import numpy.testing as npt import nibabel.tmpdirs as nbtmp from AFQ.csd import fit_csd from AFQ.dti import fit_dti from AFQ.tractography import track from AFQ.utils.testing import make_tracking_data seeds = np.array([[-80., -120., -60.], [-81, -121, -61], ...
import os.path as op import numpy as np import numpy.testing as npt import nibabel.tmpdirs as nbtmp from AFQ.csd import fit_csd from AFQ.dti import fit_dti from AFQ.tractography import track from AFQ.utils.testing import make_tracking_data seeds = np.array([[-80., -120., -60.], [-81, -121, -61], ...
Python
0
705cb5cf3eec171baf3a8b91b8cc77d9987a1414
Fix ImproperlyConfigured exception
precision/accounts/views.py
precision/accounts/views.py
from django.http import HttpResponse from django.shortcuts import render, redirect from django.contrib.auth import authenticate, login from django.views.generic.base import TemplateResponseMixin, View from .forms import LoginForm class SignInView(TemplateResponseMixin, View): template_name = 'accounts/sign_in.ht...
from django.http import HttpResponse from django.shortcuts import render, redirect from django.contrib.auth import authenticate, login from django.views.generic.base import TemplateResponseMixin, View from .forms import LoginForm class SignInView(TemplateResponseMixin, View): def get(self, request): tem...
Python
0.000003
5b7bb415b03e9bb3b432fd8e6dc40a9b5ecd4539
as_user or None
corehq/apps/formplayer_api/management/commands/prime_formplayer_restores.py
corehq/apps/formplayer_api/management/commands/prime_formplayer_restores.py
import csv import sys from concurrent import futures from django.core.management.base import BaseCommand from corehq.apps.formplayer_api.sync_db import sync_db from corehq.apps.users.models import CouchUser from corehq.apps.users.util import format_username class Command(BaseCommand): help = "Call the Formplaye...
import csv import sys from concurrent import futures from django.core.management.base import BaseCommand from corehq.apps.formplayer_api.sync_db import sync_db from corehq.apps.users.models import CouchUser from corehq.apps.users.util import format_username class Command(BaseCommand): help = "Call the Formplaye...
Python
0.999902
15f1afc9292f55850f7bade4b468fafc971c752a
Exclude past contest rounds. HACK
project/convention/views.py
project/convention/views.py
from __future__ import division from haystack.views import basic_search from django.shortcuts import ( get_list_or_404, get_object_or_404, render, redirect, ) from django.contrib import messages from django.contrib.auth.decorators import login_required # from django.core.exceptions import ( # Doe...
from __future__ import division from haystack.views import basic_search from django.shortcuts import ( get_list_or_404, get_object_or_404, render, redirect, ) from django.contrib import messages from django.contrib.auth.decorators import login_required # from django.core.exceptions import ( # Doe...
Python
0.999955
c0684358b217318327d71470ee86074b3556148a
Use double quotes consistently
bc125csv/__main__.py
bc125csv/__main__.py
from bc125csv.handler import main if __name__ == "__main__": main()
from bc125csv.handler import main if __name__ == '__main__': main()
Python
0
32537dafa3c13761b910ab8449ff80d60df6f02b
Bump version to 2.3.4-dev
indico/__init__.py
indico/__init__.py
# This file is part of Indico. # Copyright (C) 2002 - 2021 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. import warnings from indico.util.mimetypes import register_custom_mimetypes __version__ = '2.3.4-dev' ...
# This file is part of Indico. # Copyright (C) 2002 - 2021 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. import warnings from indico.util.mimetypes import register_custom_mimetypes __version__ = '2.3.3' regi...
Python
0
41acddb1e2edcac54cd3ae5287a7c2977b02f305
Change `ugettext` to `ugettext_lazy`
cmsplugin_bootstrap_carousel/models_default.py
cmsplugin_bootstrap_carousel/models_default.py
# coding: utf-8 import os from django.db import models from django.core.files.uploadedfile import SimpleUploadedFile from django.utils.translation import ugettext_lazy as _ from cms.models.pluginmodel import CMSPlugin from PIL import Image from cStringIO import StringIO from . import config class Carousel(CMSPlugin)...
# coding: utf-8 import os from django.db import models from django.core.files.uploadedfile import SimpleUploadedFile from django.utils.translation import ugettext as _ from cms.models.pluginmodel import CMSPlugin from PIL import Image from cStringIO import StringIO from . import config class Carousel(CMSPlugin): ...
Python
0.000052
862f81d54624ea198d6351f5ea7c88b66bc02019
Make the Nick an argument to Client.py
src/Client.py
src/Client.py
#!python __author__ = 'JacobAMason' import sys from twisted.words.protocols import irc from twisted.internet import protocol, reactor import StringIO class Bot(irc.IRCClient): def _get_nickname(self): return self.factory.nickname nickname = property(_get_nickname) def signedOn(self): se...
#!python __author__ = 'JacobAMason' import sys from twisted.words.protocols import irc from twisted.internet import protocol, reactor import StringIO class Bot(irc.IRCClient): def _get_nickname(self): return self.factory.nickname nickname = property(_get_nickname) def signedOn(self): se...
Python
0.001602
ecf71bd004d99b679936e07453f5a938e19f71dc
Add aiohttp as a execution requirement
megalist_dataflow/setup.py
megalist_dataflow/setup.py
# 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 or agreed to in writing, ...
# Copyright 2019 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 or agreed to in writing, ...
Python
0
8ffb2beea77897e3fa40691f35f2e089dbc5df9a
Add more documentation
coalib/bearlib/languages/LanguageDefinition.py
coalib/bearlib/languages/LanguageDefinition.py
import os from coalib.bearlib.abstractions.SectionCreatable import SectionCreatable from coalib.misc.StringConstants import StringConstants from coalib.parsing.ConfParser import ConfParser class LanguageDefinition(SectionCreatable): def __init__(self, language_family: str, language: str): """ Cre...
import os from coalib.bearlib.abstractions.SectionCreatable import SectionCreatable from coalib.misc.StringConstants import StringConstants from coalib.parsing.ConfParser import ConfParser class LanguageDefinition(SectionCreatable): def __init__(self, language_family: str, language: str): """ Cre...
Python
0
fd3e9c09f14b554883e47102b4750faef5c10ecc
Print body in case of HTTPError
unit-healthcheck.py
unit-healthcheck.py
#!/usr/bin/env python import logging import argparse import os import json import sys try: from urllib2 import Request, urlopen, HTTPError except ImportError: from urllib.request import Request, urlopen, HTTPError TSURU_TARGET = os.environ['TSURU_TARGET'] TSURU_TOKEN = os.environ['TSURU_TOKEN'] def main()...
#!/usr/bin/env python import logging import argparse import os import json import sys try: from urllib2 import Request, urlopen except ImportError: from urllib.request import Request, urlopen TSURU_TARGET = os.environ['TSURU_TARGET'] TSURU_TOKEN = os.environ['TSURU_TOKEN'] def main(): logging.basicCon...
Python
0
74272b9916c29bb9e97d4761801ee3730b053b87
comment fix
athenet/sparsifying/utils/numlike.py
athenet/sparsifying/utils/numlike.py
"""Template class with arithmetic operations that can be passed through neural network. All classes that are being used for derest should inherit from this class.""" class Numlike(object): """Template class with arithmetic operations that can be passed through neural network. All classes that are being ...
"""Template class with arithmetic operations that can be passed through neural network. All classes that are being used for derest should inherit from this class.""" class Numlike(object): """Template class with arithmetic operations that can be passed through neural network. All classes that are being ...
Python
0
9ba255886ca5315be1b95ccac28d496e3941f155
Bump alpha version
uplink/__about__.py
uplink/__about__.py
""" This module is the single source of truth for any package metadata that is used both in distribution (i.e., setup.py) and within the codebase. """ __version__ = "0.8.0a1"
""" This module is the single source of truth for any package metadata that is used both in distribution (i.e., setup.py) and within the codebase. """ __version__ = "0.8.0a0"
Python
0
ec665be1811b458f849cbed09ef3d3c61f9e4533
Change order of environment setup
metatlas/tools/notebook.py
metatlas/tools/notebook.py
"""Jupyter notebook helper functions""" import logging import os import shutil import sys from pathlib import Path import pandas as pd from IPython.core.display import display, HTML from metatlas.tools.logging import activate_logging logger = logging.getLogger(__name__) def configure_environment(log_level): ""...
"""Jupyter notebook helper functions""" import logging import os import shutil import sys from pathlib import Path import pandas as pd from IPython.core.display import display, HTML from metatlas.tools.logging import activate_logging logger = logging.getLogger(__name__) def configure_environment(log_level): ""...
Python
0.000001
646416efa7378b645af56031c06e7544cb72627f
Delete comment
user_recommender.py
user_recommender.py
from tumblr_manager import TumblrManager, TumblrScraper class UserRecommender(object): user_counter = {} def __init__(self, consumer_key=None, consumer_secret=None, oauth_token=None, oauth_token_secret=None): self.tm = TumblrManager(consumer_key, consumer_secret, oauth_token, oauth_token_secret) ...
from tumblr_manager import TumblrManager, TumblrScraper class UserRecommender(object): user_counter = {} def __init__(self, consumer_key=None, consumer_secret=None, oauth_token=None, oauth_token_secret=None): self.tm = TumblrManager(consumer_key, consumer_secret, oauth_token, oauth_token_secret) ...
Python
0
906d765e387367654a02a36e9b5ba7aca4480ed6
Check if zip only contains one file
util/zipwrangler.py
util/zipwrangler.py
from pathlib import Path from zipfile import ZipFile from tempfile import TemporaryDirectory import shutil ignore = ['__MACOSX', '.DS_Store'] def get_cleaned_contents(zipfile, ignore_list=ignore, verbose=False): contents = [] for info in zipfile.infolist(): if not any(ignored in info.filename for ign...
from pathlib import Path from zipfile import ZipFile from tempfile import TemporaryDirectory import shutil ignore = ['__MACOSX', '.DS_Store'] def get_cleaned_contents(zipfile, ignore_list=ignore, verbose=False): contents = [] for info in zipfile.infolist(): if not any(ignored in info.filename for ign...
Python
0
2d09314ab58bb766372dc6e263fb17428b1fd3cd
Fix check for existing pools.
doc/pool_scripts/cats.py
doc/pool_scripts/cats.py
import os import photomosaic.flickr import photomosaic as pm if not os.path.isfile(os.path.expanduser('~/pools/cats/pool.json')): FLICKR_API_KEY = os.environ['FLICKR_API_KEY'] pm.set_options(flickr_api_key=FLICKR_API_KEY) photomosaic.flickr.from_search('cats', '~/pools/cats/') pool = pm.make_pool('~/...
import os import photomosaic.flickr import photomosaic as pm if not os.path.isfile('~/pools/cats/pool.json'): FLICKR_API_KEY = os.environ['FLICKR_API_KEY'] pm.set_options(flickr_api_key=FLICKR_API_KEY) photomosaic.flickr.from_search('cats', '~/pools/cats/') pool = pm.make_pool('~/pools/cats/*.jpg') ...
Python
0
3f190e10707895a357a9167add44fa8ae0a3cc31
Tidy up ebay messaging call
erpnext_ebay/ebay_do_requests.py
erpnext_ebay/ebay_do_requests.py
# -*- coding: utf-8 -*- """eBay requests which are not read-only, and can affect live eBay data. Excludes item revision calls. """ from ebaysdk.exception import ConnectionError from erpnext_ebay.ebay_constants import HOME_SITE_ID from erpnext_ebay.ebay_get_requests import ( ebay_logger, get_trading_api, handle_eb...
# -*- coding: utf-8 -*- """eBay requests which are not read-only, and can affect live eBay data. Excludes item revision calls. """ from ebaysdk.exception import ConnectionError from erpnext_ebay.ebay_constants import HOME_SITE_ID from erpnext_ebay.ebay_get_requests import ( ebay_logger, get_trading_api, handle_eb...
Python
0.00001
e83be594507c994069d20d5f2cd86c52905a52a6
Fix personal brain damage.
lib/plugin/disk_utilization.py
lib/plugin/disk_utilization.py
import datetime import logging import os import snmpy.plugin import subprocess class disk_utilization(snmpy.plugin.TablePlugin): def __init__(self, conf): conf['table'] = [ {'dev': 'string'}, {'wait': 'integer'}, {'util': 'integer'}, ] snmpy.plugin.Tabl...
import datetime import logging import os import snmpy.plugin import subprocess class disk_utilization(snmpy.plugin.TablePlugin): def __init__(self, conf): conf['table'] = [ {'dev': 'string'}, {'wait': 'integer'}, {'util': 'integer'}, ] snmpy.plugin.Tabl...
Python
0.000001
65981662c7c0500a8428b5c332465cea32c813da
Use admin_authenticate for a non-SRP flow
lizard_auth_server/backends.py
lizard_auth_server/backends.py
"""Custom Django authentication backend Copyright note: copied almost verbatim from backend.py in https://github.com/metametricsinc/django-warrant (BSD licensed) """ from boto3.exceptions import Boto3Error from botocore.exceptions import ClientError from django.conf import settings from django.contrib.auth import get...
"""Custom Django authentication backend Copyright note: copied almost verbatim from backend.py in https://github.com/metametricsinc/django-warrant (BSD licensed) """ from boto3.exceptions import Boto3Error from botocore.exceptions import ClientError from django.conf import settings from django.contrib.auth import get...
Python
0
4ceeed0eceff9d75b0bc3047c9a8e2fcb6877e31
Fix tasks reading of different course_id
lms/djangoapps/ecoapi/tasks.py
lms/djangoapps/ecoapi/tasks.py
from celery.task import task from instructor.offline_gradecalc import student_grades , offline_grade_calculation from opaque_keys.edx.keys import CourseKey from opaque_keys import InvalidKeyError from opaque_keys.edx.locations import SlashSeparatedCourseKey #TODO: add a better task management to prevent concurrent tas...
from celery.task import task from instructor.offline_gradecalc import student_grades , offline_grade_calculation #TODO: add a better task management to prevent concurrent task execution with some course_id @task() def offline_calc(course_id): offline_grade_calculation(course_id)
Python
0.999881
c9ef1c40bb8b0179f19991d27309008c1805d6a6
add a skeletal twisted client (-t)
src/client.py
src/client.py
import sys import time import select import socket # local imports import event import message import mars_math RECV_SIZE = 4096 # should be way more than enough from twisted.internet import reactor from twisted.internet.protocol import Protocol, ClientFactory class Client(object): def __init__(self, host, port): ...
import sys import time import select import socket # local imports import event import message import mars_math RECV_SIZE = 4096 # should be way more than enough class Client(object): def __init__(self, host, port): self.host = host self.port = port self.event_queue = event.EventQueue() self.mtime = 0 # ma...
Python
0
6d84f7eb25352c50e40950d0585c33bd1193649e
fix bug in init
sfa/util/osxrn.py
sfa/util/osxrn.py
import re from sfa.util.xrn import Xrn from sfa.util.config import Config class OSXrn(Xrn): def __init__(self, name=None, type=None, **kwds): config = Config() if name is not None: self.type = type self.hrn = config.SFA_INTERFACE_HRN + "." + name self.h...
import re from sfa.util.xrn import Xrn from sfa.util.config import Config class OSXrn(Xrn): def __init__(self, name=None, type=None, *args, **kwds): config = Config() if name is not None: self.type = type self.hrn = config.SFA_INTERFACE_HRN + "." + name self.hrn...
Python
0
3aba768c7a3c11f2941db36d0292cd5810433596
fix python2.7.9
src/api/util/timeutils.py
src/api/util/timeutils.py
import datetime def total_seconds(td): # Keep backward compatibility with Python 2.6 which doesn't have # this method if hasattr(td, 'total_seconds'): return td.total_seconds() else: return (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6 def convert_to_epoch(times...
from datetime import datetime def total_seconds(td): # Keep backward compatibility with Python 2.6 which doesn't have # this method if hasattr(td, 'total_seconds'): return td.total_seconds() else: return (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6 def convert...
Python
0.998339
f98b30583fb9fca4674ad93afd242ffae7ac9f36
Fix tests
spacy/tests/conftest.py
spacy/tests/conftest.py
# coding: utf-8 from __future__ import unicode_literals from ..en import English from ..de import German from ..es import Spanish from ..it import Italian from ..fr import French from ..pt import Portuguese from ..nl import Dutch from ..sv import Swedish from ..hu import Hungarian from ..fi import Finnish from ..bn im...
# coding: utf-8 from __future__ import unicode_literals from ..en import English from ..de import German from ..es import Spanish from ..it import Italian from ..fr import French from ..pt import Portuguese from ..nl import Dutch from ..sv import Swedish from ..hu import Hungarian from ..fi import Finnish from ..bn im...
Python
0.000003
d6b69f7d5868597426f7718165d4933af72e154d
Fix typo in command-line
spreadsplug/pdfbeads.py
spreadsplug/pdfbeads.py
# -*- coding: utf-8 -*- # Copyright (C) 2014 Johannes Baiter <johannes.baiter@gmail.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your ...
# -*- coding: utf-8 -*- # Copyright (C) 2014 Johannes Baiter <johannes.baiter@gmail.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your ...
Python
0.000006
20cf0f2b6647b7a03fb5a9808f9d854975feb651
add shebang line to demo.py
demo.py
demo.py
#!/usr/bin/env python3 from prettytask import Task, TaskGroup, Error, prompt def main(): with Task("A quick task"): pass with Task("A task with a custom success message") as task: task.ok("that went well!") with Task("A task that fails") as task: raise Error with Task("A tas...
from prettytask import Task, TaskGroup, Error, prompt def main(): with Task("A quick task"): pass with Task("A task with a custom success message") as task: task.ok("that went well!") with Task("A task that fails") as task: raise Error with Task("A task that fails with a cus...
Python
0.000001
6684f08beaaf297eb6a0249ee17a6d90770b93e8
Update 1.0 protocol version spec in test_versions.py
bokeh/server/protocol/tests/test_versions.py
bokeh/server/protocol/tests/test_versions.py
############################################################################### # # # # # # ...
############################################################################### # # # # # # ...
Python
0
a6aec17cff730914c0901db9e9ab9bb4da660306
Switch elm-formato to post save
elm_format.py
elm_format.py
from __future__ import print_function import subprocess import os, os.path import re import sublime, sublime_plugin class ElmFormatCommand(sublime_plugin.TextCommand): def run(self, edit): settings = sublime.load_settings('Elm Language Support.sublime-settings') path = settings.get('elm_paths', '') if path: ...
from __future__ import print_function import subprocess import os, os.path import re import sublime, sublime_plugin class ElmFormatCommand(sublime_plugin.TextCommand): def run(self, edit): settings = sublime.load_settings('Elm Language Support.sublime-settings') path = settings.get('elm_paths', '') if path: ...
Python
0
d679f7dbedd3decc7cd4abc782d4c0fae0b872ea
Enable the ability to import H264 SubMe, MotionEstimationMethod and Trellis
bitmovin/resources/enums/__init__.py
bitmovin/resources/enums/__init__.py
from .status import Status from .aac_channel_layout import AACChannelLayout from .ac3_channel_layout import AC3ChannelLayout from .aws_cloud_region import AWSCloudRegion from .badapt import BAdapt from .cloud_region import CloudRegion from .crop_filter_unit import CropFilterUnit from .google_cloud_region import GoogleC...
from .status import Status from .aac_channel_layout import AACChannelLayout from .ac3_channel_layout import AC3ChannelLayout from .aws_cloud_region import AWSCloudRegion from .badapt import BAdapt from .cloud_region import CloudRegion from .crop_filter_unit import CropFilterUnit from .google_cloud_region import GoogleC...
Python
0
2e3e7e1bf92e342e0ed14c672b7c5a600f0ba3a2
Fix ros__parameters in game settings script
bitbots_utils/bitbots_utils/game_settings.py
bitbots_utils/bitbots_utils/game_settings.py
#!/usr/bin/env python3 import sys import yaml import os # path to the game settings yaml and to the game setting options SETTING_PATH = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))), "bitbots_utils", "config", "game_settings.yaml") OPTIONS_PATH ...
#!/usr/bin/env python3 import sys import yaml import os # path to the game settings yaml and to the game setting options SETTING_PATH = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))), "bitbots_utils", "config", "game_settings.yaml") OPTIONS_PATH ...
Python
0.000086
b4a2bf0ee660aab40a885cd8b84c18c8b4a8580b
make host, ip and type dynamic
mpf/core/bcp/bcp_server.py
mpf/core/bcp/bcp_server.py
"""Bcp server for clients which connect and disconnect randomly.""" import asyncio import logging from mpf.core.utility_functions import Util class BcpServer(): """Server socket which listens for incoming BCP clients.""" def __init__(self, machine, ip, port, type): self.machine = machine se...
"""Bcp server for clients which connect and disconnect randomly.""" import asyncio from mpf.core.bcp.bcp_socket_client import BCPClientSocket class BcpServer(): """Server socket which listens for incoming BCP clients.""" def __init__(self, machine): self.machine = machine self._server = Non...
Python
0
35f9db005fc95f6d95d1559f81137381fa43e7ad
Add new locale.
mrburns/settings/server.py
mrburns/settings/server.py
import os import socket from django.utils.translation import ugettext_lazy as _ from .base import * # noqa SERVER_ENV = os.getenv('DJANGO_SERVER_ENV') SECRET_KEY = os.getenv('SECRET_KEY') DEBUG = TEMPLATE_DEBUG = False ALLOWED_HOSTS = [ # the server's IP (for monitors) socket.gethostbyname(socket.gethostna...
import os import socket from django.utils.translation import ugettext_lazy as _ from .base import * # noqa SERVER_ENV = os.getenv('DJANGO_SERVER_ENV') SECRET_KEY = os.getenv('SECRET_KEY') DEBUG = TEMPLATE_DEBUG = False ALLOWED_HOSTS = [ # the server's IP (for monitors) socket.gethostbyname(socket.gethostna...
Python
0.000001
a59dcbe8df5b933006dcc554962bdeef674c4383
Remove print statements and re-raise errors
mstranslator/translator.py
mstranslator/translator.py
import requests import urllib import sys class Config: """Config to be given to an instance of translator to do the Authorization.""" def __init__(self, translator_client_id, translator_client_secret): assert translator_client_id is not None assert type(translator_client_id) is str ass...
import requests import urllib import sys class Config: """Config to be given to an instance of translator to do the Authorization.""" def __init__(self, translator_client_id, translator_client_secret): assert translator_client_id is not None assert type(translator_client_id) is str ass...
Python
0.000007
61d8ced0d46bb0e351b8c488814b75b1de2ddab3
Update Ejemplos.py
Ago-Dic-2018/Ejemplos/Ejemplos.py
Ago-Dic-2018/Ejemplos/Ejemplos.py
import collections potenciaPares = 2 potenciaImpares = 3 # print(2 / 3) #for i in range(0, 10): #if i % 2: # Estilo de formateo 1: # print("Impar: %d" % (i)) # Estilo de formateo 2: # print("El impar #{} ^ {} es = {}".format(i, potenciaImpares, i ** potenciaImpares)) #else: ...
import collections potenciaPares = 2 potenciaImpares = 3 # print(2 / 3) #for i in range(0, 10): #if i % 2: # Estilo de formateo 1: # print("Impar: %d" % (i)) # Estilo de formateo 2: # print("El impar #{} ^ {} es = {}".format(i, potenciaImpares, i ** potenciaImpares)) #else: ...
Python
0
4b545d2e72080537672bb4ebb990708cad678344
Debug Google Cloud Run support
entrypoint.py
entrypoint.py
#!/usr/bin/python3 # # Define containerized environment for running Diosix on Qemu # # On Google Cloud Run: Creates HTTP server on port 8080 # or whatever was specified using the PORT system variable. # Outputs via the HTTP port. This requires K_SERVICE to be set. # # On all other environments: Log to stdout # # syntax...
#!/usr/bin/python3 # # Define containerized environment for running Diosix on Qemu # # On Google Cloud Run: Creates HTTP server on port 8080 # or whatever was specified using the PORT system variable. # Outputs via the HTTP port. This requires K_SERVICE to be set. # # On all other environments: Log to stdout # # syntax...
Python
0
73143ebf17e7af6503da0136fdd8c3bdf0674f06
fix address indexing of qld data
eheritage/injest/qld.py
eheritage/injest/qld.py
from lxml import etree def parse_ahpi_xml(path): """ Parses the AHPI XML export format of the queensland heritage register and calls a function with each heritage place. :param path: The location of a heritage_places xml file. """ ns = {'hp': 'http://www.heritage.gov.au/ahpi/heritage_places'} ...
from lxml import etree def parse_ahpi_xml(path): """ Parses the AHPI XML export format of the queensland heritage register and calls a function with each heritage place. :param path: The location of a heritage_places xml file. """ ns = {'hp': 'http://www.heritage.gov.au/ahpi/heritage_places'} ...
Python
0
6c3929806a19fbaac0c17887e697bba7ddeaa92d
create cache dir if it does not exist
micronota/commands/database.py
micronota/commands/database.py
# ---------------------------------------------------------------------------- # Copyright (c) 2015--, micronota development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. # ---------------------------------------------...
# ---------------------------------------------------------------------------- # Copyright (c) 2015--, micronota development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. # ---------------------------------------------...
Python
0.000001
b31a13c457b045fa8f1e6a2f99f862fe1675926c
Fix broken tests
nodes/tests/test_models.py
nodes/tests/test_models.py
import sure from mock import MagicMock from django.test import TestCase from django.contrib.auth.models import User from projects.tests.factories import ProjectFactory from ..exceptions import TaskAlreadyPerformed from .. import models from . import factories from .base import WithKeysMixin class ProjectKeysCase(With...
import sure from mock import MagicMock from django.test import TestCase from django.contrib.auth.models import User from projects.tests.factories import ProjectFactory from ..exceptions import TaskAlreadyPerformed from .. import models from . import factories from .base import WithKeysMixin class ProjectKeysCase(With...
Python
0.000555
f4f5f91fac676b05f552f1a3d13e58dab63ec619
Refresh an instance's maintenance mode status after en/dis-abling it
stackdriver/instance.py
stackdriver/instance.py
import datetime class Maintenance(object): __source = None __instance = None def __init__(self, source, instance): self.__source = source self.__instance = instance @property def is_enabled(self): return self.__source['maintenance'] @property def reason(self): ...
import datetime class Maintenance(object): __source = None __instance = None def __init__(self, source, instance): self.__source = source self.__instance = instance @property def is_enabled(self): return self.__source['maintenance'] @property def reason(self): ...
Python
0
07874ee51375b7597d79288e85acc68294d4b007
customize the JSON dump for Event objects
oabutton/apps/web/views.py
oabutton/apps/web/views.py
from django.shortcuts import render_to_response from django.conf import settings from django.core.context_processors import csrf from oabutton.common import SigninForm import json def homepage(req): # Need to lazy import the Event model so that tests work with # mocks c = {} c.update(csrf(req)) f...
from django.shortcuts import render_to_response from django.conf import settings from django.core.context_processors import csrf from oabutton.common import SigninForm def homepage(req): # Need to lazy import the Event model so that tests work with # mocks c = {} c.update(csrf(req)) from oabutton...
Python
0
3e332088c25ce0515b68d17c6f38bd02756cc4a3
add state executive branches too
openstates/jurisdiction.py
openstates/jurisdiction.py
from pupa.scrape import Jurisdiction, Organization from openstates.base import OpenstatesBaseScraper from openstates.people import OpenstatesPersonScraper from openstates.events import OpenstatesEventScraper from openstates.bills import OpenstatesBillScraper POSTS = { 'ak': {'lower': range(1, 41), 'upper': (chr(n)...
from pupa.scrape import Jurisdiction, Organization from openstates.base import OpenstatesBaseScraper from openstates.people import OpenstatesPersonScraper from openstates.events import OpenstatesEventScraper from openstates.bills import OpenstatesBillScraper POSTS = { 'ak': {'lower': range(1, 41), 'upper': (chr(n)...
Python
0.000002
371ddf2c4beb79b82b1154abfa1efdd6bc5e379a
Change version to 0.5.dev
elasticutils/_version.py
elasticutils/_version.py
# follow pep-386 # Examples: # * 0.3 - released version # * 0.3a1 - alpha version # * 0.3.dev - version in developmentv __version__ = '0.5.dev' __releasedate__ = ''
# follow pep-386 # Examples: # * 0.3 - released version # * 0.3a1 - alpha version # * 0.3.dev - version in developmentv __version__ = '0.4' __releasedate__ = '20120731'
Python
0.000001
fb71dbaa34f51df1125c9d8d9e6e41cdc0260b29
Change default iterations
fuzz.py
fuzz.py
from __future__ import print_function import argparse,binascii,os,pprint,traceback,sys from random import randrange from dnslib import DNSRecord,DNSQuestion,QTYPE,DNSError def fuzz_delete(b): """ Delete byte """ f = b[:] del f[randrange(len(b))] return f def fuzz_add(b): """ Add byte """ f =...
from __future__ import print_function import argparse,binascii,os,pprint,traceback,sys from random import randrange from dnslib import DNSRecord,DNSQuestion,QTYPE,DNSError def fuzz_delete(b): """ Delete byte """ f = b[:] del f[randrange(len(b))] return f def fuzz_add(b): """ Add byte """ f =...
Python
0
fda7fa04943575c01f3c5d3d19bb07b9efddbcc8
remove MIDI
game.py
game.py
__author__ = 'Florian Tautz' import pygame class Game: def __init__(self): pygame.init() size = self._width, self._height = 1920, 1200 self._speed = [2, 2] self._screen = pygame.display.set_mode(size, pygame.FULLSCREEN| pygame...
__author__ = 'Florian Tautz' import pygame import pygame.midi class Game: def __init__(self): pygame.init() pygame.midi.init() midi_port = pygame.midi.get_default_output_id() self._midi = pygame.midi.Output(midi_port) self._midi.set_instrument(56) size = self._wid...
Python
0.000085
ba6b5c50e5ea1875e117d72675fb58092325b193
add moves: left, right and down
game.py
game.py
#using python2 import Tkinter from visual import Visual from relief import Relief from figure import Figure from random import randint class Game: def __init__(self): self.root= Tkinter.Tk() self.vis= Visual(self.root) self.relief= Relief() self.figure= None self.relief.extend([(0,0), (0,3)]) self.ro...
#using python2 import Tkinter from visual import Visual from relief import Relief from figure import Figure from random import randint class Game: def __init__(self): self.root= Tkinter.Tk() self.vis= Visual(self.root) self.relief= Relief() self.figure= None self.root.after_idle(self.tick) self.root.bin...
Python
0.999992