commit
stringlengths
40
40
old_file
stringlengths
5
117
new_file
stringlengths
5
117
old_contents
stringlengths
0
1.93k
new_contents
stringlengths
19
3.3k
subject
stringlengths
17
320
message
stringlengths
18
3.28k
lang
stringclasses
1 value
license
stringclasses
13 values
repos
stringlengths
7
42.4k
completion
stringlengths
19
3.3k
prompt
stringlengths
21
3.65k
faf35a814d045ce3d71921ed0d4ac268d5a9811c
app/notify_client/provider_client.py
app/notify_client/provider_client.py
from app.notify_client import _attach_current_user, NotifyAdminAPIClient class ProviderClient(NotifyAdminAPIClient): def __init__(self): super().__init__("a", "b", "c") def init_app(self, app): self.base_url = app.config['API_HOST_NAME'] self.service_id = app.config['ADMIN_CLIENT_USE...
from app.notify_client import _attach_current_user, NotifyAdminAPIClient class ProviderClient(NotifyAdminAPIClient): def __init__(self): super().__init__("a", "b", "c") def init_app(self, app): self.base_url = app.config['API_HOST_NAME'] self.service_id = app.config['ADMIN_CLIENT_USE...
Add provider client method to get provider version history
Add provider client method to get provider version history
Python
mit
gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin,gov-cjwaszczuk/notifications-admin,gov-cjwaszczuk/notifications-admin
from app.notify_client import _attach_current_user, NotifyAdminAPIClient class ProviderClient(NotifyAdminAPIClient): def __init__(self): super().__init__("a", "b", "c") def init_app(self, app): self.base_url = app.config['API_HOST_NAME'] self.service_id = app.config['ADMIN_CLIENT_USE...
Add provider client method to get provider version history from app.notify_client import _attach_current_user, NotifyAdminAPIClient class ProviderClient(NotifyAdminAPIClient): def __init__(self): super().__init__("a", "b", "c") def init_app(self, app): self.base_url = app.config['API_HOST_N...
b6e9215457eba813f91c9eb4a8b96f8652bcd5fc
functional_tests/pages/settings.py
functional_tests/pages/settings.py
# -*- coding: utf-8 -*- from selenium.webdriver.support.ui import Select from page_objects import PageObject, PageElement, MultiPageElement class SettingsPage(PageObject): return_link = PageElement(css='.mui--text-title a.appbar-correct') inlist_delete_confirm = PageElement(name='inlist_delete_confirm') ac...
# -*- coding: utf-8 -*- from selenium.webdriver.support.ui import Select from page_objects import PageObject, PageElement, MultiPageElement class SettingsPage(PageObject): return_link = PageElement(css='#sidebar-brand a') inlist_delete_confirm = PageElement(name='inlist_delete_confirm') action_delete_confi...
Make the return link work again
Make the return link work again
Python
mit
XeryusTC/projman,XeryusTC/projman,XeryusTC/projman
# -*- coding: utf-8 -*- from selenium.webdriver.support.ui import Select from page_objects import PageObject, PageElement, MultiPageElement class SettingsPage(PageObject): return_link = PageElement(css='#sidebar-brand a') inlist_delete_confirm = PageElement(name='inlist_delete_confirm') action_delete_confi...
Make the return link work again # -*- coding: utf-8 -*- from selenium.webdriver.support.ui import Select from page_objects import PageObject, PageElement, MultiPageElement class SettingsPage(PageObject): return_link = PageElement(css='.mui--text-title a.appbar-correct') inlist_delete_confirm = PageElement(nam...
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...
# 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 # 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...
2e6080f2d8c258700444129a9b989ca5db056a9d
elfi/examples/ma2.py
elfi/examples/ma2.py
import numpy as np """Example implementation of the MA2 model """ # TODO: add tests def MA2(n_obs, t1, t2, n_sim=1, prng=None, latents=None): if latents is None: if prng is None: prng = np.random.RandomState() latents = prng.randn(n_sim, n_obs+2) # i.i.d. sequence ~ N(0,1) u = np....
import numpy as np """Example implementation of the MA2 model """ # TODO: add tests def MA2(n_obs, t1, t2, n_sim=1, prng=None, latents=None): if latents is None: if prng is None: prng = np.random.RandomState() latents = prng.randn(n_sim, n_obs+2) # i.i.d. sequence ~ N(0,1) u = np....
Change autocorrelation to autocov. Variance infromation improves ABC results.
Change autocorrelation to autocov. Variance infromation improves ABC results.
Python
bsd-3-clause
lintusj1/elfi,HIIT/elfi,lintusj1/elfi,elfi-dev/elfi,elfi-dev/elfi
import numpy as np """Example implementation of the MA2 model """ # TODO: add tests def MA2(n_obs, t1, t2, n_sim=1, prng=None, latents=None): if latents is None: if prng is None: prng = np.random.RandomState() latents = prng.randn(n_sim, n_obs+2) # i.i.d. sequence ~ N(0,1) u = np....
Change autocorrelation to autocov. Variance infromation improves ABC results. import numpy as np """Example implementation of the MA2 model """ # TODO: add tests def MA2(n_obs, t1, t2, n_sim=1, prng=None, latents=None): if latents is None: if prng is None: prng = np.random.RandomState() ...
697833caade1323ddb9a0b4e51031f1d494262cd
201705/migonzalvar/biggest_set.py
201705/migonzalvar/biggest_set.py
#!/usr/bin/env python3 from contextlib import contextmanager import time from main import has_subset_sum_zero class Duration: def __init__(self, elapsed=None): self.elapsed = elapsed @contextmanager def less_than(secs): duration = Duration() tic = time.time() yield duration elapsed = ti...
#!/usr/bin/env python3 from contextlib import contextmanager import time from main import has_subset_sum_zero class Duration: def __init__(self, elapsed=None): self.elapsed = elapsed @contextmanager def less_than(secs): duration = Duration() tic = time.time() yield duration elapsed = ti...
Use several strategies for performance
Use several strategies for performance
Python
bsd-3-clause
VigoTech/reto,VigoTech/reto,VigoTech/reto,VigoTech/reto,VigoTech/reto,VigoTech/reto,VigoTech/reto,vigojug/reto,vigojug/reto,vigojug/reto,vigojug/reto,VigoTech/reto,vigojug/reto,vigojug/reto,vigojug/reto,vigojug/reto,VigoTech/reto,VigoTech/reto,vigojug/reto,vigojug/reto
#!/usr/bin/env python3 from contextlib import contextmanager import time from main import has_subset_sum_zero class Duration: def __init__(self, elapsed=None): self.elapsed = elapsed @contextmanager def less_than(secs): duration = Duration() tic = time.time() yield duration elapsed = ti...
Use several strategies for performance #!/usr/bin/env python3 from contextlib import contextmanager import time from main import has_subset_sum_zero class Duration: def __init__(self, elapsed=None): self.elapsed = elapsed @contextmanager def less_than(secs): duration = Duration() tic = time.ti...
10df3cd5e4c8517652efdb8381155253aa6a8157
osfclient/tests/test_cli.py
osfclient/tests/test_cli.py
from unittest.mock import call from unittest.mock import Mock from unittest.mock import patch from osfclient import cli @patch('osfclient.cli.os.path.exists', return_value=True) @patch('osfclient.cli.configparser.ConfigParser') def test_config_file(MockConfigParser, os_path_exists): MockConfigParser().__getitem_...
Add test for file based configuration
Add test for file based configuration
Python
bsd-3-clause
betatim/osf-cli,betatim/osf-cli
from unittest.mock import call from unittest.mock import Mock from unittest.mock import patch from osfclient import cli @patch('osfclient.cli.os.path.exists', return_value=True) @patch('osfclient.cli.configparser.ConfigParser') def test_config_file(MockConfigParser, os_path_exists): MockConfigParser().__getitem_...
Add test for file based configuration
693b904a9053fbddc6c93cfab1d6448c4b644d1c
scripts/travis_build_dependent_projects.py
scripts/travis_build_dependent_projects.py
# -*- coding: utf-8 -*- import os from click import echo from travispy import travispy from travispy import TravisPy def main(): restarted = [] building = [] for domain in [travispy.PUBLIC, travispy.PRIVATE]: echo("Enumerate repos on {!r}".format(domain)) conn = TravisPy.github_auth(o...
# -*- coding: utf-8 -*- import os from click import echo from travispy import travispy from travispy import TravisPy def main(): restarted = [] building = [] for domain in [travispy.PUBLIC, travispy.PRIVATE]: echo("Enumerate repos on {!r}".format(domain)) conn = TravisPy.github_auth(o...
Fix Travis dependant build trigger
Fix Travis dependant build trigger
Python
mit
dgnorth/drift,dgnorth/drift,dgnorth/drift
# -*- coding: utf-8 -*- import os from click import echo from travispy import travispy from travispy import TravisPy def main(): restarted = [] building = [] for domain in [travispy.PUBLIC, travispy.PRIVATE]: echo("Enumerate repos on {!r}".format(domain)) conn = TravisPy.github_auth(o...
Fix Travis dependant build trigger # -*- coding: utf-8 -*- import os from click import echo from travispy import travispy from travispy import TravisPy def main(): restarted = [] building = [] for domain in [travispy.PUBLIC, travispy.PRIVATE]: echo("Enumerate repos on {!r}".format(domain)) ...
d8444cec60f38baa75b89892dda6163bf63917af
todo/__init__.py
todo/__init__.py
"""django todo""" __version__ = '1.5.dev' __author__ = 'Scot Hacker' __email__ = 'shacker@birdhouse.org' __url__ = 'https://github.com/shacker/django-todo' __license__ = 'BSD License'
"""django todo""" __version__ = '1.5' __author__ = 'Scot Hacker' __email__ = 'shacker@birdhouse.org' __url__ = 'https://github.com/shacker/django-todo' __license__ = 'BSD License'
Bump version number for release 1.5
Bump version number for release 1.5
Python
bsd-3-clause
jwiltshire/django-todo,shacker/django-todo,jwiltshire/django-todo,shacker/django-todo,jwiltshire/django-todo,shacker/django-todo
"""django todo""" __version__ = '1.5' __author__ = 'Scot Hacker' __email__ = 'shacker@birdhouse.org' __url__ = 'https://github.com/shacker/django-todo' __license__ = 'BSD License'
Bump version number for release 1.5 """django todo""" __version__ = '1.5.dev' __author__ = 'Scot Hacker' __email__ = 'shacker@birdhouse.org' __url__ = 'https://github.com/shacker/django-todo' __license__ = 'BSD License'
666b011ef95ef6e82e59cc134b52fb29443ff9d8
iroha_cli/crypto.py
iroha_cli/crypto.py
import base64 import sha3 import os from collections import namedtuple class KeyPair: def __init__(self, pub, pri): self.private_key = pri self.public_key = pub from iroha_cli.crypto_ed25519 import generate_keypair_ed25519, sign_ed25519, verify_ed25519, ed25519_sha3_512, \ ed25519_sha3_256...
import base64 import sha3 import os from collections import namedtuple class KeyPair: def __init__(self, pub, pri): self.private_key = pri self.public_key = pub def raw_public_key(self): return base64.b64decode(self.public_key) from iroha_cli.crypto_ed25519 import generate_keypair_...
Add get raw key from KeyPair
Add get raw key from KeyPair
Python
apache-2.0
MizukiSonoko/iroha-cli,MizukiSonoko/iroha-cli
import base64 import sha3 import os from collections import namedtuple class KeyPair: def __init__(self, pub, pri): self.private_key = pri self.public_key = pub def raw_public_key(self): return base64.b64decode(self.public_key) from iroha_cli.crypto_ed25519 import generate_keypair_...
Add get raw key from KeyPair import base64 import sha3 import os from collections import namedtuple class KeyPair: def __init__(self, pub, pri): self.private_key = pri self.public_key = pub from iroha_cli.crypto_ed25519 import generate_keypair_ed25519, sign_ed25519, verify_ed25519, ed25519_sh...
a4808284731ebcc7ae9c29bfeee4db7e943e1b2a
pyinfra/__init__.py
pyinfra/__init__.py
# pyinfra # File: pyinfra/__init__.py # Desc: some global state for pyinfra ''' Welcome to pyinfra. ''' import logging # Global pyinfra logger logger = logging.getLogger('pyinfra') # Setup package level version from .version import __version__ # noqa # Trigger pseudo_* creation from . import pseudo_modules # no...
# pyinfra # File: pyinfra/__init__.py # Desc: some global state for pyinfra ''' Welcome to pyinfra. ''' import logging # Global flag set True by `pyinfra_cli.__main__` is_cli = False # Global pyinfra logger logger = logging.getLogger('pyinfra') # Setup package level version from .version import __version__ # noq...
Add default for `is_cli` to pyinfra.
Add default for `is_cli` to pyinfra.
Python
mit
Fizzadar/pyinfra,Fizzadar/pyinfra
# pyinfra # File: pyinfra/__init__.py # Desc: some global state for pyinfra ''' Welcome to pyinfra. ''' import logging # Global flag set True by `pyinfra_cli.__main__` is_cli = False # Global pyinfra logger logger = logging.getLogger('pyinfra') # Setup package level version from .version import __version__ # noq...
Add default for `is_cli` to pyinfra. # pyinfra # File: pyinfra/__init__.py # Desc: some global state for pyinfra ''' Welcome to pyinfra. ''' import logging # Global pyinfra logger logger = logging.getLogger('pyinfra') # Setup package level version from .version import __version__ # noqa # Trigger pseudo_* creat...
f5198851aebb000a6107b3f9ce34825da200abff
src/foremast/utils/get_template.py
src/foremast/utils/get_template.py
"""Render Jinja2 template.""" import logging import os import jinja2 LOG = logging.getLogger(__name__) def get_template(template_file='', **kwargs): """Get the Jinja2 template and renders with dict _kwargs_. Args: kwargs: Keywords to use for rendering the Jinja2 template. Returns: Stri...
"""Render Jinja2 template.""" import logging import os import jinja2 LOG = logging.getLogger(__name__) def get_template(template_file='', **kwargs): """Get the Jinja2 template and renders with dict _kwargs_. Args: kwargs: Keywords to use for rendering the Jinja2 template. Returns: Stri...
Use more descriptive variable names
style: Use more descriptive variable names See also: PSOBAT-1197
Python
apache-2.0
gogoair/foremast,gogoair/foremast
"""Render Jinja2 template.""" import logging import os import jinja2 LOG = logging.getLogger(__name__) def get_template(template_file='', **kwargs): """Get the Jinja2 template and renders with dict _kwargs_. Args: kwargs: Keywords to use for rendering the Jinja2 template. Returns: Stri...
style: Use more descriptive variable names See also: PSOBAT-1197 """Render Jinja2 template.""" import logging import os import jinja2 LOG = logging.getLogger(__name__) def get_template(template_file='', **kwargs): """Get the Jinja2 template and renders with dict _kwargs_. Args: kwargs: Keywords t...
e7cba721d78860d0151cc65793e567b0da719d39
regserver/regulations/tests/partial_view_tests.py
regserver/regulations/tests/partial_view_tests.py
from unittest import TestCase from mock import Mock, patch from regulations.generator.layers.layers_applier import * from regulations.views.partial import * class PartialParagraphViewTests(TestCase): @patch('regulations.views.partial.generator') def test_get_context_data(self, generator): generator.ge...
from unittest import TestCase from mock import Mock, patch from django.test import RequestFactory from regulations.generator.layers.layers_applier import * from regulations.views.partial import * class PartialParagraphViewTests(TestCase): @patch('regulations.views.partial.generator') def test_get_context_da...
Change test, so that view has a request object
Change test, so that view has a request object
Python
cc0-1.0
ascott1/regulations-site,18F/regulations-site,ascott1/regulations-site,grapesmoker/regulations-site,tadhg-ohiggins/regulations-site,18F/regulations-site,adderall/regulations-site,adderall/regulations-site,ascott1/regulations-site,grapesmoker/regulations-site,EricSchles/regulations-site,EricSchles/regulations-site,willb...
from unittest import TestCase from mock import Mock, patch from django.test import RequestFactory from regulations.generator.layers.layers_applier import * from regulations.views.partial import * class PartialParagraphViewTests(TestCase): @patch('regulations.views.partial.generator') def test_get_context_da...
Change test, so that view has a request object from unittest import TestCase from mock import Mock, patch from regulations.generator.layers.layers_applier import * from regulations.views.partial import * class PartialParagraphViewTests(TestCase): @patch('regulations.views.partial.generator') def test_get_con...
35c2c26ba379c4fc33465c11bb77a5cc8b4a7d2d
data/process_bigrams.py
data/process_bigrams.py
# Intended to be used with count_2w.txt which has the following format: # A B\tFREQENCY # Sometimes "A" is "<S>" for start and "</S>" for end. # Output is similar with all output lower-cased (including "<S>" and "</S>"). import collections from src.data import data all_results = collections.defaultdict(int) for line...
Reformat words_2w.txt to sort and remove caps.
Reformat words_2w.txt to sort and remove caps.
Python
mit
PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge
# Intended to be used with count_2w.txt which has the following format: # A B\tFREQENCY # Sometimes "A" is "<S>" for start and "</S>" for end. # Output is similar with all output lower-cased (including "<S>" and "</S>"). import collections from src.data import data all_results = collections.defaultdict(int) for line...
Reformat words_2w.txt to sort and remove caps.
e19b11c8598fe7a7e68640638a3489c05002f968
tests/test_supercron.py
tests/test_supercron.py
#!/usr/bin/env python import sys import os import unittest from subprocess import Popen, PIPE ROOT_DIR = os.path.join(os.path.dirname(__file__), "..") sys.path.append(ROOT_DIR) from supercron import SuperCron class RunTests(unittest.TestCase): """class that tests supercron for behavior correctness""" def setUp...
#!/usr/bin/env python import sys import os import unittest from subprocess import Popen, PIPE ROOT_DIR = os.path.join(os.path.dirname(__file__), "..") sys.path.append(ROOT_DIR) from supercron import SuperCron class RunTests(unittest.TestCase): """class that tests supercron for behavior correctness""" def setUp...
Delete the jobs in tearDown() in tests
Delete the jobs in tearDown() in tests
Python
bsd-3-clause
linostar/SuperCron
#!/usr/bin/env python import sys import os import unittest from subprocess import Popen, PIPE ROOT_DIR = os.path.join(os.path.dirname(__file__), "..") sys.path.append(ROOT_DIR) from supercron import SuperCron class RunTests(unittest.TestCase): """class that tests supercron for behavior correctness""" def setUp...
Delete the jobs in tearDown() in tests #!/usr/bin/env python import sys import os import unittest from subprocess import Popen, PIPE ROOT_DIR = os.path.join(os.path.dirname(__file__), "..") sys.path.append(ROOT_DIR) from supercron import SuperCron class RunTests(unittest.TestCase): """class that tests supercron...
b264313d48a66b847a1cfa6459745f2d35e10cee
tests/conftest.py
tests/conftest.py
import os import subprocess import sys def _is_pip_installed(): try: import pip # NOQA return True except ImportError: return False def _is_in_ci(): ci_name = os.environ.get('CUPY_CI', '') return ci_name != '' def pytest_configure(config): # Print installed packages ...
Print installed packages in pytest
Print installed packages in pytest
Python
mit
cupy/cupy,cupy/cupy,cupy/cupy,cupy/cupy
import os import subprocess import sys def _is_pip_installed(): try: import pip # NOQA return True except ImportError: return False def _is_in_ci(): ci_name = os.environ.get('CUPY_CI', '') return ci_name != '' def pytest_configure(config): # Print installed packages ...
Print installed packages in pytest
88d938fc4050ef99180ff364f0a6d27d31ecc16c
lambdautils/metadata.py
lambdautils/metadata.py
# -*- coding: utf-8 -*- """Project metadata.""" package = "lambdautils" project = "lambdautils" version = '0.2.8' description = "Simple utilities for AWS Lambda functions" authors = ["Innovative Travel Ltd"] authors_string = ', '.join(authors) emails = ['german@innovativetravel.eu'] license = 'MIT' copyright = '2016 '...
# -*- coding: utf-8 -*- """Project metadata.""" package = "lambdautils" project = "lambdautils" version = '0.2.9' description = "Simple utilities for AWS Lambda functions" authors = ["Innovative Travel Ltd"] authors_string = ', '.join(authors) emails = ['german@innovativetravel.eu'] license = 'MIT' copyright = '2016 '...
Support for externally produced Kinesis partition keys
Support for externally produced Kinesis partition keys
Python
mit
humilis/humilis-lambdautils
# -*- coding: utf-8 -*- """Project metadata.""" package = "lambdautils" project = "lambdautils" version = '0.2.9' description = "Simple utilities for AWS Lambda functions" authors = ["Innovative Travel Ltd"] authors_string = ', '.join(authors) emails = ['german@innovativetravel.eu'] license = 'MIT' copyright = '2016 '...
Support for externally produced Kinesis partition keys # -*- coding: utf-8 -*- """Project metadata.""" package = "lambdautils" project = "lambdautils" version = '0.2.8' description = "Simple utilities for AWS Lambda functions" authors = ["Innovative Travel Ltd"] authors_string = ', '.join(authors) emails = ['german@i...
2231c0384e56af56285999bc0bf7a096d3dd1cb9
pyuploadcare/dj/models.py
pyuploadcare/dj/models.py
from django.db import models from django.core.exceptions import ValidationError from pyuploadcare.dj import forms, UploadCare from pyuploadcare.file import File class FileField(models.Field): __metaclass__ = models.SubfieldBase description = "UploadCare file id/URI with cached data" def get_internal_ty...
from django.db import models from django.core.exceptions import ValidationError from pyuploadcare.dj import forms, UploadCare from pyuploadcare.exceptions import InvalidRequestError from pyuploadcare.file import File class FileField(models.Field): __metaclass__ = models.SubfieldBase description = "UploadCar...
Add handling of InvalidRequestError in ``to_python`
Add handling of InvalidRequestError in ``to_python`
Python
mit
uploadcare/pyuploadcare
from django.db import models from django.core.exceptions import ValidationError from pyuploadcare.dj import forms, UploadCare from pyuploadcare.exceptions import InvalidRequestError from pyuploadcare.file import File class FileField(models.Field): __metaclass__ = models.SubfieldBase description = "UploadCar...
Add handling of InvalidRequestError in ``to_python` from django.db import models from django.core.exceptions import ValidationError from pyuploadcare.dj import forms, UploadCare from pyuploadcare.file import File class FileField(models.Field): __metaclass__ = models.SubfieldBase description = "UploadCare f...
2cd19b395f4320330b66dff1ef98d149f3a40a31
ckanext/syndicate/tests/test_plugin.py
ckanext/syndicate/tests/test_plugin.py
from mock import patch import unittest import ckan.model as model from ckan.model.domain_object import DomainObjectOperation from ckanext.syndicate.plugin import SyndicatePlugin class TestPlugin(unittest.TestCase): def test_notify_syndicates_task(self): entity = model.Package() entity.extras = ...
from mock import patch import unittest import ckan.model as model from ckan.model.domain_object import DomainObjectOperation from ckanext.syndicate.plugin import SyndicatePlugin class TestNotify(unittest.TestCase): def setUp(self): super(TestNotify, self).setUp() self.entity = model.Package() ...
Add test for notify dataset/update
Add test for notify dataset/update
Python
agpl-3.0
aptivate/ckanext-syndicate,sorki/ckanext-redmine-autoissues,aptivate/ckanext-syndicate,sorki/ckanext-redmine-autoissues
from mock import patch import unittest import ckan.model as model from ckan.model.domain_object import DomainObjectOperation from ckanext.syndicate.plugin import SyndicatePlugin class TestNotify(unittest.TestCase): def setUp(self): super(TestNotify, self).setUp() self.entity = model.Package() ...
Add test for notify dataset/update from mock import patch import unittest import ckan.model as model from ckan.model.domain_object import DomainObjectOperation from ckanext.syndicate.plugin import SyndicatePlugin class TestPlugin(unittest.TestCase): def test_notify_syndicates_task(self): entity = mode...
b5744150da20f9b3b0f37704eb91878de21072cf
deploy/scripts/upgrade-web.py
deploy/scripts/upgrade-web.py
#!/usr/bin/python3 import errno import pathlib import platform import sys import subprocess def main(): dist = platform.dist() if dist[0] != 'debian' and dist[0] != 'Ubuntu': print('This script can only be run on Debian GNU/Linux or Ubuntu.') sys.exit(errno.EPERM) workdir = pathlib.Path(_...
#!/usr/bin/python3 import errno import pathlib import platform import sys import subprocess def main(): dist = platform.dist() if dist[0] != 'debian' and dist[0] != 'Ubuntu': print('This script can only be run on Debian GNU/Linux or Ubuntu.') sys.exit(errno.EPERM) workdir = pathlib.Path(_...
Install uwsgi in venv on web upgrade
Install uwsgi in venv on web upgrade
Python
mit
clicheio/cliche,clicheio/cliche,item4/cliche,clicheio/cliche,item4/cliche
#!/usr/bin/python3 import errno import pathlib import platform import sys import subprocess def main(): dist = platform.dist() if dist[0] != 'debian' and dist[0] != 'Ubuntu': print('This script can only be run on Debian GNU/Linux or Ubuntu.') sys.exit(errno.EPERM) workdir = pathlib.Path(_...
Install uwsgi in venv on web upgrade #!/usr/bin/python3 import errno import pathlib import platform import sys import subprocess def main(): dist = platform.dist() if dist[0] != 'debian' and dist[0] != 'Ubuntu': print('This script can only be run on Debian GNU/Linux or Ubuntu.') sys.exit(errn...
a11d33f5e1df23f044cac709ebbbb5d369d0e6ca
tests/test_add_language/test_update_language_list.py
tests/test_add_language/test_update_language_list.py
# test_update_language_list from __future__ import unicode_literals import json import os import os.path import nose.tools as nose import yvs.shared as yvs import utilities.add_language as add_lang from tests.test_add_language import set_up, tear_down from tests.test_add_language.decorators import redirect_stdout ...
Add first test for update_language_list function
Add first test for update_language_list function
Python
mit
caleb531/youversion-suggest,caleb531/youversion-suggest
# test_update_language_list from __future__ import unicode_literals import json import os import os.path import nose.tools as nose import yvs.shared as yvs import utilities.add_language as add_lang from tests.test_add_language import set_up, tear_down from tests.test_add_language.decorators import redirect_stdout ...
Add first test for update_language_list function
4b52f2c237ff3c73af15846e7ae23436af8ab6c7
airesources/Python/BasicBot.py
airesources/Python/BasicBot.py
from hlt import * from networking import * playerTag, gameMap = getInit() sendInit("BasicBot"+str(playerTag)) turtleFactor = random.randint(1, 20) while True: moves = [] gameMap = getFrame() for y in range(0, len(gameMap.contents)): for x in range(0, len(gameMap.contents[y])): site = gameMap.contents[y][x] ...
from hlt import * from networking import * playerTag, gameMap = getInit() sendInit("BasicBot"+str(playerTag)) while True: moves = [] gameMap = getFrame() for y in range(0, len(gameMap.contents)): for x in range(0, len(gameMap.contents[y])): site = gameMap.contents[y][x] if site.owner == playerTag: dir...
Revert basic bot random turtle factor
Revert basic bot random turtle factor Former-commit-id: 53ffe42cf718cfedaa3ec329b0688c093513683c Former-commit-id: 6a282c036f4e11a0aa9e954f72050053059ac557 Former-commit-id: c52f52d401c4a3768c7d590fb02f3d08abd38002
Python
mit
HaliteChallenge/Halite-II,HaliteChallenge/Halite-II,lanyudhy/Halite-II,yangle/HaliteIO,yangle/HaliteIO,lanyudhy/Halite-II,yangle/HaliteIO,yangle/HaliteIO,HaliteChallenge/Halite-II,yangle/HaliteIO,yangle/HaliteIO,lanyudhy/Halite-II,HaliteChallenge/Halite-II,lanyudhy/Halite-II,HaliteChallenge/Halite,HaliteChallenge/Halit...
from hlt import * from networking import * playerTag, gameMap = getInit() sendInit("BasicBot"+str(playerTag)) while True: moves = [] gameMap = getFrame() for y in range(0, len(gameMap.contents)): for x in range(0, len(gameMap.contents[y])): site = gameMap.contents[y][x] if site.owner == playerTag: dir...
Revert basic bot random turtle factor Former-commit-id: 53ffe42cf718cfedaa3ec329b0688c093513683c Former-commit-id: 6a282c036f4e11a0aa9e954f72050053059ac557 Former-commit-id: c52f52d401c4a3768c7d590fb02f3d08abd38002 from hlt import * from networking import * playerTag, gameMap = getInit() sendInit("BasicBot"+str(play...
8fb60650f8ff1da16d537402e7227f78667b434e
tests/test_schema_loader.py
tests/test_schema_loader.py
import contextlib import json import os import tempfile import unittest from faker_schema.schema_loader import load_json_from_file, load_json_from_string class TestFakerSchema(unittest.TestCase): def test_load_json_from_string(self): schema_json_string = '{"Full Name": "name", "Address": "address", "Email": "ema...
Add unit tests for schema loader module
Add unit tests for schema loader module
Python
mit
ueg1990/faker-schema
import contextlib import json import os import tempfile import unittest from faker_schema.schema_loader import load_json_from_file, load_json_from_string class TestFakerSchema(unittest.TestCase): def test_load_json_from_string(self): schema_json_string = '{"Full Name": "name", "Address": "address", "Email": "ema...
Add unit tests for schema loader module
fd114dbd5036735a9c3bcbd49fd8d31c2e750a8a
nailgun/nailgun/test/unit/test_requirements.py
nailgun/nailgun/test/unit/test_requirements.py
# -*- coding: utf-8 -*- # Copyright 2015 Mirantis, 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 requi...
Check if nailgun's requirements do not conflict
Check if nailgun's requirements do not conflict Added simple test that will try to parse nailgun's requirements and see if there are any problems with them. Change-Id: I342eda0a3b019780e0d452455734591aab91f6e9 Closes-Bug: #1462281
Python
apache-2.0
huntxu/fuel-web,stackforge/fuel-web,eayunstack/fuel-web,prmtl/fuel-web,stackforge/fuel-web,prmtl/fuel-web,SmartInfrastructures/fuel-web-dev,prmtl/fuel-web,nebril/fuel-web,huntxu/fuel-web,eayunstack/fuel-web,eayunstack/fuel-web,SmartInfrastructures/fuel-web-dev,prmtl/fuel-web,eayunstack/fuel-web,SmartInfrastructures/fue...
# -*- coding: utf-8 -*- # Copyright 2015 Mirantis, 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 requi...
Check if nailgun's requirements do not conflict Added simple test that will try to parse nailgun's requirements and see if there are any problems with them. Change-Id: I342eda0a3b019780e0d452455734591aab91f6e9 Closes-Bug: #1462281
a466a89cd18252c6d90fd3b590148ca3268ff637
karabo_data/tests/test_lpd_geometry.py
karabo_data/tests/test_lpd_geometry.py
from matplotlib.figure import Figure import numpy as np from karabo_data.geometry2 import LPD_1MGeometry def test_inspect(): geom = LPD_1MGeometry.from_quad_positions([ (11.4, 299), (-11.5, 8), (254.5, -16), (278.5, 275) ]) # Smoketest fig = geom.inspect() assert is...
Add a couple of simple tests for LPD geometry
Add a couple of simple tests for LPD geometry
Python
bsd-3-clause
European-XFEL/h5tools-py
from matplotlib.figure import Figure import numpy as np from karabo_data.geometry2 import LPD_1MGeometry def test_inspect(): geom = LPD_1MGeometry.from_quad_positions([ (11.4, 299), (-11.5, 8), (254.5, -16), (278.5, 275) ]) # Smoketest fig = geom.inspect() assert is...
Add a couple of simple tests for LPD geometry
ae9392137c66832e2e4fa0a51938aad2e6fdb8a4
django_q/__init__.py
django_q/__init__.py
import os import sys import django myPath = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, myPath) VERSION = (0, 9, 2) default_app_config = 'django_q.apps.DjangoQConfig' # root imports will slowly be deprecated. # please import from the relevant sub modules if django.VERSION[:2] < (1, 9): from .t...
# import os # import sys import django # myPath = os.path.dirname(os.path.abspath(__file__)) # sys.path.insert(0, myPath) VERSION = (0, 9, 2) default_app_config = 'django_q.apps.DjangoQConfig' # root imports will slowly be deprecated. # please import from the relevant sub modules if django.VERSION[:2] < (1, 9): ...
Change path location of django q
Change path location of django q
Python
mit
Koed00/django-q
# import os # import sys import django # myPath = os.path.dirname(os.path.abspath(__file__)) # sys.path.insert(0, myPath) VERSION = (0, 9, 2) default_app_config = 'django_q.apps.DjangoQConfig' # root imports will slowly be deprecated. # please import from the relevant sub modules if django.VERSION[:2] < (1, 9): ...
Change path location of django q import os import sys import django myPath = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, myPath) VERSION = (0, 9, 2) default_app_config = 'django_q.apps.DjangoQConfig' # root imports will slowly be deprecated. # please import from the relevant sub modules if django...
ea5bcdb8864fe326fcaa66f43313311d954ed759
arx/sources/test/s3.py
arx/sources/test/s3.py
import pytest from ...decorators import InvalidScheme from ..s3 import S3, S3Jar, S3Tar, Invalid def test_http(): src = S3('s3://bucket/key') assert src.authority == 'bucket' assert src.path == '/key' assert src.fragment is None with pytest.raises(Invalid): src = S3('s3://bucket/key#piec...
Test S3 parsing and validation
Test S3 parsing and validation
Python
mit
drcloud/arx
import pytest from ...decorators import InvalidScheme from ..s3 import S3, S3Jar, S3Tar, Invalid def test_http(): src = S3('s3://bucket/key') assert src.authority == 'bucket' assert src.path == '/key' assert src.fragment is None with pytest.raises(Invalid): src = S3('s3://bucket/key#piec...
Test S3 parsing and validation
a670b598f4416b0e99acd7442e5a51295a5daaa3
tests/test_utils.py
tests/test_utils.py
import os import time import unittest from helpers.utils import sigchld_handler, sigterm_handler, sleep def nop(*args, **kwargs): pass def os_waitpid(a, b): return (0, 0) def time_sleep(_): sigchld_handler(None, None) class TestUtils(unittest.TestCase): def __init__(self, method_name='runTest'...
import os import time import unittest from helpers.utils import reap_children, sigchld_handler, sigterm_handler, sleep def nop(*args, **kwargs): pass def os_waitpid(a, b): return (0, 0) def time_sleep(_): sigchld_handler(None, None) class TestUtils(unittest.TestCase): def __init__(self, method...
Implement unit test for reap_children function
Implement unit test for reap_children function
Python
mit
jinty/patroni,sean-/patroni,jinty/patroni,pgexperts/patroni,sean-/patroni,zalando/patroni,pgexperts/patroni,zalando/patroni
import os import time import unittest from helpers.utils import reap_children, sigchld_handler, sigterm_handler, sleep def nop(*args, **kwargs): pass def os_waitpid(a, b): return (0, 0) def time_sleep(_): sigchld_handler(None, None) class TestUtils(unittest.TestCase): def __init__(self, method...
Implement unit test for reap_children function import os import time import unittest from helpers.utils import sigchld_handler, sigterm_handler, sleep def nop(*args, **kwargs): pass def os_waitpid(a, b): return (0, 0) def time_sleep(_): sigchld_handler(None, None) class TestUtils(unittest.TestCase...
a47f8ce5166b6b95b55136c2fd104e5c7b5dbf7a
swaggery/keywords.py
swaggery/keywords.py
'''A utility module to import all boilerplate Swaggery keywords into a module. Usage: from swaggery.keywords import * ''' from .api import Api, Resource, operations from .utils import Ptypes from .logger import log from .flowcontrol import Respond from .models import ( Model, Void, Integer, Float,...
'''A utility module to import all boilerplate Swaggery keywords into a module. Usage: from swaggery.keywords import * ''' from .api import Api, Resource, operations from .utils import Ptypes from .logger import log from .flowcontrol import Respond from .models import ( Model, Void, Integer, Float,...
Add newline to end of file
Add newline to end of file
Python
agpl-3.0
quasipedia/swaggery,quasipedia/swaggery
'''A utility module to import all boilerplate Swaggery keywords into a module. Usage: from swaggery.keywords import * ''' from .api import Api, Resource, operations from .utils import Ptypes from .logger import log from .flowcontrol import Respond from .models import ( Model, Void, Integer, Float,...
Add newline to end of file '''A utility module to import all boilerplate Swaggery keywords into a module. Usage: from swaggery.keywords import * ''' from .api import Api, Resource, operations from .utils import Ptypes from .logger import log from .flowcontrol import Respond from .models import ( Model, V...
52cc08dd2df39d8b64ac1a95b6861985ca7ac487
erpnext/manufacturing/doctype/bom_update_tool/test_bom_update_tool.py
erpnext/manufacturing/doctype/bom_update_tool/test_bom_update_tool.py
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals import unittest import frappe test_records = frappe.get_test_records('BOM') class TestBOMUpdateTool(unittest.TestCase): def test_replace_bom(self): ...
Test case added for replacing BOM
Test case added for replacing BOM
Python
agpl-3.0
gsnbng/erpnext,geekroot/erpnext,geekroot/erpnext,indictranstech/erpnext,indictranstech/erpnext,gsnbng/erpnext,indictranstech/erpnext,geekroot/erpnext,gsnbng/erpnext,gsnbng/erpnext,geekroot/erpnext,indictranstech/erpnext
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals import unittest import frappe test_records = frappe.get_test_records('BOM') class TestBOMUpdateTool(unittest.TestCase): def test_replace_bom(self): ...
Test case added for replacing BOM
f2752572d915563ea5a3361dbb7a3fee08b04660
tests/test_mmstats.py
tests/test_mmstats.py
import mmstats def test_uint(): class MyStats(mmstats.MmStats): apples = mmstats.UIntStat() oranges = mmstats.UIntStat() mmst = MyStats() # Basic format assert mmst.mmap[0] == '\x01' assert mmst.mmap.find('applesL') != -1 assert mmst.mmap.find('orangesL') != -1 # Stat man...
import mmstats def test_uint(): class MyStats(mmstats.MmStats): zebras = mmstats.UIntStat() apples = mmstats.UIntStat() oranges = mmstats.UIntStat() mmst = MyStats() # Basic format assert mmst.mmap[0] == '\x01' assert mmst.mmap.find('applesL') != -1 assert mmst.mmap.fi...
Make basic test a bit more thorough
Make basic test a bit more thorough
Python
bsd-3-clause
schmichael/mmstats,schmichael/mmstats,schmichael/mmstats,schmichael/mmstats
import mmstats def test_uint(): class MyStats(mmstats.MmStats): zebras = mmstats.UIntStat() apples = mmstats.UIntStat() oranges = mmstats.UIntStat() mmst = MyStats() # Basic format assert mmst.mmap[0] == '\x01' assert mmst.mmap.find('applesL') != -1 assert mmst.mmap.fi...
Make basic test a bit more thorough import mmstats def test_uint(): class MyStats(mmstats.MmStats): apples = mmstats.UIntStat() oranges = mmstats.UIntStat() mmst = MyStats() # Basic format assert mmst.mmap[0] == '\x01' assert mmst.mmap.find('applesL') != -1 assert mmst.mmap.f...
f331780f48d9f053ba770cade487417537cc2a93
data_structures/graphs/adjacency_list.py
data_structures/graphs/adjacency_list.py
# -*- coding: utf-8 -*- if __name__ == '__main__': from os import getcwd from os import sys sys.path.append(getcwd()) from helpers.display import Section from pprint import pprint as ppr class AbstractGraphList(object): def __init__(self): # We're using a dict since the vertices are labeled...
Add adjacency list data structure
Add adjacency list data structure
Python
apache-2.0
christabor/MoAL,christabor/MoAL,christabor/MoAL,christabor/MoAL,christabor/MoAL
# -*- coding: utf-8 -*- if __name__ == '__main__': from os import getcwd from os import sys sys.path.append(getcwd()) from helpers.display import Section from pprint import pprint as ppr class AbstractGraphList(object): def __init__(self): # We're using a dict since the vertices are labeled...
Add adjacency list data structure
9fba6f871068b0d40b71b9de4f69ac59bc33f567
tests/test_CheckButton.py
tests/test_CheckButton.py
#!/usr/bin/env python import unittest from kiwi.ui.widgets.checkbutton import ProxyCheckButton class CheckButtonTest(unittest.TestCase): def testForBool(self): myChkBtn = ProxyCheckButton() # PyGObject bug, we cannot set bool in the constructor with # introspection #self.assertEqu...
#!/usr/bin/env python import unittest import gtk from kiwi.ui.widgets.checkbutton import ProxyCheckButton class CheckButtonTest(unittest.TestCase): def testForBool(self): myChkBtn = ProxyCheckButton() assert isinstance(myChkBtn, gtk.CheckButton) # PyGObject bug, we cannot set bool in the...
Add a silly assert to avoid a pyflakes warning
Add a silly assert to avoid a pyflakes warning
Python
lgpl-2.1
stoq/kiwi
#!/usr/bin/env python import unittest import gtk from kiwi.ui.widgets.checkbutton import ProxyCheckButton class CheckButtonTest(unittest.TestCase): def testForBool(self): myChkBtn = ProxyCheckButton() assert isinstance(myChkBtn, gtk.CheckButton) # PyGObject bug, we cannot set bool in the...
Add a silly assert to avoid a pyflakes warning #!/usr/bin/env python import unittest from kiwi.ui.widgets.checkbutton import ProxyCheckButton class CheckButtonTest(unittest.TestCase): def testForBool(self): myChkBtn = ProxyCheckButton() # PyGObject bug, we cannot set bool in the constructor with ...
556e9f5a9f04b730260268a769cbd7170868f693
opps/__init__.py
opps/__init__.py
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages try: __import__('pkg_resources').declare_namespace(__name__) except ImportError: from pkgutil import extend_path __path__ = extend_path(__path__, __name__)
#!/usr/bin/env python # -*- coding: utf-8 -*- import pkg_resources pkg_resources.declare_namespace(__name__)
Fix pkg resources declare namespace
Fix pkg resources declare namespace
Python
mit
opps/opps-polls,opps/opps-polls
#!/usr/bin/env python # -*- coding: utf-8 -*- import pkg_resources pkg_resources.declare_namespace(__name__)
Fix pkg resources declare namespace # See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages try: __import__('pkg_resources').declare_namespace(__name__) except ImportError: from pkgutil import extend_path __path__ = extend_path(__path__, __name__)
e4967c60c172ee85c6050744b487156daee13c23
Dice.py
Dice.py
import random class Die(object): def __init__(self, sides = 6): self.sides = sides self.held = False self.die_face = 1 def change_held(self, held): self.held = held def roll_die(self): if (self.held == False): self.die_face = random.randint(1, self.sides) ...
Add base Die functionality(roll, hold, get)
Add base Die functionality(roll, hold, get)
Python
mit
achyutreddy24/DiceGame
import random class Die(object): def __init__(self, sides = 6): self.sides = sides self.held = False self.die_face = 1 def change_held(self, held): self.held = held def roll_die(self): if (self.held == False): self.die_face = random.randint(1, self.sides) ...
Add base Die functionality(roll, hold, get)
b35d4292e50e8a8dc56635bddeac5a1fc42a5d19
tveebot_tracker/source.py
tveebot_tracker/source.py
from abc import ABC, abstractmethod class TVShowNotFound(Exception): """ Raised when a reference does not match any TV Show available """ class EpisodeSource(ABC): """ Abstract base class to define the interface for and episode source. An episode source is used by the tracker to obtain episode file...
from abc import ABC, abstractmethod class TVShowNotFound(Exception): """ Raised when a reference does not match any TV Show available """ class EpisodeSource(ABC): """ Abstract base class to define the interface for and episode source. An episode source is used by the tracker to obtain episode file...
Rename Source's get_episodes_for() method to fetch()
Rename Source's get_episodes_for() method to fetch()
Python
mit
tveebot/tracker
from abc import ABC, abstractmethod class TVShowNotFound(Exception): """ Raised when a reference does not match any TV Show available """ class EpisodeSource(ABC): """ Abstract base class to define the interface for and episode source. An episode source is used by the tracker to obtain episode file...
Rename Source's get_episodes_for() method to fetch() from abc import ABC, abstractmethod class TVShowNotFound(Exception): """ Raised when a reference does not match any TV Show available """ class EpisodeSource(ABC): """ Abstract base class to define the interface for and episode source. An episod...
f70d73b5a67ca13dc243f72ed701e1f8d5924405
setup.py
setup.py
from setuptools import setup DESCRIPTION = "A Django oriented templated / transaction email abstraction" LONG_DESCRIPTION = None try: LONG_DESCRIPTION = open('README.rst').read() except: pass CLASSIFIERS = [ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'Licens...
from setuptools import setup DESCRIPTION = "A Django oriented templated / transaction email abstraction" LONG_DESCRIPTION = None try: LONG_DESCRIPTION = open('README.rst').read() except: pass CLASSIFIERS = [ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'Licens...
Revert "Perhaps need to modify the name"
Revert "Perhaps need to modify the name" This reverts commit d4ee1a1d91cd13bf0cb844be032eaa527806fad1.
Python
mit
dpetzold/django-templated-email,vintasoftware/django-templated-email,ScanTrust/django-templated-email,vintasoftware/django-templated-email,mypebble/django-templated-email,dpetzold/django-templated-email,BradWhittington/django-templated-email,hator/django-templated-email,ScanTrust/django-templated-email,BradWhittington/...
from setuptools import setup DESCRIPTION = "A Django oriented templated / transaction email abstraction" LONG_DESCRIPTION = None try: LONG_DESCRIPTION = open('README.rst').read() except: pass CLASSIFIERS = [ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'Licens...
Revert "Perhaps need to modify the name" This reverts commit d4ee1a1d91cd13bf0cb844be032eaa527806fad1. from setuptools import setup DESCRIPTION = "A Django oriented templated / transaction email abstraction" LONG_DESCRIPTION = None try: LONG_DESCRIPTION = open('README.rst').read() except: pass CLASSIFIERS ...
424fc74377ba4385e4c25fe90f888d39d5f14abd
runtests.py
runtests.py
#!/usr/bin/env python from os.path import dirname, abspath import sys from django.conf import settings if not settings.configured: from django import VERSION settings_dict = dict( INSTALLED_APPS=( 'localeurl', 'localeurl.tests', 'django.contrib.sites', # for sitema...
#!/usr/bin/env python from os.path import dirname, abspath import sys from django.conf import settings if not settings.configured: from django import VERSION settings_dict = dict( INSTALLED_APPS=( 'localeurl', 'localeurl.tests', 'django.contrib.sites', # for sitema...
Add SITE_ID to test settings since contrib.sites is in INSTALLED_APPS.
Add SITE_ID to test settings since contrib.sites is in INSTALLED_APPS.
Python
mit
extertioner/django-localeurl,carljm/django-localeurl,gonnado/django-localeurl
#!/usr/bin/env python from os.path import dirname, abspath import sys from django.conf import settings if not settings.configured: from django import VERSION settings_dict = dict( INSTALLED_APPS=( 'localeurl', 'localeurl.tests', 'django.contrib.sites', # for sitema...
Add SITE_ID to test settings since contrib.sites is in INSTALLED_APPS. #!/usr/bin/env python from os.path import dirname, abspath import sys from django.conf import settings if not settings.configured: from django import VERSION settings_dict = dict( INSTALLED_APPS=( 'localeurl', ...
b56b7ed23ce60a352f163d21fedff63fe2a1c44a
scheduler/scheduled_external_program.py
scheduler/scheduled_external_program.py
import luigi from luigi.contrib.external_program import ExternalProgramTask, ExternalProgramRunError from subprocess import Popen, PIPE, check_call import os import datetime import logging logger = logging.getLogger('luigi-interface') class Scheduler(object): @classmethod def fromblurb(cls, blurb): fo...
Implement a scheduled version of Luigi's external program module
Implement a scheduled version of Luigi's external program module
Python
unlicense
ppavlidis/rnaseq-pipeline,ppavlidis/rnaseq-pipeline,ppavlidis/rnaseq-pipeline
import luigi from luigi.contrib.external_program import ExternalProgramTask, ExternalProgramRunError from subprocess import Popen, PIPE, check_call import os import datetime import logging logger = logging.getLogger('luigi-interface') class Scheduler(object): @classmethod def fromblurb(cls, blurb): fo...
Implement a scheduled version of Luigi's external program module
ea0d732972d4b86cffdc63d73ff04b3da06b6860
osmwriter/_version.py
osmwriter/_version.py
"""Store the version info so that setup.py and __init__ can access it. """ __version__ = "0.2.0"
"""Store the version info so that setup.py and __init__ can access it. """ __version__ = "0.2.0.dev"
Prepare version 0.2.0.dev for next development cycle
Prepare version 0.2.0.dev for next development cycle
Python
agpl-3.0
rory/openstreetmap-writer
"""Store the version info so that setup.py and __init__ can access it. """ __version__ = "0.2.0.dev"
Prepare version 0.2.0.dev for next development cycle """Store the version info so that setup.py and __init__ can access it. """ __version__ = "0.2.0"
34061c55be17a19846833148e2cf6e015918efae
frameworks/C/onion/setup.py
frameworks/C/onion/setup.py
import subprocess import sys import os import setup_util def start(args, logfile, errfile): setup_util.replace_text("onion/hello.c", "mysql_real_connect\(data.db\[i\], \".*\",", "mysql_real_connect(data.db[i], \"" + args.database_host + "\",") subprocess.call("rm *.o", cwd="onion", shell=True, stderr=errfile, ...
import subprocess import sys import os import setup_util def start(args, logfile, errfile): setup_util.replace_text("onion/hello.c", "mysql_real_connect\(data.db\[i\], \".*\",", "mysql_real_connect(data.db[i], \"" + args.database_host + "\",") subprocess.call("rm -f *.o", cwd="onion", shell=True, stderr=errfil...
Remove minor errors in onion
Remove minor errors in onion
Python
bsd-3-clause
alubbe/FrameworkBenchmarks,markkolich/FrameworkBenchmarks,sxend/FrameworkBenchmarks,steveklabnik/FrameworkBenchmarks,jamming/FrameworkBenchmarks,jamming/FrameworkBenchmarks,torhve/FrameworkBenchmarks,kellabyte/FrameworkBenchmarks,marko-asplund/FrameworkBenchmarks,markkolich/FrameworkBenchmarks,ratpack/FrameworkBenchmar...
import subprocess import sys import os import setup_util def start(args, logfile, errfile): setup_util.replace_text("onion/hello.c", "mysql_real_connect\(data.db\[i\], \".*\",", "mysql_real_connect(data.db[i], \"" + args.database_host + "\",") subprocess.call("rm -f *.o", cwd="onion", shell=True, stderr=errfil...
Remove minor errors in onion import subprocess import sys import os import setup_util def start(args, logfile, errfile): setup_util.replace_text("onion/hello.c", "mysql_real_connect\(data.db\[i\], \".*\",", "mysql_real_connect(data.db[i], \"" + args.database_host + "\",") subprocess.call("rm *.o", cwd="onion"...
ede7158c611bf618ee03989d33c5fe6a091b7d66
tests/testapp/models.py
tests/testapp/models.py
from __future__ import absolute_import import sys from django.conf import settings from django.db import models from django.utils.encoding import python_2_unicode_compatible import rules @python_2_unicode_compatible class Book(models.Model): isbn = models.CharField(max_length=50, unique=True) title = model...
from __future__ import absolute_import import sys from django.conf import settings from django.db import models try: from django.utils.encoding import python_2_unicode_compatible except ImportError: def python_2_unicode_compatible(c): return c import rules @python_2_unicode_compatible class Book(m...
Add shim for python_2_unicode_compatible in tests
Add shim for python_2_unicode_compatible in tests
Python
mit
dfunckt/django-rules,dfunckt/django-rules,ticosax/django-rules,ticosax/django-rules,dfunckt/django-rules,ticosax/django-rules
from __future__ import absolute_import import sys from django.conf import settings from django.db import models try: from django.utils.encoding import python_2_unicode_compatible except ImportError: def python_2_unicode_compatible(c): return c import rules @python_2_unicode_compatible class Book(m...
Add shim for python_2_unicode_compatible in tests from __future__ import absolute_import import sys from django.conf import settings from django.db import models from django.utils.encoding import python_2_unicode_compatible import rules @python_2_unicode_compatible class Book(models.Model): isbn = models.Char...
86522eab0758ac6bf92ad19b60417b279c71a42c
tabtranslator/model.py
tabtranslator/model.py
# coding: utf-8 class Sheet(object): """ sheet: Top level object. Models the entire music sheet """ def __init__(self, name): super(sheet, self).__init__() self.name = name self.bars = list() class Bar(object): """ bar: Models a measure. Compose the sheet as the temporal layer => Where the notes are d...
# coding: utf-8 class Sheet(object): """ sheet: Top level object. Models the entire music sheet """ def __init__(self, name): super(Sheet, self).__init__() self.name = name self.bars = list() class Bar(object): """ bar: Models a measure. Compose the sheet as the temporal layer => Where the notes are d...
FIX class name in camel case:
FIX class name in camel case:
Python
mit
ograndedjogo/tab-translator,ograndedjogo/tab-translator
# coding: utf-8 class Sheet(object): """ sheet: Top level object. Models the entire music sheet """ def __init__(self, name): super(Sheet, self).__init__() self.name = name self.bars = list() class Bar(object): """ bar: Models a measure. Compose the sheet as the temporal layer => Where the notes are d...
FIX class name in camel case: # coding: utf-8 class Sheet(object): """ sheet: Top level object. Models the entire music sheet """ def __init__(self, name): super(sheet, self).__init__() self.name = name self.bars = list() class Bar(object): """ bar: Models a measure. Compose the sheet as the temporal la...
e8ee7ad6e2560a4fd0ca287adc55155f066eb815
akanda/horizon/routers/views.py
akanda/horizon/routers/views.py
from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from openstack_dashboard import api def get_interfaces_data(self): try: router_id = self.kwargs['router_id'] router = api.quantum.router_get(self.request, router_id) # Note(rods): Filter off the...
from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from openstack_dashboard import api def get_interfaces_data(self): try: router_id = self.kwargs['router_id'] router = api.quantum.router_get(self.request, router_id) # Note(rods): Filter off the...
Remove wrong reference to quantum
Remove wrong reference to quantum Change-Id: Ic3d8b26e061e85c1d128a79b115fd2da4412e705 Signed-off-by: Rosario Di Somma <73b2fe5f91895aea2b4d0e8942a5edf9f18fa897@dreamhost.com>
Python
apache-2.0
dreamhost/akanda-horizon,dreamhost/akanda-horizon
from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from openstack_dashboard import api def get_interfaces_data(self): try: router_id = self.kwargs['router_id'] router = api.quantum.router_get(self.request, router_id) # Note(rods): Filter off the...
Remove wrong reference to quantum Change-Id: Ic3d8b26e061e85c1d128a79b115fd2da4412e705 Signed-off-by: Rosario Di Somma <73b2fe5f91895aea2b4d0e8942a5edf9f18fa897@dreamhost.com> from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from openstack_dashboard import api def get_...
b16b701f6ad80d0df27ab6ea1d9f115a6e2b9106
pymatgen/__init__.py
pymatgen/__init__.py
__author__ = "Shyue Ping Ong, Anubhav Jain, Michael Kocher, " + \ "Geoffroy Hautier, William Davidson Richard, Dan Gunter, " + \ "Shreyas Cholia, Vincent L Chevrier, Rickard Armiento" __date__ = "Jul 27, 2012" __version__ = "2.1.2" """ Useful aliases for commonly used objects and modules. """...
__author__ = "Shyue Ping Ong, Anubhav Jain, Michael Kocher, " + \ "Geoffroy Hautier, William Davidson Richard, Dan Gunter, " + \ "Shreyas Cholia, Vincent L Chevrier, Rickard Armiento" __date__ = "Jul 27, 2012" __version__ = "2.1.3dev" """ Useful aliases for commonly used objects and modules. ...
Increase minor version number + dev.
Increase minor version number + dev. Former-commit-id: 44023123016583dcb692ce23c19978e6f5d90abd [formerly 01b7fa7fe0778c195d9f75d35d43618691778ef8] Former-commit-id: a96aa4b8265bf7b15143879b0a3b98e30a9e5953
Python
mit
blondegeek/pymatgen,tallakahath/pymatgen,dongsenfo/pymatgen,mbkumar/pymatgen,vorwerkc/pymatgen,mbkumar/pymatgen,johnson1228/pymatgen,setten/pymatgen,johnson1228/pymatgen,tschaume/pymatgen,davidwaroquiers/pymatgen,fraricci/pymatgen,dongsenfo/pymatgen,blondegeek/pymatgen,aykol/pymatgen,richardtran415/pymatgen,dongsenfo/p...
__author__ = "Shyue Ping Ong, Anubhav Jain, Michael Kocher, " + \ "Geoffroy Hautier, William Davidson Richard, Dan Gunter, " + \ "Shreyas Cholia, Vincent L Chevrier, Rickard Armiento" __date__ = "Jul 27, 2012" __version__ = "2.1.3dev" """ Useful aliases for commonly used objects and modules. ...
Increase minor version number + dev. Former-commit-id: 44023123016583dcb692ce23c19978e6f5d90abd [formerly 01b7fa7fe0778c195d9f75d35d43618691778ef8] Former-commit-id: a96aa4b8265bf7b15143879b0a3b98e30a9e5953 __author__ = "Shyue Ping Ong, Anubhav Jain, Michael Kocher, " + \ "Geoffroy Hautier, William David...
7c68a78a81721ecbbda0f999576b91b803a34a3e
.circleci/get-commit-range.py
.circleci/get-commit-range.py
#!/usr/bin/env python3 import os import argparse from github import Github def from_pr(project, repo, pr_number): gh = Github() pr = gh.get_repo(f'{project}/{repo}').get_pull(pr_number) base = pr.base.ref head = pr.head.ref return f'origin/{base}...{head}' def main(): argparser = argparse.Ar...
#!/usr/bin/env python3 import os import argparse from github import Github def from_pr(project, repo, pr_number): gh = Github() pr = gh.get_repo(f'{project}/{repo}').get_pull(pr_number) base = pr.base.sha head = pr.base.sha return f'{base}...{head}' def main(): argparser = argparse.ArgumentP...
Use SHAs for commit_range rather than refs
Use SHAs for commit_range rather than refs Refs are local and might not always be present in the checkout.
Python
bsd-3-clause
ryanlovett/datahub,berkeley-dsep-infra/datahub,ryanlovett/datahub,ryanlovett/datahub,berkeley-dsep-infra/datahub,berkeley-dsep-infra/datahub
#!/usr/bin/env python3 import os import argparse from github import Github def from_pr(project, repo, pr_number): gh = Github() pr = gh.get_repo(f'{project}/{repo}').get_pull(pr_number) base = pr.base.sha head = pr.base.sha return f'{base}...{head}' def main(): argparser = argparse.ArgumentP...
Use SHAs for commit_range rather than refs Refs are local and might not always be present in the checkout. #!/usr/bin/env python3 import os import argparse from github import Github def from_pr(project, repo, pr_number): gh = Github() pr = gh.get_repo(f'{project}/{repo}').get_pull(pr_number) base = pr.b...
6cfc9de7fe8fd048a75845a69bdeefc7c742bae4
oneall/django_oneall/management/commands/emaillogin.py
oneall/django_oneall/management/commands/emaillogin.py
# -*- coding: utf-8 -*- from django.core.management.base import BaseCommand from django.core.urlresolvers import reverse from ...auth import EmailTokenAuthBackend class Command(BaseCommand): help = "E-mail login without sending the actual e-mail." def add_arguments(self, parser): parser.add_argument...
# -*- coding: utf-8 -*- from django.core.mail import EmailMessage from django.core.management.base import BaseCommand from django.core.urlresolvers import reverse from ...auth import EmailTokenAuthBackend class Command(BaseCommand): help = "Issues an e-mail login token." def add_arguments(self, parser): ...
Add the possibility of testing SMTP from the command-line.
Add the possibility of testing SMTP from the command-line.
Python
mit
leandigo/django-oneall,ckot/django-oneall,leandigo/django-oneall,ckot/django-oneall
# -*- coding: utf-8 -*- from django.core.mail import EmailMessage from django.core.management.base import BaseCommand from django.core.urlresolvers import reverse from ...auth import EmailTokenAuthBackend class Command(BaseCommand): help = "Issues an e-mail login token." def add_arguments(self, parser): ...
Add the possibility of testing SMTP from the command-line. # -*- coding: utf-8 -*- from django.core.management.base import BaseCommand from django.core.urlresolvers import reverse from ...auth import EmailTokenAuthBackend class Command(BaseCommand): help = "E-mail login without sending the actual e-mail." ...
8fb421831bb562a80edf5c3de84d71bf2a3eec4b
tools/scrub_database.py
tools/scrub_database.py
import os import sys import django sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) os.environ.setdefault("DJANGO_SETTINGS_MODULE", "museum.settings") django.setup() from museum_site.models import * # noqa: E402 from museum_site.constants import REMOVED_ARTICLE, DETAIL_REMOVED # noqa: E...
import datetime import os import sys import django sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) os.environ.setdefault("DJANGO_SETTINGS_MODULE", "museum.settings") django.setup() from django.contrib.sessions.models import Session from django.contrib.auth.models import User from museu...
Remove sessions when scrubbing DB for public release
Remove sessions when scrubbing DB for public release
Python
mit
DrDos0016/z2,DrDos0016/z2,DrDos0016/z2
import datetime import os import sys import django sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) os.environ.setdefault("DJANGO_SETTINGS_MODULE", "museum.settings") django.setup() from django.contrib.sessions.models import Session from django.contrib.auth.models import User from museu...
Remove sessions when scrubbing DB for public release import os import sys import django sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) os.environ.setdefault("DJANGO_SETTINGS_MODULE", "museum.settings") django.setup() from museum_site.models import * # noqa: E402 from museum_site.const...
5252e86a9613545cbd6db2f0867276abac994282
run.py
run.py
from flask import Flask, request, redirect import twilio.twiml app = Flask(__name__) @app.route("/", methods=['GET', 'POST']) def hello_monkey(): """Respond to incoming requests""" resp = twilio.twiml.Response() with resp.gather(numDigits=1, action="/handle-key", method="POST") as g: g.say("pres...
from flask import Flask, request, redirect import twilio.twiml app = Flask(__name__) @app.route("/", methods=['GET', 'POST']) def hello_monkey(): """Respond to incoming requests""" resp = twilio.twiml.Response() with resp.gather(numDigits=1, action="/handle-key", method="POST") as g: g.say("pres...
Add ability to programatically play sound after button press
Add ability to programatically play sound after button press
Python
mit
ColdSauce/tw-1,zachlatta/tw-1,christophert/tw-1
from flask import Flask, request, redirect import twilio.twiml app = Flask(__name__) @app.route("/", methods=['GET', 'POST']) def hello_monkey(): """Respond to incoming requests""" resp = twilio.twiml.Response() with resp.gather(numDigits=1, action="/handle-key", method="POST") as g: g.say("pres...
Add ability to programatically play sound after button press from flask import Flask, request, redirect import twilio.twiml app = Flask(__name__) @app.route("/", methods=['GET', 'POST']) def hello_monkey(): """Respond to incoming requests""" resp = twilio.twiml.Response() with resp.gather(numDigits=...
3f136f153cdc60c1dcc757a8a35ef116bb892a1c
python/prep_policekml.py
python/prep_policekml.py
""" A collection of classes used to manipulate Police KML data, used with prepgml4ogr.py. """ import os from lxml import etree class prep_kml(): def __init__ (self, inputfile): self.inputfile = inputfile self.infile = os.path.basename(inputfile) self.feat_types = ['Placemark'] def get...
""" prep_kml class used to manipulate police.uk KML data, used with prepgml4ogr.py """ import os from lxml import etree class prep_kml(): def __init__(self, inputfile): self.inputfile = inputfile self.infile = os.path.basename(inputfile) self.feat_types = ['Placemark'] def get_feat_t...
Remove stray comment, update docstring and minor PEP8 changes
Remove stray comment, update docstring and minor PEP8 changes
Python
mit
AstunTechnology/Loader
""" prep_kml class used to manipulate police.uk KML data, used with prepgml4ogr.py """ import os from lxml import etree class prep_kml(): def __init__(self, inputfile): self.inputfile = inputfile self.infile = os.path.basename(inputfile) self.feat_types = ['Placemark'] def get_feat_t...
Remove stray comment, update docstring and minor PEP8 changes """ A collection of classes used to manipulate Police KML data, used with prepgml4ogr.py. """ import os from lxml import etree class prep_kml(): def __init__ (self, inputfile): self.inputfile = inputfile self.infile = os.path.basename(...
d7ab04186f3b8c7c58b654a7372b1d4f3ffad64e
tests/unit/test_domain_commands.py
tests/unit/test_domain_commands.py
from caspy.domain import command, models class TestBook: def test_prepare_new_book(self): empty_book = models.Book() result = command.prepare_book(empty_book, 'now') assert isinstance(result, models.Book) assert result.created_at == 'now' def test_prepare_old_book(self): ...
Add unit tests for prepare_book
Add unit tests for prepare_book
Python
bsd-3-clause
altaurog/django-caspy,altaurog/django-caspy,altaurog/django-caspy
from caspy.domain import command, models class TestBook: def test_prepare_new_book(self): empty_book = models.Book() result = command.prepare_book(empty_book, 'now') assert isinstance(result, models.Book) assert result.created_at == 'now' def test_prepare_old_book(self): ...
Add unit tests for prepare_book
29cde856d41fc8654735aa5233e5983178a8e08e
wp2github/_version.py
wp2github/_version.py
__version_info__ = (1, 0, 2) __version__ = '.'.join(map(str, __version_info__))
__version_info__ = (1, 0, 3) __version__ = '.'.join(map(str, __version_info__))
Replace Markdown README with reStructured text
Replace Markdown README with reStructured text
Python
mit
r8/wp2github.py
__version_info__ = (1, 0, 3) __version__ = '.'.join(map(str, __version_info__))
Replace Markdown README with reStructured text __version_info__ = (1, 0, 2) __version__ = '.'.join(map(str, __version_info__))
ecbb3ffdf063bc53eae0f8bd180e62ae61f99fee
opencontrail_netns/vrouter_control.py
opencontrail_netns/vrouter_control.py
from contrail_vrouter_api.vrouter_api import ContrailVRouterApi def interface_register(vm, vmi, iface_name): api = ContrailVRouterApi() mac = vmi.virtual_machine_interface_mac_addresses.mac_address[0] api.add_port(vm.uuid, vmi.uuid, iface_name, mac) def interface_unregister(vmi_uuid): api = Contrail...
from contrail_vrouter_api.vrouter_api import ContrailVRouterApi def interface_register(vm, vmi, iface_name): api = ContrailVRouterApi() mac = vmi.virtual_machine_interface_mac_addresses.mac_address[0] api.add_port(vm.uuid, vmi.uuid, iface_name, mac, port_type='NovaVMPort') def interface_unregister(vmi_u...
Use NovaVMPort type; otherwise the agent will believe it is a Use NovaVMPort as type; otherwise the agent will believe it is dealing with a service-instance and will not send a VM registration.
Use NovaVMPort type; otherwise the agent will believe it is a Use NovaVMPort as type; otherwise the agent will believe it is dealing with a service-instance and will not send a VM registration.
Python
apache-2.0
pedro-r-marques/opencontrail-netns,DreamLab/opencontrail-netns
from contrail_vrouter_api.vrouter_api import ContrailVRouterApi def interface_register(vm, vmi, iface_name): api = ContrailVRouterApi() mac = vmi.virtual_machine_interface_mac_addresses.mac_address[0] api.add_port(vm.uuid, vmi.uuid, iface_name, mac, port_type='NovaVMPort') def interface_unregister(vmi_u...
Use NovaVMPort type; otherwise the agent will believe it is a Use NovaVMPort as type; otherwise the agent will believe it is dealing with a service-instance and will not send a VM registration. from contrail_vrouter_api.vrouter_api import ContrailVRouterApi def interface_register(vm, vmi, iface_name): api = Cont...
389ca2213c2ba3c86c783372e3e933a12f90506e
ckanext/requestdata/controllers/admin.py
ckanext/requestdata/controllers/admin.py
from ckan.lib import base from ckan import logic from ckan.plugins import toolkit get_action = logic.get_action NotFound = logic.NotFound NotAuthorized = logic.NotAuthorized redirect = base.redirect abort = base.abort BaseController = base.BaseController class AdminController(BaseController): def email(self): ...
from ckan.lib import base from ckan import logic from ckan.plugins import toolkit from ckan.controllers.admin import AdminController get_action = logic.get_action NotFound = logic.NotFound NotAuthorized = logic.NotAuthorized redirect = base.redirect abort = base.abort BaseController = base.BaseController class Admi...
Extend Admin instead of Base controller
Extend Admin instead of Base controller
Python
agpl-3.0
ViderumGlobal/ckanext-requestdata,ViderumGlobal/ckanext-requestdata,ViderumGlobal/ckanext-requestdata,ViderumGlobal/ckanext-requestdata
from ckan.lib import base from ckan import logic from ckan.plugins import toolkit from ckan.controllers.admin import AdminController get_action = logic.get_action NotFound = logic.NotFound NotAuthorized = logic.NotAuthorized redirect = base.redirect abort = base.abort BaseController = base.BaseController class Admi...
Extend Admin instead of Base controller from ckan.lib import base from ckan import logic from ckan.plugins import toolkit get_action = logic.get_action NotFound = logic.NotFound NotAuthorized = logic.NotAuthorized redirect = base.redirect abort = base.abort BaseController = base.BaseController class AdminControlle...
dcbb22300663f0484e81c13770f196e078e83ca5
api/base/parsers.py
api/base/parsers.py
from rest_framework.parsers import JSONParser from api.base.renderers import JSONAPIRenderer class JSONAPIParser(JSONParser): """ Parses JSON-serialized data. Overrides media_type. """ media_type = 'application/vnd.api+json' renderer_class = JSONAPIRenderer
from rest_framework.parsers import JSONParser from api.base.renderers import JSONAPIRenderer from api.base.exceptions import JSONAPIException class JSONAPIParser(JSONParser): """ Parses JSON-serialized data. Overrides media_type. """ media_type = 'application/vnd.api+json' renderer_class = JSONAPI...
Add parse method which flattens data dictionary.
Add parse method which flattens data dictionary.
Python
apache-2.0
icereval/osf.io,RomanZWang/osf.io,cwisecarver/osf.io,abought/osf.io,sloria/osf.io,aaxelb/osf.io,zamattiac/osf.io,KAsante95/osf.io,GageGaskins/osf.io,TomHeatwole/osf.io,pattisdr/osf.io,laurenrevere/osf.io,zamattiac/osf.io,emetsger/osf.io,rdhyee/osf.io,cslzchen/osf.io,mluke93/osf.io,samchrisinger/osf.io,mattclark/osf.io,...
from rest_framework.parsers import JSONParser from api.base.renderers import JSONAPIRenderer from api.base.exceptions import JSONAPIException class JSONAPIParser(JSONParser): """ Parses JSON-serialized data. Overrides media_type. """ media_type = 'application/vnd.api+json' renderer_class = JSONAPI...
Add parse method which flattens data dictionary. from rest_framework.parsers import JSONParser from api.base.renderers import JSONAPIRenderer class JSONAPIParser(JSONParser): """ Parses JSON-serialized data. Overrides media_type. """ media_type = 'application/vnd.api+json' renderer_class = JSONAP...
3588c52060b540f6d3ca791c7309b4e9185a60aa
config.py
config.py
class Config(object): """ Base configuration class. Contains one method that defines the database URI. This class is to be subclassed and its attributes defined therein. """ def __init__(self): self.database_uri() def database_uri(self): if self.DIALECT == 'sqlite': ...
class Config(object): """ Base configuration class. Contains one property that defines the database URI. This class is to be subclassed and its attributes defined therein. """ @property def database_uri(self): return r'sqlite://{name}'.format(name=self.DBNAME) if self.DIALECT == 'sqli...
Replace database_uri method with a property
Replace database_uri method with a property
Python
mit
soccermetrics/marcotti-mls
class Config(object): """ Base configuration class. Contains one property that defines the database URI. This class is to be subclassed and its attributes defined therein. """ @property def database_uri(self): return r'sqlite://{name}'.format(name=self.DBNAME) if self.DIALECT == 'sqli...
Replace database_uri method with a property class Config(object): """ Base configuration class. Contains one method that defines the database URI. This class is to be subclassed and its attributes defined therein. """ def __init__(self): self.database_uri() def database_uri(self): ...
9c2bee9fe8442cad0761d196d78baaff37c9cb08
mff_rams_plugin/config.py
mff_rams_plugin/config.py
from uber.common import * config = parse_config(__file__) c.include_plugin_config(config) c.DEALER_BADGE_PRICE = c.BADGE_PRICE
from uber.common import * config = parse_config(__file__) c.include_plugin_config(config) @Config.mixin class ExtraConfig: @property def DEALER_BADGE_PRICE(self): return self.get_attendee_price()
Fix DB errors on stop/re-up Due to the fact that this code was being run before everything else, it would cause server-stopping errors -- but only when starting the server for the first time. It took a little bit to track down, but this is the correct way to override this variable.
Fix DB errors on stop/re-up Due to the fact that this code was being run before everything else, it would cause server-stopping errors -- but only when starting the server for the first time. It took a little bit to track down, but this is the correct way to override this variable.
Python
agpl-3.0
MidwestFurryFandom/mff-rams-plugin,MidwestFurryFandom/mff-rams-plugin
from uber.common import * config = parse_config(__file__) c.include_plugin_config(config) @Config.mixin class ExtraConfig: @property def DEALER_BADGE_PRICE(self): return self.get_attendee_price()
Fix DB errors on stop/re-up Due to the fact that this code was being run before everything else, it would cause server-stopping errors -- but only when starting the server for the first time. It took a little bit to track down, but this is the correct way to override this variable. from uber.common import * config = ...
45ee26fae4a8d31b66e3307c0ab4aed21678b4b6
scrubadub/filth/named_entity.py
scrubadub/filth/named_entity.py
from .base import Filth class NamedEntityFilth(Filth): """ Named entity filth. Upon initialisation provide a label for named entity (e.g. name, org) """ type = 'named_entity' def __init__(self, *args, label: str, **kwargs): super(NamedEntityFilth, self).__init__(*args, **kwargs) s...
from .base import Filth class NamedEntityFilth(Filth): """ Named entity filth. Upon initialisation provide a label for named entity (e.g. name, org) """ type = 'named_entity' def __init__(self, *args, label: str, **kwargs): super(NamedEntityFilth, self).__init__(*args, **kwargs) s...
Revert NamedEntityFilth name because it was a bad idea
Revert NamedEntityFilth name because it was a bad idea
Python
mit
deanmalmgren/scrubadub,datascopeanalytics/scrubadub,deanmalmgren/scrubadub,datascopeanalytics/scrubadub
from .base import Filth class NamedEntityFilth(Filth): """ Named entity filth. Upon initialisation provide a label for named entity (e.g. name, org) """ type = 'named_entity' def __init__(self, *args, label: str, **kwargs): super(NamedEntityFilth, self).__init__(*args, **kwargs) s...
Revert NamedEntityFilth name because it was a bad idea from .base import Filth class NamedEntityFilth(Filth): """ Named entity filth. Upon initialisation provide a label for named entity (e.g. name, org) """ type = 'named_entity' def __init__(self, *args, label: str, **kwargs): super(Nam...
d7fa7d2bacd45a50f14e4e1aeae57cfc56a315db
__init__.py
__init__.py
from openedoo_project import db from openedoo.core.libs import Blueprint from .controllers.employee import EmployeeLogin, EmployeeLogout, AddEmployee, \ AssignEmployeeAsTeacher, EmployeeDashboard, EditEmployee, DeleteEmployee, \ SearchEmployee, AddSubject module_employee = Blueprint('module_employee', __name_...
from openedoo_project import db from openedoo.core.libs import Blueprint from .controllers.employee import EmployeeLogin, EmployeeLogout, AddEmployee, \ AssignEmployeeAsTeacher, EmployeeDashboard, EditEmployee, DeleteEmployee, \ SearchEmployee, AddSubject module_employee = Blueprint('module_employee', __name_...
Make dashboard route become admin's default
Make dashboard route become admin's default
Python
mit
openedoo/module_employee,openedoo/module_employee,openedoo/module_employee
from openedoo_project import db from openedoo.core.libs import Blueprint from .controllers.employee import EmployeeLogin, EmployeeLogout, AddEmployee, \ AssignEmployeeAsTeacher, EmployeeDashboard, EditEmployee, DeleteEmployee, \ SearchEmployee, AddSubject module_employee = Blueprint('module_employee', __name_...
Make dashboard route become admin's default from openedoo_project import db from openedoo.core.libs import Blueprint from .controllers.employee import EmployeeLogin, EmployeeLogout, AddEmployee, \ AssignEmployeeAsTeacher, EmployeeDashboard, EditEmployee, DeleteEmployee, \ SearchEmployee, AddSubject module_em...
1b502cdf399b5b9cd4593aea82750b77114fe858
examples/flask_hello.py
examples/flask_hello.py
from pyinstrument import Profiler try: from flask import Flask, g, make_response, request except ImportError: print('This example requires Flask.') print('Install using `pip install flask`.') exit(1) app = Flask(__name__) @app.before_request def before_request(): if "profile" in request.args: ...
import time from pyinstrument import Profiler try: from flask import Flask, g, make_response, request except ImportError: print('This example requires Flask.') print('Install using `pip install flask`.') exit(1) app = Flask(__name__) @app.before_request def before_request(): if "profile" in reque...
Add some more endpoints to the flask example
Add some more endpoints to the flask example
Python
bsd-3-clause
joerick/pyinstrument,joerick/pyinstrument,joerick/pyinstrument,joerick/pyinstrument,joerick/pyinstrument,joerick/pyinstrument
import time from pyinstrument import Profiler try: from flask import Flask, g, make_response, request except ImportError: print('This example requires Flask.') print('Install using `pip install flask`.') exit(1) app = Flask(__name__) @app.before_request def before_request(): if "profile" in reque...
Add some more endpoints to the flask example from pyinstrument import Profiler try: from flask import Flask, g, make_response, request except ImportError: print('This example requires Flask.') print('Install using `pip install flask`.') exit(1) app = Flask(__name__) @app.before_request def before_re...
91db70d1fc266e3e3925e84fcaf83410e0504e37
Lib/tkinter/test/test_tkinter/test_font.py
Lib/tkinter/test/test_tkinter/test_font.py
import unittest import tkinter from tkinter import font from test.support import requires, run_unittest import tkinter.test.support as support requires('gui') class FontTest(unittest.TestCase): def setUp(self): support.root_deiconify() def tearDown(self): support.root_withdraw() def tes...
import unittest import tkinter from tkinter import font from test.support import requires, run_unittest import tkinter.test.support as support requires('gui') class FontTest(unittest.TestCase): def setUp(self): support.root_deiconify() def tearDown(self): support.root_withdraw() def tes...
Fix test_tk under OS X with Tk 8.4. Patch by Ned Deily. This should fix some buildbot failures.
Fix test_tk under OS X with Tk 8.4. Patch by Ned Deily. This should fix some buildbot failures.
Python
mit
sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator
import unittest import tkinter from tkinter import font from test.support import requires, run_unittest import tkinter.test.support as support requires('gui') class FontTest(unittest.TestCase): def setUp(self): support.root_deiconify() def tearDown(self): support.root_withdraw() def tes...
Fix test_tk under OS X with Tk 8.4. Patch by Ned Deily. This should fix some buildbot failures. import unittest import tkinter from tkinter import font from test.support import requires, run_unittest import tkinter.test.support as support requires('gui') class FontTest(unittest.TestCase): def setUp(self): ...
b80b781b8f446b8149b948a6ec4aeff63fd728ce
Orange/widgets/utils/plot/__init__.py
Orange/widgets/utils/plot/__init__.py
""" ************************* Plot classes and tools for use in Orange widgets ************************* The main class of this module is :obj:`.OWPlot`, from which all plots in visualization widgets should inherit. This module also contains plot elements, which are normally used by the :obj:`.OWPlot`, but can al...
""" ************************* Plot classes and tools for use in Orange widgets ************************* The main class of this module is :obj:`.OWPlot`, from which all plots in visualization widgets should inherit. This module also contains plot elements, which are normally used by the :obj:`.OWPlot`, but can al...
Handle PyQt 5.3 raising RuntimeError on incompatible orangeqt import
Handle PyQt 5.3 raising RuntimeError on incompatible orangeqt import
Python
bsd-2-clause
cheral/orange3,cheral/orange3,cheral/orange3,cheral/orange3,cheral/orange3,cheral/orange3
""" ************************* Plot classes and tools for use in Orange widgets ************************* The main class of this module is :obj:`.OWPlot`, from which all plots in visualization widgets should inherit. This module also contains plot elements, which are normally used by the :obj:`.OWPlot`, but can al...
Handle PyQt 5.3 raising RuntimeError on incompatible orangeqt import """ ************************* Plot classes and tools for use in Orange widgets ************************* The main class of this module is :obj:`.OWPlot`, from which all plots in visualization widgets should inherit. This module also contains plo...
f9a4ae44f33279632396716fbd808e80773f0a71
widelanguagedemo/assets.py
widelanguagedemo/assets.py
# -*- coding: utf-8 -*- from flask.ext.assets import Bundle, Environment css = Bundle( "libs/bootstrap/dist/css/bootstrap.css", "css/style.css", filters="cssmin", output="public/css/common.css" ) js = Bundle( "libs/jQuery/dist/jquery.js", "libs/bootstrap/dist/js/bootstrap.js", "libs/typeah...
# -*- coding: utf-8 -*- from flask.ext.assets import Bundle, Environment css = Bundle( "libs/bootstrap/dist/css/bootstrap.css", "css/style.css", filters="cssmin", output="public/css/common.css" ) js = Bundle( "libs/jQuery/dist/jquery.js", "libs/bootstrap/dist/js/bootstrap.js", "libs/typeah...
Work around a js minification bug.
Work around a js minification bug.
Python
bsd-3-clause
larsyencken/wide-language-demo,larsyencken/wide-language-demo,larsyencken/wide-language-demo,larsyencken/wide-language-demo,larsyencken/wide-language-demo
# -*- coding: utf-8 -*- from flask.ext.assets import Bundle, Environment css = Bundle( "libs/bootstrap/dist/css/bootstrap.css", "css/style.css", filters="cssmin", output="public/css/common.css" ) js = Bundle( "libs/jQuery/dist/jquery.js", "libs/bootstrap/dist/js/bootstrap.js", "libs/typeah...
Work around a js minification bug. # -*- coding: utf-8 -*- from flask.ext.assets import Bundle, Environment css = Bundle( "libs/bootstrap/dist/css/bootstrap.css", "css/style.css", filters="cssmin", output="public/css/common.css" ) js = Bundle( "libs/jQuery/dist/jquery.js", "libs/bootstrap/dis...
8db65c9f6ec67e188dd6cd11f7a7933d371e323d
feed/tests/test_contactview.py
feed/tests/test_contactview.py
from django.contrib.auth.models import User from django.test import TestCase from rest_framework.test import APIRequestFactory from feed.views import ContactViewSet from workflow.models import Contact, Country, Organization, TolaUser, \ WorkflowLevel1, WorkflowTeam class ContactViewsTest(TestCase): def setUp...
Add unit test for Contact view
Add unit test for Contact view
Python
apache-2.0
toladata/TolaActivity,toladata/TolaActivity,toladata/TolaActivity,toladata/TolaActivity
from django.contrib.auth.models import User from django.test import TestCase from rest_framework.test import APIRequestFactory from feed.views import ContactViewSet from workflow.models import Contact, Country, Organization, TolaUser, \ WorkflowLevel1, WorkflowTeam class ContactViewsTest(TestCase): def setUp...
Add unit test for Contact view
eafd68dd70d24f6e5551e2f59d7c13e4be6dce6e
testparser.py
testparser.py
#!/usr/bin/env python import sys import os import subprocess # ARGUMENTS: # 1 - path to the parser executable # 2 - path to the parser-lalr executable # 3 - path to the source directory to look for *.rs files parser = sys.argv[1] parser_lalr = sys.argv[2] # flex dies on multibyte characters BLACKLIST = ['libstd/st...
Add a new test script to evaluate status of different parsers.
Add a new test script to evaluate status of different parsers.
Python
mit
patperry/rust-grammar,bleibig/rust-grammar,patperry/rust-grammar,patperry/rust-grammar,bleibig/rust-grammar,bleibig/rust-grammar,patperry/rust-grammar,bleibig/rust-grammar
#!/usr/bin/env python import sys import os import subprocess # ARGUMENTS: # 1 - path to the parser executable # 2 - path to the parser-lalr executable # 3 - path to the source directory to look for *.rs files parser = sys.argv[1] parser_lalr = sys.argv[2] # flex dies on multibyte characters BLACKLIST = ['libstd/st...
Add a new test script to evaluate status of different parsers.
d7f184dd7c41bb3cacba5f77c81ae961b3a12760
subsample_bam_file.py
subsample_bam_file.py
#!/usr/bin/env python """ This script subsamples the alignments of a BAM file. For this a likelihood (0.0 < p(keep) < 1.0) of keeping all alignments of a read has to be provided. All alignments of a read are treated the same (i.e. are discarded or kept). """ import argparse import random import sys import pysam __d...
Add script to subsample bam file entries
Add script to subsample bam file entries
Python
isc
konrad/kuf_bio_scripts
#!/usr/bin/env python """ This script subsamples the alignments of a BAM file. For this a likelihood (0.0 < p(keep) < 1.0) of keeping all alignments of a read has to be provided. All alignments of a read are treated the same (i.e. are discarded or kept). """ import argparse import random import sys import pysam __d...
Add script to subsample bam file entries
a941218e8bacd528cff058d3afaac06e14ac7766
OpenPNM/PHYS/__GenericPhysics__.py
OpenPNM/PHYS/__GenericPhysics__.py
#! /usr/bin/env python # -*- coding: utf-8 -*- # Author: CEF PNM Team # License: TBD # Copyright (c) 2012 #from __future__ import print_function """ module __GenericPhysics__: Base class to define pore scale physics ================================================================== .. warning:: The classes of this m...
#! /usr/bin/env python # -*- coding: utf-8 -*- # Author: CEF PNM Team # License: TBD # Copyright (c) 2012 #from __future__ import print_function """ module __GenericPhysics__: Base class to define pore scale physics ================================================================== .. warning:: The classes of this m...
Revert "Updated docstring for the file (mostly to diagnose/solve a git branch/merge problem)"
Revert "Updated docstring for the file (mostly to diagnose/solve a git branch/merge problem)" This reverts commit 3bcc40305193f3a46de63f4345812c9c2ee4c27f [formerly e2fe152ba58cfa853637bc5bd805adf0ae9617eb] [formerly 8e549c3bfb3650f08aca2ba204d2904e53aa4ab4]. Former-commit-id: e783ac4d5946403a9d608fe9dffa42212796b40...
Python
mit
TomTranter/OpenPNM,amdouglas/OpenPNM,stadelmanma/OpenPNM,PMEAL/OpenPNM,amdouglas/OpenPNM
#! /usr/bin/env python # -*- coding: utf-8 -*- # Author: CEF PNM Team # License: TBD # Copyright (c) 2012 #from __future__ import print_function """ module __GenericPhysics__: Base class to define pore scale physics ================================================================== .. warning:: The classes of this m...
Revert "Updated docstring for the file (mostly to diagnose/solve a git branch/merge problem)" This reverts commit 3bcc40305193f3a46de63f4345812c9c2ee4c27f [formerly e2fe152ba58cfa853637bc5bd805adf0ae9617eb] [formerly 8e549c3bfb3650f08aca2ba204d2904e53aa4ab4]. Former-commit-id: e783ac4d5946403a9d608fe9dffa42212796b40...
1c60cf7082672335279d5b96e83f3cb2eb57424f
purchase_supplier_minimum_order/models/__init__.py
purchase_supplier_minimum_order/models/__init__.py
# -*- coding: utf-8 -*- ############################################################################## # # Set minimum order on suppliers # Copyright (C) 2016 OpusVL (<http://opusvl.com/>) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public Lic...
# -*- coding: utf-8 -*- ############################################################################## # # Set minimum order on suppliers # Copyright (C) 2016 OpusVL (<http://opusvl.com/>) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public Lic...
Enforce minimum PO value for supplier.
Enforce minimum PO value for supplier.
Python
agpl-3.0
OpusVL/odoo-purchase-min-order
# -*- coding: utf-8 -*- ############################################################################## # # Set minimum order on suppliers # Copyright (C) 2016 OpusVL (<http://opusvl.com/>) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public Lic...
Enforce minimum PO value for supplier. # -*- coding: utf-8 -*- ############################################################################## # # Set minimum order on suppliers # Copyright (C) 2016 OpusVL (<http://opusvl.com/>) # # This program is free software: you can redistribute it and/or modify # it under the te...
e4d4e1b79bea641c66dfafe486d94a87c63e6edb
setup.py
setup.py
#!/usr/bin/env python from codecs import open from setuptools import find_packages, setup with open('README.rst', 'r', 'utf-8') as f: readme = f.read() setup( name='django-latest-tweets', version='0.4.5', description='Latest Tweets for Django', long_description=readme, url='https://github.c...
#!/usr/bin/env python from codecs import open from setuptools import find_packages, setup with open('README.rst', 'r', 'utf-8') as f: readme = f.read() setup( name='django-latest-tweets', version='0.4.5', description='Latest Tweets for Django', long_description=readme, url='https://github.c...
Update GitHub repos from blancltd to developersociety
Update GitHub repos from blancltd to developersociety
Python
bsd-3-clause
blancltd/django-latest-tweets
#!/usr/bin/env python from codecs import open from setuptools import find_packages, setup with open('README.rst', 'r', 'utf-8') as f: readme = f.read() setup( name='django-latest-tweets', version='0.4.5', description='Latest Tweets for Django', long_description=readme, url='https://github.c...
Update GitHub repos from blancltd to developersociety #!/usr/bin/env python from codecs import open from setuptools import find_packages, setup with open('README.rst', 'r', 'utf-8') as f: readme = f.read() setup( name='django-latest-tweets', version='0.4.5', description='Latest Tweets for Django',...
b37814280dc06dbf8aefec4490f6b73a47f05c1a
custom_fixers/fix_alt_unicode.py
custom_fixers/fix_alt_unicode.py
# Taken from jinja2. Thanks, Armin Ronacher. # See also http://lucumr.pocoo.org/2010/2/11/porting-to-python-3-a-guide from lib2to3 import fixer_base from lib2to3.fixer_util import Name, BlankLine class FixAltUnicode(fixer_base.BaseFix): PATTERN = """ func=funcdef< 'def' name='__unicode__' ...
# Taken from jinja2. Thanks, Armin Ronacher. # See also http://lucumr.pocoo.org/2010/2/11/porting-to-python-3-a-guide from lib2to3 import fixer_base class FixAltUnicode(fixer_base.BaseFix): PATTERN = "'__unicode__'" def transform(self, node, results): new = node.clone() new.value = '__str__...
Simplify python3 unicode fixer and make it replace all occurrences of __unicode__ with __str__.
Simplify python3 unicode fixer and make it replace all occurrences of __unicode__ with __str__.
Python
mit
live-clones/pybtex
# Taken from jinja2. Thanks, Armin Ronacher. # See also http://lucumr.pocoo.org/2010/2/11/porting-to-python-3-a-guide from lib2to3 import fixer_base class FixAltUnicode(fixer_base.BaseFix): PATTERN = "'__unicode__'" def transform(self, node, results): new = node.clone() new.value = '__str__...
Simplify python3 unicode fixer and make it replace all occurrences of __unicode__ with __str__. # Taken from jinja2. Thanks, Armin Ronacher. # See also http://lucumr.pocoo.org/2010/2/11/porting-to-python-3-a-guide from lib2to3 import fixer_base from lib2to3.fixer_util import Name, BlankLine class FixAltUnicode(fix...
ba4f692e00d87afdd65d3a1b88046089b709eaab
organizer/views.py
organizer/views.py
from django.http.response import HttpResponse from django.template import Context, loader from .models import Tag def homepage(request): tag_list = Tag.objects.all() template = loader.get_template( 'organizer/tag_list.html') context = Context({'tag_list': tag_list}) output = template.render(c...
from django.http.response import HttpResponse from django.template import Context, loader from .models import Tag def homepage(request): tag_list = Tag.objects.all() template = loader.get_template( 'organizer/tag_list.html') context = Context({'tag_list': tag_list}) output = template.render(c...
Tag Detail: get Tag from database.
Ch05: Tag Detail: get Tag from database.
Python
bsd-2-clause
jambonrose/DjangoUnleashed-1.8,jambonrose/DjangoUnleashed-1.8
from django.http.response import HttpResponse from django.template import Context, loader from .models import Tag def homepage(request): tag_list = Tag.objects.all() template = loader.get_template( 'organizer/tag_list.html') context = Context({'tag_list': tag_list}) output = template.render(c...
Ch05: Tag Detail: get Tag from database. from django.http.response import HttpResponse from django.template import Context, loader from .models import Tag def homepage(request): tag_list = Tag.objects.all() template = loader.get_template( 'organizer/tag_list.html') context = Context({'tag_list':...
a3ffef803d3bde1bb771217f3ed5dd4509a2c82c
tests/test_03_login.py
tests/test_03_login.py
"""Test login to an ICAT server. """ from __future__ import print_function import pytest import icat import icat.config # Try out three different users: root, useroffice, and acord. Normal # users like acord might use a different authentication plugin then # system users as root and useroffice. We want to try out b...
Add test to login to the ICAT server.
Add test to login to the ICAT server.
Python
apache-2.0
icatproject/python-icat
"""Test login to an ICAT server. """ from __future__ import print_function import pytest import icat import icat.config # Try out three different users: root, useroffice, and acord. Normal # users like acord might use a different authentication plugin then # system users as root and useroffice. We want to try out b...
Add test to login to the ICAT server.
5b735dff075cb4fb2e9fd89dc4d872281210964d
config/regenerate_launch_files.py
config/regenerate_launch_files.py
#!/usr/bin/env python3 # (C) 2015 Jean Nassar # Released under BSD import glob import os import subprocess as sp import rospkg import tqdm def get_launch_dir(package: str) -> str: return os.path.join(rospkg.RosPack().get_path(package), "launch") def get_file_root(path: str) -> str: """ >>> get_file_ro...
#!/usr/bin/env python2 # (C) 2015 Jean Nassar # Released under BSD import glob import os import subprocess as sp import rospkg import tqdm def get_launch_dir(package): return os.path.join(rospkg.RosPack().get_path(package), "launch") def get_file_root(path): """ >>> get_file_root("/tmp/test.txt") ...
Make compatible with Python 2 and 3.
Make compatible with Python 2 and 3.
Python
mit
masasin/spirit,masasin/spirit
#!/usr/bin/env python2 # (C) 2015 Jean Nassar # Released under BSD import glob import os import subprocess as sp import rospkg import tqdm def get_launch_dir(package): return os.path.join(rospkg.RosPack().get_path(package), "launch") def get_file_root(path): """ >>> get_file_root("/tmp/test.txt") ...
Make compatible with Python 2 and 3. #!/usr/bin/env python3 # (C) 2015 Jean Nassar # Released under BSD import glob import os import subprocess as sp import rospkg import tqdm def get_launch_dir(package: str) -> str: return os.path.join(rospkg.RosPack().get_path(package), "launch") def get_file_root(path: st...
5a885124432ccb33d180a8e73c753ceab54ffdf5
src/Itemizers.py
src/Itemizers.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from Foundation import objc from Foundation import NSBundle from AppKit import NSImage def iconForName(klass, name): """Return the NSImage instance representing a `name` item.""" imgpath = NSBundle.bundleForClass_(klass).pathForResource_ofType_(name, 'png') img = NSIma...
#!/usr/bin/env python # -*- coding: utf-8 -*- from Foundation import objc from Foundation import NSBundle from AppKit import NSImage haskellBundleIdentifier = 'org.purl.net.mkhl.haskell' def iconForName(name): """Return the NSImage instance representing a `name` item.""" bundle = NSBundle.bundleWithIdentifier_(has...
Simplify the icon finder function.
Simplify the icon finder function. We statically know our bundle identifier, so we don’t have too find the bundle by runtime class.
Python
mit
mkhl/haskell.sugar
#!/usr/bin/env python # -*- coding: utf-8 -*- from Foundation import objc from Foundation import NSBundle from AppKit import NSImage haskellBundleIdentifier = 'org.purl.net.mkhl.haskell' def iconForName(name): """Return the NSImage instance representing a `name` item.""" bundle = NSBundle.bundleWithIdentifier_(has...
Simplify the icon finder function. We statically know our bundle identifier, so we don’t have too find the bundle by runtime class. #!/usr/bin/env python # -*- coding: utf-8 -*- from Foundation import objc from Foundation import NSBundle from AppKit import NSImage def iconForName(klass, name): """Return the NSImag...
6e4daa3745cf51443550d559493a0cf8c2dbd8f1
grid_map_demos/scripts/image_publisher.py
grid_map_demos/scripts/image_publisher.py
#!/usr/bin/env python # simple script to publish a image from a file. import rospy import cv2 import sensor_msgs.msg #change these to fit the expected topic names IMAGE_MESSAGE_TOPIC = 'grid_map_image' IMAGE_PATH = 'test2.png' def callback(self): """ Convert a image to a ROS compatible message (sensor_msg...
#!/usr/bin/env python # simple script to publish a image from a file. import rospy import cv2 import sensor_msgs.msg #change these to fit the expected topic names IMAGE_MESSAGE_TOPIC = 'grid_map_image' IMAGE_PATH = 'test2.png' def callback(self): """ Convert a image to a ROS compatible message (sensor_msg...
Read gray scale image with alpha channel
Read gray scale image with alpha channel
Python
bsd-3-clause
uzh-rpg/grid_map,chen0510566/grid_map,ANYbotics/grid_map,ysonggit/grid_map,ANYbotics/grid_map,ysonggit/grid_map,ethz-asl/grid_map,ethz-asl/grid_map,uzh-rpg/grid_map,chen0510566/grid_map
#!/usr/bin/env python # simple script to publish a image from a file. import rospy import cv2 import sensor_msgs.msg #change these to fit the expected topic names IMAGE_MESSAGE_TOPIC = 'grid_map_image' IMAGE_PATH = 'test2.png' def callback(self): """ Convert a image to a ROS compatible message (sensor_msg...
Read gray scale image with alpha channel #!/usr/bin/env python # simple script to publish a image from a file. import rospy import cv2 import sensor_msgs.msg #change these to fit the expected topic names IMAGE_MESSAGE_TOPIC = 'grid_map_image' IMAGE_PATH = 'test2.png' def callback(self): """ Convert a image to a ...
7fab2f02ddea20a790c4e6065b38229776c6b763
spam/tests/test_preprocess.py
spam/tests/test_preprocess.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest from spam.preprocess import PreProcess from spam.common import params class TestPreProcess(unittest.TestCase): """ Class for testing the preprocces. """ def setUp(self): self.preprocess = PreProcess( params.DATASET_PAT...
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest from spam.preprocess import PreProcess from spam.common import params class TestPreProcess(unittest.TestCase): """ Class for testing the preprocces. """ def setUp(self): self.preprocess = PreProcess( params.DATASET_PAT...
Add empty tests with descriptions.
Add empty tests with descriptions.
Python
mit
benigls/spam,benigls/spam
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest from spam.preprocess import PreProcess from spam.common import params class TestPreProcess(unittest.TestCase): """ Class for testing the preprocces. """ def setUp(self): self.preprocess = PreProcess( params.DATASET_PAT...
Add empty tests with descriptions. #!/usr/bin/env python # -*- coding: utf-8 -*- import unittest from spam.preprocess import PreProcess from spam.common import params class TestPreProcess(unittest.TestCase): """ Class for testing the preprocces. """ def setUp(self): self.preprocess = PrePro...
af88bfaece839d044ccb0781a15c8c538979051e
tests/test_object.py
tests/test_object.py
#!/usr/bin/env python import unittest import mlbgame class TestObject(unittest.TestCase): def test_object(self): data = { 'string': 'string', 'int': '10', 'float': '10.1' } obj = mlbgame.object.Object(data) self.assertIsInstance(obj.string...
#!/usr/bin/env python import unittest import mlbgame class TestObject(unittest.TestCase): def test_object(self): data = { 'string': 'string', 'int': '10', 'float': '10.1', 'unicode': u'\xe7\x8c\xab' } obj = mlbgame.object.Object(data) ...
Add test for unicode characters
Add test for unicode characters
Python
mit
panzarino/mlbgame,zachpanz88/mlbgame
#!/usr/bin/env python import unittest import mlbgame class TestObject(unittest.TestCase): def test_object(self): data = { 'string': 'string', 'int': '10', 'float': '10.1', 'unicode': u'\xe7\x8c\xab' } obj = mlbgame.object.Object(data) ...
Add test for unicode characters #!/usr/bin/env python import unittest import mlbgame class TestObject(unittest.TestCase): def test_object(self): data = { 'string': 'string', 'int': '10', 'float': '10.1' } obj = mlbgame.object.Object(data) ...
df8efcc0f86fa9a311ec444da7e6488de2e86d8a
tests/test_repr.py
tests/test_repr.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # (c) 2015-2018, ETH Zurich, Institut fuer Theoretische Physik # Author: Dominik Gresch <greschd@gmx.ch> import pytest import numpy as np from parameters import T_VALUES, KPT @pytest.mark.parametrize('t', T_VALUES) def test_repr_reload(t, get_model): m1 = get_mode...
#!/usr/bin/env python # -*- coding: utf-8 -*- # (c) 2015-2018, ETH Zurich, Institut fuer Theoretische Physik # Author: Dominik Gresch <greschd@gmx.ch> import pytest import tbmodels # pylint: disable=unused-import import numpy as np from tbmodels._ptools.sparse_matrix import csr # pylint: disable=unused-import fr...
Add back imports to repr test.
Add back imports to repr test.
Python
apache-2.0
Z2PackDev/TBmodels,Z2PackDev/TBmodels
#!/usr/bin/env python # -*- coding: utf-8 -*- # (c) 2015-2018, ETH Zurich, Institut fuer Theoretische Physik # Author: Dominik Gresch <greschd@gmx.ch> import pytest import tbmodels # pylint: disable=unused-import import numpy as np from tbmodels._ptools.sparse_matrix import csr # pylint: disable=unused-import fr...
Add back imports to repr test. #!/usr/bin/env python # -*- coding: utf-8 -*- # (c) 2015-2018, ETH Zurich, Institut fuer Theoretische Physik # Author: Dominik Gresch <greschd@gmx.ch> import pytest import numpy as np from parameters import T_VALUES, KPT @pytest.mark.parametrize('t', T_VALUES) def test_repr_reload(...
828521e71b2afd93f53b13222fbdfaf9e855d442
scripts/comment_scraper.py
scripts/comment_scraper.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import praw # Connect to Reddit # ---------------------------- user_agent = "Quick comment thread scraper by /u/mediaarts" r = praw.Reddit(user_agent = user_agent) # Get comment thread and populate dict # ---------------------------- submission_id = "1p1j6c" submissio...
Add scratch Reddit comment scraper
Add scratch Reddit comment scraper
Python
mit
PsyBorgs/redditanalyser,PsyBorgs/redditanalyser
#!/usr/bin/env python # -*- coding: utf-8 -*- import praw # Connect to Reddit # ---------------------------- user_agent = "Quick comment thread scraper by /u/mediaarts" r = praw.Reddit(user_agent = user_agent) # Get comment thread and populate dict # ---------------------------- submission_id = "1p1j6c" submissio...
Add scratch Reddit comment scraper
d9b582694560684f89d89b3fd0c3269665a843d2
setup.py
setup.py
#!/usr/bin/env python3 from setuptools import setup, find_packages setup( name='django-afip', version='0.8.0', description='AFIP integration for django', author='Hugo Osvaldo Barrera', author_email='hbarrera@z47.io', url='https://gitlab.com/hobarrera/django-afip', license='ISC', packag...
#!/usr/bin/env python3 from setuptools import setup, find_packages setup( name='django-afip', version='0.8.0', description='AFIP integration for django', author='Hugo Osvaldo Barrera', author_email='hbarrera@z47.io', url='https://gitlab.com/hobarrera/django-afip', license='ISC', packag...
Include package data in builds
Include package data in builds
Python
isc
hobarrera/django-afip,hobarrera/django-afip
#!/usr/bin/env python3 from setuptools import setup, find_packages setup( name='django-afip', version='0.8.0', description='AFIP integration for django', author='Hugo Osvaldo Barrera', author_email='hbarrera@z47.io', url='https://gitlab.com/hobarrera/django-afip', license='ISC', packag...
Include package data in builds #!/usr/bin/env python3 from setuptools import setup, find_packages setup( name='django-afip', version='0.8.0', description='AFIP integration for django', author='Hugo Osvaldo Barrera', author_email='hbarrera@z47.io', url='https://gitlab.com/hobarrera/django-afip...
905690beacad9731bb113bdbeedf0ed2c7df3160
profile_audfprint_match.py
profile_audfprint_match.py
import audfprint import cProfile import pstats argv = ["audfprint", "match", "-d", "tmp.fpdb", "--density", "200", "query.mp3", "query2.mp3"] cProfile.run('audfprint.main(argv)', 'fpmstats') p = pstats.Stats('fpmstats') p.sort_stats('time') p.print_stats(10)
import audfprint import cProfile import pstats argv = ["audfprint", "match", "-d", "fpdbase.pklz", "--density", "200", "query.mp3"] cProfile.run('audfprint.main(argv)', 'fpmstats') p = pstats.Stats('fpmstats') p.sort_stats('time') p.print_stats(10)
Update profile for local data.
Update profile for local data.
Python
mit
dpwe/audfprint
import audfprint import cProfile import pstats argv = ["audfprint", "match", "-d", "fpdbase.pklz", "--density", "200", "query.mp3"] cProfile.run('audfprint.main(argv)', 'fpmstats') p = pstats.Stats('fpmstats') p.sort_stats('time') p.print_stats(10)
Update profile for local data. import audfprint import cProfile import pstats argv = ["audfprint", "match", "-d", "tmp.fpdb", "--density", "200", "query.mp3", "query2.mp3"] cProfile.run('audfprint.main(argv)', 'fpmstats') p = pstats.Stats('fpmstats') p.sort_stats('time') p.print_stats(10)
137f5542aff91d259e68684c79d41cc47648cee2
mrburns/settings/server.py
mrburns/settings/server.py
import os import socket from .base import * # noqa SERVER_ENV = os.getenv('DJANGO_SERVER_ENV') SECRET_KEY = os.getenv('SECRET_KEY') DEBUG = TEMPLATE_DEBUG = False ALLOWED_HOSTS = [ 'webwewant.mozilla.org', 'webwewant.allizom.org', # the server's IP (for monitors) socket.gethostbyname(socket.gethostn...
import os import socket from .base import * # noqa SERVER_ENV = os.getenv('DJANGO_SERVER_ENV') SECRET_KEY = os.getenv('SECRET_KEY') STATIC_URL = os.getenv('STATIC_URL', STATIC_URL) DEBUG = TEMPLATE_DEBUG = False ALLOWED_HOSTS = [ 'webwewant.mozilla.org', 'webwewant.allizom.org', # the server's IP (for m...
Set STATIC_URL from an env var if available.
Set STATIC_URL from an env var if available.
Python
mpl-2.0
almossawi/mrburns,mozilla/mrburns,almossawi/mrburns,mozilla/mrburns,almossawi/mrburns,almossawi/mrburns,mozilla/mrburns
import os import socket from .base import * # noqa SERVER_ENV = os.getenv('DJANGO_SERVER_ENV') SECRET_KEY = os.getenv('SECRET_KEY') STATIC_URL = os.getenv('STATIC_URL', STATIC_URL) DEBUG = TEMPLATE_DEBUG = False ALLOWED_HOSTS = [ 'webwewant.mozilla.org', 'webwewant.allizom.org', # the server's IP (for m...
Set STATIC_URL from an env var if available. import os import socket from .base import * # noqa SERVER_ENV = os.getenv('DJANGO_SERVER_ENV') SECRET_KEY = os.getenv('SECRET_KEY') DEBUG = TEMPLATE_DEBUG = False ALLOWED_HOSTS = [ 'webwewant.mozilla.org', 'webwewant.allizom.org', # the server's IP (for moni...
00b822d2523708f333e214fc7f507ef3bf1ca865
setup.py
setup.py
import os try: from setuptools import setup except ImportError: from distutils.core import setup from pypvwatts.__version__ import VERSION setup( name='pypvwatts', version=VERSION, author='Miguel Paolino', author_email='mpaolino@gmail.com', url='https://github.com/mpaolino/pypvwatts', ...
import os try: from setuptools import setup except ImportError: from distutils.core import setup from pypvwatts.__version__ import VERSION setup( name='pypvwatts', version=VERSION, author='Miguel Paolino', author_email='mpaolino@gmail.com', url='https://github.com/mpaolino/pypvwatts', ...
Make sure we require at least python 2.7
Make sure we require at least python 2.7
Python
mit
mpaolino/pypvwatts
import os try: from setuptools import setup except ImportError: from distutils.core import setup from pypvwatts.__version__ import VERSION setup( name='pypvwatts', version=VERSION, author='Miguel Paolino', author_email='mpaolino@gmail.com', url='https://github.com/mpaolino/pypvwatts', ...
Make sure we require at least python 2.7 import os try: from setuptools import setup except ImportError: from distutils.core import setup from pypvwatts.__version__ import VERSION setup( name='pypvwatts', version=VERSION, author='Miguel Paolino', author_email='mpaolino@gmail.com', url='h...
7806937a4a3b9853becdf963dbcbfe79a256097d
rapidsms/router/celery/tasks.py
rapidsms/router/celery/tasks.py
import celery from celery.utils.log import get_task_logger from rapidsms.errors import MessageSendingError logger = get_task_logger(__name__) @celery.task def receive_async(text, connection_id, message_id, fields): """Task used to send inbound message through router phases.""" from rapidsms.models import Co...
import celery import logging from rapidsms.errors import MessageSendingError logger = logging.getLogger(__name__) @celery.task def receive_async(text, connection_id, message_id, fields): """Task used to send inbound message through router phases.""" from rapidsms.models import Connection from rapidsms.r...
Refactor logging in celery router
Refactor logging in celery router Send logging for celery router tasks to the 'rapidsms' logger rather than the 'celery' logger, and make sure celery knows the task failed by re-raising the exception.
Python
bsd-3-clause
eHealthAfrica/rapidsms,eHealthAfrica/rapidsms,lsgunth/rapidsms,peterayeni/rapidsms,peterayeni/rapidsms,caktus/rapidsms,peterayeni/rapidsms,ehealthafrica-ci/rapidsms,caktus/rapidsms,catalpainternational/rapidsms,lsgunth/rapidsms,lsgunth/rapidsms,peterayeni/rapidsms,ehealthafrica-ci/rapidsms,catalpainternational/rapidsms...
import celery import logging from rapidsms.errors import MessageSendingError logger = logging.getLogger(__name__) @celery.task def receive_async(text, connection_id, message_id, fields): """Task used to send inbound message through router phases.""" from rapidsms.models import Connection from rapidsms.r...
Refactor logging in celery router Send logging for celery router tasks to the 'rapidsms' logger rather than the 'celery' logger, and make sure celery knows the task failed by re-raising the exception. import celery from celery.utils.log import get_task_logger from rapidsms.errors import MessageSendingError logger = ...
a9581a26704f663f5d496ad07c4a6f4fd0ee641f
lampost/util/encrypt.py
lampost/util/encrypt.py
import hashlib from os import urandom from base64 import b64encode, b64decode from itertools import izip from lampost.util.pdkdf2 import pbkdf2_bin SALT_LENGTH = 8 KEY_LENGTH = 20 COST_FACTOR = 800 def make_hash(password): if isinstance(password, unicode): password = password.encode('utf-8') salt = ...
import hashlib from os import urandom from base64 import b64encode, b64decode from itertools import izip from lampost.util.pdkdf2 import pbkdf2_bin SALT_LENGTH = 8 KEY_LENGTH = 20 COST_FACTOR = 800 def make_hash(password): if isinstance(password, unicode): password = password.encode('utf-8') salt = ...
Remove password back door since database updates complete.
Remove password back door since database updates complete.
Python
mit
genzgd/Lampost-Mud,genzgd/Lampost-Mud,genzgd/Lampost-Mud
import hashlib from os import urandom from base64 import b64encode, b64decode from itertools import izip from lampost.util.pdkdf2 import pbkdf2_bin SALT_LENGTH = 8 KEY_LENGTH = 20 COST_FACTOR = 800 def make_hash(password): if isinstance(password, unicode): password = password.encode('utf-8') salt = ...
Remove password back door since database updates complete. import hashlib from os import urandom from base64 import b64encode, b64decode from itertools import izip from lampost.util.pdkdf2 import pbkdf2_bin SALT_LENGTH = 8 KEY_LENGTH = 20 COST_FACTOR = 800 def make_hash(password): if isinstance(password, unico...
c23cd25247974abc85c66451737f4de8d8b19d1b
lib/rapidsms/backends/backend.py
lib/rapidsms/backends/backend.py
#!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 class Backend(object): def log(self, level, message): self.router.log(level, message) def start(self): raise NotImplementedError def stop(self): raise NotImplementedError def send(self): raise NotImpleme...
#!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 class Backend(object): def __init__ (self, router): self.router = router def log(self, level, message): self.router.log(level, message) def start(self): raise NotImplementedError def stop(self): raise NotImple...
Add a constructor method for Backend
Add a constructor method for Backend
Python
bsd-3-clause
dimagi/rapidsms,ehealthafrica-ci/rapidsms,eHealthAfrica/rapidsms,ken-muturi/rapidsms,lsgunth/rapidsms,catalpainternational/rapidsms,unicefuganda/edtrac,catalpainternational/rapidsms,eHealthAfrica/rapidsms,ken-muturi/rapidsms,ken-muturi/rapidsms,lsgunth/rapidsms,unicefuganda/edtrac,lsgunth/rapidsms,ehealthafrica-ci/rapi...
#!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 class Backend(object): def __init__ (self, router): self.router = router def log(self, level, message): self.router.log(level, message) def start(self): raise NotImplementedError def stop(self): raise NotImple...
Add a constructor method for Backend #!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 class Backend(object): def log(self, level, message): self.router.log(level, message) def start(self): raise NotImplementedError def stop(self): raise NotImplementedError de...
46600be25ea95a0c823730694a7f79be453477b1
list_projects.py
list_projects.py
from yastlib import * yast_id = 'id' yast_password = 'password' yast = Yast() yast_hash = yast.login(yast_id, yast_password) if yast_hash != False: print 'Connected to yast.com' projects = yast.getProjects() nodes = projects.items() for k, n in nodes: print 'project ' + str(k) + ': ' + 'name: "' + n.name + '" pa...
Add script to list projects
Add script to list projects
Python
mit
jfitz/hours-reporter
from yastlib import * yast_id = 'id' yast_password = 'password' yast = Yast() yast_hash = yast.login(yast_id, yast_password) if yast_hash != False: print 'Connected to yast.com' projects = yast.getProjects() nodes = projects.items() for k, n in nodes: print 'project ' + str(k) + ': ' + 'name: "' + n.name + '" pa...
Add script to list projects
721f9d02645ba91c542e9eba243ddb617db0975e
Steamworks.NET_CodeGen.py
Steamworks.NET_CodeGen.py
import sys from SteamworksParser import steamworksparser import interfaces import constants import enums import structs def main(): if len(sys.argv) != 2: print("TODO: Usage Instructions") return steamworksparser.Settings.fake_gameserver_interfaces = True ___parser = steamworksparser.parse...
import sys from SteamworksParser import steamworksparser import interfaces import constants import enums import structs import typedefs def main(): if len(sys.argv) != 2: print("TODO: Usage Instructions") return steamworksparser.Settings.fake_gameserver_interfaces = True ___parser = steamw...
Add typedef generation to the main script
Add typedef generation to the main script
Python
mit
rlabrecque/Steamworks.NET-CodeGen,rlabrecque/Steamworks.NET-CodeGen,rlabrecque/Steamworks.NET-CodeGen,rlabrecque/Steamworks.NET-CodeGen
import sys from SteamworksParser import steamworksparser import interfaces import constants import enums import structs import typedefs def main(): if len(sys.argv) != 2: print("TODO: Usage Instructions") return steamworksparser.Settings.fake_gameserver_interfaces = True ___parser = steamw...
Add typedef generation to the main script import sys from SteamworksParser import steamworksparser import interfaces import constants import enums import structs def main(): if len(sys.argv) != 2: print("TODO: Usage Instructions") return steamworksparser.Settings.fake_gameserver_interfaces = ...
c5996b4a933f2d27251e8d85f3392b715e130759
mapentity/templatetags/convert_tags.py
mapentity/templatetags/convert_tags.py
import urllib from django import template from django.conf import settings register = template.Library() @register.simple_tag def convert_url(request, sourceurl, format='pdf'): fullurl = request.build_absolute_uri(sourceurl) conversion_url = "%s?url=%s&to=%s" % (settings.CONVERSION_SERVER, ...
import urllib from mimetypes import types_map from django import template from django.conf import settings register = template.Library() @register.simple_tag def convert_url(request, sourceurl, format='pdf'): if '/' not in format: extension = '.' + format if not format.startswith('.') else format ...
Support conversion format as extension, instead of mimetype
Support conversion format as extension, instead of mimetype
Python
bsd-3-clause
Anaethelion/django-mapentity,makinacorpus/django-mapentity,makinacorpus/django-mapentity,makinacorpus/django-mapentity,Anaethelion/django-mapentity,Anaethelion/django-mapentity
import urllib from mimetypes import types_map from django import template from django.conf import settings register = template.Library() @register.simple_tag def convert_url(request, sourceurl, format='pdf'): if '/' not in format: extension = '.' + format if not format.startswith('.') else format ...
Support conversion format as extension, instead of mimetype import urllib from django import template from django.conf import settings register = template.Library() @register.simple_tag def convert_url(request, sourceurl, format='pdf'): fullurl = request.build_absolute_uri(sourceurl) conversion_url = "%s?ur...
e1a27161621038cc3bdfd4030aef130ee09e92ec
troposphere/dax.py
troposphere/dax.py
# Copyright (c) 2012-2017, Mark Peek <mark@peek.org> # All rights reserved. # # See LICENSE file for full license. from . import AWSObject, AWSProperty from .validators import boolean class SSESpecification(AWSProperty): props = { "SSEEnabled": (boolean, False), } class Cluster(AWSObject): reso...
# Copyright (c) 2012-2017, Mark Peek <mark@peek.org> # All rights reserved. # # See LICENSE file for full license. from . import AWSObject, AWSProperty from .validators import boolean class SSESpecification(AWSProperty): props = { "SSEEnabled": (boolean, False), } class Cluster(AWSObject): reso...
Update DAX per 2021-06-24 changes
Update DAX per 2021-06-24 changes
Python
bsd-2-clause
cloudtools/troposphere,cloudtools/troposphere
# Copyright (c) 2012-2017, Mark Peek <mark@peek.org> # All rights reserved. # # See LICENSE file for full license. from . import AWSObject, AWSProperty from .validators import boolean class SSESpecification(AWSProperty): props = { "SSEEnabled": (boolean, False), } class Cluster(AWSObject): reso...
Update DAX per 2021-06-24 changes # Copyright (c) 2012-2017, Mark Peek <mark@peek.org> # All rights reserved. # # See LICENSE file for full license. from . import AWSObject, AWSProperty from .validators import boolean class SSESpecification(AWSProperty): props = { "SSEEnabled": (boolean, False), } ...
dcce2d6db32c94e382615dc8eb01d8bef0894c00
tests/test_config.py
tests/test_config.py
import unittest import yaml import keepaneyeon.config from keepaneyeon.http import HttpDownloader class TestConfig(unittest.TestCase): def test_register(self): # custom type we want to load from YAML class A(): def __init__(self, **opts): self.opts = opts # YAML...
import unittest import yaml import keepaneyeon.config from keepaneyeon.http import HttpDownloader class TestConfig(unittest.TestCase): def test_register(self): # custom type we want to load from YAML class A(): def __init__(self, **opts): self.opts = opts # YAML...
Fix bug in config test
Fix bug in config test
Python
mit
mmcloughlin/keepaneyeon
import unittest import yaml import keepaneyeon.config from keepaneyeon.http import HttpDownloader class TestConfig(unittest.TestCase): def test_register(self): # custom type we want to load from YAML class A(): def __init__(self, **opts): self.opts = opts # YAML...
Fix bug in config test import unittest import yaml import keepaneyeon.config from keepaneyeon.http import HttpDownloader class TestConfig(unittest.TestCase): def test_register(self): # custom type we want to load from YAML class A(): def __init__(self, **opts): self.op...
7d5207a493877910c4d6282cb8bb05b7a7ef6a13
sdnip/hop_db.py
sdnip/hop_db.py
class HopDB(object): def __init__(self): super(HopDB, self).__init__() self.hops = {} # prefix -> hop self.installed_prefix = [] def add_hop(self, prefix, next_hop): self.hops.setdefault(prefix, next_hop) def get_nexthop(self, prefix): self.hops.get(prefix) ...
class HopDB(object): def __init__(self): super(HopDB, self).__init__() self.hops = {} # prefix -> hop self.installed_prefix = [] def add_hop(self, prefix, next_hop): self.hops.setdefault(prefix, next_hop) def get_nexthop(self, prefix): self.hops.get(prefix) ...
Fix missing ref from hop db
Fix missing ref from hop db
Python
mit
sdnds-tw/Ryu-SDN-IP
class HopDB(object): def __init__(self): super(HopDB, self).__init__() self.hops = {} # prefix -> hop self.installed_prefix = [] def add_hop(self, prefix, next_hop): self.hops.setdefault(prefix, next_hop) def get_nexthop(self, prefix): self.hops.get(prefix) ...
Fix missing ref from hop db class HopDB(object): def __init__(self): super(HopDB, self).__init__() self.hops = {} # prefix -> hop self.installed_prefix = [] def add_hop(self, prefix, next_hop): self.hops.setdefault(prefix, next_hop) def get_nexthop(self, prefix): ...
514e2b3ce6464bd9a4f926fb9c42789ab82bbbd2
json_to_db.py
json_to_db.py
import json import sys import sqlite3 import os no_ending = os.path.splitext(sys.argv[1])[0] file_fields = no_ending.split("_") currency = file_fields[-2] asset = file_fields[-1] table_name = "candles_{}_{}".format(currency.upper(), asset.upper()) conn = sqlite3.connect(no_ending +".db") data = json.load(open(sys.ar...
Add script for converting json data blob to .db file
Add script for converting json data blob to .db file
Python
mit
F1LT3R/bitcoin-scraper,F1LT3R/bitcoin-scraper
import json import sys import sqlite3 import os no_ending = os.path.splitext(sys.argv[1])[0] file_fields = no_ending.split("_") currency = file_fields[-2] asset = file_fields[-1] table_name = "candles_{}_{}".format(currency.upper(), asset.upper()) conn = sqlite3.connect(no_ending +".db") data = json.load(open(sys.ar...
Add script for converting json data blob to .db file
72382916560d275a0bb456ab4d5bd0e63e95cff4
css_updater/git/webhook/handler.py
css_updater/git/webhook/handler.py
"""handles webhook""" from typing import Any, List, Dict class Handler(object): """wraps webhook data""" def __init__(self: Handler, data: Dict[str, Any]) -> None: self.data: Dict[str, Any] = data @property def head_commit(self: Handler) -> Dict[str, Any]: """returns head_commit for ...
"""handles webhook""" from typing import Any, List, Dict class Handler(object): """wraps webhook data""" def __init__(self: Handler, data: Dict[str, Any]) -> None: self.data: Dict[str, Any] = data @property def head_commit(self: Handler) -> Dict[str, Any]: """returns head_commit for ...
Add function to return URL
Add function to return URL
Python
mit
neoliberal/css-updater
"""handles webhook""" from typing import Any, List, Dict class Handler(object): """wraps webhook data""" def __init__(self: Handler, data: Dict[str, Any]) -> None: self.data: Dict[str, Any] = data @property def head_commit(self: Handler) -> Dict[str, Any]: """returns head_commit for ...
Add function to return URL """handles webhook""" from typing import Any, List, Dict class Handler(object): """wraps webhook data""" def __init__(self: Handler, data: Dict[str, Any]) -> None: self.data: Dict[str, Any] = data @property def head_commit(self: Handler) -> Dict[str, Any]: ...
cf4dc3f65049c23f4a20140cf5092f3c5a771a6a
administrator/tests/models/test_user.py
administrator/tests/models/test_user.py
from django.test import TestCase from administrator.models import User, UserManager class UserManagerTestCase(TestCase): valid_email = 'example@example.com' valid_username = 'foobar' valid_password = 'qwerty123' def setUp(self): self.user_manager = UserManager() self.user_manager.mod...
Add tests for User model
Add tests for User model
Python
mit
Social-projects-Rivne/Rv-025.Python,Social-projects-Rivne/Rv-025.Python,Social-projects-Rivne/Rv-025.Python
from django.test import TestCase from administrator.models import User, UserManager class UserManagerTestCase(TestCase): valid_email = 'example@example.com' valid_username = 'foobar' valid_password = 'qwerty123' def setUp(self): self.user_manager = UserManager() self.user_manager.mod...
Add tests for User model
8178bf161d39976405690d68d9ffe6c4dfd9d705
web/view_athena/views.py
web/view_athena/views.py
from django.shortcuts import render from elasticsearch import Elasticsearch from django.http import HttpResponse def search(request): if request.method == 'GET': term = request.GET.get('term_search') if term == None: term = "" response = search_term(term) pages = [] ...
from django.shortcuts import render from elasticsearch import Elasticsearch from django.http import HttpResponse def search(request): if request.method == 'GET': term = request.GET.get('term_search') if term == None: term = "" response = search_term(term) pages = [] ...
Update 'search_term' functon. Add 'match_phrase' function.
Update 'search_term' functon. Add 'match_phrase' function.
Python
mit
pattyvader/athena,pattyvader/athena,pattyvader/athena
from django.shortcuts import render from elasticsearch import Elasticsearch from django.http import HttpResponse def search(request): if request.method == 'GET': term = request.GET.get('term_search') if term == None: term = "" response = search_term(term) pages = [] ...
Update 'search_term' functon. Add 'match_phrase' function. from django.shortcuts import render from elasticsearch import Elasticsearch from django.http import HttpResponse def search(request): if request.method == 'GET': term = request.GET.get('term_search') if term == None: term = ""...
8e5443c7f302957f18db116761f7e410e03eb1fb
app/main/errors.py
app/main/errors.py
# coding=utf-8 from flask import render_template from . import main from dmapiclient import APIError @main.app_errorhandler(APIError) def api_error_handler(e): return _render_error_page(e.status_code) @main.app_errorhandler(404) def page_not_found(e): return _render_error_page(404) @main.app_errorhandler...
# coding=utf-8 from flask import render_template from . import main from ..api_client.error import APIError @main.app_errorhandler(APIError) def api_error_handler(e): return _render_error_page(e.status_code) @main.app_errorhandler(404) def page_not_found(e): return _render_error_page(404) @main.app_error...
Change app-level error handler to use api_client.error exceptions
Change app-level error handler to use api_client.error exceptions
Python
mit
AusDTO/dto-digitalmarketplace-buyer-frontend,AusDTO/dto-digitalmarketplace-buyer-frontend,AusDTO/dto-digitalmarketplace-buyer-frontend,AusDTO/dto-digitalmarketplace-buyer-frontend
# coding=utf-8 from flask import render_template from . import main from ..api_client.error import APIError @main.app_errorhandler(APIError) def api_error_handler(e): return _render_error_page(e.status_code) @main.app_errorhandler(404) def page_not_found(e): return _render_error_page(404) @main.app_error...
Change app-level error handler to use api_client.error exceptions # coding=utf-8 from flask import render_template from . import main from dmapiclient import APIError @main.app_errorhandler(APIError) def api_error_handler(e): return _render_error_page(e.status_code) @main.app_errorhandler(404) def page_not_fo...
8653159dcf6a078bc2193293b93457388e7799d3
tests/tests.py
tests/tests.py
import functools import os from nose.tools import istest, assert_equal import spur def test(func): @functools.wraps(func) def run_test(): for shell in _create_shells(): yield func, shell def _create_shells(): return [ spur.LocalShell(), _cr...
import functools import os from nose.tools import istest, assert_equal import spur def test(func): @functools.wraps(func) def run_test(): for shell in _create_shells(): yield func, shell def _create_shells(): return [ spur.LocalShell(), _cr...
Add test for output that doesn't end in a newline
Add test for output that doesn't end in a newline
Python
bsd-2-clause
mwilliamson/spur.py
import functools import os from nose.tools import istest, assert_equal import spur def test(func): @functools.wraps(func) def run_test(): for shell in _create_shells(): yield func, shell def _create_shells(): return [ spur.LocalShell(), _cr...
Add test for output that doesn't end in a newline import functools import os from nose.tools import istest, assert_equal import spur def test(func): @functools.wraps(func) def run_test(): for shell in _create_shells(): yield func, shell def _create_shells(): retu...
e79b92888fa9dfc57a274f3377cf425776ccb468
food.py
food.py
# Food Class class Food: def __init__(self, x, y): self.location = (x, y) self.eaten = False def getX(self): return self.location[0] def getY(self): return self.location[1] def setX(self, newX): self.location[0] = newX def setY(self, newY): self.location[1] = newY def isEaten(self): return ea...
# Food Class class Food: def __init__(self, x, y): self.location = (x, y) self.eaten = False def getX(self): return self.location[0] def getY(self): return self.location[1] def setX(self, newX): self.location[0] = newX def setY(self, newY): self.location[1] = newY def isEaten(self): return se...
Add self before eaten on isEaten for Food
Add self before eaten on isEaten for Food
Python
mit
MEhlinger/rpi_pushbutton_games
# Food Class class Food: def __init__(self, x, y): self.location = (x, y) self.eaten = False def getX(self): return self.location[0] def getY(self): return self.location[1] def setX(self, newX): self.location[0] = newX def setY(self, newY): self.location[1] = newY def isEaten(self): return se...
Add self before eaten on isEaten for Food # Food Class class Food: def __init__(self, x, y): self.location = (x, y) self.eaten = False def getX(self): return self.location[0] def getY(self): return self.location[1] def setX(self, newX): self.location[0] = newX def setY(self, newY): self.location...
c69b9519c2984154dd15d31395d9590e00d689b5
allauth/socialaccount/providers/trello/provider.py
allauth/socialaccount/providers/trello/provider.py
from allauth.socialaccount.providers.base import ProviderAccount from allauth.socialaccount.providers.oauth.provider import OAuthProvider class TrelloAccount(ProviderAccount): def get_profile_url(self): return None def get_avatar_url(self): return None class TrelloProvider(OAuthProvider): ...
from allauth.socialaccount.providers.base import ProviderAccount from allauth.socialaccount.providers.oauth.provider import OAuthProvider class TrelloAccount(ProviderAccount): def get_profile_url(self): return None def get_avatar_url(self): return None class TrelloProvider(OAuthProvider): ...
Use 'scope' in TrelloProvider auth params. Allows overriding from django settings.
feat(TrelloProvider): Use 'scope' in TrelloProvider auth params. Allows overriding from django settings.
Python
mit
lukeburden/django-allauth,rsalmaso/django-allauth,lukeburden/django-allauth,bittner/django-allauth,rsalmaso/django-allauth,pennersr/django-allauth,bittner/django-allauth,bittner/django-allauth,pennersr/django-allauth,lukeburden/django-allauth,pennersr/django-allauth,rsalmaso/django-allauth
from allauth.socialaccount.providers.base import ProviderAccount from allauth.socialaccount.providers.oauth.provider import OAuthProvider class TrelloAccount(ProviderAccount): def get_profile_url(self): return None def get_avatar_url(self): return None class TrelloProvider(OAuthProvider): ...
feat(TrelloProvider): Use 'scope' in TrelloProvider auth params. Allows overriding from django settings. from allauth.socialaccount.providers.base import ProviderAccount from allauth.socialaccount.providers.oauth.provider import OAuthProvider class TrelloAccount(ProviderAccount): def get_profile_url(self): ...
11fdccbc4144c2b1e27d2b124596ce9122c365a2
froide/problem/apps.py
froide/problem/apps.py
import json from django.apps import AppConfig from django.utils.translation import gettext_lazy as _ class ProblemConfig(AppConfig): name = 'froide.problem' verbose_name = _('Problems') def ready(self): from froide.account.export import registry from . import signals # noqa re...
import json from django.apps import AppConfig from django.urls import reverse from django.utils.translation import gettext_lazy as _ class ProblemConfig(AppConfig): name = 'froide.problem' verbose_name = _('Problems') def ready(self): from froide.account.export import registry from froid...
Add user merging to problem, menu for moderation
Add user merging to problem, menu for moderation
Python
mit
fin/froide,fin/froide,stefanw/froide,stefanw/froide,stefanw/froide,fin/froide,stefanw/froide,fin/froide,stefanw/froide
import json from django.apps import AppConfig from django.urls import reverse from django.utils.translation import gettext_lazy as _ class ProblemConfig(AppConfig): name = 'froide.problem' verbose_name = _('Problems') def ready(self): from froide.account.export import registry from froid...
Add user merging to problem, menu for moderation import json from django.apps import AppConfig from django.utils.translation import gettext_lazy as _ class ProblemConfig(AppConfig): name = 'froide.problem' verbose_name = _('Problems') def ready(self): from froide.account.export import registry ...