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
e0521c1f9a12819fd89f12aed01c623628dc4c4d
Build options added.
intexration/propertyhandler.py
intexration/propertyhandler.py
import configparser import os class Build: def __init__(self, name, idx, bib): self._name = name self._idx = idx self._bib = bib def get_name(self): return self._name def get_idx(self): return self._idx def get_bib(self): return self._bib def get...
import configparser import os class Build: def __init__(self, name, idx, bib): self._name = name self._idx = idx self._bib = bib def get_name(self): return self._name def get_idx(self): return self._idx def get_bib(self): return self._bib def get...
Python
0
e6885fd2260dc9399f5ea2f835cbf65294d18a8d
make competiable with postgres new version 8.3
addons/report_analytic_line/report_analytic_line.py
addons/report_analytic_line/report_analytic_line.py
############################################################################## # # Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved. # # $Id: sale.py 1005 2005-07-25 08:41:42Z nicoe $ # # WARNING: This program as such is intended to be used by professional # programmers who take the whole respons...
############################################################################## # # Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved. # # $Id: sale.py 1005 2005-07-25 08:41:42Z nicoe $ # # WARNING: This program as such is intended to be used by professional # programmers who take the whole respons...
Python
0
9069c2678b68571406458f7414c7b0474183090b
Fix check for dictionary entry
lit/Suite/lldbtest.py
lit/Suite/lldbtest.py
from __future__ import absolute_import import os import subprocess import sys import lit.Test import lit.TestRunner import lit.util from lit.formats.base import TestFormat def getBuildDir(cmd): found = False for arg in cmd: if found: return arg if arg == '--build-dir': ...
from __future__ import absolute_import import os import subprocess import sys import lit.Test import lit.TestRunner import lit.util from lit.formats.base import TestFormat def getBuildDir(cmd): found = False for arg in cmd: if found: return arg if arg == '--build-dir': ...
Python
0
f27dc9d2793bb555d80a5c8e6635ba246278d017
Add DES support
simplecrypto.py
simplecrypto.py
import hashlib import math from base64 import b64encode, b64decode from Crypto.Cipher import DES, AES from Crypto import Random random_instance = Random.new() algorithms = {'aes': AES, 'des': DES} def sha1(message): return hashlib.sha1(message).hexdigest() def md5(message): return hashlib.md5(message).hexdi...
import hashlib import math import base64 from Crypto.Cipher import DES, AES from Crypto import Random random_instance = Random.new() algorithms = {'aes': AES, 'des': DES} def sha1(message): return hashlib.sha1(message).hexdigest() def md5(message): return hashlib.md5(message).hexdigest() def sha256(message...
Python
0
1bd814df2c5175ac7745b2d58fbe6b82c5a941ae
add 'debug' hack
sts/util/console.py
sts/util/console.py
BEGIN = '\033[1;' END = '\033[1;m' class color(object): GRAY, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, CRIMSON = map(lambda num : BEGIN + str(num) + "m", range(30, 39)) B_GRAY, B_RED, B_GREEN, B_YELLOW, B_BLUE, B_MAGENTA, B_CYAN, B_WHITE, B_CRIMSON = map(lambda num: BEGIN + str(num) + "m", range(40, 49)) ...
BEGIN = '\033[1;' END = '\033[1;m' class color(object): GRAY, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, CRIMSON = map(lambda num : BEGIN + str(num) + "m", range(30, 39)) B_GRAY, B_RED, B_GREEN, B_YELLOW, B_BLUE, B_MAGENTA, B_CYAN, B_WHITE, B_CRIMSON = map(lambda num: BEGIN + str(num) + "m", range(40, 49)) ...
Python
0.000001
4987412578744db64984cb40841994b3852287f7
update evalrunner
pytools/src/IndexEval/evalrunner.py
pytools/src/IndexEval/evalrunner.py
''' Created on 04.11.2015 @author: selen00r ''' import datetime from pymongo.mongo_client import MongoClient import evalresult class EvalRunner(object): ''' Base class to run an evaluation of an index. ''' def __init__(self): ''' Constructor ''' ...
''' Created on 04.11.2015 @author: selen00r ''' import datetime from pymongo.mongo_client import MongoClient import evalresult class EvalRunner(object): ''' Base class to run an evaluation of an index. ''' def __init__(self): ''' Constructor ''' ...
Python
0
5ba73b9dd92b55b3f02f76ae981e53744abac750
Add an option to time SQL statements
sir/__main__.py
sir/__main__.py
# Copyright (c) 2014 Wieland Hoffmann # License: MIT, see LICENSE for details import argparse import logging import multiprocessing from . import config from .indexing import reindex from .schema import SCHEMA from sqlalchemy import exc as sa_exc logger = logging.getLogger("sir") def watch(args): raise NotImp...
# Copyright (c) 2014 Wieland Hoffmann # License: MIT, see LICENSE for details import argparse import logging import multiprocessing from . import config from .indexing import reindex from .schema import SCHEMA from sqlalchemy import exc as sa_exc logger = logging.getLogger("sir") def watch(args): raise NotImp...
Python
0.000014
dde133a9ae751ce3caab8e8896c1e04e48c0cc1e
fix typo
qiita_pet/handlers/base_handlers.py
qiita_pet/handlers/base_handlers.py
from tornado.web import RequestHandler class BaseHandler(RequestHandler): def get_current_user(self): '''Overrides default method of returning user curently connected''' user = self.get_secure_cookie("user") if user is None: self.clear_cookie("user") return None ...
from tornado.web import RequestHandler class BaseHandler(RequestHandler): def get_current_user(self): '''Overrides default method of returning user curently connected''' user = self.get_secure_cookie("user") if user is None: self.clear_cookie("user") return None ...
Python
0.999991
6fbb50fcb851d0387d44dbaca361cc63f1dbbe79
Add get_db_query method.
loldb/v2/resources.py
loldb/v2/resources.py
import collections import os import re import sqlite3 import raf def _get_highest_version(versions): versions = [(v, v.split('.')) for v in versions] def version_converter(version): try: parts = map(int, version[1]) except ValueError: return None else: ...
import collections import os import re import sqlite3 import raf def _get_highest_version(versions): versions = [(v, v.split('.')) for v in versions] def version_converter(version): try: parts = map(int, version[1]) except ValueError: return None else: ...
Python
0
45ab8a3585008cc4ad31eb553b9291f4e1a65c01
Update C++ version, #190
binding.gyp
binding.gyp
{ "variables": { "os_linux_compiler%": "gcc", "use_vl32%": "false", "use_fixed_size%": "false", "use_posix_semaphores%": "false" }, "targets": [ { "target_name": "node-lmdb", "win_delay_load_hook": "false", "sources": [ "dependencies/lmdb/libraries/liblmdb/mdb...
{ "variables": { "os_linux_compiler%": "gcc", "use_vl32%": "false", "use_fixed_size%": "false", "use_posix_semaphores%": "false" }, "targets": [ { "target_name": "node-lmdb", "win_delay_load_hook": "false", "sources": [ "dependencies/lmdb/libraries/liblmdb/mdb...
Python
0
9c950c73bdc518c35aa471834431222c7c60ea4b
update binding.gyp
binding.gyp
binding.gyp
{ "targets": [ { "target_name": "ons", "sources": [ "src/entry.cpp", "src/ons_options.cpp", "src/consumer_ack.cpp", "src/consumer.cpp", "src/producer.cpp", "src/consumer_listener.cpp", ...
{ "targets": [ { "target_name": "ons", "sources": [ "src/entry.cpp", "src/ons_options.cpp", "src/consumer_ack.cpp", "src/consumer.cpp", "src/producer.cpp", "src/consumer_listener.cpp" ...
Python
0
f0f3a7ab0b285f447f0573ff537e6252a8752528
Use pkg-build in binding.gyp
binding.gyp
binding.gyp
{ "targets": [ { "target_name": "tiff-multipage", "sources": [ "src/module.cc", "src/sync.cc", "src/async.cc", "src/tiff_multipage.cc" ], "include_dirs": [ "<!(node -e \"require('n...
{ "targets": [ { "target_name": "tiff-multipage", "sources": [ "src/module.cc", "src/sync.cc", "src/async.cc", "src/tiff_multipage.cc" ], "include_dirs": ["<!(node -e \"require('nan')\")"], ...
Python
0
c34f040ba19c27277d6cc9a1ad46e4c8d668e77b
Apply -DNDEBUG globally on release builds
binding.gyp
binding.gyp
{ "target_defaults": { "target_conditions": [ ["OS != 'win'", { "cflags": ["-fdata-sections", "-ffunction-sections", "-fvisibility=hidden"], "ldflags": ["-Wl,--gc-sections"] }], ["OS == 'mac'", { "xcode_settings": { "MACOSX_DEPLOYMENT_TARGET": "10.9", } ...
{ "target_defaults": { "target_conditions": [ ["OS != 'win'", { "cflags": ["-fdata-sections", "-ffunction-sections", "-fvisibility=hidden"], "ldflags": ["-Wl,--gc-sections"] }], ["OS == 'mac'", { "xcode_settings": { "MACOSX_DEPLOYMENT_TARGET": "10.9", } ...
Python
0
b0dea361dfb27e537c0165dac69e71c20f33e883
Add helpers to bindings.gyp
binding.gyp
binding.gyp
{ 'targets': [ { 'target_name': 'jsaudio', 'sources': ['src/jsaudio.cc', 'src/helpers.cc'], 'include_dirs': [ '<!(node -e "require(\'nan\')")', '<(module_root_dir)/vendor/' ], "conditions": [ [ 'OS=="win"', { "conditions": [ [ 'target...
{ 'targets': [ { 'target_name': 'jsaudio', 'sources': ['src/jsaudio.cc'], 'include_dirs': [ '<!(node -e "require(\'nan\')")', '<(module_root_dir)/vendor/' ], "conditions": [ [ 'OS=="win"', { "conditions": [ [ 'target_arch=="ia32"', { ...
Python
0.000001
7e5cafed3908f829bb8ff334a7d8f6ebb939a7cc
fix test import for python3
d4s2_api/dukeds_auth.py
d4s2_api/dukeds_auth.py
from gcb_web_auth.dukeds_auth import DukeDSTokenAuthentication from gcb_web_auth.backends.dukeds import DukeDSAuthBackend from gcb_web_auth.backends.base import BaseBackend from .models import DukeDSUser class D4S2DukeDSTokenAuthentication(DukeDSTokenAuthentication): """ Extends authorization to save users to...
from gcb_web_auth.dukeds_auth import DukeDSTokenAuthentication from gcb_web_auth.backends.dukeds import DukeDSAuthBackend from gcb_web_auth.backends.base import BaseBackend from models import DukeDSUser class D4S2DukeDSTokenAuthentication(DukeDSTokenAuthentication): """ Extends authorization to save users to ...
Python
0.000001
7c788c868323aa8c6237caab208d726c5cce24ac
address first time new user condition where user_id may be none
cis/user.py
cis/user.py
"""First class object to represent a user and data about that user.""" import logging from cis.settings import get_config logger = logging.getLogger(__name__) class Profile(object): def __init__(self, boto_session=None, profile_data=None): """ :param boto_session: The boto session object from t...
"""First class object to represent a user and data about that user.""" import logging from cis.settings import get_config logger = logging.getLogger(__name__) class Profile(object): def __init__(self, boto_session=None, profile_data=None): """ :param boto_session: The boto session object from t...
Python
0.000009
81833470d1eb831e27e9e34712b983efbc38a735
Convert entire table to cartesian
solar_neighbourhood/prepare_data_add_kinematics.py
solar_neighbourhood/prepare_data_add_kinematics.py
""" Add very large RV errors for stars with no known RVs. Convert to cartesian. """ import numpy as np import sys sys.path.insert(0, '..') from chronostar import tabletool from astropy.table import Table datafile = Table.read('../data/ScoCen_box_result.fits') d = Table.read(datafile) # Set missing radial velocities ...
""" Add very large RV errors for stars with no known RVs. Convert to cartesian. """ import numpy as np import sys sys.path.insert(0, '..') from chronostar import tabletool from astropy.table import Table datafile = Table.read('../data/ScoCen_box_result.fits') d = tabletool.read(datafile) # Set missing radial velocit...
Python
0.999999
0700e25b4dce989fcfc6ee367c7516578c8aaf5b
Update heartbeat in idle times
lava_scheduler_daemon/service.py
lava_scheduler_daemon/service.py
# Copyright (C) 2013 Linaro Limited # # Author: Senthil Kumaran <senthil.kumaran@linaro.org> # # This file is part of LAVA Scheduler. # # LAVA Scheduler is free software: you can redistribute it and/or modify it # under the terms of the GNU Affero General Public License version 3 as # published by the Free Software Fou...
# Copyright (C) 2013 Linaro Limited # # Author: Senthil Kumaran <senthil.kumaran@linaro.org> # # This file is part of LAVA Scheduler. # # LAVA Scheduler is free software: you can redistribute it and/or modify it # under the terms of the GNU Affero General Public License version 3 as # published by the Free Software Fou...
Python
0.000003
fedb3768539259568555d5a62d503c7995f4b9a2
Handle orgs that you don’t own personally.
readthedocs/oauth/utils.py
readthedocs/oauth/utils.py
import logging from .models import GithubProject, GithubOrganization log = logging.getLogger(__name__) def make_github_project(user, org, privacy, repo_json): if (repo_json['private'] is True and privacy == 'private' or repo_json['private'] is False and privacy == 'public'): project, created ...
import logging from .models import GithubProject, GithubOrganization log = logging.getLogger(__name__) def make_github_project(user, org, privacy, repo_json): if (repo_json['private'] is True and privacy == 'private' or repo_json['private'] is False and privacy == 'public'): project, created ...
Python
0
7755c117e354871bbc06c98d0709545cee2032ba
Add versioning managers
share/models/base.py
share/models/base.py
import uuid import inspect from django.db import models from django.conf import settings from django.db import transaction from django.db.models.base import ModelBase from django.db.models.fields.related import lazy_related_operation from share.models.core import RawData from share.models.core import ShareUser clas...
import uuid import inspect from django.db import models from django.conf import settings from django.db import transaction from django.db.models.base import ModelBase from django.db.models.fields.related import lazy_related_operation from share.models.core import RawData from share.models.core import ShareUser clas...
Python
0
bc196c74b3959577f7254d1d5434aeb23d284eea
Convert tabs to spaces
RecordingApp/app/src/scripts/getChunks.py
RecordingApp/app/src/scripts/getChunks.py
#Script to generate a json file containing book name, number of chapters, number of chunks import json import urllib.request import re result_json_name = "chunks.json" with open("catalog.json") as file: data = json.load(file) output = [] #skip obs for now, loop over all books for x in range(1, 67): #gives b...
#Script to generate a json file containing book name, number of chapters, number of chunks import json import urllib.request import re result_json_name = "chunks.json" with open("catalog.json") as file: data = json.load(file) output = [] #skip obs for now, loop over all books for x in range(1, 67): #gives book n...
Python
0.999999
bc4a37e3a93a68fa76c47bd355e1b028f0ca6c60
fix skynetqa url, add timeout and more graceful error handling
daft/scorebig/action.py
daft/scorebig/action.py
__author__ = 'bkeroack' import logging import ec2 import salt.client import requests import re class QualType: Corp = 0 EC2 = 1 CorpMaster = 'laxqualmaster' EC2Master = 'qualmaster001' class QualTypeUnknown(Exception): pass class UploadBuildAction: def __init__(self, **kwargs): #pa...
__author__ = 'bkeroack' import logging import ec2 import salt.client import requests import re class QualType: Corp = 0 EC2 = 1 CorpMaster = 'laxqualmaster' EC2Master = 'qualmaster001' class QualTypeUnknown(Exception): pass class UploadBuildAction: def __init__(self, **kwargs): #pa...
Python
0
588fb283cc82be28d3fb28bb6a8896c42d1a7eee
Fix the CONF_LOOP check to use the config (#38890)
homeassistant/components/environment_canada/camera.py
homeassistant/components/environment_canada/camera.py
"""Support for the Environment Canada radar imagery.""" import datetime import logging from env_canada import ECRadar import voluptuous as vol from homeassistant.components.camera import PLATFORM_SCHEMA, Camera from homeassistant.const import ( ATTR_ATTRIBUTION, CONF_LATITUDE, CONF_LONGITUDE, CONF_NAM...
"""Support for the Environment Canada radar imagery.""" import datetime import logging from env_canada import ECRadar import voluptuous as vol from homeassistant.components.camera import PLATFORM_SCHEMA, Camera from homeassistant.const import ( ATTR_ATTRIBUTION, CONF_LATITUDE, CONF_LONGITUDE, CONF_NAM...
Python
0
c96cccbe7afc282aedbb316a2e9e41e47e68bcb6
fix efs lvm create (#610)
chroma-manager/tests/integration/utils/test_blockdevices/test_blockdevice_lvm.py
chroma-manager/tests/integration/utils/test_blockdevices/test_blockdevice_lvm.py
# Copyright (c) 2017 Intel Corporation. All rights reserved. # Use of this source code is governed by a MIT-style # license that can be found in the LICENSE file. import re from tests.integration.utils.test_blockdevices.test_blockdevice import TestBlockDevice class TestBlockDeviceLvm(TestBlockDevice): _supporte...
# Copyright (c) 2017 Intel Corporation. All rights reserved. # Use of this source code is governed by a MIT-style # license that can be found in the LICENSE file. import re from tests.integration.utils.test_blockdevices.test_blockdevice import TestBlockDevice class TestBlockDeviceLvm(TestBlockDevice): _supporte...
Python
0
d0e75c65505713a5f044d67a08e6697c4e332611
Add djangobower and update static settings
darts/darts/settings.py
darts/darts/settings.py
""" Django settings for darts project. For more information on this file, see https://docs.djangoproject.com/en/1.7/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.7/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) impo...
""" Django settings for darts project. For more information on this file, see https://docs.djangoproject.com/en/1.7/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.7/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) impo...
Python
0
5273e0fcdf2b7f1b03301cb0834b07da82064b98
Remove trailing /n
mailproc/vidmaster.py
mailproc/vidmaster.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Zoe vidmaster - https://github.com/rmed/zoe-vidmaster # # Copyright (c) 2015 Rafael Medina García <rafamedgar@gmail.com> # # The MIT License (MIT) # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documen...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Zoe vidmaster - https://github.com/rmed/zoe-vidmaster # # Copyright (c) 2015 Rafael Medina García <rafamedgar@gmail.com> # # The MIT License (MIT) # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documen...
Python
0.000017
a7a1a83bf0f6546b1e985b7c4611b5b83df25853
Add python's version in breakpad stack traces
breakpad.py
breakpad.py
# Copyright (c) 2009 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. """Breakpad for Python. Sends a notification when a process stops on an exception. It is only enabled when all these conditions are met: 1. hostname ...
# Copyright (c) 2009 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. """Breakpad for Python. Sends a notification when a process stops on an exception. It is only enabled when all these conditions are met: 1. hostname ...
Python
0.000057
95d9c3ecd9a8c2aa73fd91ffdf40a55fee541dd3
Enable flatpages without middleware.
suorganizer/urls.py
suorganizer/urls.py
"""suorganizer URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.8/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class...
"""suorganizer URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.8/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class...
Python
0
411751a10ece8b84bb122422b8d58f22710731aa
Fix typo
relayer/flask/logging_middleware.py
relayer/flask/logging_middleware.py
from datetime import datetime class LoggingMiddleware(object): def __init__(self, app, wsgi_app, context, logging_topic): self.app = app self.wsgi_app = wsgi_app self.context = context self.logging_topic = logging_topic def __call__(self, environ, start_response): with...
from datetime import datetime class LoggingMiddleware(object): def __init__(self, app, wsgi_app, context, logging_topic): self.app = app self.wsgi_app = wsgi_app self.context = context self.logging_topic = logging_topic def __call__(self, environ, start_response): with...
Python
0.999999
911e961f189967554bc5a046f022bb1c394cc119
Debug and test before finishing. p50-52
bruteKey.py
bruteKey.py
#!/usr/bin/env python import pexpect, optparse, os from threading import * maxConnections = 5 connection_lock = BoundSemapohre(value=maxConnections) Stop = False Fails = 0 usage = "Example: bruteKey.py -H <target> -u <user name> -d <directory> " def banner(): print "##### SSH Weak Key Exploit #######" usage prin...
#!/usr/bin/env python import pexpect, optparse, os from threading import * maxConnections = 5 connection_lock = BoundSemapohre(value=maxConnections) Stop = False Fails = 0 usage = "Example: bruteKey.py -H <target> -u <user name> -d <directory> " def banner(): print "##### SSH Weak Key Exploit #######" usage prin...
Python
0
899fcb64dbc8cc6bb9bbaf0a41f8237a9b4eea5a
remove unnecessary loop in _resolve_alias
core/argument_parser.py
core/argument_parser.py
from core.get_names import get_idol_names IDOL_NAMES = get_idol_names() ALIASES = { 'name': { 'honk': 'Kousaka Honoka', 'eri': 'Ayase Eli', 'yohane': 'Tsushima Yoshiko', 'hana': 'Koizumi Hanayo', 'pana': 'Koizumi Hanayo', 'tomato': "Nishikino Maki", 'zura': ...
from core.get_names import get_idol_names IDOL_NAMES = get_idol_names() ALIASES = { "name": { ("honk",): "Kousaka Honoka", ("eri",): "Ayase Eli", ("yohane",): "Tsushima Yoshiko", ("hana", "pana"): "Koizumi Hanayo", ("tomato",): "Nishikino Maki", ("zura", "woah", "te...
Python
0.000027
f3578096219dbb82572063c8a6dbb75be4da07ac
Update P03_combinePDFs fixed reading encrypted files
books/AutomateTheBoringStuffWithPython/Chapter13/P03_combinePDFs.py
books/AutomateTheBoringStuffWithPython/Chapter13/P03_combinePDFs.py
#! python3 # combinePdfs.py - Combines all the PDFs in the current working directory into # a single PDF. import PyPDF4, os # Get all the PDF filenames. pdfFiles = [] for filename in os.listdir('.'): if filename.endswith(".pdf"): pdfFiles.append(filename) pdfFiles.sort(key=str.lower) pdfWriter = PyPDF4.P...
#! python3 # combinePdfs.py - Combines all the PDFs in the current working directory into # a single PDF. import PyPDF4, os # Get all the PDF filenames. pdfFiles = [] for filename in os.listdir('.'): if filename.endswith(".pdf"): pdfFiles.append(filename) pdfFiles.sort(key=str.lower) pdfWriter = PyPDF4.P...
Python
0
26ce46c14f3fc5d38253617822974c21b488dd95
Set priority to 0, set viability to permanently null. Add test to ensure keyring can render itself. Ref #358.
keyring/backends/chainer.py
keyring/backends/chainer.py
""" Implementation of a keyring backend chainer. This is specifically not a viable backend, and must be instantiated directly with a list of ordered backends. """ from __future__ import absolute_import from ..backend import KeyringBackend class ChainerBackend(KeyringBackend): """ >>> ChainerBackend(()) ...
""" Implementation of a keyring backend chainer. This is specifically not a viable backend, and must be instantiated directly with a list of ordered backends. """ from __future__ import absolute_import from ..backend import KeyringBackend class ChainerBackend(KeyringBackend): def __init__(self, backends): ...
Python
0
d6ef946df0497868de9d035ab0d56d0d828c2be1
Disable failing assertion in python test
tests/query_test/test_hdfs_fd_caching.py
tests/query_test/test_hdfs_fd_caching.py
# Copyright 2012 Cloudera Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, so...
# Copyright 2012 Cloudera Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, so...
Python
0.000001
56598776ce6588445cf0d76b5faaea507d5d1405
Update Labels for consistency
github3/issues/label.py
github3/issues/label.py
# -*- coding: utf-8 -*- """Module containing the logic for labels.""" from __future__ import unicode_literals from json import dumps from ..decorators import requires_auth from ..models import GitHubCore class Label(GitHubCore): """A representation of a label object defined on a repository. See also: http:/...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from json import dumps from ..decorators import requires_auth from ..models import GitHubCore class Label(GitHubCore): """The :class:`Label <Label>` object. Succintly represents a label that exists in a repository. See also: http://develope...
Python
0
9626736dc94c85987472b7d7ad5951363883a5dc
Disable Facter plugin if yaml import fails
JsonStats/FetchStats/Plugins/Facter.py
JsonStats/FetchStats/Plugins/Facter.py
import datetime from JsonStats.FetchStats import Fetcher import os.path class Facter(Fetcher): """ Facter plugin for `jsonstats`. Returns key-value pairs of general system information provided by the `facter` command. Load conditions: * Plugin will load if the `facter` command is found Opera...
import datetime from JsonStats.FetchStats import Fetcher import os.path class Facter(Fetcher): """ Facter plugin for `jsonstats`. Returns key-value pairs of general system information provided by the `facter` command. Load conditions: * Plugin will load if the `facter` command is found Opera...
Python
0
764f785bfa34d99dc2633db78a0d80407e401993
Implement a client instance
zuora/client.py
zuora/client.py
""" Client for Zuora SOAP API """ # TODO: # - Handle debug # - Handle error # - Session policy from suds.client import Client from suds.sax.element import Element from zuora.transport import HttpTransportWithKeepAlive class ZuoraException(Exception): """ Base Zuora Exception. """ pass class Zuor...
""" Client for Zuora SOAP API """ # TODO: # - Handle debug # - Handle error # - Session policy from suds.client import Client from suds.sax.element import Element class ZuoraException(Exception): """ Base Zuora Exception. """ pass class Zuora(object): """ SOAP Client based on Suds """...
Python
0.000426
88206513d4a04a99832ac8461a3209b2d1d7d2c8
make test work
tests/test_quality/test_restoringbeam.py
tests/test_quality/test_restoringbeam.py
import os import unittest2 as unittest from tkp.quality.restoringbeam import beam_invalid from tkp.testutil.decorators import requires_data from tkp import accessors from tkp.testutil.data import DATAPATH fits_file = os.path.join(DATAPATH, 'quality/noise/bad/home-pcarrol-msss-3C196a-analysis-band6.corr.fits') ...
import os import unittest2 as unittest from tkp.quality.restoringbeam import beam_invalid from tkp.testutil.decorators import requires_data from tkp import accessors from tkp.testutil.data import DATAPATH fits_file = os.path.join(DATAPATH, 'quality/noise/bad/home-pcarrol-msss-3C196a-analysis-band6.corr.fits') ...
Python
0.000195
716ffae543838af6de7b83723ac6048a9f8f390a
improve test list latest articles
knowledge/tests/tests_views.py
knowledge/tests/tests_views.py
from __future__ import unicode_literals from model_mommy import mommy from knowledge.base import choices from knowledge.base.test import ViewTestCase from knowledge.models import Article class HomepageTestCase(ViewTestCase): from knowledge.views import Homepage view_class = Homepage view_name = 'knowl...
from __future__ import unicode_literals from model_mommy import mommy from knowledge.base import choices from knowledge.base.test import ViewTestCase from knowledge.models import Article class HomepageTestCase(ViewTestCase): from knowledge.views import Homepage view_class = Homepage view_name = 'knowl...
Python
0.000001
faa912ed8d2cb68b2f8661ed3550745967f58ba1
fix broken config path
test/test_transports.py
test/test_transports.py
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. import datetime import ssl from datetime import date import pytest from wampy.peers.clients import Client from wampy.p...
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. import datetime import ssl from datetime import date import pytest from wampy.peers.clients import Client from wampy.p...
Python
0.000004
1112495ae59542ad76d1cc72f40ab91e7e562f1c
Simplify mac_epoch_diff
Lib/fontTools/ttLib/tables/_h_e_a_d.py
Lib/fontTools/ttLib/tables/_h_e_a_d.py
from __future__ import print_function, division from fontTools.misc.py23 import * from fontTools.misc import sstruct from fontTools.misc.textTools import safeEval, num2binary, binary2num from . import DefaultTable import time import calendar headFormat = """ > # big endian tableVersion: 16.16F fontRevisio...
from __future__ import print_function, division from fontTools.misc.py23 import * from fontTools.misc import sstruct from fontTools.misc.textTools import safeEval, num2binary, binary2num from . import DefaultTable import time import calendar headFormat = """ > # big endian tableVersion: 16.16F fontRevisio...
Python
0.999998
c69ac39ee650445533d31a4a476f6f3b14cb43ca
Update roles.py
site/models/roles.py
site/models/roles.py
import datetime, re; from sqlalchemy.orm import validates; from server import DB, FlaskServer; class Roles(DB.Model): id = DB.Column(DB.Integer, primary_key=True, autoincrement=True); name = DB.Column(DB.String(20); district_id = DB.relationship(DB.Integer, DB.ForeignKey('district.id')); created_by = DB....
import datetime, re; from sqlalchemy.orm import validates; from server import DB, FlaskServer; class Roles(DB.Model): id = DB.Column(DB.Integer, primary_key=True, autoincrement=True); name = DB.Column(DB.String(20); district_id = DB.relationship(DB.Integer, DB.ForeignKey('district.id')); created_by = DB....
Python
0.000001
a39dcc1548bea483225635292c5e1f489a3288a2
support direct line navigation shorthand (submission from RUBY-12579 improved) #RUBY-12579 fixed
platform/platform-resources/src/launcher.py
platform/platform-resources/src/launcher.py
#!/usr/bin/python import socket import struct import sys import os import os.path import time # see com.intelij.idea.SocketLock for the server side of this interface RUN_PATH = '$RUN_PATH$' CONFIG_PATH = '$CONFIG_PATH$' args = [] skip_next = False for arg in sys.argv[1:]: if arg == '-h' or arg == '-?' or arg == ...
#!/usr/bin/python import socket import struct import sys import os import os.path import time # see com.intelij.idea.SocketLock for the server side of this interface RUN_PATH = '$RUN_PATH$' CONFIG_PATH = '$CONFIG_PATH$' args = [] skip_next = False for arg in sys.argv[1:]: if arg == '-l' or arg == '--line': ...
Python
0
8a5d931cb66dc452e9db6f52ac7fcc371a855608
Update curate_teleco_performance_data.py
lab-01/cell-tower-anomaly-detection/00-scripts/curate_teleco_performance_data.py
lab-01/cell-tower-anomaly-detection/00-scripts/curate_teleco_performance_data.py
# ====================================================================================== # ABOUT # In this PySpark script, we augment the Telecom data with curated customer data (prior # job), curate it and persist to GCS # ====================================================================================== import c...
# ====================================================================================== # ABOUT # In this PySpark script, we augment the Telecom data with curated customer data (prior # job), curate it and persist to GCS # ====================================================================================== import c...
Python
0
ea542282911cbc7b3cf594a20175fbddcbd75a89
Use absolute import
restapi_logging_handler/__init__.py
restapi_logging_handler/__init__.py
from __future__ import absolute_import from restapi_logging_handler.loggly_handler import LogglyHandler from restapi_logging_handler.restapi_logging_handler import RestApiHandler
from loggly_handler import LogglyHandler from restapi_logging_handler import RestApiHandler
Python
0.000045
128c54529da80d5f84a0bf8a9bca6e83ed14a342
Delete unused import
simplesqlite/loader/html/formatter.py
simplesqlite/loader/html/formatter.py
# encoding: utf-8 """ .. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com> """ from __future__ import absolute_import import bs4 import dataproperty from ..constant import TableNameTemplate as tnt from ..data import TableData from ..formatter import TableFormatter class HtmlTableFormatter(TableFormatter): ...
# encoding: utf-8 """ .. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com> """ from __future__ import absolute_import import bs4 import dataproperty from ..constant import TableNameTemplate as tnt from ..data import TableData from ..error import InvalidDataError from ..formatter import TableFormatter class Htm...
Python
0.000001
de69aa9c04ea34bd31b5cf17e8e3cfdf17b0b9df
Naive user/password login w.o. encryption
1wire/publish.py
1wire/publish.py
#!/usr/bin/env python import os import argparse import time import threading from Queue import Queue import mosquitto queue = Queue(100) def main(host, port, user, password, sensors): print "#######################" print "Temperature poller v0.2" print "#######################" print "Using sensors...
#!/usr/bin/env python import os import argparse import time import threading from Queue import Queue import mosquitto queue = Queue(100) def main(host, port, sensors): print "#######################" print "Temperature poller v0.2" print "#######################" print "Using sensors:" pollers =...
Python
0.99999
7f02d1f2b23bbf27e99d87ef23c491823875c3d1
fix bin none subprocess.TimeoutExpired
bin/virt.py
bin/virt.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import yaml import subprocess import os import sys def proc(cmd,time = 120,sh = True ): print("$".format(cmd)) p = subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE, shell=sh) outs, errs = p.communicate(timeout=time) return outs,errs,p ROO...
#!/usr/bin/env python # -*- coding: utf-8 -*- import yaml import subprocess import os import sys def proc(cmd,time = 120,sh = True ): print("$".format(cmd)) p = subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE, shell=sh) try: outs, errs = p.communicate(timeout=time) except sub...
Python
0.000001
45e9ddce96b4fdadca63a50bf2808c7f98520d99
print query on error
data_upload/util/bq_wrapper.py
data_upload/util/bq_wrapper.py
''' Created on Jan 22, 2017 Copyright 2017, Institute for Systems Biology. 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...
''' Created on Jan 22, 2017 Copyright 2017, Institute for Systems Biology. 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.000446
d590307b0d59ac7163016197e3de0e8bced377d2
Fix form typo
account_verification_flask/forms/forms.py
account_verification_flask/forms/forms.py
from flask_wtf import Form from wtforms import TextField, PasswordField, IntegerField from wtforms.validators import DataRequired, Length, Email, EqualTo class RegisterForm(Form): name = TextField( 'Tell us your name', validators = [DataRequired(message = "Name is required"), Length(min = 3,messag...
from flask_wtf import Form from wtforms import TextField, PasswordField, IntegerField from wtforms.validators import DataRequired, Length, Email, EqualTo class RegisterForm(Form): name = TextField( 'Tell us your name', validators = [DataRequired(message = "Name is required"), Length(min = 3,messag...
Python
0.000191
a1826e5507a083cdcb906c411e97031bb5546eae
Remove debug print
cax/qsub.py
cax/qsub.py
""" Access the cluster. Easy to use functions to make use of the cluster facilities. This checks the available slots on the requested queue, creates the scripts to submit, submits the jobs, and cleans up afterwards. Example usage:: >>> import qsub >>> qsub.submit_job('touch /data/hisp...
""" Access the cluster. Easy to use functions to make use of the cluster facilities. This checks the available slots on the requested queue, creates the scripts to submit, submits the jobs, and cleans up afterwards. Example usage:: >>> import qsub >>> qsub.submit_job('touch /data/hisp...
Python
0.000003
ddaa9a687019794f61c019c5e3139a0b9ceaf521
enable C++ exception-handling
binding.gyp
binding.gyp
{ "target_defaults": { "conditions": [ ['OS=="win"', { }, { 'cflags' : [ "-fexceptions" ], 'cflags_cc' : [ "-fexceptions" ] } ] ], "configurations": { "Release": { 'msvs_settings': { 'VCCLCompilerTool': { 'WholeProgramOptimization': ...
{ "target_defaults": { "conditions": [ ['OS=="win"', { }, { 'cflags' : [ "-fexceptions" ], 'cflags_cc' : [ "-fexceptions" ] } ] ], "configurations": { "Release": { 'msvs_settings': { 'VCCLCompilerTool': { 'WholeProgramOptimization': ...
Python
0.000012
7998477a627a78b83f96894e72ec2f121c4b9606
Update binding.gyp
binding.gyp
binding.gyp
{ "targets": [ { 'target_name': 'LDAP', 'sources': [ 'src/LDAP.cc' ], 'include_dirs': [ '/usr/local/include' ], 'defines': [ 'LDAP_DEPRECATED' ], 'cflags': [ '-Wall', '-g' ], 'libraries': [ '-llber -ll...
{ "targets": [ { 'target_name': 'LDAP', 'sources': [ 'src/LDAP.cc' ], 'include_dirs': [ '/usr/local/include' ], 'defines': [ 'LDAP_DEPRECATED' ], 'cflags': [ '-Wall', '-g' ], 'ldflags': [ '-L/usr/local...
Python
0
996c8d4e9a65f411341f0c5f349ff3788cca0209
Use unittest assertions.
rinse/tests/test_client.py
rinse/tests/test_client.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Unit tests for rinse.client module.""" import unittest from lxml import etree from mock import MagicMock, patch from rinse.client import SoapClient from rinse.message import SoapMessage from .utils import captured_stdout class TestSoapMessage(unittest.TestCase): ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """Unit tests for rinse.client module.""" import unittest from lxml import etree from mock import MagicMock, patch from rinse.client import SoapClient from rinse.message import SoapMessage from .utils import captured_stdout class TestSoapMessage(unittest.TestCase): ...
Python
0
182c2ea095dc5207b6d66ce1ad8e2ad2dc986da2
Fix test skipper
skimage/_shared/tests/test_testing.py
skimage/_shared/tests/test_testing.py
""" Testing decorators module """ import numpy as np from nose.tools import (assert_true, assert_raises, assert_equal) from skimage._shared.testing import doctest_skip_parser, test_parallel def test_skipper(): def f(): pass class c(): def __init__(self): self.me = "I think, ther...
""" Testing decorators module """ import numpy as np from nose.tools import (assert_true, assert_raises, assert_equal) from skimage._shared.testing import doctest_skip_parser, test_parallel def test_skipper(): def f(): pass class c(): def __init__(self): self.me = "I think, ther...
Python
0.000003
01bee58d06a2af3f94e3a1be954abd845da52ba1
Update language.py
language_detection/language.py
language_detection/language.py
import pickle import os from sklearn.decomposition import TruncatedSVD from sklearn.metrics import pairwise class language_detection: def __init__(self): # ''' Constructor for this class. ''' __location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__))) ...
import pickle import os from sklearn.decomposition import TruncatedSVD from sklearn.metrics import pairwise class language_detection: def __init__(self): # ''' Constructor for this class. ''' __location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__))) ...
Python
0.000001
2a65b1715e469e11ed73faf7f3446f81c836c42e
Add fetch domain logic
handler/domain.py
handler/domain.py
#!/usr/bin/python # -*- coding:utf-8 -*- # Powered By KK Studio # Domain Page from BaseHandler import BaseHandler from tornado.web import authenticated as Auth from model.models import Domain, Groups, Record class IndexHandler(BaseHandler): @Auth def get(self): page = int(self.get_argument('page', 1)...
#!/usr/bin/python # -*- coding:utf-8 -*- # Powered By KK Studio # Domain Page from BaseHandler import BaseHandler from tornado.web import authenticated as Auth class IndexHandler(BaseHandler): @Auth def get(self): self.render('domain/index.html') class GroupHandler(BaseHandler): @Auth def g...
Python
0.000001
c7412824c1e9edb7c386f111ce30b5d76952f861
Remove 'reviews' from Context API return
mendel/serializers.py
mendel/serializers.py
from .models import Keyword, Category, Document, Context, Review, User from rest_auth.models import TokenModel from rest_framework import serializers class KeywordSerializer(serializers.ModelSerializer): class Meta: model = Keyword fields = ('id', 'name', 'definition') def create(self, valid...
from .models import Keyword, Category, Document, Context, Review, User from rest_auth.models import TokenModel from rest_framework import serializers class KeywordSerializer(serializers.ModelSerializer): class Meta: model = Keyword fields = ('id', 'name', 'definition') def create(self, valid...
Python
0.000006
f471441bde9940e46badd0ec506c18e8587de004
Optimize the rebuild admin
metaci/build/admin.py
metaci/build/admin.py
from django.contrib import admin from metaci.build.models import Build from metaci.build.models import BuildFlow from metaci.build.models import FlowTask from metaci.build.models import Rebuild class BuildAdmin(admin.ModelAdmin): list_display = ( 'repo', 'plan', 'branch', 'commit',...
from django.contrib import admin from metaci.build.models import Build from metaci.build.models import BuildFlow from metaci.build.models import FlowTask from metaci.build.models import Rebuild class BuildAdmin(admin.ModelAdmin): list_display = ( 'repo', 'plan', 'branch', 'commit',...
Python
0.000003
206f76026504219ed52f2fcca1b6b64b78bdcf21
Add some print statements
software/lightpowertool/csv_export.py
software/lightpowertool/csv_export.py
import csv class CSVExport(object): """docstring for CSVExport""" def __init__(self, filename): super(CSVExport, self).__init__() self._filename = filename def export_data(self, data): print("Beginning exportation of data...") with open(self._filename, "w", newline='') as c...
import csv class CSVExport(object): """docstring for CSVExport""" def __init__(self, filename): super(CSVExport, self).__init__() self._filename = filename def export_data(self, data): with open(self._filename, "w", newline='') as csvfile: csvwriter = csv.writer(csvfile...
Python
0.006669
3121a02c6174a31b64974d57a3ec2d7df760a7ae
Ajoute une référence législative au taux d'incapacité
openfisca_france/model/caracteristiques_socio_demographiques/capacite_travail.py
openfisca_france/model/caracteristiques_socio_demographiques/capacite_travail.py
# -*- coding: utf-8 -*- from openfisca_france.model.base import * class taux_capacite_travail(Variable): value_type = float default_value = 1.0 entity = Individu label = u"Taux de capacité de travail, appréciée par la commission des droits et de l'autonomie des personnes handicapées (CDAPH)" defi...
# -*- coding: utf-8 -*- from openfisca_france.model.base import * class taux_capacite_travail(Variable): value_type = float default_value = 1.0 entity = Individu label = u"Taux de capacité de travail, appréciée par la commission des droits et de l'autonomie des personnes handicapées (CDAPH)" defi...
Python
0.000012
a279cb4340c6da5ed64b39660cfcb5ef53d0bb74
Fix test
tests/core/test_node.py
tests/core/test_node.py
from common import auth_check def test_node_fields(mc): cclient = mc.client fields = { 'nodeTaints': 'r', 'nodeLabels': 'r', 'nodeAnnotations': 'r', 'namespaceId': 'cr', 'conditions': 'r', 'allocatable': 'r', 'capacity': 'r', 'hostname': 'r', ...
from common import auth_check def test_node_fields(mc): cclient = mc.client fields = { 'nodeTaints': 'r', 'nodeLabels': 'r', 'nodeAnnotations': 'r', 'namespaceId': 'cr', 'conditions': 'r', 'allocatable': 'r', 'capacity': 'r', 'hostname': 'r', ...
Python
0.000004
7b67ae8910b90dda49d370dd95fb5969a9a5d16b
Fix restrict_quadrants and add all 4 corners
cell.py
cell.py
from __future__ import division import collections import itertools import math Spoke = collections.namedtuple('Spoke', 'start, end') def get_neighbours(cell, include_self=False): """ Get 8 neighbouring cell coords to a start cell. If `include_self` is True, returns the current (center) cell as well. ...
from __future__ import division import collections import itertools import math Spoke = collections.namedtuple('Spoke', 'start, end') def get_neighbours(cell, include_self=False): """ Get 8 neighbouring cell coords to a start cell. If `include_self` is True, returns the current (center) cell as well. ...
Python
0.000001
1bf3e893e45e0dc16e2e820f5f073a63600217c3
Fix errors in PeriodicFilter
robotpy_ext/misc/periodic_filter.py
robotpy_ext/misc/periodic_filter.py
import logging import time class PeriodicFilter: """ Periodic Filter to help keep down clutter in the console. Simply add this filter to your logger and the logger will only print periodically. The logger will always print logging levels of WARNING or higher """ def __ini...
import logging import wpilib class PeriodicFilter: """ Periodic Filter to help keep down clutter in the console. Simply add this filter to your logger and the logger will only print periodically. The logger will always print logging levels of WARNING or higher """ def __i...
Python
0.000119
881b5c56e89fb2fdb7d4af3a9ec5c5044a25b878
declare dummy functions
ansible/lib/modules/rally/library/test.py
ansible/lib/modules/rally/library/test.py
from ansible.module_utils.basic import * DOCUMENTATION = ''' --- module: rally short_description: Executes rally commands ''' def main(): fields = { "scenario_file" : {"required": True, "type": "str"}, "scenario_args" : {"required" : False, "type": "str"}, } commands = {'create_db', ...
from ansible.module_utils.basic import * DOCUMENTATION = ''' --- module: rally short_description: Executes rally commands ''' def main(): fields = { "scenario_file" : {"required": True, "type": "str"}, "scenario_args" : {"required" : False, "type": "str"}, } commands = {'create_db', ...
Python
0.000034
27330e69226f36b49f5d5eca5a67af29ee8d679b
Normalize the weasyl link.
conbadge.py
conbadge.py
from fractions import Fraction from cStringIO import StringIO from PIL import Image, ImageDraw, ImageFont import qrcode import requests museo = ImageFont.truetype('Museo500-Regular.otf', 424) badge_back = Image.open('badge-back.png') logo_stamp = Image.open('logo-stamp.png') qr_size = 975, 975 qr_offset = 75, 75 na...
from fractions import Fraction from cStringIO import StringIO from PIL import Image, ImageDraw, ImageFont import qrcode import requests museo = ImageFont.truetype('Museo500-Regular.otf', 424) badge_back = Image.open('badge-back.png') logo_stamp = Image.open('logo-stamp.png') qr_size = 975, 975 qr_offset = 75, 75 na...
Python
0.000002
90678692ec85ec90d454b1a3b255dae834bb24ba
trim space
tests/mocks/postgres.py
tests/mocks/postgres.py
from psycopg2.extensions import connection, cursor class MockConnection(connection): def __init__(self, *args, **kwargs): self._cursor = MockCursor() def cursor(self, *args, **kwargs): return self._cursor class MockCursor(cursor): def __init__(self, *args, **kwargs): self.queries =...
from psycopg2.extensions import connection, cursor class MockConnection(connection): def __init__(self, *args, **kwargs): self._cursor = MockCursor() def cursor(self, *args, **kwargs): return self._cursor class MockCursor(cursor): def __init__(self, *args, **kwargs): self.queries ...
Python
0.000001
4c5ebbabcf54b1f23459da7ddf85adf5e5de22d8
Update add-lore.py to serve legacy lorebot needs
add-lore.py
add-lore.py
#!/usr/bin/env python3 import argparse import datetime from peewee import peewee db = peewee.SqliteDatabase(None) class BaseModel(peewee.Model): class Meta: database = db class Lore(BaseModel): time = peewee.DateTimeField(null=True, index=True) author = peewee.CharField(null=True, index=True) ...
#!/usr/bin/env python3 import argparse import datetime from peewee import peewee db = peewee.SqliteDatabase(None) class BaseModel(peewee.Model): class Meta: database = db class Lore(BaseModel): time = peewee.DateTimeField(null=True, index=True) author = peewee.CharField(null=True, index=True) ...
Python
0
5f21305d1736322064aa9f5e503965b102a6c086
Add Ending class
hairball/plugins/neu.py
hairball/plugins/neu.py
"""This module provides plugins for NEU metrics.""" import kurt from hairball.plugins import HairballPlugin from PIL import Image import os class Variables(HairballPlugin): """Plugin that counts the number of variables in a project.""" def __init__(self): super(Variables, self).__init__() s...
"""This module provides plugins for NEU metrics.""" import kurt from hairball.plugins import HairballPlugin from PIL import Image import os class Variables(HairballPlugin): """Plugin that counts the number of variables in a project.""" def __init__(self): super(Variables, self).__init__() s...
Python
0.000011
6ed282bb2da04790e6e399faad4d2ba8dfc214c4
add v0.20210330 (#28111)
var/spack/repos/builtin/packages/ccls/package.py
var/spack/repos/builtin/packages/ccls/package.py
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Ccls(CMakePackage): """C/C++ language server""" homepage = "https://github.com/MaskRa...
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Ccls(CMakePackage): """C/C++ language server""" homepage = "https://github.com/MaskRa...
Python
0
f230e69780823f4ceb48a68015cd5bd4af94cba0
Add in some settings for email
ml_service_api/aws.py
ml_service_api/aws.py
""" Deployment settings file """ from settings import * import json DEBUG=False TIME_BETWEEN_INDEX_REBUILDS = 60 * 30 # seconds #Tastypie throttle settings THROTTLE_AT = 100 #Throttle requests after this number in below timeframe THROTTLE_TIMEFRAME= 60 * 60 #Timeframe in which to throttle N requests, seconds THROTT...
""" Deployment settings file """ from settings import * import json DEBUG=False TIME_BETWEEN_INDEX_REBUILDS = 60 * 30 # seconds #Tastypie throttle settings THROTTLE_AT = 100 #Throttle requests after this number in below timeframe THROTTLE_TIMEFRAME= 60 * 60 #Timeframe in which to throttle N requests, seconds THROTT...
Python
0.000001
e4fff83666ee6e3ce63145f84a550f6fb361096d
Fix Enum hack situation
nycodex/db.py
nycodex/db.py
import enum import os import typing import sqlalchemy from sqlalchemy.dialects import postgresql from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() # type: typing.Any engine = sqlalchemy.create_engine(os.environ["DATABASE_URI"]) Session = sqlalchemy.orm.sessionmaker(bind=engine) @en...
from enum import Enum import os import typing import sqlalchemy from sqlalchemy.dialects import postgresql from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() # type: typing.Any engine = sqlalchemy.create_engine(os.environ["DATABASE_URI"]) Session = sqlalchemy.orm.sessionmaker(bind=eng...
Python
0.000013
6ac28c1daa0173ae5baa66c9cb020e9c673973ff
Add info for lftp@4.8.1 (#5452)
var/spack/repos/builtin/packages/lftp/package.py
var/spack/repos/builtin/packages/lftp/package.py
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
Python
0
e2be8a486c9d13f98d9f14ae7b0cddf8225cf1b3
Add boolswitch test
test/test_apv_rename.py
test/test_apv_rename.py
""" Copyright (c) 2017, Michael Sonntag (sonntag@bio.lmu.de) All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted under the terms of the BSD License. See LICENSE file in the root of the project. """ import os import shutil import tempfile import unittest...
""" Copyright (c) 2017, Michael Sonntag (sonntag@bio.lmu.de) All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted under the terms of the BSD License. See LICENSE file in the root of the project. """ import os import shutil import tempfile import unittest...
Python
0.000001
59faede78ad5d763c7c9fa1763e3e7cac67c1ca6
Move Circle inside CxDeriv
cxroots/CxDerivative.py
cxroots/CxDerivative.py
from __future__ import division import numpy as np from numpy import inf, pi import scipy.integrate import math def CxDeriv(f, contour=None): """ Compute derivaive of an analytic function using Cauchy's Integral Formula for Derivatives """ if contour is None: from cxroots.Contours import Circle C = lambda z0: ...
from __future__ import division import numpy as np from numpy import inf, pi import scipy.integrate import math from cxroots.Contours import Circle, Rectangle def CxDeriv(f, contour=None): """ Compute derivaive of an analytic function using Cauchy's Integral Formula for Derivatives """ if contour is None: C = l...
Python
0
2df7947f02fd39e05bf18a89f904e273d17c63ca
add v0.9.29 (#23606)
var/spack/repos/builtin/packages/lmdb/package.py
var/spack/repos/builtin/packages/lmdb/package.py
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Lmdb(MakefilePackage): """Symas LMDB is an extraordinarily fast, memory-efficient database...
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Lmdb(MakefilePackage): """Symas LMDB is an extraordinarily fast, memory-efficient database...
Python
0
7abc503d6aa492f2340ab0b98d1f66892180ba19
Fix some test error
tests/test_blueprint.py
tests/test_blueprint.py
from wood import Wood from wood.support import Blueprint def make_example_blueprint(): b = Blueprint() b.empty(r"/example","example") return b def test_blueprint_can_add_empty_handler(): b = make_example_blueprint() assert b != None def test_blueprint_can_add_handlers_to_wood(): w = Wood(...
from wood import Wood from wood.support import Blueprint def make_example_blueprint(): b = Blueprint() b.empty(r"/example","example") return b def test_blueprint_can_add_empty_handler(): b = make_example_blueprint() assert b != None def test_blueprint_can_add_handlers_to_wood(): w = Wood(...
Python
0.002705
d5438347980b4ed3f4a798b8c1019b87691f28bd
Bump version
oi/version.py
oi/version.py
VERSION = '0.2.1'
VERSION = '0.2.0'
Python
0
676440a464d695146361eb1bdb684e121bf41a42
fix simple_date parsing
solution/__init__.py
solution/__init__.py
# coding=utf-8 """ ============================= Solution ============================= An amazing form solution :copyright: `Juan-Pablo Scaletti <http://jpscaletti.com>`_. :license: MIT, see LICENSE for more details. """ from .form import Form # noqa from .formset import FormSet # noqa fro...
# coding=utf-8 """ ============================= Solution ============================= An amazing form solution :copyright: `Juan-Pablo Scaletti <http://jpscaletti.com>`_. :license: MIT, see LICENSE for more details. """ from .form import Form # noqa from .formset import FormSet # noqa fro...
Python
0.000345
c9f634ccea4b034907bb403a683945ace373c97d
Add unary + - support for atoms
solver/core/atoms.py
solver/core/atoms.py
class Atom(object): """ Base class for any atomic type """ def __pos__(self): return self def __neg__(self): return -1 * self def __add__(self, other): from .operations import Add return Add(self, other) def __radd__(self, other): return self.__add__(o...
class Atom(object): """ Base class for any atomic type """ def __add__(self, other): from .operations import Add return Add(self, other) def __radd__(self, other): return self.__add__(other) def __mul__(self, other): from .operations import Mul return Mul(s...
Python
0.001074
f6c6ff376974f604b2b4a7b62ad28fd56a264c55
Add empty testing scaffolding.
test/test_exceptions.py
test/test_exceptions.py
#!/usr/bin/env python3 import pyglab.exceptions as ex import unittest as ut class TestBadRequest(ut.TestCase): def test_throw(self): pass def test_statuscode(self): pass def test_message(self): pass def test_body(self): pass
#!/usr/bin/env python3 import pyglab.exceptions as ex
Python
0
f13982144a2a0710af8e082dd01d73f036f026fd
Use clean_system fixture on pypackage test
tests/test_pypackage.py
tests/test_pypackage.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_pypackage -------------- Tests formerly known from a unittest residing in test_generate.py named TestPyPackage.test_cookiecutter_pypackage """ from __future__ import unicode_literals import os import subprocess import pytest from cookiecutter import utils from ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_pypackage -------------- Tests formerly known from a unittest residing in test_generate.py named TestPyPackage.test_cookiecutter_pypackage """ from __future__ import unicode_literals import os import subprocess import pytest from cookiecutter import utils from ...
Python
0
247e8f8ce8ed4677c629affec6b9a291c730e3a2
Use assert_equal instead of assertEqual in fail testcase.
tests/testcases/fail.py
tests/testcases/fail.py
from systest import TestCase class FailTest(TestCase): """A test that always fails. """ count = 0 def __init__(self, name): super(FailTest, self).__init__() self.name = "fail_" + name def run(self): FailTest.count += 1 self.assert_equal(1, 0)
from systest import TestCase class FailTest(TestCase): """A test that always fails. """ count = 0 def __init__(self, name): super(FailTest, self).__init__() self.name = "fail_" + name def run(self): FailTest.count += 1 self.assertEqual(1, 0)
Python
0
3c2d290452a07946880fc25af917b32766f9529d
Update test script to include deposit
testsuite/front_test.py
testsuite/front_test.py
#!/usr/bin/env python2 import gevent import requests import json import time import hashlib ip_address = "vm" port = "3000" url = ''.join(['http://', ip_address, ':', port]) def secret(params, secret): keys = params.keys() keys.sort() hash_str = "" for key in keys: hash_str += (params[key]) ...
#!/usr/bin/env python2 import gevent import requests import json import time import hashlib ip_address = "vm" port = "3000" url = ''.join(['http://', ip_address, ':', port]) def secret(params, secret): keys = params.keys() keys.sort() hash_str = "" for key in keys: hash_str += (params[key]) ...
Python
0
50c4b312a27b61725885ee84d45a0f07f94a8ec6
Handle interactive-on-error also when error is from contextmanager exit.
teuthology/run_tasks.py
teuthology/run_tasks.py
import sys import logging log = logging.getLogger(__name__) def _run_one_task(taskname, **kwargs): submod = taskname subtask = 'task' if '.' in taskname: (submod, subtask) = taskname.rsplit('.', 1) parent = __import__('teuthology.task', globals(), locals(), [submod], 0) mod = getattr(paren...
import sys import logging log = logging.getLogger(__name__) def _run_one_task(taskname, **kwargs): submod = taskname subtask = 'task' if '.' in taskname: (submod, subtask) = taskname.rsplit('.', 1) parent = __import__('teuthology.task', globals(), locals(), [submod], 0) mod = getattr(paren...
Python
0
e8eaa2e4bd6cc7fe51e3c4c15a5bf392a24d5b92
generate index
hodge/__init__.py
hodge/__init__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import io import shutil import click from cookiecutter.main import cookiecutter from slugify import slugify from jinja2 import Template, Environment, FileSystemLoader from datetime import datetime import markdown2 from .utils import walk_dir @click.group() def ...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import io import shutil import click from cookiecutter.main import cookiecutter from slugify import slugify from jinja2 import Template, Environment, FileSystemLoader from datetime import datetime import markdown2 from .utils import walk_dir @click.group() def ...
Python
0.999996
f6c0258e257aa537dbb64bb8c5f10c87ec32dcf9
Update my_hooks.py
hooks/my_hooks.py
hooks/my_hooks.py
#!/usr/bin/python """ Example Diaphora export hooks script. In this example script the following fake scenario is considered: 1) There is a something-user.i64 database, for user-land stuff. 2) There is a something-kernel.i64 database, for kernel-land stuff. 3) We export all functions from the something-user.i64...
#!/usr/bin/python """ Example Diaphora export hooks script. In this example script the following fake scenario is considered: 1) There is a something-user.i64 database, for user-land stuff. 2) There is a something-kernel.i64 database, for kernel-land stuff. 3) We export all functions from the something-user.i64...
Python
0.000001
4ab33cec7c0f4ee9fee7a7dce1c28466780b7074
Add hoomd.box.Box to main namespace
hoomd/__init__.py
hoomd/__init__.py
# Copyright (c) 2009-2019 The Regents of the University of Michigan # This file is part of the HOOMD-blue project, released under the BSD 3-Clause # License. """ HOOMD-blue python API :py:mod:`hoomd` provides a high level user interface for defining and executing simulations using HOOMD. .. rubric:: API stability :...
# Copyright (c) 2009-2019 The Regents of the University of Michigan # This file is part of the HOOMD-blue project, released under the BSD 3-Clause # License. """ HOOMD-blue python API :py:mod:`hoomd` provides a high level user interface for defining and executing simulations using HOOMD. .. rubric:: API stability :...
Python
0.000003
c7ecf728e12dd3a59f4ef45e30b61ce5c52ceca5
Fix corpus to Polish language
analysis/textclassification/bagofwords.py
analysis/textclassification/bagofwords.py
import functools from nltk import ngrams from nltk.collocations import BigramCollocationFinder from nltk.metrics import BigramAssocMeasures import nltk.corpus import re import definitions INVALID_TOKEN_PATTERN = r'^[!%"%\*\(\)\+,&#-\.\$/\d:;\?\<\>\=@\[\]].*' NEGATION_TOKEN_PATTERN = r'^nie$' def get_stopwords_list()...
import functools from nltk import ngrams from nltk.collocations import BigramCollocationFinder from nltk.metrics import BigramAssocMeasures import nltk.corpus import re import definitions INVALID_TOKEN_PATTERN = r'^[!%"%\*\(\)\+,&#-\.\$/\d:;\?\<\>\=@\[\]].*' NEGATION_TOKEN_PATTERN = r'^nie$' def get_stopwords_list()...
Python
0.999998
de027652a4bb12c6d1a4cb7bc85448c8c2a0d321
use argparse to get arguments from command line
sortroms/__main__.py
sortroms/__main__.py
from sortroms import main import argparse parser = argparse.ArgumentParser( description='Sort emulator ROM files', prog='sortroms' ) parser.add_argument( 'folder', metavar='DIR', type=str, nargs='?', help='The ROM folder to sort.' ) if __name__ == '__main__': args = parser.parse_args() main(args)
from sortroms import main if __name__ == '__main__': main()
Python
0.000001
56151ad549e82206c3894e8c945c00d4bac24ab5
Complete error message.
source/memex/rest.py
source/memex/rest.py
from rest_framework import routers, serializers, viewsets, parsers, filters from django.core.exceptions import ValidationError from django.core.files.uploadedfile import SimpleUploadedFile, InMemoryUploadedFile from base.models import Project from apps.crawl_space.models import Crawl, CrawlModel class SlugModelSeri...
from rest_framework import routers, serializers, viewsets, parsers, filters from django.core.exceptions import ValidationError from django.core.files.uploadedfile import SimpleUploadedFile, InMemoryUploadedFile from base.models import Project from apps.crawl_space.models import Crawl, CrawlModel class SlugModelSeri...
Python
0
25c242ed3352bcf52683454e12c3e9ae7e51622b
Check line endings for all modified files with 'binary' attr not set.
hooks.d/line_endings.py
hooks.d/line_endings.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # vim:ts=4:sw=4:expandtab # # ================================================================== # # Copyright (c) 2016, Parallels IP Holdings GmbH # Released under the terms of MIT license (see LICENSE for details) # # ======================================================...
#!/usr/bin/env python # -*- coding: utf-8 -*- # vim:ts=4:sw=4:expandtab # # ================================================================== # # Copyright (c) 2016, Parallels IP Holdings GmbH # Released under the terms of MIT license (see LICENSE for details) # # ======================================================...
Python
0
19d81520a7fe9dd8098bd1603b455f08e465c5f7
add getspire to init
hsadownload/__init__.py
hsadownload/__init__.py
__all__ = ['access', 'getpacs', 'getspire'] from hsadownload import access, getpacs, getspire
__all__ = ['access', 'getpacs'] from hsadownload import access, getpacs
Python
0
54b40488a7b0baefba3ada33cf9b792af1c2ca4d
fix bug with api v1
people/api.py
people/api.py
# -*- coding: utf-8 -*- from django.contrib.auth.models import User from tastypie import fields from tastypie.resources import ModelResource, ALL, ALL_WITH_RELATIONS from common.api import WebsiteResource from .models import Artist, Staff, Organization class UserResource(ModelResource): class Meta: querys...
# -*- coding: utf-8 -*- from django.contrib.auth.models import User from tastypie import fields from tastypie.resources import ModelResource, ALL, ALL_WITH_RELATIONS from common.api import WebsiteResource from .models import Artist, Staff, Organization class UserResource(ModelResource): class Meta: querys...
Python
0
59b2d0418c787066c37904816925dad15b0b45cf
Use author display name in document list_filter
scanblog/scanning/admin.py
scanblog/scanning/admin.py
from django.contrib import admin from scanning.models import PendingScan, Document, DocumentPage, Scan, ScanPage, Transcription class ScanPageInline(admin.TabularInline): model = ScanPage class ScanAdmin(admin.ModelAdmin): model = Scan inlines = [ScanPageInline] admin.site.register(Scan, ScanAdmin) class...
from django.contrib import admin from scanning.models import PendingScan, Document, DocumentPage, Scan, ScanPage, Transcription class ScanPageInline(admin.TabularInline): model = ScanPage class ScanAdmin(admin.ModelAdmin): model = Scan inlines = [ScanPageInline] admin.site.register(Scan, ScanAdmin) class...
Python
0.000001
3bc11eea2d629b316eb9a8bdf4d9c2a2c801ddf5
Remove unused imports
whylog/tests/tests_front/tests_whylog_factory.py
whylog/tests/tests_front/tests_whylog_factory.py
from whylog.config.investigation_plan import LineSource from whylog.front.whylog_factory import whylog_factory from whylog.front.utils import FrontInput from whylog.tests.utils import TestRemovingSettings class TestWhylogFactory(TestRemovingSettings): def tests_whylog_factory(self): log_reader, teacher_ge...
from whylog.config.investigation_plan import LineSource from whylog.front.whylog_factory import whylog_factory from whylog.front.utils import FrontInput from whylog.log_reader import LogReader from whylog.teacher import Teacher from whylog.tests.utils import TestRemovingSettings class TestWhylogFactory(TestRemovingSe...
Python
0.000001
b875084e74ee03c6b251a79f04f0db340bb356b8
Fix #604
scout/constants/indexes.py
scout/constants/indexes.py
from pymongo import (IndexModel, ASCENDING, DESCENDING) INDEXES = { 'hgnc_collection': [ IndexModel([ ('build', ASCENDING), ('chromosome', ASCENDING)], name="build_chromosome"), ], 'variant_collection': [ IndexModel([ ('case_id', ASCENDING),...
from pymongo import (IndexModel, ASCENDING, DESCENDING) INDEXES = { 'hgnc_collection': [IndexModel( [('build', ASCENDING), ('chromosome', ASCENDING)], name="build_chromosome"), ], 'variant_collection': [ IndexModel([('case_id', ASCENDING),('rank_score', DESCENDING)], name="caseid_rankscore"...
Python
0.000001
87371774ad332a3adbe927e2609d73710f4a7678
change method name
tests/graph/test_dag.py
tests/graph/test_dag.py
from pybbn.graph.edge import Edge, EdgeType from pybbn.graph.node import Node from pybbn.graph.dag import Dag from nose import with_setup def setup(): pass def teardown(): pass @with_setup(setup, teardown) def test_dag_creation(): n0 = Node(0) n1 = Node(1) n2 = Node(2) e0 = Edge(n0, n1, Ed...
from pybbn.graph.edge import Edge, EdgeType from pybbn.graph.node import Node from pybbn.graph.dag import Dag from nose import with_setup def setup(): pass def teardown(): pass @with_setup(setup, teardown) def test_graph_creation(): n0 = Node(0) n1 = Node(1) n2 = Node(2) e0 = Edge(n0, n1, ...
Python
0.000021
3ad6fc495c877d36bb014062094f6e52edf1ac23
allow bps or Bps
i3pystatus/net_speed.py
i3pystatus/net_speed.py
from i3pystatus import IntervalModule import speedtest_cli import requests import time import os from urllib.parse import urlparse import contextlib import sys from io import StringIO class NetSpeed(IntervalModule): """ Attempts to provide an estimation of internet speeds. Requires: speedtest_cli """ ...
from i3pystatus import IntervalModule import speedtest_cli import requests import time import os from urllib.parse import urlparse class NetSpeed(IntervalModule): """ Attempts to provide an estimation of internet speeds. Requires: speedtest_cli """ settings = ( ("url", "Target URL to down...
Python
0
0230de965fbc4247bf1f087f8454d09f30a6b0f3
Fix naming convention of array references
angr/engines/soot/expressions/newArray.py
angr/engines/soot/expressions/newArray.py
from .base import SimSootExpr from ..values import SimSootValue_ArrayRef import logging l = logging.getLogger('angr.engines.soot.expressions.newarray') class SimSootExpr_NewArray(SimSootExpr): def __init__(self, expr, state): super(SimSootExpr_NewArray, self).__init__(expr, state) def _execute(self...
from .base import SimSootExpr from ..values import SimSootValue_ArrayRef import logging l = logging.getLogger('angr.engines.soot.expressions.newarray') class SimSootExpr_NewArray(SimSootExpr): def __init__(self, expr, state): super(SimSootExpr_NewArray, self).__init__(expr, state) def _execute(self...
Python
0.000289