commit
stringlengths
40
40
subject
stringlengths
4
1.73k
repos
stringlengths
5
127k
old_file
stringlengths
2
751
new_file
stringlengths
2
751
new_contents
stringlengths
1
8.98k
old_contents
stringlengths
0
6.59k
license
stringclasses
13 values
lang
stringclasses
23 values
643c8bf95bd5ac0df32eed39beb7124badd723ed
allow extra args in subprocess dispatcher
genome/flow-core,genome/flow-core,genome/flow-core
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 ...
agpl-3.0
Python
054dc32d30ca9175a6c8b40af52491b8e3a98978
Debug the URL that's being requested
Heufneutje/PyHeufyBot,Heufneutje/PyHeufyBot
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 ...
mit
Python
ab51dd3c6c649e582deeb2309a88738b45bccba8
clean up formatting of logger
krdyke/OGP-metadata-py,krdyke/OGP-metadata-py
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...
mit
Python
ebdb3a510718288f5db14539d7261f10abb59c96
Fix a small typo error in clusterdemo.py (#945)
mininet/mininet,mininet/mininet,mininet/mininet
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...
bsd-3-clause
Python
5dbaf2f519c573dbeb239be0d21282ad432339e8
Fix order in base
cryvate/project-euler,cryvate/project-euler
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....
mit
Python
24b868f99d40e5309fc4a8f8e1ca9d9ca00524ea
move init code into its own function
fretboardfreak/netify
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, ...
apache-2.0
Python
e1cb37a061f1522e027004d5ed2aca572223a4a2
Update cooler test utility
hms-dbmi/clodius,hms-dbmi/clodius
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...
mit
Python
b149d3e2be52a9876815b4599164210f086cf0c0
update TODO objectives
MrXlVii/crypto_project
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...
mit
Python
cf4debe97d48d42ac28fb8e2d328a8583e81a007
Fix version_info comparison
wbond/asn1crypto
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...
mit
Python
22ae21ab43c1f94807e282b7d50987af13a6a9d6
Exclude ps1 modules from the TestModules unittest
thaim/ansible,thaim/ansible
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...
mit
Python
7f00ff930b70b9c0ca00874d00704cdf540e3939
correct errors
yanadsl/ML-Autocar
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...
mit
Python
dba06078985716bda0a0d3a6ab26d0fad73b4c73
add a flags parameter to test() to allow passing in during interactive sessions
matthew-brett/draft-statsmodels,matthew-brett/draft-statsmodels
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)
bsd-3-clause
Python
1c9f12f808ffa0f1d4f16ea9f35021a83126243f
Update test Solr download script to work with default Python 3
upayavira/pysolr,mylanium/pysolr,mbeacom/pysolr,shasha79/pysolr,django-searchstack/skisolr,toastdriven/pysolr,CANTUS-Project/pysolr-tornado,toastdriven/pysolr,mylanium/pysolr,mbeacom/pysolr,upayavira/pysolr,django-haystack/pysolr,swistakm/pysolr,CANTUS-Project/pysolr-tornado,swistakm/pysolr,django-haystack/pysolr,rokak...
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...
bsd-3-clause
Python
f9b7fa7fd7a75c5fb85fae545ed05080a162e967
Add sphinx markup to test_input.py
raspearsy/bme590hrm
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...
mit
Python
6143888a2fa396b868ed44c3ceab765a95abea45
Check function must always use all parameters.
knub/skypyblue
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() ...
mit
Python
f52a19fe28fa84b3d83ab20998fd678c795490dc
Remove generated code
davidmogar/lexgen,davidmogar/lexgen
lexgen/__init__.py
lexgen/__init__.py
__author__ = 'David'
mit
Python
aff805625f465421277447e5bd2a53a552dd175f
Fix assertion and error
charanpald/APGL
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 ...
bsd-3-clause
Python
b7256a0696331b5b0889708449ebb93ef90fab4a
add language and save function.
imwithye/git-ignore,imwithye/git-ignore
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...
mit
Python
b6ab29eed44fa0b63043d1481d835a1b25418a22
Remove unused code
jcass77/mopidy,bencevans/mopidy,jmarsik/mopidy,jmarsik/mopidy,quartz55/mopidy,mopidy/mopidy,SuperStarPL/mopidy,woutervanwijk/mopidy,ZenithDK/mopidy,ali/mopidy,pacificIT/mopidy,mokieyue/mopidy,tkem/mopidy,dbrgn/mopidy,dbrgn/mopidy,rawdlite/mopidy,tkem/mopidy,glogiotatidis/mopidy,glogiotatidis/mopidy,glogiotatidis/mopidy...
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...
apache-2.0
Python
9153fc157866b071b3a4322a5e68171f82abe6fd
reduce redundancy in settings.py
uw-it-aca/pivot,uw-it-aca/pivot,uw-it-aca/pivot,uw-it-aca/pivot,uw-it-aca/pivot
docker/settings.py
docker/settings.py
from .base_settings import * import os from django.urls import reverse_lazy ALLOWED_HOSTS = ['*'] if os.getenv("ENV") == "localdev": DEBUG = True else: DEBUG = False INSTALLED_APPS += [ 'pivot', 'templatetag_handlebars', 'compressor', 'django.contrib.humanize', 'django_user_agents', ] WEBPACK...
from .base_settings import * import os from django.urls import reverse_lazy # BASE_DIR = os.path.dirname(os.path.dirname(__file__)) ALLOWED_HOSTS = ['*'] if os.getenv("ENV") == "localdev": DEBUG = True else: DEBUG = False SECRET_KEY = os.getenv('DJANGO_SECRET_KEY', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
apache-2.0
Python
094ff00f180926d44e2102f119beb33354fc7122
Remove unused import
wintersandroid/tvrenamr,ghickman/tvrenamr
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...
mit
Python
0c0a1d0ec480c7df9dd8821d40af7791e46db453
Fix for wrong test: create_semester_accounts
agdsn/pycroft,agdsn/pycroft,lukasjuhrich/pycroft,lukasjuhrich/pycroft,lukasjuhrich/pycroft,lukasjuhrich/pycroft,agdsn/pycroft,agdsn/pycroft,agdsn/pycroft
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...
apache-2.0
Python
38de328a3899b96542f702a51eb180efb47a5556
Fix town regroup bugs
credis/geo-django-fla
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...
bsd-3-clause
Python
928a428a79e574edc9e00416335eccba139dffdd
change csv lists to python sets
Guokr1991/ProstateSensitivityAnalysis
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,...
apache-2.0
Python
211aff9fd57775a87409e1eab50f8803a9efe9f7
add imports for chart and effects
J216/gimp_be,J216/gimp_be
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 *
mit
Python
d362d3770b999293db854a08e9627cfb96557544
disable pagination
tschaume/global_gitfeed_api,tschaume/global_gitfeed_api
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...
mit
Python
248ad807e98aa379f24cb41b6fcf0af753c4f169
Test _assert_eq_nan with scalars and 0-D arrays
dask-image/dask-ndmeasure
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=...
bsd-3-clause
Python
8533400ecf69aac64c6210cb9fca1dfe90d0e6b7
work around hanging issue on Windows (#27)
osrf/osrf_pycommon
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): ...
apache-2.0
Python
63483418d2169cde88649a29754846d30c6cb5c4
Improve fuel.downloaders.basic unit tests
codeaudit/fuel,chrishokamp/fuel,glewis17/fuel,codeaudit/fuel,janchorowski/fuel,udibr/fuel,harmdevries89/fuel,dribnet/fuel,harmdevries89/fuel,mjwillson/fuel,dmitriy-serdyuk/fuel,dhruvparamhans/fuel,vdumoulin/fuel,aalmah/fuel,capybaralet/fuel,orhanf/fuel,bouthilx/fuel,laurent-dinh/fuel,mjwillson/fuel,aalmah/fuel,EderSant...
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: ...
mit
Python
169a8612eb06410a5ae7e110227f7bea010d2ba9
Make stdout and stderr into strings.
YPlan/treepoem
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...
mit
Python
ba37080645153d66a8ae1c8df10312806999f8ec
Add use of fmisid to tests.
kipe/fmi
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...
mit
Python
9369f72c4fe9a544e24f10a1db976589dc013424
Add dependency on apache module
kkampardi/Plinth,harry-7/Plinth,kkampardi/Plinth,harry-7/Plinth,harry-7/Plinth,kkampardi/Plinth,kkampardi/Plinth,harry-7/Plinth,kkampardi/Plinth,harry-7/Plinth
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...
agpl-3.0
Python
3de616fa0bfc8e075e4c7aa4a5e8e9108e168f7c
fix bugs
xmaruto/mcord,zdw/xos,cboling/xos,wathsalav/xos,wathsalav/xos,opencord/xos,zdw/xos,opencord/xos,open-cloud/xos,xmaruto/mcord,open-cloud/xos,cboling/xos,cboling/xos,cboling/xos,jermowery/xos,wathsalav/xos,xmaruto/mcord,cboling/xos,wathsalav/xos,open-cloud/xos,jermowery/xos,jermowery/xos,zdw/xos,jermowery/xos,zdw/xos,xma...
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...
apache-2.0
Python
6e87102251f6448ffa7b9c662ace3b50b00b69b2
Test for git config.
charanpald/APGL
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...
bsd-3-clause
Python
25870e710ca51a6fe373677f2d2889a0df3641ca
Revert "test commit heroku"
codeforamerica/westsac-urban-land-locator,codeforamerica/westsac-urban-land-locator,codeforamerica/westsac-urban-land-locator,codeforamerica/westsac-urban-land-locator
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...
bsd-3-clause
Python
57c0668b9dd11845fb2d845ecbcb0a8aae19eb9c
Add default params to template
mweb/python,exercism/python,behrtam/xpython,exercism/xpython,pheanex/xpython,exercism/xpython,exercism/python,smalley/python,N-Parsons/exercism-python,smalley/python,behrtam/xpython,jmluy/xpython,N-Parsons/exercism-python,mweb/python,pheanex/xpython,jmluy/xpython
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
mit
Python
2b3431f302cf08d3892eb613079df905ba1f68cb
Add tests to check content page rendering
pycontw/pycontw2016,uranusjr/pycontw2016,uranusjr/pycontw2016,pycontw/pycontw2016,pycontw/pycontw2016,uranusjr/pycontw2016,uranusjr/pycontw2016,pycontw/pycontw2016
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...
mit
Python
ee98b5a5c6b82671738bc60e68ea87d838c5400f
Improve the migration for unique data source name
ninneko/redash,EverlyWell/redash,hudl/redash,useabode/redash,pubnative/redash,chriszs/redash,akariv/redash,alexanderlz/redash,easytaxibr/redash,pubnative/redash,amino-data/redash,rockwotj/redash,ninneko/redash,guaguadev/redash,rockwotj/redash,denisov-vlad/redash,imsally/redash,ninneko/redash,useabode/redash,crowdworks/...
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 ...
bsd-2-clause
Python
791546d9fa1fc0317dc613e0ba7e74ca1cbf8210
Update __init__.py
closeio/flask-admin,jmagnusson/flask-admin,flask-admin/flask-admin,lifei/flask-admin,rochacbruno/flask-admin,quokkaproject/flask-admin,closeio/flask-admin,rochacbruno/flask-admin,jmagnusson/flask-admin,quokkaproject/flask-admin,rochacbruno/flask-admin,ArtemSerga/flask-admin,flask-admin/flask-admin,ArtemSerga/flask-admi...
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
bsd-3-clause
Python
558085de2a32ef14d7b9ef2884f34699b7f7c39b
Update test.py
liontoolkit/test
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...
mpl-2.0
Python
53d75c14d79b92ad1fdf9c99b0773db6427d4294
update to reveal.js 3.2.0
humrochagf/flask-reveal,humrochagf/flask-reveal
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', }) ...
mit
Python
a7db7bdb277eed65c93fbc9f5e9e923487711071
Update file_system_storage.py
ArabellaTech/django-image-diet
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...
mit
Python
9c3b3cb541e8d42d1206fabae83fbef4a249f3ec
bump version
slash-testing/backslash-python,vmalloc/backslash-python
backslash/__version__.py
backslash/__version__.py
__version__ = "2.4.0"
__version__ = "2.3.1"
bsd-3-clause
Python
9834fab5a7e061f0eb1cb7b737cec8d2b23b4c7c
Declare numpydoc template in setup_package.py
astropy/astropy-helpers,Cadair/astropy-helpers,bsipocz/astropy-helpers,bsipocz/astropy-helpers,dpshelio/astropy-helpers,bsipocz/astropy-helpers,Cadair/astropy-helpers,astropy/astropy-helpers,dpshelio/astropy-helpers
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']}
bsd-3-clause
Python
220708945a18b5d876cdff32dcfb9b8b8971d85b
Add time/space complexity
bowen0701/algorithms_data_structures
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...
bsd-2-clause
Python
8161561499e813c8821d6f810e6e28d4e3984922
Update __init__.py
delitamakanda/socialite,delitamakanda/socialite,delitamakanda/socialite
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...
mit
Python
65f8dc529a78593621f4f2b2477707b8e877f0d3
Add Mooseman to privileged users. --autopull
Charcoal-SE/SmokeDetector,NickVolynkin/SmokeDetector,Charcoal-SE/SmokeDetector,ArtOfCode-/SmokeDetector,NickVolynkin/SmokeDetector,ArtOfCode-/SmokeDetector
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") ...
apache-2.0
Python
b518de210dc3ae075beea60a06e981844ecff3d8
fix lint errors
happyraul/tv
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...
apache-2.0
Python
10bbd489e4123363ee4ecafe0ca43151f52a9813
Create compatibility settings/functions for pluggable auth user functionality. See #24
vyscond/django-all-access,dpoirier/django-all-access,dpoirier/django-all-access,iXioN/django-all-access,mlavin/django-all-access,vyscond/django-all-access,mlavin/django-all-access,iXioN/django-all-access
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 ...
bsd-2-clause
Python
15f00997113ecb87de9daf636738bc0b51686918
Fix assertion in AutocompleteList.choices_for_request for empty lists
Eraldo/django-autocomplete-light,yourlabs/django-autocomplete-light,Perkville/django-autocomplete-light,shubhamdipt/django-autocomplete-light,shubhamdipt/django-autocomplete-light,Visgean/django-autocomplete-light,luzfcb/django-autocomplete-light,blueyed/django-autocomplete-light,dsanders11/django-autocomplete-light,yo...
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...
mit
Python
d92cfdf6644663a6e615e032c6bc6ca52bed3edb
Add DragonLord to privileged users
ArtOfCode-/SmokeDetector,NickVolynkin/SmokeDetector,Charcoal-SE/SmokeDetector,NickVolynkin/SmokeDetector,ArtOfCode-/SmokeDetector,Charcoal-SE/SmokeDetector
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") ...
apache-2.0
Python
cc1000824237cd74dec3e0ff210ee08020c2cd92
add config ini to ament_mypy site package (#182)
ament/ament_lint,ament/ament_lint,ament/ament_lint
ament_mypy/setup.py
ament_mypy/setup.py
from setuptools import find_packages from setuptools import setup setup( name='ament_mypy', version='0.7.3', packages=find_packages(exclude=['test']), install_requires=['setuptools'], package_data={'': [ 'configuration/ament_mypy.ini', ]}, zip_safe=False, author='Ted Kern', ...
from setuptools import find_packages from setuptools import setup setup( name='ament_mypy', version='0.7.3', packages=find_packages(exclude=['test']), install_requires=['setuptools'], zip_safe=False, author='Ted Kern', author_email='ted.kern@canonical.com', maintainer='Ted Kern', ma...
apache-2.0
Python
1ec0b7bf12b8d0ea452caa9aad17535a2fd745d8
Optimise for readability
eugene-eeo/scell
scell/core.py
scell/core.py
""" scell.core ~~~~~~~~~~ Provides abstractions over lower level APIs and file objects and their interests. """ from select import select as _select from collections import namedtuple def select(rl, wl, timeout=None): """ Returns the file objects ready for reading/writing from the read-...
""" scell.core ~~~~~~~~~~ Provides abstractions over lower level APIs and file objects and their interests. """ from select import select as _select from collections import namedtuple def select(rl, wl, timeout=None): """ Returns the file objects ready for reading/writing from the read-...
mit
Python
9f0837d387c7303d5c8c925a9989ca77a1a96e3e
Bump version after keras model fix
iskandr/fancyimpute,hammerlab/fancyimpute
fancyimpute/__init__.py
fancyimpute/__init__.py
from __future__ import absolute_import, print_function, division from .solver import Solver from .nuclear_norm_minimization import NuclearNormMinimization from .iterative_imputer import IterativeImputer from .matrix_factorization import MatrixFactorization from .iterative_svd import IterativeSVD from .simple_fill impo...
from __future__ import absolute_import, print_function, division from .solver import Solver from .nuclear_norm_minimization import NuclearNormMinimization from .iterative_imputer import IterativeImputer from .matrix_factorization import MatrixFactorization from .iterative_svd import IterativeSVD from .simple_fill impo...
apache-2.0
Python
5b7abc62a541622b007da367e52488eab72f2b5a
Fix font usage.
rsmith-nl/scripts,rsmith-nl/scripts
graph-deps.py
graph-deps.py
#!/usr/bin/env python3 # file: graph-deps.py # vim:fileencoding=utf-8:fdm=marker:ft=python # # Author: R.F. Smith <rsmith@xs4all.nl> # Created: 2017-04-27 13:50:28 +0200 # Last modified: 2018-03-10 22:50:33 +0100 # # To the extent possible under law, R.F. Smith has waived all copyright and # related or neighboring righ...
#!/usr/bin/env python3 # file: graph-deps.py # vim:fileencoding=utf-8:fdm=marker:ft=python # # Author: R.F. Smith <rsmith@xs4all.nl> # Created: 2017-04-27 13:50:28 +0200 # Last modified: 2017-06-04 13:38:06 +0200 # # To the extent possible under law, R.F. Smith has waived all copyright and # related or neighboring righ...
mit
Python
8408f5431e56309d95076db16c86b0aa2ef044ba
Decrease number of messages from MoveToFort worker
halsafar/PokemonGo-Bot,DBa2016/PokemonGo-Bot,Gobberwart/PokemonGo-Bot,dtee/PokemonGo-Bot,heihachi/PokemonGo-Bot,goedzo/PokemonGo-Bot,lythien/pokemongo,Gobberwart/PokemonGo-Bot,cmezh/PokemonGo-Bot,DBa2016/PokemonGo-Bot,dtee/PokemonGo-Bot,heihachi/PokemonGo-Bot,halsafar/PokemonGo-Bot,goedzo/PokemonGo-Bot,pengzhangdev/Pok...
pokemongo_bot/event_manager.py
pokemongo_bot/event_manager.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from sys import stdout class EventNotRegisteredException(Exception): pass class EventMalformedException(Exception): pass class EventHandler(object): def __init__(self): pass def handle_event(self, event, kwargs): rai...
# -*- coding: utf-8 -*- from __future__ import unicode_literals class EventNotRegisteredException(Exception): pass class EventMalformedException(Exception): pass class EventHandler(object): def __init__(self): pass def handle_event(self, event, kwargs): raise NotImplementedError(...
mit
Python
05835304797c9486d0c715d5a07d02fffd676b67
Fix test to account for new composition
johnwlockwood/stream_tap,johnwlockwood/iter_karld_tools,johnwlockwood/stream_tap,johnwlockwood/karl_data
karld/tests/test_run_together.py
karld/tests/test_run_together.py
from itertools import islice import string import unittest from mock import patch, Mock from ..run_together import csv_file_to_file class TestCSVFileToFile(unittest.TestCase): def setUp(self): self.csv_contents = iter([ 'a,b', 'c,d', 'e,f', ]) self.csv_...
from itertools import islice import string import unittest from mock import patch, Mock from ..run_together import csv_file_to_file class TestCSVFileToFile(unittest.TestCase): def setUp(self): self.csv_contents = iter([ ['a', 'b'], ['c', 'd'], ['e', 'f'], ]) ...
apache-2.0
Python
cb202e49d2b96dd46d322bb2c9ef21eb3cce05f7
Update Google OAuth to user requests_oauthlib
alexisrolland/data-quality,alexisrolland/data-quality,alexisrolland/data-quality,alexisrolland/data-quality
api/init/security/oauth/google.py
api/init/security/oauth/google.py
import json import os from flask import redirect, request, session from flask_restplus import Namespace, Resource from requests_oauthlib import OAuth2Session from security.token import get_jwt_token, TokenType, get_token_redirect_response # OAuth endpoints given in the Google API documentation AUTHORIZATION_URI = 'ht...
import os import json import requests from flask import redirect, request from flask_restplus import Namespace, Resource from google_auth_oauthlib.flow import Flow from security.token import get_jwt_token, TokenType, get_token_redirect_response # pylint: disable=unused-variable google_redirect_url = os.environ['GOOG...
apache-2.0
Python
25e7574b6d58444ba81b3ad9321662e3a1a6b7e8
Apply some PEP8 cleanup
OCA/product-variant,OCA/product-variant,OCA/product-variant
product_variant_sale_price/models/product_product.py
product_variant_sale_price/models/product_product.py
# -*- coding: utf-8 -*- # © 2016 Sergio Teruel <sergio.teruel@tecnativa.com> # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from openerp import models, fields, api class ProductTemplate(models.Model): _inherit = "product.template" @api.multi def write(self, vals): res = super(P...
# -*- coding: utf-8 -*- # © 2016 Sergio Teruel <sergio.teruel@tecnativa.com> # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from openerp import models, fields, api class ProductTemplate(models.Model): _inherit = "product.template" @api.multi def write(self, vals): res = super(P...
agpl-3.0
Python
93181a9a8df89c9ed1ff1e06672cc592a2b689dc
Fix deadcode
ktok07b6/polyphony,ktok07b6/polyphony,ktok07b6/polyphony
polyphony/compiler/deadcode.py
polyphony/compiler/deadcode.py
from .env import env from .ir import * from logging import getLogger logger = getLogger(__name__) class DeadCodeEliminator(object): def process(self, scope): if scope.is_namespace() or scope.is_class(): return usedef = scope.usedef for blk in scope.traverse_blocks(): ...
from .env import env from .ir import * from logging import getLogger logger = getLogger(__name__) class DeadCodeEliminator(object): def process(self, scope): if scope.is_namespace() or scope.is_class() or scope.is_method(): return usedef = scope.usedef for blk in scope.traverse...
mit
Python
e1e4d36096fe2c8cea92b77feabc60d94ac4310a
Break class now inherits behaviour from KitchenTimer.
doughgle/pomodoro_evolved,doughgle/pomodoro_evolved,doughgle/pomodoro_evolved
pomodoro_evolved/rest_break.py
pomodoro_evolved/rest_break.py
from kitchen_timer import KitchenTimer, AlreadyRunningError, TimeAlreadyUp, NotRunningError from math import ceil class BreakAlreadySkipped(Exception): pass class BreakCannotBeSkippedOnceStarted(Exception): pass class BreakAlreadyStarted(Exception): pass class BreakNotStarted(Exception): pass class BreakAlreadyTermina...
from kitchen_timer import KitchenTimer, AlreadyRunningError, TimeAlreadyUp, NotRunningError from math import ceil class BreakAlreadySkipped(Exception): pass class BreakCannotBeSkippedOnceStarted(Exception): pass class BreakAlreadyStarted(Exception): pass class BreakNotStarted(Exception): pass class BreakAlreadyTermina...
mit
Python
ca15e6523bd34e551528dce6c6ee3dcb70cf7806
Use sed inline (unsure why mv was used originally).
Fizzadar/pyinfra,Fizzadar/pyinfra
pyinfra/modules/util/files.py
pyinfra/modules/util/files.py
# pyinfra # File: pyinfra/modules/util/files.py # Desc: common functions for handling the filesystem from types import NoneType def ensure_mode_int(mode): # Already an int (/None)? if isinstance(mode, (int, NoneType)): return mode try: # Try making an int ('700' -> 700) return in...
# pyinfra # File: pyinfra/modules/util/files.py # Desc: common functions for handling the filesystem from types import NoneType def ensure_mode_int(mode): # Already an int (/None)? if isinstance(mode, (int, NoneType)): return mode try: # Try making an int ('700' -> 700) return in...
mit
Python
f015c3e5973c9424734ff6181563ee7905c73428
fix version pattern
amoskong/scylla-cluster-tests,scylladb/scylla-cluster-tests,amoskong/scylla-cluster-tests,scylladb/scylla-cluster-tests,scylladb/scylla-longevity-tests,amoskong/scylla-cluster-tests,amoskong/scylla-cluster-tests,scylladb/scylla-cluster-tests,scylladb/scylla-cluster-tests,scylladb/scylla-cluster-tests,amoskong/scylla-cl...
sdcm/utils.py
sdcm/utils.py
# 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 distributed in the hope that it will be usefu...
# 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 distributed in the hope that it will be usefu...
agpl-3.0
Python
c1a263107cac6f55ce01ea5f260c005d307398e7
add env vars to ping.json
ministryofjustice/laa-legal-adviser-api,ministryofjustice/laa-legal-adviser-api,ministryofjustice/laa-legal-adviser-api
laalaa/apps/healthcheck/views.py
laalaa/apps/healthcheck/views.py
import os import requests from django.http import JsonResponse from django.conf import settings def ping(request): res = { "version_number": os.environ.get('APPVERSION'), "build_date": os.environ.get('APP_BUILD_DATE'), "commit_id": os.environ.get('APP_GIT_COMMIT'), "build_tag": os...
import requests from django.http import JsonResponse from django.conf import settings def ping(request): res = { "version_number": None, "build_date": None, "commit_id": None, "build_tag": None } # Get version details try: res['version_number'] = str(open("{0}...
mit
Python
5a4d9255c59be0d5dda8272e0e7ced71822f4d40
Fix memory issues by just trying every number
CubicComet/exercism-python-solutions
prime-factors/prime_factors.py
prime-factors/prime_factors.py
def prime_factors(n): factors = [] factor = 2 while n != 1: while n % factor == 0: factors += [factor] n //= factor factor += 1 return factors
import sieve def prime_factors(n): primes = sieve.sieve(n) factors = [] for p in primes: while n % p == 0: factors += [p] n //= p return factors
agpl-3.0
Python
8ea3350c6944946b60732308c912dc240952237c
Revert "Set the right recalbox.log path"
recalbox/recalbox-manager,recalbox/recalbox-manager,recalbox/recalbox-manager,sveetch/recalbox-manager,sveetch/recalbox-manager,sveetch/recalbox-manager,sveetch/recalbox-manager,recalbox/recalbox-manager,sveetch/recalbox-manager,recalbox/recalbox-manager
project/settings_production.py
project/settings_production.py
from .settings import * # Update SITE infos to use the common port 80 to publish the webapp SITE_FIXED = { 'name': "Recalbox Manager", 'ip': None, # If 'None' find the ip automatically. Use a string to define another ip/hostname 'port': None, # If 'None' no port is added to hostname, so the server have to ...
from .settings import * # Update SITE infos to use the common port 80 to publish the webapp SITE_FIXED = { 'name': "Recalbox Manager", 'ip': None, # If 'None' find the ip automatically. Use a string to define another ip/hostname 'port': None, # If 'None' no port is added to hostname, so the server have to ...
mit
Python
812efd4b5addeee879e91c6c660ac2a1a2adfe5d
mueve logica de avance de un paso a una funcion
uchileFI3104B-2015B/demo-crank-nicolson
heat.py
heat.py
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Este script resuelve un problema simple de diffusion en 1D. La ecuación a resover es: dT/dt = d2T/dx2; T(0,x) = sin(pi * x); T(t, 0) = T(t, 1) = 0 ''' from __future__ import division import numpy as np def inicializa_T(T, N_steps, h): ''' Rellena T con ...
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Este script resuelve un problema simple de diffusion en 1D. La ecuación a resover es: dT/dt = d2T/dx2; T(0,x) = sin(pi * x); T(t, 0) = T(t, 1) = 0 ''' from __future__ import division import numpy as np def inicializa_T(T, N_steps, h): ''' Rellena T con ...
mit
Python
eb66cae55dee3b401cd84a71f9906cdb42a217bc
Update __init__.py
williamFalcon/pytorch-lightning,williamFalcon/pytorch-lightning
pytorch_lightning/__init__.py
pytorch_lightning/__init__.py
"""Root package info.""" __version__ = '0.9.0rc4' __author__ = 'William Falcon et al.' __author_email__ = 'waf2107@columbia.edu' __license__ = 'Apache-2.0' __copyright__ = 'Copyright (c) 2018-2020, %s.' % __author__ __homepage__ = 'https://github.com/PyTorchLightning/pytorch-lightning' # this has to be simple string, ...
"""Root package info.""" __version__ = '0.9.0rc3' __author__ = 'William Falcon et al.' __author_email__ = 'waf2107@columbia.edu' __license__ = 'Apache-2.0' __copyright__ = 'Copyright (c) 2018-2020, %s.' % __author__ __homepage__ = 'https://github.com/PyTorchLightning/pytorch-lightning' # this has to be simple string, ...
apache-2.0
Python
a5f274b5a3dbb72e109184b7a3c56b2a1dac13b4
Enable WebForm page
StrellaGroup/frappe,mhbu50/frappe,yashodhank/frappe,almeidapaulopt/frappe,mhbu50/frappe,almeidapaulopt/frappe,frappe/frappe,yashodhank/frappe,yashodhank/frappe,StrellaGroup/frappe,almeidapaulopt/frappe,frappe/frappe,StrellaGroup/frappe,almeidapaulopt/frappe,mhbu50/frappe,mhbu50/frappe,frappe/frappe,yashodhank/frappe
frappe/website/serve.py
frappe/website/serve.py
import frappe from frappe import _ from frappe.utils import cstr from frappe.website.page_controllers.document_page import DocumentPage from frappe.website.page_controllers.list_page import ListPage from frappe.website.page_controllers.not_permitted_page import NotPermittedPage from frappe.website.page_controllers.pri...
import frappe from frappe import _ from frappe.utils import cstr from frappe.website.page_controllers.document_page import DocumentPage from frappe.website.page_controllers.list_page import ListPage from frappe.website.page_controllers.not_permitted_page import NotPermittedPage from frappe.website.page_controllers.pri...
mit
Python
fd4688cc899b08253cc50b345bb7e836081783d8
Add Beta and Binomial to automatically imported nodes
jluttine/bayespy,SalemAmeen/bayespy,fivejjs/bayespy,bayespy/bayespy
bayespy/inference/vmp/nodes/__init__.py
bayespy/inference/vmp/nodes/__init__.py
###################################################################### # Copyright (C) 2011,2012 Jaakko Luttinen # # This file is licensed under Version 3.0 of the GNU General Public # License. See LICENSE for a text of the license. ###################################################################### ###############...
###################################################################### # Copyright (C) 2011,2012 Jaakko Luttinen # # This file is licensed under Version 3.0 of the GNU General Public # License. See LICENSE for a text of the license. ###################################################################### ###############...
mit
Python
769a334675cc451c6de07ed21e23ffd4480088df
Add time/space complexity
bowen0701/algorithms_data_structures
lc0041_first_missing_positive.py
lc0041_first_missing_positive.py
"""Leetcode 41. First Missing Positive Hard URL: https://leetcode.com/problems/first-missing-positive/ Given an unsorted integer array, find the smallest missing positive integer. Example 1: Input: [1,2,0] Output: 3 Example 2: Input: [3,4,-1,1] Output: 2 Example 3: Input: [7,8,9,11,12] Output: 1 Note: Your algori...
"""Leetcode 41. First Missing Positive Hard URL: https://leetcode.com/problems/first-missing-positive/ Given an unsorted integer array, find the smallest missing positive integer. Example 1: Input: [1,2,0] Output: 3 Example 2: Input: [3,4,-1,1] Output: 2 Example 3: Input: [7,8,9,11,12] Output: 1 Note: Your algori...
bsd-2-clause
Python
f33b294d60ffbfb5351d4579e38ea197e2c3787a
Complete reverse iter sol
bowen0701/algorithms_data_structures
lc0482_license_key_formatting.py
lc0482_license_key_formatting.py
"""Leecode 482. License Key Formatting Easy URL: https://leetcode.com/problems/license-key-formatting/ You are given a license key represented as a string S which consists only alphanumeric character and dashes. The string is separated into N+1 groups by N dashes. Given a number K, we would want to reformat the stri...
"""Leecode 482. License Key Formatting Easy URL: https://leetcode.com/problems/license-key-formatting/ You are given a license key represented as a string S which consists only alphanumeric character and dashes. The string is separated into N+1 groups by N dashes. Given a number K, we would want to reformat the stri...
bsd-2-clause
Python
dc95d6766d305f2126c158f50417e29d0c47ce3f
Change doc route
odtvince/APITaxi,odtvince/APITaxi,odtvince/APITaxi,l-vincent-l/APITaxi,l-vincent-l/APITaxi,openmaraude/APITaxi,odtvince/APITaxi,openmaraude/APITaxi
backoffice_operateurs/__init__.py
backoffice_operateurs/__init__.py
# -*- coding: utf8 -*- VERSION = (0, 1, 0) __author__ = 'Vincent Lara' __contact__ = "vincent.lara@data.gouv.fr" __homepage__ = "https://github.com/" __version__ = ".".join(map(str, VERSION)) from flask import Flask, make_response from flask.ext.security import Security, SQLAlchemyUserDatastore from flask.ext.script ...
# -*- coding: utf8 -*- VERSION = (0, 1, 0) __author__ = 'Vincent Lara' __contact__ = "vincent.lara@data.gouv.fr" __homepage__ = "https://github.com/" __version__ = ".".join(map(str, VERSION)) from flask import Flask, make_response from flask.ext.security import Security, SQLAlchemyUserDatastore from flask.ext.script ...
agpl-3.0
Python
aa4061887fc750dd63cd226e3fa45f0b56ec2462
Update server.py
mikelambson/tcid,mikelambson/tcid,mikelambson/tcid,mikelambson/tcid
site/server.py
site/server.py
#Import flask libraries import json, re, os, datetime, logging;#Import general libraries from flask import Flask, jsonify, request, render_template, send_from_directory; from flask_socketio import SocketIO, send, emit, join_room, leave_room, close_room; from flask_mail import Mail, Message; from flask_socketio imp...
#Import flask libraries import json, re, os, datetime, logging;#Import general libraries from flask import Flask, jsonify, request, render_template, send_from_directory; from flask_socketio import SocketIO, send, emit, join_room, leave_room, close_room; from flask_mail import Mail, Message; from flask_socketio imp...
bsd-3-clause
Python
ec149e2e6b56f201ed154eaeecab2f651fe70351
Update docstrings.
makism/dyfunconn
dyfunconn/graphs/laplacian_energy.py
dyfunconn/graphs/laplacian_energy.py
# -*- coding: utf-8 -*- """ Laplcian Energy The Laplcian energy (LE) for a graph :math:`G` is computed as .. math:: LE(G) = \\sum_{i=1}^n | { \\mu_{i} - \\frac{2m}{n} } | ξ(A_1, A_2 ; t) = ‖exp⁡(-tL_1 ) - exp⁡(-tL_2 )‖_F^2 Where :math:`\mu_i` denote the eigenvalue associated with the node of the Laplcian mat...
# -*- coding: utf-8 -*- """ Laplcian Energy The Laplcian energy (LE) for a graph :math:`G` is computed as .. math:: LE(G) = \sum_{i=1}^n | {\mu_i - \frac{2m}{n}} | ξ(A_1, A_2 ; t) = ‖exp⁡(-tL_1 ) - exp⁡(-tL_2 )‖_F^2 Where :math:``\mu_i` denote the eigenvalue associated with the node of the Laplcian matrix of...
bsd-3-clause
Python
cd3e129c1951dbb1d2d99d454b1e07d96d1d5497
Support multi or non-multi mappers for bowtie alignments
lbeltrame/bcbio-nextgen,vladsaveliev/bcbio-nextgen,SciLifeLab/bcbio-nextgen,hjanime/bcbio-nextgen,vladsaveliev/bcbio-nextgen,fw1121/bcbio-nextgen,lpantano/bcbio-nextgen,SciLifeLab/bcbio-nextgen,SciLifeLab/bcbio-nextgen,Cyberbio-Lab/bcbio-nextgen,biocyberman/bcbio-nextgen,elkingtonmcb/bcbio-nextgen,verdurin/bcbio-nextge...
bcbio/ngsalign/bowtie.py
bcbio/ngsalign/bowtie.py
"""Next gen sequence alignments with Bowtie (http://bowtie-bio.sourceforge.net). """ import os import subprocess from bcbio.utils import file_transaction galaxy_location_file = "bowtie_indices.loc" def align(fastq_file, pair_file, ref_file, out_base, align_dir, config): """Before a standard or paired end alignme...
"""Next gen sequence alignments with Bowtie (http://bowtie-bio.sourceforge.net). """ import os import subprocess from bcbio.utils import file_transaction galaxy_location_file = "bowtie_indices.loc" def align(fastq_file, pair_file, ref_file, out_base, align_dir, config): """Before a standard or paired end alignme...
mit
Python
a6283772b07a29faa54a8c141947e19005bef61e
append max and min to entire dataset
navierula/Research-Fall-2017
minMaxCalc.py
minMaxCalc.py
import pandas as pd # read in dataset xl = pd.ExcelFile("data/130N_Cycles_1-47.xlsx") df = xl.parse("Specimen_RawData_1") df """ This is what the dataset currently looks like - it has 170,101 rows and two columns. The dataset contains data from 47 cycles following an experiment. The output of these experiments form...
import pandas as pd # read in dataset xl = pd.ExcelFile("data/130N_Cycles_1-47.xlsx") df = xl.parse("Specimen_RawData_1") df """ This is what the dataset currently looks like - it has 170,101 rows and two columns. The dataset contains data from 47 cycles following an experiment. The output of these experiments form...
mit
Python
fff56b52afb40ee0a69c9a84b847f7ccc0836bd6
Update some admin list parameters.
gauravjns/taiga-back,CoolCloud/taiga-back,joshisa/taiga-back,crr0004/taiga-back,dycodedev/taiga-back,gam-phon/taiga-back,astronaut1712/taiga-back,astagi/taiga-back,19kestier/taiga-back,bdang2012/taiga-back-casting,CoolCloud/taiga-back,seanchen/taiga-back,coopsource/taiga-back,gam-phon/taiga-back,Tigerwhit4/taiga-back,g...
greenmine/scrum/admin.py
greenmine/scrum/admin.py
# -*- coding: utf-8 -*- from django.contrib import admin from guardian.admin import GuardedModelAdmin from greenmine.scrum import models import reversion class MilestoneInline(admin.TabularInline): model = models.Milestone fields = ('name', 'owner', 'estimated_start', 'estimated_finish', 'closed', 'disponibi...
# -*- coding: utf-8 -*- from django.contrib import admin from guardian.admin import GuardedModelAdmin from greenmine.scrum import models import reversion class MilestoneInline(admin.TabularInline): model = models.Milestone fields = ('name', 'owner', 'estimated_start', 'estimated_finish', 'closed', 'disponibi...
agpl-3.0
Python
f66a679a1ca8f78a12567a1d8acfe04ca2778ce3
allow removal of genomes and fragments in admin
ginkgobioworks/edge,ginkgobioworks/edge,ginkgobioworks/edge,ginkgobioworks/edge
src/edge/admin.py
src/edge/admin.py
from django.contrib import admin from edge.models import Genome, Fragment class Genome_Admin(admin.ModelAdmin): list_display = ('id', 'name', 'notes', 'parent', 'created_on') search_fields = ('name',) fields = ('name', 'notes', 'active') actions = None def has_add_permission(self, request): ...
from django.contrib import admin from edge.models import Genome, Fragment class Genome_Admin(admin.ModelAdmin): list_display = ('id', 'name', 'notes', 'parent', 'created_on') search_fields = ('name',) fields = ('name', 'notes', 'active') actions = None def has_add_permission(self, request): ...
mit
Python
ed21e865f346b700c48458f22e3d3f1841f63451
Fix JSON encoder to work with Decimal fields
jimbobhickville/swd6,jimbobhickville/swd6,jimbobhickville/swd6
api/swd6/api/app.py
api/swd6/api/app.py
import flask import flask_cors from sqlalchemy_jsonapi import flaskext as flask_jsonapi import logging from swd6.config import CONF from swd6.db.models import db logging.basicConfig(level=logging.DEBUG) app = flask.Flask(__name__) app.config['DEBUG'] = True app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True app.con...
import flask import flask_cors from sqlalchemy_jsonapi import flaskext as flask_jsonapi import logging from swd6.config import CONF from swd6.db.models import db logging.basicConfig(level=logging.DEBUG) app = flask.Flask(__name__) app.config['DEBUG'] = True app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True app.con...
apache-2.0
Python
efe79ebfa2b023e6971244b7f3c803a09dd6d2c7
change check to skipp
FESOM/pyfesom,FESOM/pyfesom
tools/pcdo.py
tools/pcdo.py
import glob from joblib import Parallel, delayed import os import click def cdo_command(ifile, opath, command, ext, skip): if opath != 'no': ofile = os.path.join(opath, '{}_{}.nc'.format(os.path.basename(ifile)[:-3], ext)) else: ofile = ' ' if skip: if os.path.isfile(ofile): ...
import glob from joblib import Parallel, delayed import os import click def cdo_comand(ifile, opath, command, ext, checko): if opath != 'no': ofile = os.path.join(opath, '{}_tm.nc'.format(os.path.basename(ifile)[:-3])) else: ofile = ' ' if checko: if os.path.isfile(ofile): ...
mit
Python
eb368c11b7d0e481c6539130c34cb0b04c8f57a6
add prompt number
faycheng/tpl,faycheng/tpl
tpl/prompt.py
tpl/prompt.py
# -*- coding:utf-8 -*- import os import sys sys.path.insert(0, os.path.dirname(os.path.dirname(__file__))) import prompt_toolkit from prompt_toolkit.history import FileHistory from prompt_toolkit.completion import Completion, Completer from tpl import path class WordMatchType(object): CONTAINS = 'CONTAINES' ...
# -*- coding:utf-8 -*- import os import sys sys.path.insert(0, os.path.dirname(os.path.dirname(__file__))) import prompt_toolkit from prompt_toolkit.history import FileHistory from prompt_toolkit.completion import Completion, Completer from tpl import path class WordMatchType(object): CONTAINS = 'CONTAINES' ...
mit
Python
63fddd07e3b110c06c7369fa9d815e79384ef27e
update try_pandas.py
hanhanwu/Hanhan_Data_Science_Practice,hanhanwu/Hanhan_Data_Science_Practice,hanhanwu/Hanhan_Data_Science_Practice,hanhanwu/Hanhan_Data_Science_Practice
try_pandas.py
try_pandas.py
# I'm using Spark Cloud Community Edition, sicne my own machine cannot have the right numpy for pandas... # So, in this code, so features could only be used in Spark Cloud Python Notebook # Try pandas :) # cell 1 - load the data (I upload the .csv into Spark Cloud first) import pandas as pd import numpy as np ## The ...
# I'm using Spark Cloud Community Edition, sicne my own machine cannot have the right numpy for pandas... # So, in this code, so features could only be used in Spark Cloud Python Notebook # Try pandas :) # cell 1 - load the data (I upload the .csv into Spark Cloud first) import pandas as pd import numpy as np ## The ...
mit
Python
31caf3d6366cdc3669eb72007a1a6a45bffe2ce3
Update at 2017-07-23 11-30-32
amoshyc/tthl-code
plot.py
plot.py
from sys import argv from pathlib import Path import matplotlib as mpl mpl.use('Agg') import seaborn as sns sns.set_style("darkgrid") import matplotlib.pyplot as plt import pandas as pd # from keras.utils import plot_model # plot_model(model, to_file='model.png', show_shapes=True, show_layer_names=False) def plot_s...
from sys import argv from pathlib import Path import matplotlib as mpl mpl.use('Agg') import seaborn as sns sns.set_style("darkgrid") import matplotlib.pyplot as plt import pandas as pd # from keras.utils import plot_model # plot_model(model, to_file='model.png', show_shapes=True, show_layer_names=False) def plot_s...
apache-2.0
Python
e2330caffae04bc31376a2e0f66f0e86ebf92532
Add my own K-nearest-neighbor algorithm
a-holm/MachinelearningAlgorithms,a-holm/MachinelearningAlgorithms
kNearestNeighbors/howItWorksKNearestNeighbors.py
kNearestNeighbors/howItWorksKNearestNeighbors.py
# -*- coding: utf-8 -*- """K Nearest Neighbors classification for machine learning. This file demonstrate knowledge of K Nearest Neighbors classification. By building the algorithm from scratch. The idea of K Nearest Neighbors classification is to best divide and separate the data based on clustering the data and clas...
mit
Python
9f8cf1c321e9c325fbaaaba3a6ef30c7cf3dd211
Hide deleted course updates from mobile API.
ak2703/edx-platform,lduarte1991/edx-platform,DNFcode/edx-platform,defance/edx-platform,pabloborrego93/edx-platform,Edraak/circleci-edx-platform,dsajkl/123,chand3040/cloud_that,antoviaque/edx-platform,ahmedaljazzar/edx-platform,jamiefolsom/edx-platform,Edraak/edx-platform,OmarIthawi/edx-platform,alu042/edx-platform,anal...
lms/djangoapps/mobile_api/course_info/views.py
lms/djangoapps/mobile_api/course_info/views.py
from rest_framework import generics, permissions from rest_framework.authentication import OAuth2Authentication, SessionAuthentication from rest_framework.response import Response from rest_framework.views import APIView from courseware.model_data import FieldDataCache from courseware.module_render import get_module f...
from rest_framework import generics, permissions from rest_framework.authentication import OAuth2Authentication, SessionAuthentication from rest_framework.response import Response from rest_framework.views import APIView from courseware.model_data import FieldDataCache from courseware.module_render import get_module f...
agpl-3.0
Python
72a633793b30a87b6affa528459185d46fc37007
Update getJob signature
bryantrobbins/baseball,bryantrobbins/baseball,bryantrobbins/baseball,bryantrobbins/baseball,bryantrobbins/baseball
shared/api.py
shared/api.py
from __future__ import print_function import boto3 import json import os import btr3baseball jobTable = os.environ['JOB_TABLE'] jobQueue = os.environ['JOB_QUEUE'] repo = btr3baseball.JobRepository(jobTable) queue = boto3.resource('sqs').get_queue_by_name(QueueName=jobQueue) def submitJob(event, context): # Put i...
from __future__ import print_function import boto3 import json import os import btr3baseball jobTable = os.environ['JOB_TABLE'] jobQueue = os.environ['JOB_QUEUE'] repo = btr3baseball.JobRepository(jobTable) queue = boto3.resource('sqs').get_queue_by_name(QueueName=jobQueue) def submitJob(event, context): # Put i...
apache-2.0
Python
06d0287a8fef0679b281296e6ed76e0b6c803acb
Improve management command to clear or clean kvstore
mariocesar/sorl-thumbnail,perdona/sorl-thumbnail,fdgogogo/sorl-thumbnail,Knotis/sorl-thumbnail,jcupitt/sorl-thumbnail,einvalentin/sorl-thumbnail,fladi/sorl-thumbnail,lampslave/sorl-thumbnail,seedinvest/sorl-thumbnail,guilouro/sorl-thumbnail,TriplePoint-Software/sorl-thumbnail,jazzband/sorl-thumbnail,jcupitt/sorl-thumbn...
sorl/thumbnail/management/commands/thumbnail.py
sorl/thumbnail/management/commands/thumbnail.py
import sys from django.core.management.base import BaseCommand, CommandError from sorl.thumbnail import default class Command(BaseCommand): help = ( u'Handles thumbnails and key value store' ) args = '[cleanup, clear]' option_list = BaseCommand.option_list def handle(self, *labels, **opti...
from django.core.management.base import BaseCommand, CommandError from sorl.thumbnail.conf import settings from sorl.thumbnail import default class Command(BaseCommand): help = ( u'Handles thumbnails and key value store' ) args = '[cleanup, clear]' option_list = BaseCommand.option_list de...
bsd-3-clause
Python
a8805982ff5b92a59d25a28e2acd63af3c210f65
Add brute force sol
bowen0701/algorithms_data_structures
lc0945_minimum_increment_to_make_array_unique.py
lc0945_minimum_increment_to_make_array_unique.py
"""Leetcode 945. Minimum Increment to Make Array Unique Medium URL: https://leetcode.com/problems/minimum-increment-to-make-array-unique/ Given an array of integers A, a move consists of choosing any A[i], and incrementing it by 1. Return the least number of moves to make every value in A unique. Example 1: Input: ...
"""Leetcode 945. Minimum Increment to Make Array Unique Medium URL: https://leetcode.com/problems/minimum-increment-to-make-array-unique/ Given an array of integers A, a move consists of choosing any A[i], and incrementing it by 1. Return the least number of moves to make every value in A unique. Example 1: Input: ...
bsd-2-clause
Python
ca3b1c09705d65307851711dca71714915e4525a
Fix the formatting of log message
apophys/ipaqe-provision-hosts
ipaqe_provision_hosts/__main__.py
ipaqe_provision_hosts/__main__.py
#!/usr/bin/env python from __future__ import print_function import argparse import logging import sys from ipaqe_provision_hosts.runner import create, delete from ipaqe_provision_hosts.errors import IPAQEProvisionerError CONFIG_HELP_MSG = ( 'Configuration file for the topology. Must contain core configuration ...
#!/usr/bin/env python from __future__ import print_function import argparse import logging import sys from ipaqe_provision_hosts.runner import create, delete from ipaqe_provision_hosts.errors import IPAQEProvisionerError CONFIG_HELP_MSG = ( 'Configuration file for the topology. Must contain core configuration ...
mit
Python
01afa5bdbdf1900b5d67ffb6b0bb880d257a1869
Update server.py
carloscadena/http-server,carloscadena/http-server
src/server.py
src/server.py
"""Server for http-server echo assignment.""" import socket # pragma: no cover import sys # pragma: no cover from email.utils import formatdate def server(): # pragma: no cover """ Open the server, waits for input from client. Closes connection on completed message. Closes server with Ctrl-C "...
"""Server for http-server echo assignment.""" import socket # pragma: no cover import sys # pragma: no cover from email.utils import formatdate def server(): # pragma: no cover """ Open the server, waits for input from client. Closes connection on completed message. Closes server with Ctrl-C "...
mit
Python
5c97b9911a2dafde5fd1e4c40cda4e84974eb855
Allow keys to be set (in anticipation of write commands). Better object __repr__() for spaces and tickets.
markfinger/assembla
assembla/lib.py
assembla/lib.py
from functools import wraps class AssemblaObject(object): """ Proxies getitem calls (eg: `instance['id']`) to a dictionary `instance.data['id']`. """ def __init__(self, data): self.data = data def __getitem__(self, key): return self.data[key] def __setitem__(self, key, value)...
from functools import wraps class AssemblaObject(object): """ Proxies getitem calls (eg: `instance['id']`) to a dictionary `instance.data['id']`. """ def __init__(self, data): self.data = data def __getitem__(self, key): return self.data[key] def keys(self): return se...
mit
Python
d013f50b92e968258b14b67ebea9e70b4c35dcb0
Fix completion
iff/dotfiles-old,iff/dotfiles-old
pylibs/ropemode/environment.py
pylibs/ropemode/environment.py
class Environment(object): def ask(self, prompt, default=None, starting=None): pass def ask_values(self, prompt, values, default=None, starting=None): pass def ask_directory(self, prompt, default=None, starting=None): pass def ask_completion(self, prompt, values, starting=Non...
class Environment(object): def ask(self, prompt, default=None, starting=None): pass def ask_values(self, prompt, values, default=None, starting=None): pass def ask_directory(self, prompt, default=None, starting=None): pass def ask_completion(self, prompt, values, starting=Non...
mit
Python
1563c35f10ac4419d6c732e0e25c3d2d62fcd3fd
send all available output to client if are multiple lines available
wilsaj/hey
hey/server.py
hey/server.py
from twisted.internet import protocol, reactor from twisted.internet.endpoints import TCP4ServerEndpoint try: from Queue import Queue, Empty except ImportError: # python 3.x from queue import Queue, Empty class HeyQueueFactory(protocol.Factory, object): def __init__(self, outQueue, *args, **kwargs): ...
from twisted.internet import protocol, reactor from twisted.internet.endpoints import TCP4ServerEndpoint try: from Queue import Queue, Empty except ImportError: # python 3.x from queue import Queue, Empty class HeyQueueFactory(protocol.Factory, object): def __init__(self, outQueue, *args, **kwargs): ...
bsd-2-clause
Python
0dce50c77963ef0d2cdb168f85c2588d62f43220
Remove duplicate import
yunity/yunity-core,yunity/foodsaving-backend,yunity/foodsaving-backend,yunity/yunity-core,yunity/foodsaving-backend
yunity/stores/models.py
yunity/stores/models.py
from config import settings from yunity.base.base_models import BaseModel from django.db import models class PickupDate(BaseModel): date = models.DateTimeField() collectors = models.ManyToManyField(settings.AUTH_USER_MODEL) store = models.ForeignKey('stores.store', related_name='pickupdates', on_delete=mo...
from django.db import models from config import settings from yunity.base.base_models import BaseModel from django.db import models class PickupDate(BaseModel): date = models.DateTimeField() collectors = models.ManyToManyField(settings.AUTH_USER_MODEL) store = models.ForeignKey('stores.store', related_nam...
agpl-3.0
Python
bc63b8f19742277ad96c2427405f1430687430d1
expire jwt in 1 day
saks/hb,saks/hb,saks/hb,saks/hb
hbapi/settings/heroku.py
hbapi/settings/heroku.py
import dj_database_url import os from .base import * DEBUG = False TEMPLATE_DEBUG = DEBUG ADMINS = [('znotdead', 'zhirafchik@gmail.com')] DATABASES['default'] = dj_database_url.config() STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage' STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') STAT...
import dj_database_url import os from .base import * DEBUG = False TEMPLATE_DEBUG = DEBUG ADMINS = [('znotdead', 'zhirafchik@gmail.com')] DATABASES['default'] = dj_database_url.config() STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage' STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') STAT...
mit
Python
cee2368dac250ef9655a3df9af3188b8abd095dc
Disable slow test. Not intended to run.
PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge
spec/puzzle/examples/gph/a_basic_puzzle_spec.py
spec/puzzle/examples/gph/a_basic_puzzle_spec.py
from data import warehouse from puzzle.examples.gph import a_basic_puzzle from puzzle.problems import number_problem from puzzle.puzzlepedia import prod_config from spec.mamba import * with _description('a_basic_puzzle'): with before.all: warehouse.save() prod_config.init() self.subject = a_basic_puzzle....
from data import warehouse from puzzle.examples.gph import a_basic_puzzle from puzzle.problems import number_problem from puzzle.puzzlepedia import prod_config from spec.mamba import * with description('a_basic_puzzle'): with before.all: warehouse.save() prod_config.init() self.subject = a_basic_puzzle.g...
mit
Python
3066f8f64f185624fe95a696d7fcef102dc61921
add galery models
Samael500/helena,Samael500/helena,Samael500/helena
helena/content/models.py
helena/content/models.py
from django.db import models from helpers.service import image_path class ImgWithDescr(models.Model): """ class with genres model """ directory = None def get_image_path(instace, filename): return image_path(instace, filename, directory=self.directory) title = models.CharField(verbose_nam...
from django.db import models from helpers.service import image_path class Genres(models.Model): """ class with genres model """ def get_image_path(instace, filename): return image_path(instace, filename, directory='genres') title = models.CharField(verbose_name='Заголовок', max_length=200) ...
unlicense
Python
a1d3304f993702460077d7f6c70607131aff874b
add fix keyword
IfengAutomation/uitester,IfengAutomation/uitester
libs/player.py
libs/player.py
# @Time : 2016/11/11 11:01 # @Author : lixintong from keywords import keyword, var_cache @keyword('current_activity') def current_activity(acticity_desc): """ :param acticity_desc:video_player or topic_player or live or vr_live or pic_player or local_player :return: """ return var_cache['proxy...
# @Time : 2016/11/11 11:01 # @Author : lixintong from keywords import keyword, var_cache @keyword('current_activity') def current_activity(acticity_desc): """ :param acticity_desc:video_player or topic_player or live or vr_live or pic_player or local_player :return: """ return var_cache['proxy...
apache-2.0
Python
04d0bb5a32b3e1b66c6ac1e27df656aed607c3cb
Test suite: Fix re_util doctest on PyPy
gencer/python-phonenumbers,daviddrysdale/python-phonenumbers,titansgroup/python-phonenumbers,daviddrysdale/python-phonenumbers,daviddrysdale/python-phonenumbers
python/phonenumbers/re_util.py
python/phonenumbers/re_util.py
"""Additional regular expression utilities, to make it easier to sync up with Java regular expression code. >>> import re >>> from .re_util import fullmatch >>> from .util import u >>> string = 'abcd' >>> r1 = re.compile('abcd') >>> r2 = re.compile('bc') >>> r3 = re.compile('abc') >>> fullmatch(r1, string) # doctest:...
"""Additional regular expression utilities, to make it easier to sync up with Java regular expression code. >>> import re >>> from .re_util import fullmatch >>> from .util import u >>> string = 'abcd' >>> r1 = re.compile('abcd') >>> r2 = re.compile('bc') >>> r3 = re.compile('abc') >>> fullmatch(r1, string) # doctest:...
apache-2.0
Python