commit
stringlengths
40
40
old_file
stringlengths
4
236
new_file
stringlengths
4
236
old_contents
stringlengths
1
3.26k
new_contents
stringlengths
16
4.43k
subject
stringlengths
16
624
message
stringlengths
17
3.29k
lang
stringclasses
5 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
aefa8a3d6d4c809c7e470b22a0c9fb2c0875ba8b
project/project/urls.py
project/project/urls.py
from django.conf import settings from django.conf.urls import include, url from django.contrib import admin from django.conf.urls.static import static from django.contrib.auth import views urlpatterns = [ url( r'^silk/', include('silk.urls', namespace='silk', app_name='silk') ), url( ...
from django.conf import settings from django.conf.urls import include, url from django.contrib import admin from django.conf.urls.static import static from django.contrib.auth import views urlpatterns = [ url( r'^silk/', include('silk.urls', namespace='silk') ), url( r'^exampl...
Remove unneeded app_name from test project to be django 2 compatible
Remove unneeded app_name from test project to be django 2 compatible
Python
mit
crunchr/silk,mtford90/silk,jazzband/silk,crunchr/silk,mtford90/silk,jazzband/silk,crunchr/silk,django-silk/silk,django-silk/silk,jazzband/silk,django-silk/silk,crunchr/silk,mtford90/silk,jazzband/silk,mtford90/silk,django-silk/silk
aae29a385129e6a1573fac2c631eff8db8ea3079
stackdio/stackdio/__init__.py
stackdio/stackdio/__init__.py
# -*- coding: utf-8 -*- # Copyright 2014, Digital Reasoning # # 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 applica...
# -*- coding: utf-8 -*- # Copyright 2014, Digital Reasoning # # 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 applica...
Print a more useful warning message
Print a more useful warning message
Python
apache-2.0
stackdio/stackdio,clarkperkins/stackdio,stackdio/stackdio,clarkperkins/stackdio,clarkperkins/stackdio,clarkperkins/stackdio,stackdio/stackdio,stackdio/stackdio
067bbbc6c9edbf55606fe6f236c70affd86a1fc0
tests/convert/test_unit.py
tests/convert/test_unit.py
from unittest.mock import patch from smif.convert.unit import parse_unit def test_parse_unit_valid(): """Parse a valid unit """ meter = parse_unit('m') assert str(meter) == 'meter' @patch('smif.convert.unit.LOGGER.warning') def test_parse_unit_invalid(warning_logger): """Warn if unit not recogni...
import numpy as np from unittest.mock import patch from smif.convert.unit import parse_unit from smif.convert import UnitConvertor def test_parse_unit_valid(): """Parse a valid unit """ meter = parse_unit('m') assert str(meter) == 'meter' @patch('smif.convert.unit.LOGGER.warning') def test_parse_uni...
Add test for normal unit conversion
Add test for normal unit conversion
Python
mit
tomalrussell/smif,tomalrussell/smif,nismod/smif,nismod/smif,tomalrussell/smif,nismod/smif,nismod/smif,willu47/smif,willu47/smif,willu47/smif,willu47/smif,tomalrussell/smif
c56a6c2f861d50d2bdc38ee33d30e4ef614a2de0
tests/sim/test_entities.py
tests/sim/test_entities.py
import unittest from hunting.sim.entities import * class TestFighter(unittest.TestCase): def test_minimum_speed_is_one(self): self.assertEqual(Fighter(1, 1, 1, 1, base_speed=-5).speed, 1) self.assertEqual(Fighter(1, 1, 1, 1, base_speed=0).speed, 1)
import unittest from hunting.sim.entities import * class TestPropertyEffect(unittest.TestCase): def setUp(self): self.fighter = Fighter(100, 100, 100, 0, base_speed=100) def test_add_remove_power(self): power_buff = PropertyEffect(PROPERTY_POWER, value=100) self.fighter.add_effect(po...
Add failing tests for buffs
Add failing tests for buffs
Python
mit
MoyTW/RL_Arena_Experiment
51660291b043b88eab599c59d8c1ef7ae9dc74d7
src/core/models.py
src/core/models.py
from django.db import models from django.contrib.auth.models import User from util.session import get_or_generate_session_name class Session(models.Model): name = models.CharField(max_length=255) user = models.ForeignKey(User, blank=True, null=True) started_at = models.DateTimeField('started at', auto_now...
from django.db import models from django.contrib.auth.models import User from util.session import get_or_generate_session_name from util.session import DEFAULT_SESSION_NAME_PREFIX class Session(models.Model): name = models.CharField(max_length=255) user = models.ForeignKey(User, blank=True, null=True) sta...
Use the existing default name.
Use the existing default name.
Python
mit
uxebu/tddbin-backend,uxebu/tddbin-backend
9c6f3e1994f686e57092a7cd947c49b4f857743e
apps/predict/urls.py
apps/predict/urls.py
""" Predict app's urls """ # # pylint: disable=bad-whitespace # from django.conf.urls import patterns, include, url from .views import * def url_tree(regex, *urls): """Quick access to stitching url patterns""" return url(regex, include(patterns('', *urls))) urlpatterns = patterns('', url(r'^$', Datasets.as...
""" Predict app's urls """ # # pylint: disable=bad-whitespace # from django.conf.urls import patterns, include, url from .views import * def url_tree(regex, *urls): """Quick access to stitching url patterns""" return url(regex, include(patterns('', *urls))) urlpatterns = patterns('', url(r'^$', Datasets.as...
Remove callback url and bring uploads together
Remove callback url and bring uploads together
Python
agpl-3.0
IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site
a077a5b7731e7d609b5c3adc8f8176ad79053f17
rmake/lib/twisted_extras/tools.py
rmake/lib/twisted_extras/tools.py
# # Copyright (c) SAS Institute Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
# # Copyright (c) SAS Institute Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
Fix Serializer locking bug that caused it to skip calls it should have made
Fix Serializer locking bug that caused it to skip calls it should have made
Python
apache-2.0
sassoftware/rmake3,sassoftware/rmake3,sassoftware/rmake3
42e16bf376a64995a8b70a91829a82d7b0f3e1a1
gameanalysis/__main__.py
gameanalysis/__main__.py
"""Command line module""" import argparse import pkgutil import sys import gameanalysis from gameanalysis import script def create_parser(): """Create the default parser""" modules = [imp.find_module(name).load_module(name) for imp, name, _ in pkgutil.iter_modules(script.__path__)] parser ...
"""Command line module""" import argparse import logging import pkgutil import sys import gameanalysis from gameanalysis import script def create_parser(): """Create the default parser""" modules = [imp.find_module(name).load_module(name) for imp, name, _ in pkgutil.iter_modules(script.__path_...
Add logging verbosity to game analysis
Add logging verbosity to game analysis
Python
apache-2.0
egtaonline/GameAnalysis
f5d0f8cd145c759cff6d5f6cfeb46459efaa63ca
sale_line_description/__openerp__.py
sale_line_description/__openerp__.py
# -*- coding: utf-8 -*- # # # Copyright (C) 2013-15 Agile Business Group sagl # (<http://www.agilebg.com>) # # 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 ...
# -*- coding: utf-8 -*- # # # Copyright (C) 2013-15 Agile Business Group sagl # (<http://www.agilebg.com>) # # 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 ...
Remove active key since is deprecated
Remove active key since is deprecated
Python
agpl-3.0
anas-taji/sale-workflow,brain-tec/sale-workflow,luistorresm/sale-workflow,factorlibre/sale-workflow,BT-fgarbely/sale-workflow,adhoc-dev/sale-workflow,jjscarafia/sale-workflow,richard-willowit/sale-workflow,VitalPet/sale-workflow,akretion/sale-workflow,ddico/sale-workflow,fevxie/sale-workflow,xpansa/sale-workflow,Endika...
c6926dda0a9e6e1515721e54788c29d0ef8b58a4
tests/test_sqlcompletion.py
tests/test_sqlcompletion.py
from pgcli.packages.sqlcompletion import suggest_type def test_select_suggests_cols_with_table_scope(): suggestion = suggest_type('SELECT FROM tabl', 'SELECT ') assert suggestion == ('columns-and-functions', ['tabl']) def test_lparen_suggest_cols(): suggestion = suggest_type('SELECT MAX( FROM tbl', 'SEL...
from pgcli.packages.sqlcompletion import suggest_type def test_select_suggests_cols_with_table_scope(): suggestion = suggest_type('SELECT FROM tabl', 'SELECT ') assert suggestion == ('columns-and-functions', ['tabl']) def test_where_suggests_columns_functions(): suggestion = suggest_type('SELECT * FROM ...
Add a test for where clause and rename all tests functions.
Add a test for where clause and rename all tests functions.
Python
bsd-3-clause
thedrow/pgcli,d33tah/pgcli,n-someya/pgcli,bitmonk/pgcli,joewalnes/pgcli,yx91490/pgcli,TamasNo1/pgcli,MattOates/pgcli,TamasNo1/pgcli,j-bennet/pgcli,lk1ngaa7/pgcli,zhiyuanshi/pgcli,koljonen/pgcli,dbcli/vcli,dbcli/pgcli,lk1ngaa7/pgcli,dbcli/pgcli,j-bennet/pgcli,suzukaze/pgcli,janusnic/pgcli,darikg/pgcli,johshoff/pgcli,nos...
52982c735f729ddf0a9c020d495906c4a4899462
txircd/modules/rfc/umode_i.py
txircd/modules/rfc/umode_i.py
from twisted.plugin import IPlugin from txircd.module_interface import IMode, IModuleData, Mode, ModuleData from txircd.utils import ModeType from zope.interface import implements class InvisibleMode(ModuleData, Mode): implements(IPlugin, IModuleData, IMode) name = "InvisibleMode" core = True affe...
from twisted.plugin import IPlugin from txircd.module_interface import IMode, IModuleData, Mode, ModuleData from txircd.utils import ModeType from zope.interface import implements class InvisibleMode(ModuleData, Mode): implements(IPlugin, IModuleData, IMode) name = "InvisibleMode" core = True affe...
Make the invisible check action not necessarily require an accompanying channel
Make the invisible check action not necessarily require an accompanying channel
Python
bsd-3-clause
Heufneutje/txircd,ElementalAlchemist/txircd
c447ca3d85d9862be38034be85b2328e3d6b02a3
vcproj/tests/test_solution.py
vcproj/tests/test_solution.py
import vcproj.solution import tempfile, filecmp import pytest @pytest.fixture(scope="session") def test_sol(): return vcproj.solution.parse('vcproj/tests/test_solution/vc15sol/vc15sol.sln') def test_all_projects(test_sol): projects = test_sol.project_names() len(list(projects)) == 59 def test_project_n...
import vcproj.solution import tempfile, filecmp import pytest @pytest.fixture(scope="session") def test_sol(): return vcproj.solution.parse('vcproj/tests/test_solution/test.sln') def test_project_files(test_sol): assert list(test_sol.project_files()) == ['test\\test.vcxproj', 'lib1\\lib1.vcxproj', 'lib2\\lib2...
Add back in test of 2010 solution
Add back in test of 2010 solution
Python
unlicense
jhandley/pyvcproj,jhandley/pyvcproj,jhandley/pyvcproj
fb91bf1e7c1677124f4aa1ce9c534fb437145980
pygametemplate/helper.py
pygametemplate/helper.py
"""Module containing helper functions for using pygame.""" def load_class_assets(calling_object, assets_dict): """Load class assets. Only call if class_assets_loaded is False.""" calling_class = type(calling_object) for attribute_name in assets_dict: setattr(calling_class, attribute_name, assets_dic...
"""Module containing helper functions for using pygame.""" def load_class_assets(calling_object, assets_dict): """Load class assets. Only call if class_assets_loaded is False.""" calling_class = type(calling_object) for attribute_name in assets_dict: setattr(calling_class, attribute_name, assets_dic...
Replace % with f-string :)
Replace % with f-string :)
Python
mit
AndyDeany/pygame-template
b57d0b0d3d65995270318d94b551d8bacda73d22
baseline.py
baseline.py
#/usr/bin/python """ Baseline example that needs to be beaten """ import numpy as np import matplotlib.pyplot as plt x, y, yerr = np.loadtxt("data/data.txt", unpack=True) A = np.vstack((np.ones_like(x), x)).T C = np.diag(yerr * yerr) cov = np.linalg.inv(np.dot(A.T, np.linalg.solve(C, A))) b_ls, m_ls = np.dot(cov, n...
#/usr/bin/python """ Baseline example that needs to be beaten """ import os import numpy as np import matplotlib.pyplot as plt x, y, yerr = np.loadtxt("data/data.txt", unpack=True) A = np.vstack((np.ones_like(x), x)).T C = np.diag(yerr * yerr) cov = np.linalg.inv(np.dot(A.T, np.linalg.solve(C, A))) b_ls, m_ls = np....
Add results to environment parameters RESULT_M, RESULT_B
Add results to environment parameters RESULT_M, RESULT_B
Python
mit
arfon/dottravis,arfon/dottravis
b960962472f1c40fbaa1338d2cba316810ba119b
tt_dailyemailblast/admin.py
tt_dailyemailblast/admin.py
from django.contrib import admin from django.db import models as django_models from tinymce.widgets import TinyMCE from .models import (Recipient, RecipientList, DailyEmailBlast, DailyEmailBlastType) def send_blasts(model_admin, request, qs): for blast in qs: print blast.send() class RecipientI...
from django.contrib import admin from django.db import models as django_models from tinymce.widgets import TinyMCE from .models import (Recipient, RecipientList, DailyEmailBlast, DailyEmailBlastType) def send_blasts(model_admin, request, qs): for blast in qs: print blast.send() class RecipientI...
Include all dates in blast list display
Include all dates in blast list display
Python
apache-2.0
texastribune/tt_dailyemailblast,texastribune/tt_dailyemailblast
ef404dad280ec2f7317e0176d3e91b20d1bbe7c0
inbox/notify/__init__.py
inbox/notify/__init__.py
from redis import StrictRedis, BlockingConnectionPool from inbox.config import config import json REDIS_HOSTNAME = config.get('NOTIFY_QUEUE_REDIS_HOSTNAME') REDIS_DB = int(config.get('NOTIFY_QUEUE_REDIS_DB')) MAX_CONNECTIONS = 40 redis_pool = BlockingConnectionPool( max_connections=MAX_CONNECTIONS, host=REDI...
import json from redis import StrictRedis, BlockingConnectionPool from inbox.config import config from nylas.logging import get_logger log = get_logger() REDIS_HOSTNAME = config.get('NOTIFY_QUEUE_REDIS_HOSTNAME') REDIS_PORT = int(config.get('NOTIFY_QUEUE_REDIS_PORT', 6379)) REDIS_DB = int(config.get('NOTIFY_QUEUE_REDI...
Add logger an try/except logic
Add logger an try/except logic
Python
agpl-3.0
jobscore/sync-engine,jobscore/sync-engine,jobscore/sync-engine,jobscore/sync-engine
45261d57bdb1ee23c84ea6c5d83550b7e84c26f1
highlander/highlander.py
highlander/highlander.py
from functools import wraps from logging import getLogger from os import getcwd, unlink from os.path import join, realpath, isfile from psutil import Process logger = getLogger(__name__) def one(f): @wraps(f) def decorator(): pid_file = realpath(join(getcwd(), '.pid')) if _is_running(pid_fi...
from functools import wraps from logging import getLogger from os import getcwd, unlink from os.path import join, realpath, isfile from psutil import Process logger = getLogger(__name__) def one(f): @wraps(f) def decorator(): pid_file = realpath(join(getcwd(), '.pid')) if _is_running(pid_fi...
Check to make sure the file doesn't exist if we get to the set running state.
Check to make sure the file doesn't exist if we get to the set running state.
Python
mit
chriscannon/highlander
3d1612e5f9e20cf74a962dd4ca1b538776d5ec7e
StationPopWithoutTrain.py
StationPopWithoutTrain.py
def before_train_station_pop(station, escalator): # calculate the number of people waiting to depart on the train by the time the train arive. station.travelers_departing = station.travelers_departing + (escalator.rate * escalators.entering * station.train_wait) # number of people who have arived and want t...
"""This module calculates the number of people in the station by the time the next train arives""" def before_train_station_pop(station, escalator): """This function calculates the total number of people as a sume of people waiting to board the next train, and the number of people waiting to leave the stat...
Simplify the function to calculate the platform population between trains
Simplify the function to calculate the platform population between trains The function to calculate the change in platform population in the time between trains was needlessly complex. It has now been simplified. ref #17
Python
mit
ForestPride/rail-problem
b3befb47d4b48e83b42fc6b10a10269d32cafb4e
src-backend/api/urls.py
src-backend/api/urls.py
from django.conf.urls import url, include from views import ProcedureViewSet from rest_framework import routers router = routers.SimpleRouter() router.register(r'procedures', ProcedureViewSet) urlpatterns = [ url(r'^', include(router.urls)) ]
from django.conf.urls import url, include from views import ProcedureViewSet from rest_framework import routers router = routers.SimpleRouter(trailing_slash=False) router.register(r'procedures', ProcedureViewSet) urlpatterns = [ url(r'^', include(router.urls)) ]
Remove trailing slash from the router
Remove trailing slash from the router
Python
bsd-3-clause
SanaMobile/sana.protocol_builder,SanaMobile/sana.protocol_builder,SanaMobile/sana.protocol_builder,SanaMobile/sana.protocol_builder,SanaMobile/sana.protocol_builder
c40fc13dca5a0596a72d5c26214777f8a2845675
tests/test_repr.py
tests/test_repr.py
""" Test __str__ methods. """ import pexpect from . import PexpectTestCase class TestCaseMisc(PexpectTestCase.PexpectTestCase): def test_str_spawnu(self): """ Exercise spawnu.__str__() """ # given, p = pexpect.spawnu('cat') # exercise, value = p.__str__() # verify ...
""" Test __str__ methods. """ import pexpect from . import PexpectTestCase class TestCaseMisc(PexpectTestCase.PexpectTestCase): def test_str_spawnu(self): """ Exercise spawnu.__str__() """ # given, p = pexpect.spawnu('cat') # exercise, value = str(p) # verify ...
Use str(p) and not p.__str__()
Use str(p) and not p.__str__()
Python
isc
bangi123/pexpect,Depado/pexpect,dongguangming/pexpect,Depado/pexpect,quatanium/pexpect,Wakeupbuddy/pexpect,Wakeupbuddy/pexpect,Depado/pexpect,crdoconnor/pexpect,crdoconnor/pexpect,quatanium/pexpect,nodish/pexpect,quatanium/pexpect,crdoconnor/pexpect,dongguangming/pexpect,Wakeupbuddy/pexpect,Wakeupbuddy/pexpect,Depado/p...
6110bc1137f5e3f1f12249c366323c6c0b48dbe3
IPython/nbconvert/utils/base.py
IPython/nbconvert/utils/base.py
"""Global configuration class.""" #----------------------------------------------------------------------------- # Copyright (c) 2013, the IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. #------------...
"""Global configuration class.""" #----------------------------------------------------------------------------- # Copyright (c) 2013, the IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. #------------...
Revert "Moved JS in front of HTML"
Revert "Moved JS in front of HTML" This reverts commit 8b0164edde418138d4e28c20d63fa422931ae6a8.
Python
bsd-3-clause
ipython/ipython,ipython/ipython
9a6467688f567abc405a3fca6c4bfda7b6cd0351
FileWatcher.py
FileWatcher.py
from watchdog.observers import Observer from watchdog.events import FileSystemEventHandler import os class MyEventHandler(FileSystemEventHandler): def __init__(self, filePath, callback): super(MyEventHandler, self).__init__() self.filePath = filePath self.callback = callback def on_m...
from watchdog.observers import Observer from watchdog.events import FileSystemEventHandler import os class MyEventHandler(FileSystemEventHandler): def __init__(self, filePath, callback): super(MyEventHandler, self).__init__() self.filePath = filePath self.callback = callback def on_m...
Handle filepaths in an OS independent manner.
Handle filepaths in an OS independent manner. --CAR
Python
apache-2.0
BBN-Q/PyQLab,calebjordan/PyQLab,Plourde-Research-Lab/PyQLab,rmcgurrin/PyQLab
b50ef13cb25c795a1ad3b2bfdbbb47b709fcbd39
binding/python/__init__.py
binding/python/__init__.py
# This file is part of SpaceVecAlg. # # SpaceVecAlg is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # SpaceVecAlg is distribut...
# This file is part of RBDyn. # # RBDyn is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # RBDyn is distributed in the hope tha...
Fix bad copy/past in licence header.
Fix bad copy/past in licence header.
Python
bsd-2-clause
jrl-umi3218/RBDyn,jrl-umi3218/RBDyn,gergondet/RBDyn,jrl-umi3218/RBDyn,gergondet/RBDyn,gergondet/RBDyn,jrl-umi3218/RBDyn,gergondet/RBDyn,gergondet/RBDyn
c1e5822f07e2fe4ca47633ed3dfda7d7bee64b6c
nvchecker/source/aiohttp_httpclient.py
nvchecker/source/aiohttp_httpclient.py
# MIT licensed # Copyright (c) 2013-2017 lilydjwg <lilydjwg@gmail.com>, et al. import atexit import aiohttp connector = aiohttp.TCPConnector(limit=20) __all__ = ['session', 'HTTPError'] class HTTPError(Exception): def __init__(self, code, message, response): self.code = code self.message = messag...
# MIT licensed # Copyright (c) 2013-2017 lilydjwg <lilydjwg@gmail.com>, et al. import atexit import asyncio import aiohttp connector = aiohttp.TCPConnector(limit=20) __all__ = ['session', 'HTTPError'] class HTTPError(Exception): def __init__(self, code, message, response): self.code = code self.m...
Handle graceful exit and timeout
Handle graceful exit and timeout Timeout was refactored and the defaults work correctly here.
Python
mit
lilydjwg/nvchecker
3856b48af3e83f49a66c0c29b81e0a80ad3248d9
nubes/connectors/aws/connector.py
nubes/connectors/aws/connector.py
import boto3.session from nubes.connectors import base class AWSConnector(base.BaseConnector): def __init__(self, aws_access_key_id, aws_secret_access_key, region_name): self.connection = boto3.session.Session( aws_access_key_id=aws_access_key_id, aws_secret_access_key=aws_secret...
import boto3.session from nubes.connectors import base class AWSConnector(base.BaseConnector): def __init__(self, aws_access_key_id, aws_secret_access_key, region_name): self.connection = boto3.session.Session( aws_access_key_id=aws_access_key_id, aws_secret_access_key=aws_secret...
Move client and resource to __init__
Move client and resource to __init__ * moved the calls to create the ec2 session resource session client to the init
Python
apache-2.0
omninubes/nubes
770bbf80a78d2f418e47ca2dc641c7dccbb86cac
rollbar/test/asgi_tests/helper.py
rollbar/test/asgi_tests/helper.py
import asyncio import functools from rollbar.contrib.asgi import ASGIApp def async_test_func_wrapper(asyncfunc): @functools.wraps(asyncfunc) def wrapper(*args, **kwargs): try: loop = asyncio.get_running_loop() except RuntimeError: loop = asyncio.new_event_loop() ...
import asyncio import functools import inspect import sys from rollbar.contrib.asgi import ASGIApp def run(coro): if sys.version_info >= (3, 7): return asyncio.run(coro) assert inspect.iscoroutine(coro) loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) try: return loo...
Refactor async wrapper. Use asyncio.run() for Py3.7
Refactor async wrapper. Use asyncio.run() for Py3.7
Python
mit
rollbar/pyrollbar
c32e87894d4baf404d5b300459fc68a6d9d973c8
zun/db/__init__.py
zun/db/__init__.py
# Copyright 2015 NEC Corporation. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
# Copyright 2015 NEC Corporation. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
Remove the duplicated config sqlite_db
Remove the duplicated config sqlite_db The config sqlite_db has been removed from oslo.db. See here: https://review.openstack.org/#/c/449437/ Change-Id: I9197b08aeb7baabf2d3fdd4cf4bd06b57a6782ff
Python
apache-2.0
kevin-zhaoshuai/zun,kevin-zhaoshuai/zun,kevin-zhaoshuai/zun
b8ac8edbd12c6b021815e4fa4fd68cfee7dc18cf
frigg/builds/api.py
frigg/builds/api.py
# -*- coding: utf8 -*- import json from django.http import HttpResponse, Http404 from django.http.response import JsonResponse from django.shortcuts import get_object_or_404 from django.views.decorators.csrf import csrf_exempt from frigg.decorators import token_required from .models import Build, Project @token_req...
# -*- coding: utf8 -*- import json from django.http import HttpResponse, Http404 from django.http.response import JsonResponse from django.shortcuts import get_object_or_404 from django.views.decorators.cache import never_cache from django.views.decorators.csrf import csrf_exempt from frigg.decorators import token_re...
Add @never_cache decorator to the badge view
Add @never_cache decorator to the badge view
Python
mit
frigg/frigg-hq,frigg/frigg-hq,frigg/frigg-hq
04b7e79ce3fed1afac129098badb632ca226fdee
dispatch.py
dispatch.py
#!/usr/bin/env python """ Copyright (c) 2008-2011, Anthony Garcia <lagg@lavabit.com> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVID...
#!/usr/bin/env python """ Copyright (c) 2008-2011, Anthony Garcia <lagg@lavabit.com> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVID...
Add wsgi handler by default
Add wsgi handler by default
Python
isc
Lagg/optf2,FlaminSarge/optf2,Lagg/optf2,FlaminSarge/optf2,Lagg/optf2,FlaminSarge/optf2
67255ac86d2ef91ce355655112c919f2e08045b4
django_uwsgi/urls.py
django_uwsgi/urls.py
from django.conf.urls import patterns, url from . import views urlpatterns = [ url(r'^$', views.UwsgiStatus.as_view(), name='uwsgi_index'), url(r'^reload/$', views.UwsgiReload.as_view(), name='uwsgi_reload'), url(r'^clear_cache/$', views.UwsgiCacheClear.as_view(), name='uwsgi_cache_clear'), ]
from django.conf.urls import url from . import views urlpatterns = [ url(r'^$', views.UwsgiStatus.as_view(), name='uwsgi_index'), url(r'^reload/$', views.UwsgiReload.as_view(), name='uwsgi_reload'), url(r'^clear_cache/$', views.UwsgiCacheClear.as_view(), name='uwsgi_cache_clear'), ]
Remove usage of patterns in import line
Remove usage of patterns in import line
Python
mit
unbit/django-uwsgi,unbit/django-uwsgi
b2cac05be3f6c510edfaf1ae478fabdcf06fd19a
mgsv_names.py
mgsv_names.py
import random global adjectives, animals, rares with open('adjectives.txt') as f: adjectives = f.readlines() with open('animals.txt') as f: animals = f.readlines() with open('rares.txt') as f: rares = f.readlines() uncommons = { # Adjectives: 'master': 'miller', 'raging': 'bull'...
import random, os global adjectives, animals, rares with open(os.path.join(os.path.dirname(__file__), 'adjectives.txt')) as f: adjectives = f.readlines() with open(os.path.join(os.path.dirname(__file__), 'animals.txt')) as f: animals = f.readlines() with open(os.path.join(os.path.dirname(__file__), 'rares.t...
Load text files from the same dir as the script.
Load text files from the same dir as the script. Also renamed our name generator.
Python
unlicense
rotated8/mgsv_names
40edd4a635dd8f83a21f15f22883e7dae8d8d0a8
test/test_modes/test_backspace.py
test/test_modes/test_backspace.py
from pyqode.qt import QtCore from pyqode.qt.QtTest import QTest from pyqode.core.api import TextHelper from pyqode.core import modes from test.helpers import editor_open def get_mode(editor): return editor.modes.get(modes.SmartBackSpaceMode) def test_enabled(editor): mode = get_mode(editor) assert mode....
from pyqode.qt import QtCore from pyqode.qt.QtTest import QTest from pyqode.core.api import TextHelper from pyqode.core import modes from test.helpers import editor_open def get_mode(editor): return editor.modes.get(modes.SmartBackSpaceMode) def test_enabled(editor): mode = get_mode(editor) assert mode....
Fix test backspace (this test has to be changed since the parent implementation is now called when there is no space to eat)
Fix test backspace (this test has to be changed since the parent implementation is now called when there is no space to eat)
Python
mit
pyQode/pyqode.core,zwadar/pyqode.core,pyQode/pyqode.core
e68836173dec1e1fe80e07cca8eb67ebe19e424e
cegui/src/ScriptingModules/PythonScriptModule/bindings/distutils/PyCEGUI/__init__.py
cegui/src/ScriptingModules/PythonScriptModule/bindings/distutils/PyCEGUI/__init__.py
import os import os.path # atrocious and unholy! def get_my_path(): import fake return os.path.dirname(str(fake).split()[3][1:]) libpath = os.path.abspath(get_my_path()) #print "libpath =", libpath os.environ['PATH'] = libpath + ";" + os.environ['PATH'] from PyCEGUI import *
import os import os.path # atrocious and unholy! def get_my_path(): import fake return os.path.dirname(os.path.abspath(fake.__file__)) libpath = get_my_path() #print "libpath =", libpath os.environ['PATH'] = libpath + ";" + os.environ['PATH'] from PyCEGUI import *
Use a less pathetic method to retrieve the PyCEGUI dirname
MOD: Use a less pathetic method to retrieve the PyCEGUI dirname
Python
mit
ruleless/CEGUI,OpenTechEngine/CEGUI,ruleless/CEGUI,ruleless/CEGUI,ruleless/CEGUI,OpenTechEngine/CEGUI,OpenTechEngine/CEGUI,OpenTechEngine/CEGUI
cd30723af9f82b7a91d1ad1e2a5b86f88d8f4b17
harvester/post_processing/dedup_sourceresource.py
harvester/post_processing/dedup_sourceresource.py
# pass in a Couchdb doc, get back one with de-duplicated sourceResource values def dedup_sourceresource(doc): ''' Look for duplicate values in the doc['sourceResource'] and remove. Values must be *exactly* the same ''' for key, value in doc['sourceResource'].items(): if not isinstance(val...
# pass in a Couchdb doc, get back one with de-duplicated sourceResource values def dedup_sourceresource(doc): ''' Look for duplicate values in the doc['sourceResource'] and remove. Values must be *exactly* the same ''' for key, value in doc['sourceResource'].items(): if isinstance(value, ...
Make sure dedup item is a list.
Make sure dedup item is a list.
Python
bsd-3-clause
barbarahui/harvester,ucldc/harvester,ucldc/harvester,mredar/harvester,mredar/harvester,barbarahui/harvester
b98bd25a8b25ca055ca92393f24b6a04382457a8
forms.py
forms.py
from flask_wtf import FlaskForm from wtforms import StringField, PasswordField from wtforms.validators import DataRequired, Email class Login(FlaskForm): username = StringField('Username', validators=[DataRequired()]) password = PasswordField('Password', validators=[DataRequired()])
from flask import flash from flask_wtf import FlaskForm from wtforms import StringField, PasswordField from wtforms.validators import DataRequired, Email, Length def flash_errors(form): """ Universal interface to handle form error. Handles form error with the help of flash message """ for field, error...
Add universal interface for validation error message
Add universal interface for validation error message
Python
mit
openedoo/module_employee,openedoo/module_employee,openedoo/module_employee
1af120a5ce7f2fc35aeb7e77a747b0e8382bba51
api_tests/utils.py
api_tests/utils.py
from blinker import ANY from urlparse import urlparse from contextlib import contextmanager from addons.osfstorage import settings as osfstorage_settings def create_test_file(node, user, filename='test_file', create_guid=True): osfstorage = node.get_addon('osfstorage') root_node = osfstorage.get_root() te...
from blinker import ANY from urlparse import urlparse from contextlib import contextmanager from addons.osfstorage import settings as osfstorage_settings def create_test_file(target, user, filename='test_file', create_guid=True): osfstorage = target.get_addon('osfstorage') root_node = osfstorage.get_root() ...
Update api test util to create files to use target name instead
Update api test util to create files to use target name instead
Python
apache-2.0
mattclark/osf.io,cslzchen/osf.io,HalcyonChimera/osf.io,mfraezz/osf.io,mattclark/osf.io,CenterForOpenScience/osf.io,aaxelb/osf.io,adlius/osf.io,pattisdr/osf.io,pattisdr/osf.io,CenterForOpenScience/osf.io,brianjgeiger/osf.io,cslzchen/osf.io,Johnetordoff/osf.io,mattclark/osf.io,mfraezz/osf.io,mfraezz/osf.io,cslzchen/osf.i...
21dbb8af7412c04b768a9d68e1f8566786d5100c
mdot_rest/serializers.py
mdot_rest/serializers.py
from .models import Resource, ResourceLink, IntendedAudience from rest_framework import serializers class ResourceLinkSerializer(serializers.ModelSerializer): class Meta: model = ResourceLink fields = ('link_type', 'url',) class IntendedAudienceSerializer(serializers.ModelSerializer): class ...
from .models import Resource, ResourceLink, IntendedAudience from rest_framework import serializers class ResourceLinkSerializer(serializers.ModelSerializer): class Meta: model = ResourceLink fields = ('link_type', 'url',) class IntendedAudienceSerializer(serializers.ModelSerializer): class ...
Add image field to the resource serialization.
Add image field to the resource serialization.
Python
apache-2.0
uw-it-aca/mdot-rest,uw-it-aca/mdot-rest
f7c9bbd5ac49254d564a56ba3713b55abcfa4079
byceps/blueprints/news/views.py
byceps/blueprints/news/views.py
# -*- coding: utf-8 -*- """ byceps.blueprints.news.views ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :Copyright: 2006-2016 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from flask import abort, g from ...services.news import service as news_service from ...util.framework import create_blueprint from .....
# -*- coding: utf-8 -*- """ byceps.blueprints.news.views ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :Copyright: 2006-2016 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from flask import abort, current_app, g from ...services.news import service as news_service from ...util.framework import create_blue...
Allow configuration of the number of news items per page
Allow configuration of the number of news items per page
Python
bsd-3-clause
homeworkprod/byceps,homeworkprod/byceps,m-ober/byceps,m-ober/byceps,m-ober/byceps,homeworkprod/byceps
5352e164b38099cbc7fe4eba87c00bc1c1d30d44
bluezero/eddystone.py
bluezero/eddystone.py
""" Level 1 file for creating Eddystone beacons """ from bluezero import tools from bluezero import broadcaster class EddystoneURL: def __init__(self, url): service_data = tools.url_to_advert(url, 0x10, 0x00) url_beacon = broadcaster.Beacon() url_beacon.add_service_data('FEAA', service_dat...
""" Level 1 file for creating Eddystone beacons """ from bluezero import tools from bluezero import broadcaster class EddystoneURL: def __init__(self, url, tx_power=0x08): """ The Eddystone-URL frame broadcasts a URL using a compressed encoding format in order to fit more within the limite...
Test for URL length error
Test for URL length error
Python
mit
ukBaz/python-bluezero,ukBaz/python-bluezero
8d229401ea69799638d8cd005bc4dc87bb4327a4
src/mist/io/tests/MyRequestsClass.py
src/mist/io/tests/MyRequestsClass.py
import requests class MyRequests(object): """ Simple class to make requests with or withour cookies etc. This way we can have the same request methods both in io and core """ def __init__(self, uri, data=None, cookie=None, timeout=None): self.headers = {'Cookie': cookie} self.time...
import requests class MyRequests(object): """ Simple class to make requests with or withour cookies etc. This way we can have the same request methods both in io and core """ def __init__(self, uri, data=None, cookie=None, timeout=None, csrf=None): self.headers = {'Cookie': cookie, 'Csrf-...
Add csrf token in MyRequests class
Add csrf token in MyRequests class
Python
agpl-3.0
kelonye/mist.io,munkiat/mist.io,Lao-liu/mist.io,DimensionDataCBUSydney/mist.io,afivos/mist.io,DimensionDataCBUSydney/mist.io,afivos/mist.io,Lao-liu/mist.io,DimensionDataCBUSydney/mist.io,kelonye/mist.io,zBMNForks/mist.io,Lao-liu/mist.io,johnnyWalnut/mist.io,munkiat/mist.io,DimensionDataCBUSydney/mist.io,Lao-liu/mist.io...
6dceb819f86fd469a4d817dec0156646a5f574cf
matchzoo/data_generator/callbacks/lambda_callback.py
matchzoo/data_generator/callbacks/lambda_callback.py
from matchzoo.data_generator.callbacks.callback import Callback class LambdaCallback(Callback): """ LambdaCallback. Just a shorthand for creating a callback class. See :class:`matchzoo.data_generator.callbacks.Callback` for more details. Example: >>> from matchzoo.data_generator.callbacks im...
from matchzoo.data_generator.callbacks.callback import Callback class LambdaCallback(Callback): """ LambdaCallback. Just a shorthand for creating a callback class. See :class:`matchzoo.data_generator.callbacks.Callback` for more details. Example: >>> import matchzoo as mz >>> from m...
Update data generator lambda callback docs.
Update data generator lambda callback docs.
Python
apache-2.0
faneshion/MatchZoo,faneshion/MatchZoo
73e4f2c333e7b4f02dbb0ec344a3a671ba97cac3
library-examples/read-replace-export-excel.py
library-examples/read-replace-export-excel.py
""" Proto type that does the following: input:Excel file in language A output 1:Copy of input file, with original strings replaced with serial numbers output 2:Single xlsx file that contains serial numbers and original texts from input file. """ import shutil from openpyxl import load_workbook, Workbook shutil.copy...
""" Proto type that does the following: input:Excel file in language A output 1:Copy of input file, with original strings replaced with serial numbers output 2:Single xlsx file that contains serial numbers and original texts from input file. """ import shutil from openpyxl import load_workbook, Workbook #point to t...
Change so original input does not change.
Change so original input does not change.
Python
apache-2.0
iku000888/Excel_Translation_Helper
23d4081392f84f2d5359f44ed4dde41611bb4cd2
tests/race_deleting_keys_test.py
tests/race_deleting_keys_test.py
import nose.plugins.attrib import time as _time import subprocess import sys import redisdl import unittest import json import os.path from . import util from . import big_data @nose.plugins.attrib.attr('slow') class RaceDeletingKeysTest(unittest.TestCase): def setUp(self): import redis self.r = re...
import nose.plugins.attrib import time as _time import subprocess import sys import redisdl import unittest import json import os.path from . import util from . import big_data @nose.plugins.attrib.attr('slow') class RaceDeletingKeysTest(unittest.TestCase): def setUp(self): import redis self.r = re...
Replace finish order requirement with a duration requirement
Replace finish order requirement with a duration requirement
Python
bsd-2-clause
p/redis-dump-load,hyunchel/redis-dump-load,p/redis-dump-load,hyunchel/redis-dump-load
93903d065cd1ff8f3f0c715668f05c804c5561f9
profile/linearsvc.py
profile/linearsvc.py
import cProfile from sklearn.svm import LinearSVC from sklearn.datasets import load_svmlight_file from sklearn.metrics import accuracy_score X, y = load_svmlight_file("data.txt") svc = LinearSVC() cProfile.runctx('svc.fit(X, y)', {'svc': svc, 'X': X, 'y': y}, {}) svc.fit(X, y) results = svc.predict(X) accuracy = a...
import timeit from sklearn.svm import LinearSVC from sklearn.datasets import load_svmlight_file from sklearn.metrics import accuracy_score setup = """ from sklearn.svm import LinearSVC from sklearn.datasets import load_svmlight_file X, y = load_svmlight_file("data.txt") svc = LinearSVC() """ time = timeit.timeit('s...
Use timeit instead of cProfile
Use timeit instead of cProfile
Python
mit
JuliaPackageMirrors/SoftConfidenceWeighted.jl,IshitaTakeshi/SoftConfidenceWeighted.jl
3ecfdf41da3eb3b881c112254b913ff907424bd7
Scripts/2-Upload.py
Scripts/2-Upload.py
import os import json # Get Steam settings steamData = open("steam.json") steamConfig = json.load(steamData) steamSDKDir = steamConfig["sdkDir"] steamBuilder = steamConfig["builder"] steamCommand = steamConfig["command"] steamAppFile = steamConfig["appFile"] steamUser = steamConfig["user"] steamPassword = steamConfig...
#!/usr/bin/env python import os import json # Get Steam settings steamData = open("steam.json") steamConfig = json.load(steamData) steamSDKDir = steamConfig["sdkDir"] steamBuilder = steamConfig["builder"] steamCommand = steamConfig["command"] steamAppFile = steamConfig["appFile"] steamUser = steamConfig["user"] steamP...
Make steam upload script works for Linux
Make steam upload script works for Linux
Python
bsd-3-clause
arbonagw/HeliumRain,arbonagw/HeliumRain,arbonagw/HeliumRain,arbonagw/HeliumRain,arbonagw/HeliumRain
92b7a5463e505f84862dd96e07c9caa5a97107a9
client/test/server_tests.py
client/test/server_tests.py
from nose.tools import * from mockito import * import unittest from source.server import * from source.exception import * from source.commands.system import * class MyTestCase(unittest.TestCase): def createCommandResponse(self, command, parameters = {}, timeout = None): response = mock() response.status_c...
from mockito import * import unittest from source.server import * from source.exception import * from source.commands.system import * class ServerTestCase(unittest.TestCase): def createCommandResponse(self, command, parameters = {}, timeout = None): response = mock() response.status_code = 200 json = ...
Change function names to camelCase
Change function names to camelCase
Python
mit
CaminsTECH/owncloud-test
52584725e462ab304bc2e976fa691f0d830e7efb
Speech/processor.py
Speech/processor.py
# Retrieve file from Facebook import urllib, convert, re, os # from speech_py import speech_to_text_offline as STT_o # from speech_py import speech_to_text_google as STT from speech_py import speech_to_text_ibm_rest as STT def transcribe(audio_url): if not os.path.isdir('./audio/retrieved_audio'): os.makedirs('./a...
# Retrieve file from Facebook import urllib, convert, re, os # from speech_py import speech_to_text_google as STT from speech_py import speech_to_text_ibm_rest as STT def transcribe(audio_url): if not os.path.isdir('./audio/retrieved_audio'): os.makedirs('./audio/retrieved_audio') reg_ex = '\w+.mp4' file_name =...
Modify ffmpeg path heroku 3
Modify ffmpeg path heroku 3
Python
mit
hungtraan/FacebookBot,hungtraan/FacebookBot,hungtraan/FacebookBot
14e000acafe7c374294a7de6ffe295c9d56df68f
tests/test_postgresql_specific.py
tests/test_postgresql_specific.py
import pytest from tests.utils import is_postgresql_env_with_json_field @pytest.mark.skipif(not is_postgresql_env_with_json_field(), reason="requires postgresql and Django 1.9+") @pytest.mark.django_db def test_dirty_json_field(): from tests.models import TestModelWithJSONField tm = Test...
import pytest from tests.utils import is_postgresql_env_with_json_field @pytest.mark.skipif(not is_postgresql_env_with_json_field(), reason="requires postgresql and Django 1.9+") @pytest.mark.django_db def test_dirty_json_field(): from tests.models import TestModelWithJSONField tm = Test...
Update postgresql json_field to reflect deepcopy fix
Update postgresql json_field to reflect deepcopy fix
Python
bsd-3-clause
jdotjdot/django-dirtyfields,romgar/django-dirtyfields,smn/django-dirtyfields
db8e02661df65e1a50c5810968afef7ecd44db42
braid/bazaar.py
braid/bazaar.py
import os from fabric.api import run from braid import package, fails def install(): package.install('bzr') def branch(branch, location): if fails('[ -d {}/.bzr ]'.format(location)): run('mkdir -p {}'.format(os.path.dirname(location))) run('bzr branch {} {}'.format(branch, location)) e...
import os from fabric.api import run from braid import package, fails def install(): package.install('bzr') def branch(branch, location): if fails('[ -d {}/.bzr ]'.format(location)): run('mkdir -p {}'.format(os.path.dirname(location))) run('bzr branch {} {}'.format(branch, location)) e...
Make bzr always pull from the specified remote.
Make bzr always pull from the specified remote. Refs: #5.
Python
mit
alex/braid,alex/braid
3d5d6d093420294ed7b5fa834285d1d55da82d5d
pyroSAR/tests/test_snap_exe.py
pyroSAR/tests/test_snap_exe.py
import pytest from contextlib import contextmanager from pyroSAR._dev_config import ExamineExe from pyroSAR.snap.auxil import ExamineSnap @contextmanager def not_raises(ExpectedException): try: yield except ExpectedException: raise AssertionError( "Did raise exception {0} when it s...
from contextlib import contextmanager import pytest from pyroSAR._dev_config import ExamineExe from pyroSAR.snap.auxil import ExamineSnap @contextmanager def not_raises(ExpectedException): try: yield except ExpectedException: raise AssertionError( "Did raise exception {0} when i...
Add unit test to determine if the classes ExamineExe and ExamineSnap will work properly.
Add unit test to determine if the classes ExamineExe and ExamineSnap will work properly. Fixed a bug `assert len(record) == 1` in 'test_not_exception' method in class `TestExamineExe`.
Python
mit
johntruckenbrodt/pyroSAR,johntruckenbrodt/pyroSAR
b55c4c0536ca23484375d93f2ef011de0d5ce417
app/app.py
app/app.py
from flask import Flask app = Flask(__name__) @app.route('/') def index(): return 'Hello Docker + Nginx + Gunicorn + Flask!' if __name__ == "__main__": app.run(host="0.0.0.0", debug=True)
from flask import Flask app = Flask(__name__) @app.route('/') def index(): return 'Hello Docker + Nginx + Gunicorn + Flask!'
Remove __name__ == __main__ becuase it'll never be used
Remove __name__ == __main__ becuase it'll never be used
Python
mit
everett-toews/guestbook,rackerlabs/guestbook,everett-toews/guestbook,rackerlabs/guestbook
ed326fba4f44552eeb206f3c5af9ad6f5e89ca44
localeurl/models.py
localeurl/models.py
from django.conf import settings from django.core import urlresolvers from django.utils import translation from localeurl import utils def reverse(*args, **kwargs): reverse_kwargs = kwargs.get('kwargs', {}) locale = utils.supported_language(reverse_kwargs.pop('locale', translation.get_language())) ...
from django.conf import settings from django.core import urlresolvers from django.utils import translation from localeurl import utils def reverse(*args, **kwargs): reverse_kwargs = kwargs.get('kwargs', {}) if reverse_kwargs!=None: locale = utils.supported_language(reverse_kwargs.pop('locale', ...
Handle situation when kwargs is None
Handle situation when kwargs is None
Python
mit
eugena/django-localeurl
4b35247fe384d4b2b206fa7650398511a493253c
setup.py
setup.py
from distutils.core import setup import sys import os import re PACKAGENAME = 'OpSimSummary' packageDir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'opsimsummary') versionFile = os.path.join(packageDir, 'version.py') # Obtain the package version with open(versionFile, 'r') as...
from distutils.core import setup import sys import os import re PACKAGENAME = 'OpSimSummary' packageDir = os.path.join(os.path.dirname(os.path.abspath(__file__)), PACKAGENAME) versionFile = os.path.join(packageDir, 'version.py') # Obtain the package version with open(versionFile, 'r') as f:...
Revert "Revert "Changed back due to problems, will fix later""
Revert "Revert "Changed back due to problems, will fix later"" This reverts commit 5e92c0ef714dea823e1deeef21b5141d9e0111a0. modified: setup.py
Python
mit
rbiswas4/simlib
83c0cb83a5eeaff693765c7d297b470adfdcec9e
setup.py
setup.py
#!/usr/bin/env python from distutils.core import setup version = __import__('stale').__version__ setup( name="stale", version=version, description="Identifies (and optionally removes) stale Delicious links", author="Jon Parise", author_email="jon@indelible.org", url="http://bitbucket.org/jpar...
#!/usr/bin/env python from distutils.core import setup version = __import__('stale').__version__ setup( name="stale", version=version, description="Identifies (and optionally removes) stale Delicious links", author="Jon Parise", author_email="jon@indelible.org", url="https://github.com/jparis...
Use the GitHub URL instead of the BitBucket URL
Use the GitHub URL instead of the BitBucket URL
Python
mit
jparise/stale
2ef360762cf807806417fbd505319165716e4591
setup.py
setup.py
#!/usr/bin/env python # Copyright (c) 2014, Michael Boyle # See LICENSE file for details: <https://github.com/moble/quaternion/blob/master/LICENSE> from auto_version import calculate_version, build_py_copy_version def configuration(parent_package='', top_path=None): import numpy from distutils.errors import...
#!/usr/bin/env python # Copyright (c) 2014, Michael Boyle # See LICENSE file for details: <https://github.com/moble/quaternion/blob/master/LICENSE> from auto_version import calculate_version, build_py_copy_version def configuration(parent_package='', top_path=None): import numpy from distutils.errors import...
Add fast-math back to compiler options, now that anaconda can handle it
Add fast-math back to compiler options, now that anaconda can handle it Closes #13 See https://github.com/ContinuumIO/anaconda-issues/issues/182
Python
mit
moble/quaternion,moble/quaternion
9f485a55227406c3cfbfb3154ec8d0f2cad8ae67
publisher/build_paper.py
publisher/build_paper.py
#!/usr/bin/env python import docutils.core as dc from writer import writer import os.path import sys import glob preamble = r''' % These preamble commands are from build_paper.py % PDF Standard Fonts \usepackage{mathptmx} \usepackage[scaled=.90]{helvet} \usepackage{courier} % Make verbatim environment smaller \ma...
#!/usr/bin/env python import docutils.core as dc from writer import writer import os.path import sys import glob preamble = r''' % These preamble commands are from build_paper.py % PDF Standard Fonts \usepackage{mathptmx} \usepackage[scaled=.90]{helvet} \usepackage{courier} % Make verbatim environment smaller \ma...
Use IEEE computer society layout to improve looks.
Use IEEE computer society layout to improve looks.
Python
bsd-2-clause
Stewori/euroscipy_proceedings,helgee/euroscipy_proceedings,juhasch/euroscipy_proceedings,mwcraig/scipy_proceedings,sbenthall/scipy_proceedings,helgee/euroscipy_proceedings,SepidehAlassi/euroscipy_proceedings,SepidehAlassi/euroscipy_proceedings,chendaniely/scipy_proceedings,dotsdl/scipy_proceedings,mikaem/euroscipy_proc...
cb2c937fa16590a7431f450c0fc79cc68dd9984c
readthedocs/cdn/purge.py
readthedocs/cdn/purge.py
import logging from django.conf import settings log = logging.getLogger(__name__) CDN_SERVICE = getattr(settings, 'CDN_SERVICE') CDN_USERNAME = getattr(settings, 'CDN_USERNAME') CDN_KEY = getattr(settings, 'CDN_KEY') CDN_SECET = getattr(settings, 'CDN_SECET') CDN_ID = getattr(settings, 'CDN_ID') def purge(files): ...
import logging from django.conf import settings log = logging.getLogger(__name__) CDN_SERVICE = getattr(settings, 'CDN_SERVICE') CDN_USERNAME = getattr(settings, 'CDN_USERNAME') CDN_KEY = getattr(settings, 'CDN_KEY') CDN_SECET = getattr(settings, 'CDN_SECET') CDN_ID = getattr(settings, 'CDN_ID') def purge(files): ...
Clean up bad logic to make it slightly less bad
Clean up bad logic to make it slightly less bad
Python
mit
sid-kap/readthedocs.org,wanghaven/readthedocs.org,CedarLogic/readthedocs.org,mhils/readthedocs.org,sunnyzwh/readthedocs.org,titiushko/readthedocs.org,laplaceliu/readthedocs.org,hach-que/readthedocs.org,pombredanne/readthedocs.org,safwanrahman/readthedocs.org,wanghaven/readthedocs.org,michaelmcandrew/readthedocs.org,saf...
552afcd33d890d2798b52919c0b4c0d146b7d914
make_ids.py
make_ids.py
#!/usr/bin/env python import csv import json import os import sys def format_entities_as_list(entities): for i, entity in enumerate(entities, 1): yield (unicode(i), json.dumps(entity["terms"])) def generate_entities(fobj): termsets_seen = set() for line in fobj: entity = json.loads(line...
#!/usr/bin/env python import csv import json import os import sys def format_entities_as_list(entities): """Format entities read from an iterator as lists. :param entities: An iterator yielding entities as dicts: eg {"terms": ["Fred"]} Yield a sequence of entites formatted as lists containin...
Add docstrings to all functions
Add docstrings to all functions
Python
mit
alphagov/entity-manager
4663fdb44628238997ecc5adbb0f0193c99efc6c
script/lib/config.py
script/lib/config.py
#!/usr/bin/env python import platform import sys BASE_URL = 'http://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent' LIBCHROMIUMCONTENT_COMMIT = '26dd65a62e35aa98b25c10cbfc00f1a621fd4c4b' ARCH = { 'cygwin': '32bit', 'darwin': '64bit', 'linux2': platform.architecture()[0], 'win32': '32bit', }...
#!/usr/bin/env python import platform import sys BASE_URL = 'http://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent' LIBCHROMIUMCONTENT_COMMIT = 'c01b10faf0d478e48f537210ec263fabd551578d' ARCH = { 'cygwin': '32bit', 'darwin': '64bit', 'linux2': platform.architecture()[0], 'win32': '32bit', }...
Update libchromiumcontent to disable zygote process
Update libchromiumcontent to disable zygote process
Python
mit
Jonekee/electron,Faiz7412/electron,cos2004/electron,mubassirhayat/electron,smczk/electron,fomojola/electron,Jonekee/electron,IonicaBizauKitchen/electron,howmuchcomputer/electron,Floato/electron,bruce/electron,joaomoreno/atom-shell,tomashanacek/electron,ervinb/electron,gbn972/electron,Zagorakiss/electron,rhencke/electro...
6869d5edd706d95c8cadbd1945b29fdd3bfecd6b
blaze/datashape/unification.py
blaze/datashape/unification.py
""" Unification is a generalization of Numpy broadcasting. In Numpy we two arrays and broadcast them to yield similar shaped arrays. In Blaze we take two arrays with more complex datashapes and unify the types prescribed by more complicated pattern matching on the types. """ from numpy import promote_types from cor...
""" Unification is a generalization of Numpy broadcasting. In Numpy we two arrays and broadcast them to yield similar shaped arrays. In Blaze we take two arrays with more complex datashapes and unify the types prescribed by more complicated pattern matching on the types. """ from numpy import promote_types from bla...
Remove very old type unifier, for robust one
Remove very old type unifier, for robust one
Python
bsd-2-clause
seibert/blaze-core,seibert/blaze-core,seibert/blaze-core,seibert/blaze-core,seibert/blaze-core
e00dc2a5725faeb3b11c6aac0d9ed0be0a55d33f
OIPA/iati/parser/schema_validators.py
OIPA/iati/parser/schema_validators.py
import os import os.path from lxml import etree from common.util import findnth_occurence_in_string def validate(iati_parser, xml_etree): base = os.path.dirname(os.path.abspath(__file__)) location = base + "/../schemas/" + iati_parser.VERSION \ + "/iati-activities-schema.xsd" xsd_data = open(loc...
import os import os.path from lxml import etree from common.util import findnth_occurence_in_string def validate(iati_parser, xml_etree): base = os.path.dirname(os.path.abspath(__file__)) location = base + "/../schemas/" + iati_parser.VERSION \ + "/iati-activities-schema.xsd" xsd_data = open(loc...
Fix another bug related to logging dataset errors
Fix another bug related to logging dataset errors OIPA-612 / #589
Python
agpl-3.0
openaid-IATI/OIPA,openaid-IATI/OIPA,zimmerman-zimmerman/OIPA,openaid-IATI/OIPA,zimmerman-zimmerman/OIPA,openaid-IATI/OIPA,zimmerman-zimmerman/OIPA,openaid-IATI/OIPA,zimmerman-zimmerman/OIPA,zimmerman-zimmerman/OIPA
8c9739572aa679cb6d55cb31737bff6d304db2d1
openstack/tests/functional/network/v2/test_extension.py
openstack/tests/functional/network/v2/test_extension.py
# 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, software # distributed under t...
# 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, software # distributed under t...
Add a functional test for find_extension
Add a functional test for find_extension Change-Id: I351a1c1529beb3cae799650e1e57364b3521d00c
Python
apache-2.0
briancurtin/python-openstacksdk,dtroyer/python-openstacksdk,openstack/python-openstacksdk,dudymas/python-openstacksdk,stackforge/python-openstacksdk,briancurtin/python-openstacksdk,stackforge/python-openstacksdk,openstack/python-openstacksdk,dudymas/python-openstacksdk,dtroyer/python-openstacksdk
d44a338e704732b9e3e7cb935eb2c9b38d2cfa06
api/drive.py
api/drive.py
# -*- encoding:utf8 -*- import httplib2 from flask import Blueprint, redirect, request, Response, abort from model.oauth import OAuth from model.utils import Utils drive = Blueprint('drive', __name__, url_prefix='/drive') @drive.route("/auth", methods=['GET']) def hookauth(): flow = OAuth().get_flow() if ...
# -*- encoding:utf8 -*- import httplib2 from flask import Blueprint, redirect, request, Response, abort from model.cache import Cache from model.oauth import OAuth from model.utils import Utils drive = Blueprint('drive', __name__, url_prefix='/drive') @drive.route("/auth", methods=['GET']) def hookauth(): flo...
Introduce cache clear logic through GoogleDrive webhook endpoint.
Introduce cache clear logic through GoogleDrive webhook endpoint.
Python
mit
supistar/Botnyan
c1d6e066ea622cc3fa7cec33cb77aa12e43a6519
avocado/exporters/_html.py
avocado/exporters/_html.py
from django.template import Context from django.template.loader import get_template from _base import BaseExporter class HTMLExporter(BaseExporter): preferred_formats = ('html', 'string') def write(self, iterable, buff=None, template=None): if not buff and not template: raise Exception('E...
from django.template import Context from django.template.loader import get_template from _base import BaseExporter class HTMLExporter(BaseExporter): preferred_formats = ('html', 'string') def write(self, iterable, buff=None, template=None): if not buff and not template: raise Exception('E...
Fix missing row iteration in HTMLExporter
Fix missing row iteration in HTMLExporter
Python
bsd-2-clause
murphyke/avocado,murphyke/avocado,murphyke/avocado,murphyke/avocado
323167f22c3176366cf2f90ce2ec314ee2c49c8f
moa/factory_registers.py
moa/factory_registers.py
from kivy.factory import Factory r = Factory.register r('StageTreeNode', module='moa.render.treerender') r('StageSimpleDisplay', module='moa.render.stage_simple') # --------------------- devices ----------------------------- r('Device', module='moa.device') r('DigitalChannel', module='moa.device.digital') r('Digita...
from kivy.factory import Factory r = Factory.register r('StageTreeNode', module='moa.render.treerender') r('StageSimpleDisplay', module='moa.render.stage_simple') # --------------------- devices ----------------------------- r('Device', module='moa.device.__init__') r('DigitalChannel', module='moa.device.digital') ...
Use __init__ for factory imports.
Use __init__ for factory imports.
Python
mit
matham/moa
a9be23f6e3b45b766b770b60e3a2a318e6fd7e71
tests/script/test_no_silent_add_and_commit.py
tests/script/test_no_silent_add_and_commit.py
import pytest pytestmark = pytest.mark.slow version_file_content = """ major = 0 minor = 2 patch = 0 """ config_file_content = """ __config_version__ = 1 GLOBALS = { 'serializer': '{{major}}.{{minor}}.{{patch}}', } FILES = ["VERSION"] VERSION = ['major', 'minor', 'patch'] VCS = { 'name': 'git', } """ d...
import pytest pytestmark = pytest.mark.slow version_file_content = """ major = 0 minor = 2 patch = 0 """ config_file_content = """ __config_version__ = 1 GLOBALS = { 'serializer': '{{major}}.{{minor}}.{{patch}}', } FILES = ["VERSION"] VERSION = ['major', 'minor', 'patch'] VCS = { 'name': 'git', } """ d...
Test name changed to reflect behaviour
Test name changed to reflect behaviour
Python
isc
lgiordani/punch
d98b891d882ca916984586631b5ba09c52652a74
app/__init__.py
app/__init__.py
from flask import Flask from flask.ext.bower import Bower from flask.ext.pymongo import PyMongo from config import Config app = Flask(__name__) app.config.from_object(Config) # Register bower Bower(app) # Create mongodb client mongo = PyMongo(app) from .report.views import index, report
from flask import Flask from flask_bower import Bower from flask_pymongo import PyMongo from config import Config app = Flask(__name__) app.config.from_object(Config) # Register bower Bower(app) # Create mongodb client mongo = PyMongo(app) from .report.views import index, report
Resolve the deprecated flask ext imports
Resolve the deprecated flask ext imports
Python
mit
mingrammer/pyreportcard,mingrammer/pyreportcard
8ebec493b086525d23bbe4110c9d277c9b9b8301
src/sentry/tsdb/dummy.py
src/sentry/tsdb/dummy.py
""" sentry.tsdb.dummy ~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import from sentry.tsdb.base import BaseTSDB class DummyTSDB(BaseTSDB): """ A no-op time-series storage. ""...
""" sentry.tsdb.dummy ~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import from sentry.tsdb.base import BaseTSDB class DummyTSDB(BaseTSDB): """ A no-op time-series storage. ""...
Add support for DummyTSDB backend.
Add support for DummyTSDB backend.
Python
bsd-3-clause
daevaorn/sentry,gencer/sentry,mvaled/sentry,BuildingLink/sentry,daevaorn/sentry,beeftornado/sentry,jean/sentry,JackDanger/sentry,JamesMura/sentry,zenefits/sentry,jean/sentry,jean/sentry,ifduyue/sentry,mvaled/sentry,gencer/sentry,BayanGroup/sentry,imankulov/sentry,nicholasserra/sentry,JamesMura/sentry,beeftornado/sentry...
0498778db28fd2e2272b48fb84a99eece7b662ff
autocorrect.py
autocorrect.py
# Open list of correcly-spelled words. wordFile = open("words.txt") threshold = 8 listOfWords = input().split() index = 0 def lev(a, b): if min(len(a), len(b)) == 0: return max(len(a), len(b)) else: return min(lev(a[:-1], b) + 1, lev(a, b[:-1]) + 1, lev(a[:-1], b[:-1]) + int(not a ...
# Open list of correcly-spelled words. wordFile = open("words.txt") threshold = 8 listOfWords = input().split() index = 0 # Compute Levenshtein distance def lev(a, b): if min(len(a), len(b)) == 0: return max(len(a), len(b)) elif len(a) == len(b): # Use Hamming Distance (special case) ...
Use Hamming distance for efficiency
Use Hamming distance for efficiency Hamming distance is faster when strings are of same length (Hamming is a special case of Levenshtein).
Python
mit
jmanuel1/spellingbee
76c44154ca1bc2eeb4e24cc820338c36960b1b5c
caniuse/test/test_caniuse.py
caniuse/test/test_caniuse.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import import pytest from caniuse.main import check def test_package_name_has_been_used(): assert 'Sorry' in check('requests') assert 'Sorry' in check('flask') assert 'Sorry' in check('pip') def test_package_name_has_not_be...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import import pytest from click.testing import CliRunner from caniuse.main import check from caniuse.cli import cli class TestAPI(): def test_package_name_has_been_used(self): assert 'Sorry' in check('requests') asser...
Add tests for cli.py to improve code coverage
Add tests for cli.py to improve code coverage
Python
mit
lord63/caniuse
429bd22a98895252dfb993d770c9b3060fef0fe3
tests/runalldoctests.py
tests/runalldoctests.py
import doctest import glob import pkg_resources try: pkg_resources.require('OWSLib') except (ImportError, pkg_resources.DistributionNotFound): pass testfiles = glob.glob('*.txt') for file in testfiles: doctest.testfile(file)
import doctest import getopt import glob import sys import pkg_resources try: pkg_resources.require('OWSLib') except (ImportError, pkg_resources.DistributionNotFound): pass def run(pattern): if pattern is None: testfiles = glob.glob('*.txt') else: testfiles = glob.glob(pattern) fo...
Add option to pick single test file from the runner
Add option to pick single test file from the runner
Python
bsd-3-clause
datagovuk/OWSLib,kwilcox/OWSLib,QuLogic/OWSLib,KeyproOy/OWSLib,tomkralidis/OWSLib,menegon/OWSLib,datagovuk/OWSLib,datagovuk/OWSLib,dblodgett-usgs/OWSLib,ocefpaf/OWSLib,mbertrand/OWSLib,gfusca/OWSLib,jaygoldfinch/OWSLib,daf/OWSLib,JuergenWeichand/OWSLib,bird-house/OWSLib,geographika/OWSLib,kalxas/OWSLib,Jenselme/OWSLib,...
459546a9cedb8e9cf3bee67edb4a76d37874f03b
tests/test_athletics.py
tests/test_athletics.py
from nose.tools import ok_, eq_ from pennathletics.athletes import get_roster, get_player class TestAthletics(): def test_roster(self): ok_(get_roster("m-baskbl", 2015) != []) def test_player_empty(self): ok_(get_player("m-baskbl", 2014) != []) def test_player_number(self): eq_(g...
from nose.tools import ok_, eq_ from pennathletics.athletes import get_roster, get_player class TestAthletics(): def test_roster(self): ok_(get_roster("m-baskbl", 2015) != []) def test_player_empty(self): ok_(get_player("m-baskbl", 2014) != []) def test_player_number(self): eq_(g...
Add a few more tests for variety
Add a few more tests for variety
Python
mit
pennlabs/pennathletics
921225181fc1d0242d61226c7b10663ddba1a1a2
indra/tests/test_rlimsp.py
indra/tests/test_rlimsp.py
from indra.sources import rlimsp def test_simple_usage(): stmts = rlimsp.process_pmc('PMC3717945')
from indra.sources import rlimsp def test_simple_usage(): rp = rlimsp.process_pmc('PMC3717945') stmts = rp.statements assert len(stmts) == 6, len(stmts) def test_ungrounded_usage(): rp = rlimsp.process_pmc('PMC3717945', with_grounding=False) assert len(rp.statements)
Update test and add test for ungrounded endpoint.
Update test and add test for ungrounded endpoint.
Python
bsd-2-clause
johnbachman/belpy,johnbachman/belpy,sorgerlab/indra,sorgerlab/belpy,sorgerlab/belpy,johnbachman/indra,pvtodorov/indra,johnbachman/indra,sorgerlab/belpy,johnbachman/indra,sorgerlab/indra,bgyori/indra,pvtodorov/indra,pvtodorov/indra,johnbachman/belpy,sorgerlab/indra,bgyori/indra,bgyori/indra,pvtodorov/indra
c461c57a90804558a30f3980b2608497a43c06a7
nipy/testing/__init__.py
nipy/testing/__init__.py
"""The testing directory contains a small set of imaging files to be used for doctests only. More thorough tests and example data will be stored in a nipy-data-suite to be created later and downloaded separately. Examples -------- >>> from nipy.testing import funcfile >>> from nipy.io.api import load_image >>> img =...
"""The testing directory contains a small set of imaging files to be used for doctests only. More thorough tests and example data will be stored in a nipy data packages that you can download separately - see :mod:`nipy.utils.data` .. note: We use the ``nose`` testing framework for tests. Nose is a dependenc...
Allow failed nose import without breaking nipy import
Allow failed nose import without breaking nipy import
Python
bsd-3-clause
bthirion/nipy,nipy/nipy-labs,alexis-roche/register,arokem/nipy,alexis-roche/niseg,alexis-roche/nireg,alexis-roche/niseg,alexis-roche/nipy,alexis-roche/register,nipy/nipy-labs,nipy/nireg,nipy/nireg,alexis-roche/register,alexis-roche/nipy,bthirion/nipy,arokem/nipy,alexis-roche/nireg,bthirion/nipy,arokem/nipy,bthirion/nip...
04fbd65f90a3ce821fed76377ce7858ae0dd56ee
masters/master.chromium.webrtc/master_builders_cfg.py
masters/master.chromium.webrtc/master_builders_cfg.py
# Copyright (c) 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from buildbot.changes.filter import ChangeFilter from buildbot.schedulers.basic import SingleBranchScheduler from master.factory import annotator_factor...
# Copyright (c) 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from buildbot.changes.filter import ChangeFilter from buildbot.schedulers.basic import SingleBranchScheduler from master.factory import annotator_factor...
Switch remaining chromium.webrtc builders to chromium recipe.
WebRTC: Switch remaining chromium.webrtc builders to chromium recipe. Linux was switched in https://codereview.chromium.org/1508933002/ This switches the rest over to the chromium recipe. BUG=538259 TBR=phajdan.jr@chromium.org Review URL: https://codereview.chromium.org/1510853002 . git-svn-id: 239fca9b83025a0b6f82...
Python
bsd-3-clause
eunchong/build,eunchong/build,eunchong/build,eunchong/build
45e86667311f4c9b79d90a3f86e71ffc072b1219
oneflow/landing/admin.py
oneflow/landing/admin.py
# -*- coding: utf-8 -*- from django.contrib import admin from django.conf import settings from .models import LandingContent TRUNCATE_LENGTH = 50 content_fields_names = tuple(('content_' + code) for code, lang in settings.LANGUAGES) content_fields_displays = ...
# -*- coding: utf-8 -*- from django.contrib import admin from django.conf import settings from .models import LandingContent from sparks.django.admin import truncate_field content_fields_names = tuple(('content_' + code) for code, lang in settings.LANGUAGES) c...
Move the `truncate_field` pseudo-decorator to sparks (which just released 1.17).
Move the `truncate_field` pseudo-decorator to sparks (which just released 1.17).
Python
agpl-3.0
WillianPaiva/1flow,WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow,WillianPaiva/1flow,1flow/1flow,1flow/1flow,1flow/1flow,WillianPaiva/1flow,1flow/1flow
b7e657134c21b62e78453b11f0745e0048e346bf
examples/simple_distribution.py
examples/simple_distribution.py
import sys import time from random import shuffle from vania.fair_distributor import FairDistributor def main(): # User input for the number of targets and objects. users = ['user1', 'user2'] tasks = ['task1', 'task2'] preferences = [ [1, 2], [2, 1], ] # Run solver start_t...
import sys import time from random import shuffle from vania.fair_distributor import FairDistributor def main(): # User input for the number of targets and objects. users = ['user1', 'user2'] tasks = ['task1', 'task2'] preferences = [ [1, 2], [2, 1], ] # Run solver distrib...
Remove time metrics from the simple example
Remove time metrics from the simple example
Python
mit
Hackathonners/vania
a6e2c0fc837b17321e2979cb12ba2d0e69603eac
orderedmodel/__init__.py
orderedmodel/__init__.py
__all__ = ['OrderedModel', 'OrderedModelAdmin'] from models import OrderedModel from admin import OrderedModelAdmin
from .models import OrderedModel from .admin import OrderedModelAdmin __all__ = ['OrderedModel', 'OrderedModelAdmin'] try: from django.conf import settings except ImportError: pass else: if 'mptt' in settings.INSTALLED_APPS: from .mptt_models import OrderableMPTTModel from .mptt_admin impo...
Make it easy importing of OrderableMPTTModel and OrderedMPTTModelAdmin in from orderedmodel module
Make it easy importing of OrderableMPTTModel and OrderedMPTTModelAdmin in from orderedmodel module
Python
bsd-3-clause
MagicSolutions/django-orderedmodel,MagicSolutions/django-orderedmodel
163cfea2a0c5e7d96dd870aa540c95a2ffa139f9
appstats/filters.py
appstats/filters.py
# encoding: utf-8 import json def json_filter(value): return json.dumps(value) def count_filter(value): if value is None: return "" count = float(value) base = 1000 prefixes = [ ('K'), ('M'), ('G'), ('T'), ('P'), ('E'), ('Z'), ...
# encoding: utf-8 import json def json_filter(value): return json.dumps(value) def count_filter(value): if value is None: return "" count = float(value) base = 1000 prefixes = [ ('K'), ('M'), ('G'), ('T'), ('P'), ('E'), ('Z'), ...
Join two lines in one
Join two lines in one
Python
mit
uvNikita/appstats,uvNikita/appstats,uvNikita/appstats
fc94d60066692e6e8dc496bb854039bb66af3311
scout.py
scout.py
# Python does not require explicit interfaces, # but I believe that code which does is more # maintainable. Thus I include this explicit # interface for Problems. class Problem: def getStartState(self): return None def getEndState(self): return None def isValidState(self, state): ...
# Python does not require explicit interfaces, # but I believe that code which does is more # maintainable. Thus I include this explicit # interface for Problems. class Problem: def getStartState(self): return None def getEndState(self): return None def isValidState(self, state): ...
Add a simple problem for testing
Add a simple problem for testing
Python
mit
SpexGuy/Scout
7caf008f5442baff92cd820d3fd3a059293a3e5d
setup.py
setup.py
#!/usr/bin/env python from distutils.core import setup setup(name='icalendar', version='0.10', description='iCalendar support module', package_dir = {'': 'src'}, packages=['icalendar'], )
#!/usr/bin/env python from distutils.core import setup f = open('version.txt', 'r') version = f.read().strip() f.close() setup(name='icalendar', version=version, description='iCalendar support module', package_dir = {'': 'src'}, packages=['icalendar'], )
Tweak so that version information is picked up from version.txt.
Tweak so that version information is picked up from version.txt. git-svn-id: aa2e0347f72f9208cad9c7a63777f32311fef72e@11576 fd0d7bf2-dfb6-0310-8d31-b7ecfe96aada
Python
lgpl-2.1
greut/iCalendar,ryba-xek/iCalendar,offby1/icalendar
0574705dcbc473805aee35b482a41bdef060b0c9
setup.py
setup.py
from distutils.core import setup import py2pack with open('README') as f: README = f.read() setup( name = py2pack.__name__, version = py2pack.__version__, license = "GPLv2", description = py2pack.__doc__, long_description = README, author = py2pack.__author__.rsplit(' ', 1)[0], author_...
from distutils.core import setup import py2pack setup( name = py2pack.__name__, version = py2pack.__version__, license = "GPLv2", description = py2pack.__doc__, long_description = open('README').read(), author = py2pack.__author__.rsplit(' ', 1)[0], author_email = py2pack.__author__.rsplit(...
Load README file traditionally, with-statement is not supported by older Python releases.
Load README file traditionally, with-statement is not supported by older Python releases.
Python
apache-2.0
saschpe/py2pack,toabctl/py2pack
6bece40a1a0c8977c6211234e5aa4e64ad5b01a2
linguine/ops/StanfordCoreNLP.py
linguine/ops/StanfordCoreNLP.py
#!/usr/bin/env python import os """ Performs some core NLP operations as a proof of concept for the library. """ from stanford_corenlp_pywrapper import CoreNLP class StanfordCoreNLP: proc = None """ When the JSON segments return from the CoreNLP library, they separate the data acquired from eac...
#!/usr/bin/env python import os """ Performs some core NLP operations as a proof of concept for the library. """ from stanford_corenlp_pywrapper import CoreNLP class StanfordCoreNLP: proc = None """ When the JSON segments return from the CoreNLP library, they separate the data acquired from eac...
Return entire corpus from corenlp analysis
Return entire corpus from corenlp analysis
Python
mit
Pastafarians/linguine-python,rigatoni/linguine-python
468a66c0945ce9e78fb5da8a6a628ce581949759
livinglots_usercontent/views.py
livinglots_usercontent/views.py
from django.views.generic import CreateView from braces.views import FormValidMessageMixin from livinglots_genericviews import AddGenericMixin class AddContentView(FormValidMessageMixin, AddGenericMixin, CreateView): def _get_content_name(self): return self.form_class._meta.model._meta.object_name ...
from django.views.generic import CreateView from braces.views import FormValidMessageMixin from livinglots_genericviews import AddGenericMixin class AddContentView(FormValidMessageMixin, AddGenericMixin, CreateView): def _get_content_name(self): return self.form_class._meta.model._meta.object_name ...
Set added_by_name if we can
Set added_by_name if we can
Python
agpl-3.0
596acres/django-livinglots-usercontent,596acres/django-livinglots-usercontent
c470da4fcf5bec84c255aa4514f6fd764781eb1a
setup.py
setup.py
from distutils.core import setup ext_files = ["pyreBloom/bloom.c"] kwargs = {} try: from Cython.Distutils import build_ext from Cython.Distutils import Extension print "Building from Cython" ext_files.append("pyreBloom/pyreBloom.pyx") kwargs['cmdclass'] = {'build_ext': build_ext} except ImportErr...
from distutils.core import setup ext_files = ["pyreBloom/bloom.c"] kwargs = {} try: from Cython.Distutils import build_ext from Cython.Distutils import Extension print "Building from Cython" ext_files.append("pyreBloom/pyreBloom.pyx") kwargs['cmdclass'] = {'build_ext': build_ext} except ImportErr...
Fix build with newer dependencies.
Fix build with newer dependencies.
Python
mit
seomoz/pyreBloom,seomoz/pyreBloom,seomoz/pyreBloom
1d5175beedeed2a2ae335a41380280a2ed39901b
lambda/control/commands.py
lambda/control/commands.py
from __future__ import print_function import shlex from traceback import format_exception from obj import Obj import click from click.testing import CliRunner runner = CliRunner() @click.group(name='') @click.argument('user', required=True) @click.pass_context def command(ctx, user, **kwargs): ctx.obj = Obj(us...
from __future__ import print_function import shlex from traceback import format_exception from obj import Obj import click from click.testing import CliRunner runner = CliRunner() @click.group(name='') @click.argument('user', required=True) @click.pass_context def command(ctx, user, **kwargs): ctx.obj = Obj(us...
Make the echo command actually echo all its parameters.
Make the echo command actually echo all its parameters.
Python
mit
ilg/LambdaMLM
f80c11efb4bcbca6d20cdbbc1a552ebb04aa8302
api/config/settings/production.py
api/config/settings/production.py
import os import dj_database_url from .base import * # BASE_NAME and BASE_DOMAIN are intentionally unset # They are only needed to seed data in staging and local BASE_URL = "https://voterengagement.com" ############################################################################### # Core SECRET_KEY = os.environ['...
import os import dj_database_url from .base import * # BASE_NAME and BASE_DOMAIN are intentionally unset # They are only needed to seed data in staging and local BASE_URL = "https://voterengagement.com" ############################################################################### # Core SECRET_KEY = os.environ['...
Allow citizenlabs.org as a host
Allow citizenlabs.org as a host
Python
mit
citizenlabsgr/voter-engagement,citizenlabsgr/voter-engagement,citizenlabsgr/voter-engagement,citizenlabsgr/voter-engagement,citizenlabsgr/voter-engagement
a8218a1c20ea48a3392ef9e6d898a73eb9642d9c
ui/repository/browse.py
ui/repository/browse.py
from django.shortcuts import render_to_response from django.template import RequestContext from registry.models import ResourceCollection from django.http import HttpResponse, HttpResponseBadRequest import json def browse(req): # Find all the collections that do not have parents top = ResourceCollection.object...
from django.shortcuts import render_to_response from django.template import RequestContext from registry.models import ResourceCollection from django.http import HttpResponse, HttpResponseBadRequest import json def browse(req): # Find all the collections that do not have parents top = ResourceCollection.object...
Adjust parent filter on collections. Now top-level collections should specific 'top' as their parent instead of being null. This helps get rid of the problem of collections ending up being top-level when removed from their old parent
Adjust parent filter on collections. Now top-level collections should specific 'top' as their parent instead of being null. This helps get rid of the problem of collections ending up being top-level when removed from their old parent
Python
bsd-3-clause
usgin/nrrc-repository,usgin/nrrc-repository,usgin/metadata-repository,usgin/metadata-repository
142022516f310aeb58f3560031b2266f39a0f2e5
erpnext_ebay/tasks.py
erpnext_ebay/tasks.py
# -*- coding: utf-8 -*- """Scheduled tasks to be run by erpnext_ebay""" from frappe.utils.background_jobs import enqueue def all(): pass def hourly(): enqueue('erpnext_ebay.sync_orders.sync', queue='long', job_name='Sync eBay Orders') def daily(): enqueue('erpnext_ebay.ebay_active_listin...
# -*- coding: utf-8 -*- """Scheduled tasks to be run by erpnext_ebay""" from frappe.utils.background_jobs import enqueue def all(): pass def hourly(): pass def daily(): enqueue('erpnext_ebay.ebay_categories.category_sync', queue='long', job_name='eBay Category Sync') def weekly(): ...
Remove sync_orders and update_ebay_listings from hooks scheduler
fix(hooks): Remove sync_orders and update_ebay_listings from hooks scheduler
Python
mit
bglazier/erpnext_ebay,bglazier/erpnext_ebay
4eba105663ba8d0323559b095055b3f89521ea07
demo/ubergui.py
demo/ubergui.py
#!/usr/bin/env python import sys import Pyro import Tkinter, tkMessageBox from VisionEgg.PyroApps.UberClientGUI import client_list, AppWindow # You can add your own controllers and GUIs to client_list try: app_window = AppWindow(client_list=client_list) except Pyro.errors.ProtocolError, x: if str(x) == 'conn...
#!/usr/bin/env python import sys import Pyro import Tkinter, tkMessageBox from VisionEgg.PyroApps.UberClientGUI import client_list, AppWindow # You can add your own controllers and GUIs to client_list try: app_window = AppWindow(client_list=client_list) except Pyro.errors.PyroError, x: uber_server_error = 0 ...
Update errors for other versions of Pyro
Minor: Update errors for other versions of Pyro git-svn-id: 033d166fe8e629f6cbcd3c0e2b9ad0cffc79b88b@775 3a63a0ee-37fe-0310-a504-e92b6e0a3ba7
Python
lgpl-2.1
visionegg/visionegg,visionegg/visionegg,visionegg/visionegg,visionegg/visionegg,visionegg/visionegg
83b060b573bee654708e5fbb41c9e3b2913e4d9c
generatechangedfilelist.py
generatechangedfilelist.py
import sys import os import commands import fnmatch import re import subprocess, shlex def cmdsplit(args): if os.sep == '\\': args = args.replace('\\', '\\\\') return shlex.split(args) def main(): md5dir = os.path.abspath(sys.argv[1]) list_file = os.path.abspath(sys.argv[2]) prelist = os.p...
import sys import os import commands import fnmatch import re import subprocess, shlex mcp_root = os.path.abspath(sys.argv[1]) sys.path.append(os.path.join(mcp_root,"runtime")) from filehandling.srgshandler import parse_srg def cmdsplit(args): if os.sep == '\\': args = args.replace('\\', '\\\\') retur...
Tweak file list script to print obf names
Tweak file list script to print obf names
Python
lgpl-2.1
MinecraftForge/FML,aerospark/FML,aerospark/FML,aerospark/FML
139e6acc19040d89f304875c533513c9651f2906
budget_proj/budget_app/filters.py
budget_proj/budget_app/filters.py
from django.db.models import CharField from django_filters import rest_framework as filters from . import models class DefaultFilterMeta: """ Set our default Filter configurations to DRY up the FilterSet Meta classes. """ # Let us filter by all fields except id exclude = ('id',) # We prefer ca...
from django.db.models import CharField from django_filters import rest_framework as filters from . import models class CustomFilterBase(filters.FilterSet): """ Extends Filterset to populate help_text from the associated model field. Works with swagger but not the builtin docs. """ @classmethod ...
Upgrade Filters fields to use docs from model fields
Upgrade Filters fields to use docs from model fields
Python
mit
jimtyhurst/team-budget,hackoregon/team-budget,hackoregon/team-budget,hackoregon/team-budget,jimtyhurst/team-budget,jimtyhurst/team-budget
891ca8ee117f462a1648e954b756f1d29a5f527c
tests/test_errors.py
tests/test_errors.py
"""Tests for errors.py""" import aiohttp def test_bad_status_line1(): err = aiohttp.BadStatusLine(b'') assert str(err) == "b''" def test_bad_status_line2(): err = aiohttp.BadStatusLine('Test') assert str(err) == 'Test'
"""Tests for errors.py""" import aiohttp def test_bad_status_line1(): err = aiohttp.BadStatusLine(b'') assert str(err) == "b''" def test_bad_status_line2(): err = aiohttp.BadStatusLine('Test') assert str(err) == 'Test' def test_fingerprint_mismatch(): err = aiohttp.FingerprintMismatch('exp', ...
Add a test for FingerprintMismatch repr
Add a test for FingerprintMismatch repr
Python
apache-2.0
jettify/aiohttp,esaezgil/aiohttp,z2v/aiohttp,arthurdarcet/aiohttp,pfreixes/aiohttp,z2v/aiohttp,mind1master/aiohttp,KeepSafe/aiohttp,mind1master/aiohttp,juliatem/aiohttp,hellysmile/aiohttp,esaezgil/aiohttp,esaezgil/aiohttp,arthurdarcet/aiohttp,panda73111/aiohttp,pfreixes/aiohttp,z2v/aiohttp,alex-eri/aiohttp-1,singulared...
4bcc0aae53def04e16e87499b1321256ff35a7c1
pyconll/__init__.py
pyconll/__init__.py
""" A library whose purpose is to provide a low level layer between the CoNLL format and python code. """ __all__ = ['exception', 'load', 'tree', 'unit', 'util'] from .load import load_from_string, load_from_file, load_from_url, \ iter_from_string, iter_from_file, iter_from_url
""" A library whose purpose is to provide a low level layer between the CoNLL format and python code. """ __all__ = ['conllable', 'exception', 'load', 'tree', 'unit', 'util'] from .load import load_from_string, load_from_file, load_from_url, \ iter_from_string, iter_from_file, iter_from_url
Add conllable to all list.
Add conllable to all list.
Python
mit
pyconll/pyconll,pyconll/pyconll
e056dc3581785fe34123189cccd9901e1e9afe71
pylatex/__init__.py
pylatex/__init__.py
# flake8: noqa """ A library for creating Latex files. .. :copyright: (c) 2014 by Jelte Fennema. :license: MIT, see License for more details. """ from .document import Document from .math import Math, VectorName, Matrix from .package import Package from .section import Section, Subsection, Subsubsection from .t...
# flake8: noqa """ A library for creating Latex files. .. :copyright: (c) 2014 by Jelte Fennema. :license: MIT, see License for more details. """ from .document import Document from .math import Math, VectorName, Matrix from .package import Package from .section import Section, Subsection, Subsubsection from .t...
Add Tabu, LongTable and LongTabu global import
Add Tabu, LongTable and LongTabu global import
Python
mit
sebastianhaas/PyLaTeX,sebastianhaas/PyLaTeX,votti/PyLaTeX,ovaskevich/PyLaTeX,JelteF/PyLaTeX,bjodah/PyLaTeX,votti/PyLaTeX,jendas1/PyLaTeX,bjodah/PyLaTeX,jendas1/PyLaTeX,JelteF/PyLaTeX,ovaskevich/PyLaTeX
117e4f59720de9d13ddb4eaa439915addb616f1d
tests/cli/test_pinout.py
tests/cli/test_pinout.py
from __future__ import ( unicode_literals, absolute_import, print_function, division, ) str = type('') import pytest import gpiozero.cli.pinout as pinout def test_args_incorrect(): with pytest.raises(SystemExit) as ex: pinout.parse_args(['--nonexistentarg']) assert ex.value.code...
from __future__ import ( unicode_literals, absolute_import, print_function, division, ) str = type('') import pytest from gpiozero.cli import pinout def test_args_incorrect(): with pytest.raises(SystemExit) as ex: pinout.parse_args(['--nonexistentarg']) assert ex.value.code == 2...
Use from to import rather than rename
Use from to import rather than rename
Python
bsd-3-clause
waveform80/gpio-zero,MrHarcombe/python-gpiozero,RPi-Distro/python-gpiozero
d814c9c131f2c2957173302f7c4c1cbf2b719b45
check_rfc_header.py
check_rfc_header.py
#!/usr/bin/env python # -*- encoding: utf-8 import os from travistooling import ROOT def get_rfc_readmes(repo): rfcs_dir = os.path.join(repo, 'docs', 'rfcs') for root, _, filenames in os.walk(rfcs_dir): for f in filenames: if f == 'README.md': yield os.path.join(root, f) ...
#!/usr/bin/env python # -*- encoding: utf-8 import datetime as dt import os from travistooling import git, ROOT def get_rfc_readmes(repo): rfcs_dir = os.path.join(repo, 'docs', 'rfcs') for root, _, filenames in os.walk(rfcs_dir): for f in filenames: if f == 'README.md': y...
Check update dates in the RFC headers
Check update dates in the RFC headers
Python
mit
wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api
d29410b39af1165ba520e7ecad7e6e9c36a7fd2f
test/test_basic.py
test/test_basic.py
#!/usr/bin/env python3 #coding=UTF-8 import os import sys #installed import pytest #local sys.path.append(os.path.split(os.path.split(__file__)[0])[0]) import searchcolor from api_keys import GoogleKeyLocker as Key Key = Key() def test_google_average(): result = searchcolor.google_average('Death', 10, Key.api(),...
#!/usr/bin/env python3 #coding=UTF-8 import os import sys #installed import pytest #local sys.path.append(os.path.split(os.path.split(__file__)[0])[0]) import searchcolor from api_keys import GoogleKeyLocker from api_keys import BingKeyLocker from api_keys import MSCSKeyLocker GKL = GoogleKeyLocker() BKL = BingKeyLoc...
Add tests for bing and mscs
Add tests for bing and mscs
Python
mit
Tathorack/searchcolor,Tathorack/searchcolor
01f3aaf8c0b2351ea41b854142263f2d52c03239
comics/comics/perrybiblefellowship.py
comics/comics/perrybiblefellowship.py
from comics.aggregator.crawler import CrawlerBase, CrawlerImage from comics.core.comic_data import ComicDataBase class ComicData(ComicDataBase): name = "The Perry Bible Fellowship" language = "en" url = "http://www.pbfcomics.com/" start_date = "2001-01-01" rights = "Nicholas Gurewitch" class Cra...
from comics.aggregator.crawler import CrawlerBase, CrawlerImage from comics.core.comic_data import ComicDataBase class ComicData(ComicDataBase): name = "The Perry Bible Fellowship" language = "en" url = "http://www.pbfcomics.com/" start_date = "2001-01-01" rights = "Nicholas Gurewitch" class Cra...
Use CSS selector instead of xpath for "The Perry Bible Fellowship"
Use CSS selector instead of xpath for "The Perry Bible Fellowship"
Python
agpl-3.0
jodal/comics,datagutten/comics,datagutten/comics,jodal/comics,datagutten/comics,jodal/comics,jodal/comics,datagutten/comics
cde63b076027345486e4e836a02811962ad5bcaa
tests/test_completion.py
tests/test_completion.py
import os import subprocess import sys from pathlib import Path import typer from typer.testing import CliRunner from first_steps import tutorial001 as mod runner = CliRunner() app = typer.Typer() app.command()(mod.main) def test_show_completion(): result = subprocess.run( [ "bash", ...
import os import subprocess import sys from pathlib import Path import typer from typer.testing import CliRunner from first_steps import tutorial001 as mod runner = CliRunner() app = typer.Typer() app.command()(mod.main) def test_show_completion(): result = subprocess.run( [ "bash", ...
Fix test completion, check for bash completion file before running
:bug: Fix test completion, check for bash completion file before running
Python
mit
tiangolo/typer,tiangolo/typer