commit
stringlengths
40
40
old_file
stringlengths
4
236
new_file
stringlengths
4
236
old_contents
stringlengths
1
3.26k
new_contents
stringlengths
16
4.43k
subject
stringlengths
16
624
message
stringlengths
17
3.29k
lang
stringclasses
5 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
68faeb845e50b4038157fc9fc5155bdeb6f3742b
common/apps.py
common/apps.py
from django.apps import AppConfig from django.conf import settings from common.helpers.db import db_is_initialized class CommonConfig(AppConfig): name = 'common' def ready(self): self.display_missing_environment_variables() from common.helpers.tags import import_tags_from_csv if db_is...
import sys from django.apps import AppConfig from django.conf import settings from common.helpers.db import db_is_initialized class CommonConfig(AppConfig): name = 'common' def ready(self): self.display_missing_environment_variables() from common.helpers.tags import import_tags_from_csv ...
Clean content types table and don't load tags when running loaddata
Clean content types table and don't load tags when running loaddata
Python
mit
DemocracyLab/CivicTechExchange,DemocracyLab/CivicTechExchange,DemocracyLab/CivicTechExchange,DemocracyLab/CivicTechExchange
100260936d433cf468c0437b9cb135bc871d27d1
sphinx-plugin/pydispatch_sphinx/__init__.py
sphinx-plugin/pydispatch_sphinx/__init__.py
import typing as tp import pkg_resources try: __version__ = pkg_resources.require('python-dispatch-sphinx')[0].version except: # pragma: no cover __version__ = 'unknown' from sphinx.application import Sphinx from . import directives from . import documenters def setup(app: Sphinx) -> tp.Dict[str, tp.Any]: ...
import typing as tp import importlib.metadata __version__ = importlib.metadata.version('python-dispatch-sphinx') from sphinx.application import Sphinx from . import directives from . import documenters def setup(app: Sphinx) -> tp.Dict[str, tp.Any]: app.setup_extension(directives.__name__) app.setup_extensi...
Use importlib.metadata for version retrieval
Use importlib.metadata for version retrieval
Python
mit
nocarryr/python-dispatch
027e4be84588e2ea62eea7e8f60ec2db1969e92c
testStats.py
testStats.py
import time import HTU21DF def median(x): m,r= divmod(len(x),2) if r: return sorted(x)[m] return sum(sorted(x)[m-1:m+1])/2 def average(x): return sum(x)/len(x) tempList = [] for x in range(100): HTU21DF.htu_reset tempList.append(HTU21DF.read_temperature()) print 'median is {0}'.format(median(t...
import time import HTU21DF def median(x): m,r= divmod(len(x),2) if r: return sorted(x)[m] return sum(sorted(x)[m-1:m+1])/2 def average(x): return sum(x)/len(x) tempList = [] for x in range(1000): HTU21DF.htu_reset tempList.append(HTU21DF.read_temperature()) print 'median is {0}'.format(median(...
Add difference and up range
Add difference and up range
Python
mit
khuisman/project-cool-attic
187026ce695dee79c4897c0e8e014bb208de5a83
gaia_tools/load/__init__.py
gaia_tools/load/__init__.py
import os, os.path import astropy.io.ascii from gaia_tools.load import path, download def galah(dr=1): filePath, ReadMePath= path.galahPath(dr=dr) if not os.path.exists(filePath): download.galah(dr=dr) data= astropy.io.ascii.read(filePath,readme=ReadMePath) return data
import os, os.path import numpy import astropy.io.ascii from gaia_tools.load import path, download def galah(dr=1): filePath, ReadMePath= path.galahPath(dr=dr) if not os.path.exists(filePath): download.galah(dr=dr) data= astropy.io.ascii.read(filePath,readme=ReadMePath) data['RA']._fill_value= n...
Set fill value of GALAH RA and Dec explicitly
Set fill value of GALAH RA and Dec explicitly
Python
mit
jobovy/gaia_tools
f4eea63ee7658a16733cce23a42aac8f5b7fe49a
handoverservice/handover_api/serializers.py
handoverservice/handover_api/serializers.py
from handover_api.models import Handover, Draft, User from rest_framework import serializers class HandoverSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Handover fields = ('project_id','from_user_id','to_user_id','state') class DraftSerializer(serializers.HyperlinkedMod...
from handover_api.models import Handover, Draft, User from rest_framework import serializers class HandoverSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Handover fields = ('id','url','project_id','from_user_id','to_user_id','state') class DraftSerializer(serializers.Hyp...
Include id and url in models
Include id and url in models
Python
mit
Duke-GCB/DukeDSHandoverService,Duke-GCB/DukeDSHandoverService,Duke-GCB/DukeDSHandoverService
d491aea2da5d52245001f4da24331f33e4a3a299
importlib_metadata/_meta.py
importlib_metadata/_meta.py
from ._compat import Protocol from typing import Any, Dict, Iterator, List, TypeVar, Union _T = TypeVar("_T") class PackageMetadata(Protocol): def __len__(self) -> int: ... # pragma: no cover def __contains__(self, item: str) -> bool: ... # pragma: no cover def __getitem__(self, key:...
from ._compat import Protocol from typing import Any, Dict, Iterator, List, TypeVar, Union _T = TypeVar("_T") class PackageMetadata(Protocol): def __len__(self) -> int: ... # pragma: no cover def __contains__(self, item: str) -> bool: ... # pragma: no cover def __getitem__(self, key:...
Add test purported to capture the failure, but it still passes.
Add test purported to capture the failure, but it still passes.
Python
apache-2.0
python/importlib_metadata
8cd319b59cb28e4ae2fe277205f586983dd4ed63
tst/utils.py
tst/utils.py
from __future__ import print_function import sys import string from colors import * def is_posix_filename(name, extra_chars=""): CHARS = string.letters + string.digits + "._-" + extra_chars return all(c in CHARS for c in name) def cprint(color, msg, file=sys.stdout, end='\n'): print(color + msg + RESE...
from __future__ import print_function import sys import string from colors import * def is_posix_filename(name, extra_chars=""): CHARS = string.letters + string.digits + "._-" + extra_chars return all(c in CHARS for c in name) def cprint(color, msg, file=sys.stdout, end='\n'): data = msg.__str__() if ...
Improve cprint to use __str__ method if available
Improve cprint to use __str__ method if available
Python
agpl-3.0
daltonserey/tst,daltonserey/tst
e8eb21a81587bb2f6c6b783f8345e6f167e15691
flycam.py
flycam.py
import capture from picamera import PiCamera def image_cap_loop(camera): """Set image parameters, capture image, set wait time, repeat""" images = 18 status = None resolution = (854, 480) latest = capture.cap(camera, resolution, status) status = latest[0] size = capture.image_size(latest...
import capture from picamera import PiCamera import time def image_cap_loop(camera): """Set image parameters, capture image, set wait time, repeat""" images = 18 status = None resolution = (854, 480) latest = capture.cap(camera, resolution, status) status = latest[0] size = capture.image...
Add time to imported modules.
Add time to imported modules.
Python
mit
gnfrazier/YardCam
a810493a9ccf26d25b467ab5f7d2b0a9718c1442
login/management/commands/demo_data_login.py
login/management/commands/demo_data_login.py
from django.core.management.base import BaseCommand from login.tests.model_maker import make_superuser from login.tests.model_maker import make_user class Command(BaseCommand): help = "Create demo data for 'login'" def handle(self, *args, **options): make_superuser('admin', 'admin') make_us...
from django.core.management.base import BaseCommand from login.tests.scenario import ( user_contractor, user_default, ) class Command(BaseCommand): help = "Create demo data for 'login'" def handle(self, *args, **options): user_contractor() user_default() print("Created 'logi...
Use the standard scenario for demo data
Use the standard scenario for demo data
Python
apache-2.0
pkimber/login,pkimber/login,pkimber/login
8762ae185d3febe06f6ef5acfa082b26063358a2
example_migration.py
example_migration.py
from metadatastore.mds import MDSRO from portable_mds.mongoquery.mds import MDS source_config = {'host': 'localhost', 'port': 27017, 'database': 'metadatastore_production_v1', 'timezone': 'US/Eastern'} dest_config = {'directory': 'some_directory'} source = MDSRO(sou...
from metadatastore.mds import MDSRO from portable_mds.mongoquery.mds import MDS source_config = {'host': 'localhost', 'port': 27017, 'database': 'metadatastore_production_v1', 'timezone': 'US/Eastern'} dest_config = {'directory': 'some_directory', 'tim...
Add timezone to example to keep Broker happy.
Add timezone to example to keep Broker happy.
Python
bsd-3-clause
ericdill/databroker,ericdill/databroker
ef7f732b9db4f0c835746d535f10e7e91e0484d7
l10n_br_zip/__openerp__.py
l10n_br_zip/__openerp__.py
# -*- coding: utf-8 -*- # Copyright (C) 2009 Renato Lima - Akretion # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html { 'name': 'Brazilian Localisation ZIP Codes', 'license': 'AGPL-3', 'author': 'Akretion, Odoo Community Association (OCA)', 'version': '8.0.1.0.1', 'depends': [ ...
# -*- coding: utf-8 -*- # Copyright (C) 2009 Renato Lima - Akretion # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html { 'name': 'Brazilian Localisation ZIP Codes', 'license': 'AGPL-3', 'author': 'Akretion, Odoo Community Association (OCA)', 'version': '9.0.1.0.0', 'depends': [ ...
Change the version of module.
[MIG] Change the version of module.
Python
agpl-3.0
odoo-brazil/l10n-brazil-wip,thinkopensolutions/l10n-brazil,odoo-brazil/l10n-brazil-wip,thinkopensolutions/l10n-brazil
bd7c5c5544a6d09062da05a4780524e8981f1737
captainhook/checkers/block_branches.py
captainhook/checkers/block_branches.py
# # # # # # # # # # # # # # # CAPTAINHOOK IDENTIFIER # # # # # # # # # # # # # # # import argparse from .utils import bash CHECK_NAME = 'block_branch' def run(files, temp_folder, arg=None): "Check we're not committing to a blocked branch" parser = get_parser() argos = parser.parse_args(arg.split()) ...
# # # # # # # # # # # # # # # CAPTAINHOOK IDENTIFIER # # # # # # # # # # # # # # # import argparse from .utils import bash CHECK_NAME = 'block_branch' def run(files, temp_folder, arg=None): "Check we're not committing to a blocked branch" parser = get_parser() argos = parser.parse_args(arg.split()) ...
Remove decode from block branches check
Remove decode from block branches check It’s now done by `bash()`.
Python
bsd-3-clause
alexcouper/captainhook
c589fffe7834d7a187c25316f95a5d1ca12c5669
active-env.py
active-env.py
#! /usr/bin/env python # Author: Joseph Lisee <jlisee@gmail.com> import os import sys # Get the current directory cur_dir, _ = os.path.split(__file__) def main(): # Get our path env_dir = os.path.abspath(os.path.join(cur_dir, 'env')) # Set our path vars env_paths = { 'PATH' : os.path.join(...
#! /usr/bin/env python # Author: Joseph Lisee <jlisee@gmail.com> import os import sys # Get the current directory cur_dir, _ = os.path.split(__file__) def main(): # Get our path env_dir = os.path.abspath(os.path.join(cur_dir, 'env')) # Set our path vars env_paths = { 'PATH' : os.path.join(...
Make bash setup script actually work
Make bash setup script actually work Fixes call to exec and labels PS1 work as non working (over-ridden by bashrc).
Python
bsd-3-clause
jlisee/xpkg,jlisee/xpkg,jlisee/xpkg
85df3afc75f52a2183ef46560f57bb6993091238
trex/urls.py
trex/urls.py
# -*- coding: utf-8 -*- # # (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com> # # See LICENSE comming with the source of 'trex' for details. # from django.conf.urls import patterns, include, url from django.contrib import admin from trex.views import project urlpatterns = patterns( '', url(r"^admin/", include(a...
# -*- coding: utf-8 -*- # # (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com> # # See LICENSE comming with the source of 'trex' for details. # from django.conf.urls import patterns, include, url from django.contrib import admin from trex.views import project urlpatterns = patterns( '', url(r"^api/1/projects/$",...
Remove the admin url mapping
Remove the admin url mapping
Python
mit
bjoernricks/trex,bjoernricks/trex
faf77acc7ddb6a5e2bc198fcfec129f83d2a7678
plotly/tests/test_core/test_file/test_file.py
plotly/tests/test_core/test_file/test_file.py
""" test_meta: ========== A module intended for use with Nose. """ from nose.tools import raises from nose import with_setup import random import string import requests import plotly.plotly as py import plotly.tools as tls from plotly.exceptions import PlotlyRequestError def _random_filename(): random_chars ...
""" test_meta: ========== A module intended for use with Nose. """ import random import string from unittest import TestCase import plotly.plotly as py from plotly.exceptions import PlotlyRequestError class FolderAPITestCase(TestCase): def setUp(self): py.sign_in('PythonTest', '9v9f20pext') def _...
Fix failing test and refact to TestCase.
Fix failing test and refact to TestCase.
Python
mit
ee-in/python-api,plotly/plotly.py,plotly/python-api,ee-in/python-api,plotly/python-api,plotly/python-api,plotly/plotly.py,plotly/plotly.py,ee-in/python-api
530bd321f38a0131eb250148bd0a67d9a59da34c
uno_image.py
uno_image.py
""" Example usage of UNO, graphic objects and networking in LO extension """ import unohelper from com.sun.star.task import XJobExecutor class ImageExample(unohelper.Base, XJobExecutor): '''Class that implements the service registered in LibreOffice''' def __init__(self, context): self.context = cont...
""" Example usage of UNO, graphic objects and networking in LO extension """ import unohelper from com.sun.star.task import XJobExecutor class ImageExample(unohelper.Base, XJobExecutor): '''Class that implements the service registered in LibreOffice''' def __init__(self, context): self.context = cont...
Add code to create needed uno services
Add code to create needed uno services
Python
mpl-2.0
JIghtuse/uno-image-manipulation-example
3a77de3c7d863041bea1366c50a95293d1cd2f7a
tests/functional/test_warning.py
tests/functional/test_warning.py
import pytest import textwrap @pytest.fixture def warnings_demo(tmpdir): demo = tmpdir.joinpath('warnings_demo.py') demo.write_text(textwrap.dedent(''' from logging import basicConfig from pip._internal.utils import deprecation deprecation.install_warning_logger() basicConfig(...
import pytest import textwrap @pytest.fixture def warnings_demo(tmpdir): demo = tmpdir.joinpath('warnings_demo.py') demo.write_text(textwrap.dedent(''' from logging import basicConfig from pip._internal.utils import deprecation deprecation.install_warning_logger() basicConfig(...
Split tests for different functionality
Split tests for different functionality
Python
mit
pypa/pip,pradyunsg/pip,xavfernandez/pip,rouge8/pip,pypa/pip,xavfernandez/pip,rouge8/pip,xavfernandez/pip,pfmoore/pip,sbidoul/pip,rouge8/pip,sbidoul/pip,pradyunsg/pip,pfmoore/pip
fe2f37c71f4c46997eb2d2e775bb928a2e7bcad1
contentdensity/textifai/modules/gic.py
contentdensity/textifai/modules/gic.py
from functools import reduce from ..models import User, Text, Insight, Comment, GeneralInsight class general_insight_calculator: name = None calc = lambda *_: None def __init__(self, name, calc): self.name = name self.calc = calc def do_calc(self): return self.calc() def...
from functools import reduce from ..models import User, Text, Insight, Comment, GeneralInsight class general_insight_calculator: name = None calc = lambda *_: None def __init__(self, name, calc): self.name = name self.calc = calc def do_calc(self): return self.calc() def...
Change from array to dictionary for general insight calculators
Change from array to dictionary for general insight calculators
Python
mit
CS326-important/space-deer,CS326-important/space-deer
0273fc0109d1ef4a4de0450998a6c420cb90217a
util_funcs.py
util_funcs.py
#!/usr/bin/env python """Collection of module netural utility functions""" from sys import stderr from ssl import SSLError try: from urllib.request import urlopen, HTTPError, URLError except ImportError: from urllib2 import urlopen, HTTPError, URLError class HTMLGetError(Exception): pass def get_html(url...
#!/usr/bin/env python """Collection of module netural utility functions""" from sys import stderr from ssl import SSLError from socket import timeout try: from urllib.request import urlopen, HTTPError, URLError except ImportError: from urllib2 import urlopen, HTTPError, URLError class HTMLGetError(Exception):...
Remove superfluous parens; catch timeout
Remove superfluous parens; catch timeout
Python
mit
jblakeman/apt-select,jblakeman/apt-select
3222fab1b026250d9aee863d068137b03c13a05b
tests/test_check_dependencies.py
tests/test_check_dependencies.py
#! /usr/bin/python from check_dependencies import CheckDependencies def test_default(): CheckDependencies(None) def test_hydrotrend(): CheckDependencies("hydrotrend")
#! /usr/bin/python from check_dependencies import CheckDependencies def test_default(): CheckDependencies(None) def test_hydrotrend(): CheckDependencies("hydrotrend") def test_cem(): CheckDependencies("cem")
Add dependency check test for CEM
Add dependency check test for CEM
Python
mit
csdms/rpm_models
85605ab0c08528c772d53ad746eb5eadcd6e495c
hook-mcedit2.py
hook-mcedit2.py
""" hook-mcedit2.py Hook for pyinstaller to collect MCEdit's data files """ from __future__ import absolute_import, division, print_function#, unicode_literals import glob import logging import os from PyInstaller.hooks.hookutils import collect_data_files log = logging.getLogger(__name__) datas = collect_data...
""" hook-mcedit2.py Hook for pyinstaller to collect MCEdit's data files """ from __future__ import absolute_import, division, print_function#, unicode_literals import glob import logging import os from PyInstaller.hooks.hookutils import collect_data_files log = logging.getLogger(__name__) # Remove cython and ...
Exclude secondary cython outputs from pyi spec
Exclude secondary cython outputs from pyi spec
Python
bsd-3-clause
Rubisk/mcedit2,vorburger/mcedit2,Rubisk/mcedit2,vorburger/mcedit2
2da3f9cf12c340322f512585711ebc02097c72a1
tests/views/test_calls_for_comments_page.py
tests/views/test_calls_for_comments_page.py
from tests import PMGLiveServerTestCase from tests.fixtures import dbfixture, CallForCommentData import urllib.request, urllib.error, urllib.parse class TestCallsForCommentsPage(PMGLiveServerTestCase): def setUp(self): super(TestCallsForCommentsPage, self).setUp() self.fx = dbfixture.data(CallFor...
from tests import PMGLiveServerTestCase from tests.fixtures import dbfixture, CallForCommentData import urllib.request, urllib.error, urllib.parse class TestCallsForCommentsPage(PMGLiveServerTestCase): def setUp(self): super(TestCallsForCommentsPage, self).setUp() self.fx = dbfixture.data(CallFor...
Remove false assertion from test
Remove false assertion from test
Python
apache-2.0
Code4SA/pmg-cms-2,Code4SA/pmg-cms-2,Code4SA/pmg-cms-2
fcf3511a586b5efe4a86674ccd4c80c67ec2ed14
tracker/src/main/tracker/util/connection.py
tracker/src/main/tracker/util/connection.py
import os from sqlalchemy.ext.automap import automap_base from sqlalchemy.orm import sessionmaker from sqlalchemy import create_engine from sqlalchemy.orm.scoping import scoped_session DB_URL = os.environ['DB_URL'] Base = automap_base() engine = create_engine(DB_URL) Base.prepare(engine, reflect=True) session_factor...
import os from sqlalchemy.ext.automap import automap_base from sqlalchemy.orm import sessionmaker from sqlalchemy import create_engine from sqlalchemy.orm.scoping import scoped_session DB_URL = os.environ['DB_URL'] if not DB_URL: raise ValueError("DB_URL not present in the environment") Base = automap_base() en...
Test for DB_URL being present in environment.
Test for DB_URL being present in environment.
Python
mit
llevar/germline-regenotyper,llevar/germline-regenotyper
9339e0bd1197f8d599309eaff66b83c38721ab29
conference/management/commands/add_invoices_for_zero_amount_orders.py
conference/management/commands/add_invoices_for_zero_amount_orders.py
# -*- coding: UTF-8 -*- from __future__ import print_function from django.core.management.base import BaseCommand from assopy import models as amodels def generate_invoices_for_zero_amount_orders_for_year(year): orders = amodels.Order.objects.filter( created__year=year, method='bank', ) ...
# -*- coding: UTF-8 -*- from __future__ import print_function from django.core.management.base import BaseCommand from assopy import models as amodels def generate_invoices_for_zero_amount_orders_for_year(year): orders = amodels.Order.objects.filter( created__year=year, method='bank', ) ...
Make sure that only zero amount orders are modified.
Make sure that only zero amount orders are modified. Note really necessary, since we don't have real bank orders, but better safe than sorry.
Python
bsd-2-clause
EuroPython/epcon,EuroPython/epcon,EuroPython/epcon,EuroPython/epcon
6bb43304fe08d299eadbd4977aa5db1f26eb90ce
build_tools/preseed_home.py
build_tools/preseed_home.py
import os import shutil import tempfile temphome = tempfile.mkdtemp() os.environ["KOLIBRI_HOME"] = temphome from kolibri.main import initialize # noqa E402 from kolibri.deployment.default.sqlite_db_names import ( # noqa E402 ADDITIONAL_SQLITE_DATABASES, ) from django.core.management import call_command # noqa ...
import os import shutil import tempfile temphome = tempfile.mkdtemp() os.environ["KOLIBRI_HOME"] = temphome from kolibri.main import initialize # noqa E402 from kolibri.deployment.default.sqlite_db_names import ( # noqa E402 ADDITIONAL_SQLITE_DATABASES, ) from django.conf import settings # noqa E402 from djang...
Make database preseeding sensitive to custom build options.
Make database preseeding sensitive to custom build options.
Python
mit
learningequality/kolibri,learningequality/kolibri,learningequality/kolibri,learningequality/kolibri
53331e43c2a95f45aaaa91f2c0fe204fd4d8d530
keras/constraints.py
keras/constraints.py
from __future__ import absolute_import import theano import theano.tensor as T import numpy as np class Constraint(object): def __call__(self, p): return p def get_config(self): return {"name":self.__class__.__name__} class MaxNorm(Constraint): def __init__(self, m=2): self.m = m ...
from __future__ import absolute_import import theano import theano.tensor as T import numpy as np class Constraint(object): def __call__(self, p): return p def get_config(self): return {"name":self.__class__.__name__} class MaxNorm(Constraint): def __init__(self, m=2): self.m = m ...
Allow constraint getter to take parameter dict
Allow constraint getter to take parameter dict
Python
mit
rudaoshi/keras,mikekestemont/keras,jonberliner/keras,xurantju/keras,Aureliu/keras,DLlearn/keras,cvfish/keras,stephenbalaban/keras,chenych11/keras,fmacias64/keras,kuza55/keras,ashhher3/keras,sjuvekar/keras,OlafLee/keras,keskarnitish/keras,iamtrask/keras,wubr2000/keras,rlkelly/keras,saurav111/keras,johmathe/keras,untom/k...
461dc9a54ae2eb8bc5f1a07557130d5251187573
install_deps.py
install_deps.py
#!/usr/bin/env python """ Install the packages you have listed in the requirements file you input as first argument. """ from __future__ import (absolute_import, division, print_function, unicode_literals) import sys import fileinput import subprocess from pip.req import parse_requirements ...
#!/usr/bin/env python """ Install the packages you have listed in the requirements file you input as first argument. """ from __future__ import (absolute_import, division, print_function, unicode_literals) import sys import fileinput import subprocess from pip.req import parse_requirements ...
Correct for None appearing in requirements list
Correct for None appearing in requirements list
Python
bsd-3-clause
Neurita/boyle
60abdfa788ef40b5bbd34ea3e332089b86b61c88
robokassa/migrations/0003_load_source_type.py
robokassa/migrations/0003_load_source_type.py
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import DataMigration from django.db import models class Migration(DataMigration): def forwards(self, orm): "Write your forwards methods here." # Note: Remember to use orm['appname.ModelName'] rather than "from appname.mo...
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import DataMigration from django.db import models class Migration(DataMigration): def forwards(self, orm): pass def backwards(self, orm): pass models = { u'robokassa.successnotification': { ...
Remove code that depends on a current model state.
Remove code that depends on a current model state.
Python
mit
a-iv/django-oscar-robokassa
f4a919b698788dcec8411665290a83537e962413
django_alexa/api/fields.py
django_alexa/api/fields.py
'''These are the only serializer fields support by the Alexa skills kit''' from rest_framework.serializers import CharField, IntegerField, DateField, TimeField, DurationField, ChoiceField # flake8: noqa # This maps serializer fields to the amazon intent slot types INTENT_SLOT_TYPES = { "CharField": "AMAZON.LITERAL...
'''These are the only serializer fields support by the Alexa skills kit''' from rest_framework.serializers import CharField, IntegerField, DateField, TimeField, DurationField, ChoiceField # flake8: noqa # This maps serializer fields to the amazon intent slot types INTENT_SLOT_TYPES = { "CharField": "AMAZON.LITERAL...
Add support for new slot types
Add support for new slot types
Python
mit
rocktavious/django-alexa,pycontribs/django-alexa
f908501860858311536a3fef03fda7a632ce5412
djohno/tests/test_utils.py
djohno/tests/test_utils.py
from django.core.exceptions import ValidationError from django.test import TestCase import djohno from djohno.utils import ( is_pretty_from_address, get_app_versions ) class DjohnoUtilTests(TestCase): def test_is_pretty_from_address_fails_on_bare_address(self): """ Ensure normal email addr...
from django.core.exceptions import ValidationError from django.test import TestCase import djohno from djohno.utils import ( is_pretty_from_address, get_app_versions ) class DjohnoUtilTests(TestCase): def test_is_pretty_from_address_fails_on_bare_address(self): """ Ensure normal email addr...
Add a missing test description
Add a missing test description
Python
bsd-2-clause
dominicrodger/djohno,dominicrodger/djohno
3a3d1f5b2c376de3e979aa17d11505dc66421852
test_journal.py
test_journal.py
# -*- coding: utf-8 -*- from contextlib import closing import pytest from journal import app from journal import connect_db from journal import get_database_connection from journal import init_db TEST_DSN = 'dbname=test_learning_journal' def clear_db(): with closing(connect_db()) as db: db.cursor().exec...
# -*- coding: utf-8 -*- from contextlib import closing import pytest from journal import app from journal import connect_db from journal import get_database_connection from journal import init_db TEST_DSN = 'dbname=test_learning_journal' def clear_db(): with closing(connect_db()) as db: db.cursor().exec...
Add db() to initialize a table and drop when finished
Add db() to initialize a table and drop when finished
Python
mit
sazlin/learning_journal
557fddcf26ef52ccea3761b000e5a94e3f551a78
pygraphc/optimization/SimulatedAnnealing.py
pygraphc/optimization/SimulatedAnnealing.py
from random import choice from pygraphc.evaluation.InternalEvaluation import InternalEvaluation class SimulatedAnnealing(object): def __init__(self, method, tmin, tmax, parameter, energy_type): """The constructor of Simulated Annealing method. Parameters ---------- method : s...
from random import choice from pygraphc.evaluation.InternalEvaluation import InternalEvaluation class SimulatedAnnealing(object): def __init__(self, tmin, tmax, alpha, parameters, energy_type, max_iteration): """The constructor of Simulated Annealing method. Parameters ---------- ...
Edit the parameters. Not fix yet
Edit the parameters. Not fix yet
Python
mit
studiawan/pygraphc
7d7dd781500328c0160ac59affc150f9323ee35d
examples/jupyter-output-area/server.py
examples/jupyter-output-area/server.py
#!/usr/bin/env python2 from SimpleHTTPServer import SimpleHTTPRequestHandler import BaseHTTPServer class CORSRequestHandler( SimpleHTTPRequestHandler ): def end_headers( self ): self.send_header( 'Access-Control-Allow-Origin', '*' ) SimpleHTTPRequestHandler.end_headers(self) if __name__ == '__main...
try: from http.server import SimpleHTTPRequestHandler import http.server as BaseHTTPServer except ImportError: from SimpleHTTPServer import SimpleHTTPRequestHandler import BaseHTTPServer class CORSRequestHandler( SimpleHTTPRequestHandler ): def end_headers( self ): self.send_header( 'Acces...
Add python3 support to stop Steve whinging
Add python3 support to stop Steve whinging
Python
bsd-3-clause
dwillmer/playground,dwillmer/playground,dwillmer/playground
9dee48fb0964b12780f57cef26c5b84072448232
ds/api/serializer/app.py
ds/api/serializer/app.py
from __future__ import absolute_import from ds.models import App from .base import Serializer from .manager import add @add(App) class AppSerializer(Serializer): def serialize(self, item, attrs): return { 'id': str(item.id), 'name': item.name, }
from __future__ import absolute_import from ds.models import App from .base import Serializer from .manager import add @add(App) class AppSerializer(Serializer): def serialize(self, item, attrs): return { 'id': str(item.id), 'name': item.name, 'provider': item.provide...
Add provider information to App
Add provider information to App
Python
apache-2.0
jkimbo/freight,rshk/freight,jkimbo/freight,getsentry/freight,jkimbo/freight,rshk/freight,klynton/freight,rshk/freight,getsentry/freight,klynton/freight,getsentry/freight,rshk/freight,klynton/freight,getsentry/freight,getsentry/freight,jkimbo/freight,klynton/freight
169d34c179a0878383edd7e2c4ba8f80aaabc7c8
zendesk_tickets_machine/tickets/services.py
zendesk_tickets_machine/tickets/services.py
import datetime from django.utils.timezone import utc from .models import Ticket class TicketServices(): def edit_ticket_once(self, **kwargs): id_list = kwargs.get('id_list') edit_tags = kwargs.get('edit_tags') edit_requester = kwargs.get('edit_requester') edit_subject = kwargs.g...
import datetime from django.utils.timezone import utc from .models import Ticket class TicketServices(): def edit_ticket_once(self, **kwargs): id_list = kwargs.get('id_list') edit_tags = kwargs.get('edit_tags') edit_requester = kwargs.get('edit_requester') edit_subject = kwargs.g...
Adjust code style to reduce lines of code :bear:
Adjust code style to reduce lines of code :bear:
Python
mit
prontotools/zendesk-tickets-machine,prontotools/zendesk-tickets-machine,prontotools/zendesk-tickets-machine,prontotools/zendesk-tickets-machine
2c41bfe7da9644b3a76adc5d2f1744107a3c40f4
core/git_mixins/rewrite.py
core/git_mixins/rewrite.py
from types import SimpleNamespace class ChangeTemplate(SimpleNamespace): # orig_hash do_commit = True msg = None datetime = None author = None class RewriteMixin(): ChangeTemplate = ChangeTemplate def rewrite_active_branch(self, base_commit, commit_chain): branch_name = self.ge...
from types import SimpleNamespace class ChangeTemplate(SimpleNamespace): # orig_hash do_commit = True msg = None datetime = None author = None class RewriteMixin(): ChangeTemplate = ChangeTemplate def rewrite_active_branch(self, base_commit, commit_chain): branch_name = self.ge...
Allow empty commit messages if explictly specified.
Allow empty commit messages if explictly specified.
Python
mit
theiviaxx/GitSavvy,jmanuel1/GitSavvy,dreki/GitSavvy,dvcrn/GitSavvy,dvcrn/GitSavvy,asfaltboy/GitSavvy,jmanuel1/GitSavvy,ddevlin/GitSavvy,ddevlin/GitSavvy,divmain/GitSavvy,stoivo/GitSavvy,stoivo/GitSavvy,divmain/GitSavvy,dreki/GitSavvy,ddevlin/GitSavvy,theiviaxx/GitSavvy,stoivo/GitSavvy,asfaltboy/GitSavvy,ralic/GitSavvy,...
cea1f24aa0862d2feab1150fbd667159ab4cbe3a
migrations/versions/0313_email_access_validated_at.py
migrations/versions/0313_email_access_validated_at.py
""" Revision ID: 0313_email_access_validated_at Revises: 0312_populate_returned_letters Create Date: 2020-01-28 18:03:22.237386 """ from alembic import op import sqlalchemy as sa revision = '0313_email_access_validated_at' down_revision = '0312_populate_returned_letters' def upgrade(): # ### commands auto gen...
""" Revision ID: 0313_email_access_validated_at Revises: 0312_populate_returned_letters Create Date: 2020-01-28 18:03:22.237386 """ from alembic import op import sqlalchemy as sa revision = '0313_email_access_validated_at' down_revision = '0312_populate_returned_letters' def upgrade(): # ### commands auto gen...
Simplify the first migration, we will do execute statements later
Simplify the first migration, we will do execute statements later
Python
mit
alphagov/notifications-api,alphagov/notifications-api
a3ee74b3b7cba17e013b549f0ed56587cfc65331
rnacentral/nhmmer/urls.py
rnacentral/nhmmer/urls.py
""" Copyright [2009-2014] EMBL-European Bioinformatics Institute Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or a...
""" Copyright [2009-2014] EMBL-European Bioinformatics Institute Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or a...
Use spaces instead of tabs
Use spaces instead of tabs
Python
apache-2.0
RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode
e548b18f223e2493472dcf393d21d1714d304216
median.py
median.py
def median(numbers): """Return the median of a list of numbers.""" length = len(numbers) numbers.sort() if length % 2 == 0: place = length / 2 calculated_median = (numbers[place] + numbers[place - 1]) / 2.0 else: place = (length - 1) / 2 calculated_median = numbe...
def median(numbers): """Return the median of a list of numbers.""" length = len(numbers) numbers.sort() if length % 2 == 0: place = int(length / 2) # index must be integer calculated_median = (numbers[place] + numbers[place - 1]) / 2.0 else: place = int((length - 1) / 2)...
Convert place to integer, for list index
Convert place to integer, for list index
Python
agpl-3.0
brylie/python-practice
48e340377ae06e962e043658b2dc8235b18f44e2
turbustat/statistics/base_statistic.py
turbustat/statistics/base_statistic.py
from astropy.io import fits import numpy as np from ..io import input_data class BaseStatisticMixIn(object): """ Common properties to all statistics """ # Disable this flag when a statistic does not need a header need_header_flag = True @property def header(self): return self._...
from astropy.io import fits import numpy as np from ..io import input_data class BaseStatisticMixIn(object): """ Common properties to all statistics """ # Disable this flag when a statistic does not need a header need_header_flag = True # Disable this when the data property will not be use...
Allow data property to not be use
Allow data property to not be use
Python
mit
e-koch/TurbuStat,Astroua/TurbuStat
18000a73273a65a320513c5ca119bc07e1efb37d
octopenstack/view.py
octopenstack/view.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import pprint import json class View(object): def service_list(self, service_list): print('service LIST:') for service in service_list: print(service) print('') def service_information(self, action, name, *argv): print...
#!/usr/bin/env python # -*- coding: utf-8 -*- import pprint import json class View(object): def service_list(self, service_list): print('service LIST:') for service in service_list: print(service) print('') def service_information(self, action, name, *argv): print...
Fix Json error for Python3 compatibility
Fix Json error for Python3 compatibility
Python
apache-2.0
epheo/shaddock,epheo/shaddock
89e196e86d3b337ff6addb9e0ba289cbd63950d5
netbox/extras/querysets.py
netbox/extras/querysets.py
from __future__ import unicode_literals from django.db.models import Q, QuerySet class ConfigContextQuerySet(QuerySet): def get_for_object(self, obj): """ Return all applicable ConfigContexts for a given object. Only active ConfigContexts will be included. """ # `device_role` fo...
from __future__ import unicode_literals from django.db.models import Q, QuerySet class ConfigContextQuerySet(QuerySet): def get_for_object(self, obj): """ Return all applicable ConfigContexts for a given object. Only active ConfigContexts will be included. """ # `device_role` fo...
Tweak ConfigContext manager to allow for objects with a regionless site
Tweak ConfigContext manager to allow for objects with a regionless site
Python
apache-2.0
digitalocean/netbox,lampwins/netbox,lampwins/netbox,lampwins/netbox,digitalocean/netbox,digitalocean/netbox,lampwins/netbox,digitalocean/netbox
6a7d741da6124ec3d8607b5780608b51b7aca8ba
editorconfig/exceptions.py
editorconfig/exceptions.py
"""EditorConfig exception classes Licensed under PSF License (see LICENSE.txt file). """ class EditorConfigError(Exception): """Parent class of all exceptions raised by EditorConfig""" from ConfigParser import ParsingError as _ParsingError class ParsingError(_ParsingError, EditorConfigError): """Error r...
"""EditorConfig exception classes Licensed under PSF License (see LICENSE.txt file). """ class EditorConfigError(Exception): """Parent class of all exceptions raised by EditorConfig""" try: from ConfigParser import ParsingError as _ParsingError except: from configparser import ParsingError as _Parsing...
Fix broken ConfigParser import for Python3
Fix broken ConfigParser import for Python3
Python
bsd-2-clause
benjifisher/editorconfig-vim,VictorBjelkholm/editorconfig-vim,johnfraney/editorconfig-vim,benjifisher/editorconfig-vim,pocke/editorconfig-vim,pocke/editorconfig-vim,pocke/editorconfig-vim,VictorBjelkholm/editorconfig-vim,johnfraney/editorconfig-vim,VictorBjelkholm/editorconfig-vim,benjifisher/editorconfig-vim,johnfrane...
449ec018d9403e1732528c2806ec68e8417e6725
raco/rules.py
raco/rules.py
import algebra import boolean class Rule: """ Argument is an expression tree Returns a possibly modified expression tree """ def __call__(self, expr): return self.fire(expr) class CrossProduct2Join(Rule): """A rewrite rule for removing Cross Product""" def fire(self, expr): if isinstance(expr, algebra...
import boolean class Rule: """ Argument is an expression tree Returns a possibly modified expression tree """ def __call__(self, expr): return self.fire(expr) import algebra class CrossProduct2Join(Rule): """A rewrite rule for removing Cross Product""" def fire(self, expr): if isinstance(expr, algebr...
Resolve circular reference during import
Resolve circular reference during import
Python
bsd-3-clause
uwescience/raco,uwescience/raco,uwescience/raco,uwescience/raco,uwescience/raco
ea73a999ffbc936f7e072a310f05ee2cb26b6c21
openprocurement/tender/limited/adapters.py
openprocurement/tender/limited/adapters.py
# -*- coding: utf-8 -*- from openprocurement.tender.core.adapters import TenderConfigurator from openprocurement.tender.limited.models import ( ReportingTender, NegotiationTender, NegotiationQuickTender ) class TenderReportingConfigurator(TenderConfigurator): """ Reporting Tender configuration adapter """ ...
# -*- coding: utf-8 -*- from openprocurement.tender.core.adapters import TenderConfigurator from openprocurement.tender.openua.constants import STATUS4ROLE from openprocurement.tender.limited.models import ( ReportingTender, NegotiationTender, NegotiationQuickTender ) class TenderReportingConfigurator(TenderConfi...
Add import and constant in adapter
Add import and constant in adapter
Python
apache-2.0
openprocurement/openprocurement.tender.limited
6ea9d0c4b4e2a117e3e74c34cc77f83d262e62d8
sendgrid_events/models.py
sendgrid_events/models.py
import json from django.db import models from django.utils import timezone from jsonfield import JSONField from sendgrid_events.signals import batch_processed class Event(models.Model): kind = models.CharField(max_length=75) email = models.CharField(max_length=150) data = JSONField(blank=True) crea...
import json from django.db import models from django.utils import timezone from jsonfield import JSONField from sendgrid_events.signals import batch_processed class Event(models.Model): kind = models.CharField(max_length=75) email = models.CharField(max_length=150) data = JSONField(blank=True) crea...
Update for latest Sendgrid webhook format
Update for latest Sendgrid webhook format
Python
bsd-3-clause
digital-eskimo/django-sendgrid-events,kronok/django-sendgrid-events,eldarion/django-sendgrid-events,rorito/django-sendgrid-events
6c4b69e071dba6e1a7fddf350a89aa348edb343e
scripts/indent_trace_log.py
scripts/indent_trace_log.py
#!/usr/bin/env python # Indents a CAF log with trace verbosity. The script does *not* deal with a log # with multiple threads. # usage (read file): indent_trace_log.py FILENAME # (read stdin): indent_trace_log.py - import sys import os import fileinput def read_lines(fp): indent = "" for line in fp: ...
#!/usr/bin/env python # Indents a CAF log with trace verbosity. The script does *not* deal with a log # with multiple threads. # usage (read file): indent_trace_log.py FILENAME # (read stdin): indent_trace_log.py - import argparse, sys, os, fileinput, re def is_entry(line): return 'TRACE' in line and 'ENTR...
Add filtering option to indentation script
Add filtering option to indentation script
Python
bsd-3-clause
actor-framework/actor-framework,DavadDi/actor-framework,actor-framework/actor-framework,DavadDi/actor-framework,DavadDi/actor-framework,actor-framework/actor-framework,actor-framework/actor-framework,DavadDi/actor-framework
0a0b1087b0067259b774b91809a166d74c8c695c
spacy/lang/id/__init__.py
spacy/lang/id/__init__.py
# coding: utf8 from __future__ import unicode_literals from .stop_words import STOP_WORDS from .punctuation import TOKENIZER_SUFFIXES, TOKENIZER_PREFIXES, TOKENIZER_INFIXES from .tokenizer_exceptions import TOKENIZER_EXCEPTIONS from .norm_exceptions import NORM_EXCEPTIONS from .lemmatizer import LOOKUP from .lex_attrs...
# coding: utf8 from __future__ import unicode_literals from .stop_words import STOP_WORDS from .punctuation import TOKENIZER_SUFFIXES, TOKENIZER_PREFIXES, TOKENIZER_INFIXES from .tokenizer_exceptions import TOKENIZER_EXCEPTIONS from .norm_exceptions import NORM_EXCEPTIONS from .lemmatizer import LOOKUP from .lex_attrs...
Make tag map available in Indonesian defaults
Make tag map available in Indonesian defaults
Python
mit
spacy-io/spaCy,explosion/spaCy,spacy-io/spaCy,explosion/spaCy,honnibal/spaCy,honnibal/spaCy,spacy-io/spaCy,explosion/spaCy,honnibal/spaCy,spacy-io/spaCy,explosion/spaCy,explosion/spaCy,explosion/spaCy,spacy-io/spaCy,spacy-io/spaCy,honnibal/spaCy
3d3aba1ff780061ced014c4387f1d91b9fb168db
skimage/measure/__init__.py
skimage/measure/__init__.py
from ._find_contours import find_contours from ._marching_cubes import marching_cubes, mesh_surface_area from ._regionprops import regionprops, perimeter from ._structural_similarity import structural_similarity from ._polygon import approximate_polygon, subdivide_polygon from ._moments import moments, moments_central,...
from ._find_contours import find_contours from ._marching_cubes import (marching_cubes, mesh_surface_area, correct_mesh_orientation) from ._regionprops import regionprops, perimeter from ._structural_similarity import structural_similarity from ._polygon import approximate_polygon, subdivi...
Add correct_mesh_orientation to skimage.measure imports
Add correct_mesh_orientation to skimage.measure imports
Python
bsd-3-clause
rjeli/scikit-image,pratapvardhan/scikit-image,paalge/scikit-image,WarrenWeckesser/scikits-image,blink1073/scikit-image,juliusbierk/scikit-image,robintw/scikit-image,ofgulban/scikit-image,ClinicalGraphics/scikit-image,chintak/scikit-image,bsipocz/scikit-image,jwiggins/scikit-image,SamHames/scikit-image,michaelaye/scikit...
8df7c8b048bc7c2883819869027764e030c8a2e6
fabfile.py
fabfile.py
from fabric.api import local, env, sudo env.hosts = ['nkhumphreys.co.uk'] env.user = 'root' NAME = "gobananas" def deploy(): base_cmd = "scp -r {local_path} root@{host}:{remote_path}" remote_path = "/tmp" template_path = "/var/www/templates/" static_path = "/var/www/static/" for h in env.hosts...
from fabric.api import local, env, sudo env.hosts = ['nkhumphreys.co.uk'] env.user = 'root' NAME = "gobananas" def deploy(): base_cmd = "scp -r {local_path} root@{host}:{remote_path}" remote_path = "/tmp" template_path = "/var/www/templates/" static_path = "/var/www/nkhumphreys/assets/static/" ...
Change location of static files on server
Change location of static files on server
Python
mit
nkhumphreys/gobananas,nkhumphreys/gobananas,nkhumphreys/gobananas
92ca74258f0028bf3b12a84a7f7741f7b72ec45d
db/migrations/migration2.py
db/migrations/migration2.py
import sqlite3 from config import DATA_FOLDER def migrate(database_path): print "migrating to db version 2" conn = sqlite3.connect(database_path) conn.text_factory = str cursor = conn.cursor() # read hashmap from db cursor.execute('''SELECT * FROM hashmap''') mappings = cursor.fetchall() ...
import sqlite3 from config import DATA_FOLDER def migrate(database_path): print "migrating to db version 2" conn = sqlite3.connect(database_path) conn.text_factory = str cursor = conn.cursor() # read hashmap from db cursor.execute('''SELECT * FROM hashmap''') mappings = cursor.fetchall() ...
Remove exception in migration Some users moved their data folder despite the code not permitting it yet. This migration will fail for those users, but they will still be able to run the app.
Remove exception in migration Some users moved their data folder despite the code not permitting it yet. This migration will fail for those users, but they will still be able to run the app.
Python
mit
OpenBazaar/Network,OpenBazaar/OpenBazaar-Server,tomgalloway/OpenBazaar-Server,saltduck/OpenBazaar-Server,tomgalloway/OpenBazaar-Server,tyler-smith/OpenBazaar-Server,saltduck/OpenBazaar-Server,cpacia/OpenBazaar-Server,tyler-smith/OpenBazaar-Server,OpenBazaar/Network,OpenBazaar/OpenBazaar-Server,saltduck/OpenBazaar-Serve...
c441eee6acd694553e5ed79f4014eef387b9bd9e
s3file/checks.py
s3file/checks.py
from django.core.checks import Error from django.core.files.storage import FileSystemStorage, default_storage def storage_check(app_configs, **kwargs): if isinstance(default_storage, FileSystemStorage): return [ Error( 'FileSystemStorage should not be used in a production envir...
from django.core.checks import Error from django.core.files.storage import FileSystemStorage, default_storage def storage_check(app_configs, **kwargs): if isinstance(default_storage, FileSystemStorage): return [ Error( 'FileSystemStorage should not be used in a production envir...
Fix deployment check return value
Fix deployment check return value AssertionError: The function <function storage_check at 0x7f8571c1a048> did not return a list. All functions registered with the checks registry must return a list.
Python
mit
codingjoe/django-s3file,codingjoe/django-s3file,codingjoe/django-s3file
bb9116940ffba48a1a930e7c3203bd2d8b8bbb6e
docs/examples/compute/pricing.py
docs/examples/compute/pricing.py
from libcloud.compute.types import Provider from libcloud.compute.providers import get_driver EC2_ACCESS_ID = 'your access id' EC2_SECRET_KEY = 'your secret key' cls = get_driver(Provider.EC2) driver = cls(EC2_ACCESS_ID, EC2_SECRET_KEY) sizes = driver.list_sizes() >>> sizes[:5] [<NodeSize: id=t1.micro, name=Micro In...
from libcloud.compute.types import Provider from libcloud.compute.providers import get_driver EC2_ACCESS_ID = 'your access id' EC2_SECRET_KEY = 'your secret key' cls = get_driver(Provider.EC2) driver = cls(EC2_ACCESS_ID, EC2_SECRET_KEY) sizes = driver.list_sizes() # >>> sizes[:2] # [<NodeSize: id=t1.micro, name=Micr...
Fix pep8 violations in the doc examples.
Fix pep8 violations in the doc examples.
Python
apache-2.0
t-tran/libcloud,illfelder/libcloud,ByteInternet/libcloud,mgogoulos/libcloud,Scalr/libcloud,apache/libcloud,erjohnso/libcloud,jimbobhickville/libcloud,erjohnso/libcloud,sahildua2305/libcloud,curoverse/libcloud,sfriesel/libcloud,wrigri/libcloud,Scalr/libcloud,supertom/libcloud,sfriesel/libcloud,StackPointCloud/libcloud,a...
4f9f23f26d4117763ad179b7de8f2e206d21c13b
server.py
server.py
"""This module runs the api server.""" import os from app import flask_app, db from app.models import User, BucketList, BucketListItem from flask.ext.script import Manager, Shell from flask.ext.migrate import Migrate, MigrateCommand from flask.ext.restful import Resource, Api from app.api_v1.resources import TestResour...
"""This module runs the api server.""" import os from app import flask_app, db from app.models import User, BucketList, BucketListItem from flask.ext.script import Manager, Shell from flask.ext.migrate import Migrate, MigrateCommand from flask.ext.restful import Resource, Api from app.api_v1.resources import TestResour...
Add Login, Registration, Bucketlists endpoints.
[Feature] Add Login, Registration, Bucketlists endpoints.
Python
mit
andela-akiura/bucketlist
f22beb7995fb20c477d837c0400b77480e5f1a13
yunity/users/tests/test_model.py
yunity/users/tests/test_model.py
from django.contrib.auth import get_user_model from django.db import DataError from django.db import IntegrityError from django.test import TestCase class TestUserModel(TestCase): @classmethod def setUpClass(cls): super().setUpClass() cls.exampleuser = { 'display_name': 'bla', ...
from django.contrib.auth import get_user_model from django.db import DataError from django.db import IntegrityError from django.test import TestCase from yunity.users.factories import UserFactory class TestUserModel(TestCase): @classmethod def setUpClass(cls): super().setUpClass() cls.user = ...
Add test for model representation
Add test for model representation
Python
agpl-3.0
yunity/foodsaving-backend,yunity/yunity-core,yunity/yunity-core,yunity/foodsaving-backend,yunity/foodsaving-backend
ea48f0fbe09fbcce843b6d380743ee65a31aa8f8
app/evolver.py
app/evolver.py
import app.selector as selector import app.applier as applier from app.rules import rules def rule_representation(rule): '''Takes a Rule and returns a list of strings which represent it, in the form [name, target, replacement, environment]''' return [rule.name, rule.target, rule.replacement, rule.environ...
import app.selector as selector import app.applier as applier from app.rules import rules def rule_representation(rule): '''Takes a Rule and returns a list of strings which represent it, in the form [name, target, replacement, environment]''' return [rule.name, rule.target, rule.replacement, rule.environ...
Add transcription to and from IPA
Add transcription to and from IPA
Python
mit
kdelwat/LangEvolve,kdelwat/LangEvolve,kdelwat/LangEvolve
7c679e019d455564f2f609799b33cab75bc361c8
modules/test.py
modules/test.py
import unirest def getTeam(summonerID): response = unirest.get("https://na.api.pvp.net/api/lol/na/v1.3/game/by-summoner/" + str(summonerID) + "/recent?api_key=4ef4ddb0-44e4-4757-8cd5-6aa9f512a813", headers={ } ) return(response.body) def getFellowPlayers(response): for games in range(10): for play...
import unirest def getTeam(summonerID): response = unirest.get("https://na.api.pvp.net/api/lol/na/v1.3/game/by-summoner/" + str(summonerID) + "/recent?api_key=4ef4ddb0-44e4-4757-8cd5-6aa9f512a813", headers={ } ) return(response.body) def winOrLose(championsID, response): wlRatio = 0 kdRatio = 0 ga...
Check W/L Ratio and K/D Ratio
Check W/L Ratio and K/D Ratio
Python
apache-2.0
Timothylock/league-carnage-notifier-Raspberry-Pi,Timothylock/league-carnage-notifier-Raspberry-Pi
7eed609f1ada212046bf1c5c18084b9a598089d8
addons/purchase/__terp__.py
addons/purchase/__terp__.py
{ "name" : "Purchase Management", "version" : "1.0", "author" : "Tiny", "website" : "http://tinyerp.com/module_purchase.html", "depends" : ["base", "account", "stock"], "category" : "Generic Modules/Sales & Purchases", "init_xml" : [], "demo_xml" : ["purchase_demo.xml", "purchase_unit_test.xml"], "update_xml" ...
{ "name" : "Purchase Management", "version" : "1.0", "author" : "Tiny", "website" : "http://tinyerp.com/module_purchase.html", "depends" : ["base", "account", "stock"], "category" : "Generic Modules/Sales & Purchases", "init_xml" : [], "demo_xml" : ["purchase_demo.xml", "purchase_unit_test.xml"], "update_xml" ...
Add purchase_security.xml file entry in update_xml section
Add purchase_security.xml file entry in update_xml section bzr revid: mga@tinyerp.com-231e8ef2a888ac261ce0278ca7f6c387760d8ea3
Python
agpl-3.0
BT-ojossen/odoo,CatsAndDogsbvba/odoo,Danisan/odoo-1,chiragjogi/odoo,nhomar/odoo-mirror,tarzan0820/odoo,klunwebale/odoo,shaufi/odoo,Bachaco-ve/odoo,gvb/odoo,patmcb/odoo,abdellatifkarroum/odoo,Ernesto99/odoo,papouso/odoo,ingadhoc/odoo,camptocamp/ngo-addons-backport,bplancher/odoo,credativUK/OCB,hubsaysnuaa/odoo,addition-...
87983a254ba1d1f036a555aab73fcc07c7f5882b
doc/pyplots/plot_density.py
doc/pyplots/plot_density.py
# -*- coding: utf-8 -*- """Plot to demonstrate the density colormap. """ import numpy as np import matplotlib.pyplot as plt from netCDF4 import Dataset from mpl_toolkits.basemap import Basemap import typhon nc = Dataset('_data/test_data.nc') lon, lat = np.meshgrid(nc.variables['lon'][:], nc.variables['lat'][:]) vm...
# -*- coding: utf-8 -*- """Plot to demonstrate the density colormap. """ import matplotlib.pyplot as plt import netCDF4 import numpy as np import cartopy.crs as ccrs from cartopy.mpl.gridliner import (LONGITUDE_FORMATTER, LATITUDE_FORMATTER) from typhon.plots.maps import get_cfeatures_at_scale # Read air temperatur...
Migrate density example to cartopy.
Migrate density example to cartopy.
Python
mit
atmtools/typhon,atmtools/typhon
e9a73945d57f93ef71d971aab5ae5cc501800c17
aslo/api/gh.py
aslo/api/gh.py
import hmac import hashlib from flask import current_app as app from urllib.parse import urlparse from github import Github def verify_signature(gh_signature, body, secret): sha1 = hmac.new(secret.encode(), body, hashlib.sha1).hexdigest() return hmac.compare_digest('sha1=' + sha1, gh_signature) def auth(): ...
import hmac import hashlib from flask import current_app as app from urllib.parse import urlparse from github import Github def verify_signature(gh_signature, body, secret): sha1 = hmac.new(secret.encode(), body, hashlib.sha1).hexdigest() return hmac.compare_digest('sha1=' + sha1, gh_signature) def auth(): ...
Improve performance of find tags function
Improve performance of find tags function
Python
mit
jatindhankhar/aslo-v3,jatindhankhar/aslo-v3,jatindhankhar/aslo-v3,jatindhankhar/aslo-v3
1d9217ae9652a152033f8691f2bc5e78d3600684
server/server.py
server/server.py
from killer import kill from log import logname import os import argparse import sys from version import version_info logger = logname() def start_server(): logger.info('Starting Turtle Control System... [PID:%s PPID:%s]', os.getpid(), os.getppid()) kill() logger.info('Starting new server instance...') ...
from killer import kill from log import logname import os import argparse import sys from version import version_info logger = logname() def start_server(): logger.info('Turtle Control Software v' + version_info) logger.info('[PID:%s PPID:%s]', os.getpid(), os.getppid()) kill() logger.info('Starting n...
Add info about version to log
Add info about version to log
Python
mit
TurtleRover/Turtle-Rover-Mission-Control,TurtleRover/Turtle-Rover-Mission-Control,TurtleRover/Turtle-Rover-Mission-Control,TurtleRover/Turtle-Rover-Mission-Control,TurtleRover/Turtle-Rover-Mission-Control,TurtleRover/Turtle-Rover-Mission-Control
7c1538c9991badf205214e9f4e567cc4f1879ce6
pasta/base/ast_constants.py
pasta/base/ast_constants.py
"""Constants relevant to ast code.""" import ast NODE_TYPE_TO_TOKENS = { ast.Add: ('+',), ast.Sub: ('-',), ast.Mult: ('*',), ast.Div: ('/',), ast.Mod: ('%',), ast.BitAnd: ('&',), ast.BitOr: ('|',), ast.BitXor: ('^',), ast.FloorDiv: ('//',), ast.Pow: ('**',), ast.LShift: ('<...
"""Constants relevant to ast code.""" import ast NODE_TYPE_TO_TOKENS = { ast.Add: ('+',), ast.And: ('and',), ast.BitAnd: ('&',), ast.BitOr: ('|',), ast.BitXor: ('^',), ast.Div: ('/',), ast.Eq: ('==',), ast.FloorDiv: ('//',), ast.Gt: ('>',), ast.GtE: ('>=',), ast.In: ('in',)...
Sort ast nodes in constants + remove duplicates
Sort ast nodes in constants + remove duplicates
Python
apache-2.0
google/pasta
373ce0f89a9253065114c757d3484849349a716d
tests/data_context/test_data_context_utils.py
tests/data_context/test_data_context_utils.py
import pytest import os from great_expectations.data_context.util import ( safe_mmkdir, ) def test_safe_mmkdir(tmp_path_factory): project_path = str(tmp_path_factory.mktemp('empty_dir')) first_path = os.path.join(project_path,"first_path") safe_mmkdir(first_path) assert os.path.isdir(first_path)...
import pytest import os import six from great_expectations.data_context.util import ( safe_mmkdir, ) def test_safe_mmkdir(tmp_path_factory): project_path = str(tmp_path_factory.mktemp('empty_dir')) first_path = os.path.join(project_path,"first_path") safe_mmkdir(first_path) assert os.path.isdir(...
Add test for the intended use case
Add test for the intended use case
Python
apache-2.0
great-expectations/great_expectations,great-expectations/great_expectations,great-expectations/great_expectations,great-expectations/great_expectations
44ff3a216c1f1e22862e1cac9c33a4e3a99860a7
pyramda/iterable/reject.py
pyramda/iterable/reject.py
from pyramda.function.curry import curry from . import filter @curry def reject(f, xs): """ Acts as a compliment of `filter` :param f: function :param xs: Iterable. A sequence, a container which supports iteration or an iterator :return: list """ return list(set(xs) - set(filter(f, xs)))
from pyramda.function.curry import curry from . import filter @curry def reject(p, xs): """ Acts as a complement of `filter` :param p: predicate :param xs: Iterable. A sequence, a container which supports iteration or an iterator :return: list """ return list(set(xs) - set(filter(p, xs))...
Rename function arg and spelling fix in docstring
Rename function arg and spelling fix in docstring
Python
mit
jackfirth/pyramda
39e7bbeadab2437b5dcfc3ffda685f07a3312206
polls/models.py
polls/models.py
from django.db import models from django.contrib.auth.models import User class Poll(models.Model): question = models.CharField(max_length=255) description = models.TextField(blank=True) def count_choices(self): return self.choice_set.count() def count_total_votes(self): result = 0 ...
from django.db import models from django.conf import settings class Poll(models.Model): question = models.CharField(max_length=255) description = models.TextField(blank=True) def count_choices(self): return self.choice_set.count() def count_total_votes(self): result = 0 for c...
Support for custom user model
Support for custom user model
Python
bsd-3-clause
byteweaver/django-polls,byteweaver/django-polls
5131e5d84c498c28ab26f4eae40ba8e0223dc33c
tests/unit/compat_tests.py
tests/unit/compat_tests.py
try: import unittest2 as unittest except ImportError: import unittest from pika import compat class UtilsTests(unittest.TestCase): def test_get_linux_version_normal(self): self.assertEqual(compat.get_linux_version("4.11.0-2-amd64"), (4, 11, 0)) def test_get_linux_version_short(self): ...
try: import unittest2 as unittest except ImportError: import unittest from pika import compat class UtilsTests(unittest.TestCase): def test_get_linux_version_normal(self): self.assertEqual(compat.get_linux_version("4.11.0-2-amd64"), (4, 11, 0)) def test_get_linux_version_short(self): ...
Add a test for `get_linux_version` for GCP
Add a test for `get_linux_version` for GCP
Python
bsd-3-clause
pika/pika,vitaly-krugl/pika
a02739581d6c9dbde900c226d121b4fb889b4e2d
window.py
window.py
from PySide import QtGui from editor import Editor class MainWindow(QtGui.QMainWindow): def __init__(self, parent=None): super(MainWindow, self).__init__(parent) editor = Editor() self.setCentralWidget(editor) self.setWindowTitle("RST Previewer") self.showMaximized()
from PySide import QtGui, QtCore from editor import Editor class MainWindow(QtGui.QMainWindow): def __init__(self, parent=None): super(MainWindow, self).__init__(parent) splitter = QtGui.QSplitter(QtCore.Qt.Horizontal) treeview = QtGui.QTreeView() editor = Editor() self.s...
Add splitter with treeview/editor split.
Add splitter with treeview/editor split.
Python
bsd-3-clause
audreyr/sphinx-gui,techdragon/sphinx-gui,audreyr/sphinx-gui,techdragon/sphinx-gui
92031812b77479fe9a3dbd3ca512ba97e700384e
fusion_index/test/test_lookup.py
fusion_index/test/test_lookup.py
from axiom.store import Store from hypothesis import given from hypothesis.strategies import binary, lists, text, tuples, characters from testtools import TestCase from testtools.matchers import Equals from fusion_index.lookup import LookupEntry def axiom_text(): return text( alphabet=characters( ...
import string from axiom.store import Store from hypothesis import given from hypothesis.strategies import binary, characters, lists, text, tuples from testtools import TestCase from testtools.matchers import Equals from fusion_index.lookup import LookupEntry def axiom_text(): return text( alphabet=char...
Fix test model to be case-insensitive.
Fix test model to be case-insensitive.
Python
mit
fusionapp/fusion-index
d86fe37bb29cc8c09c4659de579d4c370a59c40b
scripts/container_log_collector.py
scripts/container_log_collector.py
# stdlib import os from pathlib import Path from pathlib import PosixPath import subprocess # Make a log directory log_path = Path("logs") log_path.mkdir(exist_ok=True) # Get the github job name and create a directory for it job_name = os.getenv("GITHUB_JOB") job_path: PosixPath = log_path / job_name job_path.mkdir(e...
# stdlib import os from pathlib import Path from pathlib import PosixPath import subprocess # Make a log directory log_path = Path("logs") log_path.mkdir(exist_ok=True) # Get the github job name and create a directory for it job_name = os.getenv("GITHUB_JOB") job_path: PosixPath = log_path / job_name job_path.mkdir(e...
Set docker log encoding to utf-8
Set docker log encoding to utf-8
Python
apache-2.0
OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft
bd9a52bdf4d0d2a80467c144b21b13e77a7d92c2
examples/redis/src/bolts.py
examples/redis/src/bolts.py
from collections import Counter from redis import StrictRedis from streamparse import Bolt class WordCountBolt(Bolt): outputs = ['word', 'count'] def initialize(self, conf, ctx): self.counter = Counter() self.total = 0 def _increment(self, word, inc_by): self.counter[word] += i...
from collections import Counter from redis import StrictRedis from streamparse import Bolt class WordCountBolt(Bolt): outputs = ['word', 'count'] def initialize(self, conf, ctx): self.counter = Counter() self.total = 0 def _increment(self, word, inc_by): self.counter[word] += i...
Make RedisWordCountBolt inherit direclty from Bolt
Make RedisWordCountBolt inherit direclty from Bolt
Python
apache-2.0
Parsely/streamparse,codywilbourn/streamparse,codywilbourn/streamparse,Parsely/streamparse
15421e7e4a7964d77bcbed5549b9616cbb9de3c1
src/ansible/forms.py
src/ansible/forms.py
from django import forms from django.conf import settings from django.forms import ModelForm from ansible.models import Playbook class AnsibleForm1(ModelForm): class Meta: model = Playbook fields = ['repository', 'username'] class AnsibleForm2(ModelForm): class Meta: model = Playbook ...
from django import forms from django.conf import settings from django.forms import ModelForm from ansible.models import Playbook class AnsibleForm1(ModelForm): class Meta: model = Playbook fields = ['repository', 'username'] class AnsibleForm2(ModelForm): class Meta: model = Playbook ...
Add Field for Playbook filename
Add Field for Playbook filename
Python
bsd-3-clause
lozadaOmr/ansible-admin,lozadaOmr/ansible-admin,lozadaOmr/ansible-admin
655c2e6c91d70dd7985518ae19606ab407ce687f
lymph/core/declarations.py
lymph/core/declarations.py
def declaration(*args, **kwargs): def decorator(factory): return Declaration(factory, *args, **kwargs) return decorator class Declaration(object): def __init__(self, factory, *args, **kwargs): self.factory = factory self.args = args self.kwargs = kwargs def install(sel...
def declaration(*args, **kwargs): def decorator(factory): return Declaration(factory, *args, **kwargs) return decorator class Declaration(object): def __init__(self, factory, *args, **kwargs): self.factory = factory self.args = args self.kwargs = kwargs def install(sel...
Return component instance from Declaration.install()
Return component instance from Declaration.install()
Python
apache-2.0
kstrempel/lymph,alazaro/lymph,lyudmildrx/lymph,alazaro/lymph,mouadino/lymph,mouadino/lymph,emulbreh/lymph,vpikulik/lymph,mamachanko/lymph,itakouna/lymph,lyudmildrx/lymph,mamachanko/lymph,emulbreh/lymph,itakouna/lymph,alazaro/lymph,lyudmildrx/lymph,mouadino/lymph,Drahflow/lymph,dushyant88/lymph,itakouna/lymph,mamachanko...
7892fd7421c39df3190c0b1f7223a8f2083d1893
common/lib/xmodule/xmodule/util/date_utils.py
common/lib/xmodule/xmodule/util/date_utils.py
import datetime def get_default_time_display(dt, show_timezone=True): """ Converts a datetime to a string representation. This is the default representation used in Studio and LMS. It is of the form "Apr 09, 2013 at 16:00" or "Apr 09, 2013 at 16:00 UTC", depending on the value of show_timezone. ...
import datetime def get_default_time_display(dt, show_timezone=True): """ Converts a datetime to a string representation. This is the default representation used in Studio and LMS. It is of the form "Apr 09, 2013 at 16:00" or "Apr 09, 2013 at 16:00 UTC", depending on the value of show_timezone. ...
Remove extraneous test for already handled edge case
Remove extraneous test for already handled edge case
Python
agpl-3.0
EduPepperPD/pepper2013,pomegranited/edx-platform,dkarakats/edx-platform,B-MOOC/edx-platform,wwj718/edx-platform,ESOedX/edx-platform,mjirayu/sit_academy,abdoosh00/edraak,Edraak/edx-platform,Ayub-Khan/edx-platform,knehez/edx-platform,nikolas/edx-platform,Kalyzee/edx-platform,ahmadio/edx-platform,cognitiveclass/edx-platfo...
7a4d878dda0b9b947a5991be63183e247ad4e022
grammpy_transforms/UnreachableSymbolsRemove/unreachableSymbolsRemove.py
grammpy_transforms/UnreachableSymbolsRemove/unreachableSymbolsRemove.py
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 17.08.207 13:29 :Licence GNUv3 Part of grammpy-transforms """ from grammpy import Grammar from copy import copy def remove_unreachable_symbols(grammar: Grammar, transform_grammar=False) -> Grammar: # Copy if required if transform_grammar is False: g...
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 17.08.207 13:29 :Licence GNUv3 Part of grammpy-transforms """ from grammpy import Grammar from grammpy.exceptions import NotNonterminalException from copy import copy class StartSymbolNotSpecifiedException(Exception): pass def remove_unreachable_symbol...
Implement removing of unreachable symbols
Implement removing of unreachable symbols
Python
mit
PatrikValkovic/grammpy
02363de7bdd7a069243da09248816f3caf38b2e6
scripts/get-month.py
scripts/get-month.py
#!/usr/bin/env python import pandas as pd import pdfplumber import requests import datetime import re from io import BytesIO def parse_date(pdf): text = pdf.pages[0].extract_text(x_tolerance=5) date_pat = r"UPDATED:\s+As of (.+)\n" updated_date = re.search(date_pat, text).group(1) d = datetime.datetime...
#!/usr/bin/env python import pandas as pd import pdfplumber import requests import datetime import re from io import BytesIO def parse_date(pdf): text = pdf.pages[0].extract_text(x_tolerance=5) date_pat = r"UPDATED:\s+As of (.+)\n" updated_date = re.search(date_pat, text).group(1) d = datetime.datetime...
Update "Active Records" PDF URL
Update "Active Records" PDF URL
Python
mit
BuzzFeedNews/nics-firearm-background-checks
7f006958e97cf5cc972d9f8340b327ea7508e03d
packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
""" Test that LLDB correctly allows scripted commands to set an immediate output file """ from __future__ import print_function import os, time import lldb from lldbsuite.test.lldbtest import * from lldbsuite.test.lldbpexpect import * class CommandScriptImmediateOutputTestCase (PExpectTest): mydir = TestBase....
""" Test that LLDB correctly allows scripted commands to set an immediate output file """ from __future__ import print_function import os, time import lldb from lldbsuite.test.lldbtest import * from lldbsuite.test.lldbpexpect import * class CommandScriptImmediateOutputTestCase (PExpectTest): mydir = TestBase....
Mark these tests on FreeBSD and Linux as non-flakey. We don't know that they are
Mark these tests on FreeBSD and Linux as non-flakey. We don't know that they are git-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@257656 91177308-0d34-0410-b5e6-96231b3b80d8
Python
apache-2.0
apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb
bab4f346cef626f29c67cc214b03db2475ef6b64
scriptcore/process/popen.py
scriptcore/process/popen.py
from subprocess import Popen as BasePopen class Popen(BasePopen): def communicate(self, input=None, timeout=None): """ Communicate :param input: Optional input :param timeout: Optional timeout :return: Out, err, exitcode """ out, err = super(Pope...
from subprocess import Popen as BasePopen class Popen(BasePopen): def communicate(self, input=None): """ Communicate :param input: Optional input :return: Out, err, exitcode """ out, err = super(Popen, self).communicate(input=input) out = out.st...
Fix error in communicate function.
Fix error in communicate function.
Python
apache-2.0
LowieHuyghe/script-core
fb9ca96431a4f72135245705359eb1f6d340a536
moksha/api/hub/__init__.py
moksha/api/hub/__init__.py
# This file is part of Moksha. # Copyright (C) 2008-2009 Red Hat, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later...
# This file is part of Moksha. # Copyright (C) 2008-2009 Red Hat, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later...
Make the MokshaHub and reactor available in the moksha.api.hub module
Make the MokshaHub and reactor available in the moksha.api.hub module
Python
apache-2.0
lmacken/moksha,pombredanne/moksha,mokshaproject/moksha,mokshaproject/moksha,ralphbean/moksha,lmacken/moksha,lmacken/moksha,mokshaproject/moksha,pombredanne/moksha,pombredanne/moksha,ralphbean/moksha,ralphbean/moksha,pombredanne/moksha,mokshaproject/moksha
fcff4e1d25abb173870fffdd0a0d1f63aca7fccf
numpy/_array_api/dtypes.py
numpy/_array_api/dtypes.py
from .. import int8, int16, int32, int64, uint8, uint16, uint32, uint64, float32, float64, bool __all__ = ['int8', 'int16', 'int32', 'int64', 'uint8', 'uint16', 'uint32', 'uint64', 'float32', 'float64', 'bool']
from .. import int8, int16, int32, int64, uint8, uint16, uint32, uint64, float32, float64 # Note: This name is changed from .. import bool_ as bool __all__ = ['int8', 'int16', 'int32', 'int64', 'uint8', 'uint16', 'uint32', 'uint64', 'float32', 'float64', 'bool']
Fix the bool name in the array API namespace
Fix the bool name in the array API namespace
Python
bsd-3-clause
mhvk/numpy,pdebuyl/numpy,mhvk/numpy,jakirkham/numpy,seberg/numpy,mattip/numpy,jakirkham/numpy,numpy/numpy,numpy/numpy,endolith/numpy,endolith/numpy,charris/numpy,rgommers/numpy,endolith/numpy,mattip/numpy,charris/numpy,pdebuyl/numpy,rgommers/numpy,simongibbons/numpy,charris/numpy,seberg/numpy,jakirkham/numpy,simongibbo...
4af9f51da1557715a1eaaac1c2828de4dfe5b7c7
lib/globals.py
lib/globals.py
"""This module contains global constants that are used throughout the project. Module Constants: SCREEN_SIZE A tuple containing the width and height of the game screen, in pixels and with a 1x scale factor. FULL_SCALE An integer for the magnification factor that will cause ...
"""This module contains global constants that are used throughout the project. Module Constants: SCREEN_SIZE A tuple containing the width and height of the game screen, in pixels and with a 1x scale factor. FULL_SCALE An integer for the magnification factor that will cause ...
Add DEFAULT_NAMES as a global tuple constant
Add DEFAULT_NAMES as a global tuple constant They will be referenced in various places in the game and should not be subject to change. INPUT_NAMES was also changed into a tuple for guaranteed immutability.
Python
unlicense
MarquisLP/Sidewalk-Champion
cd3929203e758367c3ded00a554f531aedb79f05
blaze/tests/test_blfuncs.py
blaze/tests/test_blfuncs.py
from blaze.blfuncs import BlazeFunc from blaze.datashape import double, complex128 as c128 from blaze.blaze_kernels import BlazeElementKernel import blaze def _add(a,b): return a + b def _mul(a,b): return a * b add = BlazeFunc('add',[(_add, 'f8(f8,f8)'), (_add, 'c16(c16,c16)')]) mul =...
from blaze.blfuncs import BlazeFunc from blaze.datashape import double, complex128 as c128 from blaze.blaze_kernels import BlazeElementKernel import blaze def _add(a,b): return a + b def _mul(a,b): return a * b add = BlazeFunc('add',[('f8(f8,f8)', _add), ('c16(c16,c16)', _add)]) mul =...
Fix usage of urlparse. and re-order list of key, value dict specification.
Fix usage of urlparse. and re-order list of key, value dict specification.
Python
bsd-3-clause
xlhtc007/blaze,AbhiAgarwal/blaze,mrocklin/blaze,aterrel/blaze,markflorisson/blaze-core,AbhiAgarwal/blaze,jcrist/blaze,markflorisson/blaze-core,mwiebe/blaze,AbhiAgarwal/blaze,markflorisson/blaze-core,maxalbert/blaze,alexmojaki/blaze,scls19fr/blaze,cpcloud/blaze,aterrel/blaze,mrocklin/blaze,jcrist/blaze,xlhtc007/blaze,Fr...
a329770bdd5fdc6a646d6a0b298f0a67c789f86a
resolwe/flow/migrations/0029_storage_m2m.py
resolwe/flow/migrations/0029_storage_m2m.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.16 on 2019-02-26 04:08 from __future__ import unicode_literals from django.db import migrations, models def set_data_relation(apps, schema_editor): Data = apps.get_model('flow', 'Data') Storage = apps.get_model('flow', 'Storage') for data in Data.object...
# -*- coding: utf-8 -*- # Generated by Django 1.11.16 on 2019-02-26 04:08 from __future__ import unicode_literals from django.db import migrations, models def set_data_relation(apps, schema_editor): Storage = apps.get_model('flow', 'Storage') for storage in Storage.objects.all(): storage.data.add(st...
Fix storage migration to process all storages
Fix storage migration to process all storages
Python
apache-2.0
genialis/resolwe,genialis/resolwe
e98b4f2a343643c513d8cd4cf8b34a446322b0de
watson/common/exception.py
watson/common/exception.py
"""Watson's base exception handling."""
"""Watson's base exception handling.""" class WatsonException(Exception): """Base watson exception To correctly use this class, inherit from it and define a `template` property. That `template` will be formated using the keyword arguments provided to the constructor. Example: :: ...
Add base exeption for Watson project
Add base exeption for Watson project
Python
mit
alexandrucoman/watson,c-square/watson,c-square/evorepo-common
82973662e9cc8234e741d7595c95137df77296bb
tests/unit/utils/vt_test.py
tests/unit/utils/vt_test.py
# -*- coding: utf-8 -*- ''' :codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)` :copyright: © 2013 by the SaltStack Team, see AUTHORS for more details. :license: Apache 2.0, see LICENSE for more details. tests.unit.utils.vt_test ~~~~~~~~~~~~~~~~~~~~~~~~ VirtualTerminal tests ''' # Impor...
# -*- coding: utf-8 -*- ''' :codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)` :copyright: © 2013 by the SaltStack Team, see AUTHORS for more details. :license: Apache 2.0, see LICENSE for more details. tests.unit.utils.vt_test ~~~~~~~~~~~~~~~~~~~~~~~~ VirtualTerminal tests ''' # Impor...
Disable the VT test, the code ain't mature enough.
Disable the VT test, the code ain't mature enough.
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
9506fa3a0382ba7a156ba6188c8d05bff8be5da3
falcom/api/common/read_only_data_structure.py
falcom/api/common/read_only_data_structure.py
# Copyright (c) 2017 The Regents of the University of Michigan. # All Rights Reserved. Licensed according to the terms of the Revised # BSD License. See LICENSE.txt for details. class ReadOnlyDataStructure: def __init__ (self, **kwargs): self.__internal = kwargs self.__remove_null_keys() def ...
# Copyright (c) 2017 The Regents of the University of Michigan. # All Rights Reserved. Licensed according to the terms of the Revised # BSD License. See LICENSE.txt for details. class ReadOnlyDataStructure: def __init__ (self, **kwargs): self.__internal = kwargs self.__remove_null_keys() def ...
Add repr to data structures
Add repr to data structures
Python
bsd-3-clause
mlibrary/image-conversion-and-validation,mlibrary/image-conversion-and-validation
02ac9d6234ca00f3f5382fda9941d1e0dd0f734b
src/tenyksscripts/scripts/8ball.py
src/tenyksscripts/scripts/8ball.py
import random ateball = [ "It is certain", "It is decidedly so", "Without a doubt", "Yes definitely", "You may rely on it", "As I see it yes", "Most likely", "Outlook good", "Yes", "Signs point to yes", "Reply hazy try again", ...
import random ateball = [ "It is certain.", "It is decidedly so.", "Without a doubt.", "Yes, definitely.", "You may rely on it.", "As I see it, yes.", "Most likely.", "Outlook good.", "Yes.", "Signs point to yes.", "Reply hazy, try...
Revert "Revert "Added nickname and punct, removed parens""
Revert "Revert "Added nickname and punct, removed parens"" This reverts commit ab4e279a6866d432cd1f58a07879e219360b4911.
Python
mit
cblgh/tenyks-contrib,colby/tenyks-contrib,kyleterry/tenyks-contrib
19cc42cbaa39854131c907115548abdd2cfdfc1b
todoist/managers/generic.py
todoist/managers/generic.py
# -*- coding: utf-8 -*- class Manager(object): # should be re-defined in a subclass state_name = None object_type = None def __init__(self, api): self.api = api # shortcuts @property def state(self): return self.api.state @property def queue(self): return ...
# -*- coding: utf-8 -*- class Manager(object): # should be re-defined in a subclass state_name = None object_type = None def __init__(self, api): self.api = api # shortcuts @property def state(self): return self.api.state @property def queue(self): return ...
Fix gettatr object and name.
Fix gettatr object and name.
Python
mit
Doist/todoist-python
911fa61043cb034202aacc7ca3e92ceac048265c
greengraph/graph_command.py
greengraph/graph_command.py
#!/usr/bin/env python from .greengraph import GreenGraph from .googlemap import GoogleMap from argparse import ArgumentParser import IPython if __name__ == "__main__": parser = ArgumentParser(description = 'Generate pictures between 2 location') parser.add_argument('-f', '--from', required=True, help='Starting loca...
#!/usr/bin/env python from .greengraph import GreenGraph from .googlemap import GoogleMap from argparse import ArgumentParser from IPython.display import Image from IPython.display import display if __name__ == "__main__": parser = ArgumentParser(description = 'Generate pictures between 2 location') parser.add_argu...
Fix displaying multiple images command
Fix displaying multiple images command
Python
mit
manhdao/greengraph-MPHYSG001
e54b28430f7b301e04eb5b02ce667019df4434bf
chrome/test/chromeos/autotest/files/client/site_tests/desktopui_SyncIntegrationTests/desktopui_SyncIntegrationTests.py
chrome/test/chromeos/autotest/files/client/site_tests/desktopui_SyncIntegrationTests/desktopui_SyncIntegrationTests.py
# Copyright (c) 2010 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from autotest_lib.client.cros import chrome_test class desktopui_SyncIntegrationTests(chrome_test.ChromeTestBase): version = 1 def run_once(sel...
# Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from autotest_lib.client.cros import chrome_test class desktopui_SyncIntegrationTests(chrome_test.ChromeTestBase): version = 1 binary_to_run = ...
Make the sync integration tests self-contained on autotest
Make the sync integration tests self-contained on autotest In the past, the sync integration tests used to require a password file stored on every test device in order to do a gaia sign in using production gaia servers. This caused the tests to be brittle. As of today, the sync integration tests no longer rely on a p...
Python
bsd-3-clause
wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser
1d866c7a66d0efde1b6a9beb5ecf89b9c6360b1e
spotpy/unittests/test_objectivefunctions.py
spotpy/unittests/test_objectivefunctions.py
import unittest from spotpy import objectivefunctions as of import numpy as np #https://docs.python.org/3/library/unittest.html class TestObjectiveFunctions(unittest.TestCase): # How many digits to match in case of floating point answers tolerance = 10 def setUp(self): np.random.seed(42) ...
import unittest from spotpy import objectivefunctions as of import numpy as np #https://docs.python.org/3/library/unittest.html class TestObjectiveFunctions(unittest.TestCase): # How many digits to match in case of floating point answers tolerance = 10 def setUp(self): np.random.seed(42) ...
Add tests for pbias and nashsutcliffe
Add tests for pbias and nashsutcliffe
Python
mit
bees4ever/spotpy,thouska/spotpy,thouska/spotpy,bees4ever/spotpy,bees4ever/spotpy,thouska/spotpy
ff42b726c107e75f96409894b610256068add8dc
spacy/tests/test_textcat.py
spacy/tests/test_textcat.py
import random from ..pipeline import TextCategorizer from ..lang.en import English from ..vocab import Vocab from ..tokens import Doc from ..gold import GoldParse def test_textcat_learns_multilabel(): docs = [] nlp = English() vocab = nlp.vocab letters = ['a', 'b', 'c'] for w1 in letters: ...
from __future__ import unicode_literals import random from ..pipeline import TextCategorizer from ..lang.en import English from ..vocab import Vocab from ..tokens import Doc from ..gold import GoldParse def test_textcat_learns_multilabel(): docs = [] nlp = English() vocab = nlp.vocab letters = ['a', ...
Fix unicode declaration on test
Fix unicode declaration on test
Python
mit
honnibal/spaCy,recognai/spaCy,recognai/spaCy,honnibal/spaCy,recognai/spaCy,aikramer2/spaCy,explosion/spaCy,aikramer2/spaCy,honnibal/spaCy,explosion/spaCy,aikramer2/spaCy,explosion/spaCy,explosion/spaCy,explosion/spaCy,recognai/spaCy,spacy-io/spaCy,spacy-io/spaCy,explosion/spaCy,spacy-io/spaCy,aikramer2/spaCy,spacy-io/s...
954cd7378c70ef433f5f2dc220991905fd779dc6
allauth/socialaccount/providers/eventbrite/provider.py
allauth/socialaccount/providers/eventbrite/provider.py
"""Customise Provider classes for Eventbrite API v3.""" from allauth.socialaccount.providers.base import ProviderAccount from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider class EventbriteAccount(ProviderAccount): """ProviderAccount subclass for Eventbrite.""" def get_avatar_url(self...
"""Customise Provider classes for Eventbrite API v3.""" from allauth.socialaccount.providers.base import ProviderAccount from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider class EventbriteAccount(ProviderAccount): """ProviderAccount subclass for Eventbrite.""" def get_avatar_url(self...
Remove unneeded get_default_scope from EventbriteProvider
Remove unneeded get_default_scope from EventbriteProvider
Python
mit
spool/django-allauth,spool/django-allauth,spool/django-allauth
73f9e0e3abd49746fd246f861f2897a8cd711d90
splunk_handler/__init__.py
splunk_handler/__init__.py
import logging import socket import traceback from threading import Thread import requests class SplunkHandler(logging.Handler): """ A logging handler to send events to a Splunk Enterprise instance """ def __init__(self, host, port, username, password, index): logging.Handler.__init__(self...
import logging import socket import traceback from threading import Thread import requests class SplunkHandler(logging.Handler): """ A logging handler to send events to a Splunk Enterprise instance """ def __init__(self, host, port, username, password, index, hostname=None, source=None, sourcetype=...
Add code to allow user to configure their own hostname, source, and sourcetype (with defaults)
Add code to allow user to configure their own hostname, source, and sourcetype (with defaults)
Python
mit
zach-taylor/splunk_handler,sullivanmatt/splunk_handler
952704b93004e5763231ad3e64f32135474651b2
common/templatetags/uqam.py
common/templatetags/uqam.py
from django import template register = template.Library() @register.filter def dimension(value, arg): """ Dimension integers If value, append arg, otherwise output nothing """ if value: return str(value) + " " + arg return "" @register.filter def verbose_name(obj): """ Retu...
from django import template register = template.Library() @register.filter def dimension(value, arg): """ Dimension integers If value, append arg, otherwise output nothing """ if value: return str(value) + " " + arg return "" @register.filter def verbose_name(obj): """ Retu...
Order categories in search fields
Order categories in search fields
Python
bsd-3-clause
uq-eresearch/uqam,uq-eresearch/uqam,uq-eresearch/uqam,uq-eresearch/uqam
38669acc445dc4376968bf1bb885b8b205688a6e
syncplay/ui/sound.py
syncplay/ui/sound.py
try: import winsound except ImportError: winsound = None try: import alsaaudio import wave except ImportError: alsaaudio = None from syncplay import utils def doBuzz(): if(winsound): buzzPath = utils.findWorkingDir() + "\\resources\\buzzer.wav" winsound.PlaySound(buzzPath, winso...
try: import winsound except ImportError: winsound = None try: import alsaaudio import wave except ImportError: alsaaudio = None from syncplay import utils def doBuzz(): if(winsound): buzzPath = utils.findWorkingDir() + "\\resources\\buzzer.wav" winsound.PlaySound(buzzPath, winso...
Fix for exception due to missing buzzer.wav
Fix for exception due to missing buzzer.wav
Python
apache-2.0
NeverDecaf/syncplay,alby128/syncplay,Syncplay/syncplay,alby128/syncplay,NeverDecaf/syncplay,Syncplay/syncplay
8e2fe6bd486e7c105ef7cd6f061b41efd3e42b08
tasks/base.py
tasks/base.py
import os import invoke invoke.run = os.system class BaseTest(object): def download_mspec(self): if not os.path.isdir("../mspec"): invoke.run("cd .. && git clone --depth=100 --quiet https://github.com/ruby/mspec") def download_rubyspec(self): if not os.path.isdir("../rubyspec")...
import os import invoke if os.environ.get('TRAVIS_OS_NAME') == 'osx': invoke.run = os.system class BaseTest(object): def download_mspec(self): if not os.path.isdir("../mspec"): invoke.run("cd .. && git clone --depth=100 --quiet https://github.com/ruby/mspec") def download_rubyspec(s...
Use dirty macOS workaround only on OSX on Travis
Use dirty macOS workaround only on OSX on Travis
Python
bsd-3-clause
topazproject/topaz,topazproject/topaz,topazproject/topaz,topazproject/topaz
e29f250286411c0e1c6f084f9e3f1ab4cbdfa6ec
setup.py
setup.py
#!/usr/bin/env python # Copyright (c) 2014, Michael Boyle # See LICENSE file for details: <https://github.com/moble/quaternion/blob/master/LICENSE> from auto_version import calculate_version, build_py_copy_version def configuration(parent_package='', top_path=None): import numpy from distutils.errors import...
#!/usr/bin/env python # Copyright (c) 2014, Michael Boyle # See LICENSE file for details: <https://github.com/moble/quaternion/blob/master/LICENSE> from auto_version import calculate_version, build_py_copy_version def configuration(parent_package='', top_path=None): import numpy from distutils.errors import...
Make sure the code is rebuilt if quaternion.h changes
Make sure the code is rebuilt if quaternion.h changes
Python
mit
moble/quaternion,moble/quaternion
ed09ed41e2b9486f55f801eee47f08e2a9679b6c
tests/sequence/test_alignment.py
tests/sequence/test_alignment.py
import unittest from unittest import mock from io import StringIO from cref.sequence.alignment import Blast class AlignmentTestCase(unittest.TestCase): def test_blast_local(self): blast = Blast('data/blastdb/pdbseqres') results = blast.align('AASSF') pdbs = {result.pdb_code for result in ...
import unittest from unittest import mock from io import StringIO from cref.sequence.alignment import Blast class AlignmentTestCase(unittest.TestCase): def test_blast_local(self): blast = Blast('data/blastdb/pdbseqres') results = blast.align('AASSF') pdbs = {result.pdb_code for result in ...
Fix broken test after blast web removal
Fix broken test after blast web removal
Python
mit
mchelem/cref2,mchelem/cref2,mchelem/cref2
a6ac5c901a1b677992599d6aac231e01c5e7a39d
tests/test_thread_concurrency.py
tests/test_thread_concurrency.py
''' @author: Rahul Tanwani @summary: Test cases to make sure sequential execution and concurrent execution return the same response. ''' import json from tests.test_base import TestBase from batch_requests.settings import br_settings from batch_requests.concurrent.executor import ThreadBasedExecutor class ...
''' @author: Rahul Tanwani @summary: Test cases to make sure sequential execution and concurrent execution return the same response. ''' from tests.test_concurrency_base import TestBaseConcurrency from batch_requests.concurrent.executor import ThreadBasedExecutor class TestThreadConcurrency(TestBaseConcurr...
Refactor thread based concurrency tests
Refactor thread based concurrency tests
Python
mit
tanwanirahul/django-batch-requests
1096bc339caf0ba329332633d8b9170fb8940f6f
start.py
start.py
import cursingspock from spockbot import Client from spockbot.plugins import default_plugins as plugins from bat import bat, command plugins.extend([ ('bat', bat.BatPlugin), ('commands', command.CommandPlugin), ('curses', cursingspock.CursesPlugin), ]) # login_credentials should contain a dict with 'usern...
import cursingspock from spockbot import Client from spockbot.plugins import default_plugins from bat import bat, command plugins = default_plugins.copy() plugins.extend([ ('bat', bat.BatPlugin), ('commands', command.CommandPlugin), ('curses', cursingspock.CursesPlugin), ]) # login_credentials should cont...
Copy default plugins and extend
Copy default plugins and extend
Python
mit
Gjum/Bat