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
b5146035b7f4ae641a53bb956e9afee62c50c347
Change cache directory for vendor LST
kotori/vendor/lst/h2m/util.py
kotori/vendor/lst/h2m/util.py
# -*- coding: utf-8 -*- # (c) 2015 Andreas Motl, Elmyra UG <andreas.motl@elmyra.de> import os from appdirs import user_cache_dir from kotori.daq.intercom.c import LibraryAdapter, StructRegistryByID #from kotori.daq.intercom.cffi_adapter import LibraryAdapterCFFI def setup_h2m_structs_pyclibrary(): cache_dir = os.p...
# -*- coding: utf-8 -*- # (c) 2015 Andreas Motl, Elmyra UG <andreas.motl@elmyra.de> import os from appdirs import user_cache_dir from kotori.daq.intercom.c import LibraryAdapter, StructRegistryByID #from kotori.daq.intercom.cffi_adapter import LibraryAdapterCFFI def setup_h2m_structs_pyclibrary(): cache_dir = user...
Python
0
e6b11c0c110d0457cc31d7d798a2b35e19a0f56e
fix wrong parser
slackn/cli.py
slackn/cli.py
import sys import logging from argparse import ArgumentParser from slackn.core import Queue, Notifier from slackn.version import version log = logging.getLogger('slackn') def get_queue(s): if ':' in s: host,port = s.split(':') else: host,port = (s, 6379) return Queue(host,port) def proce...
import sys import logging from argparse import ArgumentParser from slackn.core import Queue, Notifier from slackn.version import version log = logging.getLogger('slackn') def get_queue(s): if ':' in s: host,port = s.split(':') else: host,port = (s, 6379) return Queue(host,port) def proce...
Python
0.998471
463d044cfa70de6bde04c380c459274acb71a1b6
add database
hello.py
hello.py
from flask import Flask, render_template, session, redirect, url_for, flash from flask.ext.script import Manager from flask.ext.bootstrap import Bootstrap from flask.ext.moment import Moment from flask.ext.wtf import Form from wtforms import StringField, SubmitField from wtforms.validators import Required from flask.ex...
from flask import Flask, render_template, session, redirect, url_for, flash from flask.ext.script import Manager from flask.ext.bootstrap import Bootstrap from flask.ext.moment import Moment from flask.ext.wtf import Form from wtforms import StringField, SubmitField from wtforms.validators import Required app = Flask(...
Python
0.000001
b07ada0833c1d8319e946e7444b2f2c1337c15d1
Add some debug
hello.py
hello.py
from flask import Flask, render_template, jsonify, request import pandas as pd import networkx as nx import pygraphviz as pgv import json import tempfile import numpy as np import brewer2mpl from StringIO import StringIO app = Flask(__name__) app.config['DEBUG'] = True @app.route('/') def hello(): return render_...
from flask import Flask, render_template, jsonify, request import pandas as pd import networkx as nx import pygraphviz as pgv import json import tempfile import numpy as np import brewer2mpl from StringIO import StringIO app = Flask(__name__) app.config['DEBUG'] = True @app.route('/') def hello(): return render_...
Python
0.000009
9de3dacc7c687bc5e4d11a5a334f5ef5cc4d2f37
Fix call to genome mapping code
rnacentral_pipeline/cli/genome_mapping.py
rnacentral_pipeline/cli/genome_mapping.py
# -*- coding: utf-8 -*- """ Copyright [2009-2018] EMBL-European Bioinformatics Institute Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by...
# -*- coding: utf-8 -*- """ Copyright [2009-2018] EMBL-European Bioinformatics Institute Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by...
Python
0.000002
6424edf4186236443ba4ec5a1b2ffcc26de7c695
add classifications
fl/__init__.py
fl/__init__.py
# encoding=utf-8 from pupa.scrape import Jurisdiction, Organization from .votes import FlVoteScraper from .bills import FlBillScraper from .people import FlPersonScraper class Florida(Jurisdiction): division_id = "ocd-division/country:us/state:fl" classification = "government" name = "Florida" url = "...
# encoding=utf-8 from pupa.scrape import Jurisdiction, Organization from .votes import FlVoteScraper from .bills import FlBillScraper from .people import FlPersonScraper class Florida(Jurisdiction): division_id = "ocd-division/country:us/state:fl" classification = "government" name = "Florida" url = "...
Python
0.000317
d915b43cea8e4ebb5792daaa4d537d4986fc3d0f
document for command decorator
flask_slack.py
flask_slack.py
""" flask_slack ~~~~~~~~~~~~~~~ Slack extension for Flask. :copyright: (c) 2014 by VeryCB. :license: BSD, see LICENSE for more details. """ from six import string_types __all__ = ('Slack',) __version__ = '0.1.2' __author__ = 'VeryCB <imcaibin@gmail.com>' class Slack(object): def __init__...
""" flask_slack ~~~~~~~~~~~~~~~ Slack extension for Flask. :copyright: (c) 2014 by VeryCB. :license: BSD, see LICENSE for more details. """ from six import string_types __all__ = ('Slack',) __version__ = '0.1.2' __author__ = 'VeryCB <imcaibin@gmail.com>' class Slack(object): def __init__...
Python
0.000001
6e9a0df29ba488a96293e938ed96561ee709fc4b
Improve heatmap plotting
smps/plots.py
smps/plots.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ """ import pandas as pd import matplotlib.pyplot as plt from matplotlib.colors import LogNorm import matplotlib.ticker as mtick from matplotlib.ticker import ScalarFormatter import seaborn as sns from numpy import nan_to_num default_cmap = sns.cubehelix_palette(8, as_c...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ """ import pandas as pd import matplotlib.pyplot as plt from matplotlib.colors import LogNorm import matplotlib.ticker as mtick from matplotlib.ticker import ScalarFormatter import seaborn as sns default_cmap = sns.cubehelix_palette(8, as_cmap=True) rc_log = { 'xt...
Python
0
40d9ceb14c57c109e8f6371b1a4c677fa33e1669
Bump base package requirements (#10078)
snmp/setup.py
snmp/setup.py
# (C) Datadog, Inc. 2018-present # All rights reserved # Licensed under a 3-clause BSD style license (see LICENSE) from codecs import open # To use a consistent encoding from os import path from setuptools import setup HERE = path.dirname(path.abspath(__file__)) # Get version info ABOUT = {} with open(path.join(HER...
# (C) Datadog, Inc. 2018-present # All rights reserved # Licensed under a 3-clause BSD style license (see LICENSE) from codecs import open # To use a consistent encoding from os import path from setuptools import setup HERE = path.dirname(path.abspath(__file__)) # Get version info ABOUT = {} with open(path.join(HER...
Python
0
17bb20d7f7b236feb1c2eff9d71420e672c87431
Fix typo
djchoices/choices.py
djchoices/choices.py
import re from django.core.exceptions import ValidationError try: from collections import OrderedDict except ImportError: # Py2.6, fall back to Django's implementation from django.utils.datastructures import SortedDict as OrderedDict try: from django.utils import six except ImportError: import six _...
import re from django.core.exceptions import ValidationError] try: from collections import OrderedDict except ImportError: # Py2.6, fall back to Django's implementation from django.utils.datastructures import SortedDict as OrderedDict try: from django.utils import six except ImportError: import six ...
Python
0.999999
0a0ebb7dd3267d727e6af598f6d964cd4d73fd69
Add TODO for multiple e-mail verification clicks.
eduid_signup/utils.py
eduid_signup/utils.py
from uuid import uuid4 from hashlib import sha256 import datetime from pyramid.httpexceptions import HTTPInternalServerError from eduid_signup.i18n import TranslationString as _ from eduid_signup.compat import text_type def generate_verification_link(request): code = text_type(uuid4()) link = request.route...
from uuid import uuid4 from hashlib import sha256 import datetime from pyramid.httpexceptions import HTTPInternalServerError from eduid_signup.i18n import TranslationString as _ from eduid_signup.compat import text_type def generate_verification_link(request): code = text_type(uuid4()) link = request.route...
Python
0
0019d3a4d512c4b7da2670872cd880bbe76edd80
Bump version to 0.4.0
arghelper.py
arghelper.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2014-2016 The arghelper developers. All rights reserved. # Project site: https://github.com/questrail/arghelper # Use of this source code is governed by a MIT-style license that # can be found in the LICENSE.txt file for the project. """Provide helper functi...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2014-2016 The arghelper developers. All rights reserved. # Project site: https://github.com/questrail/arghelper # Use of this source code is governed by a MIT-style license that # can be found in the LICENSE.txt file for the project. """Provide helper functi...
Python
0.000001
46483b7e551e5180ff36d6892221e4b583f107ac
Use HTTPS for oauth/authenticate step.
le_social/twitter/views.py
le_social/twitter/views.py
from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.shortcuts import redirect from django.views import generic from twitter import Twitter, OAuth, TwitterError from twitter.oauth_dance import parse_oauth_tokens class OAuthMixin(object): consumer_key = None con...
from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.shortcuts import redirect from django.views import generic from twitter import Twitter, OAuth, TwitterError from twitter.oauth_dance import parse_oauth_tokens class OAuthMixin(object): consumer_key = None con...
Python
0
f9141964ffa4ed36420b8ba564407c2ca661ac46
edit on glitter
glitter.py
glitter.py
from willie.module import commands import random @commands('glitter') def ans(bot, trigger): bot.say("*'-.*\(^O^)/*.-'*")
from willie.module import commands import random @commands('glitter') def ans(bot, trigger): bot.reply("*'-.*\(^O^)/*.-'*")
Python
0
3a83ff315db6f34fb8e656309580060cf708b8a1
Refactor request body
request.py
request.py
''' Code adapted from https://westus.dev.cognitive.microsoft.com/docs/services/TextAnalytics.V2.0/operations/56f30ceeeda5650db055a3c9 ''' import http.client, urllib.request, urllib.parse, urllib.error import script import numpy as np def main(): ''' Sends a single POST request with a test bit of text. ''' ...
''' Code adapted from https://westus.dev.cognitive.microsoft.com/docs/services/TextAnalytics.V2.0/operations/56f30ceeeda5650db055a3c9 ''' import http.client, urllib.request, urllib.parse, urllib.error import script def main(): ''' Sends a single POST request with a test bit of text. ''' headers = heade...
Python
0
c5d68743bf6392ae5e4c6bd80ed6727bfebf77fd
Solve basic/string2.py Please enter the commit message for your changes. Lines starting
basic/string2.py
basic/string2.py
#!/usr/bin/python2.4 -tt # Copyright 2010 Google Inc. # Licensed under the Apache License, Version 2.0 # http://www.apache.org/licenses/LICENSE-2.0 # Google's Python Class # http://code.google.com/edu/languages/google-python-class/ # Additional basic string exercises # D. verbing # Given a string, if its length is a...
#!/usr/bin/python2.4 -tt # Copyright 2010 Google Inc. # Licensed under the Apache License, Version 2.0 # http://www.apache.org/licenses/LICENSE-2.0 # Google's Python Class # http://code.google.com/edu/languages/google-python-class/ # Additional basic string exercises # D. verbing # Given a string, if its length is a...
Python
0.998948
6f7a75dd98c1f2cc82fe357a3c7cd2147f70db9d
add download_date to API download of single and multiple URLs
newsplease/__init__.py
newsplease/__init__.py
import datetime import os import sys import urllib from six.moves import urllib sys.path.append(os.path.dirname(os.path.realpath(__file__))) from newsplease.pipeline.extractor import article_extractor from newsplease.crawler.items import NewscrawlerItem from dotmap import DotMap from newsplease.pipeline.pipelines im...
import os import sys import urllib from six.moves import urllib sys.path.append(os.path.dirname(os.path.realpath(__file__))) from newsplease.pipeline.extractor import article_extractor from newsplease.crawler.items import NewscrawlerItem from dotmap import DotMap from newsplease.pipeline.pipelines import ExtractedIn...
Python
0
634aa9818875c15c3db0ac0763fc15889936b79e
Add a structure test macro to make test writing easier.
tests.bzl
tests.bzl
# Copyright 2017 Google Inc. All rights reserved. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agre...
# Copyright 2017 Google Inc. All rights reserved. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agre...
Python
0
f5df42e6049b31b1c147da7160e0595e595c6dbc
Add logging to grade
grade.py
grade.py
#Grader called by pyxserver_wsgi.py #Loads a grader file, which is a dict containing the prompt of the question, #a feature extractor object, and a trained model. #Extracts features and runs trained model on the submission to produce a final score. #Correctness determined by ratio of score to max possible score. #Requi...
#Grader called by pyxserver_wsgi.py #Loads a grader file, which is a dict containing the prompt of the question, #a feature extractor object, and a trained model. #Extracts features and runs trained model on the submission to produce a final score. #Correctness determined by ratio of score to max possible score. #Requi...
Python
0
f96989d067f6fd073d04f96bdf2ae314c9b02d49
Use request helper function in LayersScraper
uoftscrapers/scrapers/utils/layers.py
uoftscrapers/scrapers/utils/layers.py
import requests import json from . import Scraper class LayersScraper: """A superclass for scraping Layers of the UofT Map. Map is located at http://map.utoronto.ca """ host = 'http://map.utoronto.ca/' @staticmethod def get_layers_json(campus): """Retrieve the JSON structure from ho...
import requests import json from . import Scraper class LayersScraper: """A superclass for scraping Layers of the UofT Map. Map is located at http://map.utoronto.ca """ host = 'http://map.utoronto.ca/' s = requests.Session() @staticmethod def get_layers_json(campus): """Retrieve...
Python
0
b747da4fe99372e53850a964f450c7b00a4d81c9
Add node add/delete, edge del
graph.py
graph.py
class SimpleGraph(object): """This is a simple graph program that will allow us to impliment a graph data structure""" def __init__(self, dict_graph={}): self.dict_graph = dict_graph def node(self): '''return a list of all nodes in the graph''' return list(__dict_graph.keys()) ...
class SimpleGraph(object): """This is a simple graph program that will allow us to impliment a graph data structure""" def __init__(self, dict_graph={}): self.dict_graph = dict_graph def node(self): '''return a list of all nodes in the graph''' return list(__dict_graph.keys()) ...
Python
0.000001
4dbde6b8c33a85508ae9c375fef4d4caabfb4d15
add function build_valid_filename
nlp/extractors/base.py
nlp/extractors/base.py
import re class BaseExtractor(object): def build_valid_filename(self, text): dst=text for x in '\t\n\':;",.[](){}~!@#$%^&*_+-=/<>?': dst=dst.replace(x,' ') dst=dst.replace(' ','-').replace('--','-').replace('--','-') dst=dst.strip('-') return dst ...
import re class BaseExtractor(object): def _extract(self, html): result =[] return result def find_between(self, text, s1, s2=None): if not s1: raise Exception('s1 is None!') pos1 = text.find(s1) if s2 and pos1 != -1: pos2 = text....
Python
0.00008
a2837ab778d39e66c6178dae34a3bebdc638061f
fix test
py/test/testing/test_outcome.py
py/test/testing/test_outcome.py
import py import marshal class TestRaises: def test_raises(self): py.test.raises(ValueError, "int('qwe')") def test_raises_exec(self): py.test.raises(ValueError, "a,x = []") def test_raises_syntax_error(self): py.test.raises(SyntaxError, "qwe qwe qwe") def test_raises_funct...
import py import marshal class TestRaises: def test_raises(self): py.test.raises(ValueError, "int('qwe')") def test_raises_exec(self): py.test.raises(ValueError, "a,x = []") def test_raises_syntax_error(self): py.test.raises(SyntaxError, "qwe qwe qwe") def test_raises_funct...
Python
0.000001
38dc94240fdecaa0676921d32f749ca31da94c49
Add unit tests for similarity graph and density estimation utilities.
debacl/test/test_utils.py
debacl/test/test_utils.py
##################################### ## Brian P. Kent ## test_utils.py ## created: 20140529 ## updated: 20140712 ## Test the DeBaCl utility functions. ##################################### import unittest import numpy as np import scipy.special as spspec import sys from debacl import utils as utl class TestDensit...
##################################### ## Brian P. Kent ## test_utils.py ## created: 20140529 ## updated: 20140529 ## Test the DeBaCl utility functions. ##################################### import unittest import numpy as np import scipy.special as spspec import sys sys.path.insert(0, '/home/brian/Projects/debacl/DeB...
Python
0
f0f1fb06896294f2657083aa7a077d852ea8bb4b
add sort order
ats/admin.py
ats/admin.py
from django.contrib import admin from .models import ProjectWorker class ProjectWorkerAdmin(admin.ModelAdmin): list_filter = ['user', 'project', 'job'] ordering = ['user', 'project', 'job'] admin.site.register(ProjectWorker, ProjectWorkerAdmin)
from django.contrib import admin from .models import ProjectWorker class ProjectWorkerAdmin(admin.ModelAdmin): list_filter = ['user', 'project', 'job'] admin.site.register(ProjectWorker, ProjectWorkerAdmin)
Python
0.000088
86c82a4215aeffb3ddf0a195c8a556fc5a32667a
fix save method if object is updated
nosql_schema/schema.py
nosql_schema/schema.py
import nosqlite from fields import Field from exceptions import ValidationError import config as base_config class Schema: @staticmethod def get_config(): config = vars(base_config) if 'DATABASE_PATH' not in config: config['DATABASE_PATH'] = 'database.db' return config ...
import nosqlite from fields import Field from exceptions import ValidationError import config as base_config class Schema: @staticmethod def get_config(): config = vars(base_config) if 'DATABASE_PATH' not in config: config['DATABASE_PATH'] = 'database.db' return config ...
Python
0.000001
6447899ec344d14fbb78b9a2bbbe8b75451f10f2
Set isolation level to reapeatable read
pyophase/settings_production.py
pyophase/settings_production.py
""" This is the settings file used in production. First, it imports all default settings, then overrides respective ones. Secrets are stored in and imported from an additional file, not set under version control. """ from pyophase import settings_secrets as secrets from .settings import * SECRET_KEY = secrets.SECRE...
""" This is the settings file used in production. First, it imports all default settings, then overrides respective ones. Secrets are stored in and imported from an additional file, not set under version control. """ from pyophase import settings_secrets as secrets from .settings import * SECRET_KEY = secrets.SECRE...
Python
0
4839121f90934f7e52e51c05d052d27124680be7
Remove confusing and useless "\n"
pyqode/python/backend/server.py
pyqode/python/backend/server.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Main server script for a pyqode.python backend. You can directly use this script in your application if it fits your needs or use it as a starting point for writing your own server. :: usage: server.py [-h] [-s [SYSPATH [SYSPATH ...]]] port positional argumen...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Main server script for a pyqode.python backend. You can directly use this script in your application if it fits your needs or use it as a starting point for writing your own server. :: usage: server.py [-h] [-s [SYSPATH [SYSPATH ...]]] port positional argumen...
Python
0.000072
31852bbf09e4f416f93c7720ecd9eca8cfe32d38
Update version
pyramid_request_log/__init__.py
pyramid_request_log/__init__.py
from __future__ import absolute_import from .config import includeme __version__ = '0.7'
from __future__ import absolute_import from .config import includeme __version__ = '0.6'
Python
0
3d0bb2ea93d230c6615658be31b604228c06c1b5
Optimize verison check (#4461)
python/taichi/_version_check.py
python/taichi/_version_check.py
import datetime import json import os import platform import threading import uuid from urllib import request from taichi._lib import core as _ti_core def check_version(cur_uuid): # Check Taichi version for the user. major = _ti_core.get_version_major() minor = _ti_core.get_version_minor() patch = _t...
import json import os import platform import threading from urllib import request def check_version(): # Check Taichi version for the user. major = _ti_core.get_version_major() minor = _ti_core.get_version_minor() patch = _ti_core.get_version_patch() version = f'{major}.{minor}.{patch}' payloa...
Python
0
3c3c452426b7568675028ec9def514eb6d501e35
Fix flake8 errors
qmxgraph/decoration_contents.py
qmxgraph/decoration_contents.py
import attr from qmxgraph.extra_attr_validators import tuple_of asdict = attr.asdict _is_int = attr.validators.instance_of(int) _is_str = attr.validators.instance_of(str) @attr.s(frozen=True, slots=True) class Image: """ Represet an image tag that could be embedded into a table contents. The image's...
import attr from qmxgraph.extra_attr_validators import tuple_of asdict = attr.asdict _is_int = attr.validators.instance_of(int) _is_str = attr.validators.instance_of(str) @attr.s(frozen=True, slots=True) class Image: """ Represet an image tag that could be embedded into a table contents. The image's...
Python
0.000004
6b966f68aab979bb6dab55f08ec7c5b3807295da
Update hello.py
hello.py
hello.py
import sqlite3 from flask import Flask from flask import g import cf_deployment_tracker import os # Emit Bluemix deployment event cf_deployment_tracker.track() app = Flask(__name__) # On Bluemix, get the port number from the environment variable VCAP_APP_PORT # When running this app on the local machine, default the...
import sqlite3 from flask import Flask from flask import g import cf_deployment_tracker import os # Emit Bluemix deployment event cf_deployment_tracker.track() app = Flask(__name__) # On Bluemix, get the port number from the environment variable VCAP_APP_PORT # When running this app on the local machine, default the...
Python
0.000001
3c46550771f5dc588ae9a0cf61a6980fd0315e6f
Fix e.details handling
odlclient/v2/client.py
odlclient/v2/client.py
# Copyright 2014 Hewlett-Packard Development Company, L.P. # # Author: Endre Karlson <endre.karlson@hp.com> # # 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/lice...
# Copyright 2014 Hewlett-Packard Development Company, L.P. # # Author: Endre Karlson <endre.karlson@hp.com> # # 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/lice...
Python
0.000003
791b6720e489353bb5a2b35906dd88f558f26c33
Handle NotImplementedError
ogn/gateway/process.py
ogn/gateway/process.py
import logging from ogn.commands.dbutils import session from ogn.model import AircraftBeacon, ReceiverBeacon, Location from ogn.parser import parse, ParseError logger = logging.getLogger(__name__) def replace_lonlat_with_wkt(message): location = Location(message['longitude'], message['latitude']) message['...
import logging from ogn.commands.dbutils import session from ogn.model import AircraftBeacon, ReceiverBeacon, Location from ogn.parser import parse, ParseError logger = logging.getLogger(__name__) def replace_lonlat_with_wkt(message): location = Location(message['longitude'], message['latitude']) message['...
Python
0.000001
77733f09717a2b61d5773c14b0b5a357f155dd1e
make handler authenticated and change to request body
oidenbterm/handlers.py
oidenbterm/handlers.py
import oide.lib.decorators import oide.settings as global_settings import oide.apps.filebrowser.settings as app_settings from oide.lib.handlers.base import BaseHandler from oidenbterm.mixins.kernel_mixin import KernelMixin from terminado import TermSocket from traitlets import Integer import json import tornado.web imp...
import oide.lib.decorators import oide.settings as global_settings import oide.apps.filebrowser.settings as app_settings from oide.lib.handlers.base import BaseHandler from oidenbterm.mixins.kernel_mixin import KernelMixin from terminado import TermSocket from traitlets import Integer import json import tornado.web imp...
Python
0
5c5f7981905c757cd5a750c2b2d09ea6bc6f1f28
Add BoolTypeFactory class
dataproperty/_factory.py
dataproperty/_factory.py
# encoding: utf-8 """ .. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com> """ from __future__ import absolute_import import abc import six from .converter import NopConverterCreator from .converter import IntegerConverterCreator from .converter import FloatConverterCreator from .converter import BoolConverterCr...
# encoding: utf-8 """ .. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com> """ from __future__ import absolute_import import abc import six from .converter import NopConverterCreator from .converter import IntegerConverterCreator from .converter import FloatConverterCreator from .converter import DateTimeConvert...
Python
0
f8fd1a1b7e0eb2bcbcd64fa6a352862fceea80de
Use two level danger level.
autopilot.py
autopilot.py
# -*- coding: utf-8 -*- """ Autopilots for the DriveIt Gym environment. @author: Jean-Claude Manoli """ import numpy as np from belief import BeliefTracking epsilon = 0.05 class Autopilot(object): def __init__(self, car, other_cars=None): self.car = car self.tracker = BeliefTracking(car, other_car...
# -*- coding: utf-8 -*- """ Autopilots for the DriveIt Gym environment. @author: Jean-Claude Manoli """ import numpy as np from belief import BeliefTracking epsilon = 0.05 class Autopilot(object): def __init__(self, car, other_cars=None): self.car = car self.tracker = BeliefTracking(car, other_car...
Python
0.000004
27df09cd98d9128d89d9d9d26ee0e89223fbd990
document idlerpg's external dependencies
libqtile/widget/idlerpg.py
libqtile/widget/idlerpg.py
# -*- coding: utf-8 -*- # Copyright (c) 2016 Tycho Andersen # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modi...
# -*- coding: utf-8 -*- # Copyright (c) 2016 Tycho Andersen # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modi...
Python
0
b736e69a88d3caf288f55216830a37df3b2da57c
Generate docs correctly if pexpect is not available.
docs/autogen_api.py
docs/autogen_api.py
#!/usr/bin/env python """Script to auto-generate our API docs. """ # stdlib imports import os import sys # local imports sys.path.append(os.path.abspath('sphinxext')) from apigen import ApiDocWriter #***************************************************************************** if __name__ == '__main__': pjoin = o...
#!/usr/bin/env python """Script to auto-generate our API docs. """ # stdlib imports import os import sys # local imports sys.path.append(os.path.abspath('sphinxext')) from apigen import ApiDocWriter #***************************************************************************** if __name__ == '__main__': pjoin = o...
Python
0.999999
79006fa1fe0bf78d10a1951b2cc20ba5ff245e4b
Provide 'self' argument to instance method
sklearn/utils/tests/test_metaestimators.py
sklearn/utils/tests/test_metaestimators.py
from sklearn.utils.metaestimators import if_delegate_has_method from nose.tools import assert_true class Prefix(object): def func(self): pass class MockMetaEstimator(object): """This is a mock meta estimator""" a_prefix = Prefix() @if_delegate_has_method(delegate="a_prefix") def func(se...
from sklearn.utils.metaestimators import if_delegate_has_method from nose.tools import assert_true class Prefix(object): def func(): pass class MockMetaEstimator(object): """This is a mock meta estimator""" a_prefix = Prefix() @if_delegate_has_method(delegate="a_prefix") def func(self):...
Python
0.999981
f9f3ca75e8151b1467fddffe390aee6a8fe00259
Change configuration for wsgi settings
dev_cloud/web_service/wsgi.py
dev_cloud/web_service/wsgi.py
# -*- coding: utf-8 -*- # @COPYRIGHT_begin # # Copyright [2015] Michał Szczygieł, M4GiK Software # # 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...
# -*- coding: utf-8 -*- # @COPYRIGHT_begin # # Copyright [2015] Michał Szczygieł, M4GiK Software # # 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
f3724421fa859a5970e66353b6a311aa14b866ec
Add additional spacing to improve readability
labs/lab-5/ex5-1.log.py
labs/lab-5/ex5-1.log.py
#!/usr/bin/python # # Copyright 2016 BMC Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
#!/usr/bin/python # # Copyright 2016 BMC Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
Python
0.000003
1adb2c16780a2bbdf5a40368a856dc4b6e9df9f6
build out initial email example, small change to README
example-emailed_daily_operational_report.py
example-emailed_daily_operational_report.py
import liveengage_data_app as le_api def get_skills(application): skills_data = application.get_skills_data() print(str(skills_data['errors'])) if skills_data['errors'] else print('ok') account_skills = [{}] for skill in skills_data: account_skills.append({ 'id': skill['id'], ...
import liveengage_data_app as le_api app = le_api.LiveEngageDataApp(account_number='xx', keys_and_secrets={ 'consumer_key':'xx', 'consumer_secret':'xx', 'token_key':'xx', ...
Python
0.000361
7760765e32b81bad6957d333850293db86a2bbcf
Fixes 'Document instance has no attribute 'file_basename''
doc2text/__init__.py
doc2text/__init__.py
import PyPDF2 as pyPdf import PythonMagick import os import mimetypes import cv2 from .page import Page acceptable_mime = ["image/bmp", "image/png", "image/tiff", "image/jpg", "video/JPEG", "video/jpeg2000"] def main(): """Entry point for the application script""" print("Call your main application code here")...
import PyPDF2 as pyPdf import PythonMagick import os import mimetypes import cv2 from .page import Page acceptable_mime = ["image/bmp", "image/png", "image/tiff", "image/jpg", "video/JPEG", "video/jpeg2000"] def main(): """Entry point for the application script""" print("Call your main application code here")...
Python
0.997427
d40f1fe493ec2c71d84ac84f5dc989c68de321ca
add version option
batch_isp.py
batch_isp.py
import argparse from parts import Parts from pgm_error import PgmError from operations import Operations from serial_io import SerialIO class BatchISP: def __init__(self): parser = argparse.ArgumentParser( description='Linux remake of Atmel\'s BatchISP utility.') parser.add_argumen...
import argparse from parts import Parts from pgm_error import PgmError from operations import Operations from serial_io import SerialIO class BatchISP: def __init__(self): parser = argparse.ArgumentParser( description='Linux remake of Atmel\'s BatchISP utility.') parser.add_argumen...
Python
0.000001
84fc6f4e05c30e368b869b0e5af80b90db5b0ace
Write generic push instructions for the time being
Lib/extractor/stream.py
Lib/extractor/stream.py
# -*- coding: utf-8 -*- from fontTools.misc.textTools import num2binary from fontTools.ttLib.tables.ttProgram import streamOpcodeDict, opcodeDict from io import BytesIO class InstructionStream(object): """ :param program_bytes: The program bytecode. :type program_bytes: bytes The instruction stream....
# -*- coding: utf-8 -*- from fontTools.misc.textTools import num2binary from fontTools.ttLib.tables.ttProgram import streamOpcodeDict, opcodeDict from io import BytesIO class InstructionStream(object): """ :param program_bytes: The program bytecode. :type program_bytes: bytes The instruction stream....
Python
0.000002
1ea72ca96f0f43bd80baa9fb41ec930ea02de271
fix name error
sfa/rspecs/sfa_rspec_converter.py
sfa/rspecs/sfa_rspec_converter.py
#!/usr/bin/python from lxml import etree from StringIO import StringIO from sfa.util.xrn import * from sfa.rspecs.sfa_rspec import SfaRSpec from sfa.rspecs.pg_rspec import PGRSpec class SfaRSpecConverter: @staticmethod def to_pg_rspec(rspec): if isinstance(rspec, SfaRSpec): sfa_rspec = rs...
#!/usr/bin/python from lxml import etree from StringIO import StringIO from sfa.util.xrn import * from sfa.rspecs.sfa_rspec import SfaRSpec from sfa.rspecs.pg_rspec import PGRSpec class SfaRSpecConverter: @staticmethod def to_pg_rspec(rspec): if isinstance(rspec, SfaRSpec): sfa_rspec = rs...
Python
0.000024
c0a075810e3d92295ade789c24d141c1dbba60c4
Add support for secret driver in create_secret
docker/api/secret.py
docker/api/secret.py
import base64 import six from .. import errors from .. import utils class SecretApiMixin(object): @utils.minimum_version('1.25') def create_secret(self, name, data, labels=None, driver=None): """ Create a secret Args: name (string): Name of the secret ...
import base64 import six from .. import utils class SecretApiMixin(object): @utils.minimum_version('1.25') def create_secret(self, name, data, labels=None): """ Create a secret Args: name (string): Name of the secret data (bytes): Secret data ...
Python
0
dbf3af1de0bbbda178e5bbd1ca0473a83d8cb9b3
test triggering travis
fabre_test.py
fabre_test.py
#!/usr/bin/env python # coding=UTF-8 import sys import pytest sys.exit(0)
#!/usr/bin/env python # coding=UTF-8 import sys sys.exit(0)
Python
0.000001
4cff5b7a14dfda786fef4a869e72095b7d9d83e4
correct relative import, d'oh
pyjac/performance_tester/__main__.py
pyjac/performance_tester/__main__.py
import sys import os from . import performance_tester as pt from argparse import ArgumentParser def main(args=None): if args is None: # command line arguments parser = ArgumentParser(description='performance_tester.py: ' 'tests pyJac performance' ...
import sys import os import .performance_tester as pt from argparse import ArgumentParser def main(args=None): if args is None: # command line arguments parser = ArgumentParser(description='performance_tester.py: ' 'tests pyJac performance' ...
Python
0.000035
7596de67f67f5bdc9350067a896dcd4b7b4c7650
Stop requiring the path of the users file; only require the name.
gobbldygook.py
gobbldygook.py
#!/usr/bin/env python3 import argparse, csv, os from course import Course, all_courses, all_labs, getCourse from student import Student def argument_parse(): parser = argparse.ArgumentParser(description="This program works best if you give it some data. However, we have some example stuff to show you anyway.)") pa...
#!/usr/bin/env python3 import argparse, csv, os from course import Course, all_courses, all_labs, getCourse from student import Student def argument_parse(): parser = argparse.ArgumentParser(description="This program works best if you give it some data. However, we have some example stuff to show you anyway.)") pa...
Python
0
d73c6addf064ba7b78c4874a6affc6bac6dfee1f
Add image feature detection
image.py
image.py
from __future__ import division import numpy as np import cv2 import time, io from matplotlib import pyplot as plt from google.cloud import vision MIN_MATCH_COUNT = 200 # only using match count right now MIN_MATCH_RATIO = .2 def compare(img1_name, img2_name): """ Return whether img1 and img2 differ signfician...
from __future__ import division import numpy as np import cv2 import time from matplotlib import pyplot as plt MIN_MATCH_COUNT = 200 # only using match count right now MIN_MATCH_RATIO = .2 def compare(img1_name, img2_name): """ Return whether img1 and img2 differ signficiantly Determined through feature ...
Python
0
377aef17394b2dabd6db7439d3cfcd4e0d54a3c2
Allow codata tests to be run as script.
scipy/constants/tests/test_codata.py
scipy/constants/tests/test_codata.py
import warnings from scipy.constants import find from numpy.testing import assert_equal, run_module_suite def test_find(): warnings.simplefilter('ignore', DeprecationWarning) keys = find('weak mixing', disp=False) assert_equal(keys, ['weak mixing angle']) keys = find('qwertyuiop', disp=False) ...
import warnings from scipy.constants import find from numpy.testing import assert_equal def test_find(): warnings.simplefilter('ignore', DeprecationWarning) keys = find('weak mixing', disp=False) assert_equal(keys, ['weak mixing angle']) keys = find('qwertyuiop', disp=False) assert_equal(keys,...
Python
0.000004
67c2e8ba33b5bcc83f0242bece81f604d21939db
Fix editing error
pytest-profiling/pytest_profiling.py
pytest-profiling/pytest_profiling.py
from __future__ import absolute_import import pytest import os import cProfile import pstats import pipes import six import errno from hashlib import md5 LARGE_FILENAME_HASH_LEN = 8 def clean_filename(s): forbidden_chars = set('/?<>\:*|"') return six.text_type("".join(c if c not in forbidden_chars and ord(...
from __future__ import absolute_import import pytest import os import cProfile import pstats import pipes import six import errno from hashlib import md5 LARGE_FILENAME_HASH_LEN = 8 def clean_filename(s): forbidden_chars = set('/?<>\:*|"') return six.text_type("".join(c if c not in forbidden_chars and ord(...
Python
0.000002
20d39fe954e9dc62bbe283ad89b7c140529a23df
Remove WindowDict.__contains__
gorm/window.py
gorm/window.py
from collections import deque, MutableMapping class WindowDict(MutableMapping): """A dict that keeps every value that a variable has had over time. Look up a revision number in this dict and it will give you the effective value as of that revision. Keys should always be revision numbers. Once a key i...
from collections import deque, MutableMapping class WindowDict(MutableMapping): """A dict that keeps every value that a variable has had over time. Look up a revision number in this dict and it will give you the effective value as of that revision. Keys should always be revision numbers. Once a key i...
Python
0.000055
0e5118f0ec68ead39392e168efcc1a957162bb3f
Fix NIN example
examples/imagenet/nin.py
examples/imagenet/nin.py
import math from chainer import FunctionSet, Variable import chainer.functions as F class NIN(FunctionSet): """Network-in-Network example model.""" insize = 227 def __init__(self): w = math.sqrt(2) # MSRA scaling super(NIN, self).__init__( conv1 = F.Convolution2D( 3, 96,...
import math from chainer import FunctionSet, Variable import chainer.functions as F class NIN(FunctionSet): """Network-in-Network example model.""" insize = 227 def __init__(self): w = math.sqrt(2) # MSRA scaling super(NIN, self).__init__( conv1 = F.Convolution2D( 3, 96,...
Python
0.023101
e4fbd6f8e13861053a4a29c776ae24b934639fa5
fix ports on yaml script
tools/scripts/mosaic/gen_yaml.py
tools/scripts/mosaic/gen_yaml.py
#!/usr/bin/env python3 # # Create a yaml file for running a mosaic file # Note: *requires pyyaml* import argparse import yaml def address(port): return ['127.0.0.1', port] def create_peers(peers): res = [] for p in peers: res += [{'addr':address(p[1])}] return res def entity(role, port, peers...
#!/usr/bin/env python3 # # Create a yaml file for running a mosaic file # Note: *requires pyyaml* import argparse import yaml def address(port): return ['127.0.0.1', port] def create_peers(peers): res = [] for p in peers: res += [{'addr':address(p[1])}] return res def entity(role, port, peers...
Python
0
8e664b417d978d040d780dc252418fce087c47f4
Fix version option
src/htrun/htrun.py
src/htrun/htrun.py
# # Copyright (c) 2021-2022 Arm Limited and Contributors. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # """Greentea Host Tests Runner.""" from multiprocessing import freeze_support from htrun import init_host_test_cli_params from htrun.host_tests_runner.host_test_default import DefaultTestSelector from ...
# # Copyright (c) 2021 Arm Limited and Contributors. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # """Greentea Host Tests Runner.""" from multiprocessing import freeze_support from htrun import init_host_test_cli_params from htrun.host_tests_runner.host_test_default import DefaultTestSelector from htrun...
Python
0.999999
625c70580770b5bb00a64d15e14d15c623db21ee
Update urls.py
taiga/base/utils/urls.py
taiga/base/utils/urls.py
import django_sites as sites URL_TEMPLATE = "{scheme}://{domain}/{path}" def build_url(path, scheme="http", domain="localhost"): return URL_TEMPLATE.format(scheme=scheme, domain=domain, path=path.lstrip("/")) def is_absolute_url(path): """Test wether or not `path` is absolute url.""" return path.starts...
import django_sites as sites URL_TEMPLATE = "{scheme}://{domain}/{path}" def build_url(path, scheme="http", domain="localhost"): return URL_TEMPLATE.format(scheme=scheme, domain=domain, path=path.lstrip("/")) def is_absolute_url(path): """Test wether or not `path` is absolute url.""" return path.starts...
Python
0.000002
1656cbd6b62690017af810e795b8a23b3907a1fa
bump 1.0.2
epubuilder/version.py
epubuilder/version.py
# coding=utf-8 __version__ = '1.0.2'
# coding=utf-8 __version__ = '1.0.1'
Python
0.000003
c8fdcf888f6c34e8396f11b3e7ab3088af59abb6
Add tests for slice intersection and sanitization.
distarray/tests/test_utils.py
distarray/tests/test_utils.py
import unittest from distarray import utils from numpy import arange from numpy.testing import assert_array_equal class TestMultPartitions(unittest.TestCase): """ Test the multiplicative parition code. """ def test_both_methods(self): """ Do the two methods of computing the multiplic...
import unittest from distarray import utils class TestMultPartitions(unittest.TestCase): """ Test the multiplicative parition code. """ def test_both_methods(self): """ Do the two methods of computing the multiplicative partitions agree? """ for s in [2, 3]: ...
Python
0
c54fb802932717b417ed2e189da85b500c8e06b8
Update rasa_core/policies/mapping_policy.py
rasa_core/policies/mapping_policy.py
rasa_core/policies/mapping_policy.py
import logging import os from typing import Any, List, Text, Optional from rasa_core.actions.action import (ACTION_LISTEN_NAME, ACTION_RESTART_NAME, ACTION_BACK_NAME) from rasa_core import utils from rasa_core.domain import Domain from rasa_core.policies.policy import Policy from...
import logging import os from typing import Any, List, Text, Optional from rasa_core.actions.action import (ACTION_LISTEN_NAME, ACTION_RESTART_NAME, ACTION_BACK_NAME) from rasa_core import utils from rasa_core.domain import Domain from rasa_core.policies.policy import Policy from...
Python
0
673b123b147b99f49357b02c227b1d34ae653485
Set up some realistic defaults.
bootstrap.py
bootstrap.py
"""This script will bootstrap the database to a minimal level for usage. You will be left with the following buildings: * Town Hall (homely). * Farm (requires Town Hall). * Stable (requires Farm) You will be left with the following land features: * Mine (provides gold) * Quarry (provides stone) * Lake (provides water...
"""This script will bootstrap the database to a minimal level for usage. You will be left with the following buildings: * Town Hall (homely). * Farm (requires Town Hall). * Stable (requires Farm) You will be left with the following land features: * Mine (provides gold) * Quarry (provides stone) * Lake (provides water...
Python
0
208b6cf99d90494df9a0f6d66a0ea3669ff5fe66
remove get, add ls and rm
dog/ext/config.py
dog/ext/config.py
import logging from discord.ext import commands from dog import Cog log = logging.getLogger(__name__) class Config(Cog): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.permitted_keys = [ 'woof_response' ] @commands.group() @commands.guild_...
import logging from discord.ext import commands from dog import Cog log = logging.getLogger(__name__) class Config(Cog): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.permitted_keys = [ 'woof_response' ] @commands.group() @commands.guild_...
Python
0.000002
546f1188444365a365dc1dd7a81c2ffc974cf8b2
change of documentation in the param vector class
ParamVector.py
ParamVector.py
class ParamVector(object): """ This class represents the vectors that defines a firewall a ParamVector is a class that represents a vector that defines a firewall. we have our indicator functions that should get parameters, lets call these functions g1...gn for each gi we can say that there is a vec...
class ParamVector(object): """ This class represents the vectors that defines a firewall a ParamVector is a class that represents a vector that defines a firewall. we have our indicator functions that should get parameters, lets call these functions g1...gn for each gi we can say that there is a vec...
Python
0
1c7317ea85206541c8d518a3fc6cb338ad6873d3
Fix requires_auth decorator
fickle/api.py
fickle/api.py
import os from functools import wraps import flask from flask import request, json USERNAME = 'fickle' def Response(data, status = 200): body = json.dumps(data) return flask.Response(body, status = status, mimetype = 'application/json') def SuccessResponse(dataset_id = None): return Response({ 'success'...
import os from functools import wraps import flask from flask import request, json USERNAME = 'fickle' def Response(data, status = 200): body = json.dumps(data) return flask.Response(body, status = status, mimetype = 'application/json') def SuccessResponse(dataset_id = None): return Response({ 'success'...
Python
0.000001
9437e024b1e1630e06d1b05972eb9049af442be0
fix bad copy/paste
build_all.py
build_all.py
#! /usr/bin/env python # -*- coding: utf-8 -*- import os import subprocess # list of projects progs = [ {'path': 'apps/EHD', 'travis': True}, {'path': 'apps/fractal/cpp', 'travis': False}, {'path': 'apps/GenMAI', 'travis': True}, {'path': 'apps/md5', 'travis': True}, {'path': 'apps/minibarreTE', '...
#! /usr/bin/env python # -*- coding: utf-8 -*- import os import subprocess # list of projects progs = [ {'path': 'apps/EHD', 'travis': True}, {'path': 'apps/fractal/cpp', 'travis': False}, {'path': 'apps/GenMAI', 'travis': True}, {'path': 'apps/md5', 'travis': True}, {'path': 'apps/minibarreTE', '...
Python
0.000009
a8cb15b1983c48547edfeb53bfb63245f7e7c892
Revert "log integrations with zabbix through pyzabbix"
dbaas_zabbix/__init__.py
dbaas_zabbix/__init__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from dbaas_zabbix.dbaas_api import DatabaseAsAServiceApi from dbaas_zabbix.provider_factory import ProviderFactory from pyzabbix import ZabbixAPI def factory_for(**kwargs): databaseinfra = kwargs['databaseinfra'] credentials = kwargs['credentials'] del kwargs[...
#!/usr/bin/env python # -*- coding: utf-8 -*- import logging import sys from dbaas_zabbix.dbaas_api import DatabaseAsAServiceApi from dbaas_zabbix.provider_factory import ProviderFactory from pyzabbix import ZabbixAPI stream = logging.StreamHandler(sys.stdout) stream.setLevel(logging.DEBUG) log = logging.getLogger('p...
Python
0
b3c1b3b66d1c720172e731d1bfc44cfb44c992a3
Revert of [Android] Re-enable content_browsertests on main waterfall. (https://codereview.chromium.org/132403005/)
build/android/pylib/gtest/gtest_config.py
build/android/pylib/gtest/gtest_config.py
# Copyright (c) 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Configuration file for android gtest suites.""" # Add new suites here before upgrading them to the stable list below. EXPERIMENTAL_TEST_SUITES = [ ...
# Copyright (c) 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Configuration file for android gtest suites.""" # Add new suites here before upgrading them to the stable list below. EXPERIMENTAL_TEST_SUITES = [ ...
Python
0.000251
3812403655153e86a8b0e1ac68c9b15e69d6a4e3
Update BUILD_OSS to 4770.
src/data/version/mozc_version_template.bzl
src/data/version/mozc_version_template.bzl
# Copyright 2010-2021, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and ...
# Copyright 2010-2021, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and ...
Python
0
b6d747599661f3ce19b4d2f6ea9f80ec9839a2d8
Update couchm.reactor.py
resources/reactors/couchm.reactor.py
resources/reactors/couchm.reactor.py
#!/usr/bin/python import argparse import mosquitto #from pushover import PushoverClient import os, sys import urllib2 import json, base64 import ConfigParser #Posting data to couchDB def post(doc): global config url = 'http://%(server)s/%(database)s/_design/energy_data/_update/measurement' % config # print url...
#!/usr/bin/python import argparse import mosquitto #from pushover import PushoverClient import os, sys import urllib2 import json, base64 #Posting data to couchDB def post(doc): global config url = 'http://%(server)s/%(database)s/_design/energy_data/_update/measurement' % config # print url request = urllib2....
Python
0
ad5df2624e19779f264443f9ec779ab8a018baaa
Add socket based fallback approach in get_local_ip
catt/util.py
catt/util.py
import ipaddress import json import socket import tempfile import time from pathlib import Path import click import ifaddr def warning(msg): click.secho("Warning: ", fg="red", nl=False, err=True) click.echo("{}.".format(msg), err=True) def echo_json(data_dict): click.echo(json.dumps(data_dict, indent=4...
import ipaddress import json import tempfile import time from pathlib import Path import click import ifaddr def warning(msg): click.secho("Warning: ", fg="red", nl=False, err=True) click.echo("{}.".format(msg), err=True) def echo_json(data_dict): click.echo(json.dumps(data_dict, indent=4, default=str)...
Python
0
7a2fd7bbdaed3ffda3cb8740d38e5f3e88dd8ce8
add name for the thread
update.py
update.py
from time import time from app import db import argparse from jobs import update_registry from util import elapsed # needs to be imported so the definitions get loaded into the registry import jobs_defs """ examples of calling this: # update everything python update.py Person.refresh --limit 10 --chunk 5 --rq # up...
from time import time from app import db import argparse from jobs import update_registry from util import elapsed # needs to be imported so the definitions get loaded into the registry import jobs_defs """ examples of calling this: # update everything python update.py Person.refresh --limit 10 --chunk 5 --rq # up...
Python
0
ce625cb3c6769e859d47b3bcc90bc772b7d92a3e
use default widget many2one in tree view
partner_multi_relation_tabs/tablib/tab.py
partner_multi_relation_tabs/tablib/tab.py
# Copyright 2014-2018 Therp BV <https://therp.nl>. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). import logging from lxml import etree from odoo import _ from odoo.osv.orm import transfer_modifiers_to_node _logger = logging.getLogger(__name__) # pylint: disable=invalid-name NAME_PREFIX = '...
# Copyright 2014-2018 Therp BV <https://therp.nl>. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). import logging from lxml import etree from odoo import _ from odoo.osv.orm import transfer_modifiers_to_node _logger = logging.getLogger(__name__) # pylint: disable=invalid-name NAME_PREFIX = '...
Python
0.000001
0b54c244e6e4b745a678fe69fc1be7c16850203d
Fix a mistake.
python/distutils/example_without_dependency/setup.py
python/distutils/example_without_dependency/setup.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # PyNurseryRhymesDemo # The MIT License # # Copyright (c) 2010,2015 Jeremie DECOCK (http://www.jdhp.org) # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # PyNurseryRhymesDemo # The MIT License # # Copyright (c) 2010,2015 Jeremie DECOCK (http://www.jdhp.org) # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in ...
Python
0.003448
d0a42e06baa46f1f9455fbfbe16a0ba3f16b4b61
Fix CellView has no set_completion method
gaphor/adapters/profiles/metaclasseditor.py
gaphor/adapters/profiles/metaclasseditor.py
""" Metaclass item editors. """ from builtins import object from zope import component from gi.repository import Gtk from zope.interface import implementer from gaphor import UML from gaphor.adapters.propertypages import create_hbox_label, EventWatcher from gaphor.core import _, transactional from gaphor.diagram imp...
""" Metaclass item editors. """ from builtins import object from zope import component from gi.repository import Gtk from zope.interface import implementer from gaphor import UML from gaphor.adapters.propertypages import create_hbox_label, EventWatcher from gaphor.core import _, transactional from gaphor.diagram imp...
Python
0
6c11b9cc9b213928e32d883d4f557f7421da6802
Add kamerstukken to dossier API
document/api.py
document/api.py
from rest_framework import serializers, viewsets from document.models import Document, Kamerstuk, Dossier class DossierSerializer(serializers.HyperlinkedModelSerializer): documents = serializers.HyperlinkedRelatedField(read_only=True, view_name='document-detail...
from rest_framework import serializers, viewsets from document.models import Document, Kamerstuk, Dossier class DossierSerializer(serializers.HyperlinkedModelSerializer): documents = serializers.HyperlinkedRelatedField(read_only=True, view_name='document-detail...
Python
0
51e35e88597d2c34905222cd04a46a2a840c0d92
Refactor Poly ABC
dimod/core/polysampler.py
dimod/core/polysampler.py
# Copyright 2019 D-Wave Systems Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
# Copyright 2019 D-Wave Systems Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
Python
0
81cd0b74e611532f8421d0dfb22266cd789a5a6a
add in oauth_keys to dev (bug 858813)
solitude/settings/sites/dev/db.py
solitude/settings/sites/dev/db.py
"""private_base will be populated from puppet and placed in this directory""" import logging import dj_database_url import private_base as private from solitude.settings import base from django_sha2 import get_password_hashers ADMINS = () ALLOWED_HOSTS = ['payments-dev.allizom.org', 'localhost'] DATABASES = {} D...
"""private_base will be populated from puppet and placed in this directory""" import logging import dj_database_url import private_base as private from solitude.settings import base from django_sha2 import get_password_hashers ADMINS = () ALLOWED_HOSTS = ['payments-dev.allizom.org', 'localhost'] DATABASES = {} D...
Python
0
6e3ad1b462a95a5d51ab7b56e475b334fed32260
add "--style=symbol_index" for outputting symbox index
shotglass/app/management/commands/show.py
shotglass/app/management/commands/show.py
import collections import os import sys from django.core.management.base import BaseCommand from django.db.models import Avg, Max, Sum from app.models import SourceFile, Symbol def show_file_index(projects): FORMAT = '{name:20} {path:50} {num_lines:>5}' print FORMAT.format(name='NAME', path='PATH', num_line...
import collections import os import sys from django.core.management.base import BaseCommand from django.db.models import Avg, Max, Sum from app.models import SourceFile, Symbol def show_file_index(projects): FORMAT = '{name:20} {path:50} {num_lines:>5}' print FORMAT.format(name='NAME', path='PATH', num_line...
Python
0.000487
701bb76a49ec88ba1352ca85e75c43e5f204ab73
remove commented code commited by mistake.
depsolver/solver/core.py
depsolver/solver/core.py
import six from depsolver.errors \ import \ DepSolverError from depsolver.compat \ import \ OrderedDict from depsolver.bundled.traitlets \ import \ HasTraits, Instance from depsolver.solver.decisions \ import \ DecisionsSet from depsolver.operations \ import \ ...
import six from depsolver.errors \ import \ DepSolverError from depsolver.compat \ import \ OrderedDict from depsolver.bundled.traitlets \ import \ HasTraits, Instance from depsolver.solver.decisions \ import \ DecisionsSet from depsolver.operations \ import \ ...
Python
0
b068180ef61b3e865bc0eb325e7722ddffa72bce
Add OTP_VERIFY_URL default val
droll/settings.py
droll/settings.py
""" Django settings for droll project. Generated by 'django-admin startproject' using Django 1.8.13. For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/settings/ """ import os im...
""" Django settings for droll project. Generated by 'django-admin startproject' using Django 1.8.13. For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/settings/ """ import os im...
Python
0.000005
3422c60553c6cd1a746e7c6e39a3e2ac707b0cf7
return only mean predictions for cost and omit variance
robo/acquisition/EnvEntropySearch.py
robo/acquisition/EnvEntropySearch.py
''' Created on Jun 8, 2015 @author: Aaron Klein ''' import emcee import numpy as np from robo.acquisition.LogEI import LogEI from robo.acquisition.EntropyMC import EntropyMC from scipy import stats class EnvEntropySearch(EntropyMC): ''' classdocs ''' def __init__(self, model, cost_model, X_lower,...
''' Created on Jun 8, 2015 @author: Aaron Klein ''' import emcee import numpy as np from robo.acquisition.LogEI import LogEI from robo.acquisition.EntropyMC import EntropyMC from scipy import stats class EnvEntropySearch(EntropyMC): ''' classdocs ''' def __init__(self, model, cost_model, X_lower,...
Python
0.000001
2d8c8cce8885b24ac1766912ee7bd1897900ae0c
fix up Comment model
dwitter/models.py
dwitter/models.py
from django.db import models from django.contrib.auth import get_user_model from django.contrib.auth.models import User from django.dispatch import receiver from django.db.models.signals import pre_delete def get_sentinel_user(): users = get_user_model().objects return users.get_or_create(username='[deleted]'...
from django.db import models from django.contrib.auth import get_user_model from django.contrib.auth.models import User from django.dispatch import receiver from django.db.models.signals import pre_delete def get_sentinel_user(): users = get_user_model().objects return users.get_or_create(username='[deleted]'...
Python
0.000001
3c87476c4d0861638ff7c3d6950377c75d3057dd
read true positions
streams/io/core.py
streams/io/core.py
# coding: utf-8 """ Code for helping to select stars from the nearby Sgr wraps. """ from __future__ import division, print_function __author__ = "adrn <adrn@astro.columbia.edu>" # Standard library import os, sys import gc # Third-party import h5py import numpy as np import numexpr import astropy.units as u from as...
# coding: utf-8 """ Code for helping to select stars from the nearby Sgr wraps. """ from __future__ import division, print_function __author__ = "adrn <adrn@astro.columbia.edu>" # Standard library import os, sys import gc # Third-party import h5py import numpy as np import numexpr import astropy.units as u from as...
Python
0.000938
c98662bf577afa1dcf1b847193dd2e856a90e864
Fix flopped windows comment
examples/app-two-programs.py
examples/app-two-programs.py
# ----------------------------------------------------------------------------- # Copyright (c) 2009-2016 Nicolas P. Rougier. All rights reserved. # Distributed under the (new) BSD License. # ----------------------------------------------------------------------------- import numpy as np from glumpy import gl, app, glo...
# ----------------------------------------------------------------------------- # Copyright (c) 2009-2016 Nicolas P. Rougier. All rights reserved. # Distributed under the (new) BSD License. # ----------------------------------------------------------------------------- import numpy as np from glumpy import gl, app, glo...
Python
0
818f1431fe67120967f385ee090d06c1038e48c4
Add project level imports so users don't have to worry about the module names.
dimensionful/__init__.py
dimensionful/__init__.py
from units import Unit from quantity import Quantity from common_units import * from constants import *
Python
0
8c37a2b8e8c80fd9ad62d707a6669ea60d7b106c
Update unit tests with new estimator class interface
sklearn/linear_model/tests/test_ransac.py
sklearn/linear_model/tests/test_ransac.py
import numpy as np from numpy.testing import assert_equal, assert_raises from sklearn import linear_model np.random.seed(1) # Generate coordinates of line X = np.arange(-200, 200) y = 0.2 * X + 20 data = np.column_stack([X, y]) # Add some faulty data outliers = np.array((10, 30, 200)) data[outliers[0], :] = (1000,...
import numpy as np from numpy.testing import assert_equal, assert_raises from sklearn import linear_model from sklearn.utils import ransac np.random.seed(1) # Generate coordinates of line X = np.arange(-200, 200) y = 0.2 * X + 20 data = np.column_stack([X, y]) # Add some faulty data outliers = np.array((10, 30, 20...
Python
0
c713aa4953063cb6e64ecaaaed464f2a441482bb
Add testing scaffolding.
lilkv/testsuite/test_basic.py
lilkv/testsuite/test_basic.py
# -*- coding: utf-8 -*- """ lilkv.testsuite.basic Test lilkv basic functionality. """ from lilkv.testsuite import LilKVTestCase from lilkv.keyspace import Keyspace from lilkv.columnfamily import ColumnFamily from lilkv.column import Column class BasicTests(LilKVTestCase): """Baseclass for testing out ...
# -*- coding: utf-8 -*- """ lilkv.testsuite.basic Test lilkv basic functionality. """ from lilkv.testsuite import LilKVTestCase from lilkv.keyspace import Keyspace from lilkv.columnfamily import ColumnFamily from lilkv.column import Column class BasicTests(LilKVTestCase): """Baseclass for testing out ...
Python
0
573d1e2498467da357a79bb865683e162e16eb14
increment version to 0.13.1
gym/version.py
gym/version.py
VERSION = '0.13.1'
VERSION = '0.13.0'
Python
0.000683
d83e8f8702755766c1c15a35297b40d25051d55e
Bump version
gym/version.py
gym/version.py
VERSION = '0.4.9'
VERSION = '0.4.8'
Python
0
3f6d5aa5ee18462ff3a9a0e366ea48f508c93a58
move to target
character.py
character.py
import pyglet # noqa from pyglet.gl import * # noqa from utility import load_image, mainbatches, window_width, window_height, calc_vel_xy # noqa from collide import * # noqa import random import math # from controller import Controller def mean(inp): return sum(inp) / float(len(inp)) green_sprite = pyglet.image...
import pyglet # noqa from pyglet.gl import * # noqa from utility import load_image, mainbatches, window_width, window_height, calc_vel_xy # noqa from collide import * # noqa import random import math # from controller import Controller def mean(inp): return sum(inp) / float(len(inp)) green_sprite = pyglet.image...
Python
0
bb9aafe090d71c2a25eb3f3a6d591a205dbb7e5e
bump to 0.9.5
dvc/__init__.py
dvc/__init__.py
""" DVC ---- Make your data science projects reproducible and shareable. """ import os VERSION = '0.9.5' if os.getenv('APPVEYOR_REPO_TAG', '').lower() != 'true' and os.getenv('TRAVIS_TAG', '') == '': # Dynamically update version try: import git repo = git.Repo(os.curdir, search_parent_director...
""" DVC ---- Make your data science projects reproducible and shareable. """ import os VERSION = '0.9.4' if os.getenv('APPVEYOR_REPO_TAG', '').lower() != 'true' and os.getenv('TRAVIS_TAG', '') == '': # Dynamically update version try: import git repo = git.Repo(os.curdir, search_parent_director...
Python
0
3aac2716972c49eb3b1b688cb1fad89ce690ca58
fix incorrect empty list condition
filter_log.py
filter_log.py
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Copyright © 2017 ciel <ciel@cieldeMBP> # # Distributed under terms of the MIT license. """ filter git log """ import codecs from call_cmd import call import config def filter_log(last_commit): commit_valid = call('git -C {} cat-file -e '.format(...
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Copyright © 2017 ciel <ciel@cieldeMBP> # # Distributed under terms of the MIT license. """ filter git log """ import codecs from call_cmd import call import config def filter_log(last_commit): commit_valid = call('git -C {} cat-file -e '.format(...
Python
0.999117
ee795da3215374f30005c9daa42de6f9d581580f
Make finglonger output a bit easier to read
finglonger.py
finglonger.py
#!/usr/bin/python import os import sys import subprocess import tempfile import yaml def validate_config(config): environment = config.get('environment') if environment is None: print "No environment set, set one in config.yaml " sys.exit(1) def validate_environment(config): if os.path...
#!/usr/bin/python import os import sys import subprocess import tempfile import yaml def validate_config(config): environment = config.get('environment') if environment is None: print "No environment set, set one in config.yaml " sys.exit(1) def validate_environment(config): if os.path...
Python
0.000005
cb4f022fb1fe0780eb2e37c8fdc8ff6a4409115c
Test and implementation for !ptr+offset loading
ostester/yamlreader.py
ostester/yamlreader.py
import collections.abc from io import StringIO import yaml import ast def parse(file): return yaml.safe_load(file) def parse_from_string(string): return parse(StringIO(string)) class Zeros(collections.abc.Sequence): """ Represents a zeroed region of memory in C >>> yaml.load("!zeros 5") ...
import collections.abc from io import StringIO import yaml import ast def parse(file): return yaml.safe_load(file) def parse_from_string(string): return parse(StringIO(string)) class Zeros(collections.abc.Sequence): """ Represents a zeroed region of memory in C >>> yaml.load("!zeros 5") ...
Python
0
fe9e6e0335716333c7cbdf6d11a737125551dc5f
Use get_terminal_size directly from shutil on newer Python version.
halo/_utils.py
halo/_utils.py
# -*- coding: utf-8 -*- """Utilities for Halo library. """ import codecs import platform import six from sys import version_info if version_info >= (3, 3): from shutil import get_terminal_size else: from backports.shutil_get_terminal_size import get_terminal_size from colorama import init from termcolor import...
# -*- coding: utf-8 -*- """Utilities for Halo library. """ import codecs import platform import six from backports.shutil_get_terminal_size import get_terminal_size from colorama import init from termcolor import colored init(autoreset=True) def is_supported(): """Check whether operating system supports main sy...
Python
0
3329b260fbea858dcfe3f6f6a9ff365467352d1f
optimize sum_lines for time consuming
fileprocess/filesline.py
fileprocess/filesline.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- r""" # .---. .----------- # / \ __ / ------ # / / \( )/ ----- (`-') _ _(`-') <-. (`-')_ # ////// '\/ ` --- ( OO).-/( (OO ).-> .-> \( OO) ) .-> # //// / // : : --- (,------...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- r""" # .---. .----------- # / \ __ / ------ # / / \( )/ ----- (`-') _ _(`-') <-. (`-')_ # ////// '\/ ` --- ( OO).-/( (OO ).-> .-> \( OO) ) .-> # //// / // : : --- (,------...
Python
0.012633
e1f1f0ca797b639a730e8804dbd5595ad0f395e0
Add docstring for module.py
package_name/module.py
package_name/module.py
""" Module provides a simple cubic_rectification function. """ import numpy as np def cubic_rectification(x): ''' Returns the rectified value of the cube of X. If X is positive, this is the cube of X, if X is negative it is 0. ''' return np.maximum(0, x**3)
import numpy as np def cubic_rectification(x): ''' Returns the rectified value of the cube of X. If X is positive, this is the cube of X, if X is negative it is 0. ''' return np.maximum(0, x**3)
Python
0.000001
d71c0745a4032ce60dd506e91665e46c4c98271f
Update forwarder_ZMQ_Server.py
ProBot_Server/Midi_Device/forwarder_ZMQ_Server.py
ProBot_Server/Midi_Device/forwarder_ZMQ_Server.py
#!/usr/bin/python import zmq def main(): print "\nProBot's ZMQ Server is running..." try: context = zmq.Context(1) # Socket facing clients frontend = context.socket(zmq.SUB) frontend.bind("tcp://*:5559") frontend.setsockopt(zmq.SUBSCRIBE, "") #...
#!/usr/bin/python import zmq def main(): print "\nServer for ProBot is running..." try: context = zmq.Context(1) # Socket facing clients frontend = context.socket(zmq.SUB) frontend.bind("tcp://*:5559") frontend.setsockopt(zmq.SUBSCRIBE, "") # So...
Python
0.000001