commit
stringlengths
40
40
old_file
stringlengths
4
264
new_file
stringlengths
4
264
old_contents
stringlengths
0
3.26k
new_contents
stringlengths
1
4.43k
subject
stringlengths
15
624
message
stringlengths
15
4.7k
lang
stringclasses
3 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
74652fd620f33231e4e3086d4b461c2cdf18bfba
conjureup/controllers/vspheresetup/common.py
conjureup/controllers/vspheresetup/common.py
from conjureup import controllers from conjureup.app_config import app class BaseVSphereSetupController: def __init__(self): # Assign current datacenter app.provider.login() for dc in app.provider.get_datacenters(): if dc.name == app.provider.region: self.datace...
from conjureup import controllers from conjureup.app_config import app class BaseVSphereSetupController: def __init__(self): # Assign current datacenter app.provider.login() for dc in app.provider.get_datacenters(): if dc == app.provider.region: self.datacenter ...
Fix datacenter listing for r34lz
Fix datacenter listing for r34lz Signed-off-by: Adam Stokes <49c255c1d074742f60d19fdba5e2aa5a34add567@users.noreply.github.com>
Python
mit
Ubuntu-Solutions-Engineering/conjure,Ubuntu-Solutions-Engineering/conjure,ubuntu/conjure-up,conjure-up/conjure-up,ubuntu/conjure-up,conjure-up/conjure-up
532b0809b040318abbb8e62848f18ad0cdf72547
src/workspace/workspace_managers.py
src/workspace/workspace_managers.py
from workspace.models import GroupPublishedWorkspace, PublishedWorkSpace, WorkSpace def ref_from_workspace(workspace): if isinstance(workspace, WorkSpace): return 'group/' + str(workspace.id) elif isinstance(workspace, PublishedWorkSpace): return 'group_published/' + str(workspace.id) class...
from workspace.models import GroupPublishedWorkspace, PublishedWorkSpace, WorkSpace def ref_from_workspace(workspace): if isinstance(workspace, WorkSpace): return 'group/' + str(workspace.id) elif isinstance(workspace, PublishedWorkSpace): return 'group_published/' + str(workspace.id) class...
Make OrganizationWorkspaceManager ignore the original workspace when sharing workspaces with groups
Make OrganizationWorkspaceManager ignore the original workspace when sharing workspaces with groups
Python
agpl-3.0
rockneurotiko/wirecloud,jpajuelo/wirecloud,rockneurotiko/wirecloud,jpajuelo/wirecloud,jpajuelo/wirecloud,rockneurotiko/wirecloud,jpajuelo/wirecloud,rockneurotiko/wirecloud
06e7cf66d37a34a33349e47c374e733b1f3006be
test/functional/feature_shutdown.py
test/functional/feature_shutdown.py
#!/usr/bin/env python3 # Copyright (c) 2018 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test bitcoind shutdown.""" from test_framework.test_framework import BitcoinTestFramework from test_framewo...
#!/usr/bin/env python3 # Copyright (c) 2018 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test bitcoind shutdown.""" from test_framework.test_framework import BitcoinTestFramework from test_framewo...
Remove race between connecting and shutdown on separate connections
qa: Remove race between connecting and shutdown on separate connections
Python
mit
chaincoin/chaincoin,chaincoin/chaincoin,chaincoin/chaincoin,chaincoin/chaincoin,chaincoin/chaincoin,chaincoin/chaincoin
63ca54e320b77501a304aa0520e133e1194e1324
src/sentry/tasks/deletion.py
src/sentry/tasks/deletion.py
""" sentry.tasks.deletion ~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2013 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from celery.task import task @task(name='sentry.tasks.deletion.delete_project', queue='cleanup') def delete_project(object_id, **kwargs): f...
""" sentry.tasks.deletion ~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2013 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from celery.task import task @task(name='sentry.tasks.deletion.delete_project', queue='cleanup') def delete_project(object_id, **kwargs): f...
Break delete_project into smaller tasks
Break delete_project into smaller tasks
Python
bsd-3-clause
vperron/sentry,BuildingLink/sentry,JTCunning/sentry,fotinakis/sentry,BuildingLink/sentry,zenefits/sentry,daevaorn/sentry,nicholasserra/sentry,hongliang5623/sentry,llonchj/sentry,mitsuhiko/sentry,TedaLIEz/sentry,alexm92/sentry,mvaled/sentry,jokey2k/sentry,fuziontech/sentry,ngonzalvez/sentry,looker/sentry,camilonova/sent...
d73872b8bcc6c7c32fa10d4a8ffdd77fe568a954
pyautotest/cli.py
pyautotest/cli.py
# -*- coding: utf-8 -*- import logging import os import signal import time from optparse import OptionParser from watchdog.observers import Observer from pyautotest.observers import Notifier, ChangeHandler # Configure logging logging.basicConfig(format='%(asctime)s (%(name)s) [%(levelname)s]: %(message)s', datefmt=...
# -*- coding: utf-8 -*- import argparse import logging import os import signal import time from watchdog.observers import Observer from pyautotest.observers import Notifier, ChangeHandler # Configure logging logging.basicConfig(format='%(asctime)s (%(name)s) [%(levelname)s]: %(message)s', datefmt='%m-%d-%Y %H:%M:%S...
Switch from optparase to argparse
Switch from optparase to argparse
Python
mit
ascarter/pyautotest
5e30bd1ae8218a6ad5a2582c15aed99258994d83
tests/tests/test_swappable_model.py
tests/tests/test_swappable_model.py
from django.test import TestCase
from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.test import TestCase, modify_settings from boardinghouse.schema import get_schema_model class TestSwappableModel(TestCase): @modify_settings() def test_schema_model_app_not_found(self): settings.BOAR...
Write tests for swappable model.
Write tests for swappable model. Resolves #28, #36. --HG-- branch : fix-swappable-model
Python
bsd-3-clause
schinckel/django-boardinghouse,schinckel/django-boardinghouse,schinckel/django-boardinghouse
1b1652053213f3939b50b2ac66a775cd5d4beed9
openpnm/__init__.py
openpnm/__init__.py
r""" ======= OpenPNM ======= OpenPNM is a package for performing pore network simulations of transport in porous materials. OpenPNM consists of several key modules. Each module is consisted of several classes and each class is consisted of a few methods. Here, you'll find a comprehensive documentation of the modules,...
r""" ======= OpenPNM ======= OpenPNM is a package for performing pore network simulations of transport in porous materials. OpenPNM consists of several key modules. Each module is consisted of several classes and each class is consisted of a few methods. Here, you'll find a comprehensive documentation of the modules,...
Fix import order to avoid circular import
Fix import order to avoid circular import
Python
mit
PMEAL/OpenPNM
32bf828445ed897609b908dff435191287f922f4
bookie/views/stats.py
bookie/views/stats.py
"""Basic views with no home""" import logging from pyramid.view import view_config from bookie.bcelery import tasks from bookie.models import BmarkMgr from bookie.models.auth import ActivationMgr from bookie.models.auth import UserMgr LOG = logging.getLogger(__name__) @view_config( route_name="dashboard", ...
"""Basic views with no home""" import logging from pyramid.view import view_config from bookie.models import BmarkMgr from bookie.models.auth import ActivationMgr from bookie.models.auth import UserMgr LOG = logging.getLogger(__name__) @view_config( route_name="dashboard", renderer="/stats/dashboard.mako")...
Clean up old code no longer used
Clean up old code no longer used
Python
agpl-3.0
adamlincoln/Bookie,charany1/Bookie,GreenLunar/Bookie,charany1/Bookie,skmezanul/Bookie,charany1/Bookie,adamlincoln/Bookie,GreenLunar/Bookie,pombredanne/Bookie,wangjun/Bookie,bookieio/Bookie,skmezanul/Bookie,pombredanne/Bookie,bookieio/Bookie,GreenLunar/Bookie,pombredanne/Bookie,teodesson/Bookie,skmezanul/Bookie,bookieio...
a29dad3b094b8d01a695e72cfc5e9b3bd51d6b6a
DataBase.py
DataBase.py
''' Copyright 2015 RTeam (Edgar Kaziahmedov, Klim Kireev, Artem Yashuhin) 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 re...
Use source file with license
Use source file with license
Python
apache-2.0
proffK/CourseManager
130acde92df3b0f9aad2f28b61f45e37531f44ac
runserver.py
runserver.py
#!/usr/bin/env python from sherry import app # Load debug config app.config.from_pyfile('../sherry.conf', silent=False) app.run(host='0.0.0.0', port=5000, debug=True)
#!/usr/bin/env python from sherry import app # Load debug config app.config.from_pyfile('../sherry.conf', silent=True) app.run(host='0.0.0.0', port=5000, debug=True)
Make optional sherry.conf optional. Oops.
Make optional sherry.conf optional. Oops.
Python
bsd-2-clause
PaulMcMillan/sherry,PaulMcMillan/sherry
c64149d3b1bb4998bddd6c05c85f0b3129f47020
pydbus/bus.py
pydbus/bus.py
from gi.repository import Gio from .proxy import ProxyMixin from .bus_names import OwnMixin, WatchMixin from .subscription import SubscriptionMixin from .registration import RegistrationMixin from .publication import PublicationMixin class Bus(ProxyMixin, OwnMixin, WatchMixin, SubscriptionMixin, RegistrationMixin, Pub...
from gi.repository import Gio from .proxy import ProxyMixin from .bus_names import OwnMixin, WatchMixin from .subscription import SubscriptionMixin from .registration import RegistrationMixin from .publication import PublicationMixin class Bus(ProxyMixin, OwnMixin, WatchMixin, SubscriptionMixin, RegistrationMixin, Pub...
Increase the default timeout to 1s.
Increase the default timeout to 1s.
Python
lgpl-2.1
LEW21/pydbus,LEW21/pydbus
c5a2c7e802d89ea17a7f0fd1a9194eaab8eaf61d
wcontrol/src/main.py
wcontrol/src/main.py
from flask import Flask app = Flask(__name__) app.config.from_object("config")
import os from flask import Flask app = Flask(__name__) app.config.from_object(os.environ.get("WCONTROL_CONF"))
Use a env var to get config
Use a env var to get config
Python
mit
pahumadad/weight-control,pahumadad/weight-control,pahumadad/weight-control,pahumadad/weight-control
8d669dc8b09b8d7c8bc9b4c123e2bdd7c3521521
functionaltests/api/base.py
functionaltests/api/base.py
# -*- coding: utf-8 -*- # # Copyright 2013 - Noorul Islam K M # # 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 applic...
# -*- coding: utf-8 -*- # # Copyright 2013 - Noorul Islam K M # # 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 applic...
Fix Tempest tests failing on gate-solum-devstack-dsvm
Fix Tempest tests failing on gate-solum-devstack-dsvm Due to a new commit on tempest, devstack tests are failing. It changed the signature of RestClient constructor. This patch changes the signature of our inherited class to match the change from tempest. Change-Id: Id15682c68de123c0d66c6aa10d889c6304fcbb65
Python
apache-2.0
devdattakulkarni/test-solum,openstack/solum,ed-/solum,openstack/solum,ed-/solum,gilbertpilz/solum,ed-/solum,julienvey/solum,gilbertpilz/solum,stackforge/solum,ed-/solum,stackforge/solum,gilbertpilz/solum,gilbertpilz/solum,devdattakulkarni/test-solum,julienvey/solum
98dfc5569fb1ae58905f8b6a36deeda324dcdd7b
cronos/teilar/models.py
cronos/teilar/models.py
from django.db import models class Departments(models.Model): urlid = models.IntegerField(unique = True) name = models.CharField("Department name", max_length = 200) class Teachers(models.Model): urlid = models.CharField("URL ID", max_length = 30, unique = True) name = models.CharField("Teacher name",...
from django.db import models class Departments(models.Model): urlid = models.IntegerField(unique = True) name = models.CharField("Department name", max_length = 200) deprecated = models.BooleanField(default = False) def __unicode__(self): return self.name class Teachers(models.Model): url...
Add deprecated flag for teachers and departments
Add deprecated flag for teachers and departments
Python
agpl-3.0
LinuxTeam-teilar/cronos.teilar.gr,LinuxTeam-teilar/cronos.teilar.gr,LinuxTeam-teilar/cronos.teilar.gr
2ac94aa922dbf2d07039bc6545e7b1d31c5c9e4e
src/cclib/progress/__init__.py
src/cclib/progress/__init__.py
__revision__ = "$Revision$" from textprogress import TextProgress try: import qt except ImportError: pass # import QtProgress will cause an error else: from qtprogress import QtProgress
__revision__ = "$Revision$" from textprogress import TextProgress import sys if 'qt' in sys.modules.keys(): from qtprogress import QtProgress
Check to see if qt is loaded; if so, export QtProgress class
Check to see if qt is loaded; if so, export QtProgress class
Python
lgpl-2.1
Clyde-fare/cclib,Schamnad/cclib,jchodera/cclib,ghutchis/cclib,gaursagar/cclib,berquist/cclib,andersx/cclib,ben-albrecht/cclib,Schamnad/cclib,cclib/cclib,ATenderholt/cclib,cclib/cclib,langner/cclib,berquist/cclib,Clyde-fare/cclib,langner/cclib,ben-albrecht/cclib,ATenderholt/cclib,ghutchis/cclib,jchodera/cclib,andersx/cc...
f239fd08bb5536501b05ba6a81c99edffdea6f38
pylamb/bmi_ilamb.py
pylamb/bmi_ilamb.py
#! /usr/bin/env python import sys import subprocess class BmiIlamb(object): _command = 'run_ilamb' _args = None _env = None def __init__(self): self._time = self.get_start_time() @property def args(self): return [self._command] + (self._args or []) def get_component_name...
#! /usr/bin/env python import sys import subprocess class BmiIlamb(object): _command = 'run_ilamb.sh' _args = None _env = None def __init__(self): self._time = self.get_start_time() @property def args(self): return [self._command] + (self._args or []) def get_component_n...
Use the correct name for the run script
Use the correct name for the run script It may be time to go home.
Python
mit
permamodel/ILAMB,permamodel/ILAMB,permamodel/ILAMB
32def5f720b5ffb858f604dc360f66fa2a1b946a
pirx/base.py
pirx/base.py
import collections class Settings(object): def __init__(self): self._settings = collections.OrderedDict() def __setattr__(self, name, value): if name.startswith('_'): super(Settings, self).__setattr__(name, value) else: self._settings[name] = value def _se...
import collections class Settings(object): def __init__(self): self._settings = collections.OrderedDict() def __setattr__(self, name, value): if name.startswith('_'): super(Settings, self).__setattr__(name, value) else: self._settings[name] = value def __s...
Replace 'write' method with '__str__'
Replace 'write' method with '__str__'
Python
mit
piotrekw/pirx
62e32c356fc86bcd855d2931974b9df17856809e
tests/backends/test_macOS.py
tests/backends/test_macOS.py
import pytest import keyring from keyring.testing.backend import BackendBasicTests from keyring.backends import macOS @pytest.mark.skipif( not keyring.backends.macOS.Keyring.viable, reason="macOS backend not viable", ) class TestOSXKeychain(BackendBasicTests): def init_keyring(self): return macOS...
import pytest import keyring from keyring.testing.backend import BackendBasicTests from keyring.backends import macOS @pytest.mark.skipif( not keyring.backends.macOS.Keyring.viable, reason="macOS backend not viable", ) class Test_macOSKeychain(BackendBasicTests): def init_keyring(self): return ma...
Rename test to match preferred naming convention for macOS.
Rename test to match preferred naming convention for macOS.
Python
mit
jaraco/keyring
d26b9d22363f9763f959332d07445a2a4e7c221c
services/vimeo.py
services/vimeo.py
import foauth.providers class Vimeo(foauth.providers.OAuth1): # General info about the provider provider_url = 'http://vimeo.com/' docs_url = 'http://developer.vimeo.com/apis/advanced' category = 'Videos' # URLs to interact with the API request_token_url = 'https://vimeo.com/oauth/request_tok...
import foauth.providers class Vimeo(foauth.providers.OAuth1): # General info about the provider provider_url = 'http://vimeo.com/' docs_url = 'http://developer.vimeo.com/apis/advanced' category = 'Videos' # URLs to interact with the API request_token_url = 'https://vimeo.com/oauth/request_tok...
Rewrite Vimeo to use the new scope selection system
Rewrite Vimeo to use the new scope selection system
Python
bsd-3-clause
foauth/foauth.org,foauth/foauth.org,foauth/oauth-proxy,foauth/foauth.org
612c393ec4d964fb933ebf5b8f957ae573ae65ba
tests/rules/test_git_push.py
tests/rules/test_git_push.py
import pytest from thefuck.rules.git_push import match, get_new_command from tests.utils import Command @pytest.fixture def stderr(): return '''fatal: The current branch master has no upstream branch. To push the current branch and set the remote as upstream, use git push --set-upstream origin master ''' ...
import pytest from thefuck.rules.git_push import match, get_new_command from tests.utils import Command @pytest.fixture def stderr(): return '''fatal: The current branch master has no upstream branch. To push the current branch and set the remote as upstream, use git push --set-upstream origin master ''' ...
Check git_push matches without specifying a branch
Check git_push matches without specifying a branch
Python
mit
nvbn/thefuck,mlk/thefuck,mlk/thefuck,nvbn/thefuck,SimenB/thefuck,Clpsplug/thefuck,scorphus/thefuck,scorphus/thefuck,SimenB/thefuck,Clpsplug/thefuck
e621b9f03b19e38dc6754dd1a4cb7b172e4891e7
tests/test_extended_tests.py
tests/test_extended_tests.py
import pytest import glob from html2kirby import HTML2Kirby files = [] for f in glob.glob("extended_tests/*.html"): html = f txt = f.replace(".html", ".txt") files.append((html, txt)) @pytest.mark.parametrize("html,kirby", files) def test_file(html, kirby): formatter = HTML2Kirby() with open(...
import pytest import glob import os from html2kirby import HTML2Kirby files = [] path = os.path.dirname(os.path.abspath(__file__)) extended_tests_path = os.path.join(path, "extended_tests/*.html") for f in glob.glob(extended_tests_path): html = f txt = f.replace(".html", ".txt") files.append((html, tx...
Fix the extended test search
Fix the extended test search
Python
mit
liip/html2kirby,liip/html2kirby
603aacd06b99326d7dbab28e750b34589c51fa05
tests/test_postgresqlgate.py
tests/test_postgresqlgate.py
# coding: utf-8 """ Unit tests for the base gate. """ from unittest.mock import MagicMock, mock_open, patch import smdba.postgresqlgate class TestPgGt: """ Test suite for base gate. """ @patch("os.path.exists", MagicMock(side_effect=[True, False, False])) @patch("smdba.postgresqlgate.open", new_ca...
# coding: utf-8 """ Unit tests for the base gate. """ from unittest.mock import MagicMock, mock_open, patch import smdba.postgresqlgate class TestPgGt: """ Test suite for base gate. """ @patch("os.path.exists", MagicMock(side_effect=[True, False, False])) @patch("smdba.postgresqlgate.open", new_ca...
Add unit test for database scenario call
Add unit test for database scenario call
Python
mit
SUSE/smdba,SUSE/smdba
2a0b1d070996bfb3d950d4fae70b264ddabc7d2f
sheldon/config.py
sheldon/config.py
# -*- coding: utf-8 -*- """ @author: Seva Zhidkov @contact: zhidkovseva@gmail.com @license: The MIT license Copyright (C) 2015 """ import os class Config: def __init__(self, prefix='SHELDON_'): """ Load config from environment variables. :param prefix: string, all needed environment va...
# -*- coding: utf-8 -*- """ @author: Seva Zhidkov @contact: zhidkovseva@gmail.com @license: The MIT license Copyright (C) 2015 """ import os class Config: def __init__(self, prefix='SHELDON_'): """ Load config from environment variables. :param prefix: string, all needed environment va...
Add function for getting installed plugins
Add function for getting installed plugins
Python
mit
lises/sheldon
2f8ae4d29bd95c298209a0cb93b5354c00186d6b
trackpy/C_fallback_python.py
trackpy/C_fallback_python.py
try: from _Cfilters import nullify_secondary_maxima except ImportError: import numpy as np # Because of the way C imports work, nullify_secondary_maxima # is *called*, as in nullify_secondary_maxima(). # For the pure Python variant, we do not want to call the function, # so we make nullify_secon...
try: from _Cfilters import nullify_secondary_maxima except ImportError: import numpy as np # Because of the way C imports work, nullify_secondary_maxima # is *called*, as in nullify_secondary_maxima(). # For the pure Python variant, we do not want to call the function, # so we make nullify_secon...
Fix and speedup pure-Python fallback for C filter.
BUG/PERF: Fix and speedup pure-Python fallback for C filter.
Python
bsd-3-clause
daniorerio/trackpy,daniorerio/trackpy
cef249edef4100b8a3c009fa05febbc66c3fe5df
spamostack/spamostack.py
spamostack/spamostack.py
import argparse from collections import OrderedDict import json import logger import logging from session import Session from simulator import Simulator from cache import Cache from client_factory import ClientFactory from keeper import Keeper parser = argparse.ArgumentParser() parser.add_argument('--pipe', dest='pi...
import argparse from collections import OrderedDict import json import logger import logging from session import Session from simulator import Simulator from cache import Cache from client_factory import ClientFactory from keeper import Keeper parser = argparse.ArgumentParser() parser.add_argument('--pipe', dest='pi...
Add default path to config
Add default path to config
Python
apache-2.0
seecloud/spamostack
0003ef7fe3d59c4bda034dee334d45b6d7a2622d
pyvm_test.py
pyvm_test.py
import pyvm import unittest class PyVMTest(unittest.TestCase): def setUp(self): self.vm = pyvm.PythonVM() def test_load_const_num(self): self.assertEqual( 10, self.vm.eval('10') ) def test_load_const_str(self): self.assertEqual( "hoge", ...
import pyvm import unittest class PyVMTest(unittest.TestCase): def setUp(self): self.vm = pyvm.PythonVM() def test_load_const_num(self): self.assertEqual( 10, self.vm.eval('10') ) def test_load_const_num_float(self): self.assertEqual( 10...
Add test of storing float
Add test of storing float
Python
mit
utgwkk/tiny-python-vm
9ff48dd4bff605ad1521c8ebaffc18432a155d8d
wagtailcodeblock/settings.py
wagtailcodeblock/settings.py
from django.conf import settings def get_language_choices(): """ Default list of language choices, if not overridden by Django. """ DEFAULT_LANGUAGES = ( ('bash', 'Bash/Shell'), ('css', 'CSS'), ('diff', 'diff'), ('http', 'HTML'), ('javascript', 'Java...
from django.conf import settings def get_language_choices(): """ Default list of language choices, if not overridden by Django. """ DEFAULT_LANGUAGES = ( ('bash', 'Bash/Shell'), ('css', 'CSS'), ('diff', 'diff'), ('http', 'HTML'), ('javascript', 'Java...
Update to prims 1.10 version
Update to prims 1.10 version
Python
bsd-3-clause
FlipperPA/wagtailcodeblock,FlipperPA/wagtailcodeblock,FlipperPA/wagtailcodeblock
c4d64672c8c72ca928b354e9cfd35a7d40dbb78f
MROCPdjangoForm/ocpipeline/mrpaths.py
MROCPdjangoForm/ocpipeline/mrpaths.py
# # Code to load project paths # import os, sys MR_BASE_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), "/Users/dmhembere44/MR-connectome" )) MR_CMAPPER_PATH = os.path.join(MR_BASE_PATH, "cmapper" ) MR_MRCAP_PATH = os.path.join(MR_BASE_PATH, "mrcap" ) sys.path += [ MR_BASE_PATH, MR_CMAPPER_PATH, MR_MR...
# # Code to load project paths # import os, sys MR_BASE_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.." )) MR_CMAPPER_PATH = os.path.join(MR_BASE_PATH, "cmapper" ) MR_MRCAP_PATH = os.path.join(MR_BASE_PATH, "mrcap" ) sys.path += [ MR_BASE_PATH, MR_CMAPPER_PATH, MR_MRCAP_PATH ]
Change to path, made relative
Change to path, made relative Former-commit-id: f00bf782fad3f6ddc6d2c97a23ff4f087ad3a22f
Python
apache-2.0
neurodata/ndmg
cba5a3d4928a3ee2e7672ca4a3f766a789d83acf
cupcake/smush/plot.py
cupcake/smush/plot.py
""" User-facing interface for plotting all dimensionality reduction algorithms """ def smushplot(data, smusher='pca', n_components=2, marker='o', marker_order=None, text=False, text_order=None, linewidth=1, linewidth_order=None, edgecolor='k', edgecolor_order=None, smusher_kws=None, ...
""" User-facing interface for plotting all dimensionality reduction algorithms """ def smushplot(data, smusher='PCA', x=1, y=2, n_components=2, marker='o', marker_order=None, text=False, text_order=None, linewidth=1, linewidth_order=None, edgecolor='k', edgecolor_order=None, s...
Add x, y arguments and docstring
Add x, y arguments and docstring
Python
bsd-3-clause
olgabot/cupcake
66ba9aa2172fbed67b67a06acb331d449d32a33c
tests/services/shop/conftest.py
tests/services/shop/conftest.py
""" :Copyright: 2006-2020 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ import pytest from byceps.services.shop.cart.models import Cart from byceps.services.shop.sequence import service as sequence_service from byceps.services.shop.shop import service as shop_service from testfixtures.sho...
""" :Copyright: 2006-2020 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ import pytest from byceps.services.shop.cart.models import Cart from byceps.services.shop.sequence import service as sequence_service from byceps.services.shop.shop import service as shop_service from testfixtures.sho...
Remove unused fixture from orderer
Remove unused fixture from orderer
Python
bsd-3-clause
homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps
d95001c17b095b713d8a4edacead561ba127aa53
src/NamerTests.py
src/NamerTests.py
import unittest import os from approvaltests.Namer import Namer class NamerTests(unittest.TestCase): def test_class(self): n = Namer() self.assertEqual("NamerTests", n.getClassName()) def test_method(self): n = Namer() self.assertEqual("test_method", n.getMethodName()) d...
import unittest import os from approvaltests.Namer import Namer class NamerTests(unittest.TestCase): def test_class(self): n = Namer() self.assertEqual("NamerTests", n.getClassName()) def test_method(self): n = Namer() self.assertEqual("test_method", n.getMethodName()) d...
Remove '\' condition from test as it will not be in the file path when used on Linux.
Remove '\' condition from test as it will not be in the file path when used on Linux.
Python
apache-2.0
approvals/ApprovalTests.Python,tdpreece/ApprovalTests.Python,approvals/ApprovalTests.Python,approvals/ApprovalTests.Python
4e88b6ee9c1927aeb312e40335633d2ca9871c8c
tokens/migrations/0002_token_token_type.py
tokens/migrations/0002_token_token_type.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2017-07-14 19:02 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('tokens', '0001_initial'), ] operations = [ migrations.AddField( ...
# -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2017-07-14 19:02 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('tokens', '0001_initial'), ] operations = [ migrations.AddField( ...
Fix psycopg2 DataError due to bad varchar length
Fix psycopg2 DataError due to bad varchar length
Python
apache-2.0
onyb/ethane,onyb/ethane,onyb/ethane,onyb/ethane
e743f82d93e9501c8b3bd827ee0553ceec8aadb6
linkedin_scraper/spiders/search.py
linkedin_scraper/spiders/search.py
import scrapy class SearchSpider(scrapy.Spider): name = 'search' allowed_domains = ['linkedin.com'] start_urls = [ 'https://www.linkedin.com/vsearch/f?type=people&keywords=MateuszMoneta'] def parse(self, response): for search_result in response.css('li.mod.result.people'): ...
from os import environ from scrapy.spiders.init import InitSpider from scrapy.http import Request, FormRequest class SearchSpider(InitSpider): name = 'search' allowed_domains = ['linkedin.com'] login_page = 'https://www.linkedin.com/uas/login' start_urls = [ 'https://www.linkedin.com/vsearch...
Allow Spider to log into LinkedIn.
Allow Spider to log into LinkedIn. * SearchSpider now uses InitSpider as base class, * SearchSpider now accepts username and password arguments, * username and password can also be set by SPIDER_USERNAME and SPIDER_PASSWORD env variables, * SearchSpider log into LinkedIn by sending form with credentials to /uas/login ...
Python
mit
nihn/linkedin-scraper,nihn/linkedin-scraper
d237071aef4cc62c3506d25072937cdc6feab797
examples/modes/pygments_syntax_highlighter.py
examples/modes/pygments_syntax_highlighter.py
""" Minimal example showing the use of the AutoCompleteMode. """ import logging logging.basicConfig(level=logging.DEBUG) import sys from pyqode.qt import QtWidgets from pyqode.core.api import CodeEdit, ColorScheme from pyqode.core.backend import server from pyqode.core.modes import PygmentsSH if __name__ == '__main_...
""" Minimal example showing the use of the AutoCompleteMode. """ import logging logging.basicConfig(level=logging.DEBUG) import sys from pyqode.qt import QtWidgets from pyqode.core.api import CodeEdit, ColorScheme from pyqode.core.backend import server from pyqode.core.modes import PygmentsSH if __name__ == '__main_...
Update example to make use of the new simplified color scheme api
Update example to make use of the new simplified color scheme api
Python
mit
pyQode/pyqode.core,zwadar/pyqode.core,pyQode/pyqode.core
cd9b9675cd81e9ee01b4ad2932319a6070b82753
zerver/migrations/0099_index_wildcard_mentioned_user_messages.py
zerver/migrations/0099_index_wildcard_mentioned_user_messages.py
from django.db import migrations class Migration(migrations.Migration): dependencies = [ ("zerver", "0098_index_has_alert_word_user_messages"), ] operations = [ migrations.RunSQL( """ CREATE INDEX IF NOT EXISTS zerver_usermessage_wildcard_mentioned_message_id ...
from django.db import migrations class Migration(migrations.Migration): dependencies = [ ("zerver", "0098_index_has_alert_word_user_messages"), ] operations = [ migrations.RunSQL( """ CREATE INDEX IF NOT EXISTS zerver_usermessage_wildcard_mentioned_message_id ...
Fix typo in 0099 reverse_sql.
migrations: Fix typo in 0099 reverse_sql. Signed-off-by: Anders Kaseorg <dfdb7392591db597bc41cf266a9c3bc12a2706e5@zulip.com>
Python
apache-2.0
kou/zulip,kou/zulip,kou/zulip,rht/zulip,andersk/zulip,zulip/zulip,kou/zulip,andersk/zulip,andersk/zulip,zulip/zulip,andersk/zulip,rht/zulip,kou/zulip,rht/zulip,zulip/zulip,kou/zulip,andersk/zulip,zulip/zulip,zulip/zulip,zulip/zulip,rht/zulip,rht/zulip,kou/zulip,zulip/zulip,rht/zulip,rht/zulip,andersk/zulip,andersk/zuli...
2e897f7dce89d4b52c3507c62e7120ee238b713c
database/database_setup.py
database/database_setup.py
from sqlalchemy import Column, ForeignKey, Integer, String from sqlalchemy.orm import relationship from sqlalchemy import create_engine from models.base import Base from models.user import User from models.store import Store from models.product import Product engine = create_engine('sqlite:///productcatalog.db') Base...
from sqlalchemy import Column, ForeignKey, Integer, String from sqlalchemy.orm import relationship from sqlalchemy import create_engine from models.base import Base from models.user import User from models.store import Store from models.product import Product engine = create_engine('postgresql://catalog:catalog123!@l...
Connect database engine to postgresql
feat: Connect database engine to postgresql
Python
mit
caasted/aws-flask-catalog-app,caasted/aws-flask-catalog-app
a8c8b136f081e3a2c7f1fd1f833a85288a358e42
vumi_http_retry/workers/api/validate.py
vumi_http_retry/workers/api/validate.py
import json from functools import wraps from twisted.web import http from jsonschema import Draft4Validator from vumi_http_retry.workers.api.utils import response def validate(*validators): def validator(fn): @wraps(fn) def wrapper(api, req, *a, **kw): errors = [] for v...
import json from functools import wraps from twisted.web import http from jsonschema import Draft4Validator from vumi_http_retry.workers.api.utils import response def validate(*validators): def validator(fn): @wraps(fn) def wrapper(api, req, *a, **kw): errors = [] for v...
Change validators to allow additional arguments to be given to the functions they are wrapping
Change validators to allow additional arguments to be given to the functions they are wrapping
Python
bsd-3-clause
praekelt/vumi-http-retry-api,praekelt/vumi-http-retry-api
370dac353937d73798b4cd2014884b9f1aa95abf
osmaxx-py/osmaxx/contrib/auth/tests/test_frontend_permissions.py
osmaxx-py/osmaxx/contrib/auth/tests/test_frontend_permissions.py
from django.test import TestCase from django.contrib.auth.models import User from osmaxx.contrib.auth.frontend_permissions import user_in_osmaxx_group class TestFrontendPermissions(TestCase): def test_superuser_can_access_frontend_even_if_not_in_osmaxx_group(self): an_admin = User.objects.create_superuser...
from django.test import TestCase from django.contrib.auth.models import User, Group from osmaxx.contrib.auth.frontend_permissions import user_in_osmaxx_group, FRONTEND_USER_GROUP class TestFrontendPermissions(TestCase): def test_superuser_can_access_frontend_even_if_not_in_osmaxx_group(self): an_admin = U...
Test that users can access frontend when in osmaxx group
Test that users can access frontend when in osmaxx group
Python
mit
geometalab/osmaxx,geometalab/osmaxx-frontend,geometalab/osmaxx-frontend,geometalab/drf-utm-zone-info,geometalab/osmaxx,geometalab/drf-utm-zone-info,geometalab/osmaxx-frontend,geometalab/osmaxx,geometalab/osmaxx,geometalab/osmaxx-frontend
1652b921fa2fadc936b346fc3de217cf97b0e476
src/etc/make-snapshot.py
src/etc/make-snapshot.py
#!/usr/bin/env python import snapshot, sys if len(sys.argv) == 2: print(snapshot.make_snapshot(sys.argv[1], sys.argv[2], "")) else: print(snapshot.make_snapshot(sys.argv[1], sys.argv[2], sys.argv[3]))
#!/usr/bin/env python import snapshot, sys if len(sys.argv) == 3: print(snapshot.make_snapshot(sys.argv[1], sys.argv[2], "")) else: print(snapshot.make_snapshot(sys.argv[1], sys.argv[2], sys.argv[3]))
Fix condition in snapshot script. Argv is never 2 long, it can be 3 or 4.
Fix condition in snapshot script. Argv is never 2 long, it can be 3 or 4.
Python
apache-2.0
AerialX/rust-rt-minimal,fabricedesre/rust,emk/rust,erickt/rust,cllns/rust,j16r/rust,untitaker/rust,cllns/rust,miniupnp/rust,zachwick/rust,seanrivera/rust,aidancully/rust,achanda/rand,barosl/rust,pshc/rust,aidancully/rust,barosl/rust,kmcallister/rust,mdinger/rust,l0kod/rust,quornian/rust,fabricedesre/rust,LeoTestard/rus...
837b767036f580a8c9d523e0f6c175a75d1dc3b2
pi_control_service/gpio_service.py
pi_control_service/gpio_service.py
from rpc import RPCService from pi_pin_manager import PinManager ALLOWED_ACTIONS = ('on', 'off', 'read') class GPIOService(RPCService): def __init__(self, rabbit_url, device_key, pin_config): self.pins = PinManager(config_file=pin_config) super(GPIOService, self).__init__( rabbit_ur...
from rpc import RPCService from pi_pin_manager import PinManager ALLOWED_ACTIONS = ('on', 'off', 'read', 'get_config') class GPIOService(RPCService): def __init__(self, rabbit_url, device_key, pin_config): self.pins = PinManager(config_file=pin_config) super(GPIOService, self).__init__( ...
Add get_config as GPIO action
Add get_config as GPIO action
Python
mit
HydAu/ProjectWeekds_Pi-Control-Service,projectweekend/Pi-Control-Service
6f8b5950a85c79ed33c1d00a35a1def2efc7bff5
tests/conftest.py
tests/conftest.py
from factories import post_factory, post
from factories import post_factory, post import os import sys root = os.path.join(os.path.dirname(__file__)) package = os.path.join(root, '..') sys.path.insert(0, os.path.abspath(package))
Make the tests run just via py.test
Make the tests run just via py.test
Python
mit
kalasjocke/hyp
11bcc53bc80409a0458e3a5b72014c9837561b65
src/main/python/setup.py
src/main/python/setup.py
import setuptools __version__ = None # This will get replaced when reading version.py exec(open('rlbot/version.py').read()) with open("README.md", "r") as readme_file: long_description = readme_file.read() setuptools.setup( name='rlbot', packages=setuptools.find_packages(), install_requires=['psuti...
import setuptools __version__ = None # This will get replaced when reading version.py exec(open('rlbot/version.py').read()) with open("README.md", "r") as readme_file: long_description = readme_file.read() setuptools.setup( name='rlbot', packages=setuptools.find_packages(), install_requires=['psuti...
Add MIT license that shows up in `pip show rlbot`
Add MIT license that shows up in `pip show rlbot`
Python
mit
drssoccer55/RLBot,drssoccer55/RLBot
39c777d6fc5555534628113190bb543c6225c07e
uncurl/bin.py
uncurl/bin.py
from __future__ import print_function import sys from .api import parse def main(): result = parse(sys.argv[1]) print(result)
from __future__ import print_function import sys from .api import parse def main(): if sys.stdin.isatty(): result = parse(sys.argv[1]) else: result = parse(sys.stdin.read()) print(result)
Read from stdin if available.
Read from stdin if available.
Python
apache-2.0
weinerjm/uncurl,spulec/uncurl
899f28e2cd7dbeb6227e8c56eef541cce1a424f4
alertaclient/commands/cmd_heartbeat.py
alertaclient/commands/cmd_heartbeat.py
import os import platform import sys import click prog = os.path.basename(sys.argv[0]) @click.command('heartbeat', short_help='Send a heartbeat') @click.option('--origin', default='{}/{}'.format(prog, platform.uname()[1])) @click.option('--tag', '-T', 'tags', multiple=True) @click.option('--timeout', metavar='EXPIR...
import os import platform import sys import click prog = os.path.basename(sys.argv[0]) @click.command('heartbeat', short_help='Send a heartbeat') @click.option('--origin', default='{}/{}'.format(prog, platform.uname()[1])) @click.option('--tag', '-T', 'tags', multiple=True) @click.option('--timeout', metavar='EXPIR...
Add check that heartbeat timeout is integer
Add check that heartbeat timeout is integer
Python
apache-2.0
alerta/python-alerta-client,alerta/python-alerta-client,alerta/python-alerta
ee8cb600c772e4a0f795a0fe00b1e612cb8a8e37
dirmuncher.py
dirmuncher.py
#!/usr/bin/env python # -*- Coding: utf-8 -*- import os class Dirmuncher: def __init__(self, directory): self.directory = directory def directoryListing(self): for dirname, dirnames, filenames in os.walk(self.directory): # Subdirectories for subdirname in dirnames: ...
#!/usr/bin/env python # -*- Coding: utf-8 -*- import os class Dirmuncher: def __init__(self, directory): self.directory = directory def getFiles(self): result = {} for dirname, dirnames, filenames in os.walk(self.directory): # Subdirectories for subdirname in ...
Sort files into dict with dir as key
[py] Sort files into dict with dir as key
Python
mit
claudemuller/masfir
f9c51c592483ab08417d4df33898d32f7700ffe9
sal/management/commands/update_admin_user.py
sal/management/commands/update_admin_user.py
''' Creates an admin user if there aren't any existing superusers ''' from django.core.management.base import BaseCommand, CommandError from django.contrib.auth.models import User from optparse import make_option class Command(BaseCommand): help = 'Creates/Updates an Admin user' def add_arguments(self, pars...
"""Creates an admin user if there aren't any existing superusers.""" from optparse import make_option from django.contrib.auth.models import User from django.core.management.base import BaseCommand, CommandError class Command(BaseCommand): help = 'Creates/Updates an Admin user' def add_arguments(self, par...
Fix exception handling in management command. Clean up.
Fix exception handling in management command. Clean up.
Python
apache-2.0
salopensource/sal,sheagcraig/sal,sheagcraig/sal,salopensource/sal,salopensource/sal,sheagcraig/sal,sheagcraig/sal,salopensource/sal
a5f60d664e7758b113abc31b405657952dd5eccd
tests/conftest.py
tests/conftest.py
import os import pytest from pywatson.watson import Watson @pytest.fixture def config(): """Get Watson configuration from the environment :return: dict with keys 'url', 'username', and 'password' """ try: return { 'url': os.environ['WATSON_URL'], 'username': os.environ...
import json import os import pytest from pywatson.watson import Watson @pytest.fixture def config(): """Get Watson configuration from the environment :return: dict with keys 'url', 'username', and 'password' """ try: return { 'url': os.environ['WATSON_URL'], 'username'...
Implement test data JSON loader
Implement test data JSON loader
Python
mit
sherlocke/pywatson
904db705daf24d68fcc9ac6010b55b93c7dc4544
txircd/modules/core/accounts.py
txircd/modules/core/accounts.py
from twisted.plugin import IPlugin from txircd.module_interface import IModuleData, ModuleData from txircd.utils import ircLower from zope.interface import implements class Accounts(ModuleData): implements(IPlugin, IModuleData) name = "Accounts" core = True def actions(self): return [ ("usercansetmetadata", ...
from twisted.plugin import IPlugin from twisted.words.protocols import irc from txircd.module_interface import IModuleData, ModuleData from txircd.utils import ircLower from zope.interface import implements # Numerics and names are taken from the IRCv3.1 SASL specification at http://ircv3.net/specs/extensions/sasl-3.1...
Add automatic sending of 900/901 numerics for account status
Add automatic sending of 900/901 numerics for account status
Python
bsd-3-clause
Heufneutje/txircd,ElementalAlchemist/txircd
f3c1e5bdf25b46e96a77221ace7438eb3b55cb05
bluebottle/common/management/commands/makemessages.py
bluebottle/common/management/commands/makemessages.py
import json import codecs import tempfile from django.core.management.commands.makemessages import Command as BaseCommand class Command(BaseCommand): """ Extend the makemessages to include some of the fixtures """ fixtures = [ ('bb_projects', 'project_data.json'), ('bb_tasks', 'skills.json'),...
import json import codecs import tempfile from django.core.management.commands.makemessages import Command as BaseCommand class Command(BaseCommand): """ Extend the makemessages to include some of the fixtures """ fixtures = [ ('bb_projects', 'project_data.json'), ('bb_tasks', 'skills.json'),...
Make loop a little more readable
Make loop a little more readable
Python
bsd-3-clause
onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle
ecc56eec0ebee4a93d5052280ae5d8c649e1e6da
tests/test_api.py
tests/test_api.py
from nose.tools import eq_ import mock from lcp import api @mock.patch('lcp.api.requests.request') def _assert_calls_requests_with_url(original_url, expected_url, request_mock): api.Client('BASE_URL').request('METHOD', original_url) expected_headers = {'Content-Type': 'application/json'} eq_(request_mock...
from nose.tools import eq_ import mock from lcp import api class TestApiClient(object): def setup(self): self.client = api.Client('BASE_URL') def test_request_does_not_alter_absolute_urls(self): for absolute_url in [ 'http://www.points.com', 'https://www.point...
Refactor api test to setup test client in setup +review PLAT-127 DCORE-1109
Refactor api test to setup test client in setup +review PLAT-127 DCORE-1109
Python
bsd-3-clause
bradsokol/PyLCP,Points/PyLCP,bradsokol/PyLCP,Points/PyLCP
7bdfb1ef77d23bc868434e8d74d6184dd68c0a6e
tests/test_api.py
tests/test_api.py
# coding: utf-8 """ Test the backend API Written so that after creating a new backend, you can immediately see which parts are missing! """ from unittest import TestCase import inspect from pycurlbrowser.backend import * from pycurlbrowser import Browser def is_http_backend_derived(t): if t is HttpBackend: ...
# coding: utf-8 """ Test the backend API Written so that after creating a new backend, you can immediately see which parts are missing! """ from unittest import TestCase import inspect from pycurlbrowser.backend import * from pycurlbrowser import Browser def is_http_backend_derived(t): if t is HttpBackend: ...
Improve API test by only comparing args and varargs.
Improve API test by only comparing args and varargs.
Python
agpl-3.0
ahri/pycurlbrowser
916900aaa29c5a59bcdd78ca05069ea431629de4
tests/test_cmd.py
tests/test_cmd.py
import unittest from click.testing import CliRunner from scuevals_api.cmd import cli class CmdsTestCase(unittest.TestCase): @classmethod def setUpClass(cls): cls.runner = CliRunner() def cli_run(self, *cmds): return self.runner.invoke(cli, cmds) cls.cli_run = cli_run ...
import unittest from click.testing import CliRunner from scuevals_api.cmd import cli class CmdsTestCase(unittest.TestCase): @classmethod def setUpClass(cls): cls.runner = CliRunner() def cli_run(self, *cmds): return self.runner.invoke(cli, cmds) cls.cli_run = cli_run ...
Fix error message for initdb test
Fix error message for initdb test
Python
agpl-3.0
SCUEvals/scuevals-api,SCUEvals/scuevals-api
cfaaf421bb9627f1741a9ef4074517fd5daaec86
wsgi/setup.py
wsgi/setup.py
import subprocess import sys import setup_util import os def start(args): subprocess.Popen("gunicorn hello:app -b 0.0.0.0:8080 -w " + str((args.max_threads * 2)) + " --log-level=critical", shell=True, cwd="wsgi") return 0 def stop(): p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE) out, err = p.com...
import subprocess import sys import setup_util import os def start(args): subprocess.Popen('gunicorn hello:app --worker-class="egg:meinheld#gunicorn_worker" -b 0.0.0.0:8080 -w ' + str((args.max_threads * 2)) + " --log-level=critical", shell=True, cwd="wsgi") return 0 def stop(): p = subproces...
Use meinheld worker (same as other Python Frameworks)
wsgi: Use meinheld worker (same as other Python Frameworks)
Python
bsd-3-clause
torhve/FrameworkBenchmarks,seem-sky/FrameworkBenchmarks,denkab/FrameworkBenchmarks,diablonhn/FrameworkBenchmarks,hamiltont/FrameworkBenchmarks,grob/FrameworkBenchmarks,lcp0578/FrameworkBenchmarks,knewmanTE/FrameworkBenchmarks,Ocramius/FrameworkBenchmarks,PermeAgility/FrameworkBenchmarks,jetty-project/FrameworkBenchmark...
1d4777f810388ee87cceb01c2b53367723fb3a71
PyFBA/cmd/__init__.py
PyFBA/cmd/__init__.py
from .citation import cite_me_please from .fluxes import measure_fluxes from .gapfill_from_roles import gapfill_from_roles from .assigned_functions_to_reactions import to_reactions from .fba_from_reactions import run_the_fba from .gapfill_from_reactions_multiple_conditions import gapfill_multiple_media from .media impo...
from .citation import cite_me_please from .fluxes import measure_fluxes from .gapfill_from_roles import gapfill_from_roles from .assigned_functions_to_reactions import to_reactions from .fba_from_reactions import run_the_fba from .gapfill_from_reactions_multiple_conditions import gapfill_multiple_media from .media impo...
Add a function to retrieve roles from reactions
Add a function to retrieve roles from reactions
Python
mit
linsalrob/PyFBA
6fd7f3cb01f621d2ea79e15188f8000c7b6fa361
tools/add_feed.py
tools/add_feed.py
import os from urllib.parse import urlencode, quote from autobit import Client def add_rarbg_feed(client, name, directory, filter_kwargs): url = 'http://localhost:5555/{}?{}'.format( quote(name), urlencode(filter_kwargs) ) return client.add_feed(name, url, directory) def main(): cl...
import os from autobit import Client def main(): client = Client('http://localhost:8081/gui/', auth=('admin', '20133')) client.get_torrents() name = input('name> ') directory = input('directory> ') os.makedirs(directory, exist_ok=True) client.add_feed( name, input('url> '),...
Remove code specific to my system
Remove code specific to my system
Python
mit
Mause/autobit
894203d67e88e8bac8ec4f8948d940789387b648
tests/data/questions.py
tests/data/questions.py
QUESTIONS = [ { 'questionText': 'What is the Labour Code?' }, { 'questionText': 'When can a union start a strike?' } ]
QUESTIONS = [ { 'questionText': 'What is the Labour Code?' }, { 'questionText': 'When can a union start a strike?', 'items': 0, 'evidenceRequest': { 'items': 0, 'profile': '' }, 'answerAssertion': '', 'category': '', 'co...
Add all blank parameters to sample question
Add all blank parameters to sample question
Python
mit
sherlocke/pywatson
111d0bd356c18d0c028c73cd8c84c9d3e3ae591c
astropy/io/misc/asdf/tags/tests/helpers.py
astropy/io/misc/asdf/tags/tests/helpers.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- import os import urllib.parse import yaml import numpy as np def run_schema_example_test(organization, standard, name, version, check_func=None): import asdf from asdf.tests import helpers from asdf.types import for...
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- import os import urllib.parse import urllib.request import yaml import numpy as np def run_schema_example_test(organization, standard, name, version, check_func=None): import asdf from asdf.tests import helpers from...
Fix ASDF tag test helper to load schemas correctly
Fix ASDF tag test helper to load schemas correctly
Python
bsd-3-clause
pllim/astropy,astropy/astropy,lpsinger/astropy,larrybradley/astropy,StuartLittlefair/astropy,mhvk/astropy,pllim/astropy,MSeifert04/astropy,saimn/astropy,dhomeier/astropy,lpsinger/astropy,pllim/astropy,stargaser/astropy,larrybradley/astropy,larrybradley/astropy,bsipocz/astropy,StuartLittlefair/astropy,astropy/astropy,dh...
e2f1787601e7c05c9c5ab2efe26b6d1cb90b2ccb
saleor/account/migrations/0040_auto_20200415_0443.py
saleor/account/migrations/0040_auto_20200415_0443.py
# Generated by Django 3.0.5 on 2020-04-15 09:43 from django.db import migrations def change_extension_permission_to_plugin_permission(apps, schema_editor): permission = apps.get_model("auth", "Permission") users = apps.get_model("account", "User") plugin_permission = permission.objects.filter( c...
# Generated by Django 3.0.5 on 2020-04-15 09:43 from django.db import migrations def change_extension_permission_to_plugin_permission(apps, schema_editor): permission = apps.get_model("auth", "Permission") users = apps.get_model("account", "User") service_account = apps.get_model("account", "ServiceAccou...
Fix plugin permission data migration
Fix plugin permission data migration
Python
bsd-3-clause
mociepka/saleor,mociepka/saleor,mociepka/saleor
03e0e11491c64ae546134eb6c963a31958fe6d6d
address_book/address_book.py
address_book/address_book.py
from person import Person __all__ = ['AddressBook'] class AddressBook(object): def __init__(self): self.persons = [] def add_person(self, person): self.persons.append(person) def __contains__(self, item): if isinstance(item, Person): return item in self.persons ...
from person import Person __all__ = ['AddressBook'] class AddressBook(object): def __init__(self): self.persons = [] self.groups = [] def add_person(self, person): self.persons.append(person) def add_group(self, group): self.groups.append(group) def __contains__(se...
Add `add_group` method to `AddressBook` class - to make it possible to add groups to the address book
Add `add_group` method to `AddressBook` class - to make it possible to add groups to the address book
Python
mit
dizpers/python-address-book-assignment
72466cb328fb56bfe28f5c3a1f8fca082db24319
typer/__init__.py
typer/__init__.py
"""Typer, build great CLIs. Easy to code. Based on Python type hints.""" __version__ = "0.0.4" from click.exceptions import ( # noqa Abort, BadArgumentUsage, BadOptionUsage, BadParameter, ClickException, FileError, MissingParameter, NoSuchOption, UsageError, ) from click.termui im...
"""Typer, build great CLIs. Easy to code. Based on Python type hints.""" __version__ = "0.0.4" from click.exceptions import Abort, Exit # noqa from click.termui import ( # noqa clear, confirm, echo_via_pager, edit, get_terminal_size, getchar, launch, pause, progressbar, promp...
Clean exports from typer, remove unneeded Click components, add needed ones
:fire: Clean exports from typer, remove unneeded Click components, add needed ones Clean exports from typer, remove unneeded Click components
Python
mit
tiangolo/typer,tiangolo/typer
6709944d7e856fbce0434da0dc731fc83b55feb1
tests/test_cli_update.py
tests/test_cli_update.py
# -*- coding: utf-8 -*- import pathlib def test_should_write_json(cli_runner, tmp_rc, tmp_templates_file): result = cli_runner([ '-c', tmp_rc, 'update' ]) assert result.exit_code == 0 templates = pathlib.Path(tmp_templates_file) assert templates.exists()
# -*- coding: utf-8 -*- import pathlib import json def test_store_template_data_to_json(cli_runner, tmp_rc, tmp_templates_file): result = cli_runner([ '-c', tmp_rc, 'update' ]) assert result.exit_code == 0 templates = pathlib.Path(tmp_templates_file) assert templates.exists() with ...
Extend integration test to check correctness of dumped json data
Extend integration test to check correctness of dumped json data
Python
bsd-3-clause
hackebrot/cibopath
9ee1db76af2a1afdf59bf9099008715d9bca2f4d
tests/test_collection.py
tests/test_collection.py
from bukkit import Collection def test_creation(): buckets = Collection(rate=5, limit=23, timeout=31, clock=lambda: 0) assert buckets.rate == 5 assert buckets.limit == 23 assert buckets.timeout == 31 assert buckets.head_node.prev_node is buckets.tail_node assert buckets.tail_node.next_node is ...
from bukkit import Collection def test_creation(): buckets = Collection(rate=5, limit=23, timeout=31, clock=lambda: 0) assert buckets.rate == 5 assert buckets.limit == 23 assert buckets.timeout == 31 assert buckets.head_node.prev_node is buckets.tail_node assert buckets.tail_node.next_node is ...
Make sure getting buckets and checking for their presence work.
Make sure getting buckets and checking for their presence work.
Python
mit
kgaughan/bukkit
80c4b0fe0a654ef4ec56faac73af993408b846f1
test_client.py
test_client.py
from client import client import pytest def test_string_input(): assert client("String") == "You sent: String" def test_int_input(): assert client(42) == "You sent: 42" def test_empty_input(): with pytest.raises(TypeError): client() def test_over32_input(): assert client("A long message ...
from client import client import pytest def test_response_ok(): msg = "GET /path/to/myindex.html HTTP/1.1\r\nHost: localhost:50000\r\n" result = "HTTP/1.1 200 OK\r\n" con_type = "Content-Type: text/plain\r\n" body = "Content length: {}".format(21) # Length of message from file name to end of line ...
Add first test for a good response
Add first test for a good response
Python
mit
nbeck90/network_tools
6d6528182eb5dc21f41eb4ea5e4cfd08163edc96
sara_flexbe_states/src/sara_flexbe_states/Wonderland_Request.py
sara_flexbe_states/src/sara_flexbe_states/Wonderland_Request.py
#!/usr/bin/env python # encoding=utf8 import requests from flexbe_core import EventState, Logger class Wonderland_Request(EventState): ''' MoveArm receive a ROS pose as input and launch a ROS service with the same pose ># url string url to call <= response string Finish job. ''' def __init__(sel...
#!/usr/bin/env python # encoding=utf8 import requests from flexbe_core import EventState, Logger class Wonderland_Request(EventState): ''' Send requests to Wonderland server ># url string url to call <= response string Finish job. ''' def __init__(self): # See example_state.py for basic explan...
Simplify state and save server URL
Simplify state and save server URL
Python
bsd-3-clause
WalkingMachine/sara_behaviors,WalkingMachine/sara_behaviors
f275c8cc020119b52ed01bc6b56946279853d854
src/mmw/apps/bigcz/clients/cuahsi/details.py
src/mmw/apps/bigcz/clients/cuahsi/details.py
# -*- coding: utf-8 -*- from __future__ import print_function from __future__ import unicode_literals from __future__ import division from datetime import date, timedelta from rest_framework.exceptions import ValidationError DATE_FORMAT = '%m/%d/%Y' def details(wsdl, site): if not wsdl: raise Validatio...
# -*- coding: utf-8 -*- from __future__ import print_function from __future__ import unicode_literals from __future__ import division from datetime import date, timedelta from rest_framework.exceptions import ValidationError DATE_FORMAT = '%m/%d/%Y' def details(wsdl, site): if not wsdl: raise Validatio...
Stop ulmo caching for suds-jurko compliance
Stop ulmo caching for suds-jurko compliance Previously we were using ulmo with suds-jurko 0.6, which is the current latest release, but it is 4 years old. Most recent work on suds-jurko has been done on the development branch, including optimizations to memory use (which we need). Unfortunately, the development branch...
Python
apache-2.0
WikiWatershed/model-my-watershed,WikiWatershed/model-my-watershed,WikiWatershed/model-my-watershed,WikiWatershed/model-my-watershed,WikiWatershed/model-my-watershed
366316b0ea20ae178670581b61c52c481682d2b0
cosmic_ray/operators/exception_replacer.py
cosmic_ray/operators/exception_replacer.py
import ast import builtins from .operator import Operator class OutOfNoWhereException(Exception): pass setattr(builtins, OutOfNoWhereException.__name__, OutOfNoWhereException) class ExceptionReplacer(Operator): """An operator that modifies exception handlers.""" def visit_ExceptHandler(self, node): ...
import ast import builtins from .operator import Operator class CosmicRayTestingException(Exception): pass setattr(builtins, CosmicRayTestingException.__name__, CosmicRayTestingException) class ExceptionReplacer(Operator): """An operator that modifies exception handlers.""" def visit_ExceptHandler(s...
Change exception name to CosmicRayTestingException
Change exception name to CosmicRayTestingException
Python
mit
sixty-north/cosmic-ray
132309e91cc7e951d4a7f326d9e374dc8943f2f3
tests/core/providers/test_testrpc_provider.py
tests/core/providers/test_testrpc_provider.py
import pytest from web3.manager import ( RequestManager, ) from web3.providers.tester import ( TestRPCProvider, is_testrpc_available, ) from web3.utils.compat import socket def get_open_port(): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind(("", 0)) s.listen(1) port = s.gets...
import pytest from web3.manager import ( RequestManager, ) from web3.providers.tester import ( TestRPCProvider as TheTestRPCProvider, is_testrpc_available, ) from web3.utils.compat import socket def get_open_port(): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind(("", 0)) s.liste...
Resolve pytest warning about TestRPCProvider
Resolve pytest warning about TestRPCProvider
Python
mit
pipermerriam/web3.py
17e26fa55e70de657d52e340cb6b66691310a663
bettertexts/forms.py
bettertexts/forms.py
from django_comments.forms import CommentForm from django import forms from django.utils.translation import ugettext_lazy as _ from bettertexts.models import TextComment class TextCommentForm(CommentForm): def __init__(self, *args, **kwargs): super(TextCommentForm, self).__init__(*args, **kwargs) ...
from django_comments.forms import CommentForm from django import forms from django.utils.translation import ugettext_lazy as _ from bettertexts.models import TextComment class TextCommentForm(CommentForm): def __init__(self, *args, **kwargs): super(TextCommentForm, self).__init__(*args, **kwargs) ...
Fix checkboxes inform and involved
CL011: Fix checkboxes inform and involved
Python
mit
citizenline/citizenline,citizenline/citizenline,citizenline/citizenline,citizenline/citizenline
a473e54f5643483efc490f6362f0fca6fcf0c5bd
zappa/__init__.py
zappa/__init__.py
import sys SUPPORTED_VERSIONS = [(2, 7), (3, 6)] python_major_version = sys.version_info[0] python_minor_version = sys.version_info[1] if (python_major_version, python_minor_version) not in SUPPORTED_VERSIONS: formatted_supported_versions = ['{}.{}'.format(mav, miv) for mav, miv in SUPPORTED_VERSIONS] err_m...
Check Python version upon import
Check Python version upon import
Python
mit
scoates/Zappa,pjz/Zappa,mathom/Zappa,Miserlou/Zappa,anush0247/Zappa,Miserlou/Zappa,mathom/Zappa,scoates/Zappa,pjz/Zappa,anush0247/Zappa
ee66811628ea81e0540816e012c71d90457cc933
test/utils/filesystem/name_sanitizer_spec.py
test/utils/filesystem/name_sanitizer_spec.py
from tempfile import TemporaryDirectory from expects import expect from hypothesis import given, assume, example from hypothesis.strategies import text, characters from mamba import description, it from pathlib import Path from crowd_anki.utils.filesystem.name_sanitizer import sanitize_anki_deck_name, \ invalid_f...
from tempfile import TemporaryDirectory from expects import expect from hypothesis import given, assume, example from hypothesis.strategies import text, characters from mamba import description, it from pathlib import Path from crowd_anki.utils.filesystem.name_sanitizer import sanitize_anki_deck_name, \ invalid_f...
Add explicit example filtering based on the byte length of the content
Add explicit example filtering based on the byte length of the content
Python
mit
Stvad/CrowdAnki,Stvad/CrowdAnki,Stvad/CrowdAnki
c10be759ad2ddbd076a1fe0a887d3cf9325aba3d
src/scheduler.py
src/scheduler.py
from collections import namedtuple import sched_utils import check ScheduleConfiguration = namedtuple('ScheduleConfiguration', ['zones', 'teams', 'weight_zones', 'round_length', 'imbalance_action', 'match_count']...
"""Match scheduler. Usage: scheduler.py full <teams> <matches> [options] scheduler.py partial <teams> <previous> <matches> [options] Options: -w --weight Try to balance out between starting zones. --zones=<z> Number of start zones [default: 4]. --empty Leave empty spaces to balance out th...
Switch to a new command-line interface
Switch to a new command-line interface
Python
mit
prophile/match-scheduler,prophile/match-scheduler
ecd06f371fb83823494b17e341d7c4cf8bf117d0
utils/bug_reducer/bug_reducer/bug_reducer.py
utils/bug_reducer/bug_reducer/bug_reducer.py
#!/usr/bin/env python import argparse import opt_bug_reducer import random_bug_finder def main(): parser = argparse.ArgumentParser(description="""\ A program for reducing sib/sil crashers""") subparsers = parser.add_subparsers() opt_subparser = subparsers.add_parser("opt") opt_subparser.add_argume...
#!/usr/bin/env python import argparse import opt_bug_reducer import random_bug_finder def add_subparser(subparsers, module, name): sparser = subparsers.add_parser(name) sparser.add_argument('swift_build_dir', help='Path to the swift build directory ' 'conta...
Refactor adding subparsers given that all subparsers have a common swift_build_dir arg.
[sil-bug-reducer] Refactor adding subparsers given that all subparsers have a common swift_build_dir arg.
Python
apache-2.0
uasys/swift,JaSpa/swift,milseman/swift,harlanhaskins/swift,gregomni/swift,sschiau/swift,austinzheng/swift,xedin/swift,xwu/swift,codestergit/swift,harlanhaskins/swift,huonw/swift,shahmishal/swift,lorentey/swift,deyton/swift,gmilos/swift,sschiau/swift,gregomni/swift,harlanhaskins/swift,shajrawi/swift,stephentyrone/swift,...
2d01301e9154045f4b15d1523089ad36fdd7f6f4
cs251tk/toolkit/process_student.py
cs251tk/toolkit/process_student.py
import os from cs251tk.student import remove from cs251tk.student import clone_student from cs251tk.student import stash from cs251tk.student import pull from cs251tk.student import checkout_date from cs251tk.student import record from cs251tk.student import reset from cs251tk.student import analyze from cs251tk.commo...
import os from cs251tk.student import remove from cs251tk.student import clone_student from cs251tk.student import stash from cs251tk.student import pull from cs251tk.student import checkout_date from cs251tk.student import record from cs251tk.student import reset from cs251tk.student import analyze def process_stud...
Remove leftover imports from testing
Remove leftover imports from testing
Python
mit
StoDevX/cs251-toolkit,StoDevX/cs251-toolkit,StoDevX/cs251-toolkit,StoDevX/cs251-toolkit
729d3160f974c521ab6605c02cf64861be0fb6ab
fri/utils.py
fri/utils.py
import numpy as np def distance(u, v): """ Distance measure custom made for feature comparison. Parameters ---------- u: first feature v: second feature Returns ------- """ u = np.asarray(u) v = np.asarray(v) # Euclidean differences diff = (u - v) ** 2 # Null...
import numpy as np def distance(u, v): """ Distance measure custom made for feature comparison. Parameters ---------- u: first feature v: second feature Returns ------- """ u = np.asarray(u) v = np.asarray(v) # Euclidean differences diff = (u - v) ** 2 # Null...
Revert removal of necessary function
Revert removal of necessary function
Python
mit
lpfann/fri
02522262692554a499d7c0fbc8f2efe4361023f1
bmi_ilamb/__init__.py
bmi_ilamb/__init__.py
import os from .bmi_ilamb import BmiIlamb __all__ = ['BmiIlamb'] __version__ = 0.1 package_dir = os.path.dirname(__file__) data_dir = os.path.join(package_dir, 'data')
import os from .bmi_ilamb import BmiIlamb from .config import Configuration __all__ = ['BmiIlamb', 'Configuration'] __version__ = 0.1 package_dir = os.path.dirname(__file__) data_dir = os.path.join(package_dir, 'data')
Add Configuration to package definition
Add Configuration to package definition
Python
mit
permamodel/bmi-ilamb
af2687703bc13eeabfe715e35988ad8c54ce9117
builds/format_json.py
builds/format_json.py
#!/usr/bin/env python # -*- encoding: utf-8 -*- import json import os import subprocess import sys def find_json_files(): for root, _, filenames in os.walk('.'): if any( d in root for d in ['/WIP', '/.terraform', '/target'] ): continue for f in filenam...
#!/usr/bin/env python # -*- encoding: utf-8 -*- import json import os import subprocess import sys def find_json_files(): for root, _, filenames in os.walk('.'): if any( d in root for d in ['/WIP', '/.terraform', '/target'] ): continue for f in filenam...
Tweak the JSON we export
Tweak the JSON we export
Python
mit
wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api
0b5cc3f4702081eb565ef83c3175efc4e8b30e75
circuits/node/node.py
circuits/node/node.py
# Module: node # Date: ... # Author: ... """Node ... """ from .client import Client from .server import Server from circuits import handler, BaseComponent class Node(BaseComponent): """Node ... """ channel = "node" def __init__(self, bind=None, channel=channel, **kwargs): su...
# Module: node # Date: ... # Author: ... """Node ... """ from .client import Client from .server import Server from circuits import handler, BaseComponent class Node(BaseComponent): """Node ... """ channel = "node" def __init__(self, bind=None, channel=channel, **kwargs): su...
Fix channel definition in add method
Fix channel definition in add method
Python
mit
eriol/circuits,eriol/circuits,treemo/circuits,nizox/circuits,eriol/circuits,treemo/circuits,treemo/circuits
3234d929d22d7504d89753ce6351d0efe1bfa8ac
whitepy/lexer.py
whitepy/lexer.py
from .lexerconstants import * from .ws_token import Tokeniser class Lexer(object): def __init__(self, line): self.line = line self.pos = 0 self.tokens = [] def _get_int(self): token = Tokeniser() if self.line[-1] == '\n': const = 'INT' token.sca...
from .lexerconstants import * from .ws_token import Tokeniser class IntError(ValueError): '''Exception when invalid integer is found''' class Lexer(object): def __init__(self, line): self.line = line self.pos = 0 self.tokens = [] def _get_int(self): token = Tokeniser() ...
Add Execption for invalid Integer
Add Execption for invalid Integer Exception class created for invalid integer and raise it if a bad integer is found
Python
apache-2.0
yasn77/whitepy
9d0ea4eaf8269350fabc3415545bebf4da4137a7
source/segue/backend/processor/background.py
source/segue/backend/processor/background.py
# :coding: utf-8 # :copyright: Copyright (c) 2013 Martin Pengelly-Phillips # :license: See LICENSE.txt. import multiprocessing from .base import Processor class BackgroundProcessor(Processor): '''Local background processor.''' def process(self, command, args=None, kw=None): '''Process *command*...
# :coding: utf-8 # :copyright: Copyright (c) 2013 Martin Pengelly-Phillips # :license: See LICENSE.txt. import multiprocessing from .base import Processor class BackgroundProcessor(Processor): '''Local background processor.''' def process(self, command, args=None, kw=None): '''Process *command*...
Fix passing invalid None to multiprocessing Process class.
Fix passing invalid None to multiprocessing Process class.
Python
apache-2.0
4degrees/segue
34334bdb85644a5553ba36af5dc98942ea5fbf21
launch_control/__init__.py
launch_control/__init__.py
# This file is part of the ARM Validation Dashboard Project. # for the Linaro organization (http://linaro.org/) # # For more details see: # https://blueprints.launchpad.net/ubuntu/+spec/arm-m-validation-dashboard __version__ = "0.0.1"
# This file is part of the ARM Validation Dashboard Project. # for the Linaro organization (http://linaro.org/) # # For more details see: # https://blueprints.launchpad.net/ubuntu/+spec/arm-m-validation-dashboard """ Public API for Launch Control. Please see one of the available packages for more information. """ ...
Add docstring to launch_control package
Add docstring to launch_control package
Python
agpl-3.0
Linaro/lava-server,Linaro/lava-server,OSSystems/lava-server,OSSystems/lava-server,Linaro/lava-server,Linaro/lava-server,OSSystems/lava-server
cb1af2160952c7065e236d2cd544f46e5b252e92
account_partner_account_summary/__openerp__.py
account_partner_account_summary/__openerp__.py
# -*- coding: utf-8 -*- { 'name': 'Partner Account Summary', 'version': '1.0', 'description': """Partner Account Summary""", 'category': 'Aeroo Reporting', 'author': 'Ingenieria ADHOC', 'website': 'www.ingadhoc.com', 'depends': [ 'sale', 'report_aeroo', ], 'data':...
# -*- coding: utf-8 -*- { 'name': 'Partner Account Summary', 'version': '1.0', 'description': """Partner Account Summary""", 'category': 'Aeroo Reporting', 'author': 'Ingenieria ADHOC', 'website': 'www.ingadhoc.com', 'depends': [ 'sale', 'report_aeroo', 'l10n_ar_invoi...
ADD dependency of l10n_ar_invoice for account summary
ADD dependency of l10n_ar_invoice for account summary
Python
agpl-3.0
maljac/odoo-addons,adhoc-dev/odoo-addons,syci/ingadhoc-odoo-addons,dvitme/odoo-addons,ingadhoc/account-payment,jorsea/odoo-addons,ingadhoc/stock,jorsea/odoo-addons,ingadhoc/account-financial-tools,sysadminmatmoz/ingadhoc,levkar/odoo-addons,syci/ingadhoc-odoo-addons,ingadhoc/partner,ingadhoc/product,ClearCorp/account-fi...
517d25cf79c4d04661309ab7b3ab0638a2f968ee
api/docbleach/utils/__init__.py
api/docbleach/utils/__init__.py
import os import random import string def secure_uuid(): """ Strength: 6*3 random characters from a list of 62, approx. 64^18 possible strings, or 2^100. Should be enough to prevent a successful bruteforce, as download links are only valid for 3 hours :return: """ return id_generator() + "...
import os import string from random import SystemRandom cryptogen = SystemRandom() def secure_uuid(): """ Strength: 6*3 random characters from a list of 62, approx. 64^18 possible strings, or 2^100. Should be enough to prevent a successful bruteforce, as download links are only valid for 3 hours ...
Use SystemRandom to generate security-viable randomness
Use SystemRandom to generate security-viable randomness
Python
mit
docbleach/DocBleach-Web,docbleach/DocBleach-Web,docbleach/DocBleach-Web,docbleach/DocBleach-Web
a4df3f966e232e8327522a3db32870f5dcea0c03
cartridge/shop/middleware.py
cartridge/shop/middleware.py
from mezzanine.conf import settings from cartridge.shop.models import Cart class ShopMiddleware(object): def __init__(self): old = ("SHOP_SSL_ENABLED", "SHOP_FORCE_HOST", "SHOP_FORCE_SSL_VIEWS") for name in old: try: getattr(settings, name) except Attribu...
from mezzanine.conf import settings from cartridge.shop.models import Cart class SSLRedirect(object): def __init__(self): old = ("SHOP_SSL_ENABLED", "SHOP_FORCE_HOST", "SHOP_FORCE_SSL_VIEWS") for name in old: try: getattr(settings, name) except AttributeE...
Add deprecated fallback for SSLMiddleware.
Add deprecated fallback for SSLMiddleware.
Python
bsd-2-clause
traxxas/cartridge,traxxas/cartridge,Parisson/cartridge,Kniyl/cartridge,syaiful6/cartridge,jaywink/cartridge-reservable,wbtuomela/cartridge,syaiful6/cartridge,ryneeverett/cartridge,wbtuomela/cartridge,dsanders11/cartridge,wbtuomela/cartridge,dsanders11/cartridge,wyzex/cartridge,jaywink/cartridge-reservable,Parisson/cart...
fdf014fb0602cbba476b0e35d451f43e86be7cdc
django_project/core/settings/test_travis.py
django_project/core/settings/test_travis.py
# -*- coding: utf-8 -*- from .test import * # noqa DATABASES = { 'default': { 'ENGINE': 'django.contrib.gis.db.backends.postgis', 'NAME': 'gis', 'USER': 'postgres', 'PASSWORD': '', 'HOST': 'localhost', # Set to empty string for default. 'PORT': '', } }
# -*- coding: utf-8 -*- from .test import * # noqa DATABASES = { 'default': { 'ENGINE': 'django.contrib.gis.db.backends.postgis', 'NAME': 'test_db', 'USER': 'postgres', 'PASSWORD': '', 'HOST': 'localhost', # Set to empty string for default. 'PORT': '', }...
Fix wrong db name for travis.
Fix wrong db name for travis.
Python
bsd-2-clause
AIFDR/inasafe-django,timlinux/inasafe-django,timlinux/inasafe-django,AIFDR/inasafe-django,AIFDR/inasafe-django,timlinux/inasafe-django,AIFDR/inasafe-django,timlinux/inasafe-django
d7624defd7d05e721aeb0ccd074c7172c51295bf
nvchecker_source/git.py
nvchecker_source/git.py
# MIT licensed # Copyright (c) 2020 Felix Yan <felixonmars@archlinux.org>, et al. import re from nvchecker_source.cmd import run_cmd async def get_version( name, conf, *, cache, keymanager=None ): git = conf['git'] cmd = f"git ls-remote -t --refs {git}" data = await cache.get(cmd, run_cmd) regex = "(?<=refs...
# MIT licensed # Copyright (c) 2020 Felix Yan <felixonmars@archlinux.org>, et al. import re from .cmd import run_cmd # type: ignore async def get_version( name, conf, *, cache, keymanager=None ): git = conf['git'] cmd = f"git ls-remote -t --refs {git}" data = await cache.get(cmd, run_cmd) regex = "(?<=refs/...
Fix mypy and regex flag
Fix mypy and regex flag
Python
mit
lilydjwg/nvchecker
36e5af74e6ecaba4cea4bfcd2c1ef997d1e15eb0
openstack/tests/functional/telemetry/v2/test_meter.py
openstack/tests/functional/telemetry/v2/test_meter.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...
Make sure there is data for the meter test
Make sure there is data for the meter test The meter tests relies on someone else creating a meter. If this test happens to run on a brand new system and it runs before the object store tests, it may fail. For some object store activity before the test. Change-Id: Ie9b7775bad4550842bfdaebd893eb8293590b7ff
Python
apache-2.0
openstack/python-openstacksdk,dtroyer/python-openstacksdk,openstack/python-openstacksdk,dudymas/python-openstacksdk,dtroyer/python-openstacksdk,stackforge/python-openstacksdk,briancurtin/python-openstacksdk,stackforge/python-openstacksdk,dudymas/python-openstacksdk,briancurtin/python-openstacksdk
47f495e7e5b8fa06991e0c263bc9239818dd5b4f
airpy/list.py
airpy/list.py
import os import airpy def airlist(): installed_docs = os.listdir(airpy.data_directory) for dir in installed_docs: print(dir, end= ' ') print(end = '\n')
from __future__ import print_function import os import airpy def airlist(): installed_docs = os.listdir(airpy.data_directory) for dir in installed_docs: print(dir, end= ' ') print(end = '\n')
Add a Backwards compatibility for python 2.7 by adding a __future__ import
Add a Backwards compatibility for python 2.7 by adding a __future__ import
Python
mit
kevinaloys/airpy
6656493c3bf9b24d67c6de8cb33a1ca3defa4db8
code/python/yum-check-update.py
code/python/yum-check-update.py
#!/usr/bin/python import json import subprocess process = subprocess.Popen(["yum", "check-update", "-q"], stdout=subprocess.PIPE) (output, err) = process.communicate() exit_code = process.wait() if exit_code == 0 and output == "": print "Up to date" else: print json.dumps({"exit_code": exit_code, "raw...
#!/usr/bin/python import json import subprocess process = subprocess.Popen(["yum", "check-update", "-q"], stdout=subprocess.PIPE) (output, err) = process.communicate() exit_code = process.wait() if exit_code == 0 and output == "": print json.dumps({"exit_code": exit_code, "raw": "Up to date"}) else: p...
Make output types consistent for policy creation purposes
Make output types consistent for policy creation purposes
Python
mit
ScriptRock/content,ScriptRock/content,ScriptRock/content,ScriptRock/content,ScriptRock/content,ScriptRock/content
68b0f560322884967b817ad87cef8c1db9600dbd
app/main/errors.py
app/main/errors.py
from flask import render_template from app.main import main @main.app_errorhandler(400) def page_not_found(e): return _render_error_page(500) @main.app_errorhandler(404) def page_not_found(e): return _render_error_page(404) @main.app_errorhandler(500) def exception(e): return _render_error_page(500) ...
from flask import render_template from app.main import main @main.app_errorhandler(400) def page_not_found(e): print(e.message) return _render_error_page(500) @main.app_errorhandler(404) def page_not_found(e): print(e.message) return _render_error_page(404) @main.app_errorhandler(500) def exceptio...
Add print statements for all error types
Add print statements for all error types
Python
mit
alphagov/notify-frontend,alphagov/notify-frontend,alphagov/notify-frontend,alphagov/notify-frontend
0e60863d43a5b230839191743f72818763eeee71
buildPy2app.py
buildPy2app.py
""" This is a setup.py script generated by py2applet Usage: python setup.py py2app """ from setuptools import setup from glob import glob import syncplay APP = ['syncplayClient.py'] DATA_FILES = [ ('resources', glob('resources/*.png') + glob('resources/*.rtf') + glob('resources/*.lua')), ] OPTIONS = { 'icon...
""" This is a setup.py script generated by py2applet Usage: python setup.py py2app """ from setuptools import setup from glob import glob import syncplay APP = ['syncplayClient.py'] DATA_FILES = [ ('resources', glob('resources/*.png') + glob('resources/*.rtf') + glob('resources/*.lua')), ] OPTIONS = { 'icon...
Update py2app script for Qt 5.11
Update py2app script for Qt 5.11
Python
apache-2.0
Syncplay/syncplay,NeverDecaf/syncplay,NeverDecaf/syncplay,alby128/syncplay,Syncplay/syncplay,alby128/syncplay
326f0b881d36ed19d0a37495ae34fc24fc1eb707
connect_ffi.py
connect_ffi.py
from cffi import FFI ffi = FFI() print "Loading Spotify library..." #TODO: Use absolute paths for open() and stuff #Header generated with cpp spotify.h > spotify.processed.h && sed -i 's/__extension__//g' spotify.processed.h with open("spotify.processed.h") as file: header = file.read() ffi.cdef(header) ffi.cdef(...
from cffi import FFI ffi = FFI() print "Loading Spotify library..." #TODO: Use absolute paths for open() and stuff #Header generated with cpp spotify.h > spotify.processed.h && sed -i 's/__extension__//g' spotify.processed.h with open(os.path.join(sys.path[0], "spotify.processed.h")) as file: header = file.read() ...
Load the spotify header file from an absolute path
Load the spotify header file from an absolute path
Python
mit
Fornoth/spotify-connect-web,Fornoth/spotify-connect-web,Fornoth/spotify-connect-web,Fornoth/spotify-connect-web,Fornoth/spotify-connect-web
1dbb1e0f8751f37271178665a727c4eefc49a88c
partner_firstname/exceptions.py
partner_firstname/exceptions.py
# -*- encoding: utf-8 -*- # Odoo, Open Source Management Solution # Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es> # # 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 versio...
# -*- encoding: utf-8 -*- # Odoo, Open Source Management Solution # Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es> # # 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 versio...
Remove subclassing of exception, since there is only one.
Remove subclassing of exception, since there is only one.
Python
agpl-3.0
BT-fgarbely/partner-contact,diagramsoftware/partner-contact,andrius-preimantas/partner-contact,BT-jmichaud/partner-contact,Antiun/partner-contact,Therp/partner-contact,idncom/partner-contact,gurneyalex/partner-contact,Endika/partner-contact,Ehtaga/partner-contact,QANSEE/partner-contact,raycarnes/partner-contact,open-sy...
a96cb89524f2fa17a015011d972d396e509a1079
journal.py
journal.py
# -*- coding: utf-8 -*- from flask import Flask import os import psycopg2 from contextlib import closing DB_SCHEMA = """ DROP TABLE IF EXISTS entries; CREATE TABLE entries ( id serial PRIMARY KEY, title VARCHAR (127) NOT NULL, text TEXT NOT NULL, created TIMESTAMP NOT NULL ) """ app = Flask(__name_...
# -*- coding: utf-8 -*- from flask import Flask import os import psycopg2 from contextlib import closing from flask import g DB_SCHEMA = """ DROP TABLE IF EXISTS entries; CREATE TABLE entries ( id serial PRIMARY KEY, title VARCHAR (127) NOT NULL, text TEXT NOT NULL, created TIMESTAMP NOT NULL ) """ ...
Add code for getting and releasing a database connection
Add code for getting and releasing a database connection
Python
mit
rivese/learning_journal,EyuelAbebe/learning_journal,EyuelAbebe/learning_journal
69705079398391cdc392b18dcd440fbc3b7404fd
celery_cgi.py
celery_cgi.py
import os import logging from celery import Celery from temp_config.set_environment import DeployEnv runtime_env = DeployEnv() runtime_env.load_deployment_environment() redis_server = os.environ.get('REDIS_HOSTNAME') redis_port = os.environ.get('REDIS_PORT') celery_tasks = [ 'hms_flask.modules.hms_controller', ...
import os import logging from celery import Celery from temp_config.set_environment import DeployEnv runtime_env = DeployEnv() runtime_env.load_deployment_environment() redis_server = os.environ.get('REDIS_HOSTNAME') redis_port = os.environ.get('REDIS_PORT') celery_tasks = [ 'hms_flask.modules.hms_controller', ...
Set celery to ignore results
Set celery to ignore results
Python
unlicense
puruckertom/ubertool_ecorest,puruckertom/ubertool_ecorest,quanted/ubertool_ecorest,quanted/ubertool_ecorest,puruckertom/ubertool_ecorest,quanted/ubertool_ecorest,quanted/ubertool_ecorest,puruckertom/ubertool_ecorest
a6ed56b37bba3f5abff73c297a8a20271d73cab2
example/random-agent/random-agent.py
example/random-agent/random-agent.py
#!/usr/bin/env python import argparse import logging import sys import gym import universe # register the universe environments from universe import wrappers logger = logging.getLogger() def main(): parser = argparse.ArgumentParser(description=None) parser.add_argument('-v', '--verbose', action='count', des...
#!/usr/bin/env python import argparse import logging import sys import gym import universe # register the universe environments from universe import wrappers logger = logging.getLogger() def main(): parser = argparse.ArgumentParser(description=None) parser.add_argument('-v', '--verbose', action='count', des...
Add configure call to random_agent
Add configure call to random_agent
Python
mit
openai/universe,rht/universe
ef0d0fa26bfd22c281c54bc348877afd0a7ee9d7
tests/integration/blueprints/metrics/test_metrics.py
tests/integration/blueprints/metrics/test_metrics.py
""" :Copyright: 2006-2020 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ import pytest # To be overridden by test parametrization @pytest.fixture def config_overrides(): return {} @pytest.fixture def client(admin_app, config_overrides, make_admin_app): app = make_admin_app(**conf...
""" :Copyright: 2006-2020 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ import re import pytest # To be overridden by test parametrization @pytest.fixture def config_overrides(): return {} @pytest.fixture def client(admin_app, config_overrides, make_admin_app): app = make_admin...
Use regex to match user metrics
Use regex to match user metrics
Python
bsd-3-clause
homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps
a0fab69d12d64d4e5371fcb26a4ec70365a76fa6
cref/app/web/tasks.py
cref/app/web/tasks.py
from celery import Celery from cref.app.terminal import run_cref app = Celery( 'tasks', backend='db+sqlite:///results.sqlite', broker='amqp://guest@localhost//' ) @app.task def predict_structure(sequence, params={}): return run_cref(sequence)
from celery import Celery from cref.app.terminal import run_cref app = Celery( 'tasks', backend='db+sqlite:///data/results.sqlite', broker='amqp://guest@localhost//' ) @app.task def predict_structure(sequence, params={}): return run_cref(sequence)
Move task results database to data dir
Move task results database to data dir
Python
mit
mchelem/cref2,mchelem/cref2,mchelem/cref2
9011b359bdf164994734f8d6890a2d5acb5fa865
project_euler/solutions/problem_32.py
project_euler/solutions/problem_32.py
from itertools import permutations def solve() -> int: pandigital = [] for permutation in permutations(range(1, 10)): result = int(''.join(str(digit) for digit in permutation[:4])) for i in range(1, 4): left = int(''.join(str(digit) for digit in permutation[4:4 + i])) ...
from itertools import permutations from ..library.base import list_to_number def solve() -> int: pandigital = [] for permutation in permutations(range(1, 10)): result = list_to_number(permutation[:4]) for i in range(1, 4): left = list_to_number(permutation[4:4 + i]) ...
Replace joins with list_to_number in 32
Replace joins with list_to_number in 32
Python
mit
cryvate/project-euler,cryvate/project-euler
921bdcc5d6f6ac4be7dfd0015e5b5fd6d06e6486
runcommands/__main__.py
runcommands/__main__.py
import sys from .config import RawConfig, RunConfig from .exc import RunCommandsError from .run import run, partition_argv, read_run_args from .util import printer def main(argv=None): try: all_argv, run_argv, command_argv = partition_argv(argv) cli_args = run.parse_args(RawConfig(run=RunConfig()...
import sys from .config import RawConfig, RunConfig from .exc import RunCommandsError from .run import run, partition_argv, read_run_args from .util import printer def main(argv=None): debug = None try: all_argv, run_argv, command_argv = partition_argv(argv) cli_args = run.parse_args(RawConfi...
Raise exception when --debug is specified to main script
Raise exception when --debug is specified to main script I.e., instead of printing the exception and then exiting.
Python
mit
wylee/runcommands,wylee/runcommands
a3c582df681aae77034e2db08999c89866cd6470
utilities.py
utilities.py
import collections def each(function, iterable): for item in iterable: function(item) def each_unpack(function, iterable): for item in iterable: function(*item) def minmax(*args): min = None max = None for x in args: if max < x: max = x if x > min: min = x return min, max ...
import collections def each(function, iterable): for item in iterable: function(item) def each_unpack(function, iterable): for item in iterable: function(*item) def minmax(*args): min = None max = None for x in args: if max < x: max = x if x > min: min = x return min, max ...
Refactor earth mover's distance implementation
Refactor earth mover's distance implementation
Python
mit
davidfoerster/schema-matching