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
af073d3cfaddb33d9cb4675c33707a223348e3b8
fix nans from logs in large models
models/distributions/distributions.py
models/distributions/distributions.py
import math import theano.tensor as T # ---------------------------------------------------------------------------- # this is all taken from the parmesan lib c = - 0.5 * math.log(2*math.pi) def log_bernoulli(x, p, eps=1e-5): """ Compute log pdf of a Bernoulli distribution with success probability p, at valu...
import math import theano.tensor as T # ---------------------------------------------------------------------------- # this is all taken from the parmesan lib c = - 0.5 * math.log(2*math.pi) def log_bernoulli(x, p, eps=1e-5): """ Compute log pdf of a Bernoulli distribution with success probability p, at valu...
Python
0
993d08b0ca0bcf90af77709e58698b7ecc5ba6b5
Update log.py
django_tenants/log.py
django_tenants/log.py
import logging from django.db import connection class TenantContextFilter(logging.Filter): """ Add the current ``schema_name`` and ``domain_url`` to log records. Thanks to @regolith for the snippet on https://github.com/bernardopires/django-tenant-schemas/issues/248 """ def filter(self, record): ...
import logging from django.db import connection class TenantContextFilter(logging.Filter): """ Add the current ``schema_name`` and ``domain_url`` to log records. Thanks to @regolith for the snippet on https://github.com/bernardopires/django-tenant-schemas/issues/248 """ def filter(self, record): ...
Python
0.000001
463e6563bcfa63e672ec23231b1a16870b68c56d
Fix __str__ method
pathvalidate/error.py
pathvalidate/error.py
""" .. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com> """ import enum from typing import Optional, cast from ._common import Platform @enum.unique class ErrorReason(enum.Enum): FOUND_ABS_PATH = "FOUND_ABS_PATH" NULL_NAME = "NULL_NAME" INVALID_CHARACTER = "INVALID_CHARACTER" INVALID_LEN...
""" .. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com> """ import enum from typing import Optional, cast from ._common import Platform @enum.unique class ErrorReason(enum.Enum): FOUND_ABS_PATH = "FOUND_ABS_PATH" NULL_NAME = "NULL_NAME" INVALID_CHARACTER = "INVALID_CHARACTER" INVALID_LEN...
Python
0.020279
2756326b134acc6c343be8458870121baed963cb
fix db url
pergamena/settings.py
pergamena/settings.py
# -*- coding: utf-8 -*- import os os_env = os.environ class Config(object): SECRET_KEY = os_env.get('PERGAMENA_SECRET', 'secret-key') # TODO: Change me APP_DIR = os.path.abspath(os.path.dirname(__file__)) # This directory PROJECT_ROOT = os.path.abspath(os.path.join(APP_DIR, os.pardir)) BCRYPT_LOG_RO...
# -*- coding: utf-8 -*- import os os_env = os.environ class Config(object): SECRET_KEY = os_env.get('PERGAMENA_SECRET', 'secret-key') # TODO: Change me APP_DIR = os.path.abspath(os.path.dirname(__file__)) # This directory PROJECT_ROOT = os.path.abspath(os.path.join(APP_DIR, os.pardir)) BCRYPT_LOG_RO...
Python
0.999203
b7c531220fe7a46ad56eeeb160effe94510ba4b0
Use handler registration in listener
pg_bawler/listener.py
pg_bawler/listener.py
#!/usr/bin/env python ''' Listen on given channel for notification. $ python -m pg_bawler.listener mychannel If you installed notification trigger with ``pg_bawler.gen_sql`` then channel is the same as ``tablename`` argument. ''' import argparse import asyncio import importlib import logging import sys import pg...
#!/usr/bin/env python ''' Listen on given channel for notification. $ python -m pg_bawler.listener mychannel If you installed notification trigger with ``pg_bawler.gen_sql`` then channel is the same as ``tablename`` argument. ''' import argparse import asyncio import importlib import logging import sys import pg...
Python
0
36ae5c9502d8aa7189d2e89c094a18c9891cbb6a
Use PID, which represents stable ID, over ID, which is instance dependent
pg_bridge/pgbridge.py
pg_bridge/pgbridge.py
""" PostGIS bridge """ import psycopg2 import json class PGBMABridge(object): def __init__(self, layer, conn_args): self.layer = layer self.connect(conn_args) def connect(self, conn_args): self.conn = psycopg2.connect(host=conn_args['host'], ...
""" PostGIS bridge """ import psycopg2 import json class PGBMABridge(object): def __init__(self, layer, conn_args): self.layer = layer self.connect(conn_args) def connect(self, conn_args): self.conn = psycopg2.connect(host=conn_args['host'], ...
Python
0
77170407ad61370dda87c1ed3f24aa2a50cb4ccc
Access the current line directly from the Document instance instead of calculating it manually
pgcli/key_bindings.py
pgcli/key_bindings.py
import logging from prompt_toolkit.enums import EditingMode from prompt_toolkit.keys import Keys from prompt_toolkit.key_binding.manager import KeyBindingManager from prompt_toolkit.filters import Condition from .filters import HasSelectedCompletion _logger = logging.getLogger(__name__) def pgcli_bindings(get_vi_mod...
import logging from prompt_toolkit.enums import EditingMode from prompt_toolkit.keys import Keys from prompt_toolkit.key_binding.manager import KeyBindingManager from prompt_toolkit.filters import Condition from .filters import HasSelectedCompletion _logger = logging.getLogger(__name__) def pgcli_bindings(get_vi_mod...
Python
0
e3f7b73ee06301484dbb97209508c5f36a88236f
split Polar/Airfoil data. added more general modification slots for airfoil preprocessing
fusedwind/src/fusedwind/basic_airfoil.py
fusedwind/src/fusedwind/basic_airfoil.py
#!/usr/bin/env python # encoding: utf-8 from openmdao.main.api import Component, Assembly, VariableTree from openmdao.main.datatypes.api import Float, Array, Slot, Str, List # ------- variable trees --------- class PolarDataVT(VariableTree): """airfoil data at a given Reynolds number""" alpha = Array(unit...
#!/usr/bin/env python # encoding: utf-8 from openmdao.main.api import Component, Assembly, VariableTree from openmdao.main.datatypes.api import Float, Array, Slot, Str, List # ------- variable trees --------- class PolarDataVT(VariableTree): """airfoil data at a given Reynolds number""" alpha = Array(unit...
Python
0
ef53285ce0777650dbbadce92ddfdb15e401887a
Add some error tracking hints for sentry
mainapp/functions/geo_functions.py
mainapp/functions/geo_functions.py
import logging import re from typing import Optional, Dict, Any, List, Tuple from django.conf import settings from geopy import OpenCage, Nominatim, MapBox from geopy.exc import GeocoderServiceError from geopy.geocoders.base import Geocoder from slugify import slugify logger = logging.getLogger(__name__) def get_ge...
import logging import re from typing import Optional, Dict, Any, List, Tuple from django.conf import settings from geopy import OpenCage, Nominatim, MapBox from geopy.exc import GeocoderServiceError from geopy.geocoders.base import Geocoder from slugify import slugify logger = logging.getLogger(__name__) def get_ge...
Python
0
5ff6dffeaf757e360a42e22a9df6d74345a4f418
Fix panda part imports
malcolm/parts/pandabox/__init__.py
malcolm/parts/pandabox/__init__.py
# Find all subpackages, MethodMeta decorated callables, and YAML files from malcolm.packageutil import prepare_package __all__ = prepare_package(globals(), __name__) del prepare_package
# Don't import all the parts as they need to be created from # includes.pandabox.hardware_collection() from malcolm.parts.pandabox.pandaboxdriverpart import PandABoxDriverPart
Python
0.000001
370731942a2b5cdc6e0f712f5ee307f1ee45e488
Improve memory usage
markovify/chain.py
markovify/chain.py
import random import operator import bisect import json BEGIN = "___BEGIN__" END = "___END__" def accumulate(iterable, func=operator.add): """ Cumulative calculations. (Summation, by default.) Via: https://docs.python.org/3/library/itertools.html#itertools.accumulate """ it = iter(iterable) to...
import random import itertools import operator import bisect import json from collections import defaultdict BEGIN = "___BEGIN__" END = "___END__" def accumulate(iterable, func=operator.add): """ Cumulative calculations. (Summation, by default.) Via: https://docs.python.org/3/library/itertools.html#iterto...
Python
0.000228
d2fdf0d91f41350347ba460e33cc04aa1e59eb96
Call the run script from the analysis driver
analysis_driver.py
analysis_driver.py
#! /usr/bin/env python # Brokers communication between Dakota and SWASH through files. # # Arguments: # $1 is 'params.in' from Dakota # $2 is 'results.out' returned to Dakota import sys import os import re import shutil from subprocess import call import numpy as np def read(output_file, variable=None): """R...
#! /usr/bin/env python # Brokers communication between Dakota and SWASH through files. # # Arguments: # $1 is 'params.in' from Dakota # $2 is 'results.out' returned to Dakota import sys import os import re import shutil from subprocess import call import numpy as np def read(output_file, variable=None): """R...
Python
0
9e95522c847b12a19cff54737a44f569fe2cf6b7
Add method for getting Candidacy.party_name
opencivicdata/elections/admin/candidacy.py
opencivicdata/elections/admin/candidacy.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Custom administration panels for Candidacy-related models. """ from django import VERSION as django_version from django.contrib import admin from opencivicdata.core.admin import base from .. import models class CandidacySourceInline(base.LinkInline): """ Custo...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Custom administration panels for Candidacy-related models. """ from django import VERSION as django_version from django.contrib import admin from opencivicdata.core.admin import base from .. import models class CandidacySourceInline(base.LinkInline): """ Custo...
Python
0.000001
ce266cec800fd921f9b4de82fd9f9666ed2df053
Fix another shit
modules/gy-271/core/get.py
modules/gy-271/core/get.py
# Distributed with a free-will license. # Use it any way you want, profit or free, provided it fits in the licenses of its associated works. # HMC5883 # This code is designed to work with the HMC5883_I2CS I2C Mini Module available from ControlEverything.com. # https://www.controleverything.com/content/Compass?sku=HMC58...
# Distributed with a free-will license. # Use it any way you want, profit or free, provided it fits in the licenses of its associated works. # HMC5883 # This code is designed to work with the HMC5883_I2CS I2C Mini Module available from ControlEverything.com. # https://www.controleverything.com/content/Compass?sku=HMC58...
Python
0.000005
4fccaeefd67c3c736861870a8fe711a934c96e6d
Add some documentation
mythril/laser/ethereum/transaction.py
mythril/laser/ethereum/transaction.py
import logging from mythril.laser.ethereum.state import GlobalState, Environment, CalldataType from mythril.laser.ethereum.cfg import Node, Edge, JumpType from z3 import BitVec class CallTransaction: """ Represents a call value transaction """ def __init__(self, callee_address): """ Constructo...
import logging from mythril.laser.ethereum.state import GlobalState, Environment, CalldataType from mythril.laser.ethereum.cfg import Node, Edge, JumpType from z3 import BitVec class CallTransaction: def __init__(self, callee_address): self.callee_address = callee_address self.caller = BitVec("cal...
Python
0.000001
9f3bf2756debb4534ddcbf538577044e2bae6528
remove unused import
memopol2/search.py
memopol2/search.py
# -*- coding: utf-8 -*- import os os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' import logging from django.db.models import signals from django.conf import settings from whoosh import fields from whoosh.filedb.filestore import FileStorage log = logging.getLogger(__name__) WHOOSH_SCHEMA = fields.Schema(title=field...
# -*- coding: utf-8 -*- import os os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' import logging from django.db.models import signals from django.conf import settings from whoosh import fields, index from whoosh.filedb.filestore import FileStorage log = logging.getLogger(__name__) WHOOSH_SCHEMA = fields.Schema(titl...
Python
0
e995a4725873f0587300aa1d0df6d05c7eaf412c
Move package folder deletion to start of execution
matador/commands/deploy_package.py
matador/commands/deploy_package.py
#!/usr/bin/env python from .command import Command from .deploy_ticket import execute_ticket from matador.session import Session import subprocess import os import shutil import yaml from importlib.machinery import SourceFileLoader class ActionPackage(Command): def _add_arguments(self, parser): parser.pr...
#!/usr/bin/env python from .command import Command from .deploy_ticket import execute_ticket from matador.session import Session import subprocess import os import shutil import yaml from importlib.machinery import SourceFileLoader class ActionPackage(Command): def _add_arguments(self, parser): parser.pr...
Python
0.000001
534437a0d55fccae50a86a95182a0460d07c64da
Increment version number.
mopidy_pandora/__init__.py
mopidy_pandora/__init__.py
from __future__ import absolute_import, division, print_function, unicode_literals import os from mopidy import config, ext __version__ = '0.2.1' class Extension(ext.Extension): dist_name = 'Mopidy-Pandora' ext_name = 'pandora' version = __version__ def get_default_config(self): conf_file...
from __future__ import absolute_import, division, print_function, unicode_literals import os from mopidy import config, ext __version__ = '0.2.0' class Extension(ext.Extension): dist_name = 'Mopidy-Pandora' ext_name = 'pandora' version = __version__ def get_default_config(self): conf_file...
Python
0.000001
fa67f0326f9f57bc01b023a266e1f896da617ff7
make send_mail mockable by importing the module
osmaxx-py/excerptconverter/converter_helper.py
osmaxx-py/excerptconverter/converter_helper.py
from django.contrib import messages from django.core import mail from django.utils.translation import ugettext_lazy as _ import stored_messages from osmaxx.excerptexport import models def module_converter_configuration(name, export_formats, export_options): """ :param export_formats example: { ...
from django.contrib import messages from django.core.mail import send_mail from django.utils.translation import ugettext_lazy as _ import stored_messages from osmaxx.excerptexport import models def module_converter_configuration(name, export_formats, export_options): """ :param export_formats example: ...
Python
0
bac0b5e09fc172a991fb6b7172025c698c1a23d9
Add validation that type is type of Rule into MultipleRulesGrammar
grammpy/Grammars/MultipleRulesGrammar.py
grammpy/Grammars/MultipleRulesGrammar.py
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 15.08.2017 14:40 :Licence GNUv3 Part of grammpy """ import inspect from grammpy.exceptions import NotRuleException from .StringGrammar import StringGrammar from ..HashContainer import HashContainer from ..IsMethodsRuleExtension import IsMethodsRuleExtension a...
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 15.08.2017 14:40 :Licence GNUv3 Part of grammpy """ from .StringGrammar import StringGrammar from ..HashContainer import HashContainer from ..IsMethodsRuleExtension import IsMethodsRuleExtension as Rule class MultipleRulesGrammar(StringGrammar): def __i...
Python
0.000045
f09470679ee831272c97dc0765a43faca5f28e75
Remove extra newline in bordered()
dodo_commands/framework/util.py
dodo_commands/framework/util.py
# -*- coding: utf-8 -*- """Utilities.""" from six.moves import input as raw_input import os import sys def query_yes_no(question, default="yes"): """Ask a yes/no question via raw_input() and return their answer. "question" is a string that is presented to the user. "default" is the presumed answer if th...
# -*- coding: utf-8 -*- """Utilities.""" from six.moves import input as raw_input import os import sys def query_yes_no(question, default="yes"): """Ask a yes/no question via raw_input() and return their answer. "question" is a string that is presented to the user. "default" is the presumed answer if th...
Python
0.000001
6d8b1ea0e459bd3383528fb32e6b1a348b00a9bc
Remove unknown attributes.
phoxpy/server/auth.py
phoxpy/server/auth.py
# -*- coding: utf-8 -*- # # Copyright (C) 2011 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # from random import randint from phoxpy import exceptions from phoxpy.messages import PhoxRequest, PhoxR...
# -*- coding: utf-8 -*- # # Copyright (C) 2011 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # from random import randint from phoxpy import exceptions from phoxpy.messages import PhoxRequest, PhoxR...
Python
0.000002
e2cbc0a3acf793ca8c45eb17cb0071a254a7e2b7
Update parse_indepexpends.py
server/src/datasource/parse_indepexpends.py
server/src/datasource/parse_indepexpends.py
from datasource import fec from datasource import propublica import os FEC_APIKEY = os.getenv('FEC_API_KEY', '') ProPublica_APIKEY = os.getenv('PP_API_KEY', '') FecApiObj = fec.FECAPI(FEC_APIKEY) committees = FecApiObj.get_committees() PPCampFinObj = propublica.CampaignFinanceAPI(ProPublica_APIKEY) PPCong...
from datasource import fec from datasource import propublica import os FEC_APIKEY = os.getenv('FEC_API_KEY', '') ProPublica_APIKEY = os.getenv('PP_API_KEY', '') FecApiObj = fec.FECAPI(FEC_APIKEY) committees = FecApiObj.get_committees() PPCampFinObj = propublica.CampaignFinanceAPI(ProPublica_APIKEY) datafi...
Python
0
0c450f52bfd30b694cea19a80fed900b22a39b90
Update nbgrader/plugins/export.py
nbgrader/plugins/export.py
nbgrader/plugins/export.py
from traitlets import Unicode, List from .base import BasePlugin from ..api import MissingEntry class ExportPlugin(BasePlugin): """Base class for export plugins.""" to = Unicode("", help="destination to export to").tag(config=True) student = List([], help="list of students to export").tag(confi...
from traitlets import Unicode, List from .base import BasePlugin from ..api import MissingEntry class ExportPlugin(BasePlugin): """Base class for export plugins.""" to = Unicode("", help="destination to export to").tag(config=True) student = List([], help="list of students to export").tag(confi...
Python
0
e751329b8aacdf51b70537be47172386deaded63
Fix alembic env
alembic/env.py
alembic/env.py
from __future__ import with_statement from alembic import context from sqlalchemy import engine_from_config, pool from logging.config import fileConfig # this is the Alembic Config object, which provides # access to the values within the .ini file in use. config = context.config # Interpret the config file for Python...
from __future__ import with_statement from alembic import context from sqlalchemy import engine_from_config, pool from logging.config import fileConfig # this is the Alembic Config object, which provides # access to the values within the .ini file in use. config = context.config # Interpret the config file for Python...
Python
0.999689
564b434c2fd7fadc5d467fe884e5bd88b794acc3
Fix config.
sample-config.py
sample-config.py
# -*- coding: utf-8 -*- """ Example configuration for GEAStarterKit """ ## ## Authentication/authorizationc config import authomatic from authomatic.providers import oauth2 from collections import OrderedDict AUTHOMATIC_CONFIG = OrderedDict([ ('google', { 'name': 'Google', 'id': 1000, '...
# -*- coding: utf-8 -*- """ Example configuration for GEAStarterKit """ ## ## Authentication/authorizationc config import authomatic from authomatic.providers import oauth2 from collections import OrderedDict AUTHOMATIC_CONFIG = OrderedDict([ ('google', { 'name': 'Google', 'id': 1000, '...
Python
0
b76e91c4517e52528f8543fce276ff4b5af9a4f6
fix temp file creation to something more multiplatform friendly
burp_reports/lib/files.py
burp_reports/lib/files.py
import tempfile import os def temp_file(file='temporal'): """ return: str with tempfilename """ # Append uid to end of filename file += '_{}'.format(os.getlogin()) # Simplified and reutilized core funtionally from python cache_path = os.path.join(tempfile.gettempdir(), file) return ca...
import tempfile import os def temp_file(file='temporal'): """ return: str with tempfilename """ # Append uid to end of filename file += '_{}'.format(os.getuid()) # Simplified and reutilized core funtionally from python cache_path = os.path.join(tempfile.gettempdir(), file) return cach...
Python
0
632b86289ef643381c954adeca1f58c78e2aa8d5
Add documentation for plugins
cactus/plugin/defaults.py
cactus/plugin/defaults.py
#coding:utf-8 # Define no-op plugin methods def preBuildPage(page, context, data): """ Called prior to building a page. :param page: The page about to be built :param context: The context for this page (you can modify this, but you must return it) :param data: The raw body for this page (you can m...
#coding:utf-8 # Define no-op plugin methods def preBuildPage(page, context, data): return context, data def postBuildPage(page): pass def preBuildStatic(static): pass def postBuildStatic(static): pass def preBuild(site): pass def postBuild(site): pass def preDeploy(site): pass ...
Python
0
04fd80cda56a911289bca20c7ee1bd70ac263bd4
set readonly from true to false because the cursor is hidded if readonly is true.
call_seq/TextEdit/rich.py
call_seq/TextEdit/rich.py
from PySide import QtCore import pyqode.python # public API from pyqode.python.bootstrapper import Bootstrapper from pyqode.python.modes import PyAutoCompleteMode from pyqode.python.modes import CalltipsMode from pyqode.python.modes import CommentsMode from pyqode.python.modes import PyCodeCompletionMode, JediComplet...
from PySide import QtCore import pyqode.python # public API from pyqode.python.bootstrapper import Bootstrapper from pyqode.python.modes import PyAutoCompleteMode from pyqode.python.modes import CalltipsMode from pyqode.python.modes import CommentsMode from pyqode.python.modes import PyCodeCompletionMode, JediComplet...
Python
0
29aed8ce12734ac0489a8b4e4aa9b48ff4a320a7
fix fail
client/cli.py
client/cli.py
#!/usr/bin/env python import base64 import sys import logging import firehose.common as common class CLI(common.FirehoseClient): def __select(self, chums, prompt): print prompt for n, chum in enumerate(chums): print "%02d> %s (%s)" % (n, chum.name, chum.keyid) inp = raw_input...
#!/usr/bin/env python import base64 import sys import logging import firehose.common as common class CLI(common.FirehoseClient): def __select(self, chums, prompt): print prompt for n, chum in enumerate(chums): print "%02d> %s (%s)" % (n, chum.name, chum.keyid) inp = raw_input...
Python
0.000003
f8ce7d7709c3b83e02dde352b8888f462be572ce
Make event handlers for Debugger non-filters with a priority of 100.0 (they aren't donig any filtering)
circuits/core/debugger.py
circuits/core/debugger.py
# Module: debugger # Date: 2nd April 2006 # Author: James Mills, prologic at shortcircuit dot net dot au """ Debugger component used to debug each event in a system by printing each event to sys.stderr or to a Logger Component instnace. """ import os import sys from cStringIO import StringIO from handlers im...
# Module: debugger # Date: 2nd April 2006 # Author: James Mills, prologic at shortcircuit dot net dot au """ Debugger component used to debug each event in a system by printing each event to sys.stderr or to a Logger Component instnace. """ import os import sys from cStringIO import StringIO from handlers im...
Python
0
3157bbd5cca51ea2ac0c086a9337296c6652fafc
fix url order
citizendialer3000/urls.py
citizendialer3000/urls.py
from django.conf.urls.defaults import * urlpatterns = patterns('citizendialer3000.views', url(r'^$', 'callcampaign_list', name='call_list'), url(r'^(?P<slug>[\w\-]+)/$', 'callcampaign_detail', name='call_campaign'), url(r'^(?P<slug>[\w\-]+)/thankyou/$', 'complete', name='call_complete'), url(r'^(?P<slu...
from django.conf.urls.defaults import * urlpatterns = patterns('citizendialer3000.views', url(r'^$', 'callcampaign_list', name='call_list'), url(r'^(?P<slug>[\w\-]+)/$', 'callcampaign_detail', name='call_campaign'), url(r'^(?P<slug>[\w\-]+)/(?P<bioguide_id>\w+)/$', 'contact_detail', name='call_contact'), ...
Python
0.982361
4e42da241c5edc43990778225ad84ae241973770
Convert unicode in sa engine
ckanserviceprovider/db.py
ckanserviceprovider/db.py
import sqlalchemy as sa engine = None metadata = None jobs_table = None metadata_table = None logs_table = None def setup_db(app): global engine, metadata engine = sa.create_engine(app.config.get('SQLALCHEMY_DATABASE_URI'), echo=app.config.get('SQLALCHEMY_ECHO'), ...
import sqlalchemy as sa engine = None metadata = None jobs_table = None metadata_table = None logs_table = None def setup_db(app): global engine, metadata engine = sa.create_engine(app.config.get('SQLALCHEMY_DATABASE_URI'), echo=app.config.get('SQLALCHEMY_ECHO')) metadata = ...
Python
0.999999
302934bfd8b30ee1b33cdfb60ca36021df153746
improve cleanup process of test by removing the downloaded file
quantecon/util/tests/test_notebooks.py
quantecon/util/tests/test_notebooks.py
""" Tests for Notebook Utilities Functions --------- fetch_nb_dependencies """ from quantecon.util import fetch_nb_dependencies import unittest import os FILES = ['README.md'] REPO = "https://github.com/QuantEcon/QuantEcon.py" RAW = "raw" BRANCH = "master" class TestNotebookUtils(unittest.TestCase): def test_...
""" Tests for Notebook Utilities Functions --------- fetch_nb_dependencies """ from quantecon.util import fetch_nb_dependencies import unittest FILES = ['README.md'] REPO = "https://github.com/QuantEcon/QuantEcon.py" RAW = "raw" BRANCH = "master" class TestNotebookUtils(unittest.TestCase): def test_fetch_nb_d...
Python
0
02b7d5416ad55b78e256e58ed6a282681d1df48d
Add required get_model for Haystack 2.0
readthedocs/projects/search_indexes.py
readthedocs/projects/search_indexes.py
# -*- coding: utf-8-*- import codecs import os from django.utils.html import strip_tags #from haystack import site from haystack import indexes from haystack.fields import CharField #from celery_haystack.indexes import SearchIndex from projects.models import File, ImportedFile, Project import logging log = logging...
# -*- coding: utf-8-*- import codecs import os from django.utils.html import strip_tags #from haystack import site from haystack import indexes from haystack.fields import CharField #from celery_haystack.indexes import SearchIndex from projects.models import File, ImportedFile, Project import logging log = logging...
Python
0
96877f2cb706a465c5e7fb4d316dbd82ff2cb432
add comment
purelyjs/interpreter.py
purelyjs/interpreter.py
from .io import invoke class Interpreter(object): known_engines = ['js', 'rhino'] def __init__(self, exes=None): engines = exes if exes else self.known_engines self.exe = self.detect(engines) if not self.exe: raise ValueError("No js engine could be found, tried: %s" ...
from .io import invoke class Interpreter(object): known_engines = ['js', 'rhino'] def __init__(self, exes=None): engines = exes if exes else self.known_engines self.exe = self.detect(engines) if not self.exe: raise ValueError("No js engine could be found, tried: %s" ...
Python
0
b99ded7ddd0166d88111ced1a648bd9c79a8bbbe
mark xfail of test_get_psm3 (#803)
pvlib/test/test_psm3.py
pvlib/test/test_psm3.py
""" test iotools for PSM3 """ import os from pvlib.iotools import psm3 from conftest import needs_pandas_0_22 import numpy as np import pandas as pd import pytest from requests import HTTPError BASEDIR = os.path.abspath(os.path.dirname(__file__)) PROJDIR = os.path.dirname(BASEDIR) DATADIR = os.path.join(PROJDIR, 'dat...
""" test iotools for PSM3 """ import os from pvlib.iotools import psm3 from conftest import needs_pandas_0_22 import numpy as np import pandas as pd import pytest from requests import HTTPError BASEDIR = os.path.abspath(os.path.dirname(__file__)) PROJDIR = os.path.dirname(BASEDIR) DATADIR = os.path.join(PROJDIR, 'dat...
Python
0
494e7ae13c7b8c0ef4a65cb0b005578f8a0d2857
Fix canary command
pwndbg/commands/misc.py
pwndbg/commands/misc.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import argparse import errno as _errno import struct import gdb import pwndbg as _pwndbg import pwndbg.arch as _arch impor...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import argparse import errno as _errno import struct import gdb import pwndbg as _pwndbg import pwndbg.arch as _arch impor...
Python
0.000011
5aa90e98abcfafa9036f8cc19cd49b33aa638181
update dev version after 0.26.0 tag [skip ci]
py/desispec/_version.py
py/desispec/_version.py
__version__ = '0.26.0.dev3104'
__version__ = '0.26.0'
Python
0
b59b0e12a0f5fc83d69d9eaa1f7652e8e1b4ac81
Improve tuple and list converters
pybinding/utils/misc.py
pybinding/utils/misc.py
from functools import wraps import numpy as np def to_tuple(o): try: return tuple(o) except TypeError: return (o,) if o is not None else () def to_list(o): try: return list(o) except TypeError: return [o] if o is not None else [] def with_defaults(options: dict, de...
from functools import wraps import numpy as np def to_tuple(o): if isinstance(o, (tuple, list)): return tuple(o) else: return o, def with_defaults(options: dict, defaults_dict: dict=None, **defaults_kwargs): """Return a dict where missing keys are filled in by defaults >>> options ...
Python
0.000001
ee5a85df1d2db8babd8d6df6a188137051c3a48e
Change the improvement policies due to reorganizing reggie.
pybo/policies/simple.py
pybo/policies/simple.py
""" Acquisition functions based on the probability or expected value of improvement. """ from __future__ import division from __future__ import absolute_import from __future__ import print_function import numpy as np __all__ = ['EI', 'PI', 'UCB', 'Thompson'] def EI(model, _, xi=0.0): """ Expected improveme...
""" Acquisition functions based on the probability or expected value of improvement. """ from __future__ import division from __future__ import absolute_import from __future__ import print_function import numpy as np __all__ = ['EI', 'PI', 'UCB', 'Thompson'] def EI(model, _, xi=0.0): """ Expected improveme...
Python
0
1a8d7797e691bd5959fc8f7cdc0371e39208aee7
Update version #
pyhindsight/__init__.py
pyhindsight/__init__.py
__author__ = "Ryan Benson" __version__ = "2.1.0" __email__ = "ryan@obsidianforensics.com"
__author__ = "Ryan Benson" __version__ = "2.0.5" __email__ = "ryan@obsidianforensics.com"
Python
0
ec6191d63236a130e6a39f2383b7e8a6ae8ec672
Remove the unexisting import.
pytask/profile/forms.py
pytask/profile/forms.py
import os from django import forms from registration.forms import RegistrationFormUniqueEmail from registration.models import RegistrationProfile from pytask.profile.models import GENDER_CHOICES, Profile class CustomRegistrationForm(RegistrationFormUniqueEmail): """Used instead of RegistrationForm used by defau...
import os from django import forms from registration.forms import RegistrationFormUniqueEmail from registration.models import RegistrationProfile from pytask.utils import make_key from pytask.profile.models import GENDER_CHOICES, Profile class CustomRegistrationForm(RegistrationFormUniqueEmail): """Used instead...
Python
0.000012
c45fc8485935c39af869204f9fc6b0dd6bc0deb1
Move I/O outside of properties for light/tplink platform (#8699)
homeassistant/components/light/tplink.py
homeassistant/components/light/tplink.py
""" Support for TPLink lights. For more details about this component, please refer to the documentation at https://home-assistant.io/components/light.tplink/ """ import logging from homeassistant.const import (CONF_HOST, CONF_NAME) from homeassistant.components.light import ( Light, ATTR_BRIGHTNESS, ATTR_COLOR_TEM...
""" Support for TPLink lights. For more details about this component, please refer to the documentation at https://home-assistant.io/components/light.tplink/ """ import logging from homeassistant.const import (CONF_HOST, CONF_NAME) from homeassistant.components.light import ( Light, ATTR_BRIGHTNESS, ATTR_COLOR_TEM...
Python
0
82a9dc620cc20692e5b5c84381be38084f89ad75
Add device_class to Shelly cover domain (#46894)
homeassistant/components/shelly/cover.py
homeassistant/components/shelly/cover.py
"""Cover for Shelly.""" from aioshelly import Block from homeassistant.components.cover import ( ATTR_POSITION, DEVICE_CLASS_SHUTTER, SUPPORT_CLOSE, SUPPORT_OPEN, SUPPORT_SET_POSITION, SUPPORT_STOP, CoverEntity, ) from homeassistant.core import callback from . import ShellyDeviceWrapper fr...
"""Cover for Shelly.""" from aioshelly import Block from homeassistant.components.cover import ( ATTR_POSITION, SUPPORT_CLOSE, SUPPORT_OPEN, SUPPORT_SET_POSITION, SUPPORT_STOP, CoverEntity, ) from homeassistant.core import callback from . import ShellyDeviceWrapper from .const import COAP, DAT...
Python
0
ea6f60838ae309e5fb0662b2416d3c4450be7823
correct straight function
design_of_computer_programs_cs212/lesson01/poker_game.py
design_of_computer_programs_cs212/lesson01/poker_game.py
def poker(hands): """Return the best hand: poker([hand,...]) => hand""" return max(hands, key=hand_rank) def hand_rank(hand): """define a rank for a specific hand""" ranks = card_ranks(hand) if straight(ranks) and flush(hand): # straight flush return (8, max(ranks)) elif k...
def poker(hands): """Return the best hand: poker([hand,...]) => hand""" return max(hands, key=hand_rank) def hand_rank(hand): """define a rank for a specific hand""" ranks = card_ranks(hand) if straight(ranks) and flush(hand): # straight flush return (8, max(ranks)) elif k...
Python
0.000437
56c3c373563a38991da72bc235d4e3e40e711968
Use extra space.
remove_duplicates_from_sorted_array.py
remove_duplicates_from_sorted_array.py
#! /usr/bin/env python3 """ http://oj.leetcode.com/problems/remove-duplicates-from-sorted-array/ Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space for another array, you must do this in place with constant memory. For ...
#! /usr/bin/env python3 """ http://oj.leetcode.com/problems/remove-duplicates-from-sorted-array/ Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space for another array, you must do this in place with constant memory. For ...
Python
0.000008
97dbd18e12094820be5985b9daec4ceab4d86116
Fix getfolders()
offlineimap/repository/LocalStatus.py
offlineimap/repository/LocalStatus.py
# Local status cache repository support # Copyright (C) 2002 John Goerzen # <jgoerzen@complete.org> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or...
# Local status cache repository support # Copyright (C) 2002 John Goerzen # <jgoerzen@complete.org> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or...
Python
0
c1cbdf20e6c109ff1586f663cab7e24f1716af08
Make remove-if-exists function public
opwen_email_server/utils/temporary.py
opwen_email_server/utils/temporary.py
from contextlib import contextmanager from contextlib import suppress from os import close from os import remove from tempfile import mkstemp from typing import Generator def create_tempfilename() -> str: file_descriptor, filename = mkstemp() close(file_descriptor) return filename @contextmanager def re...
from contextlib import contextmanager from contextlib import suppress from os import close from os import remove from tempfile import mkstemp from typing import Generator def create_tempfilename() -> str: file_descriptor, filename = mkstemp() close(file_descriptor) return filename @contextmanager def re...
Python
0.000217
f238d2f036d79cd9d192b09b05575a71864fb682
API tests should tearDown in the correct order
moniker/tests/test_api/test_v1/__init__.py
moniker/tests/test_api/test_v1/__init__.py
# Copyright 2012 Managed I.T. # # Author: Kiall Mac Innes <kiall@managedit.ie> # # 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 r...
# Copyright 2012 Managed I.T. # # Author: Kiall Mac Innes <kiall@managedit.ie> # # 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 r...
Python
0.999982
baf149711302fab8a29f32316cc78d7bd3a0f94f
Enable heartbeats by default for non-clustered agents (#385)
cloudify/broker_config.py
cloudify/broker_config.py
######## # Copyright (c) 2015 GigaSpaces Technologies Ltd. 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...
######## # Copyright (c) 2015 GigaSpaces Technologies Ltd. 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...
Python
0
94763abaf573bfd25cad06da0cffc6b94a7dedc8
Fix a flaw in the old implementation of checking whether the state has changed.
pervert/management/commands/pervert_migrate.py
pervert/management/commands/pervert_migrate.py
import json from django.core.management.base import BaseCommand, CommandError from pervert.models import AbstractPervert, SchemaState, PervertError class Command(BaseCommand): help = "Registers new schema for Pervert-controlled models" def handle(self, *args, **options): states = [] print "Rea...
import json from django.core.management.base import BaseCommand, CommandError from pervert.models import AbstractPervert, SchemaState, PervertError class Command(BaseCommand): help = "Registers new schema for Pervert-controlled models" def handle(self, *args, **options): states = [] print "Rea...
Python
0.000002
24c83211588ac71492640ce43e3a893e05466a54
Change old membership migration to null
amy/workshops/migrations/0065_multiple_memberships.py
amy/workshops/migrations/0065_multiple_memberships.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('workshops', '0064_membership'), ] operations = [ migrations.RemoveField( model_...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('workshops', '0064_membership'), ] operations = [ migrations.RemoveField( model_...
Python
0
c267a580ca2179722d31941f4d02e2c67093769b
Add temporary streaming mechanism for output files
dockci/views/build.py
dockci/views/build.py
""" Views related to build management """ import logging import mimetypes import os.path import re import select from flask import (abort, flash, redirect, render_template, request, Response, url_for, ...
""" Views related to build management """ import logging import mimetypes import os.path import re from flask import (abort, flash, redirect, render_template, request, Response, url_for, ...
Python
0
9bc8b9967631064821112b5c7ff3b65fb0b176f6
Fix wrong column name in db migration script of ryu plugin
neutron/db/migration/alembic_migrations/versions/5a875d0e5c_ryu.py
neutron/db/migration/alembic_migrations/versions/5a875d0e5c_ryu.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright 2012 New Dream Network, LLC (DreamHost) # # 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/li...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright 2012 New Dream Network, LLC (DreamHost) # # 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/li...
Python
0
687681724202949105a476254f7a122171b2cf3e
Update existing objects on reimport when the ID is the same.
open511/management/commands/import_xml_roadevents.py
open511/management/commands/import_xml_roadevents.py
import datetime import logging import sys from django.contrib.gis.geos import fromstr as geos_geom_from_string from django.core.management.base import BaseCommand, CommandError from lxml import etree from open511.models import RoadEvent from open511.utils.postgis import gml_to_ewkt from open511.utils.serialization i...
import datetime import logging import sys from django.contrib.gis.geos import fromstr as geos_geom_from_string from django.core.management.base import BaseCommand, CommandError from lxml import etree from open511.models import RoadEvent from open511.utils.postgis import gml_to_ewkt from open511.utils.serialization i...
Python
0
06f7f0b5d45a4349ee688aaac86b57c74ad0f76c
FIX geocoder model
partner_compassion/models/base_geocoder.py
partner_compassion/models/base_geocoder.py
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2019 Compassion CH (http://www.compassion.ch) # Releasing children from poverty in Jesus' name # @author: Emanuel Cino <ecino@compassion.ch> # # The licence is in the file __manifest__.py...
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2019 Compassion CH (http://www.compassion.ch) # Releasing children from poverty in Jesus' name # @author: Emanuel Cino <ecino@compassion.ch> # # The licence is in the file __manifest__.py...
Python
0.000001
f94a85609100b4a77cc8352838cfc110d6033fed
Fix var set/unset help messages, and scale.
dotcloud/ui/parser.py
dotcloud/ui/parser.py
import argparse from .version import VERSION def get_parser(name='dotcloud'): parser = argparse.ArgumentParser(prog=name, description='dotcloud CLI') parser.add_argument('--application', '-A', help='specify the application') parser.add_argument('--environment', '-E', help='specify the environment') par...
import argparse from .version import VERSION def get_parser(name='dotcloud'): parser = argparse.ArgumentParser(prog=name, description='dotcloud CLI') parser.add_argument('--application', '-A', help='specify the application') parser.add_argument('--environment', '-E', help='specify the environment') par...
Python
0
bf684f5a2a688739ccc195a125eb376997084f96
remove leftover code
osspeak/recognition/actions/pyexpr.py
osspeak/recognition/actions/pyexpr.py
import ast import re def varrepl(_, num): num = int(num) if num > 0: num -= 1 return f'result.vars.get({num})' error_handler_strings = { (r'\$', r'-?\d+'): varrepl } error_handlers = {} for (before_pattern, after_pattern), handler in error_handler_strings.items(): before_pattern = None if...
import ast import re def varrepl(_, num): num = int(num) if num > 0: num -= 1 return f'result.vars.get({num})' error_handler_strings = { (r'\$', r'-?\d+'): varrepl } error_handlers = {} for (before_pattern, after_pattern), handler in error_handler_strings.items(): before_pattern = None if...
Python
0.001174
397f33adb5cafaeda3de624dc9dd1bb24d0b65e5
remove dup line
MOAL/maths/applied/optimization/strength_reduction.py
MOAL/maths/applied/optimization/strength_reduction.py
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = """Chris Tabor (dxdstudio@gmail.com)""" if __name__ == '__main__': from os import getcwd from os import sys sys.path.append(getcwd()) from MOAL.helpers.display import Section from MOAL.helpers.trials import test_speed DEBUG = True if __name__ ==...
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = """Chris Tabor (dxdstudio@gmail.com)""" __author__ = """Chris Tabor (dxdstudio@gmail.com)""" if __name__ == '__main__': from os import getcwd from os import sys sys.path.append(getcwd()) from MOAL.helpers.display import Section from MOAL.helper...
Python
0.000001
3f2f069e1c22ee88afb67ef68164046222a009e3
Create a error class for the API client
drydock_provisioner/error.py
drydock_provisioner/error.py
# Copyright 2017 AT&T Intellectual Property. All other 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...
# Copyright 2017 AT&T Intellectual Property. All other 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...
Python
0
7c5018ca5d4edd85990aea7889cd767e059f55b2
modify logging level.
engine/scheduler/__init__.py
engine/scheduler/__init__.py
# -*- coding: utf-8 -*- # # dp for Tornado # YoungYong Park (youngyongpark@gmail.com) # 2015.03.09 # import os import time import threading import tornado.options import engine.scheduler.tornado_subprocess from ..engine import Engine as dpEngine try: from croniter import croniter except: croniter =...
# -*- coding: utf-8 -*- # # dp for Tornado # YoungYong Park (youngyongpark@gmail.com) # 2015.03.09 # import os import time import threading import tornado.options import engine.scheduler.tornado_subprocess from ..engine import Engine as dpEngine try: from croniter import croniter except: croniter =...
Python
0
46cd16ff56ff93b2ee8a38363b37c3287c9cb1cc
Update sal checkin module.
payload/usr/local/sal/checkin_modules/sal_checkin.py
payload/usr/local/sal/checkin_modules/sal_checkin.py
#!/usr/local/sal/Python.framework/Versions/3.8/bin/python3 import sal __version__ = '1.1.0' def main(): _, _, bu_key = sal.get_server_prefs() sal_submission = { 'extra_data': { 'sal_version': sal.__version__, 'key': bu_key,}, 'facts': {'checkin_module_version': __ve...
#!/usr/local/sal/Python.framework/Versions/3.8/bin/python3 import sys import sal __version__ = '1.0.0' def main(): _, _, bu_key = sal.get_server_prefs() sal_submission = { 'extra_data': { 'sal_version': sal.__version__, 'key': bu_key,}, 'facts': {'checkin_module_ve...
Python
0
55132ff6740b3c70ddb75dcf7c3615aaea0680ac
Fix typo
main/models.py
main/models.py
from django.db import models from django.contrib.auth.models import User class VM(models.Model): user = models.ForeignKey(User, related_name='user', null=False) vmid = models.PositiveIntegerField() template = models.CharField(max_length=100) hostname = models.CharField(max_length=30) storage = models.CharFie...
from django.db import models from django.contrib.auth.models import User class VM(models.Model): user = models.ForeignKey(User, related_name='user', null=False) vmid = models.PositiveIntegerField() template = models.CharField(max_length=100) hostname = models.CharField(max_length=30) storage = models.CharFie...
Python
0.999999
bddac740c06a1e399179b2cda16ec8fd9556f2e0
Fix monitoring new files
monitor.py
monitor.py
#!/usr/bin/env python import sys, os from pathlib import Path import time from multiprocessing import Pool from functools import partial import transfer def get_new_files(folder, init_filelist=None): if init_filelist is None: init_filelist = [] return [f for f in folder.glob('**/*.yml') ...
#!/usr/bin/env python import sys, os from pathlib import Path import time from multiprocessing import Pool from functools import partial import transfer def get_new_files(folder, init_filelist=None): if init_filelist is None: init_filelist = [] return [f.with_suffix('.dat') for f in folder.glob('**/...
Python
0.000001
b6f54a008cfe1c0a6db06d4f9c23d4699c2ab901
Update harmonizer.py
intelmq/bots/inputs/openbl/harmonizer.py
intelmq/bots/inputs/openbl/harmonizer.py
from intelmq.lib.bot import Bot, sys class OpenBLHarmonizerBot(Bot): def process(self): event = self.receive_message() if event: event.add('feed', 'openbl') event.add('feed_url', 'http://www.openbl.org/lists/date_all.txt') ip_value = event.value('reported_ip') ...
from intelmq.lib.bot import Bot, sys class OpenBLHarmonizerBot(Bot): def process(self): event = self.receive_message() if event: event.add('feed', 'openbl') event.add('feed_url', 'http://www.openbl.org/lists/date_all.txt') ip_value = event.value('reported_ip') ...
Python
0
93904a11a78d5c58d2baaaa71cb962195becae6e
Change test.
event_track_info/tests/test_track_info.py
event_track_info/tests/test_track_info.py
# -*- coding: utf-8 -*- # © 2016 Oihane Crucelaegui - AvanzOSC # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from openerp.addons.sale_order_create_event.tests.\ test_sale_order_create_event import TestSaleOrderCreateEvent class TestTrackInfo(TestSaleOrderCreateEvent): def setUp(self): ...
# -*- coding: utf-8 -*- # © 2016 Oihane Crucelaegui - AvanzOSC # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from openerp.addons.sale_order_create_event.tests.\ test_sale_order_create_event_by_task import TestSaleOrderCreateEvent class TestTrackInfo(TestSaleOrderCreateEvent): def setUp(se...
Python
0
d32f6dcfcc7bbf8f4d9a8d84673635b1345450f6
Simplify library includes
dnsimple/__init__.py
dnsimple/__init__.py
from dnsimple.client import Client
Python
0.000001
9f790ebf51c7e05e09a39bd18f2597410ea0287d
bump version to 0.6.2
djangoql/__init__.py
djangoql/__init__.py
__version__ = '0.6.2'
__version__ = '0.6.1'
Python
0.000001
a3802e18e95d2ba85454d9d45881b53452fb1aa2
fix build in chroots with older glibc
cerbero/bootstrap/build_tools.py
cerbero/bootstrap/build_tools.py
# cerbero - a multi-platform build system for Open Source software # Copyright (C) 2012 Andoni Morales Alastruey <ylatuya@gmail.com> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; eit...
# cerbero - a multi-platform build system for Open Source software # Copyright (C) 2012 Andoni Morales Alastruey <ylatuya@gmail.com> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; eit...
Python
0.000001
b9c7d3f76dee20dd1da1e53365b2aeac616bd0a3
add --run option
doc/examples/plot.py
doc/examples/plot.py
import argparse import matplotlib.pyplot as plt import perf import statistics def plot_bench(args, bench): if not args.split_runs: runs = bench.get_runs() if args.run: run = runs[args.run - 1] runs = [run] values = [] for run in runs: run_values ...
import argparse import matplotlib.pyplot as plt import perf import statistics def plot_bench(args, bench): if not args.split_runs: values = bench.get_values() if args.skip: values = values[args.skip:] values = [value for value in values] plt.plot(values, label='values')...
Python
0.000003
4c549414fdac30bdf514f346543760fbe9bf5505
Revert "Reject dud properly when not validated."
debile/master/incoming_dud.py
debile/master/incoming_dud.py
# Copyright (c) 2012-2013 Paul Tagliamonte <paultag@debian.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 the Software without restriction, including without limitation # the rights to use, copy, ...
# Copyright (c) 2012-2013 Paul Tagliamonte <paultag@debian.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 the Software without restriction, including without limitation # the rights to use, copy, ...
Python
0
facd1988bbbcbf64e64ba6d744805045e26f06f7
'subprocess' needs a literal string for the sed command
installscripts/wizard/jazz_common.py
installscripts/wizard/jazz_common.py
#!/usr/bin/python import os import re import subprocess #Global variables TFVARS_FILE = "terraform.tfvars" HOME_JAZZ_INSTALLER = os.path.expanduser("~") + "/jazz-installer/" COGNITO_USER_FILE = HOME_JAZZ_INSTALLER + "/installscripts/cookbooks/jenkins/files/credentials/cognitouser.sh" DEFAULT_RB = HOME_JAZZ_INSTALLER +...
#!/usr/bin/python import os import re import subprocess #Global variables TFVARS_FILE = "terraform.tfvars" HOME_JAZZ_INSTALLER = os.path.expanduser("~") + "/jazz-installer/" COGNITO_USER_FILE = HOME_JAZZ_INSTALLER + "/installscripts/cookbooks/jenkins/files/credentials/cognitouser.sh" DEFAULT_RB = HOME_JAZZ_INSTALLER +...
Python
0.999999
5f726edd25c1d478da02215a36b9a8ac4a41eec3
Add missing import
ckanext/stadtzhtheme/commands.py
ckanext/stadtzhtheme/commands.py
import sys import itertools import traceback import ckan.lib.cli import ckan.logic as logic import ckan.model as model class StadtzhCommand(ckan.lib.cli.CkanCommand): '''Command for stadtzh Usage: # General usage paster --plugin=ckanext-stadtzh-theme <command> -c <path to config> # Sho...
import sys import itertools import ckan.lib.cli import ckan.logic as logic import ckan.model as model class StadtzhCommand(ckan.lib.cli.CkanCommand): '''Command for stadtzh Usage: # General usage paster --plugin=ckanext-stadtzh-theme <command> -c <path to config> # Show this help ...
Python
0.000466
842e1bac8edaf6f28772067eaffd83351d28332a
add unicode
fastube/fastube/settings/partials/auth.py
fastube/fastube/settings/partials/auth.py
# -*- coding: utf-8 -*- import os # Password validation # https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.passw...
#-*- coding: utf-8 -*- import os # Password validation # https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.passwo...
Python
0.999999
61731632b04ca1d9a719b6b4b62fa0a97926e3a9
clean up unused imports
kubernetes/K8sHorizontalPodAutoscaler.py
kubernetes/K8sHorizontalPodAutoscaler.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # This file is subject to the terms and conditions defined in # file 'LICENSE.md', which is part of this source code package. # from kubernetes.K8sObject import K8sObject from kubernetes.models.v1.HorizontalPodAutoscaler import HorizontalPodAutoscaler class K8sHorizon...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # This file is subject to the terms and conditions defined in # file 'LICENSE.md', which is part of this source code package. # from kubernetes.K8sObject import K8sObject from kubernetes.K8sDeployment import K8sDeployment from kubernetes.K8sReplicationController import ...
Python
0
b6947fa1850c888cd5b3190b2abf315409f01cdc
Add an explicit logfile rollover at the beginning of each Tulsi bazel build.
src/TulsiGenerator/Scripts/tulsi_logging.py
src/TulsiGenerator/Scripts/tulsi_logging.py
# Copyright 2017 The Tulsi 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 applicable ...
# Copyright 2017 The Tulsi 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 applicable ...
Python
0
48c3a35deffaca384189c8342a65debf03036dff
Remove semicolons
acstis/Logging.py
acstis/Logging.py
# -*- coding: utf-8 -*- # MIT License # # Copyright (c) 2017 Tijme Gommers # # 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 # ...
# -*- coding: utf-8 -*- # MIT License # # Copyright (c) 2017 Tijme Gommers # # 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 # ...
Python
0.999999
9365a3dce9cc1abe507c36d3dd1d79ca7fcab15c
add admin for Product
eca_catalogue/abstract_admin.py
eca_catalogue/abstract_admin.py
from django.contrib import admin from treebeard.admin import TreeAdmin class AbstractProductCategoryAdmin(admin.ModelAdmin): prepopulated_fields = {"slug": ("name",)} class AbstractNestedProductCategoryAdmin(TreeAdmin): prepopulated_fields = {"slug": ("name",)} class AbstractProductAdmin(admin.ModelAdmin):...
from django.contrib import admin from treebeard.admin import TreeAdmin class AbstractProductCategoryAdmin(admin.ModelAdmin): prepopulated_fields = {"slug": ("name",)} class AbstractNestedProductCategoryAdmin(TreeAdmin): prepopulated_fields = {"slug": ("name",)}
Python
0
9dca7838d8fb495acc02241b55a30870b7eec0ba
fix flake error in apps.py
actstream/apps.py
actstream/apps.py
from django.core.exceptions import ImproperlyConfigured from actstream import settings from actstream.signals import action from actstream.compat_apps import AppConfig class ActstreamConfig(AppConfig): name = 'actstream' def ready(self): from actstream.actions import action_handler action.co...
from django.core.exceptions import ImproperlyConfigured from actstream import settings from actstream.signals import action from actstream.compat_apps import AppConfig class ActstreamConfig(AppConfig): name = 'actstream' def ready(self): from actstream.actions import action_handler action.co...
Python
0.000001
416d452fdaa37a6506a92adf227038474e818acc
Remove unused imports
edaboweb/blueprints/playlist.py
edaboweb/blueprints/playlist.py
#!/usr/bin/env python # coding: utf-8 # Copyright © 2015 Wieland Hoffmann # License: MIT, see LICENSE for details from flask import abort, Blueprint, redirect, request, render_template, url_for from json import loads from mbdata import models from uuid import UUID from ..mb_database import db_session from ..models impo...
#!/usr/bin/env python # coding: utf-8 # Copyright © 2015 Wieland Hoffmann # License: MIT, see LICENSE for details from flask import abort, Blueprint, redirect, request, render_template, url_for from json import loads from mbdata import models from operator import itemgetter from sqlalchemy.orm.query import Query from u...
Python
0.000001
d8099cd712279afa1c4e73989c7f03bc9de6dd4c
fix performance problem with historian
flow_workflow/historian/operation_data.py
flow_workflow/historian/operation_data.py
import json class OperationData(object): def __init__(self, net_key, operation_id, color): self.net_key = net_key self.operation_id = int(operation_id) self.color = int(color) def dumps(self): return json.dumps(self.to_dict, sort_keys=True) @classmethod def loads(cls, ...
import json class OperationData(object): def __init__(self, net_key, operation_id, color): self.net_key = net_key self.operation_id = int(operation_id) self.color = int(color) def dumps(self): return json.dumps(self.to_dict, sort_keys=True) @classmethod def loads(cls, ...
Python
0.000044
995ff0e9d7189d5b6b7ae01c3440d2ec336d6e53
Handle failed call smartctl on USB drives.
device_inventory/benchmark.py
device_inventory/benchmark.py
""" Devices benchmark Set of programs, or other operations, in order to assess the relative performance of an object, normally by running a number of standard tests and trials against it. """ import logging import re import subprocess from .utils import run def hard_disk_smart(disk="/dev/sda"): # smartctl -a /...
""" Devices benchmark Set of programs, or other operations, in order to assess the relative performance of an object, normally by running a number of standard tests and trials against it. """ import logging import re import subprocess from .utils import run def hard_disk_smart(disk="/dev/sda"): # smartctl -a /...
Python
0
71554067936e2355658e6e566e8fcb4a66f24ee7
Add new keyfile
dexter/config/celeryconfig.py
dexter/config/celeryconfig.py
from celery.schedules import crontab # uses AWS creds from the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY env variables BROKER_URL = 'sqs://' BROKER_TRANSPORT_OPTIONS = { 'region': 'eu-west-1', 'polling_interval': 15 * 1, 'queue_name_prefix': 'mma-dexter-', 'visibility_timeout': 3600*12, } # all ou...
from celery.schedules import crontab # uses AWS creds from the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY env variables BROKER_URL = 'sqs://' BROKER_TRANSPORT_OPTIONS = { 'region': 'eu-west-1', 'polling_interval': 15 * 1, 'queue_name_prefix': 'mma-dexter-', 'visibility_timeout': 3600*12, } # all ou...
Python
0.000002
a0b1948261555b724e9c72558a7ca18d793f4748
Support Ticket - In response to fix
erpnext/support/doctype/support_ticket/support_ticket.py
erpnext/support/doctype/support_ticket/support_ticket.py
import webnotes from webnotes.model.doc import make_autoname from utilities.transaction_base import TransactionBase from home import update_feed class DocType(TransactionBase): def __init__(self, doc, doclist=[]): self.doc = doc self.doclist = doclist def autoname(self): self.doc.name = make_autoname(self.do...
import webnotes from webnotes.model.doc import make_autoname from utilities.transaction_base import TransactionBase from home import update_feed class DocType(TransactionBase): def __init__(self, doc, doclist=[]): self.doc = doc self.doclist = doclist def autoname(self): self.doc.name = make_autoname(self.do...
Python
0
ab0de2247584f1c86eb15a9c9da254865ebfdfc0
Create artifact directory when not created.
tubular/scripts/find_and_advance_pipeline.py
tubular/scripts/find_and_advance_pipeline.py
#! /usr/bin/env python3 """ Command-line script to find the next release pipeline to advance and then advance it by triggering the manual stage. """ from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals from os import path import os import sys import logg...
#! /usr/bin/env python3 """ Command-line script to find the next release pipeline to advance and then advance it by triggering the manual stage. """ from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals from os import path import sys import logging import...
Python
0
30e44e48bacb1403d4df96df0654bdade324ec3e
Add test for `get_current_shift`
clock/shifts/tests/test_utils.py
clock/shifts/tests/test_utils.py
"""Tests for the shift utilities.""" from test_plus import TestCase from clock.shifts.factories import ShiftFactory, UserFactory from clock.shifts.models import Shift from clock.shifts.utils import get_current_shift, get_last_shifts from clock.contracts.models import Contract class TestUtils(TestCase): """Test t...
"""Tests for the shift utilities.""" from test_plus import TestCase from clock.shifts.factories import UserFactory, ShiftFactory from clock.shifts.models import Shift from clock.shifts.utils import get_last_shifts class TestUtils(TestCase): """Test the functionality of the shift utilities.""" def test_get_l...
Python
0
2bbf7bc31b0c7372c143e9d8d062302127ddadd8
add __version__ package attribute
online_monitor/__init__.py
online_monitor/__init__.py
# http://stackoverflow.com/questions/17583443/what-is-the-correct-way-to-share-package-version-with-setup-py-and-the-package from pkg_resources import get_distribution __version__ = get_distribution('online_monitor').version
Python
0.000077
a3f568a0eaad8209423a2d418ee7e627e614f4ee
Create Gravatar field for API serialization
dockci/api/fields.py
dockci/api/fields.py
""" Flask RESTful fields, and WTForms input validators for validation and marshaling """ import re from functools import wraps from flask_restful import fields from dockci.util import gravatar_url class RewriteUrl(fields.Url): """ Extension of the Flask RESTful Url field that allows you to remap object ...
""" Flask RESTful fields, and WTForms input validators for validation and marshaling """ import re from functools import wraps from flask_restful import fields class RewriteUrl(fields.Url): """ Extension of the Flask RESTful Url field that allows you to remap object fields to different names """ ...
Python
0
1bc4c7ff0ecd5df9a1874c1f9930e33268c9524d
fix AddonMan
app/py/cuda_addonman/work_cudatext_updates__fosshub.py
app/py/cuda_addonman/work_cudatext_updates__fosshub.py
import sys import os import re import platform import tempfile import webbrowser import cudatext as app from .work_remote import * p = sys.platform X64 = platform.architecture()[0]=='64bit' DOWNLOAD_PAGE = 'https://www.fosshub.com/CudaText.html' TEXT_CPU = 'x64' if X64 else 'x32' REGEX_GROUP_VER = 1 DOWNLOAD_REGEX ...
import sys import os import re import platform import tempfile import webbrowser import cudatext as app from .work_remote import * p = sys.platform X64 = platform.architecture()[0]=='64bit' DOWNLOAD_PAGE = 'https://www.fosshub.com/CudaText.html' TEXT_CPU = 'x64' if X64 else 'x32' REGEX_GROUP_VER = 1 DOWNLOAD_REGEX ...
Python
0.000001
34d9375de23384b3a5a777f802e93973ef7c4e60
Fix the ARC test case.
MDTraj/tests/test_arc.py
MDTraj/tests/test_arc.py
############################################################################## # MDTraj: A Python Library for Loading, Saving, and Manipulating # Molecular Dynamics Trajectories. # Copyright 2012-2013 Stanford University and the Authors # # Authors: Lee-Ping Wang # Contributors: Robert McGibbon # # MDTraj is fr...
############################################################################## # MDTraj: A Python Library for Loading, Saving, and Manipulating # Molecular Dynamics Trajectories. # Copyright 2012-2013 Stanford University and the Authors # # Authors: Lee-Ping Wang # Contributors: Robert McGibbon # # MDTraj is fr...
Python
0.000058
aec8191bb4ae782c9b7570fff2fc4b10b4a68bb6
Update docstring on top of migration
scripts/migration/migrate_root_and_parent_on_node.py
scripts/migration/migrate_root_and_parent_on_node.py
""" This will add a parent field and a parent_node field to all nodes. Root will be the primary key of the originating parent node. Parent_node will be the first primary parent Done so that you can filter on both root nodes and parent nodes with a DB query """ import sys import logging from modularodm import Q from ...
""" This will add an ultimate_parent field to all nodes. Ultimate_parent will be the primary key of the originating parent node """ import sys import logging from modularodm import Q from website import models from website.app import init_app from scripts import utils as script_utils from framework.transactions.contex...
Python
0
d35604f7cdef01f9cf39171bf6c1551e314231ae
remove chunk
openprocurement/tender/openeu/traversal.py
openprocurement/tender/openeu/traversal.py
# -*- coding: utf-8 -*- from openprocurement.api.traversal import Root, get_item def qualifications_factory(request): request.validated['tender_src'] = {} root = Root(request) if not request.matchdict or not request.matchdict.get('tender_id'): return root request.validated['tender_id'] = reque...
# -*- coding: utf-8 -*- from openprocurement.api.traversal import Root, get_item def qualifications_factory(request): request.validated['tender_src'] = {} root = Root(request) if not request.matchdict or not request.matchdict.get('tender_id'): return root request.validated['tender_id'] = reque...
Python
0.000075
863d0d28fb26007c448610a845caab39b1451326
Add comparison with TCE output in CCD example
docs/examples/ccd.py
docs/examples/ccd.py
"""Automatic derivation of CCD equations. """ import urllib.request from pyspark import SparkConf, SparkContext from sympy import IndexedBase, Rational from drudge import PartHoleDrudge, CR, AN conf = SparkConf().setAppName('CCSD-derivation') ctx = SparkContext(conf=conf) dr = PartHoleDrudge(ctx) p = dr.names c_ ...
"""Automatic derivation of CCD equations. """ import pickle from pyspark import SparkConf, SparkContext from sympy import IndexedBase, Rational from drudge import PartHoleDrudge, CR, AN conf = SparkConf().setAppName('CCSD-derivation') ctx = SparkContext(conf=conf) dr = PartHoleDrudge(ctx) p = dr.names c_ = dr.op[...
Python
0
1fd6fdbdd7c0cf3764fa0707692346675273a764
allow underscores before quality suffix
mp4mark.py
mp4mark.py
#!/usr/bin/env python2 import os import sys import re import glob from subprocess import call, Popen, PIPE files = [] for x in sys.argv[1:]: files += glob.glob(x) or ([x] if os.path.exists(x) else []) #import pdb; pdb.set_trace() base = None for vid in files: m = re.match(r'(.*)[_-]\d+p[_-]ame?\.mp4$', vid) if n...
#!/usr/bin/env python2 import os import sys import re import glob from subprocess import call, Popen, PIPE files = [] for x in sys.argv[1:]: files += glob.glob(x) or ([x] if os.path.exists(x) else []) #import pdb; pdb.set_trace() base = None for vid in files: m = re.match(r'(.*)-\d+p-ame?\.mp4$', vid) if not m: ...
Python
0.000002
ed0b5efb77dd8178d6ec63db205dcf1d4e6a3ee0
fix bug in category view
elephantblog/views.py
elephantblog/views.py
from datetime import date from django.http import Http404 from django.shortcuts import render_to_response, get_object_or_404 from django.template import RequestContext from django.utils.translation import ugettext_lazy as _ from feincms.translations import short_language_code # from tagging.models import Tag, TaggedIt...
from datetime import date from django.http import Http404 from django.shortcuts import render_to_response, get_object_or_404 from django.template import RequestContext from django.utils.translation import ugettext_lazy as _ from feincms.translations import short_language_code # from tagging.models import Tag, TaggedIt...
Python
0
b487bad4079773d8537cd46f20164af77e7674fb
change TODO on nice-to-have to avoid triggering code climate
callisto/delivery/management/commands/find_matches.py
callisto/delivery/management/commands/find_matches.py
import importlib from django.core.management.base import BaseCommand from callisto.delivery.report_delivery import PDFMatchReport from callisto.delivery.matching import find_matches class Command(BaseCommand): help = 'finds matches and sends match reports' def add_arguments(self, parser): parser.add...
import importlib from django.core.management.base import BaseCommand from callisto.delivery.report_delivery import PDFMatchReport from callisto.delivery.matching import find_matches class Command(BaseCommand): help = 'finds matches and sends match reports' def add_arguments(self, parser): parser.add...
Python
0
b0f4ebf0cd0999debfdec7a6de972666d28eea98
Update PWM example.
usr/examples/02-Board-Control/pwm_control.py
usr/examples/02-Board-Control/pwm_control.py
# PWM Control Example # # This example shows how to do PWM with your OpenMV Cam. import time from pyb import Pin, Timer tim = Timer(4, freq=1000) # Frequency in Hz # Generate a 1KHz square wave on TIM4 with 50% and 75% duty cycles on channels 1 and 2, respectively. ch1 = tim.channel(1, Timer.PWM, pin=Pin("P7"), pulse...
# PWM Control Example # # This example shows how to do PWM with your OpenMV Cam. # # WARNING: PWM control is... not easy with MicroPython. You have to use # the correct timer with the correct pins and channels. As for what the # correct values are - who knows. If you need to change the pins from the # example below ple...
Python
0
a52a0fc4589c07439da8194fb6583d46af422bc2
Fix comment typos in 04-KNN.py (examples/05-vector)
examples/05-vector/04-KNN.py
examples/05-vector/04-KNN.py
from __future__ import print_function from __future__ import unicode_literals from builtins import str, bytes, dict, int from builtins import range import os, sys; sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..")) from pattern.web import Twitter from pattern.en import Sentence, parse from patte...
from __future__ import print_function from __future__ import unicode_literals from builtins import str, bytes, dict, int from builtins import range import os, sys; sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..")) from pattern.web import Twitter from pattern.en import Sentence, parse from patte...
Python
0
ada5520cddb065899fca25ec96edb1f2b98bb797
None -> False
tests/chainer_tests/dataset_tests/tabular_tests/dummy_dataset.py
tests/chainer_tests/dataset_tests/tabular_tests/dummy_dataset.py
import numpy as np import chainer from chainer import testing class DummyDataset(chainer.dataset.TabularDataset): def __init__( self, size=10, keys=('a', 'b', 'c'), mode=tuple, return_array=False, callback=None, convert=False): if mode is None: keys = keys[0], ...
import numpy as np import chainer from chainer import testing class DummyDataset(chainer.dataset.TabularDataset): def __init__( self, size=10, keys=('a', 'b', 'c'), mode=tuple, return_array=False, callback=None, convert=None): if mode is None: keys = keys[0], ...
Python
0.999988