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
034070458b18805d7282f2bb7f0880f688bf3e6e
Remove all subdir functionality
stuff/urls.py
stuff/urls.py
import settings from django.conf.urls.defaults import * from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', (r'^admin/(.*)', admin.site.root), (r'^publication/', include('stuff.publications.urls')), (r'^file/', include('stuff.files.urls')), (r'^photo/', include('stuff.pica...
import settings from django.conf.urls.defaults import * from django.contrib import admin admin.autodiscover() subdir = '' urlpatterns = patterns('', (r'^%sadmin/(.*)' % subdir, admin.site.root), (r'^%spublication/' % subdir, include('stuff.publications.urls')), (r'^%sfile/' % subdir, include('stuff.files....
Python
0.000004
f2395dd7c37798086cf7c67c0a8cfa7e48f4ec64
Remove unnecessary loop
atlas/mongo_read.py
atlas/mongo_read.py
try: import simplejson as json except ImportError: import json from pymongo import MongoClient from pymongo.errors import PyMongoError from atlas.constants import MONGO __author__ = 'rblourenco@uchicago.edu' # 2015-09-04 - Initial commit class MongoRead(object): def __init__(self, a_x, a_y, b_x, b_y, c_...
try: import simplejson as json except ImportError: import json from pymongo import MongoClient from pymongo.errors import PyMongoError from atlas.constants import MONGO __author__ = 'rblourenco@uchicago.edu' # 2015-09-04 - Initial commit class MongoRead(object): def __init__(self, a_x, a_y, b_x, b_y, c_...
Python
0.000048
be800d70ef3085035bc8330037f0881203e978cc
fix SSL vdsClient connections
ovirt_hosted_engine_ha/broker/submonitor_util.py
ovirt_hosted_engine_ha/broker/submonitor_util.py
# # ovirt-hosted-engine-ha -- ovirt hosted engine high availability # Copyright (C) 2013 Red Hat, Inc. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the Licens...
# # ovirt-hosted-engine-ha -- ovirt hosted engine high availability # Copyright (C) 2013 Red Hat, Inc. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the Licens...
Python
0
3f325f9ac4106eb8b27ec8efc309eeb6ce87bb76
Remove experimental dead code
base_geoengine/fields.py
base_geoengine/fields.py
# -*- coding: utf-8 -*- ############################################################################## # # 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 #...
# -*- coding: utf-8 -*- ############################################################################## # # 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 #...
Python
0.000027
bf460618bc0b2e535de46a0dc0ddb08b8680ab6c
Stop to use the __future__ module.
octavia/db/migration/alembic_migrations/env.py
octavia/db/migration/alembic_migrations/env.py
# Copyright 2014 Rackspace # # 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...
# Copyright 2014 Rackspace # # 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.999929
f562fd203c441c10269c0a28861c1238c8a0947e
Simplify the closeness checking
euclid.py
euclid.py
""" Simple 2D Euclidean geometric primitives. """ from collections import namedtuple import math def isclose(a, b): return math.isclose(a, b, abs_tol=1e-8) class BadGeometry(Exception): """Any exception raised by euclid.""" pass class Point(namedtuple("Point", ["x", "y"])): """A point in 2D.""" ...
""" Simple 2D Euclidean geometric primitives. """ from collections import namedtuple import math EPSILON = 1e-8 def _near_zero(v): return math.isclose(v, 0, abs_tol=EPSILON) class BadGeometry(Exception): """Any exception raised by euclid.""" pass class Point(namedtuple("Point", ["x", "y"])): """...
Python
0.000025
0592bd3759fad25a8aa50cd2e2e5a853d0863202
Handle implicit encode/decode errors in Py3 (#4).
requests_negotiate/__init__.py
requests_negotiate/__init__.py
import base64 import re import logging import gssapi from requests.auth import AuthBase from requests.compat import urlparse import www_authenticate logger = logging.getLogger(__name__) class HTTPNegotiateAuth(AuthBase): def __init__(self, service='HTTP', service_name=None, negotiate_client_na...
import base64 import re import logging import gssapi from requests.auth import AuthBase from requests.compat import urlparse import www_authenticate logger = logging.getLogger(__name__) class HTTPNegotiateAuth(AuthBase): def __init__(self, service='HTTP', service_name=None, negotiate_client_na...
Python
0
25866e86338ac2cf0f042dded6a343a00b5f7241
Bump version to 0.5.0-alpha.4.
rnachipintegrator/__init__.py
rnachipintegrator/__init__.py
# Current version of the library __version__ = '0.5.0-alpha.4' def get_version(): """Returns a string with the current version of the library (e.g., "0.2.0") """ return __version__
# Current version of the library __version__ = '0.5.0-alpha.3' def get_version(): """Returns a string with the current version of the library (e.g., "0.2.0") """ return __version__
Python
0
e7421c5e8f3f26a617e71ee04fd16a7ebba97d53
Remove unneeded import
bibpy/lexers/__init__.py
bibpy/lexers/__init__.py
"""Various lexer functions used by the funcparserlib parser.""" import funcparserlib.lexer as lexer from bibpy.compat import u from bibpy.lexers.biblexer import BibLexer from bibpy.lexers.name_lexer import NameLexer from bibpy.lexers.namelist_lexer import NamelistLexer from funcparserlib.lexer import Token def remov...
"""Various lexer functions used by the funcparserlib parser.""" import funcparserlib.lexer as lexer import bibpy from bibpy.compat import u from bibpy.lexers.biblexer import BibLexer from bibpy.lexers.name_lexer import NameLexer from bibpy.lexers.namelist_lexer import NamelistLexer from funcparserlib.lexer import Toke...
Python
0.000002
fc3fa9871f0edc4c76a201547ec8c7f457aa2b35
fix msg string and rename 'iter' variable
modules/bibcatalog/lib/bibcatalog_templates.py
modules/bibcatalog/lib/bibcatalog_templates.py
## This file is part of Invenio. ## Copyright (C) 2009, 2010, 2011 CERN. ## ## Invenio 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 2 of the ## License, or (at your option) any later versio...
## This file is part of Invenio. ## Copyright (C) 2009, 2010, 2011 CERN. ## ## Invenio 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 2 of the ## License, or (at your option) any later versio...
Python
0.000002
1193980f77d715e1ca2b22bcb8a4b74eaed1122c
Add missing import
lino_book/projects/polls/test.py
lino_book/projects/polls/test.py
from lino.utils.test import DocTest from lino.utils.djangotest import WebIndexTestCase
from lino.utils.djangotest import WebIndexTestCase
Python
0.000466
26e14ff342e9063a6378f6b38be96b037df746c3
Fix ordering validation and parsing
avocado/query/parsers/dataview.py
avocado/query/parsers/dataview.py
from modeltree.tree import trees from modeltree.query import ModelTreeQuerySet from django.core.exceptions import ValidationError def has_keys(obj, keys): "Check the required keys are present in `obj`" for key in keys: if key not in obj: return False return True class Node(object): ...
from modeltree.tree import trees from modeltree.query import ModelTreeQuerySet from django.core.exceptions import ValidationError def has_keys(obj, keys): "Check the required keys are present in `obj`" for key in keys: if key not in obj: return False return True class Node(object): ...
Python
0.000001
06a2e65423a6e26e3226cda724112219c0867fdd
Fix missing else
readthedocs/core/management/commands/update_repos.py
readthedocs/core/management/commands/update_repos.py
""" Custom management command to rebuild documentation for all projects. Invoked via ``./manage.py update_repos``. """ import logging from django.core.management.base import BaseCommand from readthedocs.builds.constants import EXTERNAL, INTERNAL from readthedocs.builds.models import Version from readthedocs.core.ut...
""" Custom management command to rebuild documentation for all projects. Invoked via ``./manage.py update_repos``. """ import logging from django.core.management.base import BaseCommand from readthedocs.builds.constants import EXTERNAL, INTERNAL from readthedocs.builds.models import Version from readthedocs.core.ut...
Python
0.998982
02a36c08caaec2c16a965c55a35b8378f2a7609b
add 1D cosmic-ray rejection after sky subtraction
py/desispec/scripts/procexp.py
py/desispec/scripts/procexp.py
""" This script processes an exposure by applying fiberflat, sky subtraction, spectro-photometric calibration depending on input. """ from desispec.io import read_frame, write_frame from desispec.io import read_fiberflat from desispec.io import read_sky from desispec.io.fluxcalibration import read_flux_calibration fr...
""" This script processes an exposure by applying fiberflat, sky subtraction, spectro-photometric calibration depending on input. """ from desispec.io import read_frame, write_frame from desispec.io import read_fiberflat from desispec.io import read_sky from desispec.io.fluxcalibration import read_flux_calibration fr...
Python
0.000017
84159dae072424b0cc8d457b9e64e7b2490f08df
Remove some redundant URL configs.
base/components/people/urls.py
base/components/people/urls.py
from django.conf.urls import patterns, url from django.http import Http404 from django.views.generic.base import RedirectView from multiurl import ContinueResolving, multiurl from .views import (GroupBrowseView, GroupDetailView, GroupDiscographyView, GroupMembershipView, IdolBrowseView, IdolDetailView, IdolDiscog...
from django.conf.urls import patterns, url from django.http import Http404 from django.views.generic.base import RedirectView from multiurl import ContinueResolving, multiurl from .views import (GroupBrowseView, GroupDetailView, GroupDiscographyView, GroupMembershipView, IdolBrowseView, IdolDetailView, IdolDiscog...
Python
0
f1c1e471cb6c3de23991301379425dceacebe27d
change to PST
events.py
events.py
#!/usr/bin/env python import requests import time import math import os import tempfile from yattag import Doc outputdir = "./" allshards = { 'us': { 1701: 'Seastone', 1702: 'Greybriar', 1704: 'Deepwood', 1706: 'Wolfsbane', 1707: 'Faeblight', 1708: 'Laethys', 1721: 'Hailol' }, 'eu': ...
#!/usr/bin/env python import requests import time import math import os import tempfile from yattag import Doc outputdir = "./" allshards = { 'us': { 1701: 'Seastone', 1702: 'Greybriar', 1704: 'Deepwood', 1706: 'Wolfsbane', 1707: 'Faeblight', 1708: 'Laethys', 1721: 'Hailol' }, 'eu': ...
Python
0.000581
fc5b13f413713cacd147bbd29daac5df7f5bd2de
update notification sending tests
awx/main/tests/unit/test_tasks.py
awx/main/tests/unit/test_tasks.py
import pytest from contextlib import contextmanager from awx.main.models import ( UnifiedJob, Notification, ) from awx.main.tasks import ( send_notifications, run_administrative_checks, ) from awx.main.task_engine import TaskEnhancer @contextmanager def apply_patches(_patches): [p.start() for p ...
import pytest from contextlib import contextmanager from awx.main.models import ( UnifiedJob, Notification, ) from awx.main.tasks import ( send_notifications, run_administrative_checks, ) from awx.main.task_engine import TaskEnhancer @contextmanager def apply_patches(_patches): [p.start() for p ...
Python
0
25ff7901a495a140e4c8d0890fdc0746f54104b7
rename bundled assets files
eventviz/assets.py
eventviz/assets.py
# -*- coding: utf-8 -*- from flask.ext.assets import Bundle, Environment JS_ASSETS = [ 'js/jquery-1.9.1.js', 'js/jquery.tablesorter.js', 'js/bootstrap.js' ] JS_TIMELINE_ASSETS = [ 'js/timeline.js', 'js/eventviz-timeline.js' ] CSS_ASSETS = [ 'css/bootstrap.css', 'css/eventviz.css' ] CSS_TIM...
# -*- coding: utf-8 -*- from flask.ext.assets import Bundle, Environment JS_ASSETS = [ 'js/jquery-1.9.1.js', 'js/jquery.tablesorter.js', 'js/bootstrap.js' ] JS_TIMELINE_ASSETS = [ 'js/timeline.js', 'js/eventviz-timeline.js' ] CSS_ASSETS = [ 'css/bootstrap.css', 'css/eventviz.css' ] CSS_TIM...
Python
0.000001
61e4693988c5b89b4a82457181813e7a6e73403b
Fix slugify for use without validator
utils/text.py
utils/text.py
import codecs from django.core import exceptions from django.utils import text import translitcodec def no_validator(arg): pass def slugify(model, field, value, validator=no_validator): orig_slug = slug = text.slugify(codecs.encode(value, 'translit/long'))[:45] i = 0 while True: try: ...
import codecs from django.core import exceptions from django.utils import text import translitcodec def slugify(model, field, value, validator): orig_slug = slug = text.slugify(codecs.encode(value, 'translit/long'))[:45] i = 0 while True: try: try: validator(slug) ...
Python
0.000002
728c1e57b37e51306eeae59d11792444f7798da5
Change Events.default to use @propery access
events.py
events.py
EVENT_LEVELS = BLOCK, CONSUME, NOTIFY = range(3) # events: dict of (event_name:handler_levels) # handler_levels: 3-tuple of sets of functions class Events(object): def __init__(self, default = NOTIFY): self.default = default self.events = {} @property def default(self): ...
EVENT_LEVELS = BLOCK, CONSUME, NOTIFY = range(3) # events: dict of (event_name:handler_levels) # handler_levels: 3-tuple of sets of functions class Events(object): def __init__(self, default = NOTIFY): self.setdefault(default) self.events = {} def setdefault(self, value = NOTIFY...
Python
0
f2ffb339714ba848ea48008f20fa7adc71609b7f
add --update command to pr management util
people_admin/management/commands/create_pulls.py
people_admin/management/commands/create_pulls.py
from django.core.management.base import BaseCommand from people_admin.models import DeltaSet, PullStatus from people_admin.git import delta_set_to_pr, get_pr_status class Command(BaseCommand): help = "create pull requests from deltas" def add_arguments(self, parser): parser.add_argument("--list", def...
from django.core.management.base import BaseCommand from people_admin.models import DeltaSet, PullStatus from people_admin.git import delta_set_to_pr class Command(BaseCommand): help = "create pull requests from deltas" def add_arguments(self, parser): parser.add_argument("--list", default=False, act...
Python
0
efef8389f2536179ebea189fed33c3ca446e68ac
Refactor indicators
pyFxTrader/utils/indicators.py
pyFxTrader/utils/indicators.py
# -*- coding: utf-8 -*- import numpy as np def moving_average(x, n, type='simple'): """ compute an n period moving average. type is 'simple' | 'exponential' """ x = np.asarray(x) if type == 'simple': weights = np.ones(n) else: weights = np.exp(np.linspace(-1., 0., n)) ...
# -*- coding: utf-8 -*- import numpy as np def moving_average(x, n, type='simple'): """ compute an n period moving average. type is 'simple' | 'exponential' """ x = np.asarray(x) if type == 'simple': weights = np.ones(n) else: weights = np.exp(np.linspace(-1., 0., n)) ...
Python
0.000001
2eef6612a046b2982327a36ffe03beb4a0aa54f3
Remove dependancies on lmi-sdp and sympy for is_passive.
control/passivity.py
control/passivity.py
''' Author: Mark Yeatman Date: May 15, 2022 ''' from . import statesp as ss import numpy as np import cvxopt as cvx def is_passive(sys): ''' Indicates if a linear time invarient system is passive Constructs a linear matrix inequality and a feasibility optimization such that is a solution exists, t...
''' Author: Mark Yeatman Date: May 15, 2022 ''' from . import statesp as ss from sympy import symbols, Matrix, symarray from lmi_sdp import LMI_NSD, to_cvxopt from cvxopt import solvers import numpy as np def is_passive(sys): ''' Indicates if a linear time invarient system is passive Constructs a lin...
Python
0
6fde5b74509e11021d976860502a9a15f63201b8
fix bug of view.file_name() is None when execute anonymous
events.py
events.py
import sublime import sublime_plugin import os import time from . import context from .salesforce import util class SFDCEventListener(sublime_plugin.EventListener): def on_new_async(self, view): """ 1. Eveytime when you open a new view, default syntax is Apex 2. Set Status with current def...
import sublime import sublime_plugin import os import time from . import context from .salesforce import util class SFDCEventListener(sublime_plugin.EventListener): def on_new_async(self, view): """ 1. Eveytime when you open a new view, default syntax is Apex 2. Set Status with current def...
Python
0.99976
edfc0100e4f9658c71b321b4271b37889f48a453
Rework TMTape.
automata/tm/tape.py
automata/tm/tape.py
#!/usr/bin/env python3 """Classes and methods for working with Turing machine tapes.""" import collections class TMTape(collections.namedtuple( 'TMTape', ['tape', 'blank_symbol', 'current_position'] )): """A Turing machine tape.""" def __new__(cls, tape, *, blank_symbol, current_position=0): ...
#!/usr/bin/env python3 """Classes and methods for working with Turing machine tapes.""" class TMTape(object): """A Turing machine tape.""" def __init__(self, tape, *, blank_symbol, current_position=0, position_offset=0): """Initialize a new Turing machine tape.""" self.tape =...
Python
0
6a4b14980d4afc5290c9b2bdf8301d045a1525e2
add old command
paulla.ircbot/src/paulla/ircbot/plugins/Urls.py
paulla.ircbot/src/paulla/ircbot/plugins/Urls.py
import sqlite3 from os.path import exists, dirname, expanduser import re from urllib.parse import urlparse from os import makedirs import irc3 from irc3.plugins.command import command import requests from bs4 import BeautifulSoup @irc3.plugin class Urls: """ A plugin for print Url title """ def __ini...
import sqlite3 from os.path import exists, dirname, expanduser import re from urllib.parse import urlparse from os import makedirs import irc3 import requests from bs4 import BeautifulSoup @irc3.plugin class Urls: """ A plugin for print Url title """ def __init__(self, bot): self.bot = bot ...
Python
0.99801
70d95cb6aabe4a135827ed9027fd46197d708240
Add link to docs
homeassistant/components/mqtt_eventstream.py
homeassistant/components/mqtt_eventstream.py
""" homeassistant.components.mqtt_eventstream ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Connect two Home Assistant instances via MQTT.. For more details about this component, please refer to the documentation at https://home-assistant.io/components/mqtt_eventstream.html """ import json from homeassistant.core import E...
""" homeassistant.components.mqtt_eventstream ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Connect two Home Assistant instances via mqtt. Configuration: To use the mqtt_eventstream component you will need to add the following to your configuration.yaml file. If you do not specify a publish_topic you will not forward ev...
Python
0
5cff305e60a6c8a13843789dbdff16d12f782e81
Fix typo on openstack_nova_path help doc
perfkitbenchmarker/providers/openstack/flags.py
perfkitbenchmarker/providers/openstack/flags.py
# Copyright 2015 PerfKitBenchmarker Authors. 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 appli...
# Copyright 2015 PerfKitBenchmarker Authors. 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 appli...
Python
0.000016
28455c541b45ef6ca8e098702e0b7ea7c49a4a71
Update ASDF version.
versions/software/asdf.py
versions/software/asdf.py
from versions.software.utils import get_response, get_text_between def name(): """Return the precise name for the software.""" return 'asdf' def installed_version(): """Return the installed version of asdf.""" # I don't have a command-line version to run to get this from return '3.3.2' def lat...
from versions.software.utils import get_response, get_text_between def name(): """Return the precise name for the software.""" return 'asdf' def installed_version(): """Return the installed version of asdf.""" # I don't have a command-line version to run to get this from return '3.3.1' def lat...
Python
0
4011c54fc1e20f9d2e9514c1344ce3ee5bf032db
fix docstring
lm_atm/__init__.py
lm_atm/__init__.py
"""The pyro solver for low Mach number atmospheric flow. This implements as second-order approximate projection method. The general flow is: * create the limited slopes of rho, u and v (in both directions) * get the advective velocities through a piecewise linear Godunov method * enforce the divergence constrain...
"""The pyro solver for low Mach number atmospheric flow. This implements as second-order approximate projection method. The general flow is: * create the limited slopes of rho, u and v (in both directions) * get the advective velocities through a piecewise linear Godunov method * enforce the divergence constrai...
Python
0.000018
9362511d420a297fc1ed27f0642c4dcd527b4aff
Swap incorrect argument
babel_util/scripts/wos_to_edge.py
babel_util/scripts/wos_to_edge.py
#!/usr/bin/env python3 from parsers.wos import WOSStream from util.PajekFactory import PajekFactory from util.misc import open_file, Benchmark if __name__ == "__main__": import argparse import sys parser = argparse.ArgumentParser(description="Creates Pajek (.net) files from WOS XML") parser.add_argumen...
#!/usr/bin/env python3 from parsers.wos import WOSStream from util.PajekFactory import PajekFactory from util.misc import open_file, Benchmark if __name__ == "__main__": import argparse import sys parser = argparse.ArgumentParser(description="Creates Pajek (.net) files from WOS XML") parser.add_argumen...
Python
0.998647
8a92b08229119b21d7f79d1010fe73039bdd0d74
Fix test regression from fixing #132 and #135.
south/tests/modelsparser.py
south/tests/modelsparser.py
# -*- coding: UTF-8 -*- import unittest from south.db import db from south.tests import Monkeypatcher from south.tests.fakeapp.models import HorribleModel, Other1, Other2 from south.modelsparser import get_model_fields, get_model_meta class TestModelParsing(Monkeypatcher): """ Tests parsing of models.py fi...
# -*- coding: UTF-8 -*- import unittest from south.db import db from south.tests import Monkeypatcher from south.tests.fakeapp.models import HorribleModel, Other1, Other2 from south.modelsparser import get_model_fields, get_model_meta class TestModelParsing(Monkeypatcher): """ Tests parsing of models.py fi...
Python
0
7b6a16f2dc418e7898d5cca248228d50becf9d05
Add a method representation() for transition calendars.
calexicon/calendars/historical.py
calexicon/calendars/historical.py
from datetime import date from base import Calendar from calexicon.dates import InvalidDate, DateWithCalendar from main import JulianCalendar, ProlepticGregorianCalendar class SwitchDateWithCalendar(DateWithCalendar): def __str__(self): return "%s (%s - %s)" % ( self.calendar.date_display_stri...
from datetime import date from base import Calendar from calexicon.dates import InvalidDate, DateWithCalendar from main import JulianCalendar, ProlepticGregorianCalendar class SwitchDateWithCalendar(DateWithCalendar): def __str__(self): return "%s (%s - %s)" % ( self.calendar.date_display_stri...
Python
0
daed100280b615ab7bd50bbf54d7f40f1d5d2a42
Add CAN_DETECT
bears/python/PyDocStyleBear.py
bears/python/PyDocStyleBear.py
from coalib.bearlib.abstractions.Lint import Lint from coalib.bears.LocalBear import LocalBear from coalib.bears.requirements.PipRequirement import PipRequirement from coalib.settings.Setting import typed_list class PyDocStyleBear(LocalBear, Lint): executable = 'pydocstyle' output_regex = r'(.*\.py):(?P<line>...
from coalib.bearlib.abstractions.Lint import Lint from coalib.bears.LocalBear import LocalBear from coalib.bears.requirements.PipRequirement import PipRequirement from coalib.settings.Setting import typed_list class PyDocStyleBear(LocalBear, Lint): executable = 'pydocstyle' output_regex = r'(.*\.py):(?P<line>...
Python
0.000006
51872cd1a966f10976200dcdf9998a9119072d43
write warnings to stderr, not stdout (which might be muted)
export.py
export.py
#!/usr/bin/env python import optparse import os import sys import starbound def main(): p = optparse.OptionParser() p.add_option('-d', '--destination', dest='path', help='Destination directory') options, arguments = p.parse_args() if len(arguments) != 1: raise ValueError('On...
#!/usr/bin/env python import optparse import os import sys import starbound def main(): p = optparse.OptionParser() p.add_option('-d', '--destination', dest='path', help='Destination directory') options, arguments = p.parse_args() if len(arguments) != 1: raise ValueError('On...
Python
0
8785cade9bfe7cc3c54db0d0a068f99c5883ef1b
Allow locations to be imported from codelists management page
maediprojects/views/codelists.py
maediprojects/views/codelists.py
from flask import Flask, render_template, flash, request, Markup, \ session, redirect, url_for, escape, Response, abort, send_file, jsonify from flask.ext.login import login_required, current_user from maediprojects import app, db, models from maediprojects.query import activity as qact...
from flask import Flask, render_template, flash, request, Markup, \ session, redirect, url_for, escape, Response, abort, send_file, jsonify from flask.ext.login import login_required, current_user from maediprojects import app, db, models from maediprojects.query import activity as qact...
Python
0
bcedbe27c4fcd5a4ddb9312670b86b2548903192
Remove category
pinax/ratings/templatetags/pinax_ratings_tags.py
pinax/ratings/templatetags/pinax_ratings_tags.py
from decimal import Decimal from django import template from django.conf import settings from django.contrib.contenttypes.models import ContentType from django.db import models from django.urls import reverse from ..categories import category_value from ..models import OverallRating, Rating register = template.Libra...
from decimal import Decimal from django import template from django.conf import settings from django.contrib.contenttypes.models import ContentType from django.db import models from django.urls import reverse from ..categories import category_value from ..models import OverallRating, Rating register = template.Libra...
Python
0
e50d42032669d84c344e13863ccb8122b79b8b4a
prepare for release
auxlib/__about__.py
auxlib/__about__.py
# -*- coding: utf-8 -*- """auxiliary library to the python standard library""" from __future__ import absolute_import, division, print_function __all__ = ["__title__", "__author__", "__email__", "__license__", "__copyright__", "__homepage__"] __title__ = "auxlib" __author__ = 'Kale Franz' __email__ = 'kale...
# -*- coding: utf-8 -*- """auxiliary library to the python standard library""" from __future__ import absolute_import, division, print_function import os import sys import warnings __all__ = ["__title__", "__author__", "__email__", "__license__", "__copyright__", "__homepage__"] __title__ = "auxlib" __auth...
Python
0
01d7850ccf5b23c448a898a1a23533e8207e8e49
Bump version to 1.7.2
betfairlightweight/__init__.py
betfairlightweight/__init__.py
import logging from .apiclient import APIClient from .exceptions import BetfairError from .streaming import StreamListener from . import filters __title__ = 'betfairlightweight' __version__ = '1.7.2' __author__ = 'Liam Pauling' # Set default logging handler to avoid "No handler found" warnings. try: # Python 2.7+ ...
import logging from .apiclient import APIClient from .exceptions import BetfairError from .streaming import StreamListener from . import filters __title__ = 'betfairlightweight' __version__ = '1.7.1' __author__ = 'Liam Pauling' # Set default logging handler to avoid "No handler found" warnings. try: # Python 2.7+ ...
Python
0
24f546168b428580ccee05ba28f15e96fb5f64c9
Create a financial year
scorecard/tests/test_views.py
scorecard/tests/test_views.py
import json from infrastructure.models import FinancialYear from django.test import ( TransactionTestCase, Client, override_settings, ) from . import ( import_data, ) from .resources import ( GeographyResource, MunicipalityProfileResource, MedianGroupResource, RatingCountGroupResource,...
import json from django.test import ( TransactionTestCase, Client, override_settings, ) from . import ( import_data, ) from .resources import ( GeographyResource, MunicipalityProfileResource, MedianGroupResource, RatingCountGroupResource, ) @override_settings( SITE_ID=2, STAT...
Python
0.000002
70482d032d1acef1570b16551bf170a0a271a7ec
Put the 'import *' back into test-settings.py
humbug/test-settings.py
humbug/test-settings.py
from settings import * DATABASES['default']["NAME"] = "zephyr/tests/zephyrdb.test"
from settings import DATABASES DATABASES['default']["NAME"] = "zephyr/tests/zephyrdb.test"
Python
0.000002
7c74017bc0d76ecb34e3fab44767290f51d98a09
Decrease get_updates timeout for client test suite
humbug/test_settings.py
humbug/test_settings.py
from settings import * DATABASES["default"] = {"NAME": "zephyr/tests/zephyrdb.test", "ENGINE": "django.db.backends.sqlite3", "OPTIONS": { "timeout": 20, },} TORNADO_SERVER = 'http://localhost:9983' # Decrease the get_updates timeout to 1 second. # This allows CasperJS ...
from settings import * DATABASES["default"] = {"NAME": "zephyr/tests/zephyrdb.test", "ENGINE": "django.db.backends.sqlite3", "OPTIONS": { "timeout": 20, },} TORNADO_SERVER = 'http://localhost:9983'
Python
0
cd9374fba293f504e1b0a1112ca212fff77da7ef
Update plotlog.py
benchmark/paddle/image/plotlog.py
benchmark/paddle/image/plotlog.py
# Copyright (c) 2016 PaddlePaddle Authors. 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 applic...
# Copyright (c) 2016 PaddlePaddle Authors. 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 applic...
Python
0.000001
dfcc76dc1b3ca01859401bea4573d63ffadb419c
test group api DELETE method is not allowed for admin
billjobs/tests/tests_group_api.py
billjobs/tests/tests_group_api.py
from rest_framework import status from billjobs.tests.generics import GenericAPIStatusCode class GroupAPIAnonymousStatusCode(GenericAPIStatusCode): """ Tests status code returned by /groups endpoint for anonymous user Permissions are tested in tests_api.py """ def setUp(self): super().setU...
from rest_framework import status from billjobs.tests.generics import GenericAPIStatusCode class GroupAPIAnonymousStatusCode(GenericAPIStatusCode): """ Tests status code returned by /groups endpoint for anonymous user Permissions are tested in tests_api.py """ def setUp(self): super().setU...
Python
0.000001
4e539a2c35484fedbee2284e894b2e60635de83c
create initial models
mdot/models.py
mdot/models.py
from django.db import models from django.contrib.auth.models import User from django.forms import ModelForm # Create your models here. class Sponsor(models.Model): name = models.CharField(max_length = 50) netid = models.CharField(max_length = 8) title = models.CharField(max_length = 50) email = models...
from django.db import models # Create your models here.
Python
0.000001
5e68e35bade60e1c291739123c3ee7b2905bc6cf
Remove leading and trailing whitespace from keyworder match groups.
lib/rapidsms/parsers/keyworder.py
lib/rapidsms/parsers/keyworder.py
#!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 import re class Keyworder(object): TOKEN_MAP = [ ("slug", "([a-z0-9\-]+)"), ("letters", "([a-z]+)"), ("numbers", "(\d+)"), ("whatever", "(.+)")] def __init__(self): self.regexen = [] self.prefix = "" ...
#!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 import re class Keyworder(object): TOKEN_MAP = [ ("slug", "([a-z0-9\-]+)"), ("letters", "([a-z]+)"), ("numbers", "(\d+)"), ("whatever", "(.+)")] def __init__(self): self.regexen = [] self.prefix = "" ...
Python
0
c3cc948ceede66a70eadc300e558a42c8b06769b
Update change_names_miseq.py
scripts/change_names_miseq.py
scripts/change_names_miseq.py
#import sys import os import argparse import shutil parser = argparse.ArgumentParser(description='This program takes Miseq fastq files and renames them as sample.read_direction.#.fastq and keeps a log of the change') parser.add_argument('-s',action='store',dest='s',help='The sorce directory containing the original fas...
#import sys import os import argparse import shutil parser = argparse.ArgumentParser(description='This program takes Miseq fastq files and renames them as sample.read_direction.#.fastq and keeps a log of the change') parser.add_argument('-s',action='store',dest='s',help='The sorce directory containing the original fas...
Python
0
6d0bc825a1fd9184bf7b4007bfa82b69e5c7cb35
fix search to use sites
binstar_client/commands/search.py
binstar_client/commands/search.py
''' Search binstar for packages ''' from binstar_client.utils import get_binstar from binstar_client.utils.pprint import pprint_packages import logging log = logging.getLogger('binstar.search') def search(args): binstar = get_binstar(args) log.info("Run 'binstar show <USER/PACKAGE>' to get more details:") ...
''' Search binstar for packages ''' from binstar_client.utils import get_binstar from binstar_client.utils.pprint import pprint_packages import logging log = logging.getLogger('binstar.search') def search(args): binstar = get_binstar() log.info("Run 'binstar show <USER/PACKAGE>' to get more details:") ...
Python
0
83e071dd64807d1064fdd60ee0788f385b5f9334
Remove noise
bin/symlinks.py
bin/symlinks.py
#! /usr/bin/env python import os import fnmatch def link(source, dest): try: if not os.path.exists(dest): print("linking " + source + " to " + dest) os.symlink(source,dest) except: print("fail") def dotlink(source): dest = os.environ['HOME'] + "/." + os.path.basena...
#! /usr/bin/env python import os import fnmatch def link(source, dest): try: if not os.path.exists(dest): print("linking " + source + " to " + dest) os.symlink(source,dest) except: print("fail") def dotlink(source): dest = os.environ['HOME'] + "/." + os.path.basena...
Python
0.000094
6f7d0ce060a29af86bd7cf98de6b6b23bb248fdd
Add missing Bus import in can/__init__.py
cantools/database/can/__init__.py
cantools/database/can/__init__.py
from .database import Database from .message import Message from .message import EncodeError from .message import DecodeError from .signal import Signal from .node import Node from .bus import Bus
from .database import Database from .message import Message from .message import EncodeError from .message import DecodeError from .signal import Signal from .node import Node
Python
0.00005
903130b5802f34f619187635fb4b205184abd3d9
Add an example check
example/example.py
example/example.py
import netuitive import time import os ApiClient = netuitive.Client(url=os.environ.get('API_URL'), api_key=os.environ.get('CUSTOM_API_KEY')) MyElement = netuitive.Element() MyElement.add_attribute('Language', 'Python') MyElement.add_attribute('app_version', '7.0') MyElement.add_relation('my_child_element') MyEleme...
import netuitive import time import os ApiClient = netuitive.Client(url=os.environ.get('API_URL'), api_key=os.environ.get('CUSTOM_API_KEY')) MyElement = netuitive.Element() MyElement.add_attribute('Language', 'Python') MyElement.add_attribute('app_version', '7.0') MyElement.add_relation('my_child_element') MyEleme...
Python
0
6909fc497041761eadb5a8b8947eeb21b7fdbcc8
use GetManager method in example
examples/avatar.py
examples/avatar.py
""" Telepathy example which requests the avatar for the user's own handle and displays it in a Gtk window. """ import dbus.glib import gtk import sys from telepathy.constants import CONNECTION_STATUS_CONNECTED from telepathy.interfaces import ( CONN_MGR_INTERFACE, CONN_INTERFACE, CONN_INTERFACE_AVATARS) import t...
""" Telepathy example which requests the avatar for the user's own handle and displays it in a Gtk window. """ import dbus.glib import gtk import sys from telepathy.constants import CONNECTION_STATUS_CONNECTED from telepathy.interfaces import ( CONN_MGR_INTERFACE, CONN_INTERFACE, CONN_INTERFACE_AVATARS) import t...
Python
0.000002
26c8839edf0f756c746dee1e13f4332f0f3bf706
Update bashdoor.py
lib/modules/python/privesc/multi/bashdoor.py
lib/modules/python/privesc/multi/bashdoor.py
class Module: def __init__(self, mainMenu, params=[]): # metadata info about the module, not modified during runtime self.info = { # name for the module that will appear in module menus 'Name': 'bashdoor', # list of one or more authors for the module ...
class Module: def __init__(self, mainMenu, params=[]): # metadata info about the module, not modified during runtime self.info = { # name for the module that will appear in module menus 'Name': 'bashdoor', # list of one or more authors for the module ...
Python
0
cda7e0d2242e5cc3dafca63a3af01f150fcd37be
Fix seeds for new names
server/seed.py
server/seed.py
from tables import * fira = Font(fontName='Fira Sans Regular', family_id=1, author_id=1) fira.tags.append(Tag(text='#pretty', type='opinion')) fira.tags.append(Tag(text='Latin', type='language')) thread1 = Thread(title='I don\'t like this word') thread1.glyphs.append(Glyph(glyphName='A', version_hash='9c7075ca420f30a...
from tables import * fira = Font(name='Fira Sans Regular', family_id=1, author_id=1) fira.tags.append(Tag(text='#pretty', type='opinion')) fira.tags.append(Tag(text='Latin', type='language')) thread1 = Thread(title='I don\'t like this word') thread1.glyphs.append(Glyph(name='A', version_hash='9c7075ca420f30aedb27c481...
Python
0.000137
67f535f92d79de05aa10e86da3cdd635bc71537b
Use proper stacklevel for deprecation warnings
w3lib/util.py
w3lib/util.py
from warnings import warn def str_to_unicode(text, encoding=None, errors='strict'): warn( "The w3lib.utils.str_to_unicode function is deprecated and " "will be removed in a future release.", DeprecationWarning, stacklevel=2, ) if encoding is None: encoding = 'utf-8'...
from warnings import warn def str_to_unicode(text, encoding=None, errors='strict'): warn( "The w3lib.utils.str_to_unicode function is deprecated and " "will be removed in a future release.", DeprecationWarning ) if encoding is None: encoding = 'utf-8' if isinstance(text...
Python
0.000001
bc4cebcd5d6d0657f8e16a895fca31aad8e4ac16
Add OG help texts
meta/models.py
meta/models.py
# -*- coding: utf-8 -*- from django.contrib.contenttypes import generic from django.db import models from django.forms.models import model_to_dict from .settings import CONTENT_MODELS ### # MODELS ### class BaseMetatag(models.Model): ''' This class represent the whole meta tags class. ''' # Metatag...
# -*- coding: utf-8 -*- from django.contrib.contenttypes import generic from django.db import models from django.forms.models import model_to_dict from .settings import CONTENT_MODELS ### # MODELS ### class BaseMetatag(models.Model): ''' This class represent the whole meta tags class. url is og:url ...
Python
0
24f7d137c7a0f58625543858b8f4a09f1dead859
Update client.py
examples/client.py
examples/client.py
from controlhost import Client with Client('127.0.0.1') as client: client.subscribe('foo') try: while True: prefix, message = client.get_message() print prefix.tag print prefix.length print message except KeyboardInterrupt: client._disconnect(...
from controlhost import Client with Client('131.188.161.241') as client: client.subscribe('foo') try: while True: prefix, message = client.get_message() print prefix.tag print prefix.length print message except KeyboardInterrupt: client._disco...
Python
0.000001
535640d2d26beec2c8aa56386473abf4858419de
Fix mixed indentation.
bitey/loader.py
bitey/loader.py
# loader.py """ Import hook loader for LLVM bitcode files. Use the install() method to install the loader into sys.meta_path. Use the remove() method to uninstall it. """ import sys import os.path import imp from . import bind def _check_magic(filename): if os.path.exists(filename): magic = open(filenam...
# loader.py """ Import hook loader for LLVM bitcode files. Use the install() method to install the loader into sys.meta_path. Use the remove() method to uninstall it. """ import sys import os.path import imp from . import bind def _check_magic(filename): if os.path.exists(filename): magic = open(filename,"rb")...
Python
0.000001
f670152e742b5b9f7f2629b9f787134402762ce1
add nobias test
tests/chainer_tests/functions_tests/connection_tests/test_deconvolution_2d.py
tests/chainer_tests/functions_tests/connection_tests/test_deconvolution_2d.py
import unittest import numpy import chainer from chainer import cuda from chainer import functions as F from chainer import gradient_check from chainer import testing from chainer.utils.conv import get_deconv_outsize from chainer.testing import attr from chainer.testing import condition class TestDeconvolution2D(un...
import unittest import numpy import chainer from chainer import cuda from chainer import functions as F from chainer import gradient_check from chainer import testing from chainer.testing import attr from chainer.testing import condition class TestDeconvolution2D(unittest.TestCase): def setUp(self): se...
Python
0
a475173ce00b2d6686c601ffc46a8d2bc3ed0a7f
Switch back to development version
dogen/version.py
dogen/version.py
version = "2.1.0rc1.dev"
version = "2.0.0"
Python
0
c7439eb0d8a88a3a3584a3e73ed9badc910dcd05
Move newrelic initialization to the very start of wsgi initialization
contentcuration/contentcuration/wsgi.py
contentcuration/contentcuration/wsgi.py
""" WSGI config for contentcuration project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/ """ import logging import os # Attach newrelic APM try: import newrelic.agent newre...
""" WSGI config for contentcuration project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJAN...
Python
0
55d54f67111583dab4209639ef8e3d6430ea7939
Handle oversteer in turns.
src/Command_Interpreter.py
src/Command_Interpreter.py
# Motor driver for QuickBot_Follow. # John Brewer 3/31/16 # Copyright (C) 2016 Jera Design LLC # All Rights Reserverd import Motor_Driver import sys from time import sleep Motor_Driver.init_pins() print "Ready" last = "" count = 0 while True: line = sys.stdin.readline().rstrip() if not line: break...
# Motor driver for QuickBot_Follow. # John Brewer 3/31/16 # Copyright (C) 2016 Jera Design LLC # All Rights Reserverd import Motor_Driver import sys Motor_Driver.init_pins() print "Ready" while True: line = sys.stdin.readline().rstrip() if not line: break; if line == "left": print "turn...
Python
0
262dc0ebe113056e21010e061234dd6989a80a70
modify API to add parents
src/obudget/budget_lines/handlers.py
src/obudget/budget_lines/handlers.py
from datetime import datetime import urllib from django.db.models import Q from django.contrib.contenttypes.models import ContentType from django.core.urlresolvers import reverse from django.core.cache import cache from django.db.models import Count from piston.resource import Resource from piston.handler import BaseHa...
from datetime import datetime import urllib from django.db.models import Q from django.contrib.contenttypes.models import ContentType from django.core.urlresolvers import reverse from django.core.cache import cache from django.db.models import Count from piston.resource import Resource from piston.handler import BaseHa...
Python
0
6486a888cbcec7285df92020f76e3f1c5fbba0e2
Load exchange rates in test setup. Make it posible to use --keepdb
bluebottle/test/test_runner.py
bluebottle/test/test_runner.py
from django.test.runner import DiscoverRunner from django.db import connection from django.core import management from tenant_schemas.utils import get_tenant_model from bluebottle.test.utils import InitProjectDataMixin class MultiTenantRunner(DiscoverRunner, InitProjectDataMixin): def setup_databases(self, *arg...
from django.test.runner import DiscoverRunner from django.db import connection from tenant_schemas.utils import get_tenant_model from bluebottle.test.utils import InitProjectDataMixin class MultiTenantRunner(DiscoverRunner, InitProjectDataMixin): def setup_databases(self, *args, **kwargs): result = supe...
Python
0
d9a9cb9004ddc20d92441df50d3a0f73432803bb
Remove import only used for debugging
scripts/mvf_read_benchmark.py
scripts/mvf_read_benchmark.py
#!/usr/bin/env python from __future__ import print_function, division, absolute_import from builtins import range import argparse import logging import time import katdal from katdal.lazy_indexer import DaskLazyIndexer import numpy as np parser = argparse.ArgumentParser() parser.add_argument('filename') parser.add_...
#!/usr/bin/env python from __future__ import print_function, division, absolute_import from builtins import range import argparse import logging import time import dask import katdal from katdal.lazy_indexer import DaskLazyIndexer import numpy as np parser = argparse.ArgumentParser() parser.add_argument('filename')...
Python
0
873c5e8bf85a8be5a08852134967d29353ed3009
Swap ndcms for generic T3 string.
examples/simple.py
examples/simple.py
from lobster import cmssw from lobster.core import * storage = StorageConfiguration( output=[ "hdfs:///store/user/matze/test_shuffle_take29", "file:///hadoop/store/user/matze/test_shuffle_take29", "root://T3_US_NotreDame/store/user/matze/test_shuffle_take29", "sr...
from lobster import cmssw from lobster.core import * storage = StorageConfiguration( output=[ "hdfs:///store/user/matze/test_shuffle_take29", "file:///hadoop/store/user/matze/test_shuffle_take29", "root://ndcms.crc.nd.edu//store/user/matze/test_shuffle_take29", "...
Python
0.000001
6beff62ef9741cfe5ed0443250f5a93d04d74bca
Create UserCandidate model
packages/grid/backend/grid/api/users/models.py
packages/grid/backend/grid/api/users/models.py
# stdlib from typing import Optional from typing import Union # third party from nacl.encoding import HexEncoder from nacl.signing import SigningKey from pydantic import BaseModel from pydantic import EmailStr class BaseUser(BaseModel): email: Optional[EmailStr] name: Optional[str] role: Union[Optional[i...
# stdlib from typing import Optional from typing import Union # third party from nacl.encoding import HexEncoder from nacl.signing import SigningKey from pydantic import BaseModel from pydantic import EmailStr class BaseUser(BaseModel): email: Optional[EmailStr] name: Optional[str] role: Union[Optional[i...
Python
0.000002
40cbe842a7c3d596bbe07d84666d2146e9d0698b
Update or delete max 100 of 300 random domain names.
domains/views.py
domains/views.py
import random from datetime import datetime from google.appengine.ext import db from google.appengine.ext.db import stats from django.http import HttpResponseRedirect from ragendja.template import render_to_response from ragendja.dbutils import get_object_or_404 from domains.models import MAX_NAME_LENGTH, DOMAIN_CH...
import random from datetime import datetime from google.appengine.ext import db from google.appengine.ext.db import stats from django.http import HttpResponseRedirect from ragendja.template import render_to_response from ragendja.dbutils import get_object_or_404 from domains.models import MAX_NAME_LENGTH, DOMAIN_CH...
Python
0
7db2f2f9124fd82bbcaf8eabea9ff57306796f58
Fix relative path to .gitignore and other minor changes.
build/extra_gitignore.py
build/extra_gitignore.py
#!/usr/bin/env python # Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. # # Use of this source code is governed by a BSD-style license # that can be found in the LICENSE file in the root of the source # tree. An additional intellectual property rights grant can be found # in the file PATENTS. All c...
#!/usr/bin/env python # Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. # # Use of this source code is governed by a BSD-style license # that can be found in the LICENSE file in the root of the source # tree. An additional intellectual property rights grant can be found # in the file PATENTS. All c...
Python
0.00011
e3d195f0e828f135d29bbd3a7f1a1ff748a3ebc7
Implement expm approximation.
m_layer/m_layer.py
m_layer/m_layer.py
# coding=utf-8 # Copyright 2020 The Google Research Authors. # # 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 applicab...
# coding=utf-8 # Copyright 2020 The Google Research Authors. # # 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 applicab...
Python
0.000022
948a28d74c2eae3744edec60f9fbd2319873f33f
Remove unnecessary else after returns
dploy/linkcmd.py
dploy/linkcmd.py
""" The logic and workings behind the link sub-commands """ import dploy.actions as actions import dploy.utils as utils import dploy.error as error import dploy.main as main # pylint: disable=too-few-public-methods class Link(main.AbstractBaseSubCommand): """ Concrete class implementation of the link sub-comm...
""" The logic and workings behind the link sub-commands """ import dploy.actions as actions import dploy.utils as utils import dploy.error as error import dploy.main as main # pylint: disable=too-few-public-methods class Link(main.AbstractBaseSubCommand): """ Concrete class implementation of the link sub-comm...
Python
0.004957
86429b75bea758627eeef930b604e819089435a7
fix missing toUpper for location message
yowsup/layers/protocol_media/layer.py
yowsup/layers/protocol_media/layer.py
from yowsup.layers import YowLayer, YowLayerEvent, YowProtocolLayer from .protocolentities import ImageDownloadableMediaMessageProtocolEntity from .protocolentities import LocationMediaMessageProtocolEntity from .protocolentities import VCardMediaMessageProtocolEntity class YowMediaProtocolLayer(YowProtocolLayer): ...
from yowsup.layers import YowLayer, YowLayerEvent, YowProtocolLayer from .protocolentities import ImageDownloadableMediaMessageProtocolEntity from .protocolentities import LocationMediaMessageProtocolEntity from .protocolentities import VCardMediaMessageProtocolEntity class YowMediaProtocolLayer(YowProtocolLayer): ...
Python
0.000013
d17e25f899255bb361f226a022ace0eaa75a9870
Remove accidentally left-in opt kwarg
numba/cuda/tests/cudapy/test_optimization.py
numba/cuda/tests/cudapy/test_optimization.py
import numpy as np from numba.cuda.testing import skip_on_cudasim, CUDATestCase from numba import cuda, float64 import unittest def kernel_func(x): x[0] = 1 def device_func(x, y, z): return x * y + z # Fragments of code that are removed from kernel_func's PTX when optimization # is on removed_by_opt = ( ...
import numpy as np from numba.cuda.testing import skip_on_cudasim, CUDATestCase from numba import cuda, float64 import unittest def kernel_func(x): x[0] = 1 def device_func(x, y, z): return x * y + z # Fragments of code that are removed from kernel_func's PTX when optimization # is on removed_by_opt = ( ...
Python
0
4f42193b460da9c86222ddd689b2645f9a50b6e2
Update poll-sensors.py
cron/poll-sensors.py
cron/poll-sensors.py
#!/usr/bin/env python import MySQLdb import datetime import urllib2 import os servername = "localhost" username = "pi" password = "password" dbname = "pi_heating_db" t = datetime.datetime.now().strftime('%s') cnx = MySQLdb.connect(host=servername, user=username, passwd=password, db=dbname) cnx.autocommit(True) cu...
#!/usr/bin/env python import MySQLdb import datetime import urllib2 import os servername = "localhost" username = "pi" password = "password" dbname = "pi_heating_db" t = datetime.datetime.now().strftime('%s') cnx = MySQLdb.connect(host=servername, user=username, passwd=password, db=dbname) cnx.autocommit(True) cu...
Python
0
3b1334f31be1ba3dce9e12100a1fcebb15eed00e
Refactor map file script to use more functions
paasta_tools/contrib/get_containers_and_ips.py
paasta_tools/contrib/get_containers_and_ips.py
#!/usr/bin/env python import argparse import os import socket from paasta_tools.utils import atomic_file_write from paasta_tools.utils import get_docker_client HAPROXY_STATS_SOCKET = '/var/run/synapse/haproxy.sock' def get_prev_file_contents(filename): if os.path.isfile(filename): with open(filename, 'r...
#!/usr/bin/env python import argparse import os import socket from paasta_tools.utils import get_docker_client HAPROXY_STATS_SOCKET = '/var/run/synapse/haproxy.sock' def send_to_haproxy(command): s = socket.socket(socket.AF_UNIX) # 1 seconds should be more than enough of a timeout since HAProxy is local ...
Python
0
3870248740d83b0292ccca88a494ce19783847f0
Raise exception if pyspark Gateway process doesn't start.
python/pyspark/java_gateway.py
python/pyspark/java_gateway.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
Python
0
a21cdba4e742890f278c74764554711fb38ef9c1
Remove busy_downloads method, info is kept in Redis now
bqueryd/util.py
bqueryd/util.py
import netifaces import zmq import random import os import tempfile import zipfile import binascii import time import sys def get_my_ip(): eth_interfaces = sorted([ifname for ifname in netifaces.interfaces() if ifname.startswith('eth')]) if len(eth_interfaces) < 1: ifname = 'lo' else: ifnam...
import netifaces import zmq import random import os import tempfile import zipfile import binascii import time import sys def get_my_ip(): eth_interfaces = sorted([ifname for ifname in netifaces.interfaces() if ifname.startswith('eth')]) if len(eth_interfaces) < 1: ifname = 'lo' else: ifnam...
Python
0
2f50e7e71b124ae42cab5edb19c030fcc69a4ef5
Fix failing attribute lookups
saleor/product/models/utils.py
saleor/product/models/utils.py
from django.utils.encoding import smart_text def get_attributes_display_map(variant, attributes): display = {} for attribute in attributes: value = variant.get_attribute(attribute.pk) if value: choices = {smart_text(a.pk): a for a in attribute.values.all()} attr = choice...
from django.utils.encoding import smart_text def get_attributes_display_map(variant, attributes): print "in get_attributes_display_map with " + str(variant) + " and " + str(attributes) display = {} for attribute in attributes: value = variant.get_attribute(attribute.pk) if value: ...
Python
0.000001
9aee2f384e6f11d08518757a9afd7af50002cff7
Swap debug mode
gpbot/gpbot/settings.py
gpbot/gpbot/settings.py
""" Django settings for gpbot project. Generated by 'django-admin startproject' using Django 1.10.5. For more information on this file, see https://docs.djangoproject.com/en/1.10/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.10/ref/settings/ """ import os ...
""" Django settings for gpbot project. Generated by 'django-admin startproject' using Django 1.10.5. For more information on this file, see https://docs.djangoproject.com/en/1.10/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.10/ref/settings/ """ import os ...
Python
0.000001
6a8fba9bc6bb1108b048947b7ffc10c0904fba14
Move plugin loading to separate function
foob0t.py
foob0t.py
# Copyright 2017 Christoph Mende # # 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...
# Copyright 2017 Christoph Mende # # 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...
Python
0
6903779f0d34145af1f13fef7f4e07b605aec3d0
Update __init__.py
cactusbot/commands/__init__.py
cactusbot/commands/__init__.py
"""Handle commands.""" from .command import Command from .magic import COMMANDS __all__ = ["Command", "COMMANDS"]
"""Handle commands.""" from .command import Command from .magic import COMMANDS __all__ = ["Command", "COMMANDS]
Python
0.000072
5e8b82130a0bd0d63629e725fc06380105955274
Update data migration
osf/migrations/0084_preprint_node_divorce.py
osf/migrations/0084_preprint_node_divorce.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.9 on 2018-03-12 18:25 from __future__ import unicode_literals from django.db import migrations from django.db import transaction def divorce_preprints_from_nodes(apps, schema_editor): Preprint = apps.get_model('osf', 'PreprintService') PreprintContributor = a...
# -*- coding: utf-8 -*- # Generated by Django 1.11.9 on 2018-03-12 18:25 from __future__ import unicode_literals from django.db import migrations from django.db import transaction def divorce_preprints_from_nodes(apps, schema_editor): Preprint = apps.get_model('osf', 'PreprintService') PreprintContributor = a...
Python
0.000001
dd2f7da18fb295d58ac763ee7e91b9b1a5bdf1d0
Update __about__.py
bcrypt/__about__.py
bcrypt/__about__.py
# Author:: Donald Stufft (<donald@stufft.io>) # Copyright:: Copyright (c) 2013 Donald Stufft # License:: Apache License, Version 2.0 # # 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:/...
# Author:: Donald Stufft (<donald@stufft.io>) # Copyright:: Copyright (c) 2013 Donald Stufft # License:: Apache License, Version 2.0 # # 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:/...
Python
0.00002
d7c35749c682cb86356cdf825f3886e22b07942a
Add --refresh command line argument to Django admin command build_genome_blastdb
src/edge/management/commands/build_genome_blastdb.py
src/edge/management/commands/build_genome_blastdb.py
from edge.blastdb import build_all_genome_dbs from django.core.management.base import BaseCommand class Command(BaseCommand): def add_arguments(self, parser): parser.add_argument( '--refresh', action='store_true', help='Rebuild BLAST database files', ) def ...
from edge.blastdb import build_all_genome_dbs from django.core.management.base import BaseCommand class Command(BaseCommand): def handle(self, *args, **options): build_all_genome_dbs()
Python
0.000001
f7a6dc48c6d65c3937322d9e4f6e2f5e1176b03b
fix issue where a field may not exist in the data
beaver/transport.py
beaver/transport.py
import os def create_transport(beaver_config, file_config, logger): """Creates and returns a transport object""" transport_str = beaver_config.get('transport') if '.' not in transport_str: # allow simple names like 'redis' to load a beaver built-in transport module_path = 'beaver.%s_transp...
import os def create_transport(beaver_config, file_config, logger): """Creates and returns a transport object""" transport_str = beaver_config.get('transport') if '.' not in transport_str: # allow simple names like 'redis' to load a beaver built-in transport module_path = 'beaver.%s_transp...
Python
0.000001
f7f576adfccdfbc386c991bb35f2a52e9db19b5e
remove hack
tracker.py
tracker.py
from utils import * from pprint import pprint import sys from State import state from player import PlayerEventCallbacks import lastfm def track(event, args, kwargs): print "track:", repr(event), repr(args), repr(kwargs) if event is PlayerEventCallbacks.onSongChange: oldSong = kwargs["oldSong"] newSong = kwar...
from utils import * from pprint import pprint import sys from State import state from player import PlayerEventCallbacks import lastfm def track(event, args, kwargs): print "track:", repr(event), repr(args), repr(kwargs) if event is PlayerEventCallbacks.onSongChange: oldSong = kwargs["oldSong"] newSong = kwar...
Python
0
587abec7ff5b90c03885e164d9b6b62a1fb41f76
Fix the headers sent by the GitHub renderer.
grip/github_renderer.py
grip/github_renderer.py
from flask import abort, json import requests def render_content(text, gfm=False, context=None, username=None, password=None): """Renders the specified markup using the GitHub API.""" if gfm: url = 'https://api.github.com/markdown' data = {'text': text, 'mode': 'gfm'} ...
from flask import abort, json import requests def render_content(text, gfm=False, context=None, username=None, password=None): """Renders the specified markup using the GitHub API.""" if gfm: url = 'https://api.github.com/markdown' data = {'text': text, 'mode': 'gfm'} ...
Python
0
67f64792dc7321cd9521e927b4eb1a58b67cdcdc
Allow passing of direct function reference to url triple
brink/server.py
brink/server.py
from aiohttp import web from brink.config import config from brink.db import conn from brink.handlers import __handler_wrapper, __ws_handler_wrapper from brink.utils import resolve_func from brink.cli import print_globe, print_info import importlib import aiohttp_autoreload import logging def run_server(conf): fo...
from aiohttp import web from brink.config import config from brink.db import conn from brink.handlers import __handler_wrapper, __ws_handler_wrapper from brink.utils import resolve_func from brink.cli import print_globe, print_info import importlib import aiohttp_autoreload import logging def run_server(conf): fo...
Python
0
6156960333163e15fd2ddd96e831bbdf2e92163d
Correct reference to organization
src/sentry/api/bases/organization.py
src/sentry/api/bases/organization.py
from __future__ import absolute_import from sentry.api.base import Endpoint from sentry.api.exceptions import ResourceDoesNotExist from sentry.api.permissions import ScopedPermission from sentry.models import AuthIdentity, Organization, OrganizationMember class OrganizationPermission(ScopedPermission): scope_map...
from __future__ import absolute_import from sentry.api.base import Endpoint from sentry.api.exceptions import ResourceDoesNotExist from sentry.api.permissions import ScopedPermission from sentry.models import AuthIdentity, Organization, OrganizationMember class OrganizationPermission(ScopedPermission): scope_map...
Python
0.000002
606213f51e0f887f0d353b072b099b9770cc41af
Implement open_repository() as an alias to find_repository()
format.py
format.py
# Foreign branch support for Subversion # # Copyright (C) 2006 Jelmer Vernooij <jelmer@samba.org> from bzrlib.bzrdir import BzrDirFormat, BzrDir from repository import SvnRepository from branch import SvnBranch import svn.client from libsvn._core import SubversionException from bzrlib.errors import NotBranchError from...
# Foreign branch support for Subversion # # Copyright (C) 2006 Jelmer Vernooij <jelmer@samba.org> from bzrlib.bzrdir import BzrDirFormat, BzrDir from repository import SvnRepository from branch import SvnBranch import svn.client from libsvn._core import SubversionException from bzrlib.errors import NotBranchError from...
Python
0.000166
798e51e880374b43c405ce7e4314b3d1a3311c5c
Make exceptions for bad behavior (#220)
wikilabels/database/db.py
wikilabels/database/db.py
import logging from contextlib import contextmanager from psycopg2.extras import RealDictCursor from psycopg2.pool import ThreadedConnectionPool from .campaigns import Campaigns from .labels import Labels from .tasks import Tasks from .worksets import Worksets logger = logging.getLogger(__name__) class DB: def...
import logging from contextlib import contextmanager from psycopg2.extras import RealDictCursor from psycopg2.pool import ThreadedConnectionPool from .campaigns import Campaigns from .labels import Labels from .tasks import Tasks from .worksets import Worksets logger = logging.getLogger(__name__) class DB: def...
Python
0.000003
a12910798763d418f2f14d159d4b79e97dad789d
Remove TemporaryDirectory class
IPython/utils/tempdir.py
IPython/utils/tempdir.py
import os as _os import warnings as _warnings import sys as _sys from tempfile import TemporaryDirectory class NamedFileInTemporaryDirectory(object): def __init__(self, filename, mode='w+b', bufsize=-1, **kwds): """ Open a file named `filename` in a temporary directory. This context mana...
"""TemporaryDirectory class, copied from Python 3.2. This is copied from the stdlib and will be standard in Python 3.2 and onwards. """ import os as _os import warnings as _warnings import sys as _sys # This code should only be used in Python versions < 3.2, since after that we # can rely on the stdlib itself. try: ...
Python
0
5952f8cc4e46e9a1e76666b2c23c5db091500cac
Factor out the check for whether a date should be represented by Julian or Gregorian.
calexicon/calendars/historical.py
calexicon/calendars/historical.py
from datetime import date from base import Calendar from calexicon.dates import InvalidDate, DateWithCalendar from main import JulianCalendar, ProlepticGregorianCalendar class SwitchDateWithCalendar(DateWithCalendar): def __str__(self): return "%s (%s - %s)" % ( self.calendar.date_display_stri...
from datetime import date from base import Calendar from calexicon.dates import InvalidDate, DateWithCalendar from main import JulianCalendar, ProlepticGregorianCalendar class SwitchDateWithCalendar(DateWithCalendar): def __str__(self): return "%s (%s - %s)" % ( self.calendar.date_display_stri...
Python
0.999989
3f0932f8fc1277fc5354476470c2931d48f62977
bump version
callisto_core/utils/version.py
callisto_core/utils/version.py
__version__ = '0.10.11'
__version__ = '0.10.10'
Python
0
7220621fcdba6de2e0fabb69e2d51dd382e739ba
Fix Windows freeze error
freeze.py
freeze.py
#!/usr/bin/env python3 import os import re from cx_Freeze import setup, Executable with open(os.path.join("sacad", "__init__.py"), "rt") as f: version = re.search("__version__ = \"([^\"]+)\"", f.read()).group(1) build_exe_options = {"includes": ["lxml._elementpath"], "packages": ["asyncio", ...
#!/usr/bin/env python3 import os import re from cx_Freeze import setup, Executable with open(os.path.join("sacad", "__init__.py"), "rt") as f: version = re.search("__version__ = \"([^\"]+)\"", f.read()).group(1) build_exe_options = {"includes": ["lxml._elementpath"], "packages": ["asyncio"],...
Python
0.000001
ec51bcd1803a2f576f6a325b9b950d86c5d0b2a9
Cut 0.9.1
invocations/_version.py
invocations/_version.py
__version_info__ = (0, 9, 1) __version__ = '.'.join(map(str, __version_info__))
__version_info__ = (0, 9, 0) __version__ = '.'.join(map(str, __version_info__))
Python
0.000001
38b281793a52a22b4325814f9389d7d07ed95cbc
replace couchforms/by_user with reports_forms view
custom/_legacy/pact/reports/chw_list.py
custom/_legacy/pact/reports/chw_list.py
from django.core.urlresolvers import NoReverseMatch from corehq.apps.reports.datatables import DataTablesHeader, DataTablesColumn from corehq.apps.reports.generic import GenericTabularReport from corehq.apps.reports.standard import CustomProjectReport, ProjectReportParametersMixin from django.utils import html from co...
from django.core.urlresolvers import NoReverseMatch from corehq.apps.reports.datatables import DataTablesHeader, DataTablesColumn from corehq.apps.reports.generic import GenericTabularReport from corehq.apps.reports.standard import CustomProjectReport, ProjectReportParametersMixin from django.utils import html from c...
Python
0.000003
9f63ee0c05eb71ef612972867fe38791eaf2d86a
Fix #dnu implementation to not include self in the arg array
src/som/vmobjects/abstract_object.py
src/som/vmobjects/abstract_object.py
class AbstractObject(object): def __init__(self): pass def send(self, frame, selector_string, arguments, universe, interpreter): # Turn the selector string into a selector selector = universe.symbol_for(selector_string) # Push the receiver onto the stack fr...
class AbstractObject(object): def __init__(self): pass def send(self, frame, selector_string, arguments, universe, interpreter): # Turn the selector string into a selector selector = universe.symbol_for(selector_string) # Push the receiver onto the stack fr...
Python
0
4be292c5c38b4eec08c56a872f6cd4f390bc607a
make compiler's py3k warning a full deprecation warning #6837
Lib/compiler/__init__.py
Lib/compiler/__init__.py
"""Package for parsing and compiling Python source code There are several functions defined at the top level that are imported from modules contained in the package. parse(buf, mode="exec") -> AST Converts a string containing Python source code to an abstract syntax tree (AST). The AST is defined in compiler...
"""Package for parsing and compiling Python source code There are several functions defined at the top level that are imported from modules contained in the package. parse(buf, mode="exec") -> AST Converts a string containing Python source code to an abstract syntax tree (AST). The AST is defined in compiler...
Python
0
c05b179675afd326ca80540cd55cfd1900e2970f
Fix wrong import.
sugar/graphics/popup.py
sugar/graphics/popup.py
# Copyright (C) 2007, One Laptop Per Child # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is ...
# Copyright (C) 2007, One Laptop Per Child # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is ...
Python
0.000002