commit stringlengths 40 40 | old_file stringlengths 4 236 | new_file stringlengths 4 236 | old_contents stringlengths 1 3.26k | new_contents stringlengths 16 4.43k | subject stringlengths 16 624 | message stringlengths 17 3.29k | lang stringclasses 5
values | license stringclasses 13
values | repos stringlengths 5 91.5k |
|---|---|---|---|---|---|---|---|---|---|
56396f980236f6d909f63d7faaddd357f5fe235b | stock_quant_merge/models/stock.py | stock_quant_merge/models/stock.py | # -*- encoding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
from openerp import models, api
class StockQuant(model... | # -*- encoding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
from openerp import models, api
class StockQuant(model... | Use browse record instead of ids | [MOD] Use browse record instead of ids
| Python | agpl-3.0 | InakiZabala/odoomrp-wip,Eficent/odoomrp-wip,diagramsoftware/odoomrp-wip,jobiols/odoomrp-wip,Antiun/odoomrp-wip,factorlibre/odoomrp-wip,raycarnes/odoomrp-wip,Daniel-CA/odoomrp-wip-public,esthermm/odoomrp-wip,odoomrp/odoomrp-wip,Daniel-CA/odoomrp-wip-public,odoomrp/odoomrp-wip,oihane/odoomrp-wip,jobiols/odoomrp-wip,odooc... |
1eb9d6cbed7c8f2c9a216e8618dadee571a2cdf2 | pyconcz_2016/speakers/views.py | pyconcz_2016/speakers/views.py | from django.template import RequestContext
from django.template.response import TemplateResponse
from pyconcz_2016.speakers.models import Speaker, Slot
def speakers_list(request, type):
speakers = (Speaker.objects.all()
.exclude(**{type: None})
.prefetch_related(type)
... | from django.template import RequestContext
from django.template.response import TemplateResponse
from pyconcz_2016.speakers.models import Speaker, Slot
def speakers_list(request, type):
speakers = (Speaker.objects.all()
.exclude(**{type: None})
.prefetch_related(type)
... | Fix template name in view | Fix template name in view
| Python | mit | pyvec/cz.pycon.org-2017,benabraham/cz.pycon.org-2017,benabraham/cz.pycon.org-2017,pyvec/cz.pycon.org-2017,pyvec/cz.pycon.org-2016,pyvec/cz.pycon.org-2016,pyvec/cz.pycon.org-2017,benabraham/cz.pycon.org-2017,pyvec/cz.pycon.org-2016 |
4190937c741f56bb4bb8b81621a711bba03fe705 | imhotep/shas.py | imhotep/shas.py | from collections import namedtuple
Remote = namedtuple('Remote', ('name', 'url'))
CommitInfo = namedtuple("CommitInfo", ('commit', 'origin', 'remote_repo'))
class PRInfo(object):
def __init__(self, json):
self.json = json
@property
def base_sha(self):
return self.json['base']['sha']
... | from collections import namedtuple
Remote = namedtuple('Remote', ('name', 'url'))
CommitInfo = namedtuple("CommitInfo", ('commit', 'origin', 'remote_repo'))
class PRInfo(object):
def __init__(self, json):
self.json = json
@property
def base_sha(self):
return self.json['base']['sha']
... | Refactor remote_repo, to return None if there is no remote. | Refactor remote_repo, to return None
if there is no remote.
| Python | mit | richtier/imhotep,justinabrahms/imhotep,justinabrahms/imhotep,Appdynamics/imhotep |
22e0e894bdfb457f00bad1016ae28884ef94256c | okupy/otp/__init__.py | okupy/otp/__init__.py | # vim:fileencoding=utf8:et:ts=4:sts=4:sw=4:ft=python
from django_otp import login as otp_login
from django_otp.middleware import OTPMiddleware
from .sotp.models import SOTPDevice
from .totp.models import TOTPDevice
def init_otp(request):
"""
Initialize OTP after login. This sets up OTP devices
for django... | # vim:fileencoding=utf8:et:ts=4:sts=4:sw=4:ft=python
from django.db import IntegrityError
from django_otp import login as otp_login
from django_otp.middleware import OTPMiddleware
from .sotp.models import SOTPDevice
from .totp.models import TOTPDevice
def init_otp(request):
"""
Initialize OTP after login. Th... | Make otp_init() race condition safe. | Make otp_init() race condition safe.
A race condition in get_or_create() may have resulted in two devices
created per user. Now we guarantee only one. Not that it matters real
much...
| Python | agpl-3.0 | gentoo/identity.gentoo.org,gentoo/identity.gentoo.org,dastergon/identity.gentoo.org,dastergon/identity.gentoo.org |
3bfc40c0e0c81723ae43b3dfd4932ba48c3b67e7 | yak/rest_social_auth/backends/yak_instagram.py | yak/rest_social_auth/backends/yak_instagram.py | from instagram import InstagramAPI
from social.backends.instagram import InstagramOAuth2
from yak.rest_social_auth.backends.base import ExtraDataAbstractMixin, ExtraActionsAbstractMixin
class Instagram(ExtraActionsAbstractMixin, ExtraDataAbstractMixin, InstagramOAuth2):
@staticmethod
def save_extra_data(respo... | from instagram import InstagramAPI, helper
from social.backends.instagram import InstagramOAuth2
from yak.rest_social_auth.backends.base import ExtraDataAbstractMixin, ExtraActionsAbstractMixin
class Instagram(ExtraActionsAbstractMixin, ExtraDataAbstractMixin, InstagramOAuth2):
@staticmethod
def save_extra_da... | Fix for undocumented timestamp filtering in python-instagram | Fix for undocumented timestamp filtering in python-instagram
| Python | mit | yeti/YAK-server,sventech/YAK-server,ParableSciences/YAK-server,sventech/YAK-server,ParableSciences/YAK-server,yeti/YAK-server |
b1edcbe02e2e1b2c54fd96c994e2c83e27e9b7b9 | test/client/local_recognizer_test.py | test/client/local_recognizer_test.py | import unittest
import os
from speech_recognition import WavFile
from mycroft.client.speech.listener import RecognizerLoop
__author__ = 'seanfitz'
DATA_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), "data")
class LocalRecognizerTest(unittest.TestCase):
def setUp(self):
self.recognizer ... | import unittest
import os
from speech_recognition import WavFile
from mycroft.client.speech.listener import RecognizerLoop
__author__ = 'seanfitz'
DATA_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), "data")
class LocalRecognizerTest(unittest.TestCase):
def setUp(self):
rl = RecognizerL... | Fix init of local recognizer | Fix init of local recognizer
| Python | apache-2.0 | MycroftAI/mycroft-core,aatchison/mycroft-core,linuxipho/mycroft-core,forslund/mycroft-core,Dark5ide/mycroft-core,linuxipho/mycroft-core,forslund/mycroft-core,MycroftAI/mycroft-core,Dark5ide/mycroft-core,aatchison/mycroft-core |
92b28dd2e6699423707604146de4a29656b8a8ba | runtests.py | runtests.py | #!/usr/bin/env python
import sys
import unittest
from os.path import dirname, abspath
import tests
def runtests(*test_args):
suite = unittest.TestLoader().loadTestsFromModule(tests)
result = unittest.TextTestRunner(verbosity=2).run(suite)
sys.exit(bool(result.failures))
if __name__ == '__main__':
ru... | #!/usr/bin/env python
import sys
import unittest
from os.path import dirname, abspath
import tests
def runtests(*test_args):
suite = unittest.TestLoader().loadTestsFromModule(tests)
result = unittest.TextTestRunner(verbosity=2).run(suite)
if result.failures:
sys.exit(1)
elif result.errors:
... | Return the proper exit codes in event of failure or error | Return the proper exit codes in event of failure or error
| Python | mit | zhang625272514/peewee,new-xiaji/peewee,jarrahwu/peewee,Dipsomaniac/peewee,new-xiaji/peewee,wenxer/peewee,bopo/peewee,Sunzhifeng/peewee,stas/peewee,mackjoner/peewee,new-xiaji/peewee,ronyb29/peewee,py4a/peewee,giserh/peewee,Dipsomaniac/peewee,wenxer/peewee,jnovinger/peewee,coreos/peewee,Dipsomaniac/peewee,d1hotpep/peewee... |
c08df80a02791978b6677d2e2fbd8ebb885f024d | cfp/admin.py | cfp/admin.py | from django.contrib import admin
from cfp.models import CallForPaper, PaperApplication, Applicant
from django.core import urlresolvers
class ApplicantAdmin(admin.ModelAdmin):
readonly_fields = ('user',)
list_display = ('full_name', 'about', 'biography', 'speaker_experience', 'github', 'twitter')
fields = ... | from django.contrib import admin
from cfp.models import CallForPaper, PaperApplication, Applicant
from django.core import urlresolvers
class ApplicantAdmin(admin.ModelAdmin):
list_display = ('user', 'full_name', 'about', 'biography', 'speaker_experience', 'github', 'twitter')
fields = ('user', 'about', 'biogr... | Remove user from readonly fields | Remove user from readonly fields
So that we can add Applicants from the admin interface.
| Python | bsd-3-clause | denibertovic/conference-web,denibertovic/conference-web,WebCampZg/conference-web,WebCampZg/conference-web,denibertovic/conference-web,denibertovic/conference-web,denibertovic/conference-web,WebCampZg/conference-web |
7079614f35de60def5f4e1cc1cb17cf3e5b4d9c6 | setup.py | setup.py | #!/usr/bin/env python
from distutils.core import setup
import os
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name='facebook-sdk',
version='0.3.2',
description='This client library is designed to support the Facebook '
'Graph API and the o... | #!/usr/bin/env python
from distutils.core import setup
setup(
name='facebook-sdk',
version='0.3.2',
description='This client library is designed to support the Facebook '
'Graph API and the official Facebook JavaScript SDK, which '
'is the canonical way to implement Facebook... | Change way README is imported. | Change way README is imported.
The custom read function is unnecessary since only one file is being
accessed. Removing it reduces the amount of code.
| Python | apache-2.0 | Aloomaio/facebook-sdk,mobolic/facebook-sdk |
2bf24460f0ffc1b1c99c110bd552e1c0e59d6d87 | byceps/services/shop/order/ordered_articles_service.py | byceps/services/shop/order/ordered_articles_service.py | """
byceps.services.shop.order.ordered_articles_service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2018 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from collections import Counter
from typing import Dict, Sequence
from ....database import db
from ..article.mod... | """
byceps.services.shop.order.ordered_articles_service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2018 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from collections import Counter
from typing import Dict, Sequence
from ....database import db
from ..article.mod... | Return `OrderItemTuple`s rather than order item database entities from service | Return `OrderItemTuple`s rather than order item database entities from service
| Python | bsd-3-clause | homeworkprod/byceps,homeworkprod/byceps,m-ober/byceps,m-ober/byceps,homeworkprod/byceps,m-ober/byceps |
67e62a9ee88ff432f641e5c6ea9bc2244264f7ad | seahub/api2/authentication.py | seahub/api2/authentication.py | from rest_framework.authentication import BaseAuthentication
from models import Token
from seahub.base.accounts import User
class TokenAuthentication(BaseAuthentication):
"""
Simple token based authentication.
Clients should authenticate by passing the token key in the "Authorization"
HTTP header, pr... | from rest_framework.authentication import BaseAuthentication
from models import Token
from seahub.base.accounts import User
class TokenAuthentication(BaseAuthentication):
"""
Simple token based authentication.
Clients should authenticate by passing the token key in the "Authorization"
HTTP header, pr... | Fix for if token is valid format, but user with that token does not exist | Fix for if token is valid format, but user with that token does not exist
| Python | apache-2.0 | Chilledheart/seahub,madflow/seahub,madflow/seahub,madflow/seahub,madflow/seahub,madflow/seahub,Chilledheart/seahub,miurahr/seahub,cloudcopy/seahub,Chilledheart/seahub,miurahr/seahub,cloudcopy/seahub,Chilledheart/seahub,cloudcopy/seahub,miurahr/seahub,cloudcopy/seahub,Chilledheart/seahub,miurahr/seahub |
f1c482f659311b5471dfde17a7b61251f33bf1e4 | examples/demoproject/demoapp/views.py | examples/demoproject/demoapp/views.py | # Create your views here.
from tasks import add
from django.http import HttpResponse
def foo(request):
r = add.delay(2, 2)
return HttpResponse(r.task_id)
| # Create your views here.
from demoapp import tasks
from django.http import HttpResponse
def foo(request):
r = tasks.add.delay(2, 2)
return HttpResponse(r.task_id)
| Use from demoapp import tasks instead | Use from demoapp import tasks instead
| Python | bsd-3-clause | digimarc/django-celery,nadios/django-celery,nadios/django-celery,tkanemoto/django-celery,celery/django-celery,Amanit/django-celery,CloudNcodeInc/django-celery,georgewhewell/django-celery,kanemra/django-celery,ask/django-celery,planorama/django-celery,axiom-data-science/django-celery,alexhayes/django-celery,georgewhewel... |
589ae271909b3b5e8a5d153b143725f7d4a10491 | tools/documentation_crawler/documentation_crawler/spiders/check_help_documentation.py | tools/documentation_crawler/documentation_crawler/spiders/check_help_documentation.py | #!/usr/bin/env python
from __future__ import print_function
from .common.spiders import BaseDocumentationSpider
class HelpDocumentationSpider(BaseDocumentationSpider):
name = "help_documentation_crawler"
start_urls = ['http://localhost:9981/help']
deny_domains = [] # type: List[str]
def _is_external... | #!/usr/bin/env python
from __future__ import print_function
from .common.spiders import BaseDocumentationSpider
class HelpDocumentationSpider(BaseDocumentationSpider):
name = "help_documentation_crawler"
start_urls = ['http://localhost:9981/help']
deny_domains = [] # type: List[str]
deny = ['/privacy... | Exclude privacy page from documentation checking | documentation-crawler: Exclude privacy page from documentation checking
| Python | apache-2.0 | isht3/zulip,vaidap/zulip,sonali0901/zulip,rht/zulip,shubhamdhama/zulip,amyliu345/zulip,Galexrt/zulip,souravbadami/zulip,jainayush975/zulip,shubhamdhama/zulip,christi3k/zulip,jrowan/zulip,samatdav/zulip,PhilSk/zulip,cosmicAsymmetry/zulip,vabs22/zulip,KingxBanana/zulip,niftynei/zulip,Diptanshu8/zulip,isht3/zulip,dawran6/... |
aa1c2880dc85228d9a8d534858c1cfe70428cbde | src/ggrc/migrations/versions/20160510122526_44ebc240800b_remove_response_relationships.py | src/ggrc/migrations/versions/20160510122526_44ebc240800b_remove_response_relationships.py | # Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: goodson@google.com
# Maintained By: goodson@google.com
"""
Remove relationships related to deleted response objects
Create Date: 2016-05-10 12:25:... | # Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: goodson@google.com
# Maintained By: goodson@google.com
"""
Remove relationships related to deleted response objects
Create Date: 2016-05-10 12:25:... | Remove responses references in object_documents | Remove responses references in object_documents
| Python | apache-2.0 | selahssea/ggrc-core,andrei-karalionak/ggrc-core,kr41/ggrc-core,AleksNeStu/ggrc-core,josthkko/ggrc-core,edofic/ggrc-core,plamut/ggrc-core,josthkko/ggrc-core,andrei-karalionak/ggrc-core,j0gurt/ggrc-core,plamut/ggrc-core,plamut/ggrc-core,AleksNeStu/ggrc-core,edofic/ggrc-core,AleksNeStu/ggrc-core,josthkko/ggrc-core,andrei-... |
4ce3502e1623ca24e43e01e4c580ee327e6192fa | django_extensions/management/commands/generate_secret_key.py | django_extensions/management/commands/generate_secret_key.py | # -*- coding: utf-8 -*-
from random import choice
from django.core.management.base import BaseCommand
from django_extensions.management.utils import signalcommand
class Command(BaseCommand):
help = "Generates a new SECRET_KEY that can be used in a project settings file."
requires_system_checks = False
... | # -*- coding: utf-8 -*-
from random import choice
from django.core.management.base import BaseCommand
from django.core.management.utils import get_random_secret_key
from django_extensions.management.utils import signalcommand
class Command(BaseCommand):
help = "Generates a new SECRET_KEY that can be used in a p... | Use same algo to generate SECRET_KEY as Django | Use same algo to generate SECRET_KEY as Django
Using random from standard library is not cryptographically secure. | Python | mit | haakenlid/django-extensions,haakenlid/django-extensions,django-extensions/django-extensions,linuxmaniac/django-extensions,linuxmaniac/django-extensions,django-extensions/django-extensions,haakenlid/django-extensions,django-extensions/django-extensions,linuxmaniac/django-extensions |
1475a740f122f915127ed283ec25f0d48e2cc211 | tests/integration/templatetags/test_currency_filters.py | tests/integration/templatetags/test_currency_filters.py | # -*- coding: utf-8 -*-
from decimal import Decimal as D
from django.utils import translation
from django.test import TestCase
from django import template
def render(template_string, ctx):
tpl = template.Template(template_string)
return tpl.render(template.Context(ctx))
class TestCurrencyFilter(TestCase):
... | # -*- coding: utf-8 -*-
from decimal import Decimal as D
from django.utils import translation
from django.test import TestCase
from django import template
def render(template_string, ctx):
tpl = template.Template(template_string)
return tpl.render(template.Context(ctx))
class TestCurrencyFilter(TestCase):
... | Use translation.override as a context manager instead of a decorator. | Use translation.override as a context manager instead of a decorator.
| Python | bsd-3-clause | kapari/django-oscar,MatthewWilkes/django-oscar,WillisXChen/django-oscar,taedori81/django-oscar,solarissmoke/django-oscar,WillisXChen/django-oscar,WadeYuChen/django-oscar,MatthewWilkes/django-oscar,taedori81/django-oscar,django-oscar/django-oscar,anentropic/django-oscar,okfish/django-oscar,jlmadurga/django-oscar,saadatq... |
afb541d39ae13526372c7480dcf775ce0480086c | oslo/__init__.py | oslo/__init__.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | Remove extraneous vim editor configuration comments | Remove extraneous vim editor configuration comments
Change-Id: I2fb6d6174cf8b73ee663efa6718f4358be673869
Partial-Bug: #1229324
| Python | apache-2.0 | JioCloud/oslo.middleware,openstack/oslo.middleware,varunarya10/oslo.middleware |
9fba9934c9b47881ee468f295a3710f2c184fab1 | tendrl/node_agent/__init__.py | tendrl/node_agent/__init__.py | try:
from gevent import monkey
except ImportError:
pass
else:
monkey.patch_all()
from tendrl.commons import CommonNS
from tendrl.node_agent.objects.definition import Definition
from tendrl.node_agent.objects.config import Config
from tendrl.node_agent.objects.node_context import NodeContext
from tendrl.no... | try:
from gevent import monkey
except ImportError:
pass
else:
monkey.patch_all()
from tendrl.commons import CommonNS
from tendrl.node_agent.objects.definition import Definition
from tendrl.node_agent.objects.config import Config
from tendrl.node_agent.objects.node_context import NodeContext
from tendrl.no... | Fix greenlet and essential objects startup order | Fix greenlet and essential objects startup order
| Python | lgpl-2.1 | Tendrl/node_agent,Tendrl/node-agent,r0h4n/node-agent,Tendrl/node_agent,Tendrl/node-agent,Tendrl/node-agent,r0h4n/node-agent,r0h4n/node-agent |
5fc2c62ff47d7483701d5677357f06e7d9169f60 | gennotes_server/serializers.py | gennotes_server/serializers.py | from rest_framework import serializers
from .models import Relation, Variant
class VariantSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Variant
fields = ["tags"]
class RelationSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Relation
... | from rest_framework import serializers
from .models import Relation, Variant
class VariantSerializer(serializers.HyperlinkedModelSerializer):
"""
Serialize a Variant object.
"""
b37_id = serializers.SerializerMethodField()
class Meta:
model = Variant
fields = ['b37_id', 'tags']
... | Return the variant ID in the API | Return the variant ID in the API
| Python | mit | usajusaj/gennotes,PersonalGenomesOrg/gennotes,PersonalGenomesOrg/gennotes,PersonalGenomesOrg/gennotes,usajusaj/gennotes,usajusaj/gennotes |
9f8b0fe642e7900ac1c966ad365a5fe99456d23e | setup.py | setup.py | from distutils.core import setup
from jsonref import __version__
with open("README.rst") as readme:
long_description = readme.read()
classifiers = [
"Development Status :: 1 - Planning",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Indepen... | from distutils.core import setup
from jsonref import __version__
with open("README.rst") as readme:
long_description = readme.read()
classifiers = [
"Development Status :: 1 - Planning",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Indepen... | Include Python 3.4 and 3.5 | Include Python 3.4 and 3.5 | Python | mit | gazpachoking/jsonref |
e5310f1147694992d1eb48a037261f805955294c | tests/unit/forms/widget_tests.py | tests/unit/forms/widget_tests.py | import nose
from oscar.forms import widgets
def test_datetime_to_date_format_conversion():
format_testcases = (
('%Y-%m-%d', 'yy-mm-dd'),
('%Y-%m-%d %H:%M', 'yy-mm-dd'),
)
def compare(format, expected):
nose.tools.eq_(
widgets.datetime_format_to_js_date_format(format)... | import nose
from oscar.forms import widgets
def compare_date_format(format, expected):
nose.tools.eq_(
widgets.datetime_format_to_js_date_format(format), expected)
def test_datetime_to_date_format_conversion():
format_testcases = (
('%Y-%m-%d', 'yy-mm-dd'),
('%Y-%m-%d %H:%M', 'yy-mm... | Adjust test generator to make tests pass | Adjust test generator to make tests pass
| Python | bsd-3-clause | amirrpp/django-oscar,Jannes123/django-oscar,jmt4/django-oscar,marcoantoniooliveira/labweb,taedori81/django-oscar,kapt/django-oscar,josesanch/django-oscar,ademuk/django-oscar,pasqualguerrero/django-oscar,dongguangming/django-oscar,amirrpp/django-oscar,pdonadeo/django-oscar,nickpack/django-oscar,bnprk/django-oscar,jlmadu... |
3c94cd8e6f7429f3a512a49a86eaa089a8f472c7 | other/wrapping-cpp/swig/c++/multiplefiles/test_shapes.py | other/wrapping-cpp/swig/c++/multiplefiles/test_shapes.py | import os
import pytest
@pytest.fixture
def setup(request):
def teardown():
print("Running make clean")
os.system('make clean')
print("Completed finaliser")
request.addfinalizer(teardown)
os.system('make clean')
os.system('make all')
def test_square(setup):
import shape... | import os
import pytest
# Need to call Makefile in directory where this test file is
def call_make(target):
# where is this file
this_file = os.path.realpath(__file__)
this_dir = os.path.split(this_file)[0]
cd_command = "cd {}".format(this_dir)
make_command = "make {}".format(target)
command =... | Allow to be called from other directories. | Allow to be called from other directories.
| Python | bsd-2-clause | ryanpepper/oommf-python,ryanpepper/oommf-python,fangohr/oommf-python,ryanpepper/oommf-python,fangohr/oommf-python,fangohr/oommf-python,ryanpepper/oommf-python |
b8bd5fc044d3dd3b273cba4443c771e60036b6c0 | corehq/apps/importer/base.py | corehq/apps/importer/base.py | from corehq.apps.data_interfaces.interfaces import DataInterface
from django.utils.translation import ugettext as _
class ImportCases(DataInterface):
name = _("Import Cases from Excel")
slug = "import_cases"
description = _("Import case data from an external Excel file")
report_template_path = "importe... | from corehq.apps.data_interfaces.interfaces import DataInterface
from django.utils.translation import ugettext_lazy
class ImportCases(DataInterface):
name = ugettext_lazy("Import Cases from Excel")
slug = "import_cases"
description = ugettext_lazy("Import case data from an external Excel file")
report_... | Use lazy translation for importer strings | Use lazy translation for importer strings
| Python | bsd-3-clause | SEL-Columbia/commcare-hq,dimagi/commcare-hq,SEL-Columbia/commcare-hq,gmimano/commcaretest,dimagi/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,SEL-Columbia/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,gmimano/commcaretest,qedsoftware/commcare-hq,puttarajubr/... |
d4e7571b1d361a9d24650a74fffbc1980c2bbc70 | blaze/compute/air/frontend/ckernel_impls.py | blaze/compute/air/frontend/ckernel_impls.py | """
Lift ckernels to their appropriate rank so they always consume the full array
arguments.
"""
from __future__ import absolute_import, division, print_function
import datashape
from pykit.ir import transform, Op
#------------------------------------------------------------------------
# Run
#----------------------... | """
Lift ckernels to their appropriate rank so they always consume the full array
arguments.
"""
from __future__ import absolute_import, division, print_function
import datashape
from pykit.ir import transform, Op
#------------------------------------------------------------------------
# Run
#----------------------... | Remove redundant 'ckernel' overload match | Remove redundant 'ckernel' overload match
| Python | bsd-3-clause | jdmcbr/blaze,alexmojaki/blaze,FrancescAlted/blaze,aterrel/blaze,xlhtc007/blaze,mwiebe/blaze,cowlicks/blaze,ChinaQuants/blaze,mwiebe/blaze,mwiebe/blaze,LiaoPan/blaze,xlhtc007/blaze,dwillmer/blaze,FrancescAlted/blaze,scls19fr/blaze,cpcloud/blaze,scls19fr/blaze,caseyclements/blaze,mrocklin/blaze,FrancescAlted/blaze,Contin... |
ca2d37ad158dc996a15f5a2724d57ed0f6f298dd | Python/Templates/Django/ProjectTemplates/Python/Web/WebRoleDjango/urls.py | Python/Templates/Django/ProjectTemplates/Python/Web/WebRoleDjango/urls.py | """
Definition of urls for $safeprojectname$.
"""
from django.conf.urls import include, url
import $safeprojectname$.views
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = [
# Examples:
# url(r'^$', $safeprojectname$.views.home, name... | """
Definition of urls for $safeprojectname$.
"""
from django.conf.urls import include, url
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = [
# Examples:
# url(r'^$', $safeprojectname$.views.home, name='home'),
# url(r'^$safeproj... | Remove import of non-existing file. | Remove import of non-existing file.
| Python | apache-2.0 | huguesv/PTVS,huguesv/PTVS,DEVSENSE/PTVS,huguesv/PTVS,int19h/PTVS,int19h/PTVS,zooba/PTVS,Microsoft/PTVS,int19h/PTVS,Microsoft/PTVS,huguesv/PTVS,DEVSENSE/PTVS,Microsoft/PTVS,huguesv/PTVS,Microsoft/PTVS,int19h/PTVS,zooba/PTVS,Microsoft/PTVS,DEVSENSE/PTVS,DEVSENSE/PTVS,int19h/PTVS,Microsoft/PTVS,zooba/PTVS,huguesv/PTVS,zoo... |
71c47c8374cf6c5f53cdfbb71763f165bcd6c013 | oneflow/base/tests/__init__.py | oneflow/base/tests/__init__.py | # -*- coding: utf-8 -*-
import redis
from mongoengine.connection import connect, disconnect
from django.conf import settings
TEST_REDIS = redis.StrictRedis(host=settings.REDIS_TEST_HOST,
port=settings.REDIS_TEST_PORT,
db=settings.REDIS_TEST_DB)
def con... | # -*- coding: utf-8 -*-
import redis
from mongoengine.connection import connect, disconnect
from django.conf import settings
TEST_REDIS = redis.StrictRedis(host=settings.REDIS_TEST_HOST,
port=settings.REDIS_TEST_PORT,
db=settings.REDIS_TEST_DB)
def con... | Make the test MongoDB database TZ aware like the production one, else some date comparisons fail, whereas they succeed in production. | Make the test MongoDB database TZ aware like the production one, else some date comparisons fail, whereas they succeed in production.
| Python | agpl-3.0 | 1flow/1flow,WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow,WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow,1flow/1flow |
6c7f0006fd6324c544eda48fb9d7dd1316d39e7a | samples/forms.py | samples/forms.py | import datetime #for checking renewal date range.
from django import forms
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from .models import (Patient, AdmissionNote, FluVaccine,
CollectionType, CollectedSample,
Symptom, ObservedSymptom,
)
class Ad... | import datetime #for checking renewal date range.
from django import forms
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from .models import (Patient, AdmissionNote, FluVaccine,
CollectionType, CollectedSample,
Symptom, ObservedSymptom,
)
class Ad... | Change Vaccine was_applied widget to RadioSelect | :rocket: Change Vaccine was_applied widget to RadioSelect
| Python | mit | gems-uff/labsys,gcrsaldanha/fiocruz,gcrsaldanha/fiocruz,gems-uff/labsys,gems-uff/labsys |
4eeab8ad7c1d4cdbda68222f94b23a62337570c6 | pywikibot/families/commons_family.py | pywikibot/families/commons_family.py | # -*- coding: utf-8 -*-
__version__ = '$Id$'
from pywikibot import family
# The Wikimedia Commons family
class Family(family.WikimediaFamily):
def __init__(self):
super(Family, self).__init__()
self.name = 'commons'
self.langs = {
'commons': 'commons.wikimedia.org',
... | # -*- coding: utf-8 -*-
__version__ = '$Id$'
from pywikibot import family
# The Wikimedia Commons family
class Family(family.WikimediaFamily):
def __init__(self):
super(Family, self).__init__()
self.name = 'commons'
self.langs = {
'commons': 'commons.wikimedia.org',
... | Add Wikidata as shared data repository for Commons. | Add Wikidata as shared data repository for Commons.
Change-Id: Ie79e3157d016fc74e400ddc618c04f2d1d39f17d
| Python | mit | TridevGuha/pywikibot-core,darthbhyrava/pywikibot-local,xZise/pywikibot-core,wikimedia/pywikibot-core,hasteur/g13bot_tools_new,Darkdadaah/pywikibot-core,hasteur/g13bot_tools_new,happy5214/pywikibot-core,magul/pywikibot-core,wikimedia/pywikibot-core,PersianWikipedia/pywikibot-core,npdoty/pywikibot,trishnaguha/pywikibot-c... |
3ec5c0a742054177be525182f42b69d48f837aff | rache/utils.py | rache/utils.py | import os
try:
from urllib import parse
except ImportError:
import urlparse as parse
def parse_redis_url():
config = {
'host': 'localhost',
'port': 6379,
'password': None,
'db': 0,
}
parsed_redis = parse.urlparse(
os.environ.get('REDIS_URL', 'redis://localh... | import os
try:
from urllib import parse
except ImportError:
import urlparse as parse
def parse_redis_url():
config = {
'host': 'localhost',
'port': 6379,
'password': None,
'db': 0,
}
parsed_redis = parse.urlparse(
os.environ.get('REDIS_URL', 'redis://localh... | Support unix sockets in the Redis URL parser. | Support unix sockets in the Redis URL parser.
| Python | bsd-3-clause | brutasse/rache |
7a97694d14e9ed02ae38ab713267d4c722079c9c | kolibri/core/webpack/test/test_webpack_tags.py | kolibri/core/webpack/test/test_webpack_tags.py | from __future__ import absolute_import, print_function, unicode_literals
from django.test import TestCase
from ..hooks import WebpackBundleHook
class TestHook(WebpackBundleHook):
unique_slug = "non_default_frontend"
entry_file = "assets/src/kolibri_core_app.js"
class KolibriTagNavigationTestCase(TestCase)... | from __future__ import absolute_import, print_function, unicode_literals
import json
import tempfile
from django.test import TestCase
from ..hooks import WebpackBundleHook
TEST_STATS_FILE = None
class TestHook(WebpackBundleHook):
unique_slug = "non_default_frontend"
src_file = "assets/src/kolibri_core_a... | Create a faked hook that does not try to read a live stats file | Create a faked hook that does not try to read a live stats file
| Python | mit | jonboiser/kolibri,jtamiace/kolibri,66eli77/kolibri,66eli77/kolibri,mrpau/kolibri,rtibbles/kolibri,learningequality/kolibri,lyw07/kolibri,jtamiace/kolibri,jtamiace/kolibri,mrpau/kolibri,ralphiee22/kolibri,jayoshih/kolibri,learningequality/kolibri,DXCanas/kolibri,jonboiser/kolibri,benjaoming/kolibri,christianmemije/kolib... |
6e9fada3539abca49579340e20b06fc19554e2a6 | sc2reader/__init__.py | sc2reader/__init__.py | from __future__ import absolute_import
from sc2reader import factories, log_utils
# setup the library logging
log_utils.setup()
# For backwards compatibility
SC2Reader = factories.SC2Factory
# Expose a nice module level interface
__defaultSC2Reader = factories.SC2Factory()
register_datapack = __defaultSC2Reader.re... | from __future__ import absolute_import
# import submodules
from sc2reader import listeners, data, scripts, processors
from sc2reader import factories, log_utils
# setup the library logging
log_utils.setup()
# For backwards compatibility
SC2Reader = factories.SC2Factory
# Expose a nice module level interface
__defa... | Add explicit submodule imports to resolve certain runtime import issues. | Add explicit submodule imports to resolve certain runtime import issues.
| Python | mit | GraylinKim/sc2reader,vlaufer/sc2reader,ggtracker/sc2reader,GraylinKim/sc2reader,StoicLoofah/sc2reader,ggtracker/sc2reader,StoicLoofah/sc2reader,vlaufer/sc2reader |
ad2b0447afbee92684ab0b4f14dc0d45a28f3ba2 | tests/foomodulegen-auto.py | tests/foomodulegen-auto.py | #! /usr/bin/env python
import sys
import re
import pybindgen
from pybindgen.typehandlers import base as typehandlers
from pybindgen import (ReturnValue, Parameter, Module, Function, FileCodeSink)
from pybindgen import (CppMethod, CppConstructor, CppClass, Enum)
from pybindgen.gccxmlparser import ModuleParser
from pyb... | #! /usr/bin/env python
import sys
import re
import pybindgen
from pybindgen.typehandlers import base as typehandlers
from pybindgen import (ReturnValue, Parameter, Module, Function, FileCodeSink)
from pybindgen import (CppMethod, CppConstructor, CppClass, Enum)
from pybindgen.gccxmlparser import ModuleParser
from pyb... | Add a debug switch (-d) to enable debugger | Add a debug switch (-d) to enable debugger
| Python | lgpl-2.1 | cawka/pybindgen,caramucho/pybindgen,caramucho/pybindgen,cawka/pybindgen,cawka/pybindgen,caramucho/pybindgen,cawka/pybindgen,caramucho/pybindgen |
4e876b59745a67cf1fbcbaacf1ca1675c3e1946a | onetime/models.py | onetime/models.py | from django.db import models
from django.contrib.auth.models import User
class Key(models.Model):
user = models.ForeignKey(User)
key = models.CharField(max_length=40)
created = models.DateTimeField(auto_now_add=True)
usage_left = models.IntegerField(null=True, default=1)
expires = models.DateTimeFi... | from datetime import datetime
from django.db import models
from django.contrib.auth.models import User
class Key(models.Model):
user = models.ForeignKey(User)
key = models.CharField(max_length=40)
created = models.DateTimeField(auto_now_add=True)
usage_left = models.IntegerField(null=True, default=1)
... | Add validation and usage logics into the model | Add validation and usage logics into the model
| Python | agpl-3.0 | ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,uploadcare/django-loginurl,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,fajran/django-loginurl,vanschelven/cmsplugin-journal,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-web... |
a66d15d95e7ec62da12ccade0894e78e8dba6673 | cappa/factory.py | cappa/factory.py | from __future__ import print_function, absolute_import
from .pip import Pip
from .pip3 import Pip3
from .pip_pypy import PipPypy
from .apt import Apt
from .bower import Bower
from .npm import Npm
from .npmg import NpmG
from .tsd import Tsd
from .private.pip import PrivatePip
def manager_key_to_cappa(manager_key):
... | from __future__ import print_function, absolute_import
from .pip import Pip
from .pip3 import Pip3
from .pip_pypy import PipPypy
from .apt import Apt
from .bower import Bower
from .npm import Npm
from .npmg import NpmG
from .tsd import Tsd
from .private.pip import PrivatePip
MANAGER_MAP = {
'pip': Pip,
'pip... | Switch if-else block to dictionary lookup | Switch if-else block to dictionary lookup
| Python | mit | Captricity/cappa,Captricity/cappa |
599f093ba30afbf169f21559ca247eaba99dcebf | samples/custom/forms.py | samples/custom/forms.py | from django import forms
class YesNoIgnoredField(forms.NullBooleanField):
widget = forms.widgets.RadioSelect(
choices=(
(True, "Sim"), (False, "Não"), (None, "Ignorado"),
),
)
| from django import forms
class YesNoIgnoredField(forms.NullBooleanField):
widget = forms.widgets.RadioSelect(
attrs={'class': 'inline'},
choices=(
(True, "Sim"), (False, "Não"), (None, "Ignorado"),
),
)
| Add inline class to YesNoIgnored field | :memo: Add inline class to YesNoIgnored field
| Python | mit | gcrsaldanha/fiocruz,gems-uff/labsys,gcrsaldanha/fiocruz,gems-uff/labsys,gems-uff/labsys |
7d24695c7e94e787b5d66854db7cc6dc1abcbf10 | polyaxon/tracker/publish_tracker.py | polyaxon/tracker/publish_tracker.py | import analytics
from django.db import InterfaceError, OperationalError, ProgrammingError
from tracker.service import TrackerService
class PublishTrackerService(TrackerService):
def __init__(self, key=''):
self.cluster_id = None
self.analytics = analytics
self.analytics.write_key = key
... | import analytics
from django.db import InterfaceError, OperationalError, ProgrammingError
from tracker.service import TrackerService
class PublishTrackerService(TrackerService):
def __init__(self, key=''):
self.cluster_id = None
self.analytics = analytics
self.analytics.write_key = key
... | Update check on cluster id | Update check on cluster id
| Python | apache-2.0 | polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon |
7f04090c574b48b0e1de4590017c7f9960c515fb | nova/policies/ips.py | nova/policies/ips.py | # Copyright 2016 Cloudbase Solutions Srl
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | # Copyright 2016 Cloudbase Solutions Srl
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | Add policy description for Servers IPs | Add policy description for Servers IPs
This commit adds policy doc for Servers IPs policies.
Partial implement blueprint policy-docs
Change-Id: I94a7c023dd97413d30f5be9edc313caeb47cb633
| Python | apache-2.0 | vmturbo/nova,mikalstill/nova,gooddata/openstack-nova,openstack/nova,Juniper/nova,rahulunair/nova,vmturbo/nova,rajalokan/nova,Juniper/nova,gooddata/openstack-nova,vmturbo/nova,rahulunair/nova,vmturbo/nova,mahak/nova,rahulunair/nova,rajalokan/nova,rajalokan/nova,mikalstill/nova,klmitch/nova,klmitch/nova,gooddata/openstac... |
159006e87cbbb08689284ae2534f556f66c0159b | alabaster/__init__.py | alabaster/__init__.py | import os
from alabaster import _version as version
def get_path():
"""
Shortcut for users whose theme is next to their conf.py.
"""
# Theme directory is defined as our parent directory
return os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
def update_context(app, pagename, template... | import os
from alabaster import _version as version
def get_path():
"""
Shortcut for users whose theme is next to their conf.py.
"""
# Theme directory is defined as our parent directory
return os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
def update_context(app, pagename, template... | Declare extension version and parallel read safety | Declare extension version and parallel read safety
This is necessary for Sphinx' parallel read feature to work, since we import alabaster all the time now. | Python | bsd-3-clause | bgeron/alabaster,jupytercalpoly/jupyter-alabaster-theme,ellisonbg/jupyter-alabaster-theme,nikolas/alabaster,charnpreetsingh/jupyter-alabaster-theme,jupytercalpoly/jupyter-alabaster-theme,charnpreetsingh/jupyter-alabaster-theme,bgeron/alabaster,ellisonbg/jupyter-alabaster-theme,nikolas/alabaster,charnpreetsingh/jupyter-... |
dd70fcd512962c5248928a1c9b897fc33249f567 | judge/utils/views.py | judge/utils/views.py | from django.contrib.auth.decorators import login_required
from django.shortcuts import render_to_response
from django.template import RequestContext
__author__ = 'Quantum'
def generic_message(request, title, message):
return render_to_response('generic_message.jade', {
'message': message,
'title'... | from django.contrib.auth.decorators import login_required
from django.shortcuts import render
__author__ = 'Quantum'
def generic_message(request, title, message, status=None):
return render(request, 'generic_message.jade', {
'message': message,
'title': title
}, status=status)
class TitleMi... | Use the render shortcut which defaults to RequestContext and allows passing a status code | Use the render shortcut which defaults to RequestContext and allows passing a status code
| Python | agpl-3.0 | Minkov/site,monouno/site,monouno/site,Phoenix1369/site,DMOJ/site,monouno/site,DMOJ/site,Minkov/site,Phoenix1369/site,DMOJ/site,Minkov/site,Phoenix1369/site,monouno/site,monouno/site,DMOJ/site,Minkov/site,Phoenix1369/site |
b3790a607a9f48561ce7a3da9242927510974808 | packs/rackspace/actions/lib/action.py | packs/rackspace/actions/lib/action.py | from st2actions.runners.pythonrunner import Action
import pyrax
__all__ = [
'PyraxBaseAction'
]
class PyraxBaseAction(Action):
def __init__(self, config):
super(PyraxBaseAction, self).__init__(config)
self.pyrax = self._get_client()
def _get_client(self):
username = self.config['u... | import pyrax
from st2actions.runners.pythonrunner import Action
__all__ = [
'PyraxBaseAction'
]
class PyraxBaseAction(Action):
def __init__(self, config):
super(PyraxBaseAction, self).__init__(config)
self.pyrax = self._get_client()
def _get_client(self):
username = self.config[... | Make sure region name is uppercase. | Make sure region name is uppercase.
| Python | apache-2.0 | jtopjian/st2contrib,tonybaloney/st2contrib,pidah/st2contrib,armab/st2contrib,StackStorm/st2contrib,pinterb/st2contrib,meirwah/st2contrib,psychopenguin/st2contrib,dennybaa/st2contrib,pearsontechnology/st2contrib,lmEshoo/st2contrib,tonybaloney/st2contrib,meirwah/st2contrib,pearsontechnology/st2contrib,tonybaloney/st2cont... |
35c264819bac12fcb3baf8a2a33d63dd916f5f86 | mezzanine_fluent_pages/mezzanine_layout_page/widgets.py | mezzanine_fluent_pages/mezzanine_layout_page/widgets.py | from django.forms.widgets import Select
class LayoutSelector(Select):
"""
Modified `Select` class to select the original value.
This was adapted from `fluent_pages/pagetypes/fluent_pages/widgets
.py` in the `django-fluent-pages` app.
"""
def render(self, name, value, attrs=None, choices=()):
... | from django.forms.widgets import Select
class LayoutSelector(Select):
"""
Modified `Select` class to select the original value.
This was adapted from `fluent_pages/pagetypes/fluent_pages/widgets
.py` in the `django-fluent-pages` app.
"""
def render(self, name, value, attrs=None, *args, **kwar... | Remove keyword argument and allow generic argument passing. | Remove keyword argument and allow generic argument passing.
| Python | bsd-2-clause | sjdines/mezzanine-fluent-pages,sjdines/mezzanine-fluent-pages,sjdines/mezzanine-fluent-pages |
6072022e2debeb4dcd75e4969bd2beb16bac8827 | source/sqlserver_ado/fields.py | source/sqlserver_ado/fields.py | """This module provides SQL Server specific fields for Django models."""
from django.db.models import AutoField, ForeignKey, IntegerField
class BigAutoField(AutoField):
"""A bigint IDENTITY field"""
def get_internal_type(self):
return "BigAutoField"
def to_python(self, value):
if ... | """This module provides SQL Server specific fields for Django models."""
from django.db.models import AutoField, ForeignKey, IntegerField
from django.forms import ValidationError
class BigAutoField(AutoField):
"""A bigint IDENTITY field"""
def get_internal_type(self):
return "BigAutoField"
... | Fix import error for custom Field validation | Fix import error for custom Field validation
| Python | mit | theoriginalgri/django-mssql,theoriginalgri/django-mssql |
1a0fe91b6ab9a90573b0f35d6ff81e7f0523acb4 | praw/util/__init__.py | praw/util/__init__.py | """Package imports for utilities."""
__all__ = ("cache",)
| """Package imports for utilities."""
import re
__all__ = ("cache", "camel_to_snake", "snake_case_keys")
_re_camel_to_snake = re.compile(r"([a-z0-9](?=[A-Z])|[A-Z](?=[A-Z][a-z]))")
def camel_to_snake(name):
"""Convert `name` from camelCase to snake_case."""
return _re_camel_to_snake.sub(r"\1_", name).lower(... | Add `camel_to_snake()` and `snake_case_keys()` to praw.util | Add `camel_to_snake()` and `snake_case_keys()` to praw.util
| Python | bsd-2-clause | praw-dev/praw,gschizas/praw,leviroth/praw,praw-dev/praw,gschizas/praw,leviroth/praw |
53bbb9bfa6fdc1e946365e746b1acf4b03a0635e | regulations/templatetags/in_context.py | regulations/templatetags/in_context.py | from django import template
register = template.Library()
class InContextNode(template.Node):
def __init__(self, nodelist, subcontext_names):
self.nodelist = nodelist
self.subcontext_names = subcontext_names
def render(self, context):
new_context = {}
for field in self.subcon... | from django import template
register = template.Library()
class InContextNode(template.Node):
def __init__(self, nodelist, subcontext_names):
self.nodelist = nodelist
self.subcontext_names = subcontext_names
def render(self, context):
new_context = {}
for field in self.subcon... | Fix custom template tag to work with django 1.8 | Fix custom template tag to work with django 1.8
| Python | cc0-1.0 | willbarton/regulations-site,grapesmoker/regulations-site,willbarton/regulations-site,willbarton/regulations-site,grapesmoker/regulations-site,willbarton/regulations-site,ascott1/regulations-site,ascott1/regulations-site,grapesmoker/regulations-site,ascott1/regulations-site,grapesmoker/regulations-site,ascott1/regulatio... |
4f66208343c29226bdb549c2b1d6d15cd2ab985e | tests/twisted/presence/initial-presence.py | tests/twisted/presence/initial-presence.py | """
Tests setting your own presence before calling Connect(), allowing the user to
sign in as Busy/Invisible/whatever rather than available.
"""
from twisted.words.xish import domish
from gabbletest import exec_test
from servicetest import EventPattern, assertEquals, assertNotEquals
import ns
import constants as cs
f... | """
Tests setting your own presence before calling Connect(), allowing the user to
sign in as Busy/Invisible/whatever rather than available.
"""
from twisted.words.xish import domish
from gabbletest import exec_test
from servicetest import EventPattern, assertEquals, assertNotEquals
import ns
import constants as cs
f... | Add hybrid (XEP-0126 & XEP-0186) service to initial presence test. | Add hybrid (XEP-0126 & XEP-0186) service to initial presence test.
| Python | lgpl-2.1 | Ziemin/telepathy-gabble,jku/telepathy-gabble,mlundblad/telepathy-gabble,Ziemin/telepathy-gabble,mlundblad/telepathy-gabble,Ziemin/telepathy-gabble,Ziemin/telepathy-gabble,jku/telepathy-gabble,mlundblad/telepathy-gabble,jku/telepathy-gabble |
11853bead5a47d0b15877eb5e5968b91708bb223 | API/chat/models.py | API/chat/models.py | from django.db import models
class Channel(models.Model):
def __str__(self):
return self.name
name = models.CharField(max_length=20, unique=True)
class Message(models.Model):
def __str__(self):
return self.text
def to_dict(self):
return {
'text': self.text,
... | from django.db import models
class Channel(models.Model):
def __str__(self):
return self.name
name = models.CharField(max_length=20, unique=True)
class Message(models.Model):
def __str__(self):
return self.text
def to_dict(self):
serializable_fields = ('text', 'datetime_sta... | Refactor to_dict method on the Message model | Refactor to_dict method on the Message model
| Python | mit | odyvarv/ting-1,VitSalis/ting,odyvarv/ting-1,VitSalis/ting,mbalamat/ting,dionyziz/ting,gtklocker/ting,sirodoht/ting,mbalamat/ting,dionyziz/ting,VitSalis/ting,odyvarv/ting-1,mbalamat/ting,mbalamat/ting,VitSalis/ting,gtklocker/ting,odyvarv/ting-1,dionyziz/ting,sirodoht/ting,gtklocker/ting,gtklocker/ting,sirodoht/ting,siro... |
d38392998869319677cc884836c5952441f6ac62 | pokemongo_bot/base_task.py | pokemongo_bot/base_task.py | import logging
class BaseTask(object):
TASK_API_VERSION = 1
def __init__(self, bot, config):
"""
:param bot:
:type bot: pokemongo_bot.PokemonGoBot
:param config:
:return:
"""
self.bot = bot
self.config = config
self._validate_work_exists()
self.logger = logging.getLogger(... | import logging
import time
class BaseTask(object):
TASK_API_VERSION = 1
def __init__(self, bot, config):
"""
:param bot:
:type bot: pokemongo_bot.PokemonGoBot
:param config:
:return:
"""
self.bot = bot
self.config = config
self._validate_work_exists()
self.logger = loggi... | Support for log_delay for all tasks | Support for log_delay for all tasks
| Python | mit | lythien/pokemongo,heihachi/PokemonGo-Bot,pengzhangdev/PokemonGo-Bot,lythien/pokemongo,goedzo/PokemonGo-Bot,goedzo/PokemonGo-Bot,dtee/PokemonGo-Bot,DBa2016/PokemonGo-Bot,DBa2016/PokemonGo-Bot,DBa2016/PokemonGo-Bot,halsafar/PokemonGo-Bot,goshan/PokemonGo-Bot,Gobberwart/PokemonGo-Bot,cmezh/PokemonGo-Bot,Gobberwart/Pokemon... |
28da05d860147b5e0df37d998f437af6a5d4d178 | airflow/hooks/postgres_hook.py | airflow/hooks/postgres_hook.py | import psycopg2
from airflow.hooks.dbapi_hook import DbApiHook
class PostgresHook(DbApiHook):
'''
Interact with Postgres.
You can specify ssl parameters in the extra field of your connection
as ``{"sslmode": "require", "sslcert": "/path/to/cert.pem", etc}``.
'''
conn_name_attr = 'postgres_con... | import psycopg2
from airflow.hooks.dbapi_hook import DbApiHook
class PostgresHook(DbApiHook):
'''
Interact with Postgres.
You can specify ssl parameters in the extra field of your connection
as ``{"sslmode": "require", "sslcert": "/path/to/cert.pem", etc}``.
'''
conn_name_attr = 'postgres_con... | Set Postgres autocommit as supported only if server version is < 7.4 | Set Postgres autocommit as supported only if server version is < 7.4
The server-side autocommit setting was removed here http://www.postgresql.org/docs/7.4/static/release-7-4.html
Resolves: #690
| Python | apache-2.0 | vijaysbhat/incubator-airflow,dgies/incubator-airflow,owlabs/incubator-airflow,Acehaidrey/incubator-airflow,gtoonstra/airflow,hamedhsn/incubator-airflow,apache/airflow,N3da/incubator-airflow,mrkm4ntr/incubator-airflow,RealImpactAnalytics/airflow,r39132/airflow,janczak10/incubator-airflow,cfei18/incubator-airflow,CloverH... |
f5253c7f458a5ce4390b5e967f45bd2f0b9a1de2 | dosagelib/__init__.py | dosagelib/__init__.py | # -*- coding: utf-8 -*-
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012-2014 Bastian Kleineidam
# Copyright (C) 2015-2019 Tobias Gruetzmacher
"""
Automated comic downloader. Dosage traverses comic websites in
order to download each strip of the comic. The intended use is for
mirrori... | # -*- coding: utf-8 -*-
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012-2014 Bastian Kleineidam
# Copyright (C) 2015-2019 Tobias Gruetzmacher
"""
Automated comic downloader. Dosage traverses comic websites in
order to download each strip of the comic. The intended use is for
mirrori... | Return a fallback "version" if dosage is not installed | Return a fallback "version" if dosage is not installed
Additionally, inform the user on how to fix the problem. Thanks to twb
for noticing this.
| Python | mit | webcomics/dosage,peterjanes/dosage,peterjanes/dosage,webcomics/dosage |
12afe43b0f2599b0c79fab8bb0af454ccf16e57f | gittip/orm/__init__.py | gittip/orm/__init__.py | from __future__ import unicode_literals
import os
from sqlalchemy import create_engine, MetaData
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, scoped_session
class SQLAlchemy(object):
def __init__(self):
self.session = self.create_session()
@property... | from __future__ import unicode_literals
import os
import pdb
from sqlalchemy import create_engine, MetaData
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, scoped_session
class Model(object):
def __repr__(self):
cols = self.__mapper__.c.keys()
class... | Remove the convenience functions, reorganize around the SQLAlchemy class | Remove the convenience functions, reorganize around the SQLAlchemy class
| Python | cc0-1.0 | bountysource/www.gittip.com,eXcomm/gratipay.com,bountysource/www.gittip.com,studio666/gratipay.com,mccolgst/www.gittip.com,MikeFair/www.gittip.com,bountysource/www.gittip.com,gratipay/gratipay.com,studio666/gratipay.com,studio666/gratipay.com,gratipay/gratipay.com,MikeFair/www.gittip.com,mccolgst/www.gittip.com,mccolgs... |
4e35b16b8aed2ccb9dbc34a2bb56ce129450546b | mode/formatter/format_server.py | mode/formatter/format_server.py | import socket
from struct import pack, unpack
import sys
import autopep8
PORT = 10011
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_address = ('localhost', 10011)
sock.bind(server_address)
sock.listen(1)
print >>sys.stderr, 'Format server up on %s port %s' % server_address
while True:
connection... | import socket
from struct import pack, unpack
import sys
import autopep8
PORT = 10011
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_address = ('localhost', 10011)
sock.bind(server_address)
sock.listen(1)
print >>sys.stderr, 'Format server up on %s port %s' % server_address
while True:
connection... | Fix a bug in format server not fully reading 4-byte length. | Fix a bug in format server not fully reading 4-byte length.
| Python | apache-2.0 | tildebyte/processing.py,mashrin/processing.py,Luxapodular/processing.py,tildebyte/processing.py,Luxapodular/processing.py,tildebyte/processing.py,mashrin/processing.py,mashrin/processing.py,jdf/processing.py,jdf/processing.py,Luxapodular/processing.py,jdf/processing.py |
e81d5778ed5f81d5d479bf828de1a854c24af75e | tests/test_domains.py | tests/test_domains.py | import unittest
import subprocess
import random
class DomainsTest(unittest.TestCase):
def _cmd(self, cmd, *args):
pargs = ('scripts/cli53', cmd) + args
return subprocess.check_output(pargs, stderr=subprocess.STDOUT)
def _unique_name(self):
return 'temp%d.com' % random.randint(0... | import unittest
import subprocess
import random
# copied from python 2.7 for python 2.6
def check_output(*popenargs, **kwargs):
if 'stdout' in kwargs:
raise ValueError('stdout argument not allowed, it will be overridden.')
process = subprocess.Popen(stdout=subprocess.PIPE, *popenargs, **kwargs)
out... | Fix tests on python 2.6 | Fix tests on python 2.6
| Python | mit | branall1/cli53,ftahmed/cli53,branall1/cli53,Collaborne/cli53,branall1/cli53,ftahmed/cli53,jefflaplante/cli53,Collaborne/cli53,jefflaplante/cli53 |
bed4f189cd6bf9534ef152b780de0fca9e9c546a | tests/util.py | tests/util.py | from unittest import TestCase
from evesrp import create_app, db
class TestApp(TestCase):
def setUp(self):
self.app = create_app()
self.app.testing = True
self.app.config['SECRET_KEY'] = 'testing'
self.app.config['USER_AGENT_EMAIL'] = 'testing@example.com'
db.create_all(app... | from unittest import TestCase
from evesrp import create_app, db
class TestApp(TestCase):
def setUp(self):
self.app = create_app()
self.app.testing = True
self.app.config['SECRET_KEY'] = 'testing'
self.app.config['USER_AGENT_EMAIL'] = 'testing@example.com'
self.app.config['... | Disable all CSRF protection while testing | Disable all CSRF protection while testing | Python | bsd-2-clause | eskwire/evesrp,eskwire/evesrp,paxswill/evesrp,eskwire/evesrp,eskwire/evesrp,paxswill/evesrp,paxswill/evesrp |
fbd7da82e8231c025eaaf9dd60f94d104583c02c | crmapp/accounts/urls.py | crmapp/accounts/urls.py | from django.conf.urls import patterns, url
account_urls = patterns('',
url(r'^$',
'crmapp.accounts.views.account_detail', name='account_detail'
),
)
| from django.conf.urls import patterns, url
account_urls = patterns('',
url(r'^$',
'crmapp.accounts.views.account_detail', name='account_detail'
),
url(r'^edit/$',
'crmapp.accounts.views.account_cru', name='account_update'
),
)
| Create the Account Detail Page - Part II > Edit Account - Create URL Conf | Create the Account Detail Page - Part II > Edit Account - Create URL Conf
| Python | mit | tabdon/crmeasyapp,tabdon/crmeasyapp,deenaariff/Django |
af2c75a4a99f93e3cae1a1d2d0485a88cce833b7 | features/environment.py | features/environment.py | import os
import os.path as pt
from scripttest import TestFileEnvironment
def before_scenario(context, _):
root_dir = pt.abspath(pt.join(pt.dirname(__file__), '..'))
path = ":" + pt.join(root_dir, 'bin')
tmp = pt.join(root_dir, "tmp")
python_path = pt.join(root_dir, 'vendor', 'python', ... | import os
import os.path as pt
from scripttest import TestFileEnvironment
def before_scenario(context, _):
root_dir = pt.abspath(pt.join(pt.dirname(__file__), '..'))
path = ":" + pt.join(root_dir, 'bin')
tmp = pt.join(root_dir, "tmp", "feature")
python_path = pt.join(root_dir, 'vendor',... | Update location of feature tests are run in | Update location of feature tests are run in
| Python | mit | michaelbarton/command-line-interface,bioboxes/command-line-interface,bioboxes/command-line-interface,michaelbarton/command-line-interface |
931c6b2809de22b7c74206256ecfd1c5beaee149 | app/main/views/two_factor.py | app/main/views/two_factor.py | from flask import render_template, redirect, jsonify, session
from flask_login import login_user
from app.main import main
from app.main.dao import users_dao, verify_codes_dao
from app.main.forms import TwoFactorForm
@main.route("/two-factor", methods=['GET'])
def render_two_factor():
return render_template('vie... | import traceback
from flask import render_template, redirect, jsonify, session
from flask_login import login_user
from app.main import main
from app.main.dao import users_dao, verify_codes_dao
from app.main.forms import TwoFactorForm
@main.route("/two-factor", methods=['GET'])
def render_two_factor():
return re... | Add debugging to find issue. | Add debugging to find issue.
| Python | mit | alphagov/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin,gov-cjwaszczuk/notifications-admin,gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin |
d40fe9a9739ed7da4a47492124715bf6b720ae1d | rally-jobs/plugins/test_relative_import/zzz.py | rally-jobs/plugins/test_relative_import/zzz.py | # This module is used just for test that relative imports work well
def some_very_important_function():
return 42
| # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed u... | Add Apache 2.0 license to source file | Add Apache 2.0 license to source file
As per OpenStack licensing guide lines [1]:
[H102 H103] Newly contributed Source Code should be licensed under
the Apache 2.0 license.
[H104] Files with no code shouldn't contain any license header nor
comments, and must be left completely empty.
[1] http://docs.openstack.org/dev... | Python | apache-2.0 | openstack/rally,openstack/rally,openstack/rally,yeming233/rally,yeming233/rally,openstack/rally |
7dbbef88fedc07ee8cddf690b8c42785ee7241bd | astropy_helpers/sphinx/setup_package.py | astropy_helpers/sphinx/setup_package.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
def get_package_data():
# Install the theme files
return {
'astropy_helpers.sphinx': [
'ext/templates/*/*',
'themes/bootstrap-astropy/*.*',
'themes/bootstrap-astropy/static/*.*']}
| # Licensed under a 3-clause BSD style license - see LICENSE.rst
def get_package_data():
# Install the theme files
return {
'astropy_helpers.sphinx': [
'ext/templates/*/*',
'local/*.inv',
'themes/bootstrap-astropy/*.*',
'themes/bootstrap-astropy/static/*.*... | Make sure .inv file gets installed | Make sure .inv file gets installed | Python | bsd-3-clause | Cadair/astropy-helpers,bsipocz/astropy-helpers,embray/astropy_helpers,Cadair/astropy-helpers,embray/astropy_helpers,dpshelio/astropy-helpers,larrybradley/astropy-helpers,astropy/astropy-helpers,embray/astropy_helpers,astropy/astropy-helpers,bsipocz/astropy-helpers,larrybradley/astropy-helpers,embray/astropy_helpers,bsi... |
7d17358e514ad988b2619b8c364338a2058b400b | flocker/volume/script.py | flocker/volume/script.py | # Copyright Hybrid Logic Ltd. See LICENSE file for details.
"""The command-line ``flocker-volume`` tool."""
import sys
from twisted.python.usage import Options
from twisted.python.filepath import FilePath
from twisted.internet.task import react
from twisted.internet.defer import succeed
from .service import Volume... | # Copyright Hybrid Logic Ltd. See LICENSE file for details.
"""The command-line ``flocker-volume`` tool."""
import sys
from twisted.python.usage import Options
from twisted.python.filepath import FilePath
from twisted.internet.task import react
from twisted.internet.defer import succeed
from .service import Volume... | Address review comment: More useful help output. | Address review comment: More useful help output.
| Python | apache-2.0 | wallnerryan/flocker-profiles,mbrukman/flocker,adamtheturtle/flocker,jml/flocker,mbrukman/flocker,Azulinho/flocker,lukemarsden/flocker,adamtheturtle/flocker,w4ngyi/flocker,lukemarsden/flocker,runcom/flocker,agonzalezro/flocker,1d4Nf6/flocker,AndyHuu/flocker,w4ngyi/flocker,moypray/flocker,achanda/flocker,w4ngyi/flocker,h... |
58316a5823e2e136b2b5687d4aef323ad8a86cee | senlin/tests/functional/drivers/openstack/sdk.py | senlin/tests/functional/drivers/openstack/sdk.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed unde... | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed unde... | Add to_dict() method for faked resource | Add to_dict() method for faked resource
When testing node_get with details, we expect the profile to return a
resource that has a to_dict() method. The existing faked resource
doesn't support this yet. This patch fixes it.
Change-Id: I52e0dad74a1140f8233280ff10a9c14ff1760f72
| Python | apache-2.0 | stackforge/senlin,openstack/senlin,openstack/senlin,openstack/senlin,tengqm/senlin-container,stackforge/senlin,tengqm/senlin-container |
b2f94ebfb2c2549322b2ffb1da91cdba361461f1 | mezzanine/core/sitemaps.py | mezzanine/core/sitemaps.py |
from django.contrib.sitemaps import Sitemap
from django.db.models import get_models
from mezzanine.conf import settings
from mezzanine.core.models import Displayable
blog_installed = "mezzanine.blog" in settings.INSTALLED_APPS
if blog_installed:
from mezzanine.blog.models import BlogPost
class DisplayableSitem... |
from django.contrib.sitemaps import Sitemap
from django.db.models import get_models
from mezzanine.conf import settings
from mezzanine.core.models import Displayable
from mezzanine.utils.urls import home_slug
blog_installed = "mezzanine.blog" in settings.INSTALLED_APPS
if blog_installed:
from mezzanine.blog.mod... | Add homepage url to sitemap.xml | Add homepage url to sitemap.xml
| Python | bsd-2-clause | frankier/mezzanine,tuxinhang1989/mezzanine,Cajoline/mezzanine,sjuxax/mezzanine,orlenko/plei,SoLoHiC/mezzanine,jerivas/mezzanine,promil23/mezzanine,PegasusWang/mezzanine,dsanders11/mezzanine,readevalprint/mezzanine,joshcartme/mezzanine,sjdines/mezzanine,SoLoHiC/mezzanine,Skytorn86/mezzanine,jerivas/mezzanine,dsanders11/... |
74a78fc5a48ce834390590031d3d054214609ec0 | djangocms_blog/cms_app.py | djangocms_blog/cms_app.py | # -*- coding: utf-8 -*-
from cms.app_base import CMSApp
from cms.apphook_pool import apphook_pool
from django.utils.translation import ugettext_lazy as _, get_language
from .menu import BlogCategoryMenu
class BlogApp(CMSApp):
name = _('Blog')
urls = ['djangocms_blog.urls']
app_name = 'djangocms_blog'
... | # -*- coding: utf-8 -*-
from cms.app_base import CMSApp
from cms.apphook_pool import apphook_pool
from cms.menu_bases import CMSAttachMenu
from menus.base import NavigationNode
from menus.menu_pool import menu_pool
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _, get... | Attach category menu to CMSApp | Attach category menu to CMSApp
| Python | bsd-3-clause | motleytech/djangocms-blog,vnavascues/djangocms-blog,mistalaba/djangocms-blog,marty3d/djangocms-blog,EnglishConnection/djangocms-blog,jedie/djangocms-blog,kriwil/djangocms-blog,skirsdeda/djangocms-blog,nephila/djangocms-blog,mistalaba/djangocms-blog,sephii/djangocms-blog,dapeng0802/djangocms-blog,nephila/djangocms-blog,... |
72ee5d6949f25158b6cbd1deead45ee1e939be5b | sympy/series/__init__.py | sympy/series/__init__.py | """A module that handles series: find a limit, order the series etc.
"""
from order import Order
from limits import limit, Limit
from gruntz import gruntz
from series import series
O = Order
__all__ = [gruntz, limit, series, O, Order, Limit]
| """A module that handles series: find a limit, order the series etc.
"""
from order import Order
from limits import limit, Limit
from gruntz import gruntz
from series import series
O = Order
__all__ = ['gruntz', 'limit', 'series', 'O', 'Order', 'Limit']
| Fix __all__ usage for sympy/series | Fix __all__ usage for sympy/series
| Python | bsd-3-clause | hargup/sympy,Arafatk/sympy,chaffra/sympy,kaushik94/sympy,atreyv/sympy,jbbskinny/sympy,aktech/sympy,AunShiLord/sympy,AkademieOlympia/sympy,beni55/sympy,jerli/sympy,vipulroxx/sympy,Titan-C/sympy,yukoba/sympy,minrk/sympy,Shaswat27/sympy,abloomston/sympy,yashsharan/sympy,shipci/sympy,drufat/sympy,jerli/sympy,toolforger/sym... |
54c7d5704a148b703fb0db74eeeb66c187134faf | gratipay/utils/pricing.py | gratipay/utils/pricing.py | from decimal import Decimal as D, ROUND_HALF_EVEN
def suggested_payment(usage):
if usage >= 500:
percentage = D('0.02')
elif usage >= 20:
percentage = D('0.05')
else:
percentage = D('0.10')
suggestion = usage * percentage
if suggestion == 0:
rounded = suggestion
... | from decimal import Decimal as D, ROUND_HALF_EVEN
def suggested_payment(usage):
percentage = D('0.05')
suggestion = usage * percentage
rounded = suggestion.quantize(D('0'), ROUND_HALF_EVEN)
return rounded
def suggested_payment_low_high(usage):
# Above $500/wk we suggest 2%.
if usage >= 5000... | Change suggested payment to flat 5% | Change suggested payment to flat 5%
| Python | mit | eXcomm/gratipay.com,eXcomm/gratipay.com,gratipay/gratipay.com,gratipay/gratipay.com,gratipay/gratipay.com,studio666/gratipay.com,eXcomm/gratipay.com,studio666/gratipay.com,studio666/gratipay.com,gratipay/gratipay.com,eXcomm/gratipay.com,studio666/gratipay.com |
d16a3753d73714a51fbe846e45fe77d5e41cb2ab | examples/dup_and_replay.py | examples/dup_and_replay.py | from mitmproxy import ctx
def request(flow):
f = ctx.master.state.duplicate_flow(flow)
f.request.path = "/changed"
ctx.master.replay_request(f, block=True, run_scripthooks=False)
| from mitmproxy import ctx
def request(flow):
f = ctx.master.state.duplicate_flow(flow)
f.request.path = "/changed"
ctx.master.replay_request(f, block=True)
| Remove dead run_scripthooks example reference. | Remove dead run_scripthooks example reference. | Python | mit | xaxa89/mitmproxy,Kriechi/mitmproxy,cortesi/mitmproxy,zlorb/mitmproxy,dwfreed/mitmproxy,ujjwal96/mitmproxy,vhaupert/mitmproxy,mosajjal/mitmproxy,laurmurclar/mitmproxy,ujjwal96/mitmproxy,Kriechi/mitmproxy,xaxa89/mitmproxy,MatthewShao/mitmproxy,dwfreed/mitmproxy,mosajjal/mitmproxy,mitmproxy/mitmproxy,ddworken/mitmproxy,mo... |
3f09462f3be6f7d59d36ffaf5e4dae4be74b623b | private/realclearpolitics-scraper/scraper.py | private/realclearpolitics-scraper/scraper.py | import sys, os
args = sys.argv
if (len(args) <= 1):
print("ERROR: Please provide source url")
print("Example : python scraper.py url output.csv")
else:
url = args[1]
if (len(args) == 2):
filename = url.split('/')[-1].split('.')[0]
output = filename + ".csv"
print("No output file... | import sys, os
args = sys.argv
if (len(args) <= 1):
raise ValueError('Please provide source url when calling scraper.py. Example : python scraper.py url output.csv')
else:
url = args[1]
if (len(args) == 2):
filename = url.split('/')[-1].split('.')[0]
output = filename + ".csv"
print... | Raise exception when script called with wrong args | Raise exception when script called with wrong args
(instead of just printing)
| Python | mit | Rumel/berniemetrics,Rumel/berniemetrics,Rumel/berniemetrics,dpxxdp/berniemetrics,Rumel/berniemetrics,fpagnoux/berniemetrics,fpagnoux/berniemetrics,fpagnoux/berniemetrics,dpxxdp/berniemetrics,fpagnoux/berniemetrics,dpxxdp/berniemetrics,dpxxdp/berniemetrics |
b00d66ebe0248fcaff164997638c8890b5b5c17c | tensorflow/python/autograph/utils/compat_util.py | tensorflow/python/autograph/utils/compat_util.py | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | Swap out modules in py2 mode in a cleaner fashion. | Swap out modules in py2 mode in a cleaner fashion.
PiperOrigin-RevId: 288526813
Change-Id: I86efd4d804c0c873856307cf4a969270eb7bbae8
| Python | apache-2.0 | annarev/tensorflow,aam-at/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,xzturn/tensorflow,annarev/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow,yongtang/tensorflow,cxxgtxy/tensorflow,davidzchen/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_on... |
470b7313fa9b176fa4492ac9f355acd21542265d | tests/test_lib_fallback.py | tests/test_lib_fallback.py | from mock import patch
from pytest import raises
from tvrenamr.errors import NoMoreLibrariesException
from tvrenamr.main import Episode
from .base import BaseTest
from .mock_requests import initially_bad_xml, invalid_xml
class TestLibrariesFallback(BaseTest):
@patch('tvrenamr.libraries.requests.get', new=invali... | from mock import patch
from pytest import raises
from tvrenamr.errors import NoMoreLibrariesException
from tvrenamr.libraries import TheTvDb, TvRage
from tvrenamr.main import Episode
from .base import BaseTest
from .mock_requests import initially_bad_xml, invalid_xml
class TestLibrariesFallback(BaseTest):
@patc... | Test library fallback is overridden by setting a library | Test library fallback is overridden by setting a library
| Python | mit | wintersandroid/tvrenamr,ghickman/tvrenamr |
12ee53b4ec4d4fafd7f7af692dda0b0553b82226 | metpy/io/tests/test_nexrad.py | metpy/io/tests/test_nexrad.py | import os.path
from numpy.testing import TestCase
from metpy.io.nexrad import Level2File, Level3File
curdir, f = os.path.split(__file__)
datadir = os.path.join(curdir, '../../../examples/testdata')
class TestLevel3(TestCase):
def test_basic(self):
Level3File(os.path.join(datadir, 'nids/Level3_FFC_N0Q_201... | import glob
import os.path
from numpy.testing import TestCase
from metpy.io.nexrad import Level2File, Level3File
curdir, f = os.path.split(__file__)
datadir = os.path.join(curdir, '../../../examples/testdata')
def test_generator():
for fname in glob.glob(os.path.join(datadir, 'nids', 'KOUN*')):
yield rea... | Add parameterized test for nids. | Add parameterized test for nids.
| Python | bsd-3-clause | ahaberlie/MetPy,Unidata/MetPy,dopplershift/MetPy,deeplycloudy/MetPy,jrleeman/MetPy,dopplershift/MetPy,jrleeman/MetPy,ahill818/MetPy,Unidata/MetPy,ShawnMurd/MetPy,ahaberlie/MetPy |
c59fdbe03341843cbc9eb23d71c84376e71d55a1 | conda_env/main_env.py | conda_env/main_env.py | from __future__ import print_function, division, absolute_import
import argparse
from argparse import RawDescriptionHelpFormatter
import sys
from conda.cli import common
description = """
Handles interacting with Conda environments.
"""
example = """
examples:
conda env list
conda env list --json
"""
def ... | from __future__ import print_function, division, absolute_import
import argparse
from argparse import RawDescriptionHelpFormatter
import sys
from conda.cli import common
description = """
Handles interacting with Conda environments.
"""
example = """
examples:
conda env list
conda env list --json
"""
def ... | Update to work with the latest iteration | Update to work with the latest iteration
| Python | bsd-3-clause | ESSS/conda-env,conda/conda-env,conda/conda-env,dan-blanchard/conda-env,asmeurer/conda-env,nicoddemus/conda-env,isaac-kit/conda-env,phobson/conda-env,dan-blanchard/conda-env,asmeurer/conda-env,phobson/conda-env,nicoddemus/conda-env,ESSS/conda-env,mikecroucher/conda-env,mikecroucher/conda-env,isaac-kit/conda-env |
f7da89f1a2a24414778b9b53df77cdac3285a4a7 | API/chat/migrations/0001_squashed_0002_auto_20150707_1647.py | API/chat/migrations/0001_squashed_0002_auto_20150707_1647.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
replaces = [(b'chat', '0001_squashed_0008_auto_20150702_1437'), (b'chat', '0002_auto_20150707_1647')]
dependencies = [
]
operations = [
migrations... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Channel',
fields=[
('id', models.AutoField(verb... | Revert "Revert "[HOTFIX] Remove replaces line on 0001_squashed"" | Revert "Revert "[HOTFIX] Remove replaces line on 0001_squashed""
| Python | mit | VitSalis/ting,dionyziz/ting,mbalamat/ting,odyvarv/ting-1,VitSalis/ting,sirodoht/ting,odyvarv/ting-1,sirodoht/ting,VitSalis/ting,sirodoht/ting,gtklocker/ting,dionyziz/ting,odyvarv/ting-1,odyvarv/ting-1,mbalamat/ting,mbalamat/ting,gtklocker/ting,gtklocker/ting,gtklocker/ting,sirodoht/ting,dionyziz/ting,dionyziz/ting,mbal... |
dc184a5a46e4695ddd5e1886912fc18de68558b7 | extensions.py | extensions.py | valid_input_extensions = ['mkv', 'avi', 'ts', 'mov', 'vob', 'mpg', 'mts']
valid_output_extensions = ['mp4', 'm4v']
valid_audio_codecs = ['aac', 'ac3', 'dts', 'eac3']
valid_poster_extensions = ['jpg', 'png']
valid_subtitle_extensions = ['srt', 'vtt', 'ass']
valid_formats = ['mp4', 'mov']
bad_subtitle_codecs = ['pgssub',... | valid_input_extensions = ['mkv', 'avi', 'ts', 'mov', 'vob', 'mpg', 'mts']
valid_output_extensions = ['mp4', 'm4v']
valid_audio_codecs = ['aac', 'ac3', 'dts', 'eac3']
valid_poster_extensions = ['jpg', 'png']
valid_subtitle_extensions = ['srt', 'vtt', 'ass']
valid_formats = ['mp4', 'mov']
bad_subtitle_codecs = ['pgssub',... | Add dvb_subtitle to the bad codec list. | Add dvb_subtitle to the bad codec list.
| Python | mit | Filechaser/sickbeard_mp4_automator,Collisionc/sickbeard_mp4_automator,phtagn/sickbeard_mp4_automator,phtagn/sickbeard_mp4_automator,Collisionc/sickbeard_mp4_automator,Filechaser/sickbeard_mp4_automator |
a88d5414e7762e87c052ca9a28fe36a28b7d4d46 | oscar/apps/partner/prices.py | oscar/apps/partner/prices.py | class TaxNotKnown(Exception):
"""
Exception for when a tax-inclusive price is requested but we don't know
what the tax applicable is (yet).
"""
class Base(object):
#: Whether any prices exist
exists = False
#: Whether tax is known for this product (and session)
is_tax_known = False
... | class TaxNotKnown(Exception):
"""
Exception for when a tax-inclusive price is requested but we don't know
what the tax applicable is (yet).
"""
class Base(object):
"""
The interface that any pricing policy must support
"""
#: Whether any prices exist
exists = False
#: Whether... | Add currency property to pricing policies | Add currency property to pricing policies
| Python | bsd-3-clause | pdonadeo/django-oscar,jinnykoo/wuyisj.com,WillisXChen/django-oscar,bschuon/django-oscar,saadatqadri/django-oscar,kapari/django-oscar,adamend/django-oscar,adamend/django-oscar,bnprk/django-oscar,sonofatailor/django-oscar,Jannes123/django-oscar,faratro/django-oscar,MatthewWilkes/django-oscar,sasha0/django-oscar,anentropi... |
f49283377c7c1908afe67439a637c7414ce401f1 | tests/query_test/test_chars.py | tests/query_test/test_chars.py | #!/usr/bin/env python
# Copyright (c) 2012 Cloudera, Inc. All rights reserved.
#
import logging
import pytest
from copy import copy
from tests.common.test_vector import *
from tests.common.impala_test_suite import *
class TestStringQueries(ImpalaTestSuite):
@classmethod
def get_workload(cls):
return 'function... | #!/usr/bin/env python
# Copyright (c) 2012 Cloudera, Inc. All rights reserved.
#
import logging
import pytest
from copy import copy
from tests.common.test_vector import *
from tests.common.impala_test_suite import *
class TestStringQueries(ImpalaTestSuite):
@classmethod
def get_workload(cls):
return 'function... | Fix char test to only run on test/none. | Fix char test to only run on test/none.
Change-Id: I8f5ac5a6e7399ce2fdbe78d07ae24deaa1d7532d
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4326
Tested-by: jenkins
Reviewed-by: Alex Behm <fe1626037acfc2dc542d2aa723a6d14f2464a20c@cloudera.com>
| Python | apache-2.0 | theyaa/Impala,caseyching/Impala,theyaa/Impala,XiaominZhang/Impala,brightchen/Impala,bratatidas9/Impala-1,XiaominZhang/Impala,tempbottle/Impala,brightchen/Impala,bratatidas9/Impala-1,cchanning/Impala,brightchen/Impala,cloudera/recordservice,bratatidas9/Impala-1,brightchen/Impala,kapilrastogi/Impala,tempbottle/Impala,lir... |
bbe1c2aed3e6da1bd95f856e37c85e4562d6c1f0 | crmapp/urls.py | crmapp/urls.py | from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
from marketing.views import HomePage
from accounts.views import AccountList
from accounts.urls import account_urls
from contacts.urls import contact_urls
urlpatterns = patterns('',
# Marketing pages
url... | from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
from marketing.views import HomePage
from accounts.views import AccountList
from accounts.urls import account_urls
from contacts.urls import contact_urls
urlpatterns = patterns('',
# Marketing pages
url... | Create the Contacts App - Part II > New Contact - Create URL | Create the Contacts App - Part II > New Contact - Create URL
| Python | mit | tabdon/crmeasyapp,deenaariff/Django,tabdon/crmeasyapp |
bfd8d1126e771702dfe4869923927b8f4fb81ef1 | openstack/tests/functional/network/v2/test_extension.py | openstack/tests/functional/network/v2/test_extension.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | Remove namespace from network ext test | Remove namespace from network ext test
Change-Id: Id9b97d67ac6745fe962a76ccd9c0e4f7cbed4a89
| Python | apache-2.0 | mtougeron/python-openstacksdk,briancurtin/python-openstacksdk,stackforge/python-openstacksdk,stackforge/python-openstacksdk,dudymas/python-openstacksdk,dtroyer/python-openstacksdk,dtroyer/python-openstacksdk,mtougeron/python-openstacksdk,briancurtin/python-openstacksdk,openstack/python-openstacksdk,openstack/python-ope... |
63eb9f3dc26d33c4f6113011428a45b703a1886e | axelrod/__init__.py | axelrod/__init__.py | from __future__ import absolute_import
# The order of imports matters!
from .random_ import random_choice
from .plot import Plot
from .game import DefaultGame, Game
from .player import is_basic, is_cheater, update_histories, Player
from .mock_player import MockPlayer, simulate_play
from .round_robin import RoundRobin
... | from __future__ import absolute_import
# The order of imports matters!
from .random_ import random_choice
from .plot import Plot
from .game import DefaultGame, Game
from .player import is_basic, is_cheater, update_histories, Player
from .mock_player import MockPlayer, simulate_play
from .round_robin import RoundRobin
... | Fix implicit imports for tournament repo | Fix implicit imports for tournament repo
| Python | mit | ranjinidas/Axelrod,ranjinidas/Axelrod,marcharper/Axelrod,marcharper/Axelrod |
ce34a3dbaa824429b91af76ed5882ddffc2d3b2b | examples/happy_birthday.py | examples/happy_birthday.py | """A basic (single function) API written using Hug"""
import hug
@hug.get('/happy_birthday')
def happy_birthday(name, age:hug.types.number, **kwargs):
"""Says happy birthday to a user"""
return "Happy {age} Birthday {name}!".format(**locals())
| """A basic (single function) API written using Hug"""
import hug
@hug.get('/happy_birthday', example="name=HUG&page=1")
def happy_birthday(name, age:hug.types.number, **kwargs):
"""Says happy birthday to a user"""
return "Happy {age} Birthday {name}!".format(**locals())
| Add example argument, for direct url | Add example argument, for direct url
| Python | mit | STANAPO/hug,origingod/hug,jean/hug,MuhammadAlkarouri/hug,philiptzou/hug,jean/hug,giserh/hug,STANAPO/hug,MuhammadAlkarouri/hug,gbn972/hug,yasoob/hug,timothycrosley/hug,philiptzou/hug,yasoob/hug,giserh/hug,timothycrosley/hug,MuhammadAlkarouri/hug,shaunstanislaus/hug,timothycrosley/hug,janusnic/hug,janusnic/hug,alisaifee/... |
e9674f88660e14ce48239771b76310044fc37090 | erpnext/patches/v7_0/remove_old_earning_deduction_doctypes.py | erpnext/patches/v7_0/remove_old_earning_deduction_doctypes.py | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
if frappe.db.exists("DocType", "Salary Component"):
for dt in ("Salary Structure Earning", "Salary Structure Deducti... | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
if frappe.db.exists("DocType", "Salary Component"):
for dt in ("Salary Structure Earning", "Salary Structure Deducti... | Create columns for custom fields in new table Salary Detail and Component | Create columns for custom fields in new table Salary Detail and Component
| Python | agpl-3.0 | Aptitudetech/ERPNext,njmube/erpnext,geekroot/erpnext,geekroot/erpnext,gsnbng/erpnext,gsnbng/erpnext,geekroot/erpnext,geekroot/erpnext,indictranstech/erpnext,gsnbng/erpnext,indictranstech/erpnext,indictranstech/erpnext,njmube/erpnext,njmube/erpnext,indictranstech/erpnext,gsnbng/erpnext,njmube/erpnext |
89a427994c754fc63d01d7172e77f849039a356a | corehq/apps/domain/management/commands/migrate_domain_countries.py | corehq/apps/domain/management/commands/migrate_domain_countries.py | from django.core.management.base import LabelCommand
from django_countries.countries import COUNTRIES
from corehq.apps.domain.models import Domain
class Command(LabelCommand):
help = "Migrates old django domain countries from string to list. Sept 2014."
args = ""
label = ""
def handle(self, *args, **o... | from django.core.management.base import LabelCommand
from django_countries.countries import COUNTRIES
from corehq.apps.domain.models import Domain
class Command(LabelCommand):
help = "Migrates old django domain countries from string to list. Sept 2014."
args = ""
label = ""
def handle(self, *args, **o... | Change migration to fallback to old country | Change migration to fallback to old country
| Python | bsd-3-clause | dimagi/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq |
f00ae3046436f09e62460a8468e031a0c2027e7f | scikits/learn/machine/em/__init__.py | scikits/learn/machine/em/__init__.py | #! /usr/bin/env python
# Last Change: Sun Jul 22 01:00 PM 2007 J
from info import __doc__
from gauss_mix import GmParamError, GM
from gmm_em import GmmParamError, GMM, EM
from online_em import OnGMM as _OnGMM
__all__ = filter(lambda s:not s.startswith('_'), dir())
from numpy.testing import NumpyTest
test = NumpyTes... | #! /usr/bin/env python
# Last Change: Sun Sep 07 04:00 PM 2008 J
from info import __doc__
from gauss_mix import GmParamError, GM
from gmm_em import GmmParamError, GMM, EM
from online_em import OnGMM as _OnGMM
__all__ = filter(lambda s:not s.startswith('_'), dir())
| Remove deprecated test runned for em machine. | Remove deprecated test runned for em machine.
From: cdavid <cdavid@cb17146a-f446-4be1-a4f7-bd7c5bb65646>
git-svn-id: a2d1b0e147e530765aaf3e1662d4a98e2f63c719@271 22fbfee3-77ab-4535-9bad-27d1bd3bc7d8
| Python | bsd-3-clause | xzh86/scikit-learn,Akshay0724/scikit-learn,fyffyt/scikit-learn,jlegendary/scikit-learn,henridwyer/scikit-learn,Djabbz/scikit-learn,shenzebang/scikit-learn,mrshu/scikit-learn,costypetrisor/scikit-learn,jlegendary/scikit-learn,manhhomienbienthuy/scikit-learn,thientu/scikit-learn,marcocaccin/scikit-learn,xavierwu/scikit-l... |
68f4a9f7393a1f29841463c9b6b7d6bec9a00d6b | namuhub/__init__.py | namuhub/__init__.py | """namuhub --- namu.wiki contribution graph"""
from flask import Flask, jsonify, render_template, request, url_for
app = Flask('namuhub')
@app.route('/', methods=['GET'])
def index():
return render_template('index.html')
@app.route('/<user>', methods=['GET'])
def index_user(user=''):
return render_template('... | """namuhub --- namu.wiki contribution graph"""
from flask import Flask, jsonify, render_template, request, url_for
app = Flask('namuhub')
@app.route('/', methods=['GET'])
def index():
return render_template('index.html')
@app.route('/<user>', methods=['GET'])
def index_user(user=''):
return render_template('... | Return http status code 501 when a malformed message is received | Return http status code 501 when a malformed message is received
| Python | apache-2.0 | ssut/namuhub,ssut/namuhub,ssut/namuhub |
56bd6c6a0363323cc1f4b3fbbcd460ba446b0c6d | cubes/stores.py | cubes/stores.py | from .errors import *
from .browser import AggregationBrowser
from .extensions import get_namespace, initialize_namespace
__all__ = (
"open_store",
"Store"
)
def open_store(name, **options):
"""Gets a new instance of a model provider with name `name`."""
ns = get_namespace("s... | from .errors import *
from .browser import AggregationBrowser
from .extensions import get_namespace, initialize_namespace
__all__ = (
"open_store",
"Store"
)
def open_store(name, **options):
"""Gets a new instance of a model provider with name `name`."""
ns = get_namespace("s... | Raise ConfigurationError error that causes server to fail and dump whole stacktrace | Raise ConfigurationError error that causes server to fail and dump whole stacktrace
| Python | mit | noyeitan/cubes,ubreddy/cubes,she11c0de/cubes,zejn/cubes,zejn/cubes,pombredanne/cubes,she11c0de/cubes,pombredanne/cubes,ubreddy/cubes,jell0720/cubes,cesarmarinhorj/cubes,noyeitan/cubes,ubreddy/cubes,cesarmarinhorj/cubes,cesarmarinhorj/cubes,zejn/cubes,jell0720/cubes,noyeitan/cubes,pombredanne/cubes,jell0720/cubes,she11c... |
a532da48349c645464b97fb618b83799269a6b4b | examples/terminal/powerline.py | examples/terminal/powerline.py | #!/usr/bin/env python
'''Powerline terminal prompt example.
'''
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
from lib.core import Powerline, Segment
from lib.renderers import TerminalSegmentRenderer
powerline = Powerline([
Segment('⭤ SSH', 220, 166, attr=Segment.ATTR_BOLD),... | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
'''Powerline terminal prompt example.
'''
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
from lib.core import Powerline, Segment
from lib.renderers import TerminalSegmentRenderer
powerline = Powerline([
Segment('⭤ SSH'... | Fix issues with the terminal prompt example | Fix issues with the terminal prompt example
| Python | mit | DoctorJellyface/powerline,junix/powerline,prvnkumar/powerline,lukw00/powerline,cyrixhero/powerline,DoctorJellyface/powerline,seanfisk/powerline,S0lll0s/powerline,areteix/powerline,magus424/powerline,wfscheper/powerline,xfumihiro/powerline,bartvm/powerline,firebitsbr/powerline,IvanAli/powerline,russellb/powerline,Luffin... |
20e02587df6d8c776fa4b045e7004c546f531548 | tvrenamr/tests/base.py | tvrenamr/tests/base.py | from os import mkdir
from os.path import abspath, dirname, exists, join
from shutil import rmtree
from tvrenamr.config import Config
from tvrenamr.main import TvRenamr
from tvrenamr.tests import mock_requests
# make pyflakes STFU
assert mock_requests
class BaseTest(object):
files = 'tests/files'
organised = ... | from os import mkdir
from os.path import abspath, dirname, exists, join
from shutil import rmtree
from tvrenamr.config import Config
from tvrenamr.main import TvRenamr
from tvrenamr.tests import mock_requests
# make pyflakes STFU
assert mock_requests
class BaseTest(object):
files = 'tests/files'
organised = ... | Check and create the tests file folder using an absolute path | Check and create the tests file folder using an absolute path
| Python | mit | wintersandroid/tvrenamr,ghickman/tvrenamr |
b9d8406282c4017feca039a291699ae90f459f17 | trove/guestagent/common/timeutils.py | trove/guestagent/common/timeutils.py | from datetime import datetime
from oslo_utils import timeutils
def float_utcnow():
return float(datetime.strftime(timeutils.utcnow(), "%s.%f"))
| # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed u... | Add Apache 2.0 license to source file | Add Apache 2.0 license to source file
As per OpenStack licensing guide lines [1]:
[H102 H103] Newly contributed Source Code should be licensed under
the Apache 2.0 license.
[H104] Files with no code shouldn't contain any license header nor
comments, and must be left completely empty.
[1] http://docs.openstack.org/dev... | Python | apache-2.0 | openstack/trove,zhangg/trove,hplustree/trove,openstack/trove,hplustree/trove,zhangg/trove |
a540a68561db4067b66b4d4d0920b217fea4fda4 | var/spack/packages/openssl/package.py | var/spack/packages/openssl/package.py | from spack import *
class Openssl(Package):
"""The OpenSSL Project is a collaborative effort to develop a
robust, commercial-grade, full-featured, and Open Source
toolkit implementing the Secure Sockets Layer (SSL v2/v3) and
Transport Layer Security (TLS v1) protocols as well as a
full-... | from spack import *
class Openssl(Package):
"""The OpenSSL Project is a collaborative effort to develop a
robust, commercial-grade, full-featured, and Open Source
toolkit implementing the Secure Sockets Layer (SSL v2/v3) and
Transport Layer Security (TLS v1) protocols as well as a
full-... | Make OpenSSL build on Darwin | Make OpenSSL build on Darwin
| Python | lgpl-2.1 | matthiasdiener/spack,EmreAtes/spack,krafczyk/spack,iulian787/spack,matthiasdiener/spack,tmerrick1/spack,krafczyk/spack,lgarren/spack,TheTimmy/spack,iulian787/spack,EmreAtes/spack,EmreAtes/spack,skosukhin/spack,krafczyk/spack,mfherbst/spack,LLNL/spack,mfherbst/spack,skosukhin/spack,krafczyk/spack,mfherbst/spack,tmerrick... |
e1c091a4e31b346bbe9b2bffc33ccf4e82ef1beb | pre_commit_hooks/check_yaml.py | pre_commit_hooks/check_yaml.py | from __future__ import print_function
import argparse
import sys
import yaml
def check_yaml(argv=None):
parser = argparse.ArgumentParser()
parser.add_argument('filenames', nargs='*', help='Yaml filenames to check.')
args = parser.parse_args(argv)
retval = 0
for filename in args.filenames:
... | from __future__ import print_function
import argparse
import sys
import yaml
try:
from yaml.cyaml import CLoader as Loader
except ImportError: # pragma: no cover (no libyaml-dev / pypy)
Loader = yaml.Loader
def check_yaml(argv=None):
parser = argparse.ArgumentParser()
parser.add_argument('filenam... | Use the CLoader when present to validate yaml | Use the CLoader when present to validate yaml
| Python | mit | jordant/pre-commit-hooks,Harwood/pre-commit-hooks,chriskuehl/pre-commit-hooks,pre-commit/pre-commit-hooks,bgschiller/pre-commit-hooks,arahayrabedian/pre-commit-hooks,Coverfox/pre-commit-hooks,dupuy/pre-commit-hooks,jordant/pre-commit-hooks |
635d7beaff06d76bcdeddb386875f29fe132fb91 | Applications/SegmentVesselsCNNSeeds/SegmentVesselsCNNSeeds.py | Applications/SegmentVesselsCNNSeeds/SegmentVesselsCNNSeeds.py | #!/usr/bin/env python
import os.path
import ctk_cli
import keras.models as M
from tubetk.vseg.cnn import deploy, utils
script_params = utils.script_params
def main(args):
utils.set_params_path(args.params)
if (args.resampled is None) ^ (script_params['RESAMPLE_SPACING'] is None or args.preprocessed is None... | #!/usr/bin/env python
import errno
import os
import ctk_cli
import keras.models as M
from tubetk.vseg.cnn import deploy, utils
script_params = utils.script_params
def main(args):
utils.set_params_path(args.params)
if (args.resampled is None) ^ (script_params['RESAMPLE_SPACING'] is None or args.preprocessed... | Create the output directory as necessary | Create the output directory as necessary
| Python | apache-2.0 | aylward/ITKTubeTK,KitwareMedical/TubeTK,KitwareMedical/ITKTubeTK,KitwareMedical/TubeTK,aylward/ITKTubeTK,KitwareMedical/ITKTubeTK,thewtex/TubeTK,thewtex/TubeTK,aylward/ITKTubeTK,KitwareMedical/TubeTK,KitwareMedical/ITKTubeTK,thewtex/TubeTK,thewtex/TubeTK,KitwareMedical/ITKTubeTK,KitwareMedical/TubeTK,aylward/ITKTubeTK |
87f14e78e649487776585c0bb6f8253a12985ac5 | Applications/SegmentVesselsCNNSeeds/SegmentVesselsCNNSeeds.py | Applications/SegmentVesselsCNNSeeds/SegmentVesselsCNNSeeds.py | #!/usr/bin/env python
import errno
import os
import ctk_cli
import keras.models as M
from tubetk.vseg.cnn import deploy, utils
script_params = utils.script_params
def main(args):
utils.set_params_path(args.params)
if (args.resampled is None) ^ (script_params['RESAMPLE_SPACING'] is None or args.preprocessed... | #!/usr/bin/env python
import errno
import os
import ctk_cli
import keras.models as M
from tubetk.vseg.cnn import deploy, utils
script_params = utils.script_params
def main(args):
utils.set_params_path(args.params)
if (args.resampled is None) ^ (script_params['RESAMPLE_SPACING'] is None or args.preprocessed... | Create directory, if necessary, before preprocessing files as well | Create directory, if necessary, before preprocessing files as well
| Python | apache-2.0 | KitwareMedical/ITKTubeTK,KitwareMedical/TubeTK,thewtex/TubeTK,thewtex/TubeTK,KitwareMedical/TubeTK,thewtex/TubeTK,aylward/ITKTubeTK,aylward/ITKTubeTK,KitwareMedical/TubeTK,KitwareMedical/ITKTubeTK,KitwareMedical/ITKTubeTK,thewtex/TubeTK,KitwareMedical/TubeTK,KitwareMedical/ITKTubeTK,aylward/ITKTubeTK,aylward/ITKTubeTK |
fe98703f789976df76a3275c8449d53f89a58ec1 | behave_django/testcase.py | behave_django/testcase.py | from django.contrib.staticfiles.testing import StaticLiveServerTestCase
class BehaviorDrivenTestCase(StaticLiveServerTestCase):
"""
Test case attached to the context during behave execution
This test case prevents the regular tests from running.
"""
def runTest(*args, **kwargs):
pass
c... | from django.contrib.staticfiles.testing import StaticLiveServerTestCase
class BehaviorDrivenTestCase(StaticLiveServerTestCase):
"""
Test case attached to the context during behave execution
This test case prevents the regular tests from running.
"""
def runTest(self):
pass
class Existi... | Fix Landscape complaint "Method has no argument" | Fix Landscape complaint "Method has no argument"
| Python | mit | behave/behave-django,bittner/behave-django,bittner/behave-django,behave/behave-django |
a730bb6d273dcc4355ae783af96a2368098c366f | tests/sentry/receivers/test_core.py | tests/sentry/receivers/test_core.py | # coding: utf-8
from __future__ import absolute_import
from django.conf import settings
from sentry.models import Project, Team, User
from sentry.receivers.core import create_default_project
from sentry.testutils import TestCase
class CreateDefaultProjectTest(TestCase):
def test_simple(self):
user, _ =... | # coding: utf-8
from __future__ import absolute_import
from django.conf import settings
from sentry.models import Project, ProjectKey, User
from sentry.receivers.core import create_default_project
from sentry.testutils import TestCase
class CreateDefaultProjectTest(TestCase):
def test_simple(self):
use... | Add tests to confirm store/not api is default | Add tests to confirm store/not api is default
| Python | bsd-3-clause | boneyao/sentry,wujuguang/sentry,mitsuhiko/sentry,imankulov/sentry,gg7/sentry,imankulov/sentry,beeftornado/sentry,zenefits/sentry,JamesMura/sentry,JamesMura/sentry,looker/sentry,fuziontech/sentry,songyi199111/sentry,wong2/sentry,argonemyth/sentry,boneyao/sentry,ewdurbin/sentry,wujuguang/sentry,camilonova/sentry,mvaled/s... |
d7c8c43854f30d46f9a6d7367700e4fe5dc0b48d | setup.py | setup.py | #!/usr/bin/env python
from distutils.core import setup
# README = "/".join([os.path.dirname(__file__), "README.md"])
# with open(README) as file:
# long_description = file.read()
setup(
name='graphitesend',
version='0.4.0',
description='A simple interface for sending metrics to Graphite',
auth... | #!/usr/bin/env python
from distutils.core import setup
# README = "/".join([os.path.dirname(__file__), "README.md"])
# with open(README) as file:
# long_description = file.read()
setup(
name='graphitesend',
version='0.4.0',
description='A simple interface for sending metrics to Graphite',
auth... | Add gevent as an extra requirement | Add gevent as an extra requirement
| Python | apache-2.0 | daniellawrence/graphitesend,numberly/graphitesend,PabloLefort/graphitesend |
bf0b3cb27fa2b518fcc3f5116da0e4dbde25aae8 | src/django_richenum/__init__.py | src/django_richenum/__init__.py | import forms # noqa
import models # noqa
__all__ = (
'forms',
'models',
)
__version__ = 'unknown'
try:
__version__ = __import__('pkg_resources').get_distribution('django_richenum').version
except Exception as e:
pass
| __version__ = 'unknown'
try:
__version__ = __import__('pkg_resources').get_distribution('django_richenum').version
except Exception as e:
pass
| Remove unnecessary import of form submodule | Remove unnecessary import of form submodule
| Python | mit | hearsaycorp/django-richenum,dhui/django-richenum,hearsaycorp/django-richenum,asherf/django-richenum,adepue/django-richenum |
cd088415d0fd652c3e485fcd3b6e16032f09d707 | test/client/local_recognizer_test.py | test/client/local_recognizer_test.py | import unittest
import os
from speech_recognition import WavFile
from mycroft.client.speech.listener import RecognizerLoop
__author__ = 'seanfitz'
DATA_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), "data")
class LocalRecognizerTest(unittest.TestCase):
def setUp(self):
self.recognizer ... | import unittest
import os
from speech_recognition import WavFile
from mycroft.client.speech.listener import RecognizerLoop
__author__ = 'seanfitz'
DATA_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), "data")
class LocalRecognizerTest(unittest.TestCase):
def setUp(self):
rl = RecognizerL... | Fix init of local recognizer | Fix init of local recognizer
| Python | apache-2.0 | linuxipho/mycroft-core,Dark5ide/mycroft-core,forslund/mycroft-core,linuxipho/mycroft-core,forslund/mycroft-core,aatchison/mycroft-core,aatchison/mycroft-core,Dark5ide/mycroft-core,MycroftAI/mycroft-core,MycroftAI/mycroft-core |
8268b050ae98180a55b9c2e5285de1af5b8ca3e5 | pages/tests.py | pages/tests.py | from django.test import TestCase
from pages.models import *
from django.test.client import Client
class PagesTestCase(TestCase):
fixtures = ['tests.json']
def test_01_add_page(self):
"""
Test that the add admin page could be displayed correctly
"""
c = Client()
c.login(... | from django.test import TestCase
from pages.models import *
from django.test.client import Client
class PagesTestCase(TestCase):
fixtures = ['tests.json']
def test_01_add_page(self):
"""
Test that the add admin page could be displayed via the admin
"""
c = Client()
c.l... | Add a create page test | Add a create page test | Python | bsd-3-clause | PiRSquared17/django-page-cms,google-code-export/django-page-cms,google-code-export/django-page-cms,odyaka341/django-page-cms,PiRSquared17/django-page-cms,odyaka341/django-page-cms,odyaka341/django-page-cms,google-code-export/django-page-cms,Alwnikrotikz/django-page-cms,odyaka341/django-page-cms,PiRSquared17/django-page... |
c672e12779061a7999ce5802730fd2502a68a8ce | l10n_it_ipa/model/partner.py | l10n_it_ipa/model/partner.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014 KTec S.r.l.
# (<http://www.ktec.it>).
#
# Copyright (C) 2014 Associazione Odoo Italia
# (<http://www.odoo-italia.org>).
#
# This program is free software: you can redistribute it ... | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014 KTec S.r.l.
# (<http://www.ktec.it>).
#
# Copyright (C) 2014 Associazione Odoo Italia
# (<http://www.odoo-italia.org>).
#
# This program is free software: you can redistribute it ... | Use PascaleCase notation in class | Use PascaleCase notation in class
| Python | agpl-3.0 | linkitspa/l10n-italy,hurrinico/l10n-italy,ApuliaSoftware/l10n-italy,linkitspa/l10n-italy,luca-vercelli/l10n-italy,linkitspa/l10n-italy,maxhome1/l10n-italy,abstract-open-solutions/l10n-italy,alessandrocamilli/l10n-italy,scigghia/l10n-italy,odoo-isa/l10n-italy |
372e2d788e13bd1825edc2bdb31dfd4dda5353cb | kolibri/content/utils/channels.py | kolibri/content/utils/channels.py | import fnmatch
import logging as logger
import os
import uuid
logging = logger.getLogger(__name__)
def _is_valid_hex_uuid(uuid_to_test):
try:
uuid_obj = uuid.UUID(uuid_to_test)
except ValueError:
return False
return uuid_to_test == uuid_obj.hex
def get_channel_id_list_from_scanning_conten... | import fnmatch
import logging as logger
import os
import uuid
logging = logger.getLogger(__name__)
def _is_valid_hex_uuid(uuid_to_test):
try:
uuid_obj = uuid.UUID(uuid_to_test)
except ValueError:
return False
return uuid_to_test == uuid_obj.hex
def get_channel_id_list_from_scanning_conten... | Extend get_channel_id_* to return the full path to the exported DBs. | Extend get_channel_id_* to return the full path to the exported DBs.
| Python | mit | learningequality/kolibri,jtamiace/kolibri,indirectlylit/kolibri,MingDai/kolibri,jtamiace/kolibri,ralphiee22/kolibri,learningequality/kolibri,mrpau/kolibri,mrpau/kolibri,lyw07/kolibri,aronasorman/kolibri,learningequality/kolibri,christianmemije/kolibri,jtamiace/kolibri,jonboiser/kolibri,jayoshih/kolibri,jtamiace/kolibri... |
266ae3aa0a00f8b8872cd90a631196ff4a7afb38 | st2common/st2common/constants/secrets.py | st2common/st2common/constants/secrets.py | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | Add st2_auth_token to masked attributes list. | Add st2_auth_token to masked attributes list.
| Python | apache-2.0 | StackStorm/st2,alfasin/st2,punalpatel/st2,pixelrebel/st2,Plexxi/st2,dennybaa/st2,lakshmi-kannan/st2,emedvedev/st2,Plexxi/st2,dennybaa/st2,armab/st2,StackStorm/st2,lakshmi-kannan/st2,armab/st2,punalpatel/st2,StackStorm/st2,pixelrebel/st2,nzlosh/st2,peak6/st2,Plexxi/st2,nzlosh/st2,emedvedev/st2,dennybaa/st2,alfasin/st2,p... |
857750c5f2fba568c9ad3320d06b4178457be612 | uwsgi/hello.py | uwsgi/hello.py | import ujson
def application(environ, start_response):
response = {
"message": "Hello, World!"
}
data = ujson.dumps(response)
response_headers = [
('Content-type', 'text/plain'),
('Content-Length', str(len(data)))
]
start_response('200 OK', response_headers)
return [d... | import ujson
def application(environ, start_response):
response = {
"message": "Hello, World!"
}
data = ujson.dumps(response)
response_headers = [
('Content-type', 'application/json'),
('Content-Length', str(len(data)))
]
start_response('200 OK', response_headers)
ret... | Fix test to use proper Content-type for json test | uwsgi: Fix test to use proper Content-type for json test
| Python | bsd-3-clause | nbrady-techempower/FrameworkBenchmarks,zhuochenKIDD/FrameworkBenchmarks,hamiltont/FrameworkBenchmarks,actframework/FrameworkBenchmarks,jeevatkm/FrameworkBenchmarks,lcp0578/FrameworkBenchmarks,diablonhn/FrameworkBenchmarks,jetty-project/FrameworkBenchmarks,marko-asplund/FrameworkBenchmarks,zloster/FrameworkBenchmarks,Di... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.