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
152
6.66k
prompt
stringlengths
21
3.65k
f4fa2d526f6f9c8b972c20ac073ed8f0682871ea
indra/tools/disambiguate.py
indra/tools/disambiguate.py
import logging from collections import defaultdict from indra.literature.elsevier_client import logger as elsevier_logger from indra.literature import pubmed_client, pmc_client, elsevier_client logger = logging.getLogger('disambiguate') # the elsevier_client will log messages that it is safe to ignore elsevier_logge...
Add unfinished scripts that assist in deft disambiguation
Add unfinished scripts that assist in deft disambiguation git history was completley farbed through carelessness. the original deft branch was deleted and a new branch was created
Python
bsd-2-clause
bgyori/indra,pvtodorov/indra,sorgerlab/indra,johnbachman/indra,sorgerlab/indra,pvtodorov/indra,johnbachman/indra,sorgerlab/indra,sorgerlab/belpy,sorgerlab/belpy,pvtodorov/indra,bgyori/indra,sorgerlab/belpy,pvtodorov/indra,johnbachman/belpy,johnbachman/indra,johnbachman/belpy,johnbachman/belpy,bgyori/indra
<REPLACE_OLD> <REPLACE_NEW> import logging from collections import defaultdict from indra.literature.elsevier_client import logger as elsevier_logger from indra.literature import pubmed_client, pmc_client, elsevier_client logger = logging.getLogger('disambiguate') # the elsevier_client will log messages that it is ...
Add unfinished scripts that assist in deft disambiguation git history was completley farbed through carelessness. the original deft branch was deleted and a new branch was created
6ee4cd2ace969365a4898e3f89944e8ddbdca1c8
wolme/wallet/models.py
wolme/wallet/models.py
from __future__ import unicode_literals from django.conf import settings from django.db import models from django.utils.encoding import python_2_unicode_compatible from django.utils.translation import ugettext as _ @python_2_unicode_compatible class Tag(models.Model): slug = models.SlugField(unique=True) des...
from __future__ import unicode_literals from django.conf import settings from django.db import models from django.utils import timezone from django.utils.encoding import python_2_unicode_compatible from django.utils.translation import ugettext as _ @python_2_unicode_compatible class Tag(models.Model): slug = mod...
Add default to movement date
Add default to movement date
Python
bsd-2-clause
synasius/wolme
<INSERT> django.utils import timezone from <INSERT_END> <REPLACE_OLD> models.DateTimeField() <REPLACE_NEW> models.DateTimeField(default=timezone.now()) <REPLACE_END> <|endoftext|> from __future__ import unicode_literals from django.conf import settings from django.db import models from django.utils import timezone f...
Add default to movement date from __future__ import unicode_literals from django.conf import settings from django.db import models from django.utils.encoding import python_2_unicode_compatible from django.utils.translation import ugettext as _ @python_2_unicode_compatible class Tag(models.Model): slug = models....
1245e0aeaf5cd37e6f6c5c0feddbedededd3a458
tests/test_crypto.py
tests/test_crypto.py
from __future__ import absolute_import, division, print_function, unicode_literals import os import base64 import credsmash.aes_ctr import credsmash.aes_gcm class DummyKeyService(object): def generate_key_data(self, number_of_bytes): key = os.urandom(int(number_of_bytes)) return key, base64.b64en...
Add test to show crypto working
Add test to show crypto working
Python
apache-2.0
3stack-software/credsmash
<REPLACE_OLD> <REPLACE_NEW> from __future__ import absolute_import, division, print_function, unicode_literals import os import base64 import credsmash.aes_ctr import credsmash.aes_gcm class DummyKeyService(object): def generate_key_data(self, number_of_bytes): key = os.urandom(int(number_of_bytes)) ...
Add test to show crypto working
a893223d4964f946d9413a17e62871e2660843a8
flexget/plugins/input_listdir.py
flexget/plugins/input_listdir.py
import logging from flexget.plugin import * log = logging.getLogger('listdir') class InputListdir: """ Uses local path content as an input. Example: listdir: /storage/movies/ """ def validator(self): from flexget import validator root = valid...
import logging from flexget.plugin import register_plugin log = logging.getLogger('listdir') class InputListdir: """ Uses local path content as an input. Example: listdir: /storage/movies/ """ def validator(self): from flexget import validator root = validator.f...
Fix url of entries made by listdir on Windows.
Fix url of entries made by listdir on Windows. git-svn-id: ad91b9aa7ba7638d69f912c9f5d012e3326e9f74@1586 3942dd89-8c5d-46d7-aeed-044bccf3e60c
Python
mit
LynxyssCZ/Flexget,thalamus/Flexget,tvcsantos/Flexget,ibrahimkarahan/Flexget,patsissons/Flexget,oxc/Flexget,dsemi/Flexget,qvazzler/Flexget,poulpito/Flexget,crawln45/Flexget,Flexget/Flexget,ZefQ/Flexget,malkavi/Flexget,malkavi/Flexget,oxc/Flexget,JorisDeRieck/Flexget,crawln45/Flexget,sean797/Flexget,jawilson/Flexget,dsem...
<REPLACE_OLD> * log <REPLACE_NEW> register_plugin log <REPLACE_END> <REPLACE_OLD> input. Example: <REPLACE_NEW> input. Example: <REPLACE_END> <REPLACE_OLD> """ <REPLACE_NEW> """ <REPLACE_END> <REPLACE_OLD> root <REPLACE_NEW> root <REPLACE_END> <REPLACE_OLD> #i...
Fix url of entries made by listdir on Windows. git-svn-id: ad91b9aa7ba7638d69f912c9f5d012e3326e9f74@1586 3942dd89-8c5d-46d7-aeed-044bccf3e60c import logging from flexget.plugin import * log = logging.getLogger('listdir') class InputListdir: """ Uses local path content as an input. Exam...
cb4421529e9564f110b84f590f14057eda8746c8
setup.py
setup.py
from setuptools import setup from setuptools.command.install import install as _install class install(_install): def run(self): _install.run(self) setup( cmdclass = { 'install' : install }, name = 'hydra', version = '0.1', author = 'tatsy', author_email = 'tatsy.mail@gmail.com', ur...
from setuptools import setup from setuptools.command.install import install as _install class install(_install): def run(self): _install.run(self) setup( cmdclass = { 'install' : install }, name = 'hydra', version = '0.1', author = 'tatsy', author_email = 'tatsy.mail@gmail.com', ur...
Add eo to installed packages.
Add eo to installed packages.
Python
mit
tatsy/hydra
<INSERT> 'hydra.eo', 'hydra.filters', <INSERT_END> <DELETE> 'hydra.filters', <DELETE_END> <|endoftext|> from setuptools import setup from setuptools.command.install import install as _install class install(_install): def run(self): _install.run(self) setup( cmdclass = { 'instal...
Add eo to installed packages. from setuptools import setup from setuptools.command.install import install as _install class install(_install): def run(self): _install.run(self) setup( cmdclass = { 'install' : install }, name = 'hydra', version = '0.1', author = 'tatsy', author_email =...
b6c98dd016aa440f96565ceaee2716cd530beae5
pages/search_indexes.py
pages/search_indexes.py
"""Django haystack `SearchIndex` module.""" from pages.models import Page, Content from haystack.indexes import SearchIndex, CharField, DateTimeField from haystack import site import datetime class PageIndex(SearchIndex): """Search index for pages content.""" text = CharField(document=True, use_template=True...
"""Django haystack `SearchIndex` module.""" from pages.models import Page, Content from haystack.indexes import SearchIndex, CharField, DateTimeField from haystack import site import datetime class PageIndex(SearchIndex): """Search index for pages content.""" text = CharField(document=True, use_template=True...
Add a url attribute to the SearchIndex for pages.
Add a url attribute to the SearchIndex for pages. This is useful when displaying a list of search results because we can create a link to the result without having to hit the database for every object in the result list.
Python
bsd-3-clause
remik/django-page-cms,akaihola/django-page-cms,batiste/django-page-cms,akaihola/django-page-cms,batiste/django-page-cms,akaihola/django-page-cms,remik/django-page-cms,pombredanne/django-page-cms-1,pombredanne/django-page-cms-1,pombredanne/django-page-cms-1,oliciv/django-page-cms,remik/django-page-cms,remik/django-page-...
<INSERT> url = CharField(model_attr='get_absolute_url') <INSERT_END> <|endoftext|> """Django haystack `SearchIndex` module.""" from pages.models import Page, Content from haystack.indexes import SearchIndex, CharField, DateTimeField from haystack import site import datetime class PageIndex(SearchIndex): """S...
Add a url attribute to the SearchIndex for pages. This is useful when displaying a list of search results because we can create a link to the result without having to hit the database for every object in the result list. """Django haystack `SearchIndex` module.""" from pages.models import Page, Content from haystack...
5827c09e3a003f53baa5abe2d2d0fc5d695d4334
arxiv_vanity/papers/management/commands/delete_all_expired_renders.py
arxiv_vanity/papers/management/commands/delete_all_expired_renders.py
from django.core.management.base import BaseCommand, CommandError from ...models import Render class Command(BaseCommand): help = 'Deletes output of all expired renders' def handle(self, *args, **options): for render in Render.objects.expired().iterator(): try: render.dele...
from django.core.management.base import BaseCommand, CommandError from ...models import Render class Command(BaseCommand): help = 'Deletes output of all expired renders' def handle(self, *args, **options): for render in Render.objects.expired().iterator(): try: render.dele...
Add flush to delete all renders print
Add flush to delete all renders print
Python
apache-2.0
arxiv-vanity/arxiv-vanity,arxiv-vanity/arxiv-vanity,arxiv-vanity/arxiv-vanity,arxiv-vanity/arxiv-vanity
<REPLACE_OLD> deleted") <REPLACE_NEW> deleted", flush=True) <REPLACE_END> <REPLACE_OLD> deleted") <REPLACE_NEW> deleted", flush=True) <REPLACE_END> <|endoftext|> from django.core.management.base import BaseCommand, CommandError from ...models import Render class Command(BaseCommand): help = 'Deletes output ...
Add flush to delete all renders print from django.core.management.base import BaseCommand, CommandError from ...models import Render class Command(BaseCommand): help = 'Deletes output of all expired renders' def handle(self, *args, **options): for render in Render.objects.expired().iterator(): ...
a6049578c4dd4602aa903af262347dddf05df178
template/module/tests/test_something.py
template/module/tests/test_something.py
# -*- coding: utf-8 -*- # Copyright <YEAR(S)> <AUTHOR(S)> # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from openerp.tests.common import HttpCase, TransactionCase class SomethingCase(TransactionCase): def setUp(self, *args, **kwargs): super(SomethingCase, self).setUp(*args, **kwargs) ...
# -*- coding: utf-8 -*- # Copyright <YEAR(S)> <AUTHOR(S)> # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from openerp.tests.common import HttpCase, TransactionCase class SomethingCase(TransactionCase): def setUp(self, *args, **kwargs): super(SomethingCase, self).setUp(*args, **kwargs) ...
Add debug assets to HTTP cases
[IMP] Add debug assets to HTTP cases
Python
agpl-3.0
Yajo/maintainer-tools,acsone/maintainer-tools,acsone/maintainer-tools,OCA/maintainer-tools,Yajo/maintainer-tools,Yajo/maintainer-tools,acsone/maintainers-tools,OCA/maintainer-tools,acsone/maintainers-tools,OCA/maintainer-tools,acsone/maintainer-tools,Yajo/maintainer-tools,OCA/maintainer-tools,acsone/maintainer-tools,ac...
<REPLACE_OLD> self.phantom_js("/web/tests?module=module_name", <REPLACE_NEW> self.phantom_js("/web/tests?debug=assets&module=module_name", <REPLACE_END> <REPLACE_OLD> url_path="/", <REPLACE_NEW> url_path="/?debug=assets", <REPLACE_END> <|endoftext|> # -*- coding: utf-8 -*- # Copyright <YEAR(S)> <AUTHOR(S)> # License ...
[IMP] Add debug assets to HTTP cases # -*- coding: utf-8 -*- # Copyright <YEAR(S)> <AUTHOR(S)> # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from openerp.tests.common import HttpCase, TransactionCase class SomethingCase(TransactionCase): def setUp(self, *args, **kwargs): super(Somethin...
e641a19f16b99425aa1b15bd8524f2612b0d6bab
tests/test_registry.py
tests/test_registry.py
import pytest from web_test_base import * class TestIATIRegistry(WebTestBase): urls_to_get = [ "http://iatiregistry.org/" , "http://www.iatiregistry.org/" , "https://iatiregistry.org/" , "https://www.iatiregistry.org/" ] def test_contains_links(self, loaded_request): ...
Add tests for the IATI Registry This adds a 200 response and link checks for the IATI Registry
Add tests for the IATI Registry This adds a 200 response and link checks for the IATI Registry
Python
mit
IATI/IATI-Website-Tests
<INSERT> import pytest from web_test_base import * class TestIATIRegistry(WebTestBase): <INSERT_END> <INSERT> urls_to_get = [ "http://iatiregistry.org/" , "http://www.iatiregistry.org/" , "https://iatiregistry.org/" , "https://www.iatiregistry.org/" ] def test_contains_links...
Add tests for the IATI Registry This adds a 200 response and link checks for the IATI Registry
a8574ad9d7b7b933bb70fa47f84b3e396d058033
src/escpos/capabilities.py
src/escpos/capabilities.py
import re from os import path import yaml with open(path.join(path.dirname(__file__), 'capabilities.yml')) as f: PROFILES = yaml.load(f) class Profile(object): profile_data = {} def __init__(self, columns=None): self.default_columns = columns def __getattr__(self, name): return se...
Support loading capabilites YAML into Python classes.
Support loading capabilites YAML into Python classes.
Python
mit
python-escpos/python-escpos,braveheuel/python-escpos,belono/python-escpos
<REPLACE_OLD> <REPLACE_NEW> import re from os import path import yaml with open(path.join(path.dirname(__file__), 'capabilities.yml')) as f: PROFILES = yaml.load(f) class Profile(object): profile_data = {} def __init__(self, columns=None): self.default_columns = columns def __getattr__(s...
Support loading capabilites YAML into Python classes.
d251f7f97e5fc32fd41266430ed0e991109e1fbe
setup.py
setup.py
from setuptools import setup, find_packages from dimod import __version__, __author__, __description__, __authoremail__ install_requires = ['decorator>=4.1.0'] extras_require = {'all': ['numpy']} packages = ['dimod', 'dimod.responses', 'dimod.composites', 'dimod.samplers'] setup(...
from setuptools import setup, find_packages from dimod import __version__, __author__, __description__, __authoremail__, _PY2 install_requires = ['decorator>=4.1.0'] if _PY2: # enum is built-in for python 3 install_requires.append('enum') extras_require = {'all': ['numpy']} packages = ['dimod', ...
Add enum for python2 install
Add enum for python2 install
Python
apache-2.0
dwavesystems/dimod,dwavesystems/dimod
<REPLACE_OLD> __authoremail__ install_requires <REPLACE_NEW> __authoremail__, _PY2 install_requires <REPLACE_END> <REPLACE_OLD> ['decorator>=4.1.0'] extras_require <REPLACE_NEW> ['decorator>=4.1.0'] if _PY2: # enum is built-in for python 3 install_requires.append('enum') extras_require <REPLACE_END> <|endoft...
Add enum for python2 install from setuptools import setup, find_packages from dimod import __version__, __author__, __description__, __authoremail__ install_requires = ['decorator>=4.1.0'] extras_require = {'all': ['numpy']} packages = ['dimod', 'dimod.responses', 'dimod.composites', ...
d5167d8ba1b3107e5ce121eca76b5496bf8d6448
qipipe/registration/ants/template.py
qipipe/registration/ants/template.py
import os import logging import envoy from .ants_error import ANTSError def create_template(metric, files): """ Builds a template from the given image files. :param metric: the similarity metric :param files: the image files :return: the template file name """ CMD = "buildtemplateparal...
import os import logging import envoy from .ants_error import ANTSError def create_template(metric, files): """ Builds a template from the given image files. :param metric: the similarity metric :param files: the image files :return: the template file name """ CMD = "buildtemplateparal...
Truncate a long log message.
Truncate a long log message.
Python
bsd-2-clause
ohsu-qin/qipipe
<REPLACE_OLD> logging.info(cmd) <REPLACE_NEW> logging.info(cmd[:80]) <REPLACE_END> <|endoftext|> import os import logging import envoy from .ants_error import ANTSError def create_template(metric, files): """ Builds a template from the given image files. :param metric: the similarity metric :par...
Truncate a long log message. import os import logging import envoy from .ants_error import ANTSError def create_template(metric, files): """ Builds a template from the given image files. :param metric: the similarity metric :param files: the image files :return: the template file name """...
b8839302c0a4d8ada99a695f8829027fa433e05e
zerver/migrations/0232_make_archive_transaction_field_not_nullable.py
zerver/migrations/0232_make_archive_transaction_field_not_nullable.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('zerver', '0231_add_archive_transaction_model'), ] operations = [ migrations.RunSQL("DELETE ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): """ Tables cannot have data deleted from them and be altered in a single transaction, but we need the DELETEs to be atomic togeth...
Fix migration making archive_transaction field not null.
retention: Fix migration making archive_transaction field not null. DELETing from archive tables and ALTERing ArchivedMessage needs to be split into separate transactions. zerver_archivedattachment_messages needs to be cleared out before zerver_archivedattachment.
Python
apache-2.0
eeshangarg/zulip,shubhamdhama/zulip,zulip/zulip,brainwane/zulip,synicalsyntax/zulip,eeshangarg/zulip,andersk/zulip,hackerkid/zulip,hackerkid/zulip,timabbott/zulip,zulip/zulip,timabbott/zulip,synicalsyntax/zulip,tommyip/zulip,tommyip/zulip,rht/zulip,andersk/zulip,rishig/zulip,rht/zulip,timabbott/zulip,brainwane/zulip,ee...
<REPLACE_OLD> django.db.models.deletion class Migration(migrations.Migration): <REPLACE_NEW> django.db.models.deletion class Migration(migrations.Migration): """ Tables cannot have data deleted from them and be altered in a single transaction, but we need the DELETEs to be atomic together. So we set at...
retention: Fix migration making archive_transaction field not null. DELETing from archive tables and ALTERing ArchivedMessage needs to be split into separate transactions. zerver_archivedattachment_messages needs to be cleared out before zerver_archivedattachment. # -*- coding: utf-8 -*- from __future__ import unico...
b6c0a85a3199499b607ebb9ecc057434a9ea2fe5
mizani/__init__.py
mizani/__init__.py
from importlib.metadata import version, PackageNotFoundError try: __version__ = version('plotnine') except PackageNotFoundError: # package is not installed pass
from importlib.metadata import version, PackageNotFoundError try: __version__ = version('mizani') except PackageNotFoundError: # package is not installed pass
Fix version number to check for mizani
Fix version number to check for mizani and not plotnine. Copypaste error!
Python
bsd-3-clause
has2k1/mizani,has2k1/mizani
<REPLACE_OLD> version('plotnine') except <REPLACE_NEW> version('mizani') except <REPLACE_END> <|endoftext|> from importlib.metadata import version, PackageNotFoundError try: __version__ = version('mizani') except PackageNotFoundError: # package is not installed pass
Fix version number to check for mizani and not plotnine. Copypaste error! from importlib.metadata import version, PackageNotFoundError try: __version__ = version('plotnine') except PackageNotFoundError: # package is not installed pass
d5ddfb8af861f02074fe113f87a6ea6b4f1bc5db
tests/child-process-sigterm-trap.py
tests/child-process-sigterm-trap.py
#!/usr/bin/env python3 from common import * import sys, signal # Be naughty and ignore SIGTERM to simulate hanging child signal.signal(signal.SIGTERM, signal.SIG_IGN) # Start a server that listens for incoming connections try: print_ok("child starting up on port %s" % sys.argv[1]) s = TcpServer(int(sys.argv[...
#!/usr/bin/env python3 from common import * import sys, signal # Be naughty and ignore SIGTERM to simulate hanging child signal.signal(signal.SIGTERM, signal.SIG_IGN) # Start a server that listens for incoming connections try: print_ok("child starting up on port %s" % sys.argv[1]) s = TcpServer(int(sys.argv[1]))...
Fix formatting in child sample to match other files
Fix formatting in child sample to match other files
Python
apache-2.0
square/ghostunnel,square/ghostunnel
<DELETE> <DELETE_END> <DELETE> <DELETE_END> <DELETE> <DELETE_END> <DELETE> <DELETE_END> <DELETE> <DELETE_END> <DELETE> <DELETE_END> <DELETE> <DELETE_END> <DELETE> <DELETE_END> <DELETE> <DELETE_END> <DELETE> <DELETE_END> <|endoftext|> #!/usr/bin/env python3 from common import * impor...
Fix formatting in child sample to match other files #!/usr/bin/env python3 from common import * import sys, signal # Be naughty and ignore SIGTERM to simulate hanging child signal.signal(signal.SIGTERM, signal.SIG_IGN) # Start a server that listens for incoming connections try: print_ok("child starting up on po...
c54240e6d9f6393370fe94f2cd05476680cf17f2
pygtfs/__init__.py
pygtfs/__init__.py
from .loader import append_feed, delete_feed, overwrite_feed, list_feeds from .schedule import Schedule from ._version import version as __version__
import warnings from .loader import append_feed, delete_feed, overwrite_feed, list_feeds from .schedule import Schedule try: from ._version import version as __version__ except ImportError: warnings.warn("pygtfs should be installed for the version to work") __version__ = "0"
Allow usage directly from the code (fix the _version import)
Allow usage directly from the code (fix the _version import)
Python
mit
jarondl/pygtfs
<REPLACE_OLD> from <REPLACE_NEW> import warnings from <REPLACE_END> <REPLACE_OLD> Schedule from <REPLACE_NEW> Schedule try: from <REPLACE_END> <REPLACE_OLD> __version__ <REPLACE_NEW> __version__ except ImportError: warnings.warn("pygtfs should be installed for the version to work") __version__ = "0" <RE...
Allow usage directly from the code (fix the _version import) from .loader import append_feed, delete_feed, overwrite_feed, list_feeds from .schedule import Schedule from ._version import version as __version__
663f839ef539759143369f84289b6e27f21bdcce
setup.py
setup.py
#/usr/bin/env python2.6 # # $Id: setup.py 87 2010-07-01 18:01:03Z ver $ from distutils.core import setup description = """ The Jersey core libraries provide common abstractions used by Jersey software. """ def getVersion(): import os packageSeedFile = os.path.join("src", "lib", "_version.py") ns = {"__...
#/usr/bin/env python2.6 # # $Id: setup.py 87 2010-07-01 18:01:03Z ver $ from distutils.core import setup description = """ The Jersey core libraries provide common abstractions used by Jersey software. """ def getVersion(): import os packageSeedFile = os.path.join("lib", "_version.py") ns = {"__name__"...
Use lib/ instead of src/lib.
Use lib/ instead of src/lib.
Python
bsd-3-clause
olix0r/tx-jersey
<REPLACE_OLD> os.path.join("src", "lib", <REPLACE_NEW> os.path.join("lib", <REPLACE_END> <REPLACE_OLD> "src/lib", <REPLACE_NEW> "lib", <REPLACE_END> <|endoftext|> #/usr/bin/env python2.6 # # $Id: setup.py 87 2010-07-01 18:01:03Z ver $ from distutils.core import setup description = """ The Jersey core libraries pro...
Use lib/ instead of src/lib. #/usr/bin/env python2.6 # # $Id: setup.py 87 2010-07-01 18:01:03Z ver $ from distutils.core import setup description = """ The Jersey core libraries provide common abstractions used by Jersey software. """ def getVersion(): import os packageSeedFile = os.path.join("src", "lib"...
4574fe87c6efa5b1b9431546f787fcf30ad0d6b6
examples/training/train_parser.py
examples/training/train_parser.py
from __future__ import unicode_literals, print_function import json import pathlib import random import spacy from spacy.pipeline import DependencyParser from spacy.gold import GoldParse from spacy.tokens import Doc def train_parser(nlp, train_data, left_labels, right_labels): parser = DependencyParser.blank( ...
Add example for training parser
Add example for training parser
Python
mit
raphael0202/spaCy,oroszgy/spaCy.hu,aikramer2/spaCy,banglakit/spaCy,spacy-io/spaCy,oroszgy/spaCy.hu,explosion/spaCy,raphael0202/spaCy,recognai/spaCy,aikramer2/spaCy,recognai/spaCy,oroszgy/spaCy.hu,honnibal/spaCy,honnibal/spaCy,Gregory-Howard/spaCy,recognai/spaCy,banglakit/spaCy,recognai/spaCy,spacy-io/spaCy,explosion/sp...
<REPLACE_OLD> <REPLACE_NEW> from __future__ import unicode_literals, print_function import json import pathlib import random import spacy from spacy.pipeline import DependencyParser from spacy.gold import GoldParse from spacy.tokens import Doc def train_parser(nlp, train_data, left_labels, right_labels): parser...
Add example for training parser
46cec51fa3b81da21662da5d36ccaf1f409caaea
gem/personalise/templatetags/personalise_extras.py
gem/personalise/templatetags/personalise_extras.py
from django import template from wagtail_personalisation.adapters import get_segment_adapter register = template.Library() @register.simple_tag def filter_surveys_by_segments(surveys, request): """Filter out surveys not in user's segments.""" user_segments = get_segment_adapter(request).get_segments() us...
from django import template from wagtail_personalisation.adapters import get_segment_adapter register = template.Library() @register.simple_tag def filter_surveys_by_segments(surveys, request): """Filter out surveys not in user's segments.""" user_segments = get_segment_adapter(request).get_segments() us...
Fix error when displaying other types of surveys
Fix error when displaying other types of surveys
Python
bsd-2-clause
praekelt/molo-gem,praekelt/molo-gem,praekelt/molo-gem
<REPLACE_OLD> filetered_surveys <REPLACE_NEW> filtered_surveys <REPLACE_END> <REPLACE_OLD> survey.segment_id: <REPLACE_NEW> hasattr(survey, 'segment_id') or not survey.segment_id \ <REPLACE_END> <DELETE> filetered_surveys.append(survey) <DELETE_END> <REPLACE_OLD> elif <REPLACE_NEW> or <REPLACE_END> <REPLACE_OLD> ...
Fix error when displaying other types of surveys from django import template from wagtail_personalisation.adapters import get_segment_adapter register = template.Library() @register.simple_tag def filter_surveys_by_segments(surveys, request): """Filter out surveys not in user's segments.""" user_segments = ...
caf25fab4495e116303a83d52601da164b13638f
angkot/route/management/commands/export_geojson.py
angkot/route/management/commands/export_geojson.py
import sys import os import json from optparse import make_option from django.core.management.base import BaseCommand, CommandError class Command(BaseCommand): help = 'Export Route(s) as GeoJSON' option_list = BaseCommand.option_list + ( make_option('-o', dest='output_directory'), ) def hand...
Add script to export route to GeoJSON data
Add script to export route to GeoJSON data
Python
agpl-3.0
angkot/angkot,angkot/angkot,angkot/angkot,angkot/angkot
<REPLACE_OLD> <REPLACE_NEW> import sys import os import json from optparse import make_option from django.core.management.base import BaseCommand, CommandError class Command(BaseCommand): help = 'Export Route(s) as GeoJSON' option_list = BaseCommand.option_list + ( make_option('-o', dest='output_dir...
Add script to export route to GeoJSON data
11f6fd6e2401af03730afccb14f843928c27c37a
setup.py
setup.py
from setuptools import setup def readme(): with open('README.rst') as f: return f.read() setup(name='savu', version='0.1', description='Savu Python Tomography Pipeline', long_description=readme(), classifiers=[ 'Development Status :: 1 - Planning', 'Inte...
from setuptools import setup def readme(): with open('README.rst') as f: return f.read() setup(name='savu', version='0.1.1', description='Savu Python Tomography Pipeline', long_description=readme(), classifiers=[ 'Development Status :: 1 - Planning', 'In...
Update to version 0.1.1 for the next push
Update to version 0.1.1 for the next push
Python
apache-2.0
mjn19172/Savu,swtp1v07/Savu,mjn19172/Savu,swtp1v07/Savu,swtp1v07/Savu,swtp1v07/Savu,mjn19172/Savu,mjn19172/Savu,mjn19172/Savu
<REPLACE_OLD> version='0.1', <REPLACE_NEW> version='0.1.1', <REPLACE_END> <|endoftext|> from setuptools import setup def readme(): with open('README.rst') as f: return f.read() setup(name='savu', version='0.1.1', description='Savu Python Tomography Pipeline', long_descriptio...
Update to version 0.1.1 for the next push from setuptools import setup def readme(): with open('README.rst') as f: return f.read() setup(name='savu', version='0.1', description='Savu Python Tomography Pipeline', long_description=readme(), classifiers=[ 'Developme...
f87b10b6a6639843b68777e5346109acb44c948a
profile_compressible_solver/gaussian.py
profile_compressible_solver/gaussian.py
from firedrake import (SpatialCoordinate, dot, cross, sqrt, atan_2, exp, as_vector, Constant, acos) import numpy as np class Gaussian(object): def __init__(self, mesh, dir_from_center, radial_dist, sigma_theta, ...
Set up object to create random pressure field
Set up object to create random pressure field
Python
mit
thomasgibson/firedrake-hybridization
<REPLACE_OLD> <REPLACE_NEW> from firedrake import (SpatialCoordinate, dot, cross, sqrt, atan_2, exp, as_vector, Constant, acos) import numpy as np class Gaussian(object): def __init__(self, mesh, dir_from_center, radial_dist, ...
Set up object to create random pressure field
3cbc6bdd5bcc480d105ce53bffd5b350b7dc8179
setup.py
setup.py
from setuptools import setup import os #Function to read README def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() setup( name='clipboard_memo', version='0.1', description='A command-line clipboard manager', long_description=read('README.md'), url='http://githu...
from setuptools import setup import os #Function to read README def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() setup( name='clipboard_memo', version='0.1', description='A command-line clipboard manager', long_description=read('README.rst'), url='http://gith...
Use README.rst for long description
Use README.rst for long description
Python
mit
arafsheikh/clipboard-memo
<REPLACE_OLD> long_description=read('README.md'), <REPLACE_NEW> long_description=read('README.rst'), <REPLACE_END> <|endoftext|> from setuptools import setup import os #Function to read README def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() setup( name='clipboard_memo', ...
Use README.rst for long description from setuptools import setup import os #Function to read README def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() setup( name='clipboard_memo', version='0.1', description='A command-line clipboard manager', long_description=rea...
2fedb73b2c83fc7bb1b354d8b1ebd8dfe8497995
dataportal/tests/test_examples.py
dataportal/tests/test_examples.py
import unittest from ..examples.sample_data import (temperature_ramp, multisource_event, image_and_scalar) from metadatastore.api import Document class CommonSampleDataTests(object): def setUp(self): pass def test_basic_usage(self): events = self.example.run...
from nose.tools import assert_true from ..examples.sample_data import (temperature_ramp, multisource_event, image_and_scalar) from metadatastore.api import Document def run_example(example): events = example.run() assert_true(isinstance(events, list)) assert_true(isinsta...
Use generator test for examples.
REF: Use generator test for examples.
Python
bsd-3-clause
ericdill/datamuxer,danielballan/datamuxer,NSLS-II/dataportal,tacaswell/dataportal,danielballan/dataportal,ericdill/databroker,NSLS-II/datamuxer,danielballan/datamuxer,NSLS-II/dataportal,danielballan/dataportal,ericdill/databroker,tacaswell/dataportal,ericdill/datamuxer
<INSERT> from nose.tools <INSERT_END> <REPLACE_OLD> unittest from <REPLACE_NEW> assert_true from <REPLACE_END> <REPLACE_OLD> Document class CommonSampleDataTests(object): <REPLACE_NEW> Document def run_example(example): <REPLACE_END> <REPLACE_OLD> def setUp(self): <REPLACE_NEW> events = example.run() assert_tr...
REF: Use generator test for examples. import unittest from ..examples.sample_data import (temperature_ramp, multisource_event, image_and_scalar) from metadatastore.api import Document class CommonSampleDataTests(object): def setUp(self): pass def test_basic_usage(s...
4705eae5d233ea573da3482541fd52778cff88ef
corehq/apps/data_interfaces/migrations/0019_remove_old_rule_models.py
corehq/apps/data_interfaces/migrations/0019_remove_old_rule_models.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.14 on 2018-09-11 15:24 from __future__ import unicode_literals from __future__ import absolute_import from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('data_interfaces', '0018_check_for_rule_migration'), ] ...
Add migration to remove old rule models
Add migration to remove old rule models
Python
bsd-3-clause
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
<INSERT> # -*- coding: utf-8 -*- # Generated by Django 1.11.14 on 2018-09-11 15:24 from __future__ import unicode_literals from __future__ import absolute_import from django.db import migrations class Migration(migrations.Migration): <INSERT_END> <INSERT> dependencies = [ ('data_interfaces', '0018_check_f...
Add migration to remove old rule models
056bb4adada68d96f127a7610289d874ebe0cf1b
cray_test.py
cray_test.py
# -*- coding: utf-8 -*- '''module for unit test and task for CI''' import sys import unittest from yatest import testpost, testpage, testutility, testconfig if __name__ == '__main__': all_test_suites = [] all_test_suites.append(testpost.get_test_suites()) all_test_suites.append(testpage.get_test_suites())...
# -*- coding: utf-8 -*- '''module for unit test and task for CI''' import sys import unittest from yatest import testpost, testpage, testutility, testconfig, testgenerator, testpostmanager if __name__ == '__main__': all_test_suites = [] all_test_suites.append(testpost.get_test_suites()) all_test_suites.ap...
Add test cases for module post_manager, refactor part of class PostManager and update TODO list.
Add test cases for module post_manager, refactor part of class PostManager and update TODO list.
Python
mit
boluny/cray,boluny/cray
<REPLACE_OLD> testconfig if <REPLACE_NEW> testconfig, testgenerator, testpostmanager if <REPLACE_END> <REPLACE_OLD> all_test_suites.append(testconfig.get_test_suites()) <REPLACE_NEW> all_test_suites.append(testconfig.get_test_suites()) all_test_suites.append(testgenerator.get_test_suites()) all_test_suites....
Add test cases for module post_manager, refactor part of class PostManager and update TODO list. # -*- coding: utf-8 -*- '''module for unit test and task for CI''' import sys import unittest from yatest import testpost, testpage, testutility, testconfig if __name__ == '__main__': all_test_suites = [] all_tes...
4c6fb23dd40216604f914d4f869b40d23b13bf73
django/__init__.py
django/__init__.py
VERSION = (1, 4, 5, 'final', 0) def get_version(version=None): """Derives a PEP386-compliant version number from VERSION.""" if version is None: version = VERSION assert len(version) == 5 assert version[3] in ('alpha', 'beta', 'rc', 'final') # Now build the two parts of the version number:...
VERSION = (1, 4, 6, 'alpha', 0) def get_version(version=None): """Derives a PEP386-compliant version number from VERSION.""" if version is None: version = VERSION assert len(version) == 5 assert version[3] in ('alpha', 'beta', 'rc', 'final') # Now build the two parts of the version number:...
Bump version to no longer claim to be 1.4.5 final.
[1.4.x] Bump version to no longer claim to be 1.4.5 final.
Python
bsd-3-clause
riklaunim/django-custom-multisite,riklaunim/django-custom-multisite,riklaunim/django-custom-multisite
<REPLACE_OLD> 5, 'final', <REPLACE_NEW> 6, 'alpha', <REPLACE_END> <|endoftext|> VERSION = (1, 4, 6, 'alpha', 0) def get_version(version=None): """Derives a PEP386-compliant version number from VERSION.""" if version is None: version = VERSION assert len(version) == 5 assert version[3] in ('alph...
[1.4.x] Bump version to no longer claim to be 1.4.5 final. VERSION = (1, 4, 5, 'final', 0) def get_version(version=None): """Derives a PEP386-compliant version number from VERSION.""" if version is None: version = VERSION assert len(version) == 5 assert version[3] in ('alpha', 'beta', 'rc', 'f...
57d3b3cf0309222aafbd493cbdc26f30e06f05c1
tests/test_parsing.py
tests/test_parsing.py
#!/usr/bin/env python #encoding:utf-8 #author:dbr/Ben #project:tvnamer #repository:http://github.com/dbr/tvnamer #license:Creative Commons GNU GPL v2 # http://creativecommons.org/licenses/GPL/2.0/ """Test tvnamer's filename parser """ import os import sys from copy import copy import unittest sys.path.append(os.path...
#!/usr/bin/env python #encoding:utf-8 #author:dbr/Ben #project:tvnamer #repository:http://github.com/dbr/tvnamer #license:Creative Commons GNU GPL v2 # http://creativecommons.org/licenses/GPL/2.0/ """Test tvnamer's filename parser """ import os import sys from copy import copy import unittest sys.path.append(os.path...
Fix utility being picked up as test, display expected-and-got values in assertion error
Fix utility being picked up as test, display expected-and-got values in assertion error
Python
unlicense
m42e/tvnamer,lahwaacz/tvnamer,dbr/tvnamer
<REPLACE_OLD> check_test(curtest): <REPLACE_NEW> check_case(curtest): <REPLACE_END> <INSERT> assert(theep.seriesname.lower() == curtest['seriesname'].lower(), "%s == %s" % (theep.seriesname.lower(), curtest['seriesname'].lower())) <INSERT_END> <REPLACE_OLD> theep.seriesname.lower() == curtest['seriesname...
Fix utility being picked up as test, display expected-and-got values in assertion error #!/usr/bin/env python #encoding:utf-8 #author:dbr/Ben #project:tvnamer #repository:http://github.com/dbr/tvnamer #license:Creative Commons GNU GPL v2 # http://creativecommons.org/licenses/GPL/2.0/ """Test tvnamer's filename parser ...
119025b231b0f3b9077445334fc08d1ad076abfc
generic_links/migrations/0001_initial.py
generic_links/migrations/0001_initial.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings class Migration(migrations.Migration): dependencies = [ ('contenttypes', '0002_remove_content_type_name'), migrations.swappable_dependency(settings.AUTH_USER_...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings class Migration(migrations.Migration): dependencies = [ ('contenttypes', '__first__'), migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] o...
Remove Django 1.8 dependency in initial migration
Remove Django 1.8 dependency in initial migration The ('contenttypes', '0002_remove_content_type_name') migration was part of Django 1.8, replacing it with '__first__' allows the use of Django 1.7
Python
bsd-3-clause
matagus/django-generic-links,matagus/django-generic-links
<REPLACE_OLD> '0002_remove_content_type_name'), <REPLACE_NEW> '__first__'), <REPLACE_END> <|endoftext|> # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings class Migration(migrations.Migration): dependencies = [ ('co...
Remove Django 1.8 dependency in initial migration The ('contenttypes', '0002_remove_content_type_name') migration was part of Django 1.8, replacing it with '__first__' allows the use of Django 1.7 # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf...
9bf1f19eefc48dbced4b6ea1cc5258518d14bceb
app/utils/http.py
app/utils/http.py
import aiofiles import aiohttp import aiohttp.client_exceptions from aiopath import AsyncPath from sanic.log import logger EXCEPTIONS = ( aiohttp.client_exceptions.ClientConnectionError, aiohttp.client_exceptions.InvalidURL, aiohttp.client_exceptions.TooManyRedirects, AssertionError, UnicodeError, ...
import asyncio import aiofiles import aiohttp import aiohttp.client_exceptions from aiopath import AsyncPath from sanic.log import logger EXCEPTIONS = ( aiohttp.client_exceptions.ClientConnectionError, aiohttp.client_exceptions.InvalidURL, aiohttp.client_exceptions.TooManyRedirects, AssertionError, ...
Add timeout to downloading custom background images
Add timeout to downloading custom background images
Python
mit
jacebrowning/memegen,jacebrowning/memegen
<INSERT> asyncio import <INSERT_END> <INSERT> asyncio.TimeoutError, <INSERT_END> <REPLACE_OLD> session.get(url) <REPLACE_NEW> session.get(url, timeout=10) <REPLACE_END> <REPLACE_OLD> ") <REPLACE_NEW> ") or e.__class__.__name__ <REPLACE_END> <|endoftext|> import asyncio import aiofiles import aiohttp import aioh...
Add timeout to downloading custom background images import aiofiles import aiohttp import aiohttp.client_exceptions from aiopath import AsyncPath from sanic.log import logger EXCEPTIONS = ( aiohttp.client_exceptions.ClientConnectionError, aiohttp.client_exceptions.InvalidURL, aiohttp.client_exceptions.Too...
06d1039ccbf4653c2f285528b2ab058edca2ff1f
py/test/selenium/webdriver/common/proxy_tests.py
py/test/selenium/webdriver/common/proxy_tests.py
#!/usr/bin/python # Copyright 2012 Software Freedom Conservancy. # # 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 appl...
#!/usr/bin/python # Copyright 2012 Software Freedom Conservancy. # # 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 appl...
Fix test as well :)
DanielWagnerHall: Fix test as well :) r17825
Python
apache-2.0
misttechnologies/selenium,markodolancic/selenium,uchida/selenium,yukaReal/selenium,mestihudson/selenium,alb-i986/selenium,jabbrwcky/selenium,krmahadevan/selenium,jabbrwcky/selenium,AutomatedTester/selenium,s2oBCN/selenium,asolntsev/selenium,twalpole/selenium,o-schneider/selenium,jsakamoto/selenium,compstak/selenium,tku...
<REPLACE_OLD> 'manual', <REPLACE_NEW> 'MANUAL', <REPLACE_END> <|endoftext|> #!/usr/bin/python # Copyright 2012 Software Freedom Conservancy. # # 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 ...
DanielWagnerHall: Fix test as well :) r17825 #!/usr/bin/python # Copyright 2012 Software Freedom Conservancy. # # 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/l...
ac50044c16e2302e7543923d562cca5ba715e311
web/impact/impact/v1/events/base_history_event.py
web/impact/impact/v1/events/base_history_event.py
from abc import ( ABCMeta, abstractmethod, ) from impact.v1.helpers import ( STRING_FIELD, ) class BaseHistoryEvent(object): __metaclass__ = ABCMeta CLASS_FIELDS = { "event_type": STRING_FIELD, "datetime": STRING_FIELD, "latest_datetime": STRING_FIELD, "description...
from abc import ( ABCMeta, abstractmethod, ) from impact.v1.helpers import ( STRING_FIELD, ) class BaseHistoryEvent(object): __metaclass__ = ABCMeta CLASS_FIELDS = { "event_type": STRING_FIELD, "datetime": STRING_FIELD, "latest_datetime": STRING_FIELD, "description...
Switch from () to __call__()
[AC-4857] Switch from () to __call__()
Python
mit
masschallenge/impact-api,masschallenge/impact-api,masschallenge/impact-api,masschallenge/impact-api
<REPLACE_OLD> key)() <REPLACE_NEW> key).__call__() <REPLACE_END> <|endoftext|> from abc import ( ABCMeta, abstractmethod, ) from impact.v1.helpers import ( STRING_FIELD, ) class BaseHistoryEvent(object): __metaclass__ = ABCMeta CLASS_FIELDS = { "event_type": STRING_FIELD, "datet...
[AC-4857] Switch from () to __call__() from abc import ( ABCMeta, abstractmethod, ) from impact.v1.helpers import ( STRING_FIELD, ) class BaseHistoryEvent(object): __metaclass__ = ABCMeta CLASS_FIELDS = { "event_type": STRING_FIELD, "datetime": STRING_FIELD, "latest_datet...
199caafc817e4e007b2eedd307cb7bff06c029c6
imagersite/imager_images/tests.py
imagersite/imager_images/tests.py
from __future__ import unicode_literals from django.contrib.auth.models import User from django.test import TestCase import factory from faker import Faker from imager_profile.models import ImagerProfile from .models import Album, Photo # Create your tests here.
from __future__ import unicode_literals from django.contrib.auth.models import User from django.test import TestCase import factory from faker import Faker from imager_profile.models import ImagerProfile from .models import Album, Pho # Create your tests here. fake = Faker() class UserFactory(factory.Factory): ...
Add a UserFactory for images test
Add a UserFactory for images test
Python
mit
jesseklein406/django-imager,jesseklein406/django-imager,jesseklein406/django-imager
<REPLACE_OLD> Photo # <REPLACE_NEW> Pho # <REPLACE_END> <REPLACE_OLD> here. <REPLACE_NEW> here. fake = Faker() class UserFactory(factory.Factory): """Create a fake user.""" class Meta: model = User username = factory.Sequence(lambda n: 'user{}'.format(n)) first_name = fake.first_name() ...
Add a UserFactory for images test from __future__ import unicode_literals from django.contrib.auth.models import User from django.test import TestCase import factory from faker import Faker from imager_profile.models import ImagerProfile from .models import Album, Photo # Create your tests here.
42c79ec4fb98ee0964a70fa1872b674ec74e0b4e
vumi/scripts/tests/test_db_backup.py
vumi/scripts/tests/test_db_backup.py
"""Tests for vumi.scripts.db_backup.""" from twisted.trial.unittest import TestCase from vumi.tests.utils import PersistenceMixin from vumi.scripts.db_backup import ConfigHolder, Options class TestConfigHolder(ConfigHolder): def __init__(self, *args, **kwargs): self.output = [] super(TestConfig...
Test skeleton for db backup scripts.
Test skeleton for db backup scripts.
Python
bsd-3-clause
harrissoerja/vumi,vishwaprakashmishra/xmatrix,harrissoerja/vumi,vishwaprakashmishra/xmatrix,TouK/vumi,vishwaprakashmishra/xmatrix,TouK/vumi,TouK/vumi,harrissoerja/vumi
<REPLACE_OLD> <REPLACE_NEW> """Tests for vumi.scripts.db_backup.""" from twisted.trial.unittest import TestCase from vumi.tests.utils import PersistenceMixin from vumi.scripts.db_backup import ConfigHolder, Options class TestConfigHolder(ConfigHolder): def __init__(self, *args, **kwargs): self.output ...
Test skeleton for db backup scripts.
e105b44e4c07b43c36290a8f5d703f4ff0b26953
sqlshare_rest/util/query_queue.py
sqlshare_rest/util/query_queue.py
from sqlshare_rest.util.db import get_backend from sqlshare_rest.models import Query from django.utils import timezone def process_queue(): filtered = Query.objects.filter(is_finished=False) try: oldest_query = filtered.order_by('id')[:1].get() except Query.DoesNotExist: return backe...
from sqlshare_rest.util.db import get_backend from sqlshare_rest.models import Query from django.utils import timezone def process_queue(): filtered = Query.objects.filter(is_finished=False) try: oldest_query = filtered.order_by('id')[:1].get() except Query.DoesNotExist: return backe...
Remove a print statement that was dumb and breaking python3
Remove a print statement that was dumb and breaking python3
Python
apache-2.0
uw-it-aca/sqlshare-rest,uw-it-aca/sqlshare-rest,uw-it-aca/sqlshare-rest,uw-it-aca/sqlshare-rest
<DELETE> print "Finished: ", oldest_query.date_finished <DELETE_END> <|endoftext|> from sqlshare_rest.util.db import get_backend from sqlshare_rest.models import Query from django.utils import timezone def process_queue(): filtered = Query.objects.filter(is_finished=False) try: oldest_query = fil...
Remove a print statement that was dumb and breaking python3 from sqlshare_rest.util.db import get_backend from sqlshare_rest.models import Query from django.utils import timezone def process_queue(): filtered = Query.objects.filter(is_finished=False) try: oldest_query = filtered.order_by('id')[:1].g...
ffab86b081357fbd51e0c9676f03f4c39b65658b
emails/models.py
emails/models.py
from django.db import models from datetime import datetime import settings class Email(models.Model): ''' Monitor emails sent ''' to = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='emails') subject = models.CharField(max_length=150) body = models.TextField() at = models.Dat...
Add a django model to save emails and specify subscriptions.
Add a django model to save emails and specify subscriptions.
Python
bsd-3-clause
fmalina/emails,fmalina/emails
<REPLACE_OLD> <REPLACE_NEW> from django.db import models from datetime import datetime import settings class Email(models.Model): ''' Monitor emails sent ''' to = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='emails') subject = models.CharField(max_length=150) body = models.TextFie...
Add a django model to save emails and specify subscriptions.
b97842ecf1c8fa22b599353c1c7fe75fcf482702
tests/test_utils.py
tests/test_utils.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.test import TestCase from modeltrans.manager import (split_translated_fieldname, transform_translatable_fields) from modeltrans.utils import build_localized_fieldname from tests.app.models import Blog class U...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.test import TestCase from modeltrans.manager import transform_translatable_fields from modeltrans.utils import (build_localized_fieldname, split_translated_fieldname) from tests.app.models import Blog class Uti...
Use proper import from utils
Use proper import from utils
Python
bsd-3-clause
zostera/django-modeltrans,zostera/django-modeltrans
<REPLACE_OLD> (split_translated_fieldname, transform_translatable_fields) from <REPLACE_NEW> transform_translatable_fields from <REPLACE_END> <REPLACE_OLD> build_localized_fieldname from <REPLACE_NEW> (build_localized_fieldname, split_translated_fieldname) f...
Use proper import from utils # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.test import TestCase from modeltrans.manager import (split_translated_fieldname, transform_translatable_fields) from modeltrans.utils import build_localized_fieldname from tests.ap...
e16b2de7dd7c6e0df100bba08d3a7465bbbb4424
tests/test_service.py
tests/test_service.py
from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives.asymmetric import padding from cryptography.hazmat.primitives import serialization, hashes import requests import base64 import unittest import os class TestPosieService(unittest.TestCase): POSIE_URL = os.getenv('POSIE_...
from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import serialization import base64 import unittest import sys import os sys.path.append(os.path.abspath('../server.py')) import server class TestPosieService(unittest.TestCase): def test_key_generation(self): ...
Remove requests and drop external tests (now in integration)
Remove requests and drop external tests (now in integration)
Python
mit
ONSdigital/edcdi
<DELETE> cryptography.hazmat.primitives.asymmetric import padding from <DELETE_END> <REPLACE_OLD> serialization, hashes import requests import <REPLACE_NEW> serialization import <REPLACE_END> <REPLACE_OLD> os class <REPLACE_NEW> sys import os sys.path.append(os.path.abspath('../server.py')) import server class ...
Remove requests and drop external tests (now in integration) from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives.asymmetric import padding from cryptography.hazmat.primitives import serialization, hashes import requests import base64 import unittest import os class TestPosie...
18a166e0831cccd0a08f859a3533ed01d810c4ee
binarycalcs.py
binarycalcs.py
import numpy as np import matplotlib.pyplot as plt import astropy.units as u from astropy.constants import G, M_sun, au from astropy.units.core import UnitConversionError def keplerian_binary(givenquant): '''Return equivalency for Keplerian binary orbit. Parameters ---------- givenquant : `~astropy.un...
Convert between period, semimajor axis, and total mass for Keplerian orbit.
Convert between period, semimajor axis, and total mass for Keplerian orbit. For cases where a quick and easy conversion between period and semimajor axis is needed for some sort of binary system, this function will be able to do the conversion relatively quickly by taking one aspect to be fixed, and doing the rest of ...
Python
bsd-3-clause
cactaur/astropy-utils
<REPLACE_OLD> <REPLACE_NEW> import numpy as np import matplotlib.pyplot as plt import astropy.units as u from astropy.constants import G, M_sun, au from astropy.units.core import UnitConversionError def keplerian_binary(givenquant): '''Return equivalency for Keplerian binary orbit. Parameters ---------- ...
Convert between period, semimajor axis, and total mass for Keplerian orbit. For cases where a quick and easy conversion between period and semimajor axis is needed for some sort of binary system, this function will be able to do the conversion relatively quickly by taking one aspect to be fixed, and doing the rest of ...
e7aa94722c3657fb4b0dfacb4c1e432438e4670a
flexget/tests/test_move.py
flexget/tests/test_move.py
import pytest @pytest.mark.usefixtures('tmpdir') class TestMove: config = """ tasks: test_move: mock: - title: a movie location: __tmp__/movie.mkv accept_all: yes move: # Take advantage that path validation allows non-ex...
Add very basic move plugin test
Add very basic move plugin test
Python
mit
crawln45/Flexget,ianstalk/Flexget,ianstalk/Flexget,crawln45/Flexget,Flexget/Flexget,malkavi/Flexget,Flexget/Flexget,malkavi/Flexget,ianstalk/Flexget,crawln45/Flexget,malkavi/Flexget,Flexget/Flexget,malkavi/Flexget,crawln45/Flexget,Flexget/Flexget
<INSERT> import pytest @pytest.mark.usefixtures('tmpdir') class TestMove: <INSERT_END> <INSERT> config = """ tasks: test_move: mock: - title: a movie location: __tmp__/movie.mkv accept_all: yes move: # Take advantage that...
Add very basic move plugin test
11d4763b093d0f1006051e892277d33ca273916c
setup.py
setup.py
from setuptools import setup, find_packages import re with open("README.rst", mode='r') as readme_file: text=readme_file.read() #below version code pulled from requests module with open('__init__.py', 'r') as fd: version_number = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', fd...
from setuptools import setup, find_packages import re with open("README.rst", mode='r') as readme_file: text=readme_file.read() #below version code pulled from requests module with open('__init__.py', 'r') as fd: version_number = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', ...
Fix continuation whitespace and add extras_require
Fix continuation whitespace and add extras_require
Python
lgpl-2.1
rlee287/pyautoupdate,rlee287/pyautoupdate
<INSERT> <INSERT_END> <REPLACE_OLD> install_requires=['requests>=2.6'], <REPLACE_NEW> install_requires=['requests'], extras_require={ 'testing': ['pytest','coverage'] }, <REPLACE_END> <|endoftext|> from setuptools import setup, find_packages import re with open("README.rst", mode='r') as read...
Fix continuation whitespace and add extras_require from setuptools import setup, find_packages import re with open("README.rst", mode='r') as readme_file: text=readme_file.read() #below version code pulled from requests module with open('__init__.py', 'r') as fd: version_number = re.search(r'^__version__\s*...
e0388a4be8b15964ce87dafcf69805619f273805
setup.py
setup.py
from setuptools import setup setup(name='pygraphc', version='0.0.1', description='Event log clustering in Python', long_description='This package contains event log clustering method including non-graph and ' 'graph-based approaches.', classifiers=[ 'Developme...
from setuptools import setup setup(name='pygraphc', version='0.0.1', description='Event log clustering in Python', long_description='This package contains event log clustering method including non-graph and ' 'graph-based approaches.', classifiers=[ 'Developme...
Add entry_points to run executable pygraphc
Add entry_points to run executable pygraphc
Python
mit
studiawan/pygraphc
<INSERT> entry_points={ 'console_scripts': ['pygraphc=scripts.pygraphc:main'] }, <INSERT_END> <DELETE> 'numpy', 'scipy', <DELETE_END> <|endoftext|> from setuptools import setup setup(name='pygraphc', version='0.0.1', description='Event log clustering in Python'...
Add entry_points to run executable pygraphc from setuptools import setup setup(name='pygraphc', version='0.0.1', description='Event log clustering in Python', long_description='This package contains event log clustering method including non-graph and ' 'graph-based approaches....
de8d507e64894bdaaf036f99f179637c2660f0f1
tests/issue0078.py
tests/issue0078.py
# -*- coding: utf-8 -*- """ Created on Thu Nov 21 22:09:10 2013 @author: Jeff """ import logging try: print('Logger already instantiated, named: ', logger.name) except: # create logger logger = logging.getLogger() logger.setLevel(logging.CRITICAL) # create console handler with a higher log level ch...
Test script show how we might use the Python logger more effectively
Test script show how we might use the Python logger more effectively Former-commit-id: cc69a6ab3b6c61fd2f3e60bd16085b81cda84e42 Former-commit-id: 28ba0ba57de3379bd99b9f508972cd0520c04fcb
Python
mit
amdouglas/OpenPNM,amdouglas/OpenPNM,stadelmanma/OpenPNM,PMEAL/OpenPNM,TomTranter/OpenPNM
<REPLACE_OLD> <REPLACE_NEW> # -*- coding: utf-8 -*- """ Created on Thu Nov 21 22:09:10 2013 @author: Jeff """ import logging try: print('Logger already instantiated, named: ', logger.name) except: # create logger logger = logging.getLogger() logger.setLevel(logging.CRITICAL) # create console handler w...
Test script show how we might use the Python logger more effectively Former-commit-id: cc69a6ab3b6c61fd2f3e60bd16085b81cda84e42 Former-commit-id: 28ba0ba57de3379bd99b9f508972cd0520c04fcb
c02900e7fb8657316fa647f92c4f9ddbcedb2b7c
rma/helpers/formating.py
rma/helpers/formating.py
from math import floor from collections import Counter def floored_percentage(val, digits): """ Return string of floored value with given digits after period :param val: :param digits: :return: """ val *= 10 ** (digits + 2) return '{1:.{0}f}%'.format(digits, floor(val) / 10 ** digits)...
from math import floor from collections import Counter def floored_percentage(val, digits): """ Return string of floored value with given digits after period :param val: :param digits: :return: """ val *= 10 ** (digits + 2) return '{1:.{0}f}%'.format(digits, floor(val) / 10 ** digits)...
Add transforming function to pref_encodings
Add transforming function to pref_encodings
Python
mit
gamenet/redis-memory-analyzer
<REPLACE_OLD> pref_encoding(data): <REPLACE_NEW> pref_encoding(data, encoding_transform=None): <REPLACE_END> <INSERT> :param encoding_transform: <INSERT_END> <REPLACE_OLD> [{:<4}]".format(k, <REPLACE_NEW> [{:<4}]".format(encoding_transform(k) if encoding_transform else k, <REPLACE_END> <|endoftext|> from math imp...
Add transforming function to pref_encodings from math import floor from collections import Counter def floored_percentage(val, digits): """ Return string of floored value with given digits after period :param val: :param digits: :return: """ val *= 10 ** (digits + 2) return '{1:.{0}f...
c0cc820b933913a3d5967d377f557a26ff21dcf7
tests/test_utils.py
tests/test_utils.py
from io import UnsupportedOperation from pilkit.exceptions import UnknownFormat, UnknownExtension from pilkit.utils import extension_to_format, format_to_extension, FileWrapper from nose.tools import eq_, raises def test_extension_to_format(): eq_(extension_to_format('.jpeg'), 'JPEG') eq_(extension_to_format(...
from io import UnsupportedOperation from pilkit.exceptions import UnknownFormat, UnknownExtension from pilkit.utils import (extension_to_format, format_to_extension, FileWrapper, save_image) from nose.tools import eq_, raises from tempfile import NamedTemporaryFile from .utils import create_im...
Test that filename string can be used with save_image
Test that filename string can be used with save_image
Python
bsd-3-clause
kezabelle/pilkit,fladi/pilkit
<REPLACE_OLD> extension_to_format, <REPLACE_NEW> (extension_to_format, <REPLACE_END> <REPLACE_OLD> FileWrapper from <REPLACE_NEW> FileWrapper, save_image) from <REPLACE_END> <REPLACE_OLD> raises def <REPLACE_NEW> raises from tempfile import NamedTemporaryFile from .utils import create_image ...
Test that filename string can be used with save_image from io import UnsupportedOperation from pilkit.exceptions import UnknownFormat, UnknownExtension from pilkit.utils import extension_to_format, format_to_extension, FileWrapper from nose.tools import eq_, raises def test_extension_to_format(): eq_(extension_t...
1a3ffe00bfdf8c61b4ff190beb2ee6a4e9db1412
behave_django/environment.py
behave_django/environment.py
from django.core.management import call_command from django.shortcuts import resolve_url from behave_django.testcase import BehaveDjangoTestCase def before_scenario(context, scenario): # This is probably a hacky method of setting up the test case # outside of a test runner. Suggestions are welcome. :) c...
from django.core.management import call_command try: from django.shortcuts import resolve_url except ImportError: import warnings warnings.warn("URL path supported only in get_url() with Django < 1.5") resolve_url = lambda to, *args, **kwargs: to from behave_django.testcase import BehaveDjangoTestCase ...
Support Django < 1.5 with a simplified version of `get_url()`
Support Django < 1.5 with a simplified version of `get_url()`
Python
mit
nikolas/behave-django,nikolas/behave-django,behave/behave-django,bittner/behave-django,bittner/behave-django,behave/behave-django
<REPLACE_OLD> call_command from <REPLACE_NEW> call_command try: from <REPLACE_END> <REPLACE_OLD> resolve_url from <REPLACE_NEW> resolve_url except ImportError: import warnings warnings.warn("URL path supported only in get_url() with Django < 1.5") resolve_url = lambda to, *args, **kwargs: to from <REP...
Support Django < 1.5 with a simplified version of `get_url()` from django.core.management import call_command from django.shortcuts import resolve_url from behave_django.testcase import BehaveDjangoTestCase def before_scenario(context, scenario): # This is probably a hacky method of setting up the test case ...
041a3bbd512d1800067bc12f522238d681c35ac4
sheared/web/__init__.py
sheared/web/__init__.py
# vim:nowrap:textwidth=0 # # Sheared -- non-blocking network programming library for Python # Copyright (C) 2003 Sune Kirkeby <sune@mel.interspace.dk> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Fou...
# vim:nowrap:textwidth=0 # # Sheared -- non-blocking network programming library for Python # Copyright (C) 2003 Sune Kirkeby <sune@mel.interspace.dk> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Fou...
Add proxy module to __all__.
Add proxy module to __all__. git-svn-id: 8b0eea19d26e20ec80f5c0ea247ec202fbcc1090@248 5646265b-94b7-0310-9681-9501d24b2df7
Python
mit
kirkeby/sheared
<REPLACE_OLD> 'application'] <REPLACE_NEW> 'application', 'proxy'] <REPLACE_END> <|endoftext|> # vim:nowrap:textwidth=0 # # Sheared -- non-blocking network programming library for Python # Copyright (C) 2003 Sune Kirkeby <sune@mel.interspace.dk> # # This program is free software; you can redistribute it and/or modi...
Add proxy module to __all__. git-svn-id: 8b0eea19d26e20ec80f5c0ea247ec202fbcc1090@248 5646265b-94b7-0310-9681-9501d24b2df7 # vim:nowrap:textwidth=0 # # Sheared -- non-blocking network programming library for Python # Copyright (C) 2003 Sune Kirkeby <sune@mel.interspace.dk> # # This program is free software; you ca...
c339cf70342df088b920eb42aca4e3094fd96938
test/test_action.py
test/test_action.py
#!/usr/bin/env python2.6 # # This file is used to test reading and processing of config files # import os #It's ugly I know.... from shinken_test import * from shinken.action import Action class TestConfig(ShinkenTest): #setUp is in shinken_test #Change ME :) def test_action(self): a = Acti...
Add a test for actions.
Add a test for actions.
Python
agpl-3.0
staute/shinken_package,xorpaul/shinken,kaji-project/shinken,h4wkmoon/shinken,baloo/shinken,lets-software/shinken,KerkhoffTechnologies/shinken,peeyush-tm/shinken,tal-nino/shinken,naparuba/shinken,staute/shinken_deb,savoirfairelinux/shinken,baloo/shinken,dfranco/shinken,ddurieux/alignak,kaji-project/shinken,h4wkmoon/shin...
<REPLACE_OLD> <REPLACE_NEW> #!/usr/bin/env python2.6 # # This file is used to test reading and processing of config files # import os #It's ugly I know.... from shinken_test import * from shinken.action import Action class TestConfig(ShinkenTest): #setUp is in shinken_test #Change ME :) def test_a...
Add a test for actions.
4bf03eaf81f8d4c28e3b3b89c7442a787361eb5e
scripts/structure_mlsp2013_dataset.py
scripts/structure_mlsp2013_dataset.py
import csv def test(): with open("CVfolds_2.txt", newline='') as id2set, open("rec_id2filename.txt", newline='') as id2file, open("rec_labels_test_hidden.txt", newline='') as id2label: with open("file2label.csv", 'w', newline='') as file2label: readId2Label = csv.reader(id2label) re...
Add a script which structures the mlsp2013 data
Add a script which structures the mlsp2013 data - creates a csv file which maps a file name to a label set
Python
mit
johnmartinsson/bird-species-classification,johnmartinsson/bird-species-classification
<REPLACE_OLD> <REPLACE_NEW> import csv def test(): with open("CVfolds_2.txt", newline='') as id2set, open("rec_id2filename.txt", newline='') as id2file, open("rec_labels_test_hidden.txt", newline='') as id2label: with open("file2label.csv", 'w', newline='') as file2label: readId2Label = csv.re...
Add a script which structures the mlsp2013 data - creates a csv file which maps a file name to a label set
8545faa94a95ddeabffc444bcaf65e764c0c8712
fresque/lib/__init__.py
fresque/lib/__init__.py
# -*- coding: utf-8 -*- ''' Internal library for the fresque application. This module and all its files contains all the operations independant of the framework and should be completely covered in unit-tests. ''' import sqlalchemy as sa import fresque.lib.database as db
# -*- coding: utf-8 -*- ''' Internal library for the fresque application. This module and all its files contains all the operations independant of the framework and should be completely covered in unit-tests. ''' import sqlalchemy as sa import fresque.lib.database as db from sqlalchemy.orm import sessionmaker from ...
Add method to create a database session in the internal library
Add method to create a database session in the internal library
Python
agpl-3.0
fedora-infra/fresque,whitel/fresque,rahulrrixe/fresque,whitel/fresque,fedora-infra/fresque,vivekanand1101/fresque,vivekanand1101/fresque,whitel/fresque,rahulrrixe/fresque,rahulrrixe/fresque,vivekanand1101/fresque,fedora-infra/fresque,fedora-infra/fresque,rahulrrixe/fresque,whitel/fresque,vivekanand1101/fresque
<REPLACE_OLD> db <REPLACE_NEW> db from sqlalchemy.orm import sessionmaker from sqlalchemy.orm import scoped_session from sqlalchemy.orm.exc import NoResultFound from sqlalchemy.exc import SQLAlchemyError def create_session(db_url, debug=False, pool_recycle=3600): """ Create the Session object to use to query t...
Add method to create a database session in the internal library # -*- coding: utf-8 -*- ''' Internal library for the fresque application. This module and all its files contains all the operations independant of the framework and should be completely covered in unit-tests. ''' import sqlalchemy as sa import fresque....
850c5c6f133fdfd131605eb1bf1e971b33dd7416
website/addons/twofactor/tests/test_views.py
website/addons/twofactor/tests/test_views.py
from nose.tools import * from webtest_plus import TestApp from tests.base import OsfTestCase from tests.factories import AuthUserFactory from website.app import init_app from website.addons.twofactor.tests import _valid_code app = init_app( routes=True, set_backends=False, settings_module='website.setting...
from nose.tools import * from webtest.app import AppError from webtest_plus import TestApp from tests.base import OsfTestCase from tests.factories import AuthUserFactory from website.app import init_app from website.addons.twofactor.tests import _valid_code app = init_app( routes=True, set_backends=False, ...
Add test for failure to confirm 2FA code
Add test for failure to confirm 2FA code
Python
apache-2.0
doublebits/osf.io,brianjgeiger/osf.io,billyhunt/osf.io,cwisecarver/osf.io,CenterForOpenScience/osf.io,barbour-em/osf.io,wearpants/osf.io,MerlinZhang/osf.io,alexschiller/osf.io,brandonPurvis/osf.io,haoyuchen1992/osf.io,SSJohns/osf.io,HalcyonChimera/osf.io,dplorimer/osf,amyshi188/osf.io,SSJohns/osf.io,chrisseto/osf.io,ti...
<INSERT> webtest.app import AppError from <INSERT_END> <REPLACE_OLD> 200) <REPLACE_NEW> 200) def test_confirm_code_failure(self): with assert_raises(AppError) as error: res = self.app.post_json( '/api/v1/settings/twofactor/', {'code': '000000'}, ...
Add test for failure to confirm 2FA code from nose.tools import * from webtest_plus import TestApp from tests.base import OsfTestCase from tests.factories import AuthUserFactory from website.app import init_app from website.addons.twofactor.tests import _valid_code app = init_app( routes=True, set_backends=F...
9a58d241e61301b9390b17e391e4b65a3ea85071
squadron/libraries/apt/__init__.py
squadron/libraries/apt/__init__.py
import os import subprocess from string import find def run_command(command): p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() return out,err def schema(): """ This returns """ return { 'title': 'apt schema', 'type': 'stri...
import os import subprocess from string import find def run_command(command): p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() return out,err def schema(): """ This returns """ return { 'title': 'apt schema', 'type': 'stri...
Remove extra print in apt
Remove extra print in apt
Python
mit
gosquadron/squadron,gosquadron/squadron
<REPLACE_OLD> #Install <REPLACE_NEW> # Install <REPLACE_END> <REPLACE_OLD> #Something <REPLACE_NEW> # Something <REPLACE_END> <DELETE> print out <DELETE_END> <|endoftext|> import os import subprocess from string import find def run_command(command): p = subprocess.Popen(command, stdout=subprocess.PIPE, std...
Remove extra print in apt import os import subprocess from string import find def run_command(command): p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() return out,err def schema(): """ This returns """ return { 'title': 'apt schema'...
ba41dc9bff21558d1712fe06751f867806d8abd6
setup.py
setup.py
from distutils.core import setup setup( name='python_lemonway', version='0.1.0', author='Pierre Pigeau', author_email='ppigeau@payplug.fr', packages=['lemonway'], url='', license='LICENSE.txt', description='', long_description=open('README.rst').read(), package_data={'lemonway':...
from distutils.core import setup setup( name='python_lemonway', version='0.1.1', author='Pierre Pigeau', author_email='ppigeau@payplug.fr', packages=['lemonway'], url='', license='LICENSE.txt', description='', long_description=open('README.rst').read(), package_data={'lemonway':...
ADD - newversion of python_lemonway with improvements of MoneyIn
ADD - newversion of python_lemonway with improvements of MoneyIn
Python
mit
brightforme/python-lemonway
<REPLACE_OLD> version='0.1.0', <REPLACE_NEW> version='0.1.1', <REPLACE_END> <|endoftext|> from distutils.core import setup setup( name='python_lemonway', version='0.1.1', author='Pierre Pigeau', author_email='ppigeau@payplug.fr', packages=['lemonway'], url='', license='LICENSE.txt', d...
ADD - newversion of python_lemonway with improvements of MoneyIn from distutils.core import setup setup( name='python_lemonway', version='0.1.0', author='Pierre Pigeau', author_email='ppigeau@payplug.fr', packages=['lemonway'], url='', license='LICENSE.txt', description='', long_de...
ad4b972667e9111c403c1d3726b2cde87fcbc88e
setup.py
setup.py
#!/usr/bin/env python from distutils.core import setup setup(name='natural', version='0.1.4', description='Convert data to their natural (human-readable) format', long_description=''' Example Usage ============= Basic usage:: >>> from natural.file import accessed >>> print accessed(__file__) ...
#!/usr/bin/env python from distutils.core import setup setup(name='natural', version='0.1.4', description='Convert data to their natural (human-readable) format', long_description=''' Example Usage ============= Basic usage:: >>> from natural.file import accessed >>> print accessed(__file__) ...
Use 2to3 for Python 3
Use 2to3 for Python 3
Python
mit
tehmaze/natural
<REPLACE_OLD> ['locale/*/LC_MESSAGES/*.mo']}, ) <REPLACE_NEW> ['locale/*/LC_MESSAGES/*.mo']}, use_2to3=True, ) <REPLACE_END> <|endoftext|> #!/usr/bin/env python from distutils.core import setup setup(name='natural', version='0.1.4', description='Convert data to their natural (human-readable) format', ...
Use 2to3 for Python 3 #!/usr/bin/env python from distutils.core import setup setup(name='natural', version='0.1.4', description='Convert data to their natural (human-readable) format', long_description=''' Example Usage ============= Basic usage:: >>> from natural.file import accessed >>> print...
925ff38344b5058ce196877e1fdcf79a1d1f6719
ue4/tests/test_messaging.py
ue4/tests/test_messaging.py
import pytest from m2u.ue4 import connection def test_send_message_size(): """Send a big message, larger than buffer size, so the server has to read multiple chunks. """ message = "TestMessageSize " + ("abcdefg" * 5000) connection.connect() result = connection.send_message(message) asser...
Add basic test for checking messages are received correctly
Add basic test for checking messages are received correctly
Python
mit
m2u/m2u
<INSERT> import pytest from m2u.ue4 import connection def test_send_message_size(): <INSERT_END> <INSERT> """Send a big message, larger than buffer size, so the server has to read multiple chunks. """ message = "TestMessageSize " + ("abcdefg" * 5000) connection.connect() result = connection.s...
Add basic test for checking messages are received correctly
bcee6173027c48bfb25a65d3e97660f2e2a0852b
gentest.py
gentest.py
from itertools import product import json import numpy cube = numpy.array(range(1, 9)).reshape(2, 2, 2) pcube = [ cube[0 ,0 ,0 ], cube[0 ,0 ,0:2], cube[0 ,0:2,0:1], cube[0 ,0:2,0:2], cube[0:2,0:1,0:1], cube[0:2,0:1,0:2], cube[0:2,0:2,0:1], cube[0:2,0:2,0:2], ] for (i, (a, b)) i...
Add a python script to generate test methods
Add a python script to generate test methods
Python
mit
y-uti/php-bsxfun,y-uti/php-bsxfun
<INSERT> from itertools import product import json import numpy cube = numpy.array(range(1, 9)).reshape(2, 2, 2) pcube = [ <INSERT_END> <INSERT> cube[0 ,0 ,0 ], cube[0 ,0 ,0:2], cube[0 ,0:2,0:1], cube[0 ,0:2,0:2], cube[0:2,0:1,0:1], cube[0:2,0:1,0:2], cube[0:2,0:2,0:1], cube[0:2,...
Add a python script to generate test methods
164c70386191f0761923c1344447b8fac0e0795c
pelican/settings.py
pelican/settings.py
import os _DEFAULT_THEME = os.sep.join([os.path.dirname(os.path.abspath(__file__)), "themes/notmyidea"]) _DEFAULT_CONFIG = {'PATH': None, 'THEME': _DEFAULT_THEME, 'OUTPUT_PATH': 'output/', 'MARKUP': ('rst', 'md'), ...
import os _DEFAULT_THEME = os.sep.join([os.path.dirname(os.path.abspath(__file__)), "themes/notmyidea"]) _DEFAULT_CONFIG = {'PATH': None, 'THEME': _DEFAULT_THEME, 'OUTPUT_PATH': 'output/', 'MARKUP': ('rst', 'md'), ...
Add a default for JINJA_EXTENSIONS (default is no extensions)
Add a default for JINJA_EXTENSIONS (default is no extensions)
Python
agpl-3.0
treyhunner/pelican,joetboole/pelican,janaurka/git-debug-presentiation,goerz/pelican,JeremyMorgan/pelican,Polyconseil/pelican,deved69/pelican-1,JeremyMorgan/pelican,douglaskastle/pelican,farseerfc/pelican,51itclub/pelican,florianjacob/pelican,liyonghelpme/myBlog,levanhien8/pelican,lucasplus/pelican,btnpushnmunky/pelican...
<INSERT> 'JINJA_EXTENSIONS': [], <INSERT_END> <|endoftext|> import os _DEFAULT_THEME = os.sep.join([os.path.dirname(os.path.abspath(__file__)), "themes/notmyidea"]) _DEFAULT_CONFIG = {'PATH': None, 'THEME': _DEFAULT_THEME, 'OUTPUT_P...
Add a default for JINJA_EXTENSIONS (default is no extensions) import os _DEFAULT_THEME = os.sep.join([os.path.dirname(os.path.abspath(__file__)), "themes/notmyidea"]) _DEFAULT_CONFIG = {'PATH': None, 'THEME': _DEFAULT_THEME, 'OUTPUT_PATH': 'output/',...
6a40aab945e28c509e24ede6a48b7ac1f3b89ce2
product_isp/__manifest__.py
product_isp/__manifest__.py
# Copyright (C) 2019 - TODAY, Open Source Integrators # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { 'name': 'Product ISP', 'version': '12.0.1.0.0', 'license': 'AGPL-3', 'summary': 'Assign ISPs to Products', 'author': 'Open Source Integrators, Odoo Community Association (OCA)', ...
# Copyright (C) 2019 - TODAY, Open Source Integrators # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { 'name': 'Product ISP', 'version': '12.0.1.0.0', 'license': 'AGPL-3', 'summary': 'Assign ISPs to Products', 'author': 'Open Source Integrators, Odoo Community Association (OCA)', ...
Remove unneeded dependency on Inventory
[IMP] Remove unneeded dependency on Inventory
Python
agpl-3.0
OCA/vertical-isp,OCA/vertical-isp
<REPLACE_OLD> 'stock', <REPLACE_NEW> 'product', <REPLACE_END> <|endoftext|> # Copyright (C) 2019 - TODAY, Open Source Integrators # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { 'name': 'Product ISP', 'version': '12.0.1.0.0', 'license': 'AGPL-3', 'summary': 'Assign ISPs to Products'...
[IMP] Remove unneeded dependency on Inventory # Copyright (C) 2019 - TODAY, Open Source Integrators # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { 'name': 'Product ISP', 'version': '12.0.1.0.0', 'license': 'AGPL-3', 'summary': 'Assign ISPs to Products', 'author': 'Open Source In...
1db5fefc1752b71bf11fbf63853f7c93bcc526f5
tests/macaroon_property_tests.py
tests/macaroon_property_tests.py
from __future__ import unicode_literals from mock import * from nose.tools import * from hypothesis import * from hypothesis.specifiers import * from six import text_type, binary_type from pymacaroons import Macaroon, Verifier ascii_text_stategy = strategy(text_type).map( lambda s: s.encode('ascii', 'ignore') )...
from __future__ import unicode_literals from mock import * from nose.tools import * from hypothesis import * from hypothesis.specifiers import * from six import text_type, binary_type from pymacaroons import Macaroon, Verifier from pymacaroons.utils import convert_to_bytes ascii_text_strategy = strategy( [sampl...
Improve strategies in property tests
Improve strategies in property tests
Python
mit
matrix-org/pymacaroons,matrix-org/pymacaroons,ecordell/pymacaroons,illicitonion/pymacaroons
<REPLACE_OLD> Verifier ascii_text_stategy = strategy(text_type).map( <REPLACE_NEW> Verifier from pymacaroons.utils import convert_to_bytes ascii_text_strategy = strategy( [sampled_from(map(chr, range(0, 128)))] ).map(lambda c: ''.join(c)) ascii_bin_strategy = strategy(ascii_text_strategy).map( <REPLACE_END> ...
Improve strategies in property tests from __future__ import unicode_literals from mock import * from nose.tools import * from hypothesis import * from hypothesis.specifiers import * from six import text_type, binary_type from pymacaroons import Macaroon, Verifier ascii_text_stategy = strategy(text_type).map( l...
134338b7aab3c3b79c2aa62fd878926ff9d9adc5
setup.py
setup.py
#!/usr/bin/env python from distutils.core import setup def main (): dlls = ["bin/%s" % dll for dll in ["libcairo-2.dll"]] licenses = ["doc/%s" % license for license in ["LICENSE-LGPL.TXT", "LICENSE-CAIRO.TXT"]] others = ["README.rst", "LICENSE.rst"] long_description = """ This package con...
#!/usr/bin/env python from distutils.core import setup def main (): dlls = ["bin/%s" % dll for dll in ["libcairo-2.dll"]] licenses = ["doc/%s" % license for license in ["LICENSE-LGPL.TXT", "LICENSE-CAIRO.TXT"]] others = ["README.rst", "LICENSE.rst"] long_description = """ This package con...
Fix typo in package name.
Fix typo in package name. Cairp: what you get when you mix cairo with carp. Or perhaps a cairn made of carp?
Python
mit
jmcb/python-cairo-dependencies
<REPLACE_OLD> setup(name="cairp-dependencies", <REPLACE_NEW> setup(name="cairo-dependencies", <REPLACE_END> <|endoftext|> #!/usr/bin/env python from distutils.core import setup def main (): dlls = ["bin/%s" % dll for dll in ["libcairo-2.dll"]] licenses = ["doc/%s" % license for license in ["LICENSE-LGPL.TXT",...
Fix typo in package name. Cairp: what you get when you mix cairo with carp. Or perhaps a cairn made of carp? #!/usr/bin/env python from distutils.core import setup def main (): dlls = ["bin/%s" % dll for dll in ["libcairo-2.dll"]] licenses = ["doc/%s" % license for license in ["LICENSE-LGPL.TXT", "L...
843f689fd76344aa6921b94576a92d4ff7bba609
test/load_unload/TestLoadUnload.py
test/load_unload/TestLoadUnload.py
""" Test that breakpoint by symbol name works correctly dlopen'ing a dynamic lib. """ import os, time import unittest import lldb import lldbtest class TestClassTypes(lldbtest.TestBase): mydir = "load_unload" def test_dead_strip(self): """Test breakpoint by name works correctly with dlopen'ing.""" ...
Test that breakpoint by symbol name works correctly dlopen'ing a dynamic lib.
Test that breakpoint by symbol name works correctly dlopen'ing a dynamic lib. git-svn-id: b33bab8abb5b18c12ee100cd7761ab452d00b2b0@107812 91177308-0d34-0410-b5e6-96231b3b80d8
Python
apache-2.0
llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb
<REPLACE_OLD> <REPLACE_NEW> """ Test that breakpoint by symbol name works correctly dlopen'ing a dynamic lib. """ import os, time import unittest import lldb import lldbtest class TestClassTypes(lldbtest.TestBase): mydir = "load_unload" def test_dead_strip(self): """Test breakpoint by name works co...
Test that breakpoint by symbol name works correctly dlopen'ing a dynamic lib. git-svn-id: b33bab8abb5b18c12ee100cd7761ab452d00b2b0@107812 91177308-0d34-0410-b5e6-96231b3b80d8
8a309491f6370814f88d8be7e5b7c697c4b59dcd
great_expectations/__init__.py
great_expectations/__init__.py
import pandas as pd from util import * import dataset from pkg_resources import get_distribution try: __version__ = get_distribution('great_expectations').version except: pass def list_sources(): raise NotImplementedError def connect_to_datasource(): raise NotImplementedError def connect_to_datase...
import pandas as pd from .util import * import dataset from pkg_resources import get_distribution try: __version__ = get_distribution('great_expectations').version except: pass def list_sources(): raise NotImplementedError def connect_to_datasource(): raise NotImplementedError def connect_to_datas...
Change import util to .util to support python 3
Change import util to .util to support python 3
Python
apache-2.0
great-expectations/great_expectations,great-expectations/great_expectations,great-expectations/great_expectations,great-expectations/great_expectations
<REPLACE_OLD> util <REPLACE_NEW> .util <REPLACE_END> <REPLACE_OLD> df <REPLACE_NEW> df def df(df, dataset_config=None, *args, **kwargs): <REPLACE_END> <REPLACE_OLD> def <REPLACE_NEW> df.__class__ = dataset.pandas_dataset.PandasDataSet df.initialize_expectations(dataset_config) return df def <REPLACE_END> ...
Change import util to .util to support python 3 import pandas as pd from util import * import dataset from pkg_resources import get_distribution try: __version__ = get_distribution('great_expectations').version except: pass def list_sources(): raise NotImplementedError def connect_to_datasource(): ...
2932698f81a17204b824763e648cd56dbab5f5b2
hawkpost/settings/development.py
hawkpost/settings/development.py
from .common import * # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True # Database # https://docs.djangoproject.com/en/1.9/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': "hawkpost_dev", } } # Development App...
from .common import * # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True # Database # https://docs.djangoproject.com/en/1.9/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': "hawkpost_dev", } } # If the DB_HOST w...
Allow overriding database and mail_debug settings
Allow overriding database and mail_debug settings Using environment variables to override default database connection and mail_debug settings in development mode. This allows setting the values needed by the Docker environment.
Python
mit
whitesmith/hawkpost,whitesmith/hawkpost,whitesmith/hawkpost
<REPLACE_OLD> } } # <REPLACE_NEW> } } # If the DB_HOST was specified it is overriding the default connection if 'DB_HOST' in os.environ: DATABASES['default']['HOST'] = os.environ.get("DB_HOST") DATABASES['default']['PORT'] = os.environ.get("DB_PORT", 5432) DATABASES['default']['USER'] = os.environ.get("D...
Allow overriding database and mail_debug settings Using environment variables to override default database connection and mail_debug settings in development mode. This allows setting the values needed by the Docker environment. from .common import * # SECURITY WARNING: don't run with debug turned on in production! D...
09498335615b7e770f5976b9749d68050966501d
models/timeandplace.py
models/timeandplace.py
#!/usr/bin/env python3 from .base import Serializable from .locations import Platform from datetime import datetime class TimeAndPlace(Serializable): def __init__(self, platform=None, arrival=None, departure=None): super().__init__() self.platform = platform self.arrival = arrival ...
#!/usr/bin/env python3 from .base import Serializable from .locations import Platform from .realtime import RealtimeTime class TimeAndPlace(Serializable): def __init__(self, platform=None, arrival=None, departure=None): super().__init__() self.platform = platform self.arrival = arrival ...
Revert "TimeAndPlace no longer refers to realtime data"
Revert "TimeAndPlace no longer refers to realtime data" This reverts commit cf92e191e3748c67102f142b411937517c5051f4.
Python
apache-2.0
NoMoKeTo/choo,NoMoKeTo/transit
<REPLACE_OLD> datetime <REPLACE_NEW> .realtime <REPLACE_END> <REPLACE_OLD> datetime class <REPLACE_NEW> RealtimeTime class <REPLACE_END> <REPLACE_OLD> datetime), <REPLACE_NEW> RealtimeTime), <REPLACE_END> <REPLACE_OLD> datetime), <REPLACE_NEW> RealtimeTime), <REPLACE_END> <|endoftext|> #!/usr/bin/env python3 fr...
Revert "TimeAndPlace no longer refers to realtime data" This reverts commit cf92e191e3748c67102f142b411937517c5051f4. #!/usr/bin/env python3 from .base import Serializable from .locations import Platform from datetime import datetime class TimeAndPlace(Serializable): def __init__(self, platform=None, arrival=No...
ee22ba999deb9213445112f4486a6080834ba036
django/__init__.py
django/__init__.py
VERSION = (1, 0, 'post-release-SVN') def get_version(): "Returns the version as a human-format string." v = '.'.join([str(i) for i in VERSION[:-1]]) if VERSION[-1]: from django.utils.version import get_svn_revision v = '%s-%s-%s' % (v, VERSION[-1], get_svn_revision()) return v
VERSION = (1, 1, 0, 'alpha', 0) def get_version(): version = '%s.%s' % (VERSION[0], VERSION[1]) if VERSION[2]: version = '%s.%s' % (version, VERSION[2]) if VERSION[3:] == ('alpha', 0): version = '%s pre-alpha' % version else: version = '%s %s' % (version, VERSION[3]) if ...
Update django.VERSION in trunk per previous discussion
Update django.VERSION in trunk per previous discussion --HG-- extra : convert_revision : svn%3Abcc190cf-cafb-0310-a4f2-bffc1f526a37/django/trunk%409103
Python
bsd-3-clause
adieu/django-nonrel,adieu/django-nonrel,adieu/django-nonrel
<INSERT> 1, <INSERT_END> <REPLACE_OLD> 'post-release-SVN') def <REPLACE_NEW> 'alpha', 0) def <REPLACE_END> <DELETE> "Returns the <DELETE_END> <DELETE> as a human-format string." v <DELETE_END> <REPLACE_OLD> '.'.join([str(i) for i in VERSION[:-1]]) <REPLACE_NEW> '%s.%s' % (VERSION[0], VERSION[1]) <REPLACE_END> <...
Update django.VERSION in trunk per previous discussion --HG-- extra : convert_revision : svn%3Abcc190cf-cafb-0310-a4f2-bffc1f526a37/django/trunk%409103 VERSION = (1, 0, 'post-release-SVN') def get_version(): "Returns the version as a human-format string." v = '.'.join([str(i) for i in VERSION[:-1]]) if V...
5770dfc5b5df312dc15f0bc44437c0e62936d688
events/migrations/0073_soft_delete_replaced_objects.py
events/migrations/0073_soft_delete_replaced_objects.py
# Generated by Django 2.2.9 on 2020-01-31 08:25 from django.db import migrations def soft_delete_replaced_objects(Model, deleted_attr='deleted', replaced_by_attr='replaced_by'): for obj in Model.objects.filter(**{f'{replaced_by_attr}__isnull': False, deleted_attr: False}): print(f'Found an object that is...
Add data migration that deletes replaced objects
Add data migration that deletes replaced objects
Python
mit
City-of-Helsinki/linkedevents,City-of-Helsinki/linkedevents,City-of-Helsinki/linkedevents
<INSERT> # Generated by Django 2.2.9 on 2020-01-31 08:25 from django.db import migrations def soft_delete_replaced_objects(Model, deleted_attr='deleted', replaced_by_attr='replaced_by'): <INSERT_END> <INSERT> for obj in Model.objects.filter(**{f'{replaced_by_attr}__isnull': False, deleted_attr: False}): p...
Add data migration that deletes replaced objects
74506160831ec44f29b82ca02ff131b00ce91847
masters/master.chromiumos.tryserver/master_site_config.py
masters/master.chromiumos.tryserver/master_site_config.py
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ActiveMaster definition.""" from config_bootstrap import Master class ChromiumOSTryServer(Master.ChromiumOSBase): project_name = 'ChromiumOS Try Serve...
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ActiveMaster definition.""" from config_bootstrap import Master class ChromiumOSTryServer(Master.ChromiumOSBase): project_name = 'ChromiumOS Try Serve...
Use UberProxy URL for 'tryserver.chromiumos'
Use UberProxy URL for 'tryserver.chromiumos' BUG=352897 TEST=None Review URL: https://codereview.chromium.org/554383002 git-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@291886 0039d316-1c4b-4281-b951-d872f2087c98
Python
bsd-3-clause
eunchong/build,eunchong/build,eunchong/build,eunchong/build
<REPLACE_OLD> 'http://chromegw/p/tryserver.chromiumos/' <REPLACE_NEW> 'https://uberchromegw.corp.google.com/p/tryserver.chromiumos/' <REPLACE_END> <|endoftext|> # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE f...
Use UberProxy URL for 'tryserver.chromiumos' BUG=352897 TEST=None Review URL: https://codereview.chromium.org/554383002 git-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@291886 0039d316-1c4b-4281-b951-d872f2087c98 # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed b...
83d45c0fa64da347eec6b96f46c5eb1fbfe516d4
plugins/call_bad_permissions.py
plugins/call_bad_permissions.py
# -*- coding:utf-8 -*- # # Copyright 2014 Hewlett-Packard Development Company, L.P. # #    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...
# -*- coding:utf-8 -*- # # Copyright 2014 Hewlett-Packard Development Company, L.P. # #    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...
Fix bug with permissions matching
Fix bug with permissions matching
Python
apache-2.0
chair6/bandit,stackforge/bandit,austin987/bandit,pombredanne/bandit,stackforge/bandit,pombredanne/bandit
<REPLACE_OLD> if mode <REPLACE_NEW> if(mode <REPLACE_END> <INSERT> type(mode) == int and <INSERT_END> <REPLACE_OLD> stat.S_IXGRP): <REPLACE_NEW> stat.S_IXGRP)): <REPLACE_END> <|endoftext|> # -*- coding:utf-8 -*- # # Copyright 2014 Hewlett-Packard Development Company, L.P. # #    Licensed under the ...
Fix bug with permissions matching # -*- coding:utf-8 -*- # # Copyright 2014 Hewlett-Packard Development Company, L.P. # #    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 # #         htt...
916b86865acf0297293e4a13f1da6838f9b2711f
scripts/lib/errors.py
scripts/lib/errors.py
""" Оповещение администратора о возникших ошибках """ from traceback import format_exception, format_exc from lib.config import emergency_id from lib.commands import vk, api class ErrorManager: """ Упрощенное оповещение об ошибках str name: название скрипта (обычно укороченное) Использование: with ErrorManager...
""" Оповещение администратора о возникших ошибках """ from traceback import format_exception, format_exc from contextlib import contextmanager from lib.config import emergency_id from lib.commands import vk, api @contextmanager def ErrorManager(name): """ Упрощенное оповещение об ошибках str name: название скрипт...
Change error class to function
Change error class to function
Python
mit
Varabe/Guild-Manager
<INSERT> contextlib import contextmanager from <INSERT_END> <REPLACE_OLD> api class ErrorManager: """ <REPLACE_NEW> api @contextmanager def ErrorManager(name): """ <REPLACE_END> <REPLACE_OLD> ошибках str <REPLACE_NEW> ошибках str <REPLACE_END> <REPLACE_OLD> укороченное) Использование: <REPLACE_NEW> укороче...
Change error class to function """ Оповещение администратора о возникших ошибках """ from traceback import format_exception, format_exc from lib.config import emergency_id from lib.commands import vk, api class ErrorManager: """ Упрощенное оповещение об ошибках str name: название скрипта (обычно укороченное) ...
bea43337d9caa4e9a5271b66d951ae6547a23c80
DjangoLibrary/middleware.py
DjangoLibrary/middleware.py
from django.contrib import auth from django.contrib.auth.middleware import AuthenticationMiddleware import base64 class AutologinAuthenticationMiddleware(AuthenticationMiddleware): def process_request(self, request): if 'autologin' not in request.COOKIES: return if request.COOKIES['a...
from django.contrib import auth from django.contrib.auth.middleware import AuthenticationMiddleware import base64 class AutologinAuthenticationMiddleware(AuthenticationMiddleware): def process_request(self, request): if 'autologin' not in request.COOKIES: return if request.COOKIES['a...
Add a comment to py3 byte string decode.
Add a comment to py3 byte string decode.
Python
apache-2.0
kitconcept/robotframework-djangolibrary
<INSERT> # Py3 uses a bytes string here, so we need to decode to utf-8 <INSERT_END> <REPLACE_OLD> autologin_cookie_value.decode('utf8') <REPLACE_NEW> autologin_cookie_value.decode('utf-8') <REPLACE_END> <|endoftext|> from django.contrib import auth from django.contrib.auth.middleware import AuthenticationMidd...
Add a comment to py3 byte string decode. from django.contrib import auth from django.contrib.auth.middleware import AuthenticationMiddleware import base64 class AutologinAuthenticationMiddleware(AuthenticationMiddleware): def process_request(self, request): if 'autologin' not in request.COOKIES: ...
d237c121955b7249e0e2ab5580d2abc2d19b0f25
noveltorpedo/models.py
noveltorpedo/models.py
from django.db import models class Author(models.Model): name = models.CharField(max_length=255) def __str__(self): return self.name class Story(models.Model): author = models.ForeignKey(Author, on_delete=models.CASCADE) title = models.CharField(max_length=255) contents = models.TextFie...
from django.db import models class Author(models.Model): name = models.CharField(max_length=255) def __str__(self): return self.name class Story(models.Model): authors = models.ManyToManyField(Author) title = models.CharField(max_length=255) contents = models.TextField(default='') ...
Allow a story to have many authors
Allow a story to have many authors
Python
mit
NovelTorpedo/noveltorpedo,NovelTorpedo/noveltorpedo,NovelTorpedo/noveltorpedo,NovelTorpedo/noveltorpedo
<REPLACE_OLD> author <REPLACE_NEW> authors <REPLACE_END> <REPLACE_OLD> models.ForeignKey(Author, on_delete=models.CASCADE) <REPLACE_NEW> models.ManyToManyField(Author) <REPLACE_END> <|endoftext|> from django.db import models class Author(models.Model): name = models.CharField(max_length=255) def __str__(se...
Allow a story to have many authors from django.db import models class Author(models.Model): name = models.CharField(max_length=255) def __str__(self): return self.name class Story(models.Model): author = models.ForeignKey(Author, on_delete=models.CASCADE) title = models.CharField(max_lengt...
d144e30d557ea2f4b03a2f0b7fb68f1cee54a602
cla_backend/apps/legalaid/migrations/0023_migrate_contact_for_research_via_field.py
cla_backend/apps/legalaid/migrations/0023_migrate_contact_for_research_via_field.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations from django.db.models import Q def migrate_contact_for_research_via_field_data(apps, schema_editor): ContactResearchMethod = apps.get_model("legalaid", "ContactResearchMethod") research_methods = {method.method: ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations def migrate_contact_for_research_via_field_data(apps, schema_editor): ContactResearchMethod = apps.get_model("legalaid", "ContactResearchMethod") PersonalDetails = apps.get_model("legalaid", "PersonalDetails") ...
Simplify data migration and make it safe to rerun
Simplify data migration and make it safe to rerun
Python
mit
ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend
<REPLACE_OLD> migrations from django.db.models import Q def <REPLACE_NEW> migrations def <REPLACE_END> <DELETE> research_methods = {method.method: method.id for method in ContactResearchMethod.objects.all()} <DELETE_END> <REPLACE_OLD> "PersonalDetails") models = PersonalDetails.objects.exclude(Q(contact_for...
Simplify data migration and make it safe to rerun # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations from django.db.models import Q def migrate_contact_for_research_via_field_data(apps, schema_editor): ContactResearchMethod = apps.get_model("legalaid", "ContactResea...
abb23c47f503197e005637ce220a07975dc01094
recipes/spyder-line-profiler/run_test.py
recipes/spyder-line-profiler/run_test.py
from xvfbwrapper import Xvfb vdisplay = Xvfb() vdisplay.start() import spyder_line_profiler vdisplay.stop()
""" Test whether spyder_line_profiler is installed The test is only whether the module can be found. It does not attempt to import the module because this needs an X server. """ import imp imp.find_module('spyder_line_profiler')
Use imp.find_module in test for spyder-line-profiler
Use imp.find_module in test for spyder-line-profiler
Python
bsd-3-clause
jjhelmus/staged-recipes,igortg/staged-recipes,petrushy/staged-recipes,Cashalow/staged-recipes,patricksnape/staged-recipes,conda-forge/staged-recipes,NOAA-ORR-ERD/staged-recipes,petrushy/staged-recipes,synapticarbors/staged-recipes,grlee77/staged-recipes,larray-project/staged-recipes,shadowwalkersb/staged-recipes,patric...
<REPLACE_OLD> from xvfbwrapper <REPLACE_NEW> """ Test whether spyder_line_profiler is installed The test is only whether the module can be found. It does not attempt to <REPLACE_END> <REPLACE_OLD> Xvfb vdisplay = Xvfb() vdisplay.start() import spyder_line_profiler vdisplay.stop() <REPLACE_NEW> the module because thi...
Use imp.find_module in test for spyder-line-profiler from xvfbwrapper import Xvfb vdisplay = Xvfb() vdisplay.start() import spyder_line_profiler vdisplay.stop()
377d0634a77c63ce9e3d937f31bdd82ebe695cbb
ev3dev/auto.py
ev3dev/auto.py
import platform # ----------------------------------------------------------------------------- # Guess platform we are running on def current_platform(): machine = platform.machine() if machine == 'armv5tejl': return 'ev3' elif machine == 'armv6l': return 'brickpi' else: return...
import platform import sys # ----------------------------------------------------------------------------- if sys.version_info < (3,4): raise SystemError('Must be using Python 3.4 or higher') # ----------------------------------------------------------------------------- # Guess platform we are running on def c...
Enforce the use of Python 3.4 or higher
Enforce the use of Python 3.4 or higher
Python
mit
rhempel/ev3dev-lang-python,dwalton76/ev3dev-lang-python,dwalton76/ev3dev-lang-python
<REPLACE_OLD> platform # <REPLACE_NEW> platform import sys # ----------------------------------------------------------------------------- if sys.version_info < (3,4): raise SystemError('Must be using Python 3.4 or higher') # <REPLACE_END> <REPLACE_OLD> on def <REPLACE_NEW> on def <REPLACE_END> <REPLACE_OLD> '...
Enforce the use of Python 3.4 or higher import platform # ----------------------------------------------------------------------------- # Guess platform we are running on def current_platform(): machine = platform.machine() if machine == 'armv5tejl': return 'ev3' elif machine == 'armv6l': ...
4a81ee90a39c4831dca186ae269184c703ddbf2e
src/autobot/src/udpRemote.py
src/autobot/src/udpRemote.py
#!/usr/bin/env python import rospy import socket from autobot.msg import drive_param """ Warning: This code has not been tested at all Protocol could be comma delimited Vaa.aa;Abb.bb TODO - [ ] Unit test - [ ] Define protocol - [ ] Use select() for non-blocking operation - [ ] Use a timeout for setting drive/angle ...
Add code for udp remote
Add code for udp remote This code is untested and is still WIP.
Python
mit
atkvo/masters-bot,atkvo/masters-bot,atkvo/masters-bot,atkvo/masters-bot,atkvo/masters-bot
<REPLACE_OLD> <REPLACE_NEW> #!/usr/bin/env python import rospy import socket from autobot.msg import drive_param """ Warning: This code has not been tested at all Protocol could be comma delimited Vaa.aa;Abb.bb TODO - [ ] Unit test - [ ] Define protocol - [ ] Use select() for non-blocking operation - [ ] Use a tim...
Add code for udp remote This code is untested and is still WIP.
1ce040e0642c6dcc888b3787f7448c65ba0318f8
logos_setup_data/__openerp__.py
logos_setup_data/__openerp__.py
# -*- coding: utf-8 -*- { 'name': 'Logos Set Up Data', 'version': '1.0', 'category': 'Accounting', 'sequence': 14, 'summary': '', 'description': """ Logos Set Up Data ===================== """, 'author': 'Ingenieria ADHOC', 'website': 'www.ingadhoc.com', 'images': [ ], '...
# -*- coding: utf-8 -*- { 'name': 'Logos Set Up Data', 'version': '1.0', 'category': 'Accounting', 'sequence': 14, 'summary': '', 'description': """ Logos Set Up Data ===================== """, 'author': 'Ingenieria ADHOC', 'website': 'www.ingadhoc.com', 'images': [ ], '...
ADD base location to logos as it is necesary for security rules
ADD base location to logos as it is necesary for security rules
Python
agpl-3.0
ingadhoc/odoo-personalizations,adhoc-dev/odoo-personalizations
<DELETE> # <DELETE_END> <|endoftext|> # -*- coding: utf-8 -*- { 'name': 'Logos Set Up Data', 'version': '1.0', 'category': 'Accounting', 'sequence': 14, 'summary': '', 'description': """ Logos Set Up Data ===================== """, 'author': 'Ingenieria ADHOC', 'website': 'www.ingad...
ADD base location to logos as it is necesary for security rules # -*- coding: utf-8 -*- { 'name': 'Logos Set Up Data', 'version': '1.0', 'category': 'Accounting', 'sequence': 14, 'summary': '', 'description': """ Logos Set Up Data ===================== """, 'author': 'Ingenieria ADHOC'...
c7785ff4367de929392b85f73a396e987cfe4606
apps/chats/models.py
apps/chats/models.py
from django.db import models from django.contrib.auth.models import User from django.utils.text import truncate_words from automatic_timestamps.models import TimestampModel class Chat(TimestampModel): """ A chat is a single or multi-line text excerpt from a chat (usually purposefully out of context) post...
from django.db import models from django.contrib.auth.models import User from django.utils.text import truncate_words from automatic_timestamps.models import TimestampModel class Chat(TimestampModel): """ A chat is a single or multi-line text excerpt from a chat (usually purposefully out of context) post...
Add HTML representation of chat
Add HTML representation of chat
Python
mit
tofumatt/quotes,tofumatt/quotes
<INSERT> as_html(self, tag='div'): """ Return an HTML representation of this chat, including tags marking the author and text selection accordingly. Use the tag argument to customize the tag that wraps each line in a chat. """ html = u'' for line...
Add HTML representation of chat from django.db import models from django.contrib.auth.models import User from django.utils.text import truncate_words from automatic_timestamps.models import TimestampModel class Chat(TimestampModel): """ A chat is a single or multi-line text excerpt from a chat (usually ...
138aa351b3dbe95f3cdebf01dbd3c75f1ce3fac2
src/ggrc/fulltext/sql.py
src/ggrc/fulltext/sql.py
# Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: david@reciprocitylabs.com # Maintained By: david@reciprocitylabs.com from ggrc import db from . import Indexer class SqlIndexer(Indexer): def cr...
# Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: david@reciprocitylabs.com # Maintained By: david@reciprocitylabs.com from ggrc import db from . import Indexer class SqlIndexer(Indexer): def cr...
Fix test broken due to delete_record change
Fix test broken due to delete_record change
Python
apache-2.0
kr41/ggrc-core,uskudnik/ggrc-core,vladan-m/ggrc-core,AleksNeStu/ggrc-core,prasannav7/ggrc-core,josthkko/ggrc-core,vladan-m/ggrc-core,hyperNURb/ggrc-core,vladan-m/ggrc-core,uskudnik/ggrc-core,jmakov/ggrc-core,NejcZupec/ggrc-core,hyperNURb/ggrc-core,andrei-karalionak/ggrc-core,hasanalom/ggrc-core,selahssea/ggrc-core,Alek...
<INSERT> record.type, <INSERT_END> <|endoftext|> # Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: david@reciprocitylabs.com # Maintained By: david@reciprocitylabs.com from ggrc import db from . im...
Fix test broken due to delete_record change # Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: david@reciprocitylabs.com # Maintained By: david@reciprocitylabs.com from ggrc import db from . import...
79bf320f18db1b1dc89383a1c8e2f1080391c56c
tests/zeus/api/resources/test_revision_artifacts.py
tests/zeus/api/resources/test_revision_artifacts.py
from datetime import timedelta from zeus import factories from zeus.models import RepositoryAccess, RepositoryBackend, RepositoryProvider from zeus.utils import timezone def test_revision_artifacts( client, db_session, default_login, default_user, git_repo_config ): repo = factories.RepositoryFactory.create(...
Add coverage for revision artifacts endpoint
test: Add coverage for revision artifacts endpoint
Python
apache-2.0
getsentry/zeus,getsentry/zeus,getsentry/zeus,getsentry/zeus
<INSERT> from datetime import timedelta from zeus import factories from zeus.models import RepositoryAccess, RepositoryBackend, RepositoryProvider from zeus.utils import timezone def test_revision_artifacts( <INSERT_END> <INSERT> client, db_session, default_login, default_user, git_repo_config ): repo = facto...
test: Add coverage for revision artifacts endpoint
fbdfb3de379af44880b928b6779a2edb578fb987
changes/api/serializer/models/plan.py
changes/api/serializer/models/plan.py
import json from changes.api.serializer import Serializer, register from changes.models import Plan, Step @register(Plan) class PlanSerializer(Serializer): def serialize(self, instance, attrs): return { 'id': instance.id.hex, 'name': instance.label, 'steps': list(insta...
import json from changes.api.serializer import Serializer, register from changes.models import Plan, Step @register(Plan) class PlanSerializer(Serializer): def serialize(self, instance, attrs): return { 'id': instance.id.hex, 'name': instance.label, 'steps': list(insta...
Handle optional value in step.data
Handle optional value in step.data
Python
apache-2.0
dropbox/changes,wfxiang08/changes,bowlofstew/changes,wfxiang08/changes,dropbox/changes,bowlofstew/changes,bowlofstew/changes,wfxiang08/changes,wfxiang08/changes,dropbox/changes,bowlofstew/changes,dropbox/changes
<REPLACE_OLD> json.dumps(dict(instance.data)), <REPLACE_NEW> json.dumps(dict(instance.data or {})), <REPLACE_END> <|endoftext|> import json from changes.api.serializer import Serializer, register from changes.models import Plan, Step @register(Plan) class PlanSerializer(Serializer): def serialize(self, instanc...
Handle optional value in step.data import json from changes.api.serializer import Serializer, register from changes.models import Plan, Step @register(Plan) class PlanSerializer(Serializer): def serialize(self, instance, attrs): return { 'id': instance.id.hex, 'name': instance.la...
8f5849a90c63c82b036e21d36b9d77b20e1aa60b
src/pretix/testutils/settings.py
src/pretix/testutils/settings.py
import atexit import os import tempfile tmpdir = tempfile.TemporaryDirectory() os.environ.setdefault('DATA_DIR', tmpdir.name) from pretix.settings import * # NOQA DATA_DIR = tmpdir.name LOG_DIR = os.path.join(DATA_DIR, 'logs') MEDIA_ROOT = os.path.join(DATA_DIR, 'media') atexit.register(tmpdir.cleanup) EMAIL_BACK...
import atexit import os import tempfile tmpdir = tempfile.TemporaryDirectory() os.environ.setdefault('DATA_DIR', tmpdir.name) from pretix.settings import * # NOQA DATA_DIR = tmpdir.name LOG_DIR = os.path.join(DATA_DIR, 'logs') MEDIA_ROOT = os.path.join(DATA_DIR, 'media') atexit.register(tmpdir.cleanup) EMAIL_BACK...
Test on SQLite if not configured otherwise
Test on SQLite if not configured otherwise
Python
apache-2.0
Flamacue/pretix,Flamacue/pretix,Flamacue/pretix,Flamacue/pretix
<INSERT> } } DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:' <INSERT_END> <|endoftext|> import atexit import os import tempfile tmpdir = tempfile.TemporaryDirectory() os.environ.setdefault('DATA_DIR', tmpdir.name) from pretix.settings import * # NOQA DA...
Test on SQLite if not configured otherwise import atexit import os import tempfile tmpdir = tempfile.TemporaryDirectory() os.environ.setdefault('DATA_DIR', tmpdir.name) from pretix.settings import * # NOQA DATA_DIR = tmpdir.name LOG_DIR = os.path.join(DATA_DIR, 'logs') MEDIA_ROOT = os.path.join(DATA_DIR, 'media') ...
67a230dd5673601f2e1f1a8c3deb8597f29287db
src/tmlib/workflow/align/args.py
src/tmlib/workflow/align/args.py
from tmlib.workflow.args import BatchArguments from tmlib.workflow.args import SubmissionArguments from tmlib.workflow.args import Argument from tmlib.workflow import register_batch_args from tmlib.workflow import register_submission_args @register_batch_args('align') class AlignBatchArguments(BatchArguments): r...
from tmlib.workflow.args import BatchArguments from tmlib.workflow.args import SubmissionArguments from tmlib.workflow.args import Argument from tmlib.workflow import register_batch_args from tmlib.workflow import register_submission_args @register_batch_args('align') class AlignBatchArguments(BatchArguments): r...
Increase default batch size for align step
Increase default batch size for align step
Python
agpl-3.0
TissueMAPS/TmLibrary,TissueMAPS/TmLibrary,TissueMAPS/TmLibrary,TissueMAPS/TmLibrary,TissueMAPS/TmLibrary
<REPLACE_OLD> default=10, <REPLACE_NEW> default=100, <REPLACE_END> <|endoftext|> from tmlib.workflow.args import BatchArguments from tmlib.workflow.args import SubmissionArguments from tmlib.workflow.args import Argument from tmlib.workflow import register_batch_args from tmlib.workflow import register_submission_args ...
Increase default batch size for align step from tmlib.workflow.args import BatchArguments from tmlib.workflow.args import SubmissionArguments from tmlib.workflow.args import Argument from tmlib.workflow import register_batch_args from tmlib.workflow import register_submission_args @register_batch_args('align') class...
30008019f47f4077469ad12cb2a3e203fba24527
server.py
server.py
import tornado.ioloop import tornado.web import logging import motor from settings import routing from tornado.options import options import os if not os.path.exists(options.log_dir): os.makedirs(options.log_dir) logging.basicConfig( format='%(asctime)s [%(name)s] %(levelname)s: %(message)s', filename='%s...
import tornado.ioloop import tornado.web import logging import motor from settings import routing from tornado.options import options import os if not os.path.exists(options.log_dir): os.makedirs(options.log_dir) logging.basicConfig( format='%(asctime)s [%(name)s] %(levelname)s: %(message)s', filename='%s...
Add to log db connection url
Add to log db connection url
Python
apache-2.0
jiss-software/jiss-file-service,jiss-software/jiss-file-service,jiss-software/jiss-file-service
<REPLACE_OLD> level=logging.DEBUG ) ioLoop <REPLACE_NEW> level=logging.DEBUG ) logging.getLogger('INIT').info('Connecting to mongodb at: %s' % options.db_address) ioLoop <REPLACE_END> <|endoftext|> import tornado.ioloop import tornado.web import logging import motor from settings import routing from tornado.options i...
Add to log db connection url import tornado.ioloop import tornado.web import logging import motor from settings import routing from tornado.options import options import os if not os.path.exists(options.log_dir): os.makedirs(options.log_dir) logging.basicConfig( format='%(asctime)s [%(name)s] %(levelname)s: ...
28126555aea9a78467dfcadbb2b14f9c640cdc6d
dwitter/templatetags/to_gravatar_url.py
dwitter/templatetags/to_gravatar_url.py
import hashlib from django import template register = template.Library() @register.filter def to_gravatar_url(email): return ('https://gravatar.com/avatar/%s?d=retro' % hashlib.md5((email or '').strip().lower()).hexdigest())
import hashlib from django import template register = template.Library() @register.filter def to_gravatar_url(email): return ('https://gravatar.com/avatar/%s?d=retro' % hashlib.md5((email or '').strip().lower().encode('utf-8')).hexdigest())
Fix gravatar hashing error on py3
Fix gravatar hashing error on py3
Python
apache-2.0
lionleaf/dwitter,lionleaf/dwitter,lionleaf/dwitter
<REPLACE_OLD> '').strip().lower()).hexdigest()) <REPLACE_NEW> '').strip().lower().encode('utf-8')).hexdigest()) <REPLACE_END> <|endoftext|> import hashlib from django import template register = template.Library() @register.filter def to_gravatar_url(email): return ('https://gravatar.com/avatar/%s?d=retro' % ...
Fix gravatar hashing error on py3 import hashlib from django import template register = template.Library() @register.filter def to_gravatar_url(email): return ('https://gravatar.com/avatar/%s?d=retro' % hashlib.md5((email or '').strip().lower()).hexdigest())
640ce1a3b4f9cca4ebcc10f3d62b1d4d995dd0c5
src/foremast/pipeline/create_pipeline_manual.py
src/foremast/pipeline/create_pipeline_manual.py
# Foremast - Pipeline Tooling # # Copyright 2016 Gogo, LLC # # 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...
# Foremast - Pipeline Tooling # # Copyright 2016 Gogo, LLC # # 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...
Delete manual Pipeline before creating
fix: Delete manual Pipeline before creating See also: #72
Python
apache-2.0
gogoair/foremast,gogoair/foremast
<INSERT> .clean_pipelines import delete_pipeline from <INSERT_END> <INSERT> delete_pipeline(app=self.app_name, pipeline_name=json_file) <INSERT_END> <|endoftext|> # Foremast - Pipeline Tooling # # Copyright 2016 Gogo, LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may...
fix: Delete manual Pipeline before creating See also: #72 # Foremast - Pipeline Tooling # # Copyright 2016 Gogo, LLC # # 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...
ec244cc9c56fec571502529ef24af2ca18d9f5f5
spirit/templatetags/tags/utils/gravatar.py
spirit/templatetags/tags/utils/gravatar.py
#-*- coding: utf-8 -*- import hashlib from django.utils.http import urlencode, urlquote from .. import register @register.simple_tag() def get_gravatar_url(user, size, rating='g', default='identicon'): url = "http://www.gravatar.com/avatar/" hash = hashlib.md5(user.email.strip().lower()).hexdigest() d...
#-*- coding: utf-8 -*- import hashlib from django.utils.http import urlencode, urlquote from django.utils.encoding import force_bytes from .. import register @register.simple_tag() def get_gravatar_url(user, size, rating='g', default='identicon'): url = "http://www.gravatar.com/avatar/" hash = hashlib.md5...
Use django utils force_bytes to arguments of hashlib
Use django utils force_bytes to arguments of hashlib
Python
mit
alesdotio/Spirit,a-olszewski/Spirit,raybesiga/Spirit,a-olszewski/Spirit,dvreed/Spirit,ramaseshan/Spirit,adiyengar/Spirit,battlecat/Spirit,ramaseshan/Spirit,gogobook/Spirit,dvreed/Spirit,nitely/Spirit,mastak/Spirit,battlecat/Spirit,nitely/Spirit,a-olszewski/Spirit,alesdotio/Spirit,mastak/Spirit,alesdotio/Spirit,gogobook...
<REPLACE_OLD> urlquote from <REPLACE_NEW> urlquote from django.utils.encoding import force_bytes from <REPLACE_END> <REPLACE_OLD> hashlib.md5(user.email.strip().lower()).hexdigest() <REPLACE_NEW> hashlib.md5(force_bytes(user.email.strip().lower().encode('utf_8'))).hexdigest() <REPLACE_END> <|endoftext|> #-*- coding...
Use django utils force_bytes to arguments of hashlib #-*- coding: utf-8 -*- import hashlib from django.utils.http import urlencode, urlquote from .. import register @register.simple_tag() def get_gravatar_url(user, size, rating='g', default='identicon'): url = "http://www.gravatar.com/avatar/" hash = has...
47f4e738cc11ec40d3410332106163b0235f5da4
tests/python/tests/test_result.py
tests/python/tests/test_result.py
import unittest import librepo from librepo import LibrepoException class TestCaseResult(unittest.TestCase): def test_result_getinfo(self): r = librepo.Result() self.assertTrue(r) self.assertRaises(ValueError, r.getinfo, 99999999) self.assertFalse(r.getinfo(librepo.LRR_YUM_REPO)) ...
Add tests for Result object
Tests: Add tests for Result object
Python
lgpl-2.1
Conan-Kudo/librepo,bgamari/librepo,Tojaj/librepo,rholy/librepo,rholy/librepo,cgwalters/librepo,rpm-software-management/librepo,Tojaj/librepo,Conan-Kudo/librepo,rholy/librepo,cgwalters/librepo,cgwalters/librepo,rholy/librepo,Conan-Kudo/librepo,cgwalters/librepo,rpm-software-management/librepo,Tojaj/librepo,rpm-software-...
<INSERT> import unittest import librepo from librepo import LibrepoException class TestCaseResult(unittest.TestCase): <INSERT_END> <INSERT> def test_result_getinfo(self): r = librepo.Result() self.assertTrue(r) self.assertRaises(ValueError, r.getinfo, 99999999) self.assertFalse(r.g...
Tests: Add tests for Result object
21c7232081483c05752e6db3d60692a04d482d24
dakota/tests/test_dakota_base.py
dakota/tests/test_dakota_base.py
#!/usr/bin/env python # # Tests for dakota.dakota_base module. # # Call with: # $ nosetests -sv # # Mark Piper (mark.piper@colorado.edu) import os import filecmp from nose.tools import * from dakota.dakota_base import DakotaBase # Fixtures ------------------------------------------------------------- def setup_mo...
#!/usr/bin/env python # # Tests for dakota.dakota_base module. # # Call with: # $ nosetests -sv # # Mark Piper (mark.piper@colorado.edu) from nose.tools import * from dakota.dakota_base import DakotaBase # Helpers -------------------------------------------------------------- class Concrete(DakotaBase): """A s...
Add tests for dakota.dakota_base module
Add tests for dakota.dakota_base module Make a subclass of DakotaBase to use for testing. Add tests for the "block" sections used to define an input file.
Python
mit
csdms/dakota,csdms/dakota
<REPLACE_OLD> (mark.piper@colorado.edu) import os import filecmp from <REPLACE_NEW> (mark.piper@colorado.edu) from <REPLACE_END> <REPLACE_OLD> DakotaBase # <REPLACE_NEW> DakotaBase # Helpers -------------------------------------------------------------- class Concrete(DakotaBase): """A subclass of DakotaBase ...
Add tests for dakota.dakota_base module Make a subclass of DakotaBase to use for testing. Add tests for the "block" sections used to define an input file. #!/usr/bin/env python # # Tests for dakota.dakota_base module. # # Call with: # $ nosetests -sv # # Mark Piper (mark.piper@colorado.edu) import os import filecm...
b42d2239d24bb651f95830899d972e4302a10d77
setup.py
setup.py
#!/usr/bin/env python import setuptools import samsungctl setuptools.setup( name=samsungctl.__title__, version=samsungctl.__version__, description=samsungctl.__doc__, url=samsungctl.__url__, author=samsungctl.__author__, author_email=samsungctl.__author_email__, license=samsungctl.__licen...
#!/usr/bin/env python import setuptools import samsungctl setuptools.setup( name=samsungctl.__title__, version=samsungctl.__version__, description=samsungctl.__doc__, url=samsungctl.__url__, author=samsungctl.__author__, author_email=samsungctl.__author_email__, license=samsungctl.__licen...
Use comma on every line on multi-line lists
Use comma on every line on multi-line lists
Python
mit
dominikkarall/samsungctl,Ape/samsungctl
<REPLACE_OLD> Automation" <REPLACE_NEW> Automation", <REPLACE_END> <REPLACE_OLD> ] ) <REPLACE_NEW> ], ) <REPLACE_END> <|endoftext|> #!/usr/bin/env python import setuptools import samsungctl setuptools.setup( name=samsungctl.__title__, version=samsungctl.__version__, description=samsungctl.__doc__, ...
Use comma on every line on multi-line lists #!/usr/bin/env python import setuptools import samsungctl setuptools.setup( name=samsungctl.__title__, version=samsungctl.__version__, description=samsungctl.__doc__, url=samsungctl.__url__, author=samsungctl.__author__, author_email=samsungctl.__a...
0ad53b5dc887ab4b81e3cf83bfb897340880c3a2
launch_control/models/test_case.py
launch_control/models/test_case.py
""" Module with the TestCase model. """ from launch_control.utils.json.pod import PlainOldData class TestCase(PlainOldData): """ TestCase model. Currently contains just two fields: - test_case_id (test-case specific ID) - name (human readable) """ __slots__ = ('test_case_id', 'd...
""" Module with the TestCase model. """ from launch_control.utils.json.pod import PlainOldData class TestCase(PlainOldData): """ TestCase model. Currently contains just two fields: - test_case_id (test-case specific ID) - name (human readable) """ __slots__ = ('test_case_id', 'n...
Fix TestCase definition to have a slot 'name' instead of 'desc'
Fix TestCase definition to have a slot 'name' instead of 'desc'
Python
agpl-3.0
Linaro/lava-server,Linaro/lava-server,Linaro/lava-server,OSSystems/lava-server,OSSystems/lava-server,OSSystems/lava-server,Linaro/lava-server
<REPLACE_OLD> 'desc') <REPLACE_NEW> 'name') <REPLACE_END> <|endoftext|> """ Module with the TestCase model. """ from launch_control.utils.json.pod import PlainOldData class TestCase(PlainOldData): """ TestCase model. Currently contains just two fields: - test_case_id (test-case specific ID) ...
Fix TestCase definition to have a slot 'name' instead of 'desc' """ Module with the TestCase model. """ from launch_control.utils.json.pod import PlainOldData class TestCase(PlainOldData): """ TestCase model. Currently contains just two fields: - test_case_id (test-case specific ID) - ...
8db3ee0d6b73b864a91cd3617342138f05175d9d
accounts/models.py
accounts/models.py
# coding: utf-8 from django.conf import settings from django.db import models from django.utils.translation import ugettext_lazy as _ from registration.signals import user_activated from django.dispatch import receiver class UserAccount(models.Model): """ A user account. Used to store any information related...
# coding: utf-8 from django.conf import settings from django.db import models from django.utils.translation import ugettext_lazy as _ from registration.signals import user_activated from django.dispatch import receiver class UserAccount(models.Model): """ A user account. Used to store any information related...
Add __unicode__ method to UserAccount model
Add __unicode__ method to UserAccount model
Python
agpl-3.0
coders4help/volunteer_planner,alper/volunteer_planner,klinger/volunteer_planner,pitpalme/volunteer_planner,volunteer-planner/volunteer_planner,pitpalme/volunteer_planner,christophmeissner/volunteer_planner,pitpalme/volunteer_planner,christophmeissner/volunteer_planner,alper/volunteer_planner,flindenberg/volunteer_plann...
<REPLACE_OLD> accounts') @receiver(user_activated) def <REPLACE_NEW> accounts') def __unicode__(self): return u'{}'.format(self.user.username) @receiver(user_activated) def <REPLACE_END> <|endoftext|> # coding: utf-8 from django.conf import settings from django.db import models from django.utils.trans...
Add __unicode__ method to UserAccount model # coding: utf-8 from django.conf import settings from django.db import models from django.utils.translation import ugettext_lazy as _ from registration.signals import user_activated from django.dispatch import receiver class UserAccount(models.Model): """ A user a...
0efeaa258b19d5b1ba204cc55fbdb6969e0f3e64
flake8_respect_noqa.py
flake8_respect_noqa.py
# -*- coding: utf-8 -*- """ Always ignore lines with '# noqa' """ __version__ = 0.2 import pep8 class RespectNoqaReport(pep8.StandardReport): def error(self, line_number, offset, text, check): if len(self.lines) > line_number - 1 and pep8.noqa(self.lines[line_number - 1]): return els...
# -*- coding: utf-8 -*- """ Always ignore lines with '# noqa' """ __version__ = 0.2 try: from pep8 import StandardReport, noqa except ImportError: # Try the new (as of 2016-June) pycodestyle package. from pycodestyle import StandardReport, noqa class RespectNoqaReport(StandardReport): def error(self...
Adjust for pep8 package rename.
Adjust for pep8 package rename. Closes #1
Python
mit
spookylukey/flake8-respect-noqa
<REPLACE_OLD> 0.2 import pep8 class RespectNoqaReport(pep8.StandardReport): <REPLACE_NEW> 0.2 try: from pep8 import StandardReport, noqa except ImportError: # Try the new (as of 2016-June) pycodestyle package. from pycodestyle import StandardReport, noqa class RespectNoqaReport(StandardReport): <R...
Adjust for pep8 package rename. Closes #1 # -*- coding: utf-8 -*- """ Always ignore lines with '# noqa' """ __version__ = 0.2 import pep8 class RespectNoqaReport(pep8.StandardReport): def error(self, line_number, offset, text, check): if len(self.lines) > line_number - 1 and pep8.noqa(self.lines[line_...
dc0dfd4a763dceef655d62e8364b92a8073b7751
chrome/chromehost.py
chrome/chromehost.py
#!/usr/bin/env python import socket import struct import sys def send_to_chrome(message): # Write message size. sys.stdout.write(struct.pack('I', len(message))) # Write the message itself. sys.stdout.write(message) sys.stdout.flush() def read_from_chrome(): text_length_bytes = sys.stdin.rea...
#!/usr/bin/env python import socket import struct import sys def send_to_chrome(message): # Write message size. sys.stdout.write(struct.pack('I', len(message))) # Write the message itself. sys.stdout.write(message) sys.stdout.flush() def read_from_chrome(): text_length_bytes = sys.stdin.rea...
Change chromhost to use normal sockets
Change chromhost to use normal sockets
Python
mit
CacheBrowser/cachebrowser,NewBie1993/cachebrowser
<REPLACE_OLD> text sock <REPLACE_NEW> text # sock <REPLACE_END> <REPLACE_OLD> socket.SOCK_STREAM) socket_name <REPLACE_NEW> socket.SOCK_STREAM) # socket_name <REPLACE_END> <REPLACE_OLD> '/tmp/cachebrowser.sock' sock.connect(socket_name) message <REPLACE_NEW> '/tmp/cachebrowser.sock' # sock.connect(socket_name) soc...
Change chromhost to use normal sockets #!/usr/bin/env python import socket import struct import sys def send_to_chrome(message): # Write message size. sys.stdout.write(struct.pack('I', len(message))) # Write the message itself. sys.stdout.write(message) sys.stdout.flush() def read_from_chrome(...
4b63093abbc388bc26151422991ce39553cf137f
neuroimaging/utils/tests/test_odict.py
neuroimaging/utils/tests/test_odict.py
"""Test file for the ordered dictionary module, odict.py.""" from neuroimaging.externals.scipy.testing import * from neuroimaging.utils.odict import odict class TestOdict(TestCase): def setUp(self): print 'setUp' self.thedict = odict((('one', 1.0), ('two', 2.0), ('three', 3.0))) def test_cop...
"""Test file for the ordered dictionary module, odict.py.""" from neuroimaging.externals.scipy.testing import * from neuroimaging.utils.odict import odict class TestOdict(TestCase): def setUp(self): print 'setUp' self.thedict = odict((('one', 1.0), ('two', 2.0), ('three', 3.0))) def test_cop...
Fix nose call so tests run in __main__.
BUG: Fix nose call so tests run in __main__.
Python
bsd-3-clause
alexis-roche/nipy,alexis-roche/nipy,arokem/nipy,nipy/nipy-labs,nipy/nireg,alexis-roche/nireg,alexis-roche/register,nipy/nipy-labs,arokem/nipy,alexis-roche/register,nipy/nireg,bthirion/nipy,bthirion/nipy,alexis-roche/nireg,arokem/nipy,bthirion/nipy,alexis-roche/register,arokem/nipy,alexis-roche/niseg,alexis-roche/nipy,a...
<REPLACE_OLD> nose.run(argv=['', __file__]) <REPLACE_NEW> nose.runmodule() <REPLACE_END> <|endoftext|> """Test file for the ordered dictionary module, odict.py.""" from neuroimaging.externals.scipy.testing import * from neuroimaging.utils.odict import odict class TestOdict(TestCase): def setUp(self): p...
BUG: Fix nose call so tests run in __main__. """Test file for the ordered dictionary module, odict.py.""" from neuroimaging.externals.scipy.testing import * from neuroimaging.utils.odict import odict class TestOdict(TestCase): def setUp(self): print 'setUp' self.thedict = odict((('one', 1.0), ('t...
0dddfcbdb46ac91ddc0bfed4482bce049a8593c2
lazyblacksmith/views/blueprint.py
lazyblacksmith/views/blueprint.py
# -*- encoding: utf-8 -*- from flask import Blueprint from flask import render_template from lazyblacksmith.models import Activity from lazyblacksmith.models import Item from lazyblacksmith.models import Region blueprint = Blueprint('blueprint', __name__) @blueprint.route('/manufacturing/<int:item_id>') def manufac...
# -*- encoding: utf-8 -*- import config from flask import Blueprint from flask import render_template from lazyblacksmith.models import Activity from lazyblacksmith.models import Item from lazyblacksmith.models import Region blueprint = Blueprint('blueprint', __name__) @blueprint.route('/manufacturing/<int:item_id>...
Change region list to match config
Change region list to match config
Python
bsd-3-clause
Kyria/LazyBlacksmith,Kyria/LazyBlacksmith,Kyria/LazyBlacksmith,Kyria/LazyBlacksmith
<REPLACE_OLD> -*- from <REPLACE_NEW> -*- import config from <REPLACE_END> <REPLACE_OLD> render_template from <REPLACE_NEW> render_template from <REPLACE_END> <REPLACE_OLD> Region.query.filter_by(wh=False) <REPLACE_NEW> Region.query.filter( Region.id.in_(config.CREST_REGION_PRICE) ).filter_by( wh...
Change region list to match config # -*- encoding: utf-8 -*- from flask import Blueprint from flask import render_template from lazyblacksmith.models import Activity from lazyblacksmith.models import Item from lazyblacksmith.models import Region blueprint = Blueprint('blueprint', __name__) @blueprint.route('/manuf...
b5ae6290382ef69f9d76c0494aee90f85bdf2c16
plugins/Views/SimpleView/__init__.py
plugins/Views/SimpleView/__init__.py
# Copyright (c) 2015 Ultimaker B.V. # Uranium is released under the terms of the AGPLv3 or higher. from . import SimpleView from UM.i18n import i18nCatalog i18n_catalog = i18nCatalog("uranium") def getMetaData(): return { "plugin": { "name": i18n_catalog.i18nc("@label", "Simple View"), ...
# Copyright (c) 2015 Ultimaker B.V. # Uranium is released under the terms of the AGPLv3 or higher. from . import SimpleView from UM.i18n import i18nCatalog i18n_catalog = i18nCatalog("uranium") def getMetaData(): return { "type": "view", "plugin": { "name": i18n_catalog.i18nc("@label"...
Fix plug-in type and description key
Fix plug-in type and description key 't Was a typo. Contributes to issue CURA-1190.
Python
agpl-3.0
onitake/Uranium,onitake/Uranium
<INSERT> "type": "view", <INSERT_END> <REPLACE_OLD> "decription": <REPLACE_NEW> "description": <REPLACE_END> <|endoftext|> # Copyright (c) 2015 Ultimaker B.V. # Uranium is released under the terms of the AGPLv3 or higher. from . import SimpleView from UM.i18n import i18nCatalog i18n_catalog = i18nCatalog("ura...
Fix plug-in type and description key 't Was a typo. Contributes to issue CURA-1190. # Copyright (c) 2015 Ultimaker B.V. # Uranium is released under the terms of the AGPLv3 or higher. from . import SimpleView from UM.i18n import i18nCatalog i18n_catalog = i18nCatalog("uranium") def getMetaData(): return { ...
0404f6ebc33d83fc6dfeceed5d9370e73ef40e64
awx/main/conf.py
awx/main/conf.py
# Copyright (c) 2015 Ansible, Inc.. # All Rights Reserved. import json from django.conf import settings as django_settings from awx.main.models.configuration import TowerSettings class TowerConfiguration(object): def __getattr__(self, key): ts = TowerSettings.objects.filter(key=key) if not ts.exi...
# Copyright (c) 2015 Ansible, Inc.. # All Rights Reserved. import json from django.conf import settings as django_settings from awx.main.models.configuration import TowerSettings class TowerConfiguration(object): # TODO: Caching so we don't have to hit the database every time for settings def __getattr__(sel...
Add a note about caching
Add a note about caching
Python
apache-2.0
snahelou/awx,wwitzel3/awx,wwitzel3/awx,snahelou/awx,wwitzel3/awx,snahelou/awx,wwitzel3/awx,snahelou/awx
<INSERT> # TODO: Caching so we don't have to hit the database every time for settings <INSERT_END> <|endoftext|> # Copyright (c) 2015 Ansible, Inc.. # All Rights Reserved. import json from django.conf import settings as django_settings from awx.main.models.configuration import TowerSettings class TowerConfigurati...
Add a note about caching # Copyright (c) 2015 Ansible, Inc.. # All Rights Reserved. import json from django.conf import settings as django_settings from awx.main.models.configuration import TowerSettings class TowerConfiguration(object): def __getattr__(self, key): ts = TowerSettings.objects.filter(key=...
2a61cdcad1de2d4b080a91e7eaca714a3e2ec68b
test/lib/environment_test.py
test/lib/environment_test.py
# Run the following command to test: # # (in /usr/local/googkit) # $ python -m {test_module_name} # # See also: http://docs.python.org/3.3/library/unittest.html#command-line-interface # # We cannot use unittest.mock on python 2.x! # Please install the Mock module when you use Python 2.x. # # $ easy_install ...
Add a test for lib.environment
Add a test for lib.environment
Python
mit
googkit/googkit,googkit/googkit,googkit/googkit
<INSERT> # Run the following command to test: # # <INSERT_END> <INSERT> (in /usr/local/googkit) # $ python -m {test_module_name} # # See also: http://docs.python.org/3.3/library/unittest.html#command-line-interface # # We cannot use unittest.mock on python 2.x! # Please install the Mock module when you use Pytho...
Add a test for lib.environment
35974efcbae0c8a1b3009d7a2f38c73a52ff5790
powerdns/admin.py
powerdns/admin.py
# -*- coding: utf-8 -*- from django.contrib import admin from powerdns.models import Domain, Record, Supermaster class RecordAdmin(admin.ModelAdmin): list_display = ('name', 'type', 'content', 'ttl', 'prio', 'change_date',) list_filter = ['type', 'ttl',] search_fields = ('name','content',) class DomainAd...
# -*- coding: utf-8 -*- from django.contrib import admin from powerdns.models import Domain, Record, Supermaster class RecordAdmin(admin.ModelAdmin): list_display = ('name', 'type', 'content', 'ttl', 'prio', 'change_date',) list_filter = ['type', 'ttl',] search_fields = ('name','content',) readonly_fi...
Mark some fields as readonly in the Admin panel as they are set by the server (Requires Django 1.2 or greater)
Mark some fields as readonly in the Admin panel as they are set by the server (Requires Django 1.2 or greater)
Python
bsd-2-clause
dominikkowalski/django-powerdns-dnssec,zefciu/django-powerdns-dnssec,zefciu/django-powerdns-dnssec,dominikkowalski/django-powerdns-dnssec,dominikkowalski/django-powerdns-dnssec,allegro/django-powerdns-dnssec,allegro/django-powerdns-dnssec,dominikkowalski/django-powerdns-dnssec,allegro/django-powerdns-dnssec,allegro/dja...
<REPLACE_OLD> ('name','content',) class <REPLACE_NEW> ('name','content',) readonly_fields = ('change_date',) class <REPLACE_END> <REPLACE_OLD> ('name',) class <REPLACE_NEW> ('name',) readonly_fields = ('notified_serial',) class <REPLACE_END> <|endoftext|> # -*- coding: utf-8 -*- from django.contrib import a...
Mark some fields as readonly in the Admin panel as they are set by the server (Requires Django 1.2 or greater) # -*- coding: utf-8 -*- from django.contrib import admin from powerdns.models import Domain, Record, Supermaster class RecordAdmin(admin.ModelAdmin): list_display = ('name', 'type', 'content', 'ttl', 'pr...
b8796c355bc8a763dbd2a5b6c5ed88a61f91eab7
tests/test_conditionals.py
tests/test_conditionals.py
import pytest from thinglang.runner import run def test_simple_conditionals(): assert run(""" thing Program does start if "dog" eq "dog" Output.write("dog is dog") if "dog" eq "cat" Output.write("dog is cat") """).output == """dog is dog""".strip() def test_unc...
import pytest from thinglang.runner import run def test_simple_conditionals(): assert run(""" thing Program does start if "dog" eq "dog" Output.write("dog is dog") if "dog" eq "cat" Output.write("dog is cat") """).output == """dog is dog""".strip() def test_unc...
Update conditional else branch tests
Update conditional else branch tests
Python
mit
ytanay/thinglang,ytanay/thinglang,ytanay/thinglang,ytanay/thinglang
<INSERT> otherwise if "dog" eq "dog" Output.write("dog is still dog") <INSERT_END> <INSERT> cat") if "dog" eq "cat" Output.write("dog is <INSERT_END> <INSERT> otherwise if "dog" eq "Dog" Output.write("dog is Dog") otherwise if "dog" eq "mouse" ...
Update conditional else branch tests import pytest from thinglang.runner import run def test_simple_conditionals(): assert run(""" thing Program does start if "dog" eq "dog" Output.write("dog is dog") if "dog" eq "cat" Output.write("dog is cat") """).output == "...