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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a1583d181170302df72fc0a97e5db7f6300061b3 | tests/__init__.py | tests/__init__.py | #
| import os
DATADIR = os.path.abspath('docs/data')
FILES = ['test_uk.shp', 'test_uk.shx', 'test_uk.dbf', 'test_uk.prj']
def create_zipfile(zipfilename):
import zipfile
with zipfile.ZipFile(zipfilename, 'w') as zip:
for filename in FILES:
zip.write(os.path.join(DATADIR, filename), filename)
... | Create derived test data files if they do not exist when running nosetests | Create derived test data files if they do not exist when running nosetests
| Python | bsd-3-clause | perrygeo/Fiona,rbuffat/Fiona,perrygeo/Fiona,johanvdw/Fiona,Toblerity/Fiona,rbuffat/Fiona,Toblerity/Fiona | import os
DATADIR = os.path.abspath('docs/data')
FILES = ['test_uk.shp', 'test_uk.shx', 'test_uk.dbf', 'test_uk.prj']
def create_zipfile(zipfilename):
import zipfile
with zipfile.ZipFile(zipfilename, 'w') as zip:
for filename in FILES:
zip.write(os.path.join(DATADIR, filename), filename)
... | Create derived test data files if they do not exist when running nosetests
#
|
e1791d929bccd1f5e9382e45fb90bd8257ef597d | src/toil/version.py | src/toil/version.py | # Copyright (C) 2015 UCSC Computational Genomics Lab
#
# 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 o... | # Copyright (C) 2015 UCSC Computational Genomics Lab
#
# 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 o... | Prepare next development cycle 3.1.0a1 | Prepare next development cycle 3.1.0a1
| Python | apache-2.0 | BD2KGenomics/slugflow,BD2KGenomics/slugflow | # Copyright (C) 2015 UCSC Computational Genomics Lab
#
# 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 o... | Prepare next development cycle 3.1.0a1
# Copyright (C) 2015 UCSC Computational Genomics Lab
#
# 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... |
0ff547915fc9de3d5edb80cc31a0f561453f3687 | salt/returners/syslog_return.py | salt/returners/syslog_return.py | '''
Return data to the host operating system's syslog facility
Required python modules: syslog, json
The syslog returner simply reuses the operating system's syslog
facility to log return data
'''
# Import python libs
import syslog
import json
def __virtual__():
return 'syslog'
def returner(ret):
'''
... | '''
Return data to the host operating system's syslog facility
Required python modules: syslog, json
The syslog returner simply reuses the operating system's syslog
facility to log return data
'''
# Import python libs
import syslog
import json
try:
import syslog
HAS_SYSLOG = True
except ImportError:
HAS_... | Check for syslog. Doesn't exist on Windows | Check for syslog. Doesn't exist on Windows
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | '''
Return data to the host operating system's syslog facility
Required python modules: syslog, json
The syslog returner simply reuses the operating system's syslog
facility to log return data
'''
# Import python libs
import syslog
import json
try:
import syslog
HAS_SYSLOG = True
except ImportError:
HAS_... | Check for syslog. Doesn't exist on Windows
'''
Return data to the host operating system's syslog facility
Required python modules: syslog, json
The syslog returner simply reuses the operating system's syslog
facility to log return data
'''
# Import python libs
import syslog
import json
def __virtual__():
retu... |
daa4021011778f7511ad2c97648155bb17539d98 | tests/func/test_examples.py | tests/func/test_examples.py | import pytest # noqa
import os
import sys
import glob
import imp
def test_examples():
examples_pat = os.path.join(os.path.abspath(os.path.dirname(__file__)),
'../../examples/*/*.py')
# Filter out __init__.py
examples = [f for f in glob.glob(examples_pat)
... | import pytest # noqa
import os
import sys
import glob
import importlib
def test_examples():
examples_pat = os.path.join(os.path.abspath(os.path.dirname(__file__)),
'../../examples/*/*.py')
# Filter out __init__.py
examples = [f for f in glob.glob(examples_pat)
... | Replace deprecated imp with importlib | Replace deprecated imp with importlib
| Python | mit | igordejanovic/parglare,igordejanovic/parglare | import pytest # noqa
import os
import sys
import glob
import importlib
def test_examples():
examples_pat = os.path.join(os.path.abspath(os.path.dirname(__file__)),
'../../examples/*/*.py')
# Filter out __init__.py
examples = [f for f in glob.glob(examples_pat)
... | Replace deprecated imp with importlib
import pytest # noqa
import os
import sys
import glob
import imp
def test_examples():
examples_pat = os.path.join(os.path.abspath(os.path.dirname(__file__)),
'../../examples/*/*.py')
# Filter out __init__.py
examples = [f for f in ... |
3d52040663eaef07aa3e9d13500819b4633f1187 | typhon/tests/spareice/test_array.py | typhon/tests/spareice/test_array.py | import numpy as np
from typhon.spareice import Array, GroupedArrays
import xarray as xr
class TestArray:
"""Testing the array methods."""
pass
class TestGroupedArrays:
"""Testing the GroupedArrays methods."""
def test_dict(self):
# TODO: Implement test for export to / import from python dic... | Implement test class for Array and GroupedArrays | Implement test class for Array and GroupedArrays
| Python | mit | atmtools/typhon,atmtools/typhon | import numpy as np
from typhon.spareice import Array, GroupedArrays
import xarray as xr
class TestArray:
"""Testing the array methods."""
pass
class TestGroupedArrays:
"""Testing the GroupedArrays methods."""
def test_dict(self):
# TODO: Implement test for export to / import from python dic... | Implement test class for Array and GroupedArrays
| |
b6052b35235a09f508aa75012badc830df8bcfa0 | sethji/views/sync.py | sethji/views/sync.py | # -*- coding: utf-8 -*-
#
from sethji.model.sync import SyncAws
from sethji.views.account import requires_login
from flask import Blueprint, redirect, url_for, flash, request
mod = Blueprint('sync', __name__, url_prefix='/sync')
@mod.route("/", methods=["POST"])
@requires_login
def sync():
sync_aws = SyncAws()... | # -*- coding: utf-8 -*-
#
from sethji.model.sync import SyncAws
from sethji.views.account import requires_login
from flask import Blueprint, redirect, url_for, flash
mod = Blueprint('sync', __name__, url_prefix='/sync')
@mod.route("/", methods=["POST"])
@requires_login
def sync():
sync_aws = SyncAws()
sync... | Revert "Redirect to same page" | Revert "Redirect to same page"
This reverts commit 1f49ee31c21e1bebefb3be9ecc9e4df7c115a5ef.
| Python | mit | rohit01/sethji,rohit01/sethji,rohit01/sethji | # -*- coding: utf-8 -*-
#
from sethji.model.sync import SyncAws
from sethji.views.account import requires_login
from flask import Blueprint, redirect, url_for, flash
mod = Blueprint('sync', __name__, url_prefix='/sync')
@mod.route("/", methods=["POST"])
@requires_login
def sync():
sync_aws = SyncAws()
sync... | Revert "Redirect to same page"
This reverts commit 1f49ee31c21e1bebefb3be9ecc9e4df7c115a5ef.
# -*- coding: utf-8 -*-
#
from sethji.model.sync import SyncAws
from sethji.views.account import requires_login
from flask import Blueprint, redirect, url_for, flash, request
mod = Blueprint('sync', __name__, url_prefix='/... |
4c813a82d0035c9f49e0b07f54150676c5dd8faf | run_tests.py | run_tests.py | #!/usr/bin/python
import optparse
import sys
import unittest2
USAGE = """%prog SDK_PATH TEST_PATH <THIRD_PARTY>
Run unit tests for App Engine apps.
SDK_PATH Path to the SDK installation
TEST_PATH Path to package containing test modules
THIRD_PARTY Optional path to third party python modules to include."""
def ... | #!/usr/bin/python
import optparse
import sys
import unittest2
USAGE = """%prog SDK_PATH TEST_PATH <THIRD_PARTY>
Run unit tests for App Engine apps.
SDK_PATH Path to the SDK installation
TEST_PATH Path to package containing test modules
THIRD_PARTY Optional path to third party python modules to include."""
def ... | Make sure the tests exit with status 1 when there are errors or failures | Make sure the tests exit with status 1 when there are errors or failures | Python | apache-2.0 | google/gae-secure-scaffold-python,google/gae-secure-scaffold-python3,google/gae-secure-scaffold-python,google/gae-secure-scaffold-python | #!/usr/bin/python
import optparse
import sys
import unittest2
USAGE = """%prog SDK_PATH TEST_PATH <THIRD_PARTY>
Run unit tests for App Engine apps.
SDK_PATH Path to the SDK installation
TEST_PATH Path to package containing test modules
THIRD_PARTY Optional path to third party python modules to include."""
def ... | Make sure the tests exit with status 1 when there are errors or failures
#!/usr/bin/python
import optparse
import sys
import unittest2
USAGE = """%prog SDK_PATH TEST_PATH <THIRD_PARTY>
Run unit tests for App Engine apps.
SDK_PATH Path to the SDK installation
TEST_PATH Path to package containing test modules
THI... |
1004cc88032e816116bd46f2eb66e4b89f3f766f | tests/test_web_caller.py | tests/test_web_caller.py | from unittest import TestCase
from mock import NonCallableMock, patch
from modules.web_caller import get_google, GOOGLE_URL
class TestWebCaller(TestCase):
"""
Tests for the `web_caller` module.
"""
@patch('modules.web_caller.requests.get')
def test_get_google(self, get):
"""
Call... | from unittest import TestCase
from requests.exceptions import ConnectionError
from mock import NonCallableMock, patch
from modules.web_caller import get_google, GOOGLE_URL
MOCK_GOOGLE_URL = 'http://not-going-to-work!!!'
class TestWebCaller(TestCase):
"""
Tests for the `web_caller` module.
"""
@patc... | Add test examples to assert against exceptions | Add test examples to assert against exceptions
| Python | mit | tkh/test-examples,tkh/test-examples | from unittest import TestCase
from requests.exceptions import ConnectionError
from mock import NonCallableMock, patch
from modules.web_caller import get_google, GOOGLE_URL
MOCK_GOOGLE_URL = 'http://not-going-to-work!!!'
class TestWebCaller(TestCase):
"""
Tests for the `web_caller` module.
"""
@patc... | Add test examples to assert against exceptions
from unittest import TestCase
from mock import NonCallableMock, patch
from modules.web_caller import get_google, GOOGLE_URL
class TestWebCaller(TestCase):
"""
Tests for the `web_caller` module.
"""
@patch('modules.web_caller.requests.get')
def test... |
4d0295eb55e92a8885b4e48749f6db019e2fb5a3 | django/users/migrations/0002_auto_20140922_0843.py | django/users/migrations/0002_auto_20140922_0843.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def add_echonest_forward(apps, schema_editor):
"""Create echonest user."""
User = apps.get_model("users", "User")
User.objects.update_or_create(email='echonest')
def add_echonest_backward(apps, sche... | Add migration to create echonest user | Add migration to create echonest user
| Python | bsd-3-clause | FreeMusicNinja/freemusic.ninja,FreeMusicNinja/freemusic.ninja | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def add_echonest_forward(apps, schema_editor):
"""Create echonest user."""
User = apps.get_model("users", "User")
User.objects.update_or_create(email='echonest')
def add_echonest_backward(apps, sche... | Add migration to create echonest user
| |
53b176674f1d72396b066705e502b5fcbee16a91 | vulyk/plugins/dummy/__init__.py | vulyk/plugins/dummy/__init__.py | import json
import logging
from werkzeug.utils import import_string
logger = logging.getLogger(__name__)
def get_task(request):
return json.dumps({})
def configure(self_settings):
"""
Getting plugin's default settings, overwriting them with settings
from local_settings.py, returns list of setting... | import json
import logging
from werkzeug.utils import import_string
logger = logging.getLogger(__name__)
def get_task(request):
return json.dumps({})
def configure(self_settings):
"""
Getting plugin's default settings, overwriting them with settings
from local_settings.py, returns dict of setting... | Fix return format of plugin's settings | Fix return format of plugin's settings
| Python | bsd-3-clause | mrgambal/vulyk,mrgambal/vulyk,mrgambal/vulyk | import json
import logging
from werkzeug.utils import import_string
logger = logging.getLogger(__name__)
def get_task(request):
return json.dumps({})
def configure(self_settings):
"""
Getting plugin's default settings, overwriting them with settings
from local_settings.py, returns dict of setting... | Fix return format of plugin's settings
import json
import logging
from werkzeug.utils import import_string
logger = logging.getLogger(__name__)
def get_task(request):
return json.dumps({})
def configure(self_settings):
"""
Getting plugin's default settings, overwriting them with settings
from lo... |
431ca01ca4d62c68c3e8ab858138f5fa9b1f2d4c | validity.py | validity.py | import pandas as pd
import numpy as np
import operator,os
def extract( file_name ):
with open(file_name) as f:
for i,line in enumerate(f,1):
if "SCN" in line:
return i
def main(lta_file):
os.system('ltahdr -i ' + lta_file + '> lta_header')
dictionary = {}
skipped_r... | Add file to extract source name from LTA header | Add file to extract source name from LTA header
| Python | mit | NCRA-TIFR/gadpu,NCRA-TIFR/gadpu | import pandas as pd
import numpy as np
import operator,os
def extract( file_name ):
with open(file_name) as f:
for i,line in enumerate(f,1):
if "SCN" in line:
return i
def main(lta_file):
os.system('ltahdr -i ' + lta_file + '> lta_header')
dictionary = {}
skipped_r... | Add file to extract source name from LTA header
| |
8da4e9015df3e0e8ca03c0261c05970294451421 | setup.py | setup.py | # -*- coding: utf-8 -*-
#
# © 2014 Ian Eure
# Author: Ian Eure
#
from setuptools import setup, find_packages
setup(name="yar",
version="0.0.2",
packages=find_packages(),
tests_require=['nose'],
install_requires=["pyserial==2.7"],
test_suite="nose.collector",
entry_points = {
... | # -*- coding: utf-8 -*-
#
# © 2014 Ian Eure
# Author: Ian Eure
#
from setuptools import setup, find_packages
# Dumb bug https://groups.google.com/forum/#!msg/nose-users/fnJ-kAUbYHQ/ngz3qjdnrioJ
import multiprocessing
setup(name="yar",
version="0.0.2",
packages=find_packages(),
tests_require=['nose']... | Work around a dumb nose bug | Work around a dumb nose bug
| Python | bsd-3-clause | ieure/yar | # -*- coding: utf-8 -*-
#
# © 2014 Ian Eure
# Author: Ian Eure
#
from setuptools import setup, find_packages
# Dumb bug https://groups.google.com/forum/#!msg/nose-users/fnJ-kAUbYHQ/ngz3qjdnrioJ
import multiprocessing
setup(name="yar",
version="0.0.2",
packages=find_packages(),
tests_require=['nose']... | Work around a dumb nose bug
# -*- coding: utf-8 -*-
#
# © 2014 Ian Eure
# Author: Ian Eure
#
from setuptools import setup, find_packages
setup(name="yar",
version="0.0.2",
packages=find_packages(),
tests_require=['nose'],
install_requires=["pyserial==2.7"],
test_suite="nose.collector",
... |
9127e56a26e836c7e2a66359a9f9b67e6c7f8474 | ovp_users/tests/test_filters.py | ovp_users/tests/test_filters.py | from django.test import TestCase
from ovp_users.recover_password import RecoveryTokenFilter
from ovp_users.recover_password import RecoverPasswordFilter
def test_filter(c):
obj = c()
obj.filter_queryset('a', 'b', 'c')
obj.get_fields('a')
def TestPasswordRecoveryFilters(TestCase):
def test_filters():
"""A... | from django.test import TestCase
from ovp_users.recover_password import RecoveryTokenFilter
from ovp_users.recover_password import RecoverPasswordFilter
def test_filter(c):
obj = c()
obj.filter_queryset('a', 'b', 'c')
obj.get_fields('a')
def PasswordRecoveryFiltersTestCase(TestCase):
def test_filters():
... | Fix PasswordRecovery test case name | Fix PasswordRecovery test case name
| Python | agpl-3.0 | OpenVolunteeringPlatform/django-ovp-users,OpenVolunteeringPlatform/django-ovp-users | from django.test import TestCase
from ovp_users.recover_password import RecoveryTokenFilter
from ovp_users.recover_password import RecoverPasswordFilter
def test_filter(c):
obj = c()
obj.filter_queryset('a', 'b', 'c')
obj.get_fields('a')
def PasswordRecoveryFiltersTestCase(TestCase):
def test_filters():
... | Fix PasswordRecovery test case name
from django.test import TestCase
from ovp_users.recover_password import RecoveryTokenFilter
from ovp_users.recover_password import RecoverPasswordFilter
def test_filter(c):
obj = c()
obj.filter_queryset('a', 'b', 'c')
obj.get_fields('a')
def TestPasswordRecoveryFilters(Test... |
c55d917b28c41d363e2dea8ecaf750a431f016da | migrations/versions/0364_drop_old_column.py | migrations/versions/0364_drop_old_column.py | """
Revision ID: 0364_drop_old_column
Revises: 0363_cancelled_by_api_key
Create Date: 2022-01-25 18:05:27.750234
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = '0364_drop_old_column'
down_revision = '0363_cancelled_by_api_key'
def upgrade():
# move data... | Drop api_key_id column from broadcast_message table | Drop api_key_id column from broadcast_message table
This column has been superseded by a new column named
created_by_api_key_id.
Also create constraint checking that we know who created broadcast
Also move data so that constraint is met before instatiating it.
| Python | mit | alphagov/notifications-api,alphagov/notifications-api | """
Revision ID: 0364_drop_old_column
Revises: 0363_cancelled_by_api_key
Create Date: 2022-01-25 18:05:27.750234
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = '0364_drop_old_column'
down_revision = '0363_cancelled_by_api_key'
def upgrade():
# move data... | Drop api_key_id column from broadcast_message table
This column has been superseded by a new column named
created_by_api_key_id.
Also create constraint checking that we know who created broadcast
Also move data so that constraint is met before instatiating it.
| |
f7f5bc45f6c3e86e9ea77be7a9be16d86465e3b3 | perfkitbenchmarker/linux_packages/mysqlclient56.py | perfkitbenchmarker/linux_packages/mysqlclient56.py | # Copyright 2014 PerfKitBenchmarker Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | # Copyright 2014 PerfKitBenchmarker Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | Install mysqlclient from HTTPs repo. | Install mysqlclient from HTTPs repo.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=263786009
| Python | apache-2.0 | GoogleCloudPlatform/PerfKitBenchmarker,GoogleCloudPlatform/PerfKitBenchmarker,GoogleCloudPlatform/PerfKitBenchmarker,GoogleCloudPlatform/PerfKitBenchmarker | # Copyright 2014 PerfKitBenchmarker Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | Install mysqlclient from HTTPs repo.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=263786009
# Copyright 2014 PerfKitBenchmarker Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the ... |
116babc38e2e4023eb0b45eabc02050ed433e240 | scripts/mod_info.py | scripts/mod_info.py | # mod_info.py
#
# Display information about a Protracker module.
#
# Written & released by Keir Fraser <keir.xen@gmail.com>
#
# This is free and unencumbered software released into the public domain.
# See the file COPYING for more details, or visit <http://unlicense.org>.
import struct, sys
with open(sys.argv[1],... | Include a helpful MOD analyser script | scripts: Include a helpful MOD analyser script
| Python | unlicense | keirf/Amiga-Stuff,keirf/Amiga-Stuff | # mod_info.py
#
# Display information about a Protracker module.
#
# Written & released by Keir Fraser <keir.xen@gmail.com>
#
# This is free and unencumbered software released into the public domain.
# See the file COPYING for more details, or visit <http://unlicense.org>.
import struct, sys
with open(sys.argv[1],... | scripts: Include a helpful MOD analyser script
| |
87b708002b80be80657c0eb1d7670fe40f1d992d | setup.py | setup.py | from setuptools import setup
REPO_URL = 'http://github.com/datasciencebr/serenata-toolbox'
setup(
author='Serenata de Amor',
author_email='op.serenatadeamor@gmail.com',
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Science/Research',
'License :: OSI Approve... | from setuptools import setup
REPO_URL = 'http://github.com/datasciencebr/serenata-toolbox'
setup(
author='Serenata de Amor',
author_email='op.serenatadeamor@gmail.com',
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Science/Research',
'License :: OSI Approve... | Change version from 12.3.0 to 12.3.1 | Change version from 12.3.0 to 12.3.1
| Python | mit | datasciencebr/serenata-toolbox | from setuptools import setup
REPO_URL = 'http://github.com/datasciencebr/serenata-toolbox'
setup(
author='Serenata de Amor',
author_email='op.serenatadeamor@gmail.com',
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Science/Research',
'License :: OSI Approve... | Change version from 12.3.0 to 12.3.1
from setuptools import setup
REPO_URL = 'http://github.com/datasciencebr/serenata-toolbox'
setup(
author='Serenata de Amor',
author_email='op.serenatadeamor@gmail.com',
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Science/Rese... |
c09a8ce5bb47db4ea4381925ec07199415ae5c39 | spacy/tests/integration/test_load_languages.py | spacy/tests/integration/test_load_languages.py | # encoding: utf8
from __future__ import unicode_literals
from ...fr import French
def test_load_french():
nlp = French()
doc = nlp(u'Parlez-vous français?')
| # encoding: utf8
from __future__ import unicode_literals
from ...fr import French
def test_load_french():
nlp = French()
doc = nlp(u'Parlez-vous français?')
assert doc[0].text == u'Parlez'
assert doc[1].text == u'-'
assert doc[2].text == u'vouz'
assert doc[3].text == u'français'
assert doc[... | Add test for french tokenizer | Add test for french tokenizer
| Python | mit | raphael0202/spaCy,recognai/spaCy,raphael0202/spaCy,recognai/spaCy,honnibal/spaCy,aikramer2/spaCy,raphael0202/spaCy,banglakit/spaCy,oroszgy/spaCy.hu,aikramer2/spaCy,spacy-io/spaCy,explosion/spaCy,recognai/spaCy,aikramer2/spaCy,banglakit/spaCy,recognai/spaCy,spacy-io/spaCy,Gregory-Howard/spaCy,recognai/spaCy,banglakit/sp... | # encoding: utf8
from __future__ import unicode_literals
from ...fr import French
def test_load_french():
nlp = French()
doc = nlp(u'Parlez-vous français?')
assert doc[0].text == u'Parlez'
assert doc[1].text == u'-'
assert doc[2].text == u'vouz'
assert doc[3].text == u'français'
assert doc[... | Add test for french tokenizer
# encoding: utf8
from __future__ import unicode_literals
from ...fr import French
def test_load_french():
nlp = French()
doc = nlp(u'Parlez-vous français?')
|
3040c42aab5eb09e3e91095ac53b1f3e6b9d7610 | setup.py | setup.py | # -*- coding: utf-8 -*-
import os
from setuptools import setup
def read(fname):
try:
return open(os.path.join(os.path.dirname(__file__), fname)).read()
except Exception:
return ""
setup(
name="todoist-python",
version="8.1.1",
packages=["todoist", "todoist.managers"],
author... | # -*- coding: utf-8 -*-
import os
from setuptools import setup
def read(fname):
try:
return open(os.path.join(os.path.dirname(__file__), fname)).read()
except Exception:
return ""
setup(
name="todoist-python",
version="8.1.2",
packages=["todoist", "todoist.managers"],
author... | Update the PyPI version to 8.1.2. | Update the PyPI version to 8.1.2.
| Python | mit | Doist/todoist-python | # -*- coding: utf-8 -*-
import os
from setuptools import setup
def read(fname):
try:
return open(os.path.join(os.path.dirname(__file__), fname)).read()
except Exception:
return ""
setup(
name="todoist-python",
version="8.1.2",
packages=["todoist", "todoist.managers"],
author... | Update the PyPI version to 8.1.2.
# -*- coding: utf-8 -*-
import os
from setuptools import setup
def read(fname):
try:
return open(os.path.join(os.path.dirname(__file__), fname)).read()
except Exception:
return ""
setup(
name="todoist-python",
version="8.1.1",
packages=["todois... |
6a3eda2781f1ea4ed7106313fdc5b7c40786304c | tests/integration/mci/test_backwards_navigation_after_submission.py | tests/integration/mci/test_backwards_navigation_after_submission.py | from .test_happy_path import TestHappyPath
class TestbackwardsNavigationAfterSubmission(TestHappyPath):
def test_backwards_navigation(self):
self.test_happy_path()
resp = self.client.get('/submission', follow_redirects=False)
self.assertEquals(resp.status_code, 302)
self.assertReg... | Add test for navigating backwards, after submission - failing | Add test for navigating backwards, after submission - failing
| Python | mit | ONSdigital/eq-survey-runner,ONSdigital/eq-survey-runner,ONSdigital/eq-survey-runner,ONSdigital/eq-survey-runner | from .test_happy_path import TestHappyPath
class TestbackwardsNavigationAfterSubmission(TestHappyPath):
def test_backwards_navigation(self):
self.test_happy_path()
resp = self.client.get('/submission', follow_redirects=False)
self.assertEquals(resp.status_code, 302)
self.assertReg... | Add test for navigating backwards, after submission - failing
| |
43eddc3663f64e92a673c09ce52ddcd50b935842 | ipywidgets/widgets/tests/test_widget_float.py | ipywidgets/widgets/tests/test_widget_float.py |
from unittest import TestCase
from traitlets import TraitError
from ipywidgets import FloatSlider
class TestFloatSlider(TestCase):
def test_construction(self):
FloatSlider()
def test_construction_readout_format(self):
slider = FloatSlider(readout_format='$.1f')
assert slider.get_s... | Test that the float slider uses the NumberFormat traitlet | Test that the float slider uses the NumberFormat traitlet
| Python | bsd-3-clause | ipython/ipywidgets,ipython/ipywidgets,ipython/ipywidgets,ipython/ipywidgets,SylvainCorlay/ipywidgets,jupyter-widgets/ipywidgets,SylvainCorlay/ipywidgets,jupyter-widgets/ipywidgets,SylvainCorlay/ipywidgets,jupyter-widgets/ipywidgets,jupyter-widgets/ipywidgets,ipython/ipywidgets,SylvainCorlay/ipywidgets |
from unittest import TestCase
from traitlets import TraitError
from ipywidgets import FloatSlider
class TestFloatSlider(TestCase):
def test_construction(self):
FloatSlider()
def test_construction_readout_format(self):
slider = FloatSlider(readout_format='$.1f')
assert slider.get_s... | Test that the float slider uses the NumberFormat traitlet
| |
fac9d34d6c514f33bb97760fcc391ffa17cb7b5d | zerver/management/commands/queue_digest_emails.py | zerver/management/commands/queue_digest_emails.py | from __future__ import absolute_import
import datetime
import pytz
from django.core.management.base import BaseCommand
from zerver.lib.queue import queue_json_publish
from zerver.models import UserActivity, get_user_profile_by_email
VALID_DIGEST_DAYS = (1, 2, 3)
def inactive_since(user_profile, cutoff):
# Hasn't... | Add a management command to enqueue digest email recipients. | digest: Add a management command to enqueue digest email recipients.
(imported from commit 70ff2c7a4dae654f4077041c45e2154b3ac7afb7)
| Python | apache-2.0 | jonesgithub/zulip,Drooids/zulip,littledogboy/zulip,zorojean/zulip,andersk/zulip,hj3938/zulip,MariaFaBella85/zulip,ashwinirudrappa/zulip,krtkmj/zulip,AZtheAsian/zulip,hustlzp/zulip,Diptanshu8/zulip,dxq-git/zulip,itnihao/zulip,mdavid/zulip,so0k/zulip,zhaoweigg/zulip,susansls/zulip,aps-sids/zulip,verma-varsha/zulip,ApsOps... | from __future__ import absolute_import
import datetime
import pytz
from django.core.management.base import BaseCommand
from zerver.lib.queue import queue_json_publish
from zerver.models import UserActivity, get_user_profile_by_email
VALID_DIGEST_DAYS = (1, 2, 3)
def inactive_since(user_profile, cutoff):
# Hasn't... | digest: Add a management command to enqueue digest email recipients.
(imported from commit 70ff2c7a4dae654f4077041c45e2154b3ac7afb7)
| |
02ef868100ab190b5fa3bff5bad4891f21101ee2 | getkey/__init__.py | getkey/__init__.py | from __future__ import absolute_import
from .platforms import platform
__platform = platform()
getkey = __platform.getkey
keys = __platform.keys
key = keys # alias
bang = __platform.bang
# __all__ = [getkey, key, bang, platform]
__version__ = '0.6'
| from __future__ import absolute_import, print_function
import sys
from .platforms import platform, PlatformError
try:
__platform = platform()
except PlatformError as err:
print('Error initializing standard platform: {}'.format(err.args[0]),
file=sys.stderr)
else:
getkey = __platform.getkey
ke... | Handle test environment with no real stdin | Handle test environment with no real stdin
| Python | mit | kcsaff/getkey | from __future__ import absolute_import, print_function
import sys
from .platforms import platform, PlatformError
try:
__platform = platform()
except PlatformError as err:
print('Error initializing standard platform: {}'.format(err.args[0]),
file=sys.stderr)
else:
getkey = __platform.getkey
ke... | Handle test environment with no real stdin
from __future__ import absolute_import
from .platforms import platform
__platform = platform()
getkey = __platform.getkey
keys = __platform.keys
key = keys # alias
bang = __platform.bang
# __all__ = [getkey, key, bang, platform]
__version__ = '0.6'
|
9710af9d9e350d8331736d76f27af1fb46671aa2 | salt/beacons/twilio_txt_msg.py | salt/beacons/twilio_txt_msg.py | # -*- coding: utf-8 -*-
'''
Beacon to emit Twilio text messages
'''
# Import Python libs
from __future__ import absolute_import
from datetime import datetime
import logging
# Import 3rd Party libs
try:
from twilio.rest import TwilioRestClient
HAS_TWILIO = True
except ImportError:
HAS_TWILIO = False
log =... | Add Twilio text message beacon | Add Twilio text message beacon
This beacon will poll a Twilio account for text messages
and emit an event on Salt's event bus as texts are received.
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | # -*- coding: utf-8 -*-
'''
Beacon to emit Twilio text messages
'''
# Import Python libs
from __future__ import absolute_import
from datetime import datetime
import logging
# Import 3rd Party libs
try:
from twilio.rest import TwilioRestClient
HAS_TWILIO = True
except ImportError:
HAS_TWILIO = False
log =... | Add Twilio text message beacon
This beacon will poll a Twilio account for text messages
and emit an event on Salt's event bus as texts are received.
| |
2ff14d38266322d3e428c29a01a3de5015269166 | package/src/get_rss_feeds.py | package/src/get_rss_feeds.py | # Chap07/blogs_rss_get_posts.py
import json
from argparse import ArgumentParser
import feedparser
def get_parser():
parser = ArgumentParser()
parser.add_argument('--rss-url')
parser.add_argument('--json')
return parser
if __name__ == '__main__':
parser = get_parser()
args = parser.parse_args... | Add minimal feed sourcing example | Add minimal feed sourcing example
| Python | mit | MrKriss/full-fact-rss-miner | # Chap07/blogs_rss_get_posts.py
import json
from argparse import ArgumentParser
import feedparser
def get_parser():
parser = ArgumentParser()
parser.add_argument('--rss-url')
parser.add_argument('--json')
return parser
if __name__ == '__main__':
parser = get_parser()
args = parser.parse_args... | Add minimal feed sourcing example
| |
20c6e2d41e0848fddb3ff3829720ab43a71f41a9 | ideascube/conf/kb_babylab_civ.py | ideascube/conf/kb_babylab_civ.py | # -*- coding: utf-8 -*-
"""KoomBook conf"""
from .kb import * # noqa
from django.utils.translation import ugettext_lazy as _
LANGUAGE_CODE = 'fr'
IDEASCUBE_NAME = 'BabyLab'
HOME_CARDS = STAFF_HOME_CARDS + [
{
'id': 'blog',
},
{
'id': 'mediacenter',
},
{
'id': 'bsfcampus',
... | Add conf file for BabyLab KoomBook | Add conf file for BabyLab KoomBook
| Python | agpl-3.0 | ideascube/ideascube,ideascube/ideascube,ideascube/ideascube,ideascube/ideascube | # -*- coding: utf-8 -*-
"""KoomBook conf"""
from .kb import * # noqa
from django.utils.translation import ugettext_lazy as _
LANGUAGE_CODE = 'fr'
IDEASCUBE_NAME = 'BabyLab'
HOME_CARDS = STAFF_HOME_CARDS + [
{
'id': 'blog',
},
{
'id': 'mediacenter',
},
{
'id': 'bsfcampus',
... | Add conf file for BabyLab KoomBook
| |
0b8e99a6c7ecf5b35c61ce4eed1b2eec3110d41d | runtests.py | runtests.py | import os
import sys
# Force this to happen before loading django
try:
os.environ["DJANGO_SETTINGS_MODULE"] = "testtinymce.settings"
test_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, test_dir)
except ImportError:
pass
else:
import django
from django.conf ... | import argparse
import os
import sys
# Force this to happen before loading django
try:
os.environ["DJANGO_SETTINGS_MODULE"] = "testtinymce.settings"
test_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, test_dir)
except ImportError:
pass
else:
import django
f... | Add ability to run tests with verbosity and failfast options | Add ability to run tests with verbosity and failfast options
| Python | mit | aljosa/django-tinymce,aljosa/django-tinymce,aljosa/django-tinymce,aljosa/django-tinymce | import argparse
import os
import sys
# Force this to happen before loading django
try:
os.environ["DJANGO_SETTINGS_MODULE"] = "testtinymce.settings"
test_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, test_dir)
except ImportError:
pass
else:
import django
f... | Add ability to run tests with verbosity and failfast options
import os
import sys
# Force this to happen before loading django
try:
os.environ["DJANGO_SETTINGS_MODULE"] = "testtinymce.settings"
test_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, test_dir)
except Impor... |
c54a1286200ce62ef5eddef436428c2244e94798 | totemlogs/elasticsearch.py | totemlogs/elasticsearch.py | from __future__ import absolute_import
from future.builtins import ( # noqa
bytes, dict, int, list, object, range, str,
ascii, chr, hex, input, next, oct, open,
pow, round, super,
filter, map, zip)
from functools import wraps
import logging
from elasticsearch import Elasticsearch
from conf.appconfig im... | from __future__ import absolute_import
from future.builtins import ( # noqa
bytes, dict, int, list, object, range, str,
ascii, chr, hex, input, next, oct, open,
pow, round, super,
filter, map, zip)
from functools import wraps
import logging
from elasticsearch import Elasticsearch
from conf.appconfig im... | Use POST instead of GET Request for ES Search API (Issue with query string size) | Use POST instead of GET Request for ES Search API (Issue with query string size)
| Python | mit | totem/totem-logs,totem/totem-logs,totem/totem-logs,totem/totem-logs | from __future__ import absolute_import
from future.builtins import ( # noqa
bytes, dict, int, list, object, range, str,
ascii, chr, hex, input, next, oct, open,
pow, round, super,
filter, map, zip)
from functools import wraps
import logging
from elasticsearch import Elasticsearch
from conf.appconfig im... | Use POST instead of GET Request for ES Search API (Issue with query string size)
from __future__ import absolute_import
from future.builtins import ( # noqa
bytes, dict, int, list, object, range, str,
ascii, chr, hex, input, next, oct, open,
pow, round, super,
filter, map, zip)
from functools import w... |
77340cfe9580ec8510f4af9333cf1aba2d09e70b | wagtail/wagtailadmin/tests/test_password_reset.py | wagtail/wagtailadmin/tests/test_password_reset.py | from django.test import TestCase, override_settings
from django.core import mail
from wagtail.tests.utils import WagtailTestUtils
from wagtail.wagtailcore.models import Site
class TestUserPasswordReset(TestCase, WagtailTestUtils):
fixtures = ['test.json']
# need to clear urlresolver caches before/after test... | Add tests for the password reset emails | Add tests for the password reset emails
| Python | bsd-3-clause | quru/wagtail,mixxorz/wagtail,timorieber/wagtail,nilnvoid/wagtail,gasman/wagtail,timorieber/wagtail,Klaudit/wagtail,nutztherookie/wagtail,wagtail/wagtail,marctc/wagtail,zerolab/wagtail,jorge-marques/wagtail,nrsimha/wagtail,mayapurmedia/wagtail,rjsproxy/wagtail,takeshineshiro/wagtail,bjesus/wagtail,kurtw/wagtail,ianspric... | from django.test import TestCase, override_settings
from django.core import mail
from wagtail.tests.utils import WagtailTestUtils
from wagtail.wagtailcore.models import Site
class TestUserPasswordReset(TestCase, WagtailTestUtils):
fixtures = ['test.json']
# need to clear urlresolver caches before/after test... | Add tests for the password reset emails
| |
a8e2f3e00145f56429eb3d01aa08efe329191b18 | src/proposals/admin.py | src/proposals/admin.py | from django.contrib import admin
from django.contrib.contenttypes.admin import GenericTabularInline
from import_export.admin import ExportMixin
from .models import AdditionalSpeaker, TalkProposal, TutorialProposal
from .resources import TalkProposalResource
class AdditionalSpeakerInline(GenericTabularInline):
m... | from django.contrib import admin
from django.contrib.contenttypes.admin import GenericTabularInline
from import_export.admin import ExportMixin
from .models import AdditionalSpeaker, TalkProposal, TutorialProposal
from .resources import TalkProposalResource
class AdditionalSpeakerInline(GenericTabularInline):
m... | Make submitter a raw_id_field to prevent long select tag | Make submitter a raw_id_field to prevent long select tag
| Python | mit | pycontw/pycontw2016,pycontw/pycontw2016,pycontw/pycontw2016,pycontw/pycontw2016 | from django.contrib import admin
from django.contrib.contenttypes.admin import GenericTabularInline
from import_export.admin import ExportMixin
from .models import AdditionalSpeaker, TalkProposal, TutorialProposal
from .resources import TalkProposalResource
class AdditionalSpeakerInline(GenericTabularInline):
m... | Make submitter a raw_id_field to prevent long select tag
from django.contrib import admin
from django.contrib.contenttypes.admin import GenericTabularInline
from import_export.admin import ExportMixin
from .models import AdditionalSpeaker, TalkProposal, TutorialProposal
from .resources import TalkProposalResource
... |
c4bcbc49fa1418c085b0b10a836d42e5c69faa01 | setup.py | setup.py | from setuptools import setup
setup(
name="pptrees",
version="0.0.2",
description="Parallel Prefix tree generation library",
url="https://github.com/tdene/synth_opt_adders",
author="tdene",
author_email="teodord.ene@gmail.com",
license="Apache 2.0",
classifiers=[
"Development Sta... | from setuptools import setup, find_namespace_packages
setup(
name="pptrees",
version="0.0.2",
description="Parallel Prefix tree generation library",
url="https://github.com/tdene/synth_opt_adders",
author="tdene",
author_email="teodord.ene@gmail.com",
license="Apache 2.0",
classifiers=[... | Apply same fix as in 77a463b50a | Apply same fix as in 77a463b50a
Signed-off-by: Teodor-Dumitru Ene <2853baffc346a14b7885b2637a7ab7a41c2198d9@gmail.com>
| Python | apache-2.0 | tdene/synth_opt_adders | from setuptools import setup, find_namespace_packages
setup(
name="pptrees",
version="0.0.2",
description="Parallel Prefix tree generation library",
url="https://github.com/tdene/synth_opt_adders",
author="tdene",
author_email="teodord.ene@gmail.com",
license="Apache 2.0",
classifiers=[... | Apply same fix as in 77a463b50a
Signed-off-by: Teodor-Dumitru Ene <2853baffc346a14b7885b2637a7ab7a41c2198d9@gmail.com>
from setuptools import setup
setup(
name="pptrees",
version="0.0.2",
description="Parallel Prefix tree generation library",
url="https://github.com/tdene/synth_opt_adders",
autho... |
9537cb765776135bc6d2777b6f4f931724edea7f | project_name/project_name/urls.py | project_name/project_name/urls.py | from django.conf.urls import include, url
from django.conf.urls.static import static
from django.views.generic import TemplateView
from django.contrib import admin
from django.conf import settings
import views
admin.autodiscover()
urlpatterns = [
url(r'^$', TemplateView.as_view(template_name='{{project_name}}/ba... | from django.conf.urls import include, url
from django.conf.urls.static import static
from django.views.generic import TemplateView
from django.contrib import admin
from django.conf import settings
import views
import django.contrib.auth.views.login
admin.autodiscover()
urlpatterns = [
url(r'^$', TemplateView.as_... | Include django.contrib.auth.views.login in django 1.10 way | Include django.contrib.auth.views.login in django 1.10 way
| Python | mit | tom-henderson/django-template,tom-henderson/django-template | from django.conf.urls import include, url
from django.conf.urls.static import static
from django.views.generic import TemplateView
from django.contrib import admin
from django.conf import settings
import views
import django.contrib.auth.views.login
admin.autodiscover()
urlpatterns = [
url(r'^$', TemplateView.as_... | Include django.contrib.auth.views.login in django 1.10 way
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.views.generic import TemplateView
from django.contrib import admin
from django.conf import settings
import views
admin.autodiscover()
urlpatterns = [
url(r'... |
fd33fadc260cda2bd2395f027457f990ab05480b | registration/migrations/0008_auto_20160418_2250.py | registration/migrations/0008_auto_20160418_2250.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-04-18 13:50
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('registration', '0007_auto_20160416_1217'),
]
operations = [
migrations.Alter... | Add migration for Registration changed | Add migration for Registration changed
| Python | mit | pythonkr/pyconapac-2016,pythonkr/pyconapac-2016,pythonkr/pyconapac-2016 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-04-18 13:50
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('registration', '0007_auto_20160416_1217'),
]
operations = [
migrations.Alter... | Add migration for Registration changed
| |
7ebda7fca01372ae49a8c66812c958fc8200f4b0 | apps/events/filters.py | apps/events/filters.py | import django_filters
from django_filters.filters import Lookup
from apps.events.models import Event
class ListFilter(django_filters.Filter):
# https://github.com/carltongibson/django-filter/issues/137#issuecomment-37820702
def filter(self, qs, value):
value_list = value.split(u',')
return su... | import django_filters
from django_filters.filters import Lookup
from apps.events.models import Event
class ListFilter(django_filters.Filter):
# https://github.com/carltongibson/django-filter/issues/137#issuecomment-37820702
def filter(self, qs, value):
value_list = value.split(u',')
return su... | Change Django field filter kwarg from name to field_name for Django 2 support | Change Django field filter kwarg from name to field_name for Django 2 support
| Python | mit | dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4 | import django_filters
from django_filters.filters import Lookup
from apps.events.models import Event
class ListFilter(django_filters.Filter):
# https://github.com/carltongibson/django-filter/issues/137#issuecomment-37820702
def filter(self, qs, value):
value_list = value.split(u',')
return su... | Change Django field filter kwarg from name to field_name for Django 2 support
import django_filters
from django_filters.filters import Lookup
from apps.events.models import Event
class ListFilter(django_filters.Filter):
# https://github.com/carltongibson/django-filter/issues/137#issuecomment-37820702
def fi... |
bcb3b6879b70160598b98e87f0cf0b1b6aa8e1f1 | scripts/dump_timestamp.py | scripts/dump_timestamp.py | #!/usr/bin/env python
from pexif import JpegFile
import sys
usage = """Usage: dump_timestamp.py filename.jpg"""
if len(sys.argv) != 2:
print >> sys.stderr, usage
sys.exit(1)
try:
ef = JpegFile.fromFile(sys.argv[1])
primary = ef.get_exif().get_primary()
print "Primary DateTime :", primar... | Add example of extracting various date/times. | Add example of extracting various date/times.
| Python | mit | ebrelsford/pexif,untereiner/pexif,bennoleslie/pexif | #!/usr/bin/env python
from pexif import JpegFile
import sys
usage = """Usage: dump_timestamp.py filename.jpg"""
if len(sys.argv) != 2:
print >> sys.stderr, usage
sys.exit(1)
try:
ef = JpegFile.fromFile(sys.argv[1])
primary = ef.get_exif().get_primary()
print "Primary DateTime :", primar... | Add example of extracting various date/times.
| |
a15518111b6d03a4b67a2dbaa759afff15fe3302 | spec/Report_S52_spec.py | spec/Report_S52_spec.py | from expects import expect, equal
from primestg.report import Report
with fdescription('Report S52 example'):
with before.all:
self.data_filename = 'spec/data/MRTR000000822522_0_S52_1_20200929001048'
self.report = {}
with open(self.data_filename) as data_file:
self.report = R... | from expects import expect, equal
from primestg.report import Report
with description('Report S52 example'):
with before.all:
self.data_filename = 'spec/data/MRTR000000822522_0_S52_1_20200929001048'
self.report = {}
with open(self.data_filename) as data_file:
self.report = Re... | FIX only pass S52 test | FIX only pass S52 test
| Python | agpl-3.0 | gisce/primestg | from expects import expect, equal
from primestg.report import Report
with description('Report S52 example'):
with before.all:
self.data_filename = 'spec/data/MRTR000000822522_0_S52_1_20200929001048'
self.report = {}
with open(self.data_filename) as data_file:
self.report = Re... | FIX only pass S52 test
from expects import expect, equal
from primestg.report import Report
with fdescription('Report S52 example'):
with before.all:
self.data_filename = 'spec/data/MRTR000000822522_0_S52_1_20200929001048'
self.report = {}
with open(self.data_filename) as data_file:
... |
427b894fdd5690bc7a52dbcea42c4918b87d0046 | run_tests.py | run_tests.py | #!/usr/bin/env python3
# Copyright (c) 2013 Spotify AB
#
# 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 ... | #!/usr/bin/env python3
# Copyright (c) 2013 Spotify AB
#
# 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 ... | Make coverage module optional during test run | Make coverage module optional during test run
Change-Id: I79f767a90a84c7b482e0cc9acd311619611802e9
| Python | apache-2.0 | brainly/check-growth | #!/usr/bin/env python3
# Copyright (c) 2013 Spotify AB
#
# 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 ... | Make coverage module optional during test run
Change-Id: I79f767a90a84c7b482e0cc9acd311619611802e9
#!/usr/bin/env python3
# Copyright (c) 2013 Spotify AB
#
# 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
# th... |
517a65e5fba0ec302a05ad550f473bd72a719398 | test/test_recipes.py | test/test_recipes.py | from __future__ import print_function, absolute_import
import json
import os
import sys
from imp import reload
from io import StringIO
import pytest
import yaml
from adr import query
from adr.main import run_recipe
class new_run_query(object):
def __init__(self, test):
self.test = test
def __call_... | from __future__ import print_function, absolute_import
import json
import os
import sys
from imp import reload
from io import BytesIO, StringIO
import pytest
import yaml
from adr import query
from adr.main import run_recipe
class new_run_query(object):
def __init__(self, test):
self.test = test
de... | Fix python 2 error when dumping expected test results | Fix python 2 error when dumping expected test results
| Python | mpl-2.0 | ahal/active-data-recipes,ahal/active-data-recipes | from __future__ import print_function, absolute_import
import json
import os
import sys
from imp import reload
from io import BytesIO, StringIO
import pytest
import yaml
from adr import query
from adr.main import run_recipe
class new_run_query(object):
def __init__(self, test):
self.test = test
de... | Fix python 2 error when dumping expected test results
from __future__ import print_function, absolute_import
import json
import os
import sys
from imp import reload
from io import StringIO
import pytest
import yaml
from adr import query
from adr.main import run_recipe
class new_run_query(object):
def __init__... |
d623ae9eed5fd8e558461de8bc52a83ff0a168af | recursive_remove_ltac.py | recursive_remove_ltac.py | import re
__all__ = ["recursively_remove_ltac"]
LTAC_REG = re.compile(r'^\s*(?:Local\s+|Global\s+)?Ltac\s+([^\s]+)', re.MULTILINE)
def recursively_remove_ltac(statements, exclude_n=3):
"""Removes any Ltac statement which is not used later in
statements. Does not remove any code in the last exclude_n
sta... | import re
__all__ = ["recursively_remove_ltac"]
LTAC_REG = re.compile(r'^\s*(?:Local\s+|Global\s+)?Ltac\s+([^\s]+)', re.MULTILINE)
def recursively_remove_ltac(statements, exclude_n=3):
"""Removes any Ltac statement which is not used later in
statements. Does not remove any code in the last exclude_n
sta... | Add a comment with a TODO | Add a comment with a TODO
| Python | mit | JasonGross/coq-tools,JasonGross/coq-tools | import re
__all__ = ["recursively_remove_ltac"]
LTAC_REG = re.compile(r'^\s*(?:Local\s+|Global\s+)?Ltac\s+([^\s]+)', re.MULTILINE)
def recursively_remove_ltac(statements, exclude_n=3):
"""Removes any Ltac statement which is not used later in
statements. Does not remove any code in the last exclude_n
sta... | Add a comment with a TODO
import re
__all__ = ["recursively_remove_ltac"]
LTAC_REG = re.compile(r'^\s*(?:Local\s+|Global\s+)?Ltac\s+([^\s]+)', re.MULTILINE)
def recursively_remove_ltac(statements, exclude_n=3):
"""Removes any Ltac statement which is not used later in
statements. Does not remove any code in... |
d0e139d286b18c9dcdc8c46161c4ebdf0f0f8d96 | examples/cooperative_binding.py | examples/cooperative_binding.py | import sys
import os
sys.path.insert(0, os.path.join(
os.path.dirname(os.path.realpath(__file__)), '..'))
from crnpy.crn import CRN, from_react_file
__author__ = "Elisa Tonello"
__copyright__ = "Copyright (c) 2016, Elisa Tonello"
__license__ = "BSD"
__version__ = "0.0.1"
# Cooperative binding
print "Creating mo... | import sys
import os
sys.path.insert(0, os.path.join(
os.path.dirname(os.path.realpath(__file__)), '..'))
from crnpy.crn import CRN, from_react_file
__author__ = "Elisa Tonello"
__copyright__ = "Copyright (c) 2016, Elisa Tonello"
__license__ = "BSD"
__version__ = "0.0.1"
# Cooperative binding
print "Creating mo... | Remove debug and adjusted print. | Remove debug and adjusted print.
| Python | bsd-3-clause | etonello/crnpy | import sys
import os
sys.path.insert(0, os.path.join(
os.path.dirname(os.path.realpath(__file__)), '..'))
from crnpy.crn import CRN, from_react_file
__author__ = "Elisa Tonello"
__copyright__ = "Copyright (c) 2016, Elisa Tonello"
__license__ = "BSD"
__version__ = "0.0.1"
# Cooperative binding
print "Creating mo... | Remove debug and adjusted print.
import sys
import os
sys.path.insert(0, os.path.join(
os.path.dirname(os.path.realpath(__file__)), '..'))
from crnpy.crn import CRN, from_react_file
__author__ = "Elisa Tonello"
__copyright__ = "Copyright (c) 2016, Elisa Tonello"
__license__ = "BSD"
__version__ = "0.0.1"
# Coope... |
fc253535f2ef3cc256b8dd6912b65ac136eafb9c | heat/tests/functional/test_WordPress_Single_Instance_With_HA.py | heat/tests/functional/test_WordPress_Single_Instance_With_HA.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# 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 applicabl... | Add functional test for HA template | Add functional test for HA template
Change-Id: I6d3304b807492e7041264402d161365447fa6ce1
Signed-off-by: Angus Salkeld <86b65304d27d8de73dd7d624c33df7e088f8d94b@redhat.com>
| Python | apache-2.0 | takeshineshiro/heat,cryptickp/heat,dims/heat,pratikmallya/heat,varunarya10/heat,jasondunsmore/heat,steveb/heat,rickerc/heat_audit,dims/heat,varunarya10/heat,citrix-openstack-build/heat,jasondunsmore/heat,maestro-hybrid-cloud/heat,miguelgrinberg/heat,pratikmallya/heat,cwolferh/heat-scratch,gonzolino/heat,dragorosson/hea... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# 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 applicabl... | Add functional test for HA template
Change-Id: I6d3304b807492e7041264402d161365447fa6ce1
Signed-off-by: Angus Salkeld <86b65304d27d8de73dd7d624c33df7e088f8d94b@redhat.com>
| |
5f3be583d945d04ef9f259ee77d21933756209bd | components/table_fetcher.py | components/table_fetcher.py | """Fetches data from GitHub API, store and return the data in a SgTable."""
import table
import inspect
class SgTableFetcher:
"""Fetches data from GitHub API, store and return the data in a SgTable."""
def __init__(self, github):
self._github = github
def _Parse(self, label):
tmp = labe... | Add SgTableFetcher - automatically infers keys/fields and values from object | Add SgTableFetcher - automatically infers keys/fields and values from object
| Python | mit | lnishan/SQLGitHub | """Fetches data from GitHub API, store and return the data in a SgTable."""
import table
import inspect
class SgTableFetcher:
"""Fetches data from GitHub API, store and return the data in a SgTable."""
def __init__(self, github):
self._github = github
def _Parse(self, label):
tmp = labe... | Add SgTableFetcher - automatically infers keys/fields and values from object
| |
227244ae21c98b52a460beb942a8200ab66c0633 | grappa/__init__.py | grappa/__init__.py | # -*- coding: utf-8 -*
"""
`grappa` provides two different testing styles: `should` and `expect`.
should
------
Example using ``should`` style::
from grappa import should
should('foo').be.equal.to('foo')
'foo' | should.be.equal.to('foo')
expect
------
Example using ``expect`` style::
from grappa ... | # -*- coding: utf-8 -*
"""
`grappa` provides two different testing styles: `should` and `expect`.
should
------
Example using ``should`` style::
from grappa import should
should('foo').be.equal.to('foo')
'foo' | should.be.equal.to('foo')
expect
------
Example using ``expect`` style::
from grappa ... | Bump version: 0.1.8 → 0.1.9 | Bump version: 0.1.8 → 0.1.9
| Python | mit | grappa-py/grappa | # -*- coding: utf-8 -*
"""
`grappa` provides two different testing styles: `should` and `expect`.
should
------
Example using ``should`` style::
from grappa import should
should('foo').be.equal.to('foo')
'foo' | should.be.equal.to('foo')
expect
------
Example using ``expect`` style::
from grappa ... | Bump version: 0.1.8 → 0.1.9
# -*- coding: utf-8 -*
"""
`grappa` provides two different testing styles: `should` and `expect`.
should
------
Example using ``should`` style::
from grappa import should
should('foo').be.equal.to('foo')
'foo' | should.be.equal.to('foo')
expect
------
Example using ``expec... |
05e95158055e869be3bf4e98af8521afc8321ec4 | lintcode/Medium/116_Jump_Game.py | lintcode/Medium/116_Jump_Game.py | class Solution:
# @param A, a list of integers
# @return a boolean
def canJump(self, A):
# write your code here
# Brute Force
jumpable = [False] * len(A)
jumpable[0] = True
for i in range(len(A)):
if (jumpable[i]):
for j in range(1, A[i] +... | Add solution to lintcode question 116 | Add solution to lintcode question 116
| Python | mit | Rhadow/leetcode,Rhadow/leetcode,Rhadow/leetcode,Rhadow/leetcode | class Solution:
# @param A, a list of integers
# @return a boolean
def canJump(self, A):
# write your code here
# Brute Force
jumpable = [False] * len(A)
jumpable[0] = True
for i in range(len(A)):
if (jumpable[i]):
for j in range(1, A[i] +... | Add solution to lintcode question 116
| |
59a2712f353f47e3dc237479cc6cc46666b7d0f1 | energy_demand/scripts/generate_dummy_data.py | energy_demand/scripts/generate_dummy_data.py | """Generate dummy data to use in smif as scenario data for testing
"""
from pprint import pprint
from energy_demand.read_write.data_loader import dummy_data_generation
import yaml
def main():
"""Generate and write out data
"""
data = dummy_data_generation({
'sim_param': {
'base_yr': ... | Write dummy data out to yaml | Write dummy data out to yaml
| Python | mit | nismod/energy_demand,nismod/energy_demand | """Generate dummy data to use in smif as scenario data for testing
"""
from pprint import pprint
from energy_demand.read_write.data_loader import dummy_data_generation
import yaml
def main():
"""Generate and write out data
"""
data = dummy_data_generation({
'sim_param': {
'base_yr': ... | Write dummy data out to yaml
| |
5f0a4f33196c368318dba21aaa66956d4b973d60 | usig_normalizador_amba/settings.py | usig_normalizador_amba/settings.py | # coding: UTF-8
from __future__ import absolute_import
default_settings = {
'callejero_amba_server': 'http://servicios.usig.buenosaires.gob.ar/callejero-amba/',
'callejero_caba_server': 'http://usig.buenosaires.gov.ar/servicios/Callejero',
}
# Tipo de normalizacion
CALLE = 0
CALLE_ALTURA = 1
CALLE_Y_CALLE = 2... | # coding: UTF-8
from __future__ import absolute_import
default_settings = {
'callejero_amba_server': 'http://servicios.usig.buenosaires.gob.ar/callejero-amba/',
'callejero_caba_server': 'http://servicios.usig.buenosaires.gob.ar/callejero',
}
# Tipo de normalizacion
CALLE = 0
CALLE_ALTURA = 1
CALLE_Y_CALLE = 2... | Fix a la url del callejero CABA | Fix a la url del callejero CABA
| Python | mit | usig/normalizador-amba,hogasa/normalizador-amba | # coding: UTF-8
from __future__ import absolute_import
default_settings = {
'callejero_amba_server': 'http://servicios.usig.buenosaires.gob.ar/callejero-amba/',
'callejero_caba_server': 'http://servicios.usig.buenosaires.gob.ar/callejero',
}
# Tipo de normalizacion
CALLE = 0
CALLE_ALTURA = 1
CALLE_Y_CALLE = 2... | Fix a la url del callejero CABA
# coding: UTF-8
from __future__ import absolute_import
default_settings = {
'callejero_amba_server': 'http://servicios.usig.buenosaires.gob.ar/callejero-amba/',
'callejero_caba_server': 'http://usig.buenosaires.gov.ar/servicios/Callejero',
}
# Tipo de normalizacion
CALLE = 0
C... |
37b0387f9425c25a53c981dce3911e98c7ca14dd | test/test_config.py | test/test_config.py | import os
from nose.tools import *
from lctools import config
class TestConfig(object):
test_filename = "bebebe"
def setup(self):
fd = open(self.test_filename, 'w')
fd.write("[default]\n")
fd.write("foo = bar\n")
fd.close()
def test_basic_functionality(self):
con... | import os
import stat
from nose.tools import *
from lctools import config
class TestConfig(object):
test_filename = "bebebe"
def setup(self):
fd = open(self.test_filename, 'w')
fd.write("[default]\n")
fd.write("foo = bar\n")
fd.close()
os.chmod(self.test_filename, sta... | Add a test for config file permissions check. | Add a test for config file permissions check.
| Python | apache-2.0 | novel/lc-tools,novel/lc-tools | import os
import stat
from nose.tools import *
from lctools import config
class TestConfig(object):
test_filename = "bebebe"
def setup(self):
fd = open(self.test_filename, 'w')
fd.write("[default]\n")
fd.write("foo = bar\n")
fd.close()
os.chmod(self.test_filename, sta... | Add a test for config file permissions check.
import os
from nose.tools import *
from lctools import config
class TestConfig(object):
test_filename = "bebebe"
def setup(self):
fd = open(self.test_filename, 'w')
fd.write("[default]\n")
fd.write("foo = bar\n")
fd.close()
... |
79b0584887075eb1732770d1732ae07147ec21b6 | tests/mpd/protocol/test_status.py | tests/mpd/protocol/test_status.py | from __future__ import absolute_import, unicode_literals
from mopidy.models import Track
from tests.mpd import protocol
class StatusHandlerTest(protocol.BaseTestCase):
def test_clearerror(self):
self.send_request('clearerror')
self.assertEqualResponse('ACK [0@0] {clearerror} Not implemented')
... | from __future__ import absolute_import, unicode_literals
from mopidy.models import Track
from tests.mpd import protocol
class StatusHandlerTest(protocol.BaseTestCase):
def test_clearerror(self):
self.send_request('clearerror')
self.assertEqualResponse('ACK [0@0] {clearerror} Not implemented')
... | Stop using tracklist add tracks in mpd status test | tests: Stop using tracklist add tracks in mpd status test
| Python | apache-2.0 | ZenithDK/mopidy,quartz55/mopidy,tkem/mopidy,dbrgn/mopidy,rawdlite/mopidy,ali/mopidy,glogiotatidis/mopidy,quartz55/mopidy,bacontext/mopidy,bencevans/mopidy,kingosticks/mopidy,ZenithDK/mopidy,tkem/mopidy,dbrgn/mopidy,tkem/mopidy,jmarsik/mopidy,glogiotatidis/mopidy,adamcik/mopidy,bacontext/mopidy,bacontext/mopidy,pacificI... | from __future__ import absolute_import, unicode_literals
from mopidy.models import Track
from tests.mpd import protocol
class StatusHandlerTest(protocol.BaseTestCase):
def test_clearerror(self):
self.send_request('clearerror')
self.assertEqualResponse('ACK [0@0] {clearerror} Not implemented')
... | tests: Stop using tracklist add tracks in mpd status test
from __future__ import absolute_import, unicode_literals
from mopidy.models import Track
from tests.mpd import protocol
class StatusHandlerTest(protocol.BaseTestCase):
def test_clearerror(self):
self.send_request('clearerror')
self.asser... |
c08df80a02791978b6677d2e2fbd8ebb885f024d | cfp/admin.py | cfp/admin.py | from django.contrib import admin
from cfp.models import CallForPaper, PaperApplication, Applicant
from django.core import urlresolvers
class ApplicantAdmin(admin.ModelAdmin):
readonly_fields = ('user',)
list_display = ('full_name', 'about', 'biography', 'speaker_experience', 'github', 'twitter')
fields = ... | from django.contrib import admin
from cfp.models import CallForPaper, PaperApplication, Applicant
from django.core import urlresolvers
class ApplicantAdmin(admin.ModelAdmin):
list_display = ('user', 'full_name', 'about', 'biography', 'speaker_experience', 'github', 'twitter')
fields = ('user', 'about', 'biogr... | Remove user from readonly fields | Remove user from readonly fields
So that we can add Applicants from the admin interface.
| Python | bsd-3-clause | denibertovic/conference-web,denibertovic/conference-web,WebCampZg/conference-web,WebCampZg/conference-web,denibertovic/conference-web,denibertovic/conference-web,denibertovic/conference-web,WebCampZg/conference-web | from django.contrib import admin
from cfp.models import CallForPaper, PaperApplication, Applicant
from django.core import urlresolvers
class ApplicantAdmin(admin.ModelAdmin):
list_display = ('user', 'full_name', 'about', 'biography', 'speaker_experience', 'github', 'twitter')
fields = ('user', 'about', 'biogr... | Remove user from readonly fields
So that we can add Applicants from the admin interface.
from django.contrib import admin
from cfp.models import CallForPaper, PaperApplication, Applicant
from django.core import urlresolvers
class ApplicantAdmin(admin.ModelAdmin):
readonly_fields = ('user',)
list_display = (... |
47f19fec718f8407965487e2d3b993e8dbc7e23b | qregexeditor/api/match_highlighter.py | qregexeditor/api/match_highlighter.py | import re
from pyqode.core.qt import QtGui
class MatchHighlighter(QtGui.QSyntaxHighlighter):
def __init__(self, document):
super().__init__(document)
self.prog = None
self._format = QtGui.QTextCharFormat()
self._format.setBackground(QtGui.QBrush(QtGui.QColor('#bbfcbb')))
def h... | import re
from pyqode.core.qt import QtGui
class MatchHighlighter(QtGui.QSyntaxHighlighter):
def __init__(self, document):
super().__init__(document)
self.prog = None
self._format = QtGui.QTextCharFormat()
self._format.setBackground(QtGui.QBrush(QtGui.QColor('#bbfcbb')))
def h... | Fix highlighting when multiple matches | Fix highlighting when multiple matches
| Python | mit | ColinDuquesnoy/QRegexEditor | import re
from pyqode.core.qt import QtGui
class MatchHighlighter(QtGui.QSyntaxHighlighter):
def __init__(self, document):
super().__init__(document)
self.prog = None
self._format = QtGui.QTextCharFormat()
self._format.setBackground(QtGui.QBrush(QtGui.QColor('#bbfcbb')))
def h... | Fix highlighting when multiple matches
import re
from pyqode.core.qt import QtGui
class MatchHighlighter(QtGui.QSyntaxHighlighter):
def __init__(self, document):
super().__init__(document)
self.prog = None
self._format = QtGui.QTextCharFormat()
self._format.setBackground(QtGui.QBr... |
bafef6a175116aff519579822f2382e8fbbd8808 | spotipy/__init__.py | spotipy/__init__.py | VERSION='2.4.5'
from client import *
from oauth2 import *
from util import *
| VERSION='2.4.5'
from .client import *
from .oauth2 import *
from .util import *
| Make import statements explicit relative imports | Make import statements explicit relative imports
| Python | mit | plamere/spotipy | VERSION='2.4.5'
from .client import *
from .oauth2 import *
from .util import *
| Make import statements explicit relative imports
VERSION='2.4.5'
from client import *
from oauth2 import *
from util import *
|
ec13c2591a18386f08ade69874a77ce8f561e8a1 | application.py | application.py | from transporter import create_app
application = create_app(__name__)
if __name__ == '__main__':
application.run(host='0.0.0.0', debug=True)
| import os
from transporter import create_app
application = create_app(__name__)
if __name__ == '__main__':
host = os.environ.get('HOST', '0.0.0.0')
port = int(os.environ.get('PORT', 8002))
debug = bool(os.environ.get('DEBUG', False))
application.run(host, port=port, debug=debug)
| Read in some environment variables | Read in some environment variables
| Python | mit | suminb/transporter,suminb/transporter | import os
from transporter import create_app
application = create_app(__name__)
if __name__ == '__main__':
host = os.environ.get('HOST', '0.0.0.0')
port = int(os.environ.get('PORT', 8002))
debug = bool(os.environ.get('DEBUG', False))
application.run(host, port=port, debug=debug)
| Read in some environment variables
from transporter import create_app
application = create_app(__name__)
if __name__ == '__main__':
application.run(host='0.0.0.0', debug=True)
|
c97a0c3d5d5b5354cb4e5f6eb0e134eab89edc85 | pylab/website/tests/test_about_page.py | pylab/website/tests/test_about_page.py | import datetime
from django_webtest import WebTest
from django.contrib.auth.models import User
from pylab.core.models import Event
class AboutPageTests(WebTest):
def setUp(self):
self.user = User.objects.create(username='u1')
def test_no_events_on_about_page(self):
resp = self.app.get('/ab... | Add tests for about page. | Add tests for about page.
| Python | agpl-3.0 | python-dirbtuves/website,python-dirbtuves/website,python-dirbtuves/website | import datetime
from django_webtest import WebTest
from django.contrib.auth.models import User
from pylab.core.models import Event
class AboutPageTests(WebTest):
def setUp(self):
self.user = User.objects.create(username='u1')
def test_no_events_on_about_page(self):
resp = self.app.get('/ab... | Add tests for about page.
| |
35b08e6e7e60a440fe33b7120843766b9f2592c6 | tests/urls.py | tests/urls.py | from django.conf.urls import include, url
from django.contrib import admin
from . import views
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url('foo/', views.MyView.as_view(), name='class-view'),
url('bar/', views.MyAPIView.as_view(), name='api-view'),
url('', views.my_view, name='funct... | from django.conf.urls import include, url
from django.contrib import admin
from . import views
from incuna_test_utils.compat import DJANGO_LT_17
if DJANGO_LT_17:
admin.autodiscover()
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url('foo/', views.MyView.as_view(), name='class-view'),
u... | Add compatibility with django < 1.7 | Add compatibility with django < 1.7
| Python | bsd-2-clause | incuna/incuna-test-utils,incuna/incuna-test-utils | from django.conf.urls import include, url
from django.contrib import admin
from . import views
from incuna_test_utils.compat import DJANGO_LT_17
if DJANGO_LT_17:
admin.autodiscover()
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url('foo/', views.MyView.as_view(), name='class-view'),
u... | Add compatibility with django < 1.7
from django.conf.urls import include, url
from django.contrib import admin
from . import views
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url('foo/', views.MyView.as_view(), name='class-view'),
url('bar/', views.MyAPIView.as_view(), name='api-view'),
... |
3f9d68c8b1719047de29e41bd673f3b6926a81df | run.py | run.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: run.py
Author: huxuan <i(at)huxuan.org>
Description: Run script for app.
"""
import os.path
if not os.path.isfile('config.py'):
raise Exception('Please copy `config.sample.py` to `config.py` with proper'
'configuration to make it work.')
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: run.py
Author: huxuan <i(at)huxuan.org>
Description: Run script for app.
"""
import os.path
if not os.path.isfile('config.py'):
raise Exception('Please copy `config.sample.py` to `config.py` with proper'
' configuration to make it work.')
... | Add missing space for exception message. | Add missing space for exception message.
| Python | mit | CAPU-ENG/CAPUHome-API,huxuan/CAPUHome-API | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: run.py
Author: huxuan <i(at)huxuan.org>
Description: Run script for app.
"""
import os.path
if not os.path.isfile('config.py'):
raise Exception('Please copy `config.sample.py` to `config.py` with proper'
' configuration to make it work.')
... | Add missing space for exception message.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: run.py
Author: huxuan <i(at)huxuan.org>
Description: Run script for app.
"""
import os.path
if not os.path.isfile('config.py'):
raise Exception('Please copy `config.sample.py` to `config.py` with proper'
... |
5253f7fbcea33e28af6348c3cc0f65334cad5623 | setuptools/launch.py | setuptools/launch.py | """
Launch the Python script on the command line after
setuptools is bootstrapped via import.
"""
# Note that setuptools gets imported implicitly by the
# invocation of this script using python -m setuptools.launch
import tokenize
import sys
def run():
"""
Run the script in sys.argv[1] as if it had
been invoked ... | """
Launch the Python script on the command line after
setuptools is bootstrapped via import.
"""
# Note that setuptools gets imported implicitly by the
# invocation of this script using python -m setuptools.launch
import tokenize
import sys
def run():
"""
Run the script in sys.argv[1] as if it had
been... | Swap out hard tabs for spaces | Swap out hard tabs for spaces | Python | mit | pypa/setuptools,pypa/setuptools,pypa/setuptools | """
Launch the Python script on the command line after
setuptools is bootstrapped via import.
"""
# Note that setuptools gets imported implicitly by the
# invocation of this script using python -m setuptools.launch
import tokenize
import sys
def run():
"""
Run the script in sys.argv[1] as if it had
been... | Swap out hard tabs for spaces
"""
Launch the Python script on the command line after
setuptools is bootstrapped via import.
"""
# Note that setuptools gets imported implicitly by the
# invocation of this script using python -m setuptools.launch
import tokenize
import sys
def run():
"""
Run the script in sys.argv[... |
45fb01574d410c2a764e5b40a5e93a44fa8f6584 | flask_admin/contrib/geoa/form.py | flask_admin/contrib/geoa/form.py | from flask.ext.admin.model.form import converts
from flask.ext.admin.contrib.sqla.form import AdminModelConverter as SQLAAdminConverter
from .fields import GeoJSONField
class AdminModelConverter(SQLAAdminConverter):
@converts('Geometry')
def convert_geom(self, column, field_args, **extra):
field_args[... | from flask.ext.admin.model.form import converts
from flask.ext.admin.contrib.sqla.form import AdminModelConverter as SQLAAdminConverter
from .fields import GeoJSONField
class AdminModelConverter(SQLAAdminConverter):
@converts('Geography', 'Geometry')
def convert_geom(self, column, field_args, **extra):
... | Add Geography Type to GeoAlchemy Backend | Add Geography Type to GeoAlchemy Backend
The current GeoAlchemy backend only works with geometry columns, and ignores geography columns (which are also supported by geoalchemy). This 1-word fix adds support for geography columns. | Python | bsd-3-clause | litnimax/flask-admin,petrus-jvrensburg/flask-admin,closeio/flask-admin,torotil/flask-admin,jmagnusson/flask-admin,marrybird/flask-admin,dxmo/flask-admin,ondoheer/flask-admin,plaes/flask-admin,LennartP/flask-admin,jamesbeebop/flask-admin,NickWoodhams/flask-admin,closeio/flask-admin,CoolCloud/flask-admin,radioprotector/f... | from flask.ext.admin.model.form import converts
from flask.ext.admin.contrib.sqla.form import AdminModelConverter as SQLAAdminConverter
from .fields import GeoJSONField
class AdminModelConverter(SQLAAdminConverter):
@converts('Geography', 'Geometry')
def convert_geom(self, column, field_args, **extra):
... | Add Geography Type to GeoAlchemy Backend
The current GeoAlchemy backend only works with geometry columns, and ignores geography columns (which are also supported by geoalchemy). This 1-word fix adds support for geography columns.
from flask.ext.admin.model.form import converts
from flask.ext.admin.contrib.sqla.form i... |
90fb352f313b26964adcc587beb8f21deb3395a4 | tor.py | tor.py | import socks
import socket
from stem.control import Controller
from stem import Signal
class Tor(object):
"""Tor class for socks proxy and controller"""
def __init__(self, socks_port=9050, control_port=9051, control_password=""):
self.socks_port = socks_port
self.control_port = control_port
... | import socks
import socket
import json
from stem.control import Controller
from stem import Signal
from urllib2 import urlopen
class Tor(object):
"""Tor class for socks proxy and controller"""
def __init__(self, socks_port=9050, control_port=9051, control_password=""):
self.socks_port = socks_port
... | Add print_ip method for debugging | Add print_ip method for debugging
| Python | mit | MA3STR0/simpletor | import socks
import socket
import json
from stem.control import Controller
from stem import Signal
from urllib2 import urlopen
class Tor(object):
"""Tor class for socks proxy and controller"""
def __init__(self, socks_port=9050, control_port=9051, control_password=""):
self.socks_port = socks_port
... | Add print_ip method for debugging
import socks
import socket
from stem.control import Controller
from stem import Signal
class Tor(object):
"""Tor class for socks proxy and controller"""
def __init__(self, socks_port=9050, control_port=9051, control_password=""):
self.socks_port = socks_port
... |
369e70cc5d5e1c880bd61f055ffbe43d5aeab509 | nodeconductor/structure/tests/unittests/test_models.py | nodeconductor/structure/tests/unittests/test_models.py | from django.test import TestCase
from nodeconductor.structure.tests import factories
class ServiceProjectLinkTest(TestCase):
def setUp(self):
self.link = factories.TestServiceProjectLinkFactory()
def test_link_is_in_certification_erred_state_if_service_does_not_satisfy_project_certifications(self):... | from django.test import TestCase
from nodeconductor.structure.tests import factories
class ServiceProjectLinkTest(TestCase):
def setUp(self):
self.link = factories.TestServiceProjectLinkFactory()
def test_link_is_in_certification_erred_state_if_service_does_not_satisfy_project_certifications(self):... | Break test flow into logical subsets | Break test flow into logical subsets [WAL-615]
| Python | mit | opennode/nodeconductor,opennode/nodeconductor,opennode/nodeconductor | from django.test import TestCase
from nodeconductor.structure.tests import factories
class ServiceProjectLinkTest(TestCase):
def setUp(self):
self.link = factories.TestServiceProjectLinkFactory()
def test_link_is_in_certification_erred_state_if_service_does_not_satisfy_project_certifications(self):... | Break test flow into logical subsets [WAL-615]
from django.test import TestCase
from nodeconductor.structure.tests import factories
class ServiceProjectLinkTest(TestCase):
def setUp(self):
self.link = factories.TestServiceProjectLinkFactory()
def test_link_is_in_certification_erred_state_if_servic... |
8e2187d2519b4008a36f5c85910b7e7e2efc16f9 | braid/config.py | braid/config.py | """
Support for multiple environments based on python configuration files.
"""
from __future__ import print_function, absolute_import
import os
from twisted.python.filepath import FilePath
from fabric.api import env, task
from braid.settings import ENVIRONMENTS
CONFIG_DIRS = [
'~/.config/braid',
]
def loadE... | """
Support for multiple environments based on python configuration files.
"""
from __future__ import print_function, absolute_import
import os
from twisted.python.filepath import FilePath
from fabric.api import env, task
from braid.settings import ENVIRONMENTS
CONFIG_DIRS = [
'~/.config/braid',
]
#FIXME: H... | Put environment name into environment. | Put environment name into environment.
| Python | mit | alex/braid,alex/braid | """
Support for multiple environments based on python configuration files.
"""
from __future__ import print_function, absolute_import
import os
from twisted.python.filepath import FilePath
from fabric.api import env, task
from braid.settings import ENVIRONMENTS
CONFIG_DIRS = [
'~/.config/braid',
]
#FIXME: H... | Put environment name into environment.
"""
Support for multiple environments based on python configuration files.
"""
from __future__ import print_function, absolute_import
import os
from twisted.python.filepath import FilePath
from fabric.api import env, task
from braid.settings import ENVIRONMENTS
CONFIG_DIRS... |
c86b6390e46bac17c64e19010912c4cb165fa9dd | satnogsclient/settings.py | satnogsclient/settings.py | from os import environ
DEMODULATION_COMMAND = environ.get('DEMODULATION_COMMAND', None)
ENCODING_COMMAND = environ.get('ENCODING_COMMAND', None)
DECODING_COMMAND = environ.get('DECODING_COMMAND', None)
OUTPUT_PATH = environ.get('OUTPUT_PATH', None)
| from os import environ
DEMODULATION_COMMAND = environ.get('SATNOGS_DEMODULATION_COMMAND', None)
ENCODING_COMMAND = environ.get('SATNOGS_ENCODING_COMMAND', None)
DECODING_COMMAND = environ.get('SATNOGS_DECODING_COMMAND', None)
OUTPUT_PATH = environ.get('SATNOGS_OUTPUT_PATH', None)
| Add prefix to required environment variables. | Add prefix to required environment variables.
| Python | agpl-3.0 | cshields/satnogs-client,adamkalis/satnogs-client,adamkalis/satnogs-client,cshields/satnogs-client | from os import environ
DEMODULATION_COMMAND = environ.get('SATNOGS_DEMODULATION_COMMAND', None)
ENCODING_COMMAND = environ.get('SATNOGS_ENCODING_COMMAND', None)
DECODING_COMMAND = environ.get('SATNOGS_DECODING_COMMAND', None)
OUTPUT_PATH = environ.get('SATNOGS_OUTPUT_PATH', None)
| Add prefix to required environment variables.
from os import environ
DEMODULATION_COMMAND = environ.get('DEMODULATION_COMMAND', None)
ENCODING_COMMAND = environ.get('ENCODING_COMMAND', None)
DECODING_COMMAND = environ.get('DECODING_COMMAND', None)
OUTPUT_PATH = environ.get('OUTPUT_PATH', None)
|
7124d56b3edd85c64dcc7f3ff0fa172102fe8358 | devtools/travis-ci/update_versions_json.py | devtools/travis-ci/update_versions_json.py | import json
try:
# Only works in Python 3.5
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
from yank import version
if not version.release:
print("This is not a release.")
exit(0)
URL = 'http://www.getyank.org'
try:
data = urlopen(URL + '/versions.json').re... | import json
try:
# Only works in Python 3.5
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
from yank import version
#if not version.release:
# print("This is not a release.")
# exit(0)
URL = 'http://www.getyank.org'
try:
data = urlopen(URL + '/versions.json').... | Disable the check for the initial versions push | Disable the check for the initial versions push
| Python | mit | andrrizzi/yank,andrrizzi/yank,choderalab/yank,andrrizzi/yank,choderalab/yank | import json
try:
# Only works in Python 3.5
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
from yank import version
#if not version.release:
# print("This is not a release.")
# exit(0)
URL = 'http://www.getyank.org'
try:
data = urlopen(URL + '/versions.json').... | Disable the check for the initial versions push
import json
try:
# Only works in Python 3.5
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
from yank import version
if not version.release:
print("This is not a release.")
exit(0)
URL = 'http://www.getyank.org'
t... |
6994a94f55380c7a0eafeaab28fe42bc29db8e4d | modder/utils/desktop_notification.py | modder/utils/desktop_notification.py | # coding: utf-8
import platform
if platform.system() == 'Darwin':
from Foundation import NSUserNotificationDefaultSoundName
import objc
NSUserNotification = objc.lookUpClass('NSUserNotification')
NSUserNotificationCenter = objc.lookUpClass('NSUserNotificationCenter')
def desktop_notify(text, titl... | # coding: utf-8
import os.path
import platform
import sys
if getattr(sys, 'frozen', False):
desktop_icon = os.path.abspath(
os.path.join(
os.path.dirname(sys.executable), 'resources', 'icons8-Module-128.png'
)
)
else:
desktop_icon = os.path.abspath(
os.path.join(
... | Add icon for desktop notifications | Add icon for desktop notifications
| Python | mit | JokerQyou/Modder2 | # coding: utf-8
import os.path
import platform
import sys
if getattr(sys, 'frozen', False):
desktop_icon = os.path.abspath(
os.path.join(
os.path.dirname(sys.executable), 'resources', 'icons8-Module-128.png'
)
)
else:
desktop_icon = os.path.abspath(
os.path.join(
... | Add icon for desktop notifications
# coding: utf-8
import platform
if platform.system() == 'Darwin':
from Foundation import NSUserNotificationDefaultSoundName
import objc
NSUserNotification = objc.lookUpClass('NSUserNotification')
NSUserNotificationCenter = objc.lookUpClass('NSUserNotificationCenter'... |
cab360d14a6b02cc1cf4649823acd2e2c683d240 | utils/swift_build_support/swift_build_support/products/swift.py | utils/swift_build_support/swift_build_support/products/swift.py | # swift_build_support/products/swift.py -------------------------*- python -*-
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See http://swift.org/LICENSE.txt... | # swift_build_support/products/swift.py -------------------------*- python -*-
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See http://swift.org/LICENSE.txt... | Change method _compute_runtime_use_sanitizer => property _runtime_sanitizer_flags. NFC. | [vacation-gardening] Change method _compute_runtime_use_sanitizer => property _runtime_sanitizer_flags. NFC.
| Python | apache-2.0 | parkera/swift,huonw/swift,CodaFi/swift,parkera/swift,codestergit/swift,austinzheng/swift,bitjammer/swift,glessard/swift,djwbrown/swift,bitjammer/swift,gottesmm/swift,lorentey/swift,tkremenek/swift,OscarSwanros/swift,milseman/swift,airspeedswift/swift,arvedviehweger/swift,CodaFi/swift,IngmarStein/swift,JaSpa/swift,atric... | # swift_build_support/products/swift.py -------------------------*- python -*-
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See http://swift.org/LICENSE.txt... | [vacation-gardening] Change method _compute_runtime_use_sanitizer => property _runtime_sanitizer_flags. NFC.
# swift_build_support/products/swift.py -------------------------*- python -*-
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project au... |
2bfe6ac9e0408fa418dd3faea4c1e0bbd224949e | nixkeyboard.py | nixkeyboard.py | def read_device_file():
from pathlib import Path
event_files = Path('/dev/input/by-id').glob('*-event-kbd')
for event_file in event_files:
if '-if01-' not in event_file.name:
break
with event_file.open('rb') as events:
while True:
yield events.read(1)
def liste... | Add initial structure for Unix support | Add initial structure for Unix support
| Python | mit | glitchassassin/keyboard,boppreh/keyboard | def read_device_file():
from pathlib import Path
event_files = Path('/dev/input/by-id').glob('*-event-kbd')
for event_file in event_files:
if '-if01-' not in event_file.name:
break
with event_file.open('rb') as events:
while True:
yield events.read(1)
def liste... | Add initial structure for Unix support
| |
aca158817c21b8baeeb64d7290d61c32a79124f9 | tests/test_heat_demand.py | tests/test_heat_demand.py | """
Test the electricity demand
SPDX-FileCopyrightText: Uwe Krien <krien@uni-bremen.de>
SPDX-FileCopyrightText: Patrik Schönfeldt
SPDX-License-Identifier: MIT
"""
import numpy as np
from demandlib.examples import heat_demand_example
def test_heat_example():
"""Test the results of the heat example."""
ann... | """
Test the electricity demand
SPDX-FileCopyrightText: Uwe Krien <krien@uni-bremen.de>
SPDX-FileCopyrightText: Patrik Schönfeldt
SPDX-License-Identifier: MIT
"""
import numpy as np
from demandlib.examples import heat_demand_example
def test_heat_example():
"""Test the results of the heat example."""
ann... | Increase tollerance for heat demand test | Increase tollerance for heat demand test
| Python | mit | oemof/demandlib | """
Test the electricity demand
SPDX-FileCopyrightText: Uwe Krien <krien@uni-bremen.de>
SPDX-FileCopyrightText: Patrik Schönfeldt
SPDX-License-Identifier: MIT
"""
import numpy as np
from demandlib.examples import heat_demand_example
def test_heat_example():
"""Test the results of the heat example."""
ann... | Increase tollerance for heat demand test
"""
Test the electricity demand
SPDX-FileCopyrightText: Uwe Krien <krien@uni-bremen.de>
SPDX-FileCopyrightText: Patrik Schönfeldt
SPDX-License-Identifier: MIT
"""
import numpy as np
from demandlib.examples import heat_demand_example
def test_heat_example():
"""Test t... |
8915729158c9b5c22d16a4c2deee66f79a8276b9 | apps/local_apps/account/middleware.py | apps/local_apps/account/middleware.py | from django.utils.cache import patch_vary_headers
from django.utils import translation
from account.models import Account
class LocaleMiddleware(object):
"""
This is a very simple middleware that parses a request
and decides what translation object to install in the current
thread context depending on ... | from django.utils.cache import patch_vary_headers
from django.utils import translation
from account.models import Account
class LocaleMiddleware(object):
"""
This is a very simple middleware that parses a request
and decides what translation object to install in the current
thread context depending on ... | Throw 500 error on multiple account in LocaleMiddleware so we can fix them. | Throw 500 error on multiple account in LocaleMiddleware so we can fix them.
| Python | mit | ingenieroariel/pinax,ingenieroariel/pinax | from django.utils.cache import patch_vary_headers
from django.utils import translation
from account.models import Account
class LocaleMiddleware(object):
"""
This is a very simple middleware that parses a request
and decides what translation object to install in the current
thread context depending on ... | Throw 500 error on multiple account in LocaleMiddleware so we can fix them.
from django.utils.cache import patch_vary_headers
from django.utils import translation
from account.models import Account
class LocaleMiddleware(object):
"""
This is a very simple middleware that parses a request
and decides what ... |
8b9d789ccc5ed1840e8a7173c304c86f954a5447 | setup.py | setup.py | import setuptools
setuptools.setup(
name='warlock',
version='0.1',
description='',
author='Brian Waldon',
author_email='bcwaldon@gmail.com',
url='http://github.com/bcwaldon/warlock',
packages=['warlock'],
install_requires=['jsonschema'],
)
| import setuptools
setuptools.setup(
name='warlock',
version='0.0.1',
description='Python object model built on top of JSON schema',
author='Brian Waldon',
author_email='bcwaldon@gmail.com',
url='http://github.com/bcwaldon/warlock',
packages=['warlock'],
install_requires=['jsonschema'],... | Set reasonable version and add description | Set reasonable version and add description
| Python | apache-2.0 | bcwaldon/warlock | import setuptools
setuptools.setup(
name='warlock',
version='0.0.1',
description='Python object model built on top of JSON schema',
author='Brian Waldon',
author_email='bcwaldon@gmail.com',
url='http://github.com/bcwaldon/warlock',
packages=['warlock'],
install_requires=['jsonschema'],... | Set reasonable version and add description
import setuptools
setuptools.setup(
name='warlock',
version='0.1',
description='',
author='Brian Waldon',
author_email='bcwaldon@gmail.com',
url='http://github.com/bcwaldon/warlock',
packages=['warlock'],
install_requires=['jsonschema'],
)
|
10e26b52f94bb1a6345d2c1540a0a09a82b7831c | baseflask/refresh_varsnap.py | baseflask/refresh_varsnap.py | """
This script refreshes production varsnap snaps
"""
import os
from syspath import git_root # NOQA
from app import serve
os.environ['ENV'] = 'production'
app = serve.app.test_client()
app.get('/')
app.get('/health')
app.get('/robots.txt')
app.get('/asdf')
| """
This script refreshes production varsnap snaps
"""
import os
from syspath import git_root # NOQA
from app import serve
os.environ['ENV'] = 'production'
app = serve.app.test_client()
app.get('/')
app.get('/health')
app.get('/humans.txt')
app.get('/robots.txt')
app.get('/.well-known/security.txt')
app.get('/asd... | Update varsnap refresh with new endpoints | Update varsnap refresh with new endpoints
| Python | mit | albertyw/base-flask,albertyw/base-flask,albertyw/base-flask,albertyw/base-flask | """
This script refreshes production varsnap snaps
"""
import os
from syspath import git_root # NOQA
from app import serve
os.environ['ENV'] = 'production'
app = serve.app.test_client()
app.get('/')
app.get('/health')
app.get('/humans.txt')
app.get('/robots.txt')
app.get('/.well-known/security.txt')
app.get('/asd... | Update varsnap refresh with new endpoints
"""
This script refreshes production varsnap snaps
"""
import os
from syspath import git_root # NOQA
from app import serve
os.environ['ENV'] = 'production'
app = serve.app.test_client()
app.get('/')
app.get('/health')
app.get('/robots.txt')
app.get('/asdf')
|
b552d550ca7e4468d95da9a3005e07cbd2ab49d6 | tests/test_stock.py | tests/test_stock.py | import cutplanner
import unittest
class TestStock(unittest.TestCase):
def setUp(self):
self.stock = cutplanner.Stock(120)
def test_cut(self):
self.stock.assign_cut(20)
self.assertEqual(self.stock.remaining_length, 100)
if __name__ == '__main__':
unittest.main()
| import cutplanner
import unittest
class TestStock(unittest.TestCase):
def setUp(self):
self.stock = cutplanner.Stock(120)
self.piece = cutplanner.Piece(1, 20)
def test_cut(self):
self.stock.cut(self.piece)
self.assertEqual(self.stock.remaining_length, 100)
def test_used_l... | Add some initial tests for Stock. | Add some initial tests for Stock.
| Python | mit | alanc10n/py-cutplanner | import cutplanner
import unittest
class TestStock(unittest.TestCase):
def setUp(self):
self.stock = cutplanner.Stock(120)
self.piece = cutplanner.Piece(1, 20)
def test_cut(self):
self.stock.cut(self.piece)
self.assertEqual(self.stock.remaining_length, 100)
def test_used_l... | Add some initial tests for Stock.
import cutplanner
import unittest
class TestStock(unittest.TestCase):
def setUp(self):
self.stock = cutplanner.Stock(120)
def test_cut(self):
self.stock.assign_cut(20)
self.assertEqual(self.stock.remaining_length, 100)
if __name__ == '__main__':
... |
f45fc8854647754b24df5f9601920368cd2d3c49 | tests/chainerx_tests/unit_tests/test_cuda.py | tests/chainerx_tests/unit_tests/test_cuda.py | import pytest
from chainerx import _cuda
try:
import cupy
except Exception:
cupy = None
class CupyTestMemoryHook(cupy.cuda.memory_hook.MemoryHook):
name = 'CupyTestMemoryHook'
def __init__(self):
self.used_bytes = 0
self.acquired_bytes = 0
def alloc_preprocess(self, **kwargs)... | import pytest
from chainerx import _cuda
try:
import cupy
except Exception:
cupy = None
class CupyTestMemoryHook(cupy.cuda.memory_hook.MemoryHook):
name = 'CupyTestMemoryHook'
def __init__(self):
self.used_bytes = 0
self.acquired_bytes = 0
def alloc_preprocess(self, **kwargs)... | Add safety checks in test | Add safety checks in test
| Python | mit | wkentaro/chainer,hvy/chainer,niboshi/chainer,okuta/chainer,chainer/chainer,wkentaro/chainer,chainer/chainer,keisuke-umezawa/chainer,keisuke-umezawa/chainer,hvy/chainer,pfnet/chainer,hvy/chainer,chainer/chainer,keisuke-umezawa/chainer,okuta/chainer,chainer/chainer,tkerola/chainer,keisuke-umezawa/chainer,wkentaro/chainer... | import pytest
from chainerx import _cuda
try:
import cupy
except Exception:
cupy = None
class CupyTestMemoryHook(cupy.cuda.memory_hook.MemoryHook):
name = 'CupyTestMemoryHook'
def __init__(self):
self.used_bytes = 0
self.acquired_bytes = 0
def alloc_preprocess(self, **kwargs)... | Add safety checks in test
import pytest
from chainerx import _cuda
try:
import cupy
except Exception:
cupy = None
class CupyTestMemoryHook(cupy.cuda.memory_hook.MemoryHook):
name = 'CupyTestMemoryHook'
def __init__(self):
self.used_bytes = 0
self.acquired_bytes = 0
def alloc... |
226a4c1af180f0bf1924a84c76d1d2b300557e9b | instana/instrumentation/urllib3.py | instana/instrumentation/urllib3.py | from __future__ import absolute_import
import opentracing.ext.tags as ext
import instana
import opentracing
import wrapt
@wrapt.patch_function_wrapper('urllib3', 'PoolManager.urlopen')
def urlopen_with_instana(wrapped, instance, args, kwargs):
try:
span = instana.internal_tracer.start_span("urllib3")
... | from __future__ import absolute_import
import opentracing.ext.tags as ext
import instana
import opentracing
import wrapt
@wrapt.patch_function_wrapper('urllib3', 'PoolManager.urlopen')
def urlopen_with_instana(wrapped, instance, args, kwargs):
try:
span = instana.internal_tracer.start_span("urllib3")
... | Make sure to finish span when there is an exception | Make sure to finish span when there is an exception
| Python | mit | instana/python-sensor,instana/python-sensor | from __future__ import absolute_import
import opentracing.ext.tags as ext
import instana
import opentracing
import wrapt
@wrapt.patch_function_wrapper('urllib3', 'PoolManager.urlopen')
def urlopen_with_instana(wrapped, instance, args, kwargs):
try:
span = instana.internal_tracer.start_span("urllib3")
... | Make sure to finish span when there is an exception
from __future__ import absolute_import
import opentracing.ext.tags as ext
import instana
import opentracing
import wrapt
@wrapt.patch_function_wrapper('urllib3', 'PoolManager.urlopen')
def urlopen_with_instana(wrapped, instance, args, kwargs):
try:
span... |
3452603d99d82c76e3119c2da77c2f4a63777611 | assisstant/keyboard/ui/components.py | assisstant/keyboard/ui/components.py | from PyQt5.QtWidgets import QOpenGLWidget
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QPainter, QBrush
class FlashingBox(QOpenGLWidget):
def __init__(self, parent, freq, color):
super(FlashingBox, self).__init__(parent)
self.freq = freq
self.brushes = [QBrush(Qt.black), QBrush(color)]
self.i... | from PyQt5.QtWidgets import QOpenGLWidget
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QPainter, QBrush
class FlashingBox(QOpenGLWidget):
def __init__(self, parent, freq=1, color=Qt.black):
super(FlashingBox, self).__init__(parent)
self.freq = freq
self.brushes = [QBrush(Qt.black), QBrush(color)]
... | Add setFreq/setColor methods for FlashingBox | Add setFreq/setColor methods for FlashingBox
| Python | apache-2.0 | brainbots/assistant | from PyQt5.QtWidgets import QOpenGLWidget
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QPainter, QBrush
class FlashingBox(QOpenGLWidget):
def __init__(self, parent, freq=1, color=Qt.black):
super(FlashingBox, self).__init__(parent)
self.freq = freq
self.brushes = [QBrush(Qt.black), QBrush(color)]
... | Add setFreq/setColor methods for FlashingBox
from PyQt5.QtWidgets import QOpenGLWidget
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QPainter, QBrush
class FlashingBox(QOpenGLWidget):
def __init__(self, parent, freq, color):
super(FlashingBox, self).__init__(parent)
self.freq = freq
self.brushes ... |
d731ad50b863d32740bec857d46cc0c80e440185 | tests/melopy_tests.py | tests/melopy_tests.py | #!/usr/bin/env
# -*- coding: utf-8 -*-
from unittest import TestCase
from nose.tools import *
from melopy.melopy import *
class MelopyTests(TestCase):
def test_dummy(self):
assert True
| #!/usr/bin/env
# -*- coding: utf-8 -*-
from unittest import TestCase
from nose.tools import *
from melopy import *
class LibraryFunctionsTests(TestCase):
def test_frequency_from_key(self):
key = 49
assert frequency_from_key(key) == 440
def test_frequency_from_note(self):
note = 'A4'... | Add tests for the library methods. All except 2 pass right now. | Add tests for the library methods. All except 2 pass right now.
The two that don't pass, fail because I have changed what their output
should be. In the docs, it is shown that the output of
`generate_minor_scale`, given 'C4', is:
['C4', 'D4', 'E4', 'F4', 'G4', 'A4', 'A#4']
This is incorrect. The actual minor s... | Python | mit | jdan/Melopy,juliowaissman/Melopy | #!/usr/bin/env
# -*- coding: utf-8 -*-
from unittest import TestCase
from nose.tools import *
from melopy import *
class LibraryFunctionsTests(TestCase):
def test_frequency_from_key(self):
key = 49
assert frequency_from_key(key) == 440
def test_frequency_from_note(self):
note = 'A4'... | Add tests for the library methods. All except 2 pass right now.
The two that don't pass, fail because I have changed what their output
should be. In the docs, it is shown that the output of
`generate_minor_scale`, given 'C4', is:
['C4', 'D4', 'E4', 'F4', 'G4', 'A4', 'A#4']
This is incorrect. The actual minor s... |
79404e483462fd71aed1150e91657becd8a5aaf8 | clifford/test/test_multivector_inverse.py | clifford/test/test_multivector_inverse.py | import numpy as np
import pytest
import clifford as cf
class TestClosedForm:
@pytest.mark.parametrize('p, q', [
(p, total_dims - p)
for total_dims in [1, 2, 3, 4, 5]
for p in range(total_dims + 1)
])
def test_hitzer_inverse(self, p, q):
Ntests = 100
layout, blades... | import numpy as np
import pytest
import clifford as cf
class TestClosedForm:
@pytest.mark.parametrize('p, q', [
(p, total_dims - p)
for total_dims in [1, 2, 3, 4, 5]
for p in range(total_dims + 1)
])
def test_hitzer_inverse(self, p, q):
Ntests = 100
layout, blades... | Swap hitzer inverse test to use np.testing | Swap hitzer inverse test to use np.testing
| Python | bsd-3-clause | arsenovic/clifford,arsenovic/clifford | import numpy as np
import pytest
import clifford as cf
class TestClosedForm:
@pytest.mark.parametrize('p, q', [
(p, total_dims - p)
for total_dims in [1, 2, 3, 4, 5]
for p in range(total_dims + 1)
])
def test_hitzer_inverse(self, p, q):
Ntests = 100
layout, blades... | Swap hitzer inverse test to use np.testing
import numpy as np
import pytest
import clifford as cf
class TestClosedForm:
@pytest.mark.parametrize('p, q', [
(p, total_dims - p)
for total_dims in [1, 2, 3, 4, 5]
for p in range(total_dims + 1)
])
def test_hitzer_inverse(self, p, q)... |
024ddea9e3dc5ab2702b08c860e6df8702b3e5e8 | captain_hook/endpoint.py | captain_hook/endpoint.py | from __future__ import absolute_import
from os.path import abspath
from os.path import dirname
from flask import Flask, request
import yaml
import utils.config
from services import find_services
from comms import find_and_load_comms
CONFIG_FOLDER = dirname(dirname(abspath(__file__)))
application = Flask(__name__)
... | from __future__ import absolute_import
from os.path import abspath
from os.path import dirname
from flask import Flask, request
import yaml
import utils.config
from services import find_services
from comms import find_and_load_comms
CONFIG_FOLDER = dirname(dirname(abspath(__file__)))
application = Flask(__name__)
... | Make services only receive their related configs | Make services only receive their related configs
| Python | apache-2.0 | brantje/captain_hook,brantje/telegram-github-bot,brantje/telegram-github-bot,brantje/captain_hook,brantje/telegram-github-bot,brantje/captain_hook | from __future__ import absolute_import
from os.path import abspath
from os.path import dirname
from flask import Flask, request
import yaml
import utils.config
from services import find_services
from comms import find_and_load_comms
CONFIG_FOLDER = dirname(dirname(abspath(__file__)))
application = Flask(__name__)
... | Make services only receive their related configs
from __future__ import absolute_import
from os.path import abspath
from os.path import dirname
from flask import Flask, request
import yaml
import utils.config
from services import find_services
from comms import find_and_load_comms
CONFIG_FOLDER = dirname(dirname(abs... |
7a33e2e94e46dc3465a088cf4755134a09f6627c | src/models/user.py | src/models/user.py | from flock import db
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
def __init__(self):
pass
| from flock import db
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
suggestions = db.relationship('Suggestion', secondary=suggestions,
backref=db.backref('users', lazy='dynamic'))
def __init__(self):
pass
| Add suggestions to User model | Add suggestions to User model | Python | agpl-3.0 | DavidJFelix/hatchit,DavidJFelix/hatchit,DavidJFelix/hatchit | from flock import db
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
suggestions = db.relationship('Suggestion', secondary=suggestions,
backref=db.backref('users', lazy='dynamic'))
def __init__(self):
pass
| Add suggestions to User model
from flock import db
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
def __init__(self):
pass
|
8e1d07fd4ae8a2415a133fa46555869238bacaf2 | setup.py | setup.py | from setuptools import setup
setup(name='glreg',
version='0.9.0',
description='OpenGL XML API registry parser',
url='https://github.com/pyokagan/pyglreg',
author='Paul Tan',
author_email='pyokagan@gmail.com',
license='MIT',
classifiers=[
'Development Status :: 3 - A... | from setuptools import setup
setup(name='glreg',
version='0.9.0',
description='OpenGL XML API registry parser',
url='https://github.com/pyokagan/pyglreg',
author='Paul Tan',
author_email='pyokagan@gmail.com',
license='MIT',
classifiers=[
'Development Status :: 3 - A... | Add more pypi trove classifiers | Add more pypi trove classifiers
| Python | mit | pyokagan/pyglreg,pyokagan/pyglreg | from setuptools import setup
setup(name='glreg',
version='0.9.0',
description='OpenGL XML API registry parser',
url='https://github.com/pyokagan/pyglreg',
author='Paul Tan',
author_email='pyokagan@gmail.com',
license='MIT',
classifiers=[
'Development Status :: 3 - A... | Add more pypi trove classifiers
from setuptools import setup
setup(name='glreg',
version='0.9.0',
description='OpenGL XML API registry parser',
url='https://github.com/pyokagan/pyglreg',
author='Paul Tan',
author_email='pyokagan@gmail.com',
license='MIT',
classifiers=[
... |
a9fb1bb437e27f0bcd5a382e82f100722d9f0688 | data_structures/circular_buffer.py | data_structures/circular_buffer.py | from .transition import Transition
class CircularBuffer(object):
def __init__(self, capacity=100000):
self.capacity = capacity
self.memory = []
self.position = 0
def push(self, *args):
if len(self.memory) < self.capacity:
self.memory.append(Transition(*args))
... | from .transition import Transition
class CircularBuffer(object):
def __init__(self, capacity=100000):
self.capacity = capacity
self.memory = []
self.position = 0
def push(self, *args):
if len(self.memory) < self.capacity:
self.memory.append(Transition(*args))
... | Fix index. Caught by Tudor. | Fix index. Caught by Tudor.
| Python | mit | floringogianu/categorical-dqn | from .transition import Transition
class CircularBuffer(object):
def __init__(self, capacity=100000):
self.capacity = capacity
self.memory = []
self.position = 0
def push(self, *args):
if len(self.memory) < self.capacity:
self.memory.append(Transition(*args))
... | Fix index. Caught by Tudor.
from .transition import Transition
class CircularBuffer(object):
def __init__(self, capacity=100000):
self.capacity = capacity
self.memory = []
self.position = 0
def push(self, *args):
if len(self.memory) < self.capacity:
self.memory.ap... |
eb0579d7bcd585e8ae0ca82060540743f8ec90ae | py/tables.py | py/tables.py | import sqlalchemy
import sqlalchemy.ext.declarative
Base = sqlalchemy.ext.declarative.declarative_base()
class Post(Base):
__tablename__ = "posts"
id = sqlalchemy.Column(sqlalchemy.Integer, primary_key = True)
title = sqlalchemy.Column(sqlalchemy.String)
body = sqlalchemy.Column(sqlalchemy.Text,) #Should be text... | import sqlalchemy
import sqlalchemy.ext.declarative
Base = sqlalchemy.ext.declarative.declarative_base()
class Post(Base):
__tablename__ = "posts"
id = sqlalchemy.Column(sqlalchemy.Integer, primary_key = True)
title = sqlalchemy.Column(sqlalchemy.String)
body = sqlalchemy.Column(sqlalchemy.Text,) #Should be text... | Fix bug where column the function was being called, rather than class | Fix bug where column the function was being called, rather than class
| Python | mit | ollien/Timpani,ollien/Timpani,ollien/Timpani | import sqlalchemy
import sqlalchemy.ext.declarative
Base = sqlalchemy.ext.declarative.declarative_base()
class Post(Base):
__tablename__ = "posts"
id = sqlalchemy.Column(sqlalchemy.Integer, primary_key = True)
title = sqlalchemy.Column(sqlalchemy.String)
body = sqlalchemy.Column(sqlalchemy.Text,) #Should be text... | Fix bug where column the function was being called, rather than class
import sqlalchemy
import sqlalchemy.ext.declarative
Base = sqlalchemy.ext.declarative.declarative_base()
class Post(Base):
__tablename__ = "posts"
id = sqlalchemy.Column(sqlalchemy.Integer, primary_key = True)
title = sqlalchemy.Column(sqlalch... |
62c3fcd65b4c7d3cc4732885cf81640607a04480 | marty/commands/remotes.py | marty/commands/remotes.py | import datetime
import arrow
from marty.commands import Command
from marty.printer import printer
class Remotes(Command):
""" Show the list of configured remotes.
"""
help = 'Show the list of configured remotes'
def run(self, args, config, storage, remotes):
table_lines = [('<b>NAME</b>',... | import datetime
import arrow
from marty.commands import Command
from marty.printer import printer
class Remotes(Command):
""" Show the list of configured remotes.
"""
help = 'Show the list of configured remotes'
def run(self, args, config, storage, remotes):
table_lines = [('<b>NAME</b>',... | Clean useless format string in remote command | Clean useless format string in remote command
| Python | mit | NaPs/Marty | import datetime
import arrow
from marty.commands import Command
from marty.printer import printer
class Remotes(Command):
""" Show the list of configured remotes.
"""
help = 'Show the list of configured remotes'
def run(self, args, config, storage, remotes):
table_lines = [('<b>NAME</b>',... | Clean useless format string in remote command
import datetime
import arrow
from marty.commands import Command
from marty.printer import printer
class Remotes(Command):
""" Show the list of configured remotes.
"""
help = 'Show the list of configured remotes'
def run(self, args, config, storage, r... |
f516749bc41dbebeb5b0ae07078af78f510a592e | lib/markdown_deux/__init__.py | lib/markdown_deux/__init__.py | #!/usr/bin/env python
# Copyright (c) 2008-2010 ActiveState Corp.
# License: MIT (http://www.opensource.org/licenses/mit-license.php)
r"""A small Django app that provides template tags for Markdown using the
python-markdown2 library.
See <http://github.com/trentm/django-markdown-deux> for more info.
"""
__version_in... | #!/usr/bin/env python
# Copyright (c) 2008-2010 ActiveState Corp.
# License: MIT (http://www.opensource.org/licenses/mit-license.php)
r"""A small Django app that provides template tags for Markdown using the
python-markdown2 library.
See <http://github.com/trentm/django-markdown-deux> for more info.
"""
__version_in... | Fix having ver info written twice (divergence). Makes "mk cut_a_release" ver update work. | Fix having ver info written twice (divergence). Makes "mk cut_a_release" ver update work.
| Python | mit | douzepouze/django-markdown-tag,trentm/django-markdown-deux,gogobook/django-markdown-deux,gogobook/django-markdown-deux | #!/usr/bin/env python
# Copyright (c) 2008-2010 ActiveState Corp.
# License: MIT (http://www.opensource.org/licenses/mit-license.php)
r"""A small Django app that provides template tags for Markdown using the
python-markdown2 library.
See <http://github.com/trentm/django-markdown-deux> for more info.
"""
__version_in... | Fix having ver info written twice (divergence). Makes "mk cut_a_release" ver update work.
#!/usr/bin/env python
# Copyright (c) 2008-2010 ActiveState Corp.
# License: MIT (http://www.opensource.org/licenses/mit-license.php)
r"""A small Django app that provides template tags for Markdown using the
python-markdown2 lib... |
a4e98c9bdf1a16e4bcf4ec952452913b9812bb9e | fire_risk/models/DIST/providers/iaff.py | fire_risk/models/DIST/providers/iaff.py | # A dictionary where the key is an fdid-state and the values are lognormal fits generated
# from response time gis data.
response_time_distributions = {
'37140-CA': (0.20611095226322063, -4.7357748161635111, 8.6850997083002905),
'02072-FL': (0.34949627393777505, -2.1718657657665021, 6.6793162966144539),
'0... | Add response time distributions from GIS. | Add response time distributions from GIS.
| Python | mit | FireCARES/fire-risk,FireCARES/fire-risk | # A dictionary where the key is an fdid-state and the values are lognormal fits generated
# from response time gis data.
response_time_distributions = {
'37140-CA': (0.20611095226322063, -4.7357748161635111, 8.6850997083002905),
'02072-FL': (0.34949627393777505, -2.1718657657665021, 6.6793162966144539),
'0... | Add response time distributions from GIS.
| |
11860d9181d7a8e1a3924bc42234903ba96e304d | ForgeGit/forgegit/tests/test_git_app.py | ForgeGit/forgegit/tests/test_git_app.py | import unittest
from pylons import c, g
from ming.orm import ThreadLocalORMSession
from pyforge.tests import helpers
from pyforge.lib import helpers as h
class TestGitApp(unittest.TestCase):
def setUp(self):
helpers.setup_basic_test()
helpers.setup_global_objects()
h.set_context('test',... | import unittest
from pylons import c, g
from ming.orm import ThreadLocalORMSession
from pyforge.tests import helpers
from pyforge.lib import helpers as h
class TestGitApp(unittest.TestCase):
def setUp(self):
helpers.setup_basic_test()
helpers.setup_global_objects()
h.set_context('test',... | Update test to reflect changing git codebase | Update test to reflect changing git codebase
| Python | apache-2.0 | apache/incubator-allura,lym/allura-git,Bitergia/allura,lym/allura-git,leotrubach/sourceforge-allura,Bitergia/allura,leotrubach/sourceforge-allura,lym/allura-git,heiths/allura,Bitergia/allura,leotrubach/sourceforge-allura,apache/incubator-allura,heiths/allura,lym/allura-git,apache/incubator-allura,heiths/allura,lym/allu... | import unittest
from pylons import c, g
from ming.orm import ThreadLocalORMSession
from pyforge.tests import helpers
from pyforge.lib import helpers as h
class TestGitApp(unittest.TestCase):
def setUp(self):
helpers.setup_basic_test()
helpers.setup_global_objects()
h.set_context('test',... | Update test to reflect changing git codebase
import unittest
from pylons import c, g
from ming.orm import ThreadLocalORMSession
from pyforge.tests import helpers
from pyforge.lib import helpers as h
class TestGitApp(unittest.TestCase):
def setUp(self):
helpers.setup_basic_test()
helpers.setup_... |
7e71e011fc4266b1edf21a0028cf878a71ab23fe | PyOpenWorm/plot.py | PyOpenWorm/plot.py | from PyOpenWorm import *
class Plot(DataObject):
"""
Object for storing plot data in PyOpenWorm.
Must be instantiated with a 2D list of coordinates.
"""
def __init__(self, data=False, *args, **kwargs):
DataObject.__init__(self, **kwargs)
Plot.DatatypeProperty('_data_string', self... | from PyOpenWorm import *
class Plot(DataObject):
"""
Object for storing plot data in PyOpenWorm.
Must be instantiated with a 2D list of coordinates.
"""
def __init__(self, data=False, *args, **kwargs):
DataObject.__init__(self, **kwargs)
Plot.DatatypeProperty('_data_string', self... | Add data setter and getter for Plot | Add data setter and getter for Plot
| Python | mit | gsarma/PyOpenWorm,openworm/PyOpenWorm,openworm/PyOpenWorm,gsarma/PyOpenWorm | from PyOpenWorm import *
class Plot(DataObject):
"""
Object for storing plot data in PyOpenWorm.
Must be instantiated with a 2D list of coordinates.
"""
def __init__(self, data=False, *args, **kwargs):
DataObject.__init__(self, **kwargs)
Plot.DatatypeProperty('_data_string', self... | Add data setter and getter for Plot
from PyOpenWorm import *
class Plot(DataObject):
"""
Object for storing plot data in PyOpenWorm.
Must be instantiated with a 2D list of coordinates.
"""
def __init__(self, data=False, *args, **kwargs):
DataObject.__init__(self, **kwargs)
Plot.... |
a96ed550bd0c67b7a9ec0b9f636f71c530441e5f | graphene/types/abstracttype.py | graphene/types/abstracttype.py | from ..utils.subclass_with_meta import SubclassWithMeta
from ..utils.deprecated import warn_deprecation
class AbstractType(SubclassWithMeta):
def __init_subclass__(cls, *args, **kwargs):
warn_deprecation(
"Abstract type is deprecated, please use normal object inheritance instead.\n"
... | from ..utils.subclass_with_meta import SubclassWithMeta
from ..utils.deprecated import warn_deprecation
class AbstractType(SubclassWithMeta):
def __init_subclass__(cls, *args, **kwargs):
warn_deprecation(
"Abstract type is deprecated, please use normal object inheritance instead.\n"
... | Fix deprecations url in DeprecationWarning message. | Fix deprecations url in DeprecationWarning message.
| Python | mit | graphql-python/graphene,graphql-python/graphene | from ..utils.subclass_with_meta import SubclassWithMeta
from ..utils.deprecated import warn_deprecation
class AbstractType(SubclassWithMeta):
def __init_subclass__(cls, *args, **kwargs):
warn_deprecation(
"Abstract type is deprecated, please use normal object inheritance instead.\n"
... | Fix deprecations url in DeprecationWarning message.
from ..utils.subclass_with_meta import SubclassWithMeta
from ..utils.deprecated import warn_deprecation
class AbstractType(SubclassWithMeta):
def __init_subclass__(cls, *args, **kwargs):
warn_deprecation(
"Abstract type is deprecated, pleas... |
b3aeb1b1270e86d8c85a286de3a5f8443cfee2e5 | planetstack/model_policies/model_policy_Slice.py | planetstack/model_policies/model_policy_Slice.py | from core.models import *
def handle(slice):
site_deployments = SiteDeployments.objects.all()
site_deploy_lookup = defaultdict(list)
for site_deployment in site_deployments:
site_deploy_lookup[site_deployment.site].append(site_deployment.deployment)
slice_deployments = SliceDeployments.objects.all()
slice_dep... | Add new slices to all deployments | Policy: Add new slices to all deployments
| Python | apache-2.0 | wathsalav/xos,zdw/xos,xmaruto/mcord,cboling/xos,cboling/xos,wathsalav/xos,zdw/xos,xmaruto/mcord,zdw/xos,cboling/xos,opencord/xos,jermowery/xos,open-cloud/xos,xmaruto/mcord,opencord/xos,wathsalav/xos,opencord/xos,jermowery/xos,cboling/xos,cboling/xos,jermowery/xos,zdw/xos,open-cloud/xos,jermowery/xos,wathsalav/xos,xmaru... | from core.models import *
def handle(slice):
site_deployments = SiteDeployments.objects.all()
site_deploy_lookup = defaultdict(list)
for site_deployment in site_deployments:
site_deploy_lookup[site_deployment.site].append(site_deployment.deployment)
slice_deployments = SliceDeployments.objects.all()
slice_dep... | Policy: Add new slices to all deployments
| |
013048e1d68174e71d4579e28efd0339144ce186 | 2017/11.07/python/jya_homework2.py | 2017/11.07/python/jya_homework2.py | ```python
i = -1
sum = 0
one_to_ten = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
while i < 10:
i += 1
sum += one_to_ten[i]
print(sum)
``` | ```python
i = -1
sum = 0
one_to_ten = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
while i < 10:
i += 1
sum += one_to_ten[i]
print(sum)
```
**Make function!**
`like:`
```python
def sum(number):
# .. TODO
return 0
```
`I want to reuse this function, like:`
```python
one_to_ten = sum(range(1,11))
one_to_five = sum(ra... | Make function! and Use 4 tabs, not 8 tabs. | Make function! and Use 4 tabs, not 8 tabs. | Python | mit | Yokan-Study/study,Yokan-Study/study,Yokan-Study/study | ```python
i = -1
sum = 0
one_to_ten = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
while i < 10:
i += 1
sum += one_to_ten[i]
print(sum)
```
**Make function!**
`like:`
```python
def sum(number):
# .. TODO
return 0
```
`I want to reuse this function, like:`
```python
one_to_ten = sum(range(1,11))
one_to_five = sum(ra... | Make function! and Use 4 tabs, not 8 tabs.
```python
i = -1
sum = 0
one_to_ten = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
while i < 10:
i += 1
sum += one_to_ten[i]
print(sum)
``` |
28d5e53da8a92985fa9b1b4a532467dd343cc4b5 | apilisk/junit_formatter.py | apilisk/junit_formatter.py | import json
from junit_xml import TestSuite, TestCase
class JunitFormatter(object):
def __init__(self, project_cfg, project_result):
"""Initialize the stuff"""
self.testcases = {
str(item["id"]): item for item in project_cfg["testcases"]
}
test_cases = []
for ... | # -*- coding: utf-8 -*-
import json
from junit_xml import TestSuite, TestCase
class JunitFormatter(object):
def __init__(self, project_cfg, project_result):
"""Initialize the stuff"""
self.testcases = {
unicode(item["id"]): item for item in project_cfg["testcases"]
}
... | Fix junit utf-8 output to file | Fix junit utf-8 output to file
| Python | mit | apiwatcher/apilisk | # -*- coding: utf-8 -*-
import json
from junit_xml import TestSuite, TestCase
class JunitFormatter(object):
def __init__(self, project_cfg, project_result):
"""Initialize the stuff"""
self.testcases = {
unicode(item["id"]): item for item in project_cfg["testcases"]
}
... | Fix junit utf-8 output to file
import json
from junit_xml import TestSuite, TestCase
class JunitFormatter(object):
def __init__(self, project_cfg, project_result):
"""Initialize the stuff"""
self.testcases = {
str(item["id"]): item for item in project_cfg["testcases"]
}
... |
6fd86d15d896a5fcfc3d013cb9be47405be6491b | setup.py | setup.py | from setuptools import setup
setup(
name="teamscale-client",
version="3.1.1",
author="Thomas Kinnen - CQSE GmbH",
author_email="kinnen@cqse.eu",
description=("A simple service client to interact with Teamscale's REST API."),
license="Apache",
keywords="rest api teamscale",
url="https://... | from setuptools import setup
setup(
name="teamscale-client",
version="3.2.0",
author="Thomas Kinnen - CQSE GmbH",
author_email="kinnen@cqse.eu",
description=("A simple service client to interact with Teamscale's REST API."),
license="Apache",
keywords="rest api teamscale",
url="https://... | Update Client Version to 3.2 | Update Client Version to 3.2
| Python | apache-2.0 | cqse/teamscale-client-python | from setuptools import setup
setup(
name="teamscale-client",
version="3.2.0",
author="Thomas Kinnen - CQSE GmbH",
author_email="kinnen@cqse.eu",
description=("A simple service client to interact with Teamscale's REST API."),
license="Apache",
keywords="rest api teamscale",
url="https://... | Update Client Version to 3.2
from setuptools import setup
setup(
name="teamscale-client",
version="3.1.1",
author="Thomas Kinnen - CQSE GmbH",
author_email="kinnen@cqse.eu",
description=("A simple service client to interact with Teamscale's REST API."),
license="Apache",
keywords="rest api... |
b8e9a2af61e1b8fe45e32966495e46357a145a56 | dom/automation/detect_assertions.py | dom/automation/detect_assertions.py | #!/usr/bin/env python
def amiss(logPrefix):
global ignoreList
foundSomething = False
currentFile = file(logPrefix + "-err", "r")
# map from (assertion message) to (true, if seen in the current file)
seenInCurrentFile = {}
for line in currentFile:
line = line.strip("\x07").rstrip(... | #!/usr/bin/env python
import platform
def amiss(logPrefix):
global ignoreList
foundSomething = False
currentFile = file(logPrefix + "-err", "r")
# map from (assertion message) to (true, if seen in the current file)
seenInCurrentFile = {}
for line in currentFile:
line = line.stri... | Make known_assertions.txt cross-machine and hopefully also cross-platform. | Make known_assertions.txt cross-machine and hopefully also cross-platform.
| Python | mpl-2.0 | nth10sd/funfuzz,MozillaSecurity/funfuzz,MozillaSecurity/funfuzz,nth10sd/funfuzz,MozillaSecurity/funfuzz,nth10sd/funfuzz | #!/usr/bin/env python
import platform
def amiss(logPrefix):
global ignoreList
foundSomething = False
currentFile = file(logPrefix + "-err", "r")
# map from (assertion message) to (true, if seen in the current file)
seenInCurrentFile = {}
for line in currentFile:
line = line.stri... | Make known_assertions.txt cross-machine and hopefully also cross-platform.
#!/usr/bin/env python
def amiss(logPrefix):
global ignoreList
foundSomething = False
currentFile = file(logPrefix + "-err", "r")
# map from (assertion message) to (true, if seen in the current file)
seenInCurrentFile ... |
d39b44069311355c2e83e59a0b28864c89cd02f7 | avenue/database/__init__.py | avenue/database/__init__.py | # Copyright (c) 2012 Michael Babich
# See LICENSE.txt or http://opensource.org/licenses/MIT
'''This submodule manages the database.
'''
from sqlalchemy import create_engine, MetaData
from avenue.database.tables import get_tables
# LOCATION = 'sqlite:///:memory:'
LOCATION = 'sqlite:////home/mbabich/foo.sqlite'
engin... | # Copyright (c) 2012 Michael Babich
# See LICENSE.txt or http://opensource.org/licenses/MIT
'''This submodule manages the database.
'''
from sqlalchemy import create_engine, MetaData
from avenue.database.tables import get_tables
LOCATION = 'sqlite:///:memory:'
# LOCATION = 'sqlite:////home/mbabich/foo.sqlite'
engin... | Switch back to in-memory sqlite. | Switch back to in-memory sqlite.
| Python | mit | Aethaeryn/avenue | # Copyright (c) 2012 Michael Babich
# See LICENSE.txt or http://opensource.org/licenses/MIT
'''This submodule manages the database.
'''
from sqlalchemy import create_engine, MetaData
from avenue.database.tables import get_tables
LOCATION = 'sqlite:///:memory:'
# LOCATION = 'sqlite:////home/mbabich/foo.sqlite'
engin... | Switch back to in-memory sqlite.
# Copyright (c) 2012 Michael Babich
# See LICENSE.txt or http://opensource.org/licenses/MIT
'''This submodule manages the database.
'''
from sqlalchemy import create_engine, MetaData
from avenue.database.tables import get_tables
# LOCATION = 'sqlite:///:memory:'
LOCATION = 'sqlite:/... |
d0bea0fa49eb6c70f4c014d210fddf3a3a500ce6 | ci/testsettings.py | ci/testsettings.py | # This file is exec'd from settings.py, so it has access to and can
# modify all the variables in settings.py.
# If this file is changed in development, the development server will
# have to be manually restarted because changes will not be noticed
# immediately.
DEBUG = False
# disable compression for tests that ch... | # This file is exec'd from settings.py, so it has access to and can
# modify all the variables in settings.py.
# If this file is changed in development, the development server will
# have to be manually restarted because changes will not be noticed
# immediately.
DEBUG = False
# disable compression for tests that ch... | Update travis-ci settings to use local backend with range queries | Update travis-ci settings to use local backend with range queries
| Python | apache-2.0 | Princeton-CDH/derrida-django,Princeton-CDH/derrida-django,Princeton-CDH/derrida-django,Princeton-CDH/derrida-django | # This file is exec'd from settings.py, so it has access to and can
# modify all the variables in settings.py.
# If this file is changed in development, the development server will
# have to be manually restarted because changes will not be noticed
# immediately.
DEBUG = False
# disable compression for tests that ch... | Update travis-ci settings to use local backend with range queries
# This file is exec'd from settings.py, so it has access to and can
# modify all the variables in settings.py.
# If this file is changed in development, the development server will
# have to be manually restarted because changes will not be noticed
# i... |
8ce509a2a3df1fcc38442e35e8733bf00bd788ad | harvest/decorators.py | harvest/decorators.py | import os
from functools import wraps
from argparse import ArgumentParser
from fabric.context_managers import prefix
def cached_property(func):
cach_attr = '_{0}'.format(func.__name__)
@property
def wrap(self):
if not hasattr(self, cach_attr):
value = func(self)
if value i... | import os
from functools import wraps
from argparse import ArgumentParser
from fabric.context_managers import prefix
def cached_property(func):
cach_attr = '_{0}'.format(func.__name__)
@property
def wrap(self):
if not hasattr(self, cach_attr):
value = func(self)
if value i... | Return resulting object from decorated function if any | Return resulting object from decorated function if any
| Python | bsd-2-clause | chop-dbhi/harvest,tjrivera/harvest | import os
from functools import wraps
from argparse import ArgumentParser
from fabric.context_managers import prefix
def cached_property(func):
cach_attr = '_{0}'.format(func.__name__)
@property
def wrap(self):
if not hasattr(self, cach_attr):
value = func(self)
if value i... | Return resulting object from decorated function if any
import os
from functools import wraps
from argparse import ArgumentParser
from fabric.context_managers import prefix
def cached_property(func):
cach_attr = '_{0}'.format(func.__name__)
@property
def wrap(self):
if not hasattr(self, cach_attr... |
ccf9e48cf874e7970c5b2e587e797a0501483139 | spec/data/anagram_index_spec.py | spec/data/anagram_index_spec.py | from data import anagram_index, warehouse
from spec.mamba import *
with description('anagram_index'):
with before.all:
self.subject = anagram_index.AnagramIndex(warehouse.get('/words/unigram'))
with it('instantiates'):
expect(len(self.subject)).to(be_above(0))
with it('accepts pre-sort-jumbled anagrams... | import collections
from data import anagram_index
from spec.data.fixtures import tries
from spec.mamba import *
with description('anagram_index'):
with before.all:
words = collections.OrderedDict(tries.kitchen_sink_data())
self.subject = anagram_index.AnagramIndex(words)
with it('instantiates'):
expe... | Update anagram index spec data source. | Update anagram index spec data source.
| Python | mit | PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge | import collections
from data import anagram_index
from spec.data.fixtures import tries
from spec.mamba import *
with description('anagram_index'):
with before.all:
words = collections.OrderedDict(tries.kitchen_sink_data())
self.subject = anagram_index.AnagramIndex(words)
with it('instantiates'):
expe... | Update anagram index spec data source.
from data import anagram_index, warehouse
from spec.mamba import *
with description('anagram_index'):
with before.all:
self.subject = anagram_index.AnagramIndex(warehouse.get('/words/unigram'))
with it('instantiates'):
expect(len(self.subject)).to(be_above(0))
wi... |
6a330523ad683b7883cefa3878c7690fcb5dbd75 | TalkingToYouBot.py | TalkingToYouBot.py | from telegram import Updater
import json
import os
def getToken():
token = []
if not os.path.exists(file_path):
token.append(input('Insert Token here: '))
with open('token.json', 'w') as f:
json.dump(token, f)
else:
with open("token.json") as f:
token = json... | from telegram import Updater
import json
import os
def getToken():
token = []
if not os.path.exists(file_path):
token.append(input('Insert Token here: '))
with open('token.json', 'w') as f:
json.dump(token, f)
else:
with open("token.json") as f:
token = json... | Add simple Echo function and Bot initialisation | Add simple Echo function and Bot initialisation
| Python | mit | h4llow3En/IAmTalkingToYouBot | from telegram import Updater
import json
import os
def getToken():
token = []
if not os.path.exists(file_path):
token.append(input('Insert Token here: '))
with open('token.json', 'w') as f:
json.dump(token, f)
else:
with open("token.json") as f:
token = json... | Add simple Echo function and Bot initialisation
from telegram import Updater
import json
import os
def getToken():
token = []
if not os.path.exists(file_path):
token.append(input('Insert Token here: '))
with open('token.json', 'w') as f:
json.dump(token, f)
else:
with ... |
975c7d27d5972d92f491048add9786da50da7d71 | setup.py | setup.py | from setuptools import setup, find_packages
setup(name='lightweight-rest-tester',
version='1.2.0',
description='A lightweight REST API testing framework.',
url='https://github.com/ridibooks/lightweight-rest-tester',
author='Jeehoon Yoo',
author_email='jeehoon.yoo@ridi.com',
license=... | from setuptools import setup, find_packages
setup(name='lightweight-rest-tester',
version='1.4.0',
description='A lightweight REST API testing framework.',
url='https://github.com/ridibooks/lightweight-rest-tester',
author='Jeehoon Yoo',
author_email='jeehoon.yoo@ridi.com',
license=... | Update the version to 1.4.0. | Update the version to 1.4.0.
| Python | mit | ridibooks/lightweight-rest-tester,ridibooks/lightweight-rest-tester | from setuptools import setup, find_packages
setup(name='lightweight-rest-tester',
version='1.4.0',
description='A lightweight REST API testing framework.',
url='https://github.com/ridibooks/lightweight-rest-tester',
author='Jeehoon Yoo',
author_email='jeehoon.yoo@ridi.com',
license=... | Update the version to 1.4.0.
from setuptools import setup, find_packages
setup(name='lightweight-rest-tester',
version='1.2.0',
description='A lightweight REST API testing framework.',
url='https://github.com/ridibooks/lightweight-rest-tester',
author='Jeehoon Yoo',
author_email='jeehoon... |
e3c7322b0efe10041ba9c38963b9e9f188d9a54a | pkit/slot/decorators.py | pkit/slot/decorators.py | import functools
from pkit.slot import get_slot_pool
def acquire(pool_name):
"""Actor's method decorator to auto-acquire a slot before execution"""
def decorator(method):
@functools.wraps(method)
def wrapper(self, *args, **kwargs):
slots_pool = get_slot_pool(pool_name)
... | import functools
from pkit.slot import get_slot_pool
def acquire(pool_name):
"""Actor's method decorator to auto-acquire a slot before execution"""
def decorator(method):
@functools.wraps(method)
def wrapper(self, *args, **kwargs):
slots_pool = get_slot_pool(pool_name)
... | Fix slot release on method exception | Fix slot release on method exception
| Python | mit | botify-labs/process-kit | import functools
from pkit.slot import get_slot_pool
def acquire(pool_name):
"""Actor's method decorator to auto-acquire a slot before execution"""
def decorator(method):
@functools.wraps(method)
def wrapper(self, *args, **kwargs):
slots_pool = get_slot_pool(pool_name)
... | Fix slot release on method exception
import functools
from pkit.slot import get_slot_pool
def acquire(pool_name):
"""Actor's method decorator to auto-acquire a slot before execution"""
def decorator(method):
@functools.wraps(method)
def wrapper(self, *args, **kwargs):
slots_pool ... |
38cd50805e080f6613d7e1d5867a84952ec88580 | flask_resty/related.py | flask_resty/related.py | from .exceptions import ApiError
# -----------------------------------------------------------------------------
class Related(object):
def __init__(self, item_class=None, **kwargs):
self._item_class = item_class
self._view_classes = kwargs
def resolve_related(self, data):
for field_... | from .exceptions import ApiError
# -----------------------------------------------------------------------------
class Related(object):
def __init__(self, item_class=None, **kwargs):
self._item_class = item_class
self._resolvers = kwargs
def resolve_related(self, data):
for field_nam... | Fix variable names in Related | Fix variable names in Related
| Python | mit | taion/flask-jsonapiview,4Catalyzer/flask-jsonapiview,4Catalyzer/flask-resty | from .exceptions import ApiError
# -----------------------------------------------------------------------------
class Related(object):
def __init__(self, item_class=None, **kwargs):
self._item_class = item_class
self._resolvers = kwargs
def resolve_related(self, data):
for field_nam... | Fix variable names in Related
from .exceptions import ApiError
# -----------------------------------------------------------------------------
class Related(object):
def __init__(self, item_class=None, **kwargs):
self._item_class = item_class
self._view_classes = kwargs
def resolve_related(... |
ce873b24318fd6493f570f370db1d2c2d244bdcc | joby/spiders/data_science_jobs.py | joby/spiders/data_science_jobs.py | # -*- coding: utf-8 -*-
from logging import getLogger
from scrapy.spiders import Rule, CrawlSpider
from scrapy.linkextractors import LinkExtractor
class DataScienceJobsSpider(CrawlSpider):
log = getLogger(__name__)
name = 'data-science-jobs'
allowed_domains = ['www.data-science-jobs.com', 'fonts.googleap... | # -*- coding: utf-8 -*-
from logging import getLogger
from scrapy.spiders import Rule, CrawlSpider
from scrapy.linkextractors import LinkExtractor
class DataScienceJobsSpider(CrawlSpider):
log = getLogger(__name__)
name = 'data-science-jobs'
allowed_domains = ['www.data-science-jobs.com']
start_urls ... | Rename the parser function to parse_jobs. | Rename the parser function to parse_jobs.
| Python | mit | cyberbikepunk/job-spiders | # -*- coding: utf-8 -*-
from logging import getLogger
from scrapy.spiders import Rule, CrawlSpider
from scrapy.linkextractors import LinkExtractor
class DataScienceJobsSpider(CrawlSpider):
log = getLogger(__name__)
name = 'data-science-jobs'
allowed_domains = ['www.data-science-jobs.com']
start_urls ... | Rename the parser function to parse_jobs.
# -*- coding: utf-8 -*-
from logging import getLogger
from scrapy.spiders import Rule, CrawlSpider
from scrapy.linkextractors import LinkExtractor
class DataScienceJobsSpider(CrawlSpider):
log = getLogger(__name__)
name = 'data-science-jobs'
allowed_domains = ['... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.