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
bca4bb08fbfffe27214803429ad63f7800f36428
Update demo.py to show different stock codes
demo.py
demo.py
#!/usr/bin/python3 # -*- encoding: utf-8 -*- from indexes import * import global_data def main(stock='000001', date=global_data.NEWEST_TRADE_DATE, p_MA=5, p_MACD=(12,26,9), p_RSI=6, p_KDJ=(9,3), p_MTM=(12,6), p_CCI=14): """ Example stock: str, '000001', date: str, '2017-08-18', ...
#!/usr/bin/python3 # -*- encoding: utf-8 -*- from indexes import * import global_data def main(stock='000001', date=global_data.NEWEST_TRADE_DATE, p_MA=5, p_MACD=(12,26,9), p_RSI=6, p_KDJ=(9,3), p_MTM=(12,6), p_CCI=14): """ Example stock: str, '000001', date: str, '2017-08-18', ...
Python
0
d1ac527fb1d7cefba9b66577d16351950fc09647
Add note about new logging feature in example plugin.
plugins/callbacks/log_plays.py
plugins/callbacks/log_plays.py
# (C) 2012, Michael DeHaan, <michael.dehaan@gmail.com> # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any lat...
# (C) 2012, Michael DeHaan, <michael.dehaan@gmail.com> # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any lat...
Python
0
e169adc40ccdc0ea3821ac9d6603591a6330fe9c
update test_jobs.py for lobster
custodian/lobster/tests/test_jobs.py
custodian/lobster/tests/test_jobs.py
import os import shutil import unittest from monty.os import cd from monty.tempfile import ScratchDir from custodian.lobster.jobs import LobsterJob MODULE_DIR = os.path.dirname(os.path.abspath(__file__)) test_files_lobster2 = os.path.join(MODULE_DIR, "../../../test_files/lobster/lobsterins") test_files_lobs...
import os import shutil import unittest from monty.os import cd from monty.tempfile import ScratchDir from custodian.lobster.jobs import LobsterJob MODULE_DIR = os.path.dirname(os.path.abspath(__file__)) test_files_lobster2 = os.path.join(MODULE_DIR, "../../../test_files/lobster/lobsterins") test_files_lobs...
Python
0.000001
b5c8821026e877e014bd3755af07c4e0213644dd
Add ability to open default settings for viewing
misc.py
misc.py
import sublime_plugin import sublime import webbrowser import os from . import PluginLogger from .lib.sdk import SDK _logger = PluginLogger(__name__) class OpenBrowser(sublime_plugin.WindowCommand): """Opens API reference in default browser. """ def __init__(self, *args, **kwargs): super().__i...
import sublime_plugin import sublime import webbrowser import os from . import PluginLogger from .lib.sdk import SDK _logger = PluginLogger(__name__) class OpenBrowser(sublime_plugin.WindowCommand): """Opens API reference in default browser. """ def __init__(self, *args, **kwargs): super().__i...
Python
0
d99aebe4ded6f8b8663ca32a191c6c39e58b1517
bump version
kuyruk/__init__.py
kuyruk/__init__.py
from __future__ import absolute_import import logging from kuyruk.kuyruk import Kuyruk from kuyruk.worker import Worker from kuyruk.task import Task from kuyruk.config import Config __version__ = '0.14.5' try: # not available in python 2.6 from logging import NullHandler except ImportError: class NullHan...
from __future__ import absolute_import import logging from kuyruk.kuyruk import Kuyruk from kuyruk.worker import Worker from kuyruk.task import Task from kuyruk.config import Config __version__ = '0.14.4' try: # not available in python 2.6 from logging import NullHandler except ImportError: class NullHan...
Python
0
336020466c48538921497a93db2ffa2ab2909eab
Drop prefetch tags in case_list, due not used
poradnia/cases/views/cases.py
poradnia/cases/views/cases.py
from __future__ import absolute_import from django.shortcuts import get_object_or_404, redirect from django.contrib import messages from django.utils.translation import ugettext as _ from django.views.generic import UpdateView, TemplateView from django_filters.views import FilterView from braces.views import UserFormKw...
from __future__ import absolute_import from django.shortcuts import get_object_or_404, redirect from django.contrib import messages from django.utils.translation import ugettext as _ from django.views.generic import UpdateView, TemplateView from django_filters.views import FilterView from braces.views import UserFormKw...
Python
0
8650f7380976671553db28e11ac145ac3b4b9d20
Update production.py
poradnia/config/production.py
poradnia/config/production.py
# -*- coding: utf-8 -*- ''' Production Configurations ''' from .common import * # noqa # SECRET KEY SECRET_KEY = env.str('DJANGO_SECRET_KEY') # END SECRET KEY # SITE CONFIGURATION # Hosts/domain names that are valid for this site # See https://docs.djangoproject.com/en/1.6/ref/settings/#allowed-hosts ALLOWED_HOSTS = ...
# -*- coding: utf-8 -*- ''' Production Configurations ''' from .common import * # noqa # SECRET KEY SECRET_KEY = env.str('DJANGO_SECRET_KEY') # END SECRET KEY # SITE CONFIGURATION # Hosts/domain names that are valid for this site # See https://docs.djangoproject.com/en/1.6/ref/settings/#allowed-hosts ALLOWED_HOSTS = ...
Python
0.000001
a73451272d832ac22e6afcff0bf3fbe416328b65
use correct file?
cicada/publishers.py
cicada/publishers.py
import logging import os import stat import subprocess class PublishArtifact(object): """ Publish console ouput artifct is relative to workspace directory href/linktext is made for future linking """ def __init__(self, artifact, destination, href, linktext): self.artifact = artifact ...
import logging import os import stat import subprocess class PublishArtifact(object): """ Publish console ouput artifct is relative to workspace directory href/linktext is made for future linking """ def __init__(self, artifact, destination, href, linktext): self.artifact = artifact ...
Python
0.000001
eaba29ee7ea2a02eef180531e7efaf4c3cfebf31
Check for subscript like DD1
lcapy/latex.py
lcapy/latex.py
import re sub_super_pattern = re.compile(r"([_\^]){([a-zA-Z]+)([0-9]*)}") class Latex(object): words = ('in', 'out', 'ref', 'rms', 'load', 'source', 'avg', 'mean', 'peak', 'pp', 'min', 'max', 'src', 'cc', 'ee', 'dd', 'ss', 'ih', 'il', 'oh', 'ol') def __init__(self, string): ...
import re sub_super_pattern = re.compile(r"([_\^]){([\w]+)}") class Latex(object): words = ('in', 'out', 'ref', 'rms', 'load', 'source', 'avg', 'mean', 'peak', 'pp', 'min', 'max', 'src', 'cc', 'ee', 'dd', 'ss', 'ih', 'il', 'oh', 'ol') def __init__(self, string): self.str ...
Python
0.000006
9cc013cc0fbff030be386ed3af5f6a826b97ca5f
make the module hook more robust
lib/spack/spack/hooks/module_file_generation.py
lib/spack/spack/hooks/module_file_generation.py
# Copyright 2013-2020 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) import spack.config import spack.modules import spack.modules.common import llnl.util.tty as tty def _for_each_enabled(s...
# Copyright 2013-2020 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) import spack.modules import spack.modules.common import llnl.util.tty as tty try: enabled = spack.config.get('modules...
Python
0.000001
5b1349c5322c47b10fb74efeecaace6ac5d41346
Add logging. (#7)
lambda_function.py
lambda_function.py
import json import logging import requests import uuid PARTICLE_CLOUD_API_ENDPOINT = 'https://api.particle.io' logger = logging.getLogger() logger.setLevel(logging.DEBUG) # Main function entrypoint, handles request routing. def lambda_handler(event, context): logger.info("Recieved event: {}".format(json.dumps(e...
import json import logging import requests import uuid PARTICLE_CLOUD_API_ENDPOINT = 'https://api.particle.io' logger = logging.getLogger() logger.setLevel(logging.DEBUG) # Main function entrypoint, handles request routing. def lambda_handler(event, context): logger.info("Recieved event: {}".format(json.dumps(e...
Python
0
7f77f822dcf05152634cda771cce934320d23ca1
use image data
experiments/01-single-dimer/plot_velocity.py
experiments/01-single-dimer/plot_velocity.py
#!/usr/bin/env python3 import argparse parser = argparse.ArgumentParser() parser.add_argument('file', type=str, help='H5MD datafile') parser.add_argument('--directed', action='store_true') args = parser.parse_args() import numpy as np import h5py import matplotlib.pyplot as plt with h5py.File(args.file, 'r') as f: ...
#!/usr/bin/env python3 import argparse parser = argparse.ArgumentParser() parser.add_argument('file', type=str, help='H5MD datafile') parser.add_argument('--directed', action='store_true') args = parser.parse_args() import numpy as np import h5py import matplotlib.pyplot as plt with h5py.File(args.file, 'r') as f: ...
Python
0.000019
8ac7a7924277ef660df92f5f221dc678e4a14d9c
allow non-cell regions in ConstantFunctionByRegion.get_constants()
sfepy/discrete/functions.py
sfepy/discrete/functions.py
import numpy as nm from sfepy.base.base import assert_, OneTypeList, Container, Struct class Functions(Container): """Container to hold all user-defined functions.""" def from_conf(conf): objs = OneTypeList(Function) for key, fc in conf.iteritems(): fun = Function(name = fc.name, ...
import numpy as nm from sfepy.base.base import assert_, OneTypeList, Container, Struct class Functions(Container): """Container to hold all user-defined functions.""" def from_conf(conf): objs = OneTypeList(Function) for key, fc in conf.iteritems(): fun = Function(name = fc.name, ...
Python
0.000004
02ae6cadac686c9c601bcad42c6b95b8811c3cfb
Add --ip and --port flag to example.
examples/commandline.py
examples/commandline.py
"""commandline. Usage: commandline.py lookup --lang=<lang> --word=<preword> [--ip=<redis-ip>] [--port=<redis-port>] commandline.py -h | --help Options: -h --help Show this screen. --lang=<lang> Language of suggested word. --word=<preword> Pre-word of suggested word. --ip=<rediis-i...
"""commandline. Usage: commandline.py lookup --lang=<lang> --word=<preword> commandline.py -h | --help Options: -h --help Show this screen. --lang=<lang> Language of suggested word. --word=<preword> Pre-word of suggested word. """ import redis import py_word_suggest # from config import REDIS_IP fro...
Python
0
ca1fa126611f958ccd893f034df74e8821f41771
update prototype
hardware/prototype/read_serial.py
hardware/prototype/read_serial.py
__author__ = 'sachinpatney' import serial import time import binascii ser = serial.Serial('/dev/ttyUSB0', baudrate=9600, timeout=1.0) s = b'' def do(cmd): if cmd == 'play': print('Playing music ...') while True: bytesToRead = ser.inWaiting() if bytesToRead > 0: s += ser.rea...
__author__ = 'sachinpatney' import serial import time import binascii ser = serial.Serial('/dev/ttyUSB0', baudrate=9600, timeout=1.0) s = b'' def do(cmd): if cmd == 'play': print('Playing music ...') while True: bytesToRead = ser.inWaiting() if bytesToRead > 0: s += ser.rea...
Python
0
2846b996783b896f69ec0870569c7e442ddcc652
fix imports, arguments
sfepy/terms/terms_fibres.py
sfepy/terms/terms_fibres.py
from sfepy.terms.terms import * from sfepy.terms.terms_base import VectorVector from sfepy.terms.terms_hyperelastic_tl import HyperElasticTLBase from sfepy.homogenization.utils import iter_sym class FibresActiveTLTerm(VectorVector, HyperElasticTLBase): r""":description: Hyperelastic active fibres term. Effective s...
from sfepy.terms.terms import * from sfepy.terms.terms_hyperelastic_tl import HyperElasticTLBase from sfepy.homogenization.utils import iter_sym class FibresActiveTLTerm(HyperElasticTLBase): r""":description: Hyperelastic active fibres term. Effective stress $S_{ij} = A f_{\rm max} \exp{-(\frac{\epsilon - \var...
Python
0.000001
37e549e34a20eb6dd14be305a7efff5d2a7832f5
Create SetupDSRCMigrate Step
dbaas/workflow/steps/util/foreman.py
dbaas/workflow/steps/util/foreman.py
from dbaas_credentials.models import CredentialType from dbaas_foreman import get_foreman_provider from physical.models import Vip from workflow.steps.util.base import VipProviderClient from util import exec_remote_command_host, get_or_none_credentials_for from base import BaseInstanceStep class Foreman(BaseInstance...
from dbaas_credentials.models import CredentialType from dbaas_foreman import get_foreman_provider from physical.models import Vip from workflow.steps.util.base import VipProviderClient from util import exec_remote_command_host, get_or_none_credentials_for from base import BaseInstanceStep class Foreman(BaseInstance...
Python
0
a901ebf403566bdb1ef468b2d528d80f6533ead1
Update dragging example for new plugin architecture
examples/drag_points.py
examples/drag_points.py
""" Draggable Points Example ======================== This example shows how a D3 plugin can be created to make plot elements draggable. A stopPropagation command is used to allow the drag behavior and pan/zoom behavior to work in tandem. """ import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl ...
""" Draggable Points Example ======================== This example shows how a D3 plugin can be created to make plot elements draggable. A stopPropagation command is used to allow the drag behavior and pan/zoom behavior to work in tandem. """ import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl ...
Python
0
207dd3b5f59ecc66c896cc0f3ad90e283fca5145
refactor the registration process
src/app.py
src/app.py
"""The netify application object.""" # Copyright 2015 Curtis Sand # # 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 app...
"""The netify application object.""" # Copyright 2015 Curtis Sand # # 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 app...
Python
0
12720a225210afe73f301c2112f0a7ddcdc41bcb
Fix CSR loading in ACME example client script.
examples/acme_client.py
examples/acme_client.py
"""Example script showing how to use acme client API.""" import logging import os import pkg_resources from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives.asymmetric import rsa import OpenSSL from acme import client from acme import messages from acme import jose logging.bas...
"""Example script showing how to use acme client API.""" import logging import os import pkg_resources from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives.asymmetric import rsa import OpenSSL from acme import client from acme import messages from acme import jose logging.bas...
Python
0
643c8bf95bd5ac0df32eed39beb7124badd723ed
allow extra args in subprocess dispatcher
lib/amqp_service/dispatcher/subprocess_dispatcher.py
lib/amqp_service/dispatcher/subprocess_dispatcher.py
import logging import subprocess from amqp_service.dispatcher import util LOG = logging.getLogger(__name__) class SubprocessDispatcher(object): def launch_job(self, command, arguments=[], wrapper=None, wrapper_arguments=[], environment={}, stdout=None, stderr=None, **kwargs): com...
import logging import subprocess from amqp_service.dispatcher import util LOG = logging.getLogger(__name__) class SubprocessDispatcher(object): def launch_job(self, command, arguments=[], wrapper=None, wrapper_arguments=[], environment={}, stdout=None, stderr=None): command_list ...
Python
0
2dd00f27e0134b04db66a31ef83d34417ce39c46
fix bug where attempted to pickle a placeholder
cleverhans/serial.py
cleverhans/serial.py
"""Serialization functionality. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import joblib import tensorflow as tf from cleverhans.model import Model from cleverhans.utils import safe_zip class PicklableVariable(object): """ A wrapper aro...
"""Serialization functionality. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import joblib import tensorflow as tf from cleverhans.model import Model from cleverhans.utils import safe_zip class PicklableVariable(object): """ A wrapper aro...
Python
0
054dc32d30ca9175a6c8b40af52491b8e3a98978
Debug the URL that's being requested
heufybot/modules/util/webutils.py
heufybot/modules/util/webutils.py
from twisted.plugin import IPlugin from twisted.python import log from heufybot.moduleinterface import BotModule, IBotModule from heufybot.utils.logutils import logExceptionTrace from zope.interface import implements import logging, re, requests class WebUtils(BotModule): implements(IPlugin, IBotModule) name...
from twisted.plugin import IPlugin from heufybot.moduleinterface import BotModule, IBotModule from heufybot.utils.logutils import logExceptionTrace from zope.interface import implements import re, requests class WebUtils(BotModule): implements(IPlugin, IBotModule) name = "WebUtils" canDisable = False ...
Python
0.000001
ab51dd3c6c649e582deeb2309a88738b45bccba8
clean up formatting of logger
src/logger.py
src/logger.py
""" create simple logger class to output results both to text file and display """ import os.path import csv import time class Logger(object): def __init__(self, output_location): self.filename = '__ogp-mdt-log-' + str(time.time()).replace('.', '') + '.csv' self.csvfile = open(os.path.join(output...
""" create simple logger class to output results both to text file and display """ import os.path,csv,time class Logger(object): def __init__(self,OUTPUT_LOCATION): self.filename = '__ogp-mdt-log-' + str(time.time()).replace('.','') + '.csv' self.csvfile = open(os.path.join(OUTPUT_LOCATION, self.fi...
Python
0.99835
ebdb3a510718288f5db14539d7261f10abb59c96
Fix a small typo error in clusterdemo.py (#945)
examples/clusterdemo.py
examples/clusterdemo.py
#!/usr/bin/python "clusterdemo.py: demo of Mininet Cluster Edition prototype" from mininet.examples.cluster import ( MininetCluster, SwitchBinPlacer, RemoteLink ) # ^ Could also use: RemoteSSHLink, RemoteGRELink from mininet.topolib import TreeTopo from mininet.log import setLog...
#!/usr/bin/python "clusterdemo.py: demo of Mininet Cluster Edition prototype" from mininet.examples.cluster import ( MininetCluster, SwitchBinPlacer, RemoteLink ) # ^ Could also use: RemoteSSHLink, RemoteGRELink from mininet.topolib import TreeTopo from mininet.log import setLog...
Python
0.000027
028d4643f728c2618a4660b986694f807a955024
Add some necessary decodes() to neovim_mod
vroom/neovim_mod.py
vroom/neovim_mod.py
from vroom.vim import CONFIGFILE, VimscriptString from vroom.vim import Communicator as VimCommunicator import subprocess import time import neovim import os try: from StringIO import StringIO except ImportError: from io import StringIO class Communicator(VimCommunicator): """Object to communicate with a Neovim ...
from vroom.vim import CONFIGFILE, VimscriptString from vroom.vim import Communicator as VimCommunicator import subprocess import time import neovim import os try: from StringIO import StringIO except ImportError: from io import StringIO class Communicator(VimCommunicator): """Object to communicate with a Neovim ...
Python
0
5dbaf2f519c573dbeb239be0d21282ad432339e8
Fix order in base
project_euler/library/base.py
project_euler/library/base.py
from typing import List def number_to_list(number: int, base: int = 10) -> List[int]: if number < 0: raise ValueError(f'Cannot convert {number} to list, must be positive.') if base <= 0: raise ValueError(f'Cannot convert to base {base}.') digits = [] while number > 0: digits....
from typing import List def number_to_list(number: int, base: int = 10) -> List[int]: if number < 0: raise ValueError(f'Cannot convert {number} to list, must be positive.') if base <= 0: raise ValueError(f'Cannot convert to base {base}.') digits = [] while number > 0: digits....
Python
0.000079
24b868f99d40e5309fc4a8f8e1ca9d9ca00524ea
move init code into its own function
src/app.py
src/app.py
# Copyright 2015 Curtis Sand # # 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, ...
# Copyright 2015 Curtis Sand # # 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, ...
Python
0.000006
e1cb37a061f1522e027004d5ed2aca572223a4a2
Update cooler test utility
test/utils.py
test/utils.py
import h5py import logging logger = logging.getLogger(__name__) def get_cooler_info(file_path): """Get information of a cooler file. Args: file_path (str): Path to a cooler file. Returns: dict: Dictionary containing basic information about the cooler file. """ TILE_SIZE = 256 ...
import h5py import logging logger = logging.getLogger(__name__) def get_cooler_info(file_path): """Get information of a cooler file. Args: file_path (str): Path to a cooler file. Returns: dict: Dictionary containing basic information about the cooler file. """ with h5py.File(fi...
Python
0
173960e50bf4c2b7306b7107aa8f99d60ad385d2
update docstatus of documents if docstatus value is changed in workflow
frappe/workflow/doctype/workflow/workflow.py
frappe/workflow/doctype/workflow/workflow.py
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.model.document import Document from frappe.model import no_value_fields class Workflow(Document): def validate(self): self.set_...
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.model.document import Document from frappe.model import no_value_fields class Workflow(Document): def validate(self): self.set_...
Python
0
2cb9496168766b3985826312298732944df4f018
fix similarity_query_interface documentation
lexos/interfaces/similarity_query_interface.py
lexos/interfaces/similarity_query_interface.py
from flask import request, session, render_template, send_file, Blueprint from lexos.helpers import constants as constants from lexos.managers import utility, session_manager as session_manager from lexos.interfaces.base_interface import detect_active_docs # this is a flask blue print # it helps us to manage groups o...
from flask import request, session, render_template, send_file, Blueprint from lexos.helpers import constants as constants from lexos.managers import utility, session_manager as session_manager from lexos.interfaces.base_interface import detect_active_docs # this is a flask blue print # it helps us to manage groups o...
Python
0.000001
b149d3e2be52a9876815b4599164210f086cf0c0
update TODO objectives
testCaesar.py
testCaesar.py
import unittest import Caesar class TestCryptMethods(unittest.TestCase): """Tests for Caesar.py""" cryptInput = ['encrypt', 'Encrypt', 'decrypt', 'Decrypt', 'blah', 'WHOCARES'] encryptInput = ['foo', 'bar', 'Hello World', 'xyz', '101010111'] decryptInput = ['ktt', 'gfw', 'Mjqqt Btwqi', 'cde', '10101011...
import unittest import Caesar class TestCryptMethods(unittest.TestCase): """Tests for Caesar.py""" cryptInput = ['encrypt', 'Encrypt', 'decrypt', 'Decrypt', 'blah', 'WHOCARES'] encryptInput = ['foo', 'bar', 'Hello World', '342', '101010111'] decryptInput = ['ktt', 'gfw', 'Mjqqt%\twqi', '897', '65656566...
Python
0
cf4debe97d48d42ac28fb8e2d328a8583e81a007
Fix version_info comparison
dev/ci.py
dev/ci.py
# coding: utf-8 from __future__ import unicode_literals, division, absolute_import, print_function import sys from .tests import run as run_tests if sys.version_info >= (2, 7): from .lint import run as run_lint def run(): """ Runs the linter and tests :return: A bool - if the linter and tes...
# coding: utf-8 from __future__ import unicode_literals, division, absolute_import, print_function import sys from .tests import run as run_tests if sys.version_info > (2, 6): from .lint import run as run_lint def run(): """ Runs the linter and tests :return: A bool - if the linter and test...
Python
0
22ae21ab43c1f94807e282b7d50987af13a6a9d6
Exclude ps1 modules from the TestModules unittest
test/units/TestModules.py
test/units/TestModules.py
# -*- coding: utf-8 -*- import os import ast import unittest from ansible import utils class TestModules(unittest.TestCase): def list_all_modules(self): paths = utils.plugins.module_finder._get_paths() paths = [x for x in paths if os.path.isdir(x)] module_list = [] for path in pa...
# -*- coding: utf-8 -*- import os import ast import unittest from ansible import utils class TestModules(unittest.TestCase): def list_all_modules(self): paths = utils.plugins.module_finder._get_paths() paths = [x for x in paths if os.path.isdir(x)] module_list = [] for path in pa...
Python
0
a63746951ee802c5082c34c5c16afe3cbcd8ede4
fix last flake8 error
doc/source/conf.py
doc/source/conf.py
# -*- coding: utf-8 -*- # # SimPhoNy-Mayavi documentation build configuration file # import sys def mock_modules(): MOCK_MODULES = [] MOCK_TYPES = [] try: import paraview # noqa except ImportError: MOCK_MODULES.extend(( 'paraview', 'paraview.simple', ...
# -*- coding: utf-8 -*- # # SimPhoNy-Mayavi documentation build configuration file # import sys def mock_modules(): MOCK_MODULES = [] MOCK_TYPES = [] try: import paraview # noqa except ImportError: MOCK_MODULES.extend(( 'paraview', 'paraview.simple', ...
Python
0.000001
7f00ff930b70b9c0ca00874d00704cdf540e3939
correct errors
serial_test.py
serial_test.py
import datetime import sys import pigpio import time import math time_record = int(time.time() * 1000) time_limit = 50 pi = pigpio.pi() sensor_message_size = 7 sensor_signal_pin = 4 dead_pin = 17 pi.set_mode(sensor_signal_pin, pigpio.OUTPUT) h1 = pi.serial_open("/dev/ttyAMA0", 9600) pi.serial_write_byte(h1, 10 * 2) pi...
import datetime import sys import pigpio import time import math time_record = int(time.time() * 1000) time_limit = 50 pi = pigpio.pi() sensor_message_size = 7 sensor_signal_pin = 4 dead_pin = 17 pi.set_mode(sensor_signal_pin, pigpio.OUTPUT) h1 = pi.serial_open("/dev/ttyAMA0", 9600) pi.serial_write_byte(h1, 10 * 2) pi...
Python
0.999897
de039312bc8b356eb1a75f797c2be4d02643f3f2
Append "/" to get_step_path_prefix
simpleflow/step/workflow.py
simpleflow/step/workflow.py
import os import copy from collections import defaultdict from .constants import STEP_ACTIVITY_PARAMS_DEFAULT from .submittable import Step from .tasks import GetStepsDoneTask from simpleflow import activity, settings, task class WorkflowStepMixin(object): def get_step_bucket(self): """ Return t...
import os import copy from collections import defaultdict from .constants import STEP_ACTIVITY_PARAMS_DEFAULT from .submittable import Step from .tasks import GetStepsDoneTask from simpleflow import activity, settings, task class WorkflowStepMixin(object): def get_step_bucket(self): """ Return t...
Python
0.000001
4de07bc77efd617acd7629d8c636bb6515d2527e
Allow skipping in retrieval
mangaki/mangaki/management/commands/retrieve.py
mangaki/mangaki/management/commands/retrieve.py
from django.core.management.base import BaseCommand, CommandError from mangaki.utils.anidb import AniDB from mangaki.models import Anime, Artist import sys def get_or_create_artist(name): if ' ' in name: last, first = name.split() else: last, first = name, '' try: if Artist.objects....
from django.core.management.base import BaseCommand, CommandError from mangaki.utils.anidb import AniDB from mangaki.models import Anime, Artist def get_or_create_artist(name): last, first = name.split() try: if Artist.objects.filter(first_name=first, last_name=last).count(): contestants = ...
Python
0.000002
dba06078985716bda0a0d3a6ab26d0fad73b4c73
add a flags parameter to test() to allow passing in during interactive sessions
lib/neuroimaging/algorithms/statistics/__init__.py
lib/neuroimaging/algorithms/statistics/__init__.py
""" TODO """ __docformat__ = 'restructuredtext' def test(level=1, verbosity=1, flags=[]): from neuroimaging.utils.test_decorators import set_flags set_flags(flags) from numpy.testing import NumpyTest return NumpyTest().test(level, verbosity)
""" TODO """ __docformat__ = 'restructuredtext' def test(level=1, verbosity=1): from numpy.testing import NumpyTest return NumpyTest().test(level, verbosity)
Python
0
1c9f12f808ffa0f1d4f16ea9f35021a83126243f
Update test Solr download script to work with default Python 3
get-solr-download-url.py
get-solr-download-url.py
#!/usr/bin/env python # encoding: utf-8 from __future__ import absolute_import, print_function, unicode_literals import sys import requests # Try to import urljoin from the Python 3 reorganized stdlib first: try: from urllib.parse import urljoin except ImportError: from urlparse import urljoin if len(sys....
#!/usr/bin/env python # encoding: utf-8 from __future__ import absolute_import, print_function, unicode_literals import sys import requests # Try to import urljoin from the Python 3 reorganized stdlib first: try: from urlparse.parse import urljoin except ImportError: from urlparse import urljoin if len(sy...
Python
0
f9b7fa7fd7a75c5fb85fae545ed05080a162e967
Add sphinx markup to test_input.py
test_input.py
test_input.py
import pandas as pd import numpy as np from read_file import input_dataframe # requires test .csv file containing 2 columns w/ 1 row string header and all below rows float/int def test_ecg_dataframe_size(): """.. function:: test_ecg_dataframe_size() Test size of dataframe. """ ecg_dataframe = input...
import pandas as pd import numpy as np from read_file import input_dataframe # requires test .csv file containing 2 columns w/ 1 row string header and all below rows float/int def test_ecg_dataframe_size(): ecg_dataframe = input_dataframe("testfile1.csv") assert ecg_dataframe.shape[1] == 2 def test_ecg_dat...
Python
0.000004
f0acf7fe8255e376ec602117709789cba4df5ea9
add sample data to pconf
examples/simple_test.py
examples/simple_test.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # pylint: disable=line-too-long # # Georges Toth (c) 2013-2014 <georges@trypill.org> # GOVCERT.LU (c) 2013-2017 <info@govcert.etat.lu> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # pylint: disable=line-too-long # # Georges Toth (c) 2013-2014 <georges@trypill.org> # GOVCERT.LU (c) 2013-2017 <info@govcert.etat.lu> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as...
Python
0
5b626f65e3926ac34b579978303eb061fa33a09c
Change features widget to be a multiple checkbox.
us_ignite/apps/forms.py
us_ignite/apps/forms.py
from django import forms from django.contrib.auth.models import User from django.core.validators import validate_email from django.forms.models import inlineformset_factory from us_ignite.apps.models import (Application, ApplicationURL, ApplicationImage) def _get_status_choices(): ...
from django import forms from django.contrib.auth.models import User from django.core.validators import validate_email from django.forms.models import inlineformset_factory from us_ignite.apps.models import (Application, ApplicationURL, ApplicationImage) def _get_status_choices(): ...
Python
0
6143888a2fa396b868ed44c3ceab765a95abea45
Check function must always use all parameters.
tests/constraint_tests.py
tests/constraint_tests.py
from unittest import TestCase from skypyblue.core import ConstraintSystem from skypyblue.models import Method, Constraint, Strength try: from unittest.mock import MagicMock as Mock except ImportError as e: from mock import Mock class ConstraintTests(TestCase): def setUp(self): self.cs = ConstraintSystem() ...
from unittest import TestCase from skypyblue.core import ConstraintSystem from skypyblue.models import Method, Constraint, Strength try: from unittest.mock import MagicMock as Mock except ImportError as e: from mock import Mock class ConstraintTests(TestCase): def setUp(self): self.cs = ConstraintSystem() ...
Python
0
f52a19fe28fa84b3d83ab20998fd678c795490dc
Remove generated code
lexgen/__init__.py
lexgen/__init__.py
__author__ = 'David'
Python
0.000001
1aec0b6e6e8ada20d49e09b679406c9ad4e0f8c0
Fix /users/me API test (no redirect)
users/tests/test_api.py
users/tests/test_api.py
from django.core.urlresolvers import reverse from rest_framework import status from rest_framework.test import APITestCase from ..models import User class UserTest(APITestCase): """Tests for /users/ API endpoints.""" def test_view_user_logged_out(self): user = User.objects.create(name="Trey", email...
from django.core.urlresolvers import reverse from rest_framework import status from rest_framework.test import APITestCase from ..models import User class UserTest(APITestCase): """Tests for /users/ API endpoints.""" def test_view_user_logged_out(self): user = User.objects.create(name="Trey", email...
Python
0
e21056572381b92926b4fa8c7d347a0e129a6471
Fix OSError in functional test due to incomplete teardown condition
tests/functional_tests.py
tests/functional_tests.py
#!/usr/bin/env python from __future__ import absolute_import, print_function import os import subprocess from os.path import dirname, abspath from time import time, sleep from re import match from unittest import TestCase, main, skip try: from StringIO import StringIO except ImportError: from io import String...
#!/usr/bin/env python from __future__ import absolute_import, print_function import os import subprocess from os.path import dirname, abspath from time import time, sleep from re import match from unittest import TestCase, main, skip try: from StringIO import StringIO except ImportError: from io import String...
Python
0
aff805625f465421277447e5bd2a53a552dd175f
Fix assertion and error
exp/util/MCEvaluator.py
exp/util/MCEvaluator.py
import numpy import numpy.testing as nptst class MCEvaluator(object): """ A class to evaluate machine learning performance for the matrix completion problem. """ def __init__(self): pass @staticmethod def meanSqError(testX, predX): """ Find the mean squared ...
import numpy import numpy.testing as nptst class MCEvaluator(object): """ A class to evaluate machine learning performance for the matrix completion problem. """ def __init__(self): pass @staticmethod def meanSqError(testX, predX): """ Find the mean squared ...
Python
0.000012
b7256a0696331b5b0889708449ebb93ef90fab4a
add language and save function.
git-ignore.py
git-ignore.py
#! /usr/bin/env python2 # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Copyright © 2014 Ciel <imwithye@gmail.com> # # Distributed under terms of the MIT license. import sys def language(languages): print languages def save(filename): print filename # print usage def usage(): print "usage: git ignore <subcommand>" ...
#! /usr/bin/env python2 # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Copyright © 2014 Ciel <imwithye@gmail.com> # # Distributed under terms of the MIT license. import sys # print version def version(): print "git ignore, version 0.1." print print "http://github.com/imwithye/git-ignore" print "git ignore, copyrigh...
Python
0
b6ab29eed44fa0b63043d1481d835a1b25418a22
Remove unused code
tests/http/test_router.py
tests/http/test_router.py
from __future__ import unicode_literals import unittest import mock from mopidy import http class TestRouter(http.Router): name = 'test' class TestRouterMissingName(http.Router): pass class HttpRouterTest(unittest.TestCase): def setUp(self): self.config = { 'http': { ...
from __future__ import unicode_literals import os import unittest import mock from mopidy import http class TestRouter(http.Router): name = 'test' static_file_path = os.path.join(os.path.dirname(__file__), 'static') class TestRouterMissingName(http.Router): pass class HttpRouterTest(unittest.TestCa...
Python
0
29b8b8b7415431547e85564aa7b426e244542b85
Insert comment about rigs for future reference
ext/killmails/poster.py
ext/killmails/poster.py
import typing import tinydb from discord.ext import commands from utils.esicog import EsiCog from utils.log import get_logger ESI_SWAGGER_JSON = 'https://esi.evetech.net/latest/swagger.json' def setup(bot: commands.Bot): bot.add_cog(KillmailPoster(bot)) class KillmailPoster(EsiCog): def __init__(self, bo...
import typing import tinydb from discord.ext import commands from utils.esicog import EsiCog from utils.log import get_logger ESI_SWAGGER_JSON = 'https://esi.evetech.net/latest/swagger.json' def setup(bot: commands.Bot): bot.add_cog(KillmailPoster(bot)) class KillmailPoster(EsiCog): def __init__(self, bo...
Python
0
094ff00f180926d44e2102f119beb33354fc7122
Remove unused import
tests/base.py
tests/base.py
import logging import os import shutil from tvrenamr.config import Config from tvrenamr.main import File, TvRenamr logging.disable(logging.CRITICAL) class BaseTest(object): def setup(self): # absolute path to the file is pretty useful self.path = os.path.abspath(os.path.dirname(__file__)) ...
import logging import os import shutil from tvrenamr.config import Config from tvrenamr.main import File, TvRenamr from . import mock_requests # noqa logging.disable(logging.CRITICAL) class BaseTest(object): def setup(self): # absolute path to the file is pretty useful self.path = os.path.abs...
Python
0.000001
0c0a1d0ec480c7df9dd8821d40af7791e46db453
Fix for wrong test: create_semester_accounts
tests/lib/test_finance.py
tests/lib/test_finance.py
# Copyright (c) 2013 The Pycroft Authors. See the AUTHORS file. # This file is part of the Pycroft project and licensed under the terms of # the Apache License, Version 2.0. See the LICENSE file for details. from tests import OldPythonTestCase __author__ = 'felix_kluge' from pycroft.lib.finance import create_semester...
# Copyright (c) 2013 The Pycroft Authors. See the AUTHORS file. # This file is part of the Pycroft project and licensed under the terms of # the Apache License, Version 2.0. See the LICENSE file for details. from tests import OldPythonTestCase __author__ = 'felix_kluge' from pycroft.lib.finance import create_semester...
Python
0.000161
38de328a3899b96542f702a51eb180efb47a5556
Fix town regroup bugs
geodjangofla/management/commands/fixtowns.py
geodjangofla/management/commands/fixtowns.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # This code is free software; you can redistribute it and/or modify it # under the terms of the BSD License (see the file COPYING included with # the distribution). import os from optparse import make_option from django.contrib.gis.geos import GEOSGeometry from django.co...
#!/usr/bin/env python # -*- coding: utf-8 -*- # This code is free software; you can redistribute it and/or modify it # under the terms of the BSD License (see the file COPYING included with # the distribution). import os from optparse import make_option from django.contrib.gis.geos import GEOSGeometry from django.co...
Python
0.000003
928a428a79e574edc9e00416335eccba139dffdd
change csv lists to python sets
nn27.py
nn27.py
''' nn27.py - create nearest neighbor sets for the 27 prostate regions ''' __author__ = 'Mark L. Palmeri' __email__ = 'mlp6@duke.edu' __date__ = '2014-01-05' r1p = set(['2p', '2a', '1a', '7p', '7a', '3p']) r2p = set(['1p', '1a', '2a', '4p']) r3p = set(['4p', '3a', '9p', '5p', '1p']) r4p = set(['4a', '3p', '3a', '2p',...
1p,2p,2a,1a,7p,7a,3p 2p,1p,1a,2a,4p 3p,4p,3a,9p,5p,1p, 4p,4a,3p,3a,2p,6p, 5p,6p,11p,5a,15as,3p,6p 6p,5p,6a,5a,4p,, 7p,1p,8p,7a,8a,1a,9p 8p,7p,8a,10p,7a, 9p,10p,3p,9a,7a,11p, 10p,9p,10a,9a,8p,12p, 11p,12p,5p,11a,15as,12a,9p 12p,11p,12a,11a,10p, 1a,13as,2a,7a,3a, 2a,1a,13as,2p,4a, 3a,5a,4p,3p,14as,5a,1p 4a,3a,14as,4p,2a,...
Python
0.000012
76ebb0c53db5a466e7d8d0ae5a5039b854dededb
Add crunchbang.
dev/tabumemex.py
dev/tabumemex.py
#!/usr/bin/env python2 # Data: # DataStructure = {'size', 'pos'} # MemoryBank = {'capacity', 'pos'} # Conflict = {'cost', 'state', 'a', 'b'} # X = [[]] import random import sys import memproblem from greedyMemex import greedymemex from randommemex import randommemex def initialmemex(p ,A ): """Decides on an init...
# Data: # DataStructure = {'size', 'pos'} # MemoryBank = {'capacity', 'pos'} # Conflict = {'cost', 'state', 'a', 'b'} # X = [[]] import random import sys import memproblem from greedyMemex import greedymemex from randommemex import randommemex def initialmemex(p ,A ): """Decides on an initial solution for the ta...
Python
0.000002
bd8de499bbc8ec4b987c241f6b0fbd12ebf16818
Adapt the import
app/tests/euid/test_kvm_player.py
app/tests/euid/test_kvm_player.py
import unittest import os import sys try: import kvm_player except ImportError: sys.path.append(os.path.dirname(os.path.abspath(__file__))) import kvm_player @unittest.skipIf(os.geteuid() != 0 or kvm_player.virt_install != 0, "TestKVMDiscovery need privilege and virt-install") class Test...
import unittest import os import kvm_player @unittest.skipIf(os.geteuid() != 0 or kvm_player.virt_install != 0, "TestKVMDiscovery need privilege and virt-install") class TestKernelVirtualMachinePlayer(kvm_player.KernelVirtualMachinePlayer): @classmethod def setUpClass(cls): cls.check...
Python
0.998929
211aff9fd57775a87409e1eab50f8803a9efe9f7
add imports for chart and effects
gimp_be/draw/__init__.py
gimp_be/draw/__init__.py
from gimp_be.draw.draw import * from gimp_be.draw.tree import * from gimp_be.draw.polygon import * from gimp_be.draw.effects import * from gimp_be.draw.chart import *
from gimp_be.draw.draw import * from gimp_be.draw.tree import * from gimp_be.draw.polygon import *
Python
0
d362d3770b999293db854a08e9627cfb96557544
disable pagination
api/__init__.py
api/__init__.py
import os, bcrypt from eve import Eve from flask.ext.bootstrap import Bootstrap from eve_docs import eve_docs from eve.auth import BasicAuth class BCryptAuth(BasicAuth): def check_auth(self, username, password, allowed_roles, resource, method): accounts = app.data.driver.db['accounts'] account = accounts.fin...
import os, bcrypt from eve import Eve from flask.ext.bootstrap import Bootstrap from eve_docs import eve_docs from eve.auth import BasicAuth class BCryptAuth(BasicAuth): def check_auth(self, username, password, allowed_roles, resource, method): accounts = app.data.driver.db['accounts'] account = accounts.fin...
Python
0.000002
248ad807e98aa379f24cb41b6fcf0af753c4f169
Test _assert_eq_nan with scalars and 0-D arrays
tests/test__test_utils.py
tests/test__test_utils.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import pytest import numpy as np import dask.array as da import dask_ndmeasure._test_utils nan = np.nan @pytest.mark.parametrize("match, a, b", [ [True] + 2 * [np.array(2)[()]], [True] + 2 * [np.array(nan)[()]], [True] + 2 * [np.array(2)], [True] + ...
#!/usr/bin/env python # -*- coding: utf-8 -*- import pytest import numpy as np import dask.array as da import dask_ndmeasure._test_utils nan = np.nan @pytest.mark.parametrize("match, a, b", [ [True] + 2 * [np.random.randint(10, size=(15, 16))], [True] + 2 * [da.random.randint(10, size=(15, 16), chunks=...
Python
0
8533400ecf69aac64c6210cb9fca1dfe90d0e6b7
work around hanging issue on Windows (#27)
tests/test_code_format.py
tests/test_code_format.py
import os import sys import subprocess def test_flake8(): """Test source code for pyFlakes and PEP8 conformance""" this_dir = os.path.dirname(os.path.abspath(__file__)) source_dir = os.path.join(this_dir, '..', 'osrf_pycommon') cmd = ['flake8', source_dir, '--count'] # work around for https://gitl...
import os import sys import subprocess def test_flake8(): """Test source code for pyFlakes and PEP8 conformance""" this_dir = os.path.dirname(os.path.abspath(__file__)) source_dir = os.path.join(this_dir, '..', 'osrf_pycommon') cmd = ['flake8', source_dir, '--count'] if sys.version_info < (3,4): ...
Python
0
63483418d2169cde88649a29754846d30c6cb5c4
Improve fuel.downloaders.basic unit tests
tests/test_downloaders.py
tests/test_downloaders.py
import hashlib import os from fuel.downloaders.base import download, default_manager iris_url = ('https://archive.ics.uci.edu/ml/machine-learning-databases/' + 'iris/iris.data') iris_hash = "6f608b71a7317216319b4d27b4d9bc84e6abd734eda7872b71a458569e2656c0" def test_download_no_path(): download(iris_...
import os from fuel.downloaders.base import download, default_manager iris_url = ('https://archive.ics.uci.edu/ml/machine-learning-databases/' + 'iris/iris.data') iris_first_line = '5.1,3.5,1.4,0.2,Iris-setosa\n' def test_download_no_path(): download(iris_url) with open('iris.data') as f: ...
Python
0
169a8612eb06410a5ae7e110227f7bea010d2ba9
Make stdout and stderr into strings.
tests/test_ghostscript.py
tests/test_ghostscript.py
import subprocess import unittest class GhostscriptTest(unittest.TestCase): def test_installed(self): process = subprocess.Popen( ['gs', '--version'], stdin=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) stdout, stderr = process.com...
import subprocess import unittest class GhostscriptTest(unittest.TestCase): def test_installed(self): process = subprocess.Popen( ['gs', '--version'], stdin=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) stdout, stderr = process.com...
Python
0.000493
ba37080645153d66a8ae1c8df10312806999f8ec
Add use of fmisid to tests.
tests/test_observation.py
tests/test_observation.py
import unittest from datetime import datetime from dateutil.tz import tzutc from fmi import FMI class TestObservations(unittest.TestCase): def test_lappeenranta(self): now = datetime.now(tz=tzutc()) f = FMI(place='Lappeenranta') for point in f.observations(): assert point.time...
import unittest from datetime import datetime from dateutil.tz import tzutc from fmi import FMI class TestObservations(unittest.TestCase): def test_lappeenranta(self): now = datetime.now(tz=tzutc()) f = FMI(place='Lappeenranta') for point in f.observations(): assert point.time...
Python
0
94f6fcc00ed8f6b1f920bfc8242b9efd34f42fa9
test get_regional_indicator_emoji on april fools
tests/test_reactor_bot.py
tests/test_reactor_bot.py
#!/usr/bin/env python3 import reactor_bot import datetime from freezegun import freeze_time class TestReactorBot: def test_extract_emoji(self): lines_and_emojis = { ' M)-ystery meat': 'M', '🐕 dog sandwiches': '🐕', '3 blind mice': '3', '🇺🇸 flags': '🇺🇸', '<:python3:232720527448342530> python3!...
#!/usr/bin/env python3 import reactor_bot import datetime from freezegun import freeze_time class TestReactorBot: def test_extract_emoji(self): lines_and_emojis = { ' M)-ystery meat': 'M', '🐕 dog sandwiches': '🐕', '3 blind mice': '3', '🇺🇸 flags': '🇺🇸', '<:python3:232720527448342530> python3!...
Python
0.000002
9369f72c4fe9a544e24f10a1db976589dc013424
Add dependency on apache module
plinth/modules/sso/__init__.py
plinth/modules/sso/__init__.py
# # This file is part of Plinth. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distribute...
# # This file is part of Plinth. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distribute...
Python
0
3de616fa0bfc8e075e4c7aa4a5e8e9108e168f7c
fix bugs
plstackapi/planetstack/urls.py
plstackapi/planetstack/urls.py
from django.conf.urls import patterns, include, url # Uncomment the next two lines to enable the admin: from django.contrib import admin from plstackapi.planetstack.views.roles import RoleListCreate, RoleRetrieveUpdateDestroy from plstackapi.planetstack.views.sites import SiteListCreate, SiteRetrieveUpdateDestroy from...
from django.conf.urls import patterns, include, url # Uncomment the next two lines to enable the admin: from django.contrib import admin from plstackapi.planetstack.views.roles import RoleListCreate, RoleRetrieveUpdateDestroy from plstackapi.planetstack.views.roles import SiteListCreate, SiteRetrieveUpdateDestroy from...
Python
0.000001
99cbe9fc333525608842be098c87f842ac9e8906
Remove extra import
api/database.py
api/database.py
from pymongo import MongoClient from gridfs import GridFS from bson.objectid import ObjectId from datetime import datetime from os import environ from const import RequestType class MongoConnection(object): def __init__(self, db=None): if db: self.db = db else: self.db = sel...
from pymongo import MongoClient from gridfs import GridFS from bson.objectid import ObjectId from datetime import datetime from os import environ from const import RequestType from flask import current_app class MongoConnection(object): def __init__(self, db=None): if db: self.db = db ...
Python
0.000001
6e87102251f6448ffa7b9c662ace3b50b00b69b2
Test for git config.
apgl/data/ExamplesGenerator.py
apgl/data/ExamplesGenerator.py
''' A simple class which can be used to generate test sets of examples. ''' #import numpy import numpy.random class ExamplesGenerator(): def __init__(self): pass def generateBinaryExamples(self, numExamples=100, numFeatures=10, noise=0.4): """ Generate a certain nu...
''' A simple class which can be used to generate test sets of examples. ''' #import numpy import numpy.random class ExamplesGenerator(): def __init__(self): pass def generateBinaryExamples(self, numExamples=100, numFeatures=10, noise=0.4): """ Generate a certain nu...
Python
0
25870e710ca51a6fe373677f2d2889a0df3641ca
Revert "test commit heroku"
farmsList/public/api.py
farmsList/public/api.py
import jsonpickle from flask import Blueprint from farmsList.public.models import Parcel blueprint = Blueprint('api', __name__, url_prefix='/api', static_folder="../static") @blueprint.route("/parcel/", methods=["GET", "POST"]) def api_parcel(): parcelData = Parcel.query.filter(Parcel.listedToPublic == True)....
import jsonpickle from flask import Blueprint from farmsList.public.models import Parcel blueprint = Blueprint('api', __name__, url_prefix='/api', static_folder="../static") @blueprint.route("/parcel/", methods=["GET", "POST"]) def api_parcel(): print "HELLO" parcelData = Parcel.query.filter(Parcel.listedToP...
Python
0
145b25626dd018c4dd8b86e17361b9e4eeb935ea
Add some more comments to filter file.
filter_nsized_groups.py
filter_nsized_groups.py
#!/usr/bin/python import struct import sys # filter_nsized_groups: Given a CSV file of (user, group) pairs, each indicating # that user USER belongs to group GROUP, do two things: # # 1. Remove all groups with a size that fall under a threshold, specified in # arguments passed to the file (defaults to 1). # # 2. W...
#!/usr/bin/python import struct import sys def parse_arguments(): options = {} for arg in sys.argv[1:]: if arg == "--help": print "usage: ./filter_nsized_causes.py --outfile=OUTPUT [--n=N] [--infile=INPUT]" print "" print "n: threshold of group size to include in output file. (default = 1)" ...
Python
0
57c0668b9dd11845fb2d845ecbcb0a8aae19eb9c
Add default params to template
exercises/scale-generator/scale_generator.py
exercises/scale-generator/scale_generator.py
class Scale(object): def __init__(self, tonic, scale_name, pattern=None): pass
class Scale(object): def __init__(self): pass
Python
0
321e285f853280204371a882808c116e59892e27
Make wording of message describing not passing filter more clear
extraction/runnables.py
extraction/runnables.py
import collections import sys import traceback class Runnable(object): # runnable properties result_file_name = None dependencies = frozenset() def __init__(self): pass def check_dep_errors(self, dep_results): deps = self.__class__.dependencies filter_deps = [e for e in deps if issu...
import collections import sys import traceback class Runnable(object): # runnable properties result_file_name = None dependencies = frozenset() def __init__(self): pass def check_dep_errors(self, dep_results): deps = self.__class__.dependencies filter_deps = [e for e in deps if issu...
Python
0.000671
2b3431f302cf08d3892eb613079df905ba1f68cb
Add tests to check content page rendering
src/core/tests.py
src/core/tests.py
import os import pytest from django.test import override_settings from django.utils.translation import activate from core.utils import collect_language_codes def test_locale_fallback_middleware(client, settings): response = client.get('/en/', follow=True) assert response.redirect_chain == [('/en-us/', 302)...
import pytest from django.test import override_settings from core.utils import collect_language_codes def test_locale_fallback_middleware(client, settings): response = client.get('/en/', follow=True) assert response.redirect_chain == [('/en-us/', 302)] @override_settings(USE_I18N=False) def test_locale_fa...
Python
0
ee98b5a5c6b82671738bc60e68ea87d838c5400f
Improve the migration for unique data source name
migrations/0020_change_ds_name_to_non_uniqe.py
migrations/0020_change_ds_name_to_non_uniqe.py
from redash.models import db import peewee from playhouse.migrate import PostgresqlMigrator, migrate if __name__ == '__main__': migrator = PostgresqlMigrator(db.database) with db.database.transaction(): # Change the uniqueness constraint on data source name to be (org, name): # In some cases i...
from redash.models import db import peewee from playhouse.migrate import PostgresqlMigrator, migrate if __name__ == '__main__': migrator = PostgresqlMigrator(db.database) with db.database.transaction(): # Change the uniqueness constraint on data source name to be (org, name): success = False ...
Python
0.000017
791546d9fa1fc0317dc613e0ba7e74ca1cbf8210
Update __init__.py
flask_admin/__init__.py
flask_admin/__init__.py
__version__ = '1.4.2' __author__ = 'Flask-Admin team' __email__ = 'serge.koval+github@gmail.com' from .base import expose, expose_plugview, Admin, BaseView, AdminIndexView
__version__ = '1.4.1' __author__ = 'Flask-Admin team' __email__ = 'serge.koval+github@gmail.com' from .base import expose, expose_plugview, Admin, BaseView, AdminIndexView
Python
0.000072
558085de2a32ef14d7b9ef2884f34699b7f7c39b
Update test.py
tests/test.py
tests/test.py
import sys sys.path.append('..') from nose.tools import with_setup from MyModule import MyModule count = 0 def setup_module(): print('<<<Setup Module>>>') def teardown_module(): print('<<<Teardown Module>>>') def setup_function(): print('<<<Setup Function>>>') global count count = 1 def teard...
from nose.tools import with_setup from ..MyModule import MyModule count = 0 def setup_module(): print('<<<Setup Module>>>') def teardown_module(): print('<<<Teardown Module>>>') def setup_function(): print('<<<Setup Function>>>') global count count = 1 def teardown_function(): print('<<<Te...
Python
0.000001
53d75c14d79b92ad1fdf9c99b0773db6427d4294
update to reveal.js 3.2.0
flask_reveal/tools/commands/installreveal.py
flask_reveal/tools/commands/installreveal.py
# -*- coding: utf-8 -*- import argparse import os from urllib import request import flask_reveal from flask_reveal.tools.helpers import extract_file, move_and_replace class InstallReveal(argparse.ArgumentParser): info = ({ 'prog': 'installreveal', 'description': 'installs Reveal.js', }) ...
# -*- coding: utf-8 -*- import argparse import os from urllib import request import flask_reveal from flask_reveal.tools.helpers import extract_file, move_and_replace class InstallReveal(argparse.ArgumentParser): info = ({ 'prog': 'installreveal', 'description': 'installs Reveal.js', }) ...
Python
0
b663fd1a42506eeddc6c86a72f6833d737c7e135
fix logger
keystone_spassword/contrib/spassword/mailer.py
keystone_spassword/contrib/spassword/mailer.py
# # Copyright 2015 Telefonica Investigacion y Desarrollo, S.A.U # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you unde...
# # Copyright 2015 Telefonica Investigacion y Desarrollo, S.A.U # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you unde...
Python
0.000005
623d49f79dcc1986c224f2fdfdfdd825e923c53f
Add treeview
python/regvar/webapps/alignments/application.py
python/regvar/webapps/alignments/application.py
import bx.align.maf import cStringIO import os import io import ete2 from flask import Flask, request, send_file ENVSETTINGSVAR = 'ALIGNMENTS_SETTINGS' app = Flask(__name__) # # Change this to ProductionConfig when finished app.config.from_object('regvar.webapps.alignments.DevelopmentConfig') if ENVSETTINGSVAR in os.e...
import bx.align.maf import cStringIO import os from flask import Flask, request ENVSETTINGSVAR = 'ALIGNMENTS_SETTINGS' app = Flask(__name__) # # Change this to ProductionConfig when finished app.config.from_object('regvar.webapps.alignments.DevelopmentConfig') if ENVSETTINGSVAR in os.environ: app.config.from_envva...
Python
0
d060a9ad8483b86c1417ac4e439b90d2a35c6f2f
Fix management command for Django 1.11.
kitsune/sumo/management/commands/extract_db.py
kitsune/sumo/management/commands/extract_db.py
import os from django.conf import settings from django.core.management.base import BaseCommand, CommandError from django.apps import apps HEADER = """\ ####################################################################### # # Note: This file is a generated file--do not edit it directly! # Instead make changes to t...
import os from django.conf import settings from django.core.management.base import BaseCommand, CommandError from django.db.models.loading import get_model HEADER = """\ ####################################################################### # # Note: This file is a generated file--do not edit it directly! # Instead...
Python
0
a7db7bdb277eed65c93fbc9f5e9e923487711071
Update file_system_storage.py
image_diet/file_system_storage.py
image_diet/file_system_storage.py
import os from image_diet import settings from django.conf import settings as main_settings from django.contrib.staticfiles.storage import StaticFilesStorage class ImageDietFileSystemStorage(StaticFilesStorage): def post_process(self, files, *args, **kwargs): results = [] print 'test' pri...
import os from image_diet import settings from django.conf import settings as main_settings from django.contrib.staticfiles.storage import StaticFilesStorage class ImageDietFileSystemStorage(StaticFilesStorage): def post_process(self, files, *args, **kwargs): results = [] print settings d...
Python
0.000002
9c3b3cb541e8d42d1206fabae83fbef4a249f3ec
bump version
backslash/__version__.py
backslash/__version__.py
__version__ = "2.4.0"
__version__ = "2.3.1"
Python
0
d9b3d2c9178485aeec2c28f11d0032f39d5c67eb
Update list of exceptions
apns2/errors.py
apns2/errors.py
class APNsException(Exception): pass class ConnectionFailed(APNsException): """There was an error connecting to APNs.""" class InternalException(APNsException): """This exception should not be raised. If it is, please report this as a bug.""" pass class BadPayloadException(APNsException): """S...
class APNsException(Exception): pass class InternalException(APNsException): """This exception should not be raised. If it is, please report this as a bug.""" pass class BadPayloadException(APNsException): """Something bad with the payload.""" pass class PayloadEmpty(BadPayloadException): ...
Python
0
4547f0f95f04254a76d5d09d68899891892a9374
Support of new oauth API
bakery/settings/views.py
bakery/settings/views.py
# -*- coding: utf-8 -*- import datetime import logging from flask import Blueprint, render_template, request, flash, g, redirect, url_for, session from ..extensions import github, db from ..decorators import login_required from .models import ProjectCache from ..project.models import Project settings = Blueprint('set...
# -*- coding: utf-8 -*- import datetime from flask import Blueprint, render_template, request, flash, g, redirect, url_for from ..extensions import github, db from ..decorators import login_required from .models import ProjectCache from ..project.models import Project settings = Blueprint('settings', __name__, url_pr...
Python
0
9834fab5a7e061f0eb1cb7b737cec8d2b23b4c7c
Declare numpydoc template in setup_package.py
astropy_helpers/extern/setup_package.py
astropy_helpers/extern/setup_package.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst def get_package_data(): return {'astropy_helpers.extern': ['automodapi/templates/*/*.rst', 'numpydoc/templates/*.rst']}
# Licensed under a 3-clause BSD style license - see LICENSE.rst def get_package_data(): return {'astropy_helpers.extern': ['automodapi/templates/*/*.rst']}
Python
0.000001
65636f9545018b887f7a8aa6c063de63570119c9
Load DOS briefs_search_filters separately
app/__init__.py
app/__init__.py
from flask import Flask, request, redirect, session, abort from flask_login import LoginManager from flask_wtf.csrf import CsrfProtect import dmapiclient from dmutils import init_app, flask_featureflags from dmcontent.content_loader import ContentLoader from dmutils.user import User from config import configs login...
from flask import Flask, request, redirect, session, abort from flask_login import LoginManager from flask_wtf.csrf import CsrfProtect import dmapiclient from dmutils import init_app, flask_featureflags from dmcontent.content_loader import ContentLoader from dmutils.user import User from config import configs login...
Python
0
8bc306d466034d0d44fc41e935a5499631011149
Add missing module
factory/glideFactory.py
factory/glideFactory.py
# # Description: # This is the main of the glideinFactory # # Arguments: # $1 = poll period (in seconds) # $2 = advertize rate (every $2 loops) # $3 = glidein submit_dir # # Author: # Igor Sfiligoi (Apr 9th 2007 - moved old glideFactory to glideFactoryEntry) # import os import os.path import sys import fcntl...
# # Description: # This is the main of the glideinFactory # # Arguments: # $1 = poll period (in seconds) # $2 = advertize rate (every $2 loops) # $3 = glidein submit_dir # # Author: # Igor Sfiligoi (Apr 9th 2007 - moved old glideFactory to glideFactoryEntry) # import os import os.path import sys import fcntl...
Python
0.000016
a37d8a9874898b072b72c85a8b611e46a459a19e
Move order of installed apps
imagersite/imagersite/settings.py
imagersite/imagersite/settings.py
""" Django settings for imagersite project. Generated by 'django-admin startproject' using Django 1.8.3. For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/settings/ """ # Build p...
""" Django settings for imagersite project. Generated by 'django-admin startproject' using Django 1.8.3. For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/settings/ """ # Build p...
Python
0.000001
220708945a18b5d876cdff32dcfb9b8b8971d85b
Add time/space complexity
lc017_letter_combinations_of_a_phone_number.py
lc017_letter_combinations_of_a_phone_number.py
"""Leetcode 17. Letter Combinations of a Phone Number Medium URL: https://leetcode.com/problems/letter-combinations-of-a-phone-number/ Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telepho...
"""Leetcode 17. Letter Combinations of a Phone Number Medium URL: https://leetcode.com/problems/letter-combinations-of-a-phone-number/ Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telepho...
Python
0.002369
8161561499e813c8821d6f810e6e28d4e3984922
Update __init__.py
app/__init__.py
app/__init__.py
from flask import Flask, render_template from flask_assets import Bundle, Environment from flask.ext.mail import Mail from flask.ext.login import LoginManager from flask.ext.moment import Moment from flask.ext.sqlalchemy import SQLAlchemy from flask.ext.pagedown import PageDown from flask.ext.flatpages import FlatPages...
from flask import Flask, render_template from flask_assets import Bundle, Environment from flask_socketio import SocketIO, emit from flask.ext.mail import Mail from flask.ext.login import LoginManager from flask.ext.moment import Moment from flask.ext.sqlalchemy import SQLAlchemy from flask.ext.pagedown import PageDown...
Python
0.000072
2b482f638a2ff51eeed595b15f338333b5dd8856
Fix --no-progress-bar option in generate.py (#115)
fairseq/progress_bar.py
fairseq/progress_bar.py
# Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the LICENSE file in # the root directory of this source tree. An additional grant of patent rights # can be found in the PATENTS file in the same directory. # """ Progress bar wrapper around ...
# Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the LICENSE file in # the root directory of this source tree. An additional grant of patent rights # can be found in the PATENTS file in the same directory. # """ Progress bar wrapper around ...
Python
0.000003
007c8bd8bba14b2c16ba9a79d47f7c0630d20f85
Add __del__
aioinflux/client.py
aioinflux/client.py
import asyncio import logging from typing import Union, AnyStr, Mapping, Iterable from urllib.parse import urlencode import aiohttp from .line_protocol import parse_data PointType = Union[AnyStr, Mapping] class AsyncInfluxDBClient: def __init__(self, host='localhost', port=8086, database='testdb', ...
import asyncio import logging from typing import Union, AnyStr, Mapping, Iterable from urllib.parse import urlencode import aiohttp from .line_protocol import parse_data PointType = Union[AnyStr, Mapping] class AsyncInfluxDBClient: def __init__(self, host='localhost', port=8086, database='testdb', ...
Python
0.0006
cc734b39fe18ae66fee0f5b35deaf4f864fa9a4f
remove old imports
game.py
game.py
from collections import deque class SheddingGame(object): """ Represents a Shedding-type game https://en.wikipedia.org/wiki/Shedding-type_game """ def __init__(self, deck): super(SheddingGame, self).__init__() self.players = deque() self.state = {'deck': deck, 'round': 0} def add_p...
# from cardsource import * # import cardsource as cs from collections import deque class SheddingGame(object): """ Represents a Shedding-type game https://en.wikipedia.org/wiki/Shedding-type_game """ def __init__(self, deck): super(SheddingGame, self).__init__() self.players = deque() s...
Python
0.998694
65f8dc529a78593621f4f2b2477707b8e877f0d3
Add Mooseman to privileged users. --autopull
globalvars.py
globalvars.py
import os from datetime import datetime from ChatExchange.chatexchange.client import Client import HTMLParser class GlobalVars: false_positives = [] whitelisted_users = [] blacklisted_users = [] ignored_posts = [] auto_ignored_posts = [] startup_utc = datetime.utcnow().strftime("%H:%M:%S") ...
import os from datetime import datetime from ChatExchange.chatexchange.client import Client import HTMLParser class GlobalVars: false_positives = [] whitelisted_users = [] blacklisted_users = [] ignored_posts = [] auto_ignored_posts = [] startup_utc = datetime.utcnow().strftime("%H:%M:%S") ...
Python
0
b518de210dc3ae075beea60a06e981844ecff3d8
fix lint errors
app/__init__.py
app/__init__.py
import os from flask import Flask from flask.ext.sqlalchemy import SQLAlchemy from flask.ext.login import LoginManager from flask.ext.openid import OpenID from flask.ext.mail import Mail from config import config, basedir db = SQLAlchemy() mail = Mail() login_manager = LoginManager() login_manager.session_protection =...
import os from flask import Flask, render_template from flask.ext.sqlalchemy import SQLAlchemy from flask.ext.login import LoginManager from flask.ext.openid import OpenID from flask.ext.mail import Mail from config import config, basedir db = SQLAlchemy() mail = Mail() login_manager = LoginManager() login_manager.ses...
Python
0.000037
10bbd489e4123363ee4ecafe0ca43151f52a9813
Create compatibility settings/functions for pluggable auth user functionality. See #24
allaccess/compat.py
allaccess/compat.py
"Python and Django compatibility functions." from __future__ import unicode_literals from django.conf import settings AUTH_USER_MODEL = getattr(settings, 'AUTH_USER_MODEL', 'auth.User') try: from django.utils.crypto import get_random_string except ImportError: # pragma: no cover # Backport implementation f...
"Python and Django compatibility functions." from __future__ import unicode_literals from django.conf import settings try: from django.utils.crypto import get_random_string except ImportError: # pragma: no cover # Backport implementation from Django 1.4 import hashlib import random import string ...
Python
0
15f00997113ecb87de9daf636738bc0b51686918
Fix assertion in AutocompleteList.choices_for_request for empty lists
autocomplete_light/autocomplete/list.py
autocomplete_light/autocomplete/list.py
from __future__ import unicode_literals from django.utils.encoding import force_text __all__ = ('AutocompleteList',) class AutocompleteList(object): """ Simple Autocomplete implementation which expects :py:attr:`choices` to be a list of string choices. .. py:attribute:: choices List of str...
from __future__ import unicode_literals from django.utils.encoding import force_text __all__ = ('AutocompleteList',) class AutocompleteList(object): """ Simple Autocomplete implementation which expects :py:attr:`choices` to be a list of string choices. .. py:attribute:: choices List of str...
Python
0
d92cfdf6644663a6e615e032c6bc6ca52bed3edb
Add DragonLord to privileged users
globalvars.py
globalvars.py
import os from datetime import datetime from ChatExchange.chatexchange.client import Client import HTMLParser class GlobalVars: false_positives = [] whitelisted_users = [] blacklisted_users = [] ignored_posts = [] auto_ignored_posts = [] startup_utc = datetime.utcnow().strftime("%H:%M:%S") ...
import os from datetime import datetime from ChatExchange.chatexchange.client import Client import HTMLParser class GlobalVars: false_positives = [] whitelisted_users = [] blacklisted_users = [] ignored_posts = [] auto_ignored_posts = [] startup_utc = datetime.utcnow().strftime("%H:%M:%S") ...
Python
0
f4b6cc839ee38c4f072f91d7fdeee5c2238fc10d
Fix wrong surah and add mp3 url in response
odoa.py
odoa.py
""" The MIT License (MIT) Copyright (c) 2015 Adiyat Mubarak 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, modify, merg...
import sys import json import random import urllib2 import traceback class ODOA(object): TOTAL_PAGES = 159 BASE_API = 'https://raw.githubusercontent.com/semarketir/quranjson/master/source' SUPPORTED_LANGUAGES = ['id', 'en'] def get_random_surah(self, lang='id'): """ Perform http requ...
Python
0