commit stringlengths 40 40 | old_file stringlengths 5 117 | new_file stringlengths 5 117 | old_contents stringlengths 0 1.93k | new_contents stringlengths 19 3.3k | subject stringlengths 17 320 | message stringlengths 18 3.28k | lang stringclasses 1
value | license stringclasses 13
values | repos stringlengths 7 42.4k | completion stringlengths 152 6.66k | prompt stringlengths 21 3.65k |
|---|---|---|---|---|---|---|---|---|---|---|---|
6f7d8055613c8b0542dca5185cdc46e37a96942a | tests/test_status_page.py | tests/test_status_page.py | import subprocess
import unittest
from aws_status.status_page import StatusPage
class TestStatusPage(unittest.TestCase):
def test_number_of_detected_feeds(self):
command = "curl -s http://status.aws.amazon.com/|grep rss|sort -u|wc -l"
p = subprocess.Popen(command, stdout=subprocess.PIPE,
... | Add integration test for number of detected RSS feeds | Add integration test for number of detected RSS feeds
| Python | mit | jbbarth/aws-status,jbbarth/aws-status | <INSERT> import subprocess
import unittest
from aws_status.status_page import StatusPage
class TestStatusPage(unittest.TestCase):
<INSERT_END> <INSERT> def test_number_of_detected_feeds(self):
command = "curl -s http://status.aws.amazon.com/|grep rss|sort -u|wc -l"
p = subprocess.Popen(command, std... | Add integration test for number of detected RSS feeds
| |
3373521f43b0d605bba6cc36b190c064d5a0303e | kytos/core/link.py | kytos/core/link.py | """Module with all classes related to links.
Links are low level abstractions representing connections between two
interfaces.
"""
import json
from kytos.core.common import GenericEntity
class Link(GenericEntity):
"""Define a link between two Endpoints."""
def __init__(self, endpoint_a, endpoint_b):
... | """Module with all classes related to links.
Links are low level abstractions representing connections between two
interfaces.
"""
import json
from uuid import uuid4
from kytos.core.common import GenericEntity
class Link(GenericEntity):
"""Define a link between two Endpoints."""
def __init__(self, endpoi... | Define Link ID as UUID | Define Link ID as UUID
| Python | mit | kytos/kyco,kytos/kytos,renanrodrigo/kytos,macartur/kytos | <INSERT> uuid import uuid4
from <INSERT_END> <INSERT> self._uuid = uuid4()
<INSERT_END> <REPLACE_OLD> "{}:{}".format(self.endpoint_a.id, self.endpoint_b.id)
<REPLACE_NEW> "{}".format(self._uuid)
<REPLACE_END> <|endoftext|> """Module with all classes related to links.
Links are low level abstractions repre... | Define Link ID as UUID
"""Module with all classes related to links.
Links are low level abstractions representing connections between two
interfaces.
"""
import json
from kytos.core.common import GenericEntity
class Link(GenericEntity):
"""Define a link between two Endpoints."""
def __init__(self, endpoi... |
a1531197784cce0222720581a3bc47cd7b83e0ca | bluebottle/utils/template_loaders.py | bluebottle/utils/template_loaders.py | from django.template.loader import BaseLoader
from django.db import connection
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils._os import safe_join
from django.template.base import TemplateDoesNotExist
class TenantTemplateLoader(BaseLoader):
is_usable = T... | Add template loader for clients | Add template loader for clients
| Python | bsd-3-clause | jfterpstra/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,jfterpstra/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | <REPLACE_OLD> <REPLACE_NEW> from django.template.loader import BaseLoader
from django.db import connection
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils._os import safe_join
from django.template.base import TemplateDoesNotExist
class TenantTemplateLoader(B... | Add template loader for clients
| |
aec2ff67b3dbf2fa7770fc62b08659b51e6ed41e | tests/test_membrane.py | tests/test_membrane.py | from membrane import Membrane, Proxy
from rt import Wait
def test_membrane():
m1 = Membrane.create()
m1.transport = {'protocol': 'null',
'membrane': m1}
m2 = Membrane.create()
m2.transport = {'protocol': 'null',
'membrane': m1}
m1 << 'start'
m2 << 'start'... | Add test for membrane behavior | Add test for membrane behavior | Python | mit | waltermoreira/tartpy | <REPLACE_OLD> <REPLACE_NEW> from membrane import Membrane, Proxy
from rt import Wait
def test_membrane():
m1 = Membrane.create()
m1.transport = {'protocol': 'null',
'membrane': m1}
m2 = Membrane.create()
m2.transport = {'protocol': 'null',
'membrane': m1}
m1... | Add test for membrane behavior
| |
8046d67046a0be334b87e0ad54d78b6cfce83aad | main/test_race.py | main/test_race.py | import multiprocessing
import pprint
from ppm import Trie
trie = None
def test(a):
x, trie = a
trie.add('b')
trie.add('b')
print(x, trie.bit_encoding)
return trie.bit_encoding
if __name__ == '__main__':
trie = Trie(5)
trie.add('a')
alist = [ (x, trie) for x in range(0, multiprocessing... | Add a race condition tester | Add a race condition tester
| Python | mit | worldwise001/stylometry | <INSERT> import multiprocessing
import pprint
from ppm import Trie
trie = None
def test(a):
<INSERT_END> <INSERT> x, trie = a
trie.add('b')
trie.add('b')
print(x, trie.bit_encoding)
return trie.bit_encoding
if __name__ == '__main__':
trie = Trie(5)
trie.add('a')
alist = [ (x, trie) for... | Add a race condition tester
| |
809518f5915dece739d02b84146e0b9dacbabc99 | elections/uk/migrations/0005_add_favourite_biscuits.py | elections/uk/migrations/0005_add_favourite_biscuits.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
def create_simple_fields(apps, schema_editor):
ExtraField = apps.get_model('candidates', 'ExtraField')
db_alias = schema_editor.connection.alias
... | Add Favourite Biscuit as a field for candidates | Add Favourite Biscuit as a field for candidates
| Python | agpl-3.0 | DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative | <INSERT> # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
<INSERT_END> <INSERT> def create_simple_fields(apps, schema_editor):
ExtraField = apps.get_model('candidates', 'ExtraField')
db_alias = schema_ed... | Add Favourite Biscuit as a field for candidates
| |
6a2ab522c07a274920144f93f26361843d61c868 | setup.py | setup.py | from setuptools import setup, find_packages
import os
version = '0.1.1'
LONG_DESCRIPTION = """
===============
django-helpdesk
===============
This is a Django-powered helpdesk ticket tracker, designed to
plug into an existing Django website and provide you with
internal (or, perhaps, external) helpdesk management.... | from setuptools import setup, find_packages
import os
version = '0.1.2'
LONG_DESCRIPTION = """
===============
django-helpdesk
===============
This is a Django-powered helpdesk ticket tracker, designed to
plug into an existing Django website and provide you with
internal (or, perhaps, external) helpdesk management.... | Increment version number for updated pypi package | Increment version number for updated pypi package
| Python | bsd-3-clause | fjcapdevila/django-helpdesk,vladyslav2/django-helpdesk,fjcapdevila/django-helpdesk,gjedeer/django-helpdesk-issue-164,comsnetwork/django-helpdesk,comsnetwork/django-helpdesk,harrisonfeng/django-helpdesk,comsnetwork/django-helpdesk,temnoregg/django-helpdesk,harrisonfeng/django-helpdesk,django-helpdesk/django-helpdesk,ros... | <REPLACE_OLD> '0.1.1'
LONG_DESCRIPTION <REPLACE_NEW> '0.1.2'
LONG_DESCRIPTION <REPLACE_END> <|endoftext|> from setuptools import setup, find_packages
import os
version = '0.1.2'
LONG_DESCRIPTION = """
===============
django-helpdesk
===============
This is a Django-powered helpdesk ticket tracker, designed to
plug... | Increment version number for updated pypi package
from setuptools import setup, find_packages
import os
version = '0.1.1'
LONG_DESCRIPTION = """
===============
django-helpdesk
===============
This is a Django-powered helpdesk ticket tracker, designed to
plug into an existing Django website and provide you with
in... |
0762dbb9b0a43eb6bd01f43d88ac990e90da2303 | chandra_suli/filter_reg.py | chandra_suli/filter_reg.py |
"""
Take evt3 file and use region files to subtract off sources that are already known - image will have lots of holes
Goals by Friday 6/31 - Get script working for one image at a time
below = code used by Giacomo to create filtered image
ftcopy 'acisf00635_000N001_evt3.fits[EVENTS][regfilter("my_source.reg")]' test... | #!/usr/bin/env python
"""
Take evt3 file and use region files to subtract off sources that are already known - image will have lots of holes
Goals by Friday 6/31 - Get script working for one image at a time
below = code used by Giacomo to create filtered image
ftcopy 'acisf00635_000N001_evt3.fits[EVENTS][regfilter("m... | Copy reg file names into text file | Copy reg file names into text file
| Python | bsd-3-clause | nitikayad96/chandra_suli | <REPLACE_OLD>
"""
Take <REPLACE_NEW> #!/usr/bin/env python
"""
Take <REPLACE_END> <REPLACE_OLD> test.fits
""" <REPLACE_NEW> test.fits
code that works with CIAO
dmcopy "acisf00635_000N001_evt3.fits[exclude sky=region(acisf00635_000N001_r0101_reg3.fits)]" filter_test.fits opt=all
"""
import argparse
import subproces... | Copy reg file names into text file
"""
Take evt3 file and use region files to subtract off sources that are already known - image will have lots of holes
Goals by Friday 6/31 - Get script working for one image at a time
below = code used by Giacomo to create filtered image
ftcopy 'acisf00635_000N001_evt3.fits[EVENT... |
c386e9608eecc1e21fb30f073800755713267c07 | rex/network_feeder.py | rex/network_feeder.py |
import time
import threading
import socket
class NetworkFeeder:
"""
A class that feeds data to a socket port
"""
def __init__(self, proto, host, port, data, is_client=True, delay=3, timeout=2):
if not is_client:
raise NotImplementedError("Server mode is not implemented.")
... |
import time
import threading
import socket
class NetworkFeeder:
"""
A class that feeds data to a socket port
"""
def __init__(self, proto, host, port, data, is_client=True, delay=5, timeout=2):
if not is_client:
raise NotImplementedError("Server mode is not implemented.")
... | Set default delay to 5 seconds (because of my slow laptop). | NetworkFeeder: Set default delay to 5 seconds (because of my slow laptop).
| Python | bsd-2-clause | shellphish/rex,shellphish/rex | <REPLACE_OLD> delay=3, <REPLACE_NEW> delay=5, <REPLACE_END> <|endoftext|>
import time
import threading
import socket
class NetworkFeeder:
"""
A class that feeds data to a socket port
"""
def __init__(self, proto, host, port, data, is_client=True, delay=5, timeout=2):
if not is_client:
... | NetworkFeeder: Set default delay to 5 seconds (because of my slow laptop).
import time
import threading
import socket
class NetworkFeeder:
"""
A class that feeds data to a socket port
"""
def __init__(self, proto, host, port, data, is_client=True, delay=3, timeout=2):
if not is_client:
... |
56e764835e75035452a6a1ea06c386ec61dbe872 | src/rinoh/stylesheets/__init__.py | src/rinoh/stylesheets/__init__.py | # This file is part of rinohtype, the Python document preparation system.
#
# Copyright (c) Brecht Machiels.
#
# Use of this source code is subject to the terms of the GNU Affero General
# Public License v3. See the LICENSE file or http://www.gnu.org/licenses/.
import inspect
import os
import sys
from .. import DATA... | # This file is part of rinohtype, the Python document preparation system.
#
# Copyright (c) Brecht Machiels.
#
# Use of this source code is subject to the terms of the GNU Affero General
# Public License v3. See the LICENSE file or http://www.gnu.org/licenses/.
import inspect
import os
import sys
from .. import DATA... | Fix the auto-generated docstrings of style sheets | Fix the auto-generated docstrings of style sheets
| Python | agpl-3.0 | brechtm/rinohtype,brechtm/rinohtype,brechtm/rinohtype | <REPLACE_OLD> (':entry <REPLACE_NEW> ('{}\n\nEntry <REPLACE_END> <REPLACE_OLD> ``{}``\n\n{}'
<REPLACE_NEW> ``{}``'
<REPLACE_END> <REPLACE_OLD> .format(stylesheet, stylesheet.description))
<REPLACE_NEW> .format(stylesheet.description, stylesheet))
<REPLACE_END> <|endoftext|> # This file is part of rinohtype, the Pyt... | Fix the auto-generated docstrings of style sheets
# This file is part of rinohtype, the Python document preparation system.
#
# Copyright (c) Brecht Machiels.
#
# Use of this source code is subject to the terms of the GNU Affero General
# Public License v3. See the LICENSE file or http://www.gnu.org/licenses/.
impor... |
dcddc500ec8ae45c1a33a43e1727cc38c7b7e001 | blox/utils.py | blox/utils.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import ast
import sys
import struct
try:
import ujson as json
except ImportError:
import json
PY3 = sys.version_info[0] == 3
if PY3:
string_types = str,
else:
string_types = basestring,
def flatten_dtype(dtype):
dtype = str(dtype)... | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import ast
import sys
import struct
import functools
try:
import ujson as json
json_dumps = json.dumps
except ImportError:
import json
json_dumps = functools.partial(json.dumps, separators=',:')
PY3 = sys.version_info[0] == 3
if PY3:
... | Write compact json when using built-in json.dumps | Write compact json when using built-in json.dumps
| Python | mit | aldanor/blox | <REPLACE_OLD> struct
try:
<REPLACE_NEW> struct
import functools
try:
<REPLACE_END> <REPLACE_OLD> json
except <REPLACE_NEW> json
json_dumps = json.dumps
except <REPLACE_END> <REPLACE_OLD> json
PY3 <REPLACE_NEW> json
json_dumps = functools.partial(json.dumps, separators=',:')
PY3 <REPLACE_END> <REPLACE_OLD>... | Write compact json when using built-in json.dumps
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import ast
import sys
import struct
try:
import ujson as json
except ImportError:
import json
PY3 = sys.version_info[0] == 3
if PY3:
string_types = str,
else:
string_types = basestring,... |
40bb2b8aaff899f847211273f6631547b6bac978 | pyhessian/data_types.py | pyhessian/data_types.py | __all__ = ['long']
if hasattr(__builtins__, 'long'):
long = long
else:
class long(int):
pass
| __all__ = ['long']
if 'long' in __builtins__:
long = __builtins__['long']
else:
class long(int):
pass
| Fix bug encoding long type in python 2.x | Fix bug encoding long type in python 2.x
| Python | bsd-3-clause | cyrusmg/python-hessian,cyrusmg/python-hessian,cyrusmg/python-hessian | <REPLACE_OLD> hasattr(__builtins__, 'long'):
<REPLACE_NEW> 'long' in __builtins__:
<REPLACE_END> <REPLACE_OLD> long
else:
<REPLACE_NEW> __builtins__['long']
else:
<REPLACE_END> <|endoftext|> __all__ = ['long']
if 'long' in __builtins__:
long = __builtins__['long']
else:
class long(int):
pass
| Fix bug encoding long type in python 2.x
__all__ = ['long']
if hasattr(__builtins__, 'long'):
long = long
else:
class long(int):
pass
|
7fb1b95205de32ec27b4e5428928b1bba417c9c8 | build/fbcode_builder/specs/fbthrift.py | build/fbcode_builder/specs/fbthrift.py | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import specs.folly as folly
import specs.fizz as fizz
import specs.rsocket as rsocket
import spec... | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import specs.folly as folly
import specs.fizz as fizz
import specs.rsocket as rsocket
import spec... | Cut fbcode_builder dep for thrift on krb5 | Cut fbcode_builder dep for thrift on krb5
Summary: [Thrift] Cut `fbcode_builder` dep for `thrift` on `krb5`. In the past, Thrift depended on Kerberos and the `krb5` implementation for its transport-layer security. However, Thrift has since migrated fully to Transport Layer Security for its transport-layer security and... | Python | unknown | ReactiveSocket/reactivesocket-cpp,ReactiveSocket/reactivesocket-cpp,phoad/rsocket-cpp,phoad/rsocket-cpp,rsocket/rsocket-cpp,phoad/rsocket-cpp,rsocket/rsocket-cpp,rsocket/rsocket-cpp,ReactiveSocket/reactivesocket-cpp,rsocket/rsocket-cpp,phoad/rsocket-cpp,phoad/rsocket-cpp | <DELETE> builder.add_option('krb5/krb5:git_hash', 'krb5-1.16.1-final')
<DELETE_END> <DELETE> builder.github_project_workdir('krb5/krb5', 'src'),
builder.autoconf_install('krb5/krb5'),
<DELETE_END> <|endoftext|> #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
from __f... | Cut fbcode_builder dep for thrift on krb5
Summary: [Thrift] Cut `fbcode_builder` dep for `thrift` on `krb5`. In the past, Thrift depended on Kerberos and the `krb5` implementation for its transport-layer security. However, Thrift has since migrated fully to Transport Layer Security for its transport-layer security and... |
df99ee50e7d7a677aec4e30af10283399a8edb8c | dlstats/configuration.py | dlstats/configuration.py | import configobj
import validate
import os
def _get_filename():
"""Return the configuration file path."""
appname = 'dlstats'
if os.name == 'posix':
if os.path.isfile(os.environ["HOME"]+'/.'+appname):
return os.environ["HOME"]+'/.'+appname
elif os.path.isfile('/etc/'+appname):
... | import configobj
import validate
import os
def _get_filename():
"""Return the configuration file path."""
appname = 'dlstats'
if os.name == 'posix':
if "HOME" in os.environ:
if os.path.isfile(os.environ["HOME"]+'/.'+appname):
return os.environ["HOME"]+'/.'+appname
... | Test for environment variable existence | Test for environment variable existence
| Python | agpl-3.0 | Widukind/dlstats,MichelJuillard/dlstats,MichelJuillard/dlstats,mmalter/dlstats,mmalter/dlstats,Widukind/dlstats,mmalter/dlstats,MichelJuillard/dlstats | <INSERT> "HOME" in os.environ:
if <INSERT_END> <INSERT> <INSERT_END> <REPLACE_OLD> elif <REPLACE_NEW> if <REPLACE_END> <|endoftext|> import configobj
import validate
import os
def _get_filename():
"""Return the configuration file path."""
appname = 'dlstats'
if os.name == 'posix':
i... | Test for environment variable existence
import configobj
import validate
import os
def _get_filename():
"""Return the configuration file path."""
appname = 'dlstats'
if os.name == 'posix':
if os.path.isfile(os.environ["HOME"]+'/.'+appname):
return os.environ["HOME"]+'/.'+appname
... |
1a65ebc4a36da37840b3bd74666bf7f607ed190b | oshot/context_processors.py | oshot/context_processors.py | from django.contrib.auth.forms import AuthenticationForm
from django.contrib.sites.models import get_current_site
from django.conf import settings
from haystack.forms import SearchForm
from entities.models import Entity
from oshot.forms import EntityChoiceForm
def forms(request):
context = {"search_form": Search... | from django.contrib.auth.forms import AuthenticationForm
from django.contrib.sites.models import get_current_site
from django.conf import settings
from haystack.forms import SearchForm
from entities.models import Entity
from oshot.forms import EntityChoiceForm
def forms(request):
context = {"search_form": Search... | Clean bug with static file serving | Clean bug with static file serving
| Python | bsd-3-clause | hasadna/open-shot,hasadna/open-shot,hasadna/open-shot | <INSERT> try:
<INSERT_END> <INSERT> <INSERT_END> <INSERT> <INSERT_END> <INSERT> <INSERT_END> <INSERT> <INSERT_END> <INSERT> <INSERT_END> <INSERT> <INSERT_END> <INSERT> <INSERT_END> <INSERT> <INSERT_END> <INSERT> <INSERT_END> <REPLACE_OLD> auto_id=False)
<REPLACE_NEW> auto_i... | Clean bug with static file serving
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.sites.models import get_current_site
from django.conf import settings
from haystack.forms import SearchForm
from entities.models import Entity
from oshot.forms import EntityChoiceForm
def forms(request):
... |
5a8d7375b617bd5605bce5f09a4caedef170a85c | gbpservice/neutron/db/migration/cli.py | gbpservice/neutron/db/migration/cli.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
# d... | # 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... | Set project when doing neutron DB migrations | Set project when doing neutron DB migrations
That way, the default configuration files/dirs from the neutron
projects are read when doing the DB migrations.
This is useful if eg. some configuration files are in
/etc/neutron/neutron.conf.d/ . Theses files will then be automatically
evaluated.
Change-Id: I4997a86c4df5f... | Python | apache-2.0 | noironetworks/group-based-policy,stackforge/group-based-policy,stackforge/group-based-policy,noironetworks/group-based-policy | <REPLACE_OLD> CONF()
<REPLACE_NEW> CONF(project='neutron')
<REPLACE_END> <|endoftext|> # 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/LICE... | Set project when doing neutron DB migrations
That way, the default configuration files/dirs from the neutron
projects are read when doing the DB migrations.
This is useful if eg. some configuration files are in
/etc/neutron/neutron.conf.d/ . Theses files will then be automatically
evaluated.
Change-Id: I4997a86c4df5f... |
3974760a4406060061017f03bb7eabe5b1937a23 | keystone/contrib/s3/core.py | keystone/contrib/s3/core.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
"""Main entry point into the S3 Credentials service.
TODO-DOCS
"""
import base64
import hmac
from hashlib import sha1
from keystone import config
from keystone.common import wsgi
from keystone.contrib import ec2
CONF = config.CONF
def check_signature(creds_ref, creden... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
"""Main entry point into the S3 Credentials service.
TODO-DOCS
"""
import base64
import hmac
from hashlib import sha1
from keystone import config
from keystone.common import wsgi
from keystone.contrib import ec2
CONF = config.CONF
class S3Extension(wsgi.ExtensionRoute... | Make it as a subclass. | Make it as a subclass.
as advised by termie make it as a subclass instead of patching the
method.
| Python | apache-2.0 | rajalokan/keystone,dsiddharth/access-keys,townbull/keystone-dtrust,klmitch/keystone,cbrucks/keystone_ldap,openstack/keystone,promptworks/keystone,takeshineshiro/keystone,ilay09/keystone,openstack/keystone,openstack/keystone,rodrigods/keystone,rickerc/keystone_audit,ging/keystone,dstanek/keystone,klmitch/keystone,reeshu... | <REPLACE_OLD> config.CONF
def check_signature(creds_ref, credentials):
signature = credentials['signature']
msg = base64.urlsafe_b64decode(str(credentials['token']))
key = str(creds_ref['secret'])
signed = base64.encodestring(hmac.new(key, msg, sha1).digest()).strip()
if signature == signed:
... | Make it as a subclass.
as advised by termie make it as a subclass instead of patching the
method.
# vim: tabstop=4 shiftwidth=4 softtabstop=4
"""Main entry point into the S3 Credentials service.
TODO-DOCS
"""
import base64
import hmac
from hashlib import sha1
from keystone import config
from keystone.common impo... |
4c7f36e6a5f277b1c84d665edb279476a9e15063 | src/pyop/exceptions.py | src/pyop/exceptions.py | from oic.oauth2.message import ErrorResponse
from .util import should_fragment_encode
class BearerTokenError(ValueError):
pass
class InvalidAuthorizationCode(ValueError):
pass
class InvalidAccessToken(ValueError):
pass
class InvalidRefreshToken(ValueError):
pass
class InvalidSubjectIdentifier... | import json
from oic.oauth2.message import ErrorResponse
from .util import should_fragment_encode
class BearerTokenError(ValueError):
pass
class InvalidAuthorizationCode(ValueError):
pass
class InvalidAccessToken(ValueError):
pass
class InvalidRefreshToken(ValueError):
pass
class InvalidSubj... | Add JSON convenience to InvalidRegistrationRequest. | Add JSON convenience to InvalidRegistrationRequest.
| Python | apache-2.0 | its-dirg/pyop | <REPLACE_OLD> from <REPLACE_NEW> import json
from <REPLACE_END> <REPLACE_OLD> oauth_error
<REPLACE_NEW> oauth_error
def to_json(self):
error = {'error': self.oauth_error, 'error_description': str(self)}
return json.dumps(error)
<REPLACE_END> <|endoftext|> import json
from oic.oauth2.message imp... | Add JSON convenience to InvalidRegistrationRequest.
from oic.oauth2.message import ErrorResponse
from .util import should_fragment_encode
class BearerTokenError(ValueError):
pass
class InvalidAuthorizationCode(ValueError):
pass
class InvalidAccessToken(ValueError):
pass
class InvalidRefreshToken(V... |
cf336ac17ba194066517ab93ea7079415adba0c2 | sum.py | sum.py | import sublime, sublime_plugin
class SumCommand(sublime_plugin.TextCommand):
def run(self, edit):
sum_view = self.view.window().new_file()
sum_view.set_name('Sum')
file_text = self.view.substr(sublime.Region(0, self.view.size()))
sum_view.insert(edit, 0, file_text)
sum_vie... | import sublime, sublime_plugin
class SumCommand(sublime_plugin.TextCommand):
def run(self, edit):
sum_view = self.view.window().new_file()
sum_view.set_name('Sum')
file_text = self.view.substr(sublime.Region(0, self.view.size()))
numbers = []
for s in file_text.split():
... | Add up all ints (base 10) and floats in the file | Add up all ints (base 10) and floats in the file
| Python | mit | jbrudvik/sublime-sum,jbrudvik/sublime-sum | <REPLACE_OLD> self.view.size()))
<REPLACE_NEW> self.view.size()))
numbers = []
for s in file_text.split():
if s.isdigit():
numbers.append(int(s))
else:
try:
numbers.append(float(s))
except ValueError:
... | Add up all ints (base 10) and floats in the file
import sublime, sublime_plugin
class SumCommand(sublime_plugin.TextCommand):
def run(self, edit):
sum_view = self.view.window().new_file()
sum_view.set_name('Sum')
file_text = self.view.substr(sublime.Region(0, self.view.size()))
su... |
335a33465e197c9a2e52ed9de90546e2ca6173ee | tests/test_websocket_subscriber.py | tests/test_websocket_subscriber.py | """Tests for the WebSocketSubscriber handlers."""
import json
import pytest
from tornado.web import Application
from tornado.websocket import websocket_connect
from tornadose.handlers import WebSocketSubscriber
import utilities
@pytest.fixture
def store():
return utilities.TestStore()
@pytest.fixture
def app... | """Tests for the WebSocketSubscriber handlers."""
import json
from tornado.ioloop import IOLoop
from tornado.web import Application
from tornado.websocket import websocket_connect
from tornado.testing import AsyncHTTPTestCase, gen_test
from tornadose.handlers import WebSocketSubscriber
import utilities
class WebSo... | Fix test case for WebSocketSubscriber | Fix test case for WebSocketSubscriber
Switched to unittest-style testing (pytest is a bit too magical
especially with the pytest-tornado extension). I may change all
tests later to use unittest.
| Python | mit | mivade/tornadose | <REPLACE_OLD> json
import pytest
from <REPLACE_NEW> json
from tornado.ioloop import IOLoop
from <REPLACE_END> <REPLACE_OLD> websocket_connect
from <REPLACE_NEW> websocket_connect
from tornado.testing import AsyncHTTPTestCase, gen_test
from <REPLACE_END> <REPLACE_OLD> utilities
@pytest.fixture
def store():
<REPLA... | Fix test case for WebSocketSubscriber
Switched to unittest-style testing (pytest is a bit too magical
especially with the pytest-tornado extension). I may change all
tests later to use unittest.
"""Tests for the WebSocketSubscriber handlers."""
import json
import pytest
from tornado.web import Application
from torn... |
1ede9bd211cd8ea6aac4db6f8818804cb778a022 | dinosaurs/views.py | dinosaurs/views.py | import os
import tornado.web
import tornado.ioloop
class SingleStatic(tornado.web.StaticFileHandler):
def initialize(self, path):
self.dirname, self.filename = os.path.split(path)
super(SingleStatic, self).initialize(self.dirname)
def get(self, path=None, include_body=True):
super(Si... | Add a view that serves a single static file | Add a view that serves a single static file
| Python | mit | chrisseto/dinosaurs.sexy,chrisseto/dinosaurs.sexy | <INSERT> import os
import tornado.web
import tornado.ioloop
class SingleStatic(tornado.web.StaticFileHandler):
<INSERT_END> <INSERT> def initialize(self, path):
self.dirname, self.filename = os.path.split(path)
super(SingleStatic, self).initialize(self.dirname)
def get(self, path=None, includ... | Add a view that serves a single static file
| |
11cb3adf0beb19abebbf8345b9244dbcc0f51ca7 | autopoke.py | autopoke.py | #!/bin/env python
from selenium import webdriver
from selenium.common.exceptions import StaleElementReferenceException
from time import sleep
from getpass import getpass
if __name__ == '__main__':
driver = webdriver.phantomjs.webdriver.WebDriver()
driver.get('https://facebook.com')
driver.find_element_by_... | #!/bin/env python
from selenium import webdriver
from selenium.common.exceptions import StaleElementReferenceException
from time import sleep
from getpass import getpass
if __name__ == '__main__':
driver = webdriver.phantomjs.webdriver.WebDriver()
driver.get('https://facebook.com')
driver.find_element_by_... | Add notice on page reload | Add notice on page reload
| Python | mit | matthewbentley/autopoke | <DELETE> = 0
c2 <DELETE_END> <INSERT> print("Found exception, reloading page")
<INSERT_END> <|endoftext|> #!/bin/env python
from selenium import webdriver
from selenium.common.exceptions import StaleElementReferenceException
from time import sleep
from getpass import getpass
if __name__ == '__main__':... | Add notice on page reload
#!/bin/env python
from selenium import webdriver
from selenium.common.exceptions import StaleElementReferenceException
from time import sleep
from getpass import getpass
if __name__ == '__main__':
driver = webdriver.phantomjs.webdriver.WebDriver()
driver.get('https://facebook.com')
... |
6c571c88f60a761f398054ddca3d407c6010023b | docker/transform-pem.py | docker/transform-pem.py | #!/usr/bin/env python
"""Script to transform letsencrypt certificate files into string that can be inserted into
environment variable for Tutum to pick up.
Put your private key in certs/privkey.pem and your certificate in certs/fullchain.pem,
then run this script in order to obtain a certificate string compatible with... | Add script for transforming letsencrypt certificate | Add script for transforming letsencrypt certificate
| Python | mit | muzhack/muzhack,muzhack/muzhack,muzhack/musitechhub,muzhack/muzhack,muzhack/musitechhub,muzhack/musitechhub,muzhack/musitechhub,muzhack/muzhack | <INSERT> #!/usr/bin/env python
"""Script to transform letsencrypt certificate files into string that can be inserted into
environment variable for Tutum to pick up.
Put your private key in certs/privkey.pem and your certificate in certs/fullchain.pem,
then run this script in order to obtain a certificate string compat... | Add script for transforming letsencrypt certificate
| |
ddbd19d317940f61f724309b192dce5ed49f4cb0 | setup.py | setup.py | from setuptools import setup, find_packages
setup(
name='weaveserver',
version='0.8',
author='Srivatsan Iyer',
author_email='supersaiyanmode.rox@gmail.com',
packages=find_packages(),
license='MIT',
description='Library to interact with Weave Server',
long_description=open('README.md').r... | from setuptools import setup, find_packages
setup(
name='weaveserver',
version='0.8',
author='Srivatsan Iyer',
author_email='supersaiyanmode.rox@gmail.com',
packages=find_packages(),
license='MIT',
description='Library to interact with Weave Server',
long_description=open('README.md').r... | Remove sqlite3 package. Its available by default in most python distributions. | Remove sqlite3 package. Its available by default in most python distributions.
| Python | mit | supersaiyanmode/HomePiServer,supersaiyanmode/HomePiServer,supersaiyanmode/HomePiServer | <DELETE> 'sqlite3',
<DELETE_END> <|endoftext|> from setuptools import setup, find_packages
setup(
name='weaveserver',
version='0.8',
author='Srivatsan Iyer',
author_email='supersaiyanmode.rox@gmail.com',
packages=find_packages(),
license='MIT',
description='Library to interact with ... | Remove sqlite3 package. Its available by default in most python distributions.
from setuptools import setup, find_packages
setup(
name='weaveserver',
version='0.8',
author='Srivatsan Iyer',
author_email='supersaiyanmode.rox@gmail.com',
packages=find_packages(),
license='MIT',
description='... |
41d379fcb1e3d1828e7898045cca0505cb47ae61 | xgds_data/defaultSettings.py | xgds_data/defaultSettings.py | # __BEGIN_LICENSE__
# Copyright (C) 2008-2010 United States Government as represented by
# the Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# __END_LICENSE__
"""
This app may define some new parameters that can be modified in the
Django settings module. Let's say one such... | # __BEGIN_LICENSE__
# Copyright (C) 2008-2010 United States Government as represented by
# the Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# __END_LICENSE__
"""
This app may define some new parameters that can be modified in the
Django settings module. Let's say one such... | Move log enabling out of submodule | Move log enabling out of submodule
| Python | apache-2.0 | xgds/xgds_data,xgds/xgds_data | <REPLACE_OLD> r'^pipeline$',
)
XGDS_DATA_LOG_ENABLED <REPLACE_NEW> r'^pipeline$',
)
# XGDS_DATA_LOG_ENABLED <REPLACE_END> <REPLACE_OLD> False <REPLACE_NEW> False
<REPLACE_END> <|endoftext|> # __BEGIN_LICENSE__
# Copyright (C) 2008-2010 United States Government as represented by
# the Administrator of the National Ae... | Move log enabling out of submodule
# __BEGIN_LICENSE__
# Copyright (C) 2008-2010 United States Government as represented by
# the Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# __END_LICENSE__
"""
This app may define some new parameters that can be modified in the
Django ... |
4ca6d139139a08151f7cdf89993ded3440287a4a | keyform/urls.py | keyform/urls.py | from django.conf.urls import url, include
from django.contrib import admin
from django.contrib.auth.views import login, logout_then_login
from keyform import views
urlpatterns = [
url(r'^$', views.HomeView.as_view(), name='home'),
url(r'^contact$', views.ContactView.as_view(), name='contact'),
url(r'^edit-... | from django.conf.urls import url, include
from django.contrib import admin
from django.views.generic import RedirectView
from django.contrib.auth.views import login, logout_then_login
from keyform import views
urlpatterns = [
url(r'^$', views.HomeView.as_view(), name='home'),
url(r'^table.php$', RedirectView.a... | Add redirect for old hotlinks | Add redirect for old hotlinks
| Python | mit | mostateresnet/keyformproject,mostateresnet/keyformproject,mostateresnet/keyformproject | <INSERT> django.views.generic import RedirectView
from <INSERT_END> <INSERT> url(r'^table.php$', RedirectView.as_view(pattern_name='home', permanent=True)),
<INSERT_END> <|endoftext|> from django.conf.urls import url, include
from django.contrib import admin
from django.views.generic import RedirectView
from django... | Add redirect for old hotlinks
from django.conf.urls import url, include
from django.contrib import admin
from django.contrib.auth.views import login, logout_then_login
from keyform import views
urlpatterns = [
url(r'^$', views.HomeView.as_view(), name='home'),
url(r'^contact$', views.ContactView.as_view(), na... |
0834e37317b44940c27cdcdd3ee9929498356220 | copperhead/runtime/np_interop.py | copperhead/runtime/np_interop.py | import numpy as np
import copperhead.compiler.backendtypes as ET
import copperhead.compiler.coretypes as T
from copperhead.compiler.conversions import back_to_front_type
def to_numpy(ary):
front_type = back_to_front_type(ary.type)
if not isinstance(front_type, T.Seq):
raise ValueError("Not convertible... | Add conversion function between cuarray and np.ndarray. | Add conversion function between cuarray and np.ndarray.
| Python | apache-2.0 | beni55/copperhead,copperhead/copperhead,shyamalschandra/copperhead,shyamalschandra/copperhead,beni55/copperhead,copperhead/copperhead | <INSERT> import numpy as np
import copperhead.compiler.backendtypes as ET
import copperhead.compiler.coretypes as T
from copperhead.compiler.conversions import back_to_front_type
def to_numpy(ary):
<INSERT_END> <INSERT> front_type = back_to_front_type(ary.type)
if not isinstance(front_type, T.Seq):
rai... | Add conversion function between cuarray and np.ndarray.
| |
be964b02036159567efcaecce5b5d905f23985af | deduper/scanfiles.py | deduper/scanfiles.py | # This file is part of the File Deduper project. It is subject to
# the the revised 3-clause BSD license terms as set out in the LICENSE
# file found in the top-level directory of this distribution. No part of this
# project, including this file, may be copied, modified, propagated, or
# distributed except according to... | # This file is part of the File Deduper project. It is subject to
# the the revised 3-clause BSD license terms as set out in the LICENSE
# file found in the top-level directory of this distribution. No part of this
# project, including this file, may be copied, modified, propagated, or
# distributed except according to... | Check that fullpath is a regular file before continuing | Check that fullpath is a regular file before continuing
| Python | bsd-3-clause | cgspeck/filededuper | <INSERT> not os.path.isfile(fullpath):
continue
if <INSERT_END> <|endoftext|> # This file is part of the File Deduper project. It is subject to
# the the revised 3-clause BSD license terms as set out in the LICENSE
# file found in the top-level directory of this distribution. No part of thi... | Check that fullpath is a regular file before continuing
# This file is part of the File Deduper project. It is subject to
# the the revised 3-clause BSD license terms as set out in the LICENSE
# file found in the top-level directory of this distribution. No part of this
# project, including this file, may be copied, m... |
00fd5643e94cbe5543a22e804c050e979776ac6b | opps/flatpages/views.py | opps/flatpages/views.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.views.generic.detail import DetailView
from django.contrib.sites.models import get_current_site
from django import template
from django.utils import timezone
from .models import FlatPage
class PageDetail(DetailView):
model = FlatPage
context_object_n... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.views.generic.detail import DetailView
from django.contrib.sites.models import get_current_site
from django.utils import timezone
from .models import FlatPage
class PageDetail(DetailView):
model = FlatPage
context_object_name = "context"
type = '... | Fix template load on PageDetail flatpages app | Fix template load on PageDetail flatpages app
| Python | mit | opps/opps,jeanmask/opps,williamroot/opps,jeanmask/opps,YACOWS/opps,jeanmask/opps,opps/opps,YACOWS/opps,YACOWS/opps,williamroot/opps,YACOWS/opps,jeanmask/opps,opps/opps,williamroot/opps,opps/opps,williamroot/opps | <DELETE> django import template
from <DELETE_END> <REPLACE_OLD> 'pages'
<REPLACE_NEW> 'flatpages'
<REPLACE_END> <DELETE> try:
<DELETE_END> <DELETE> <DELETE_END> <DELETE> template.loader.get_template(_template)
except template.TemplateDoesNotExist:
_template = '{0}.html'.forma... | Fix template load on PageDetail flatpages app
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.views.generic.detail import DetailView
from django.contrib.sites.models import get_current_site
from django import template
from django.utils import timezone
from .models import FlatPage
class PageDetail(DetailVi... |
10379c2210b39d507af61530c56c1dbfa8cf5307 | pbxplore/demo/__init__.py | pbxplore/demo/__init__.py | """
Demonstration files --- :mod:`pbxplore.demo`
============================================
PBxplore bundles a set of demonstration files. This module ease the access to
these files.
The path to the demonstration files is stored in :const:`DEMO_DATA_PATH`. This
constant can be accessed as :const:`pbxplore.demo.DEMO... | """
Demonstration files --- :mod:`pbxplore.demo`
============================================
PBxplore bundles a set of demonstration files. This module ease the access to
these files.
The path to the demonstration files is stored in :const:`DEMO_DATA_PATH`. This
constant can be accessed as :const:`pbxplore.demo.DEMO... | Add a function to list absolute path to demo files | Add a function to list absolute path to demo files
| Python | mit | jbarnoud/PBxplore,jbarnoud/PBxplore,pierrepo/PBxplore,HubLot/PBxplore,pierrepo/PBxplore,HubLot/PBxplore | <REPLACE_OLD> function.
.. <REPLACE_NEW> function. The same list with absolute path instead of
file names is provided by :func:`list_demo_files_absolute`.
.. <REPLACE_END> <REPLACE_OLD> pbxplore.demo.list_demo_files
"""
import <REPLACE_NEW> pbxplore.demo.list_demo_files
.. autofunction:: pbxplore.demo.list_demo_fil... | Add a function to list absolute path to demo files
"""
Demonstration files --- :mod:`pbxplore.demo`
============================================
PBxplore bundles a set of demonstration files. This module ease the access to
these files.
The path to the demonstration files is stored in :const:`DEMO_DATA_PATH`. This
co... |
f9ca473abf7aea3cc146badf2d45ae715f635aac | kqueen_ui/server.py | kqueen_ui/server.py | from .config import current_config
from flask import Flask
from flask import redirect
from flask import url_for
from flask.ext.babel import Babel
from kqueen_ui.blueprints.registration.views import registration
from kqueen_ui.blueprints.ui.views import ui
from werkzeug.contrib.cache import SimpleCache
import logging
... | from .config import current_config
from flask import Flask
from flask import redirect
from flask import url_for
from flask.ext.babel import Babel
from kqueen_ui.blueprints.registration.views import registration
from kqueen_ui.blueprints.ui.views import ui
from werkzeug.contrib.cache import SimpleCache
import logging
... | Use correct parameter for HOST and PORT | Use correct parameter for HOST and PORT
| Python | mit | atengler/kqueen-ui,atengler/kqueen-ui,atengler/kqueen-ui,atengler/kqueen-ui | <REPLACE_OLD> host=app.config.get('KQUEEN_UI_HOST'),
<REPLACE_NEW> host=app.config.get('HOST'),
<REPLACE_END> <REPLACE_OLD> port=int(app.config.get('KQUEEN_UI_PORT'))
<REPLACE_NEW> port=int(app.config.get('PORT'))
<REPLACE_END> <|endoftext|> from .config import current_config
from flask import Flask
from flask imp... | Use correct parameter for HOST and PORT
from .config import current_config
from flask import Flask
from flask import redirect
from flask import url_for
from flask.ext.babel import Babel
from kqueen_ui.blueprints.registration.views import registration
from kqueen_ui.blueprints.ui.views import ui
from werkzeug.contrib.... |
395db381f6ad38465666efd2c56a261bcfdf38b9 | common/djangoapps/track/backends/logger.py | common/djangoapps/track/backends/logger.py | """Event tracker backend that saves events to a python logger."""
from __future__ import absolute_import
import logging
import json
from django.conf import settings
from track.backends import BaseBackend
from track.utils import DateTimeJSONEncoder
log = logging.getLogger('track.backends.logger')
application_log = ... | """Event tracker backend that saves events to a python logger."""
from __future__ import absolute_import
import logging
import json
from django.conf import settings
from track.backends import BaseBackend
from track.utils import DateTimeJSONEncoder
log = logging.getLogger('track.backends.logger')
application_log = ... | Raise UnicodeDecodeError exception after logging the exception | Raise UnicodeDecodeError exception after logging the exception
| Python | agpl-3.0 | wwj718/edx-platform,appsembler/edx-platform,zhenzhai/edx-platform,lduarte1991/edx-platform,raccoongang/edx-platform,kmoocdev2/edx-platform,edx/edx-platform,msegado/edx-platform,alu042/edx-platform,amir-qayyum-khan/edx-platform,Stanford-Online/edx-platform,tanmaykm/edx-platform,defance/edx-platform,kmoocdev2/edx-platfor... | <REPLACE_OLD> )
<REPLACE_NEW> )
raise
<REPLACE_END> <|endoftext|> """Event tracker backend that saves events to a python logger."""
from __future__ import absolute_import
import logging
import json
from django.conf import settings
from track.backends import BaseBackend
from track.utils import DateTi... | Raise UnicodeDecodeError exception after logging the exception
"""Event tracker backend that saves events to a python logger."""
from __future__ import absolute_import
import logging
import json
from django.conf import settings
from track.backends import BaseBackend
from track.utils import DateTimeJSONEncoder
log... |
018f8e7c7c69eefeb121c8552eb319b4b550f251 | backslash/error_container.py | backslash/error_container.py | from sentinels import NOTHING
class ErrorContainer(object):
def add_error(self, exception, exception_type, traceback, timestamp=NOTHING):
return self.client.api.call_function('add_error', {self._get_id_key(): self.id,
'exception': exception,
... | from sentinels import NOTHING
class ErrorContainer(object):
def add_error(self, message, exception_type=NOTHING, traceback=NOTHING, timestamp=NOTHING):
return self.client.api.call_function('add_error', {self._get_id_key(): self.id,
'message': mes... | Unify errors and failures in API | Unify errors and failures in API
| Python | bsd-3-clause | vmalloc/backslash-python,slash-testing/backslash-python | <REPLACE_OLD> exception, exception_type, traceback, <REPLACE_NEW> message, exception_type=NOTHING, traceback=NOTHING, <REPLACE_END> <REPLACE_OLD> 'exception': exception,
<REPLACE_NEW> 'message': message,
<REPLACE_END> <|endoftext|> from sentinels import NOTHING
class ErrorContainer(object):
def add_error(self,... | Unify errors and failures in API
from sentinels import NOTHING
class ErrorContainer(object):
def add_error(self, exception, exception_type, traceback, timestamp=NOTHING):
return self.client.api.call_function('add_error', {self._get_id_key(): self.id,
... |
825d2c053e7fa744f1d9c07748da358cba8d0d3b | tests/query_test/test_kudu.py | tests/query_test/test_kudu.py | # Copyright 2012 Cloudera Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | Add boilerplate code for Kudu end-to-end test | Add boilerplate code for Kudu end-to-end test
Change-Id: I568719afe5c172ac7e4ac98f9fe030f9710f26f1
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/7038
Reviewed-by: David Alves <33ea948168c114d220e0372a903be6ee60f6396e@cloudera.com>
Tested-by: jenkins
| Python | apache-2.0 | ibmsoe/ImpalaPPC,ibmsoe/ImpalaPPC,ibmsoe/ImpalaPPC,ibmsoe/ImpalaPPC,ibmsoe/ImpalaPPC,ibmsoe/ImpalaPPC,ibmsoe/ImpalaPPC | <INSERT> # Copyright 2012 Cloudera Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | Add boilerplate code for Kudu end-to-end test
Change-Id: I568719afe5c172ac7e4ac98f9fe030f9710f26f1
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/7038
Reviewed-by: David Alves <33ea948168c114d220e0372a903be6ee60f6396e@cloudera.com>
Tested-by: jenkins
| |
114a6eb827c0e3dd4557aee8f76fde1bbd111bb9 | archalice.py | archalice.py | #!/usr/bin/env python
import os
import re
import time
import sys
from threading import Thread
class testit(Thread):
def __init__ (self,ip):
Thread.__init__(self)
self.ip = ip
self.status = -1
self.responsetime = -1
def run(self):
pingaling = os.popen("ping -q -c2 "+self.ip,"r")
... | #!/usr/bin/env python
import os
import re
import time
import sys
from threading import Thread
class testit(Thread):
def __init__ (self,ip):
Thread.__init__(self)
self.ip = ip
self.status = -1
self.responsetime = -1
def run(self):
pingaling = os.popen("ping -q -c2 "+sel... | Update indentation to 4 spaces | Update indentation to 4 spaces
| Python | mit | imrehg/archalice | <INSERT> <INSERT_END> <INSERT> <INSERT_END> <INSERT> <INSERT_END> <INSERT> <INSERT_END> <INSERT> <INSERT_END> <INSERT> <INSERT_END> <INSERT> <INSERT_END> <INSERT> <INSERT_END> <INSERT> <INSERT_END> <INSERT> <INSERT_END> <INSERT> <INSERT_END> <INSERT> <INSERT_END> <INSERT> <INSERT_END> ... | Update indentation to 4 spaces
#!/usr/bin/env python
import os
import re
import time
import sys
from threading import Thread
class testit(Thread):
def __init__ (self,ip):
Thread.__init__(self)
self.ip = ip
self.status = -1
self.responsetime = -1
def run(self):
pingaling = os.pope... |
1bb1ececfcd548d52a28b713f4ee7eb4e710da85 | keras_tf_multigpu/examples/fchollet_inception3_multigpu.py | keras_tf_multigpu/examples/fchollet_inception3_multigpu.py | import tensorflow as tf
from keras.applications import InceptionV3
from keras.utils import multi_gpu_model
import numpy as np
num_samples = 1000
height = 224
width = 224
num_classes = 1000
gpu_count = 2
# Instantiate the base model
# (here, we do it on CPU, which is optional).
with tf.device('/cpu:0' if gpu_count > ... | Add an example of using fchollet multi_gpu_model on InceptionV3. | Add an example of using fchollet multi_gpu_model on InceptionV3.
Adapted from Keras example - parameterized number of GPUs, fixed imports,
different model class, fixed device placement for single GPU.
| Python | mit | rossumai/keras-multi-gpu,rossumai/keras-multi-gpu | <INSERT> import tensorflow as tf
from keras.applications import InceptionV3
from keras.utils import multi_gpu_model
import numpy as np
num_samples = 1000
height = 224
width = 224
num_classes = 1000
gpu_count = 2
# Instantiate the base model
# (here, we do it on CPU, which is optional).
with tf.device('/cpu:0' if gpu... | Add an example of using fchollet multi_gpu_model on InceptionV3.
Adapted from Keras example - parameterized number of GPUs, fixed imports,
different model class, fixed device placement for single GPU.
| |
80eb53ffeb51b3a6707c9714a0ed7acf7228b017 | php5_fpm.py | php5_fpm.py | #!/usr/bin/env python
#
# igcollect - PHP5 FPM
#
# This is the data collector for the PHP5 FPM status page. It makes a
# HTTP request to get the page, and formats the output. All the numeric
# values of the requested pool is printed.
#
# Copyright (c) 2016, InnoGames GmbH
#
from __future__ import print_function
imp... | Add plugin for PHP5 FPM | Add plugin for PHP5 FPM
| Python | mit | innogames/igcollect | <REPLACE_OLD> <REPLACE_NEW> #!/usr/bin/env python
#
# igcollect - PHP5 FPM
#
# This is the data collector for the PHP5 FPM status page. It makes a
# HTTP request to get the page, and formats the output. All the numeric
# values of the requested pool is printed.
#
# Copyright (c) 2016, InnoGames GmbH
#
from __future... | Add plugin for PHP5 FPM
| |
6611153650b697d56f14be347946f4a814d7fc72 | src/urllib3/_version.py | src/urllib3/_version.py | # This file is protected via CODEOWNERS
__version__ = "1.26.0.dev0"
| # This file is protected via CODEOWNERS
__version__ = "2.0.0.dev0"
| Mark master branch as 2.0.0 development branch | Mark master branch as 2.0.0 development branch | Python | mit | urllib3/urllib3,sigmavirus24/urllib3,sigmavirus24/urllib3,urllib3/urllib3 | <REPLACE_OLD> "1.26.0.dev0"
<REPLACE_NEW> "2.0.0.dev0"
<REPLACE_END> <|endoftext|> # This file is protected via CODEOWNERS
__version__ = "2.0.0.dev0"
| Mark master branch as 2.0.0 development branch
# This file is protected via CODEOWNERS
__version__ = "1.26.0.dev0"
|
43004cfd537c801475bf7e3b3c80dee4da18712f | backend/hook_manager.py | backend/hook_manager.py | # -*- coding: utf-8 -*-
#
# Copyright (c) 2014 Université Catholique de Louvain.
#
# This file is part of INGInious.
#
# INGInious is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the... | # -*- coding: utf-8 -*-
#
# Copyright (c) 2014 Université Catholique de Louvain.
#
# This file is part of INGInious.
#
# INGInious is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the... | Allow hooks to return values (and simplify the code) | Allow hooks to return values (and simplify the code)
| Python | agpl-3.0 | layus/INGInious,layus/INGInious,layus/INGInious,GuillaumeDerval/INGInious,GuillaumeDerval/INGInious,layus/INGInious,GuillaumeDerval/INGInious,GuillaumeDerval/INGInious | <REPLACE_OLD> name """
for func in <REPLACE_NEW> name. Returns a list of the returns values of the hooks (in the order the hooks were added)"""
return map(lambda x: x(**kwargs), <REPLACE_END> <REPLACE_OLD> []):
func(**kwargs)
<REPLACE_NEW> []))
<REPLACE_END> <|endoftext|> # -*- coding: utf... | Allow hooks to return values (and simplify the code)
# -*- coding: utf-8 -*-
#
# Copyright (c) 2014 Université Catholique de Louvain.
#
# This file is part of INGInious.
#
# INGInious is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by... |
1e88a3de5ed96847baf17eb1beb2599f5c79fb6b | djangobb_forum/search_indexes.py | djangobb_forum/search_indexes.py | from haystack.indexes import *
from haystack import site
from celery_haystack.indexes import CelerySearchIndex
import djangobb_forum.models as models
class PostIndex(CelerySearchIndex):
text = CharField(document=True, use_template=True)
author = CharField(model_attr='user')
created = DateTimeField(model_... | from haystack.indexes import *
from haystack import site
from gargoyle import gargoyle
try:
if gargoyle.is_active('solr_indexing_enabled'):
from celery_haystack.indexes import CelerySearchIndex as SearchIndex
except:
# Allow migrations to run
from celery_haystack.indexes import CelerySearchIndex as... | Disable indexing through celery when it's disabled. | Disable indexing through celery when it's disabled.
| Python | bsd-3-clause | tjvr/s2forums,LLK/s2forums,LLK/s2forums,LLK/s2forums,tjvr/s2forums,tjvr/s2forums | <REPLACE_OLD> site
from <REPLACE_NEW> site
from gargoyle import gargoyle
try:
if gargoyle.is_active('solr_indexing_enabled'):
from <REPLACE_END> <REPLACE_OLD> CelerySearchIndex
import <REPLACE_NEW> CelerySearchIndex as SearchIndex
except:
# Allow migrations to run
from celery_haystack.indexes imp... | Disable indexing through celery when it's disabled.
from haystack.indexes import *
from haystack import site
from celery_haystack.indexes import CelerySearchIndex
import djangobb_forum.models as models
class PostIndex(CelerySearchIndex):
text = CharField(document=True, use_template=True)
author = CharField(... |
0dd80314ae29d615b287819ae075deda435f3fe8 | setup.py | setup.py | from setuptools import setup
setup(
name='statbank',
version='0.2.1',
description='Statbank API client library',
url='http://github.com/gisgroup/statbank-python',
author='Gis Group ApS',
author_email='valentin@gisgroup.dk, zacharias@gisgroup.dk',
license='MIT',
packages=['statbank'],
... | from setuptools import setup
setup(
name='gisgroup-statbank',
version='0.0.1',
description='Statbank API client library',
url='http://github.com/gisgroup/statbank-python',
author='Gis Group ApS',
author_email='valentin@gisgroup.dk, zacharias@gisgroup.dk',
license='MIT',
packages=['statb... | Rename pypi package to gisgroup-statbank | Rename pypi package to gisgroup-statbank
| Python | mit | gisgroup/statbank-python | <REPLACE_OLD> name='statbank',
<REPLACE_NEW> name='gisgroup-statbank',
<REPLACE_END> <REPLACE_OLD> version='0.2.1',
<REPLACE_NEW> version='0.0.1',
<REPLACE_END> <|endoftext|> from setuptools import setup
setup(
name='gisgroup-statbank',
version='0.0.1',
description='Statbank API client library',
ur... | Rename pypi package to gisgroup-statbank
from setuptools import setup
setup(
name='statbank',
version='0.2.1',
description='Statbank API client library',
url='http://github.com/gisgroup/statbank-python',
author='Gis Group ApS',
author_email='valentin@gisgroup.dk, zacharias@gisgroup.dk',
li... |
86da129dd4d9665dc15218c1d5b4673ee33780f4 | factory/tools/cat_logs.py | factory/tools/cat_logs.py | #!/bin/env python
#
# cat_logs.py
#
# Print out the logs for a certain date
#
# Usage: cat_logs.py <factory> YY/MM/DD [hh:mm:ss]
#
import sys,os,os.path,time
sys.path.append("lib")
sys.path.append("..")
sys.path.append("../../lib")
import gWftArgsHelper,gWftLogParser
import glideFactoryConfig
USAGE="Usage: cat_logs.p... | Print the logs for a certain date | Print the logs for a certain date
| Python | bsd-3-clause | holzman/glideinwms-old,bbockelm/glideinWMS,holzman/glideinwms-old,bbockelm/glideinWMS,bbockelm/glideinWMS,holzman/glideinwms-old,bbockelm/glideinWMS | <REPLACE_OLD> <REPLACE_NEW> #!/bin/env python
#
# cat_logs.py
#
# Print out the logs for a certain date
#
# Usage: cat_logs.py <factory> YY/MM/DD [hh:mm:ss]
#
import sys,os,os.path,time
sys.path.append("lib")
sys.path.append("..")
sys.path.append("../../lib")
import gWftArgsHelper,gWftLogParser
import glideFactoryCon... | Print the logs for a certain date
| |
ad0f4e793ea010df243b87f42fff94037432e7b2 | mla_game/apps/transcript/management/commands/fake_game_one_gameplay.py | mla_game/apps/transcript/management/commands/fake_game_one_gameplay.py | import random
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from mla_game.apps.accounts.models import Profile
from ...models import (
Transcript, TranscriptPhraseDownvote
)
class Command(BaseCommand):
help = 'Creates random votes for all phrases in a random... | import random
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from mla_game.apps.accounts.models import Profile
from ...models import (
Transcript, TranscriptPhraseDownvote
)
class Command(BaseCommand):
help = 'Creates random votes for all phrases in a random... | Fix fake game one script again | Fix fake game one script again
| Python | mit | WGBH/FixIt,WGBH/FixIt,WGBH/FixIt | <REPLACE_OLD> Transcript.objects.random_transcript()
<REPLACE_NEW> Transcript.objects.random_transcript().first()
<REPLACE_END> <|endoftext|> import random
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from mla_game.apps.accounts.models import Profile
from ...model... | Fix fake game one script again
import random
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from mla_game.apps.accounts.models import Profile
from ...models import (
Transcript, TranscriptPhraseDownvote
)
class Command(BaseCommand):
help = 'Creates random v... |
f028e7638b02fad40561a2eca28d2bcfea34d064 | numba/tests/test_fastmath.py | numba/tests/test_fastmath.py | from __future__ import print_function, absolute_import
import math
import numpy as np
from numba import unittest_support as unittest
from numba.tests.support import captured_stdout, override_config
from numba import njit, vectorize, guvectorize
class TestFastMath(unittest.TestCase):
def test_jit(self):
... | Add test cases for fastmath flag | Add test cases for fastmath flag
| Python | bsd-2-clause | cpcloud/numba,jriehl/numba,seibert/numba,stuartarchibald/numba,IntelLabs/numba,stuartarchibald/numba,numba/numba,gmarkall/numba,sklam/numba,stonebig/numba,cpcloud/numba,cpcloud/numba,sklam/numba,seibert/numba,seibert/numba,IntelLabs/numba,IntelLabs/numba,IntelLabs/numba,stonebig/numba,stuartarchibald/numba,jriehl/numba... | <REPLACE_OLD> <REPLACE_NEW> from __future__ import print_function, absolute_import
import math
import numpy as np
from numba import unittest_support as unittest
from numba.tests.support import captured_stdout, override_config
from numba import njit, vectorize, guvectorize
class TestFastMath(unittest.TestCase):
... | Add test cases for fastmath flag
| |
6499c1f5e292f7445c0c9274a623c28c0eb7ce7b | setup.py | setup.py | #!/usr/bin/env python
from os.path import join
from setuptools import setup, find_packages
# Change geokey_sapelli version here (and here alone!):
VERSION_PARTS = (0, 6, 7)
name = 'geokey-sapelli'
version = '.'.join(map(str, VERSION_PARTS))
repository = join('https://github.com/ExCiteS', name)
def get_install_requ... | #!/usr/bin/env python
from os.path import join
from setuptools import setup, find_packages
# Change geokey_sapelli version here (and here alone!):
VERSION_PARTS = (0, 6, 7)
name = 'geokey-sapelli'
version = '.'.join(map(str, VERSION_PARTS))
repository = join('https://github.com/ExCiteS', name)
def get_install_requ... | Comment about excluding Git repositories from requirements.txt | Comment about excluding Git repositories from requirements.txt
| Python | mit | ExCiteS/geokey-sapelli,ExCiteS/geokey-sapelli | <REPLACE_OLD> comment <REPLACE_NEW> comment, Git repository <REPLACE_END> <|endoftext|> #!/usr/bin/env python
from os.path import join
from setuptools import setup, find_packages
# Change geokey_sapelli version here (and here alone!):
VERSION_PARTS = (0, 6, 7)
name = 'geokey-sapelli'
version = '.'.join(map(str, VERS... | Comment about excluding Git repositories from requirements.txt
#!/usr/bin/env python
from os.path import join
from setuptools import setup, find_packages
# Change geokey_sapelli version here (and here alone!):
VERSION_PARTS = (0, 6, 7)
name = 'geokey-sapelli'
version = '.'.join(map(str, VERSION_PARTS))
repository =... |
7ecec2d2b516d9ae22a3a0f652424045d547d811 | test_settings.py | test_settings.py | DEBUG = True
DATABASE_ENGINE = 'sqlite3'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
SECRET_KEY = '123'
INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.admin',
... | DEBUG = True
DATABASE_ENGINE = 'sqlite3'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
SECRET_KEY = '123'
INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'object_tools',
'djan... | Put object_tools in the correct order in settings | Put object_tools in the correct order in settings
| Python | bsd-3-clause | felixxm/django-object-tools,praekelt/django-object-tools,shubhamdipt/django-object-tools,shubhamdipt/django-object-tools,praekelt/django-object-tools,sky-chen/django-object-tools,felixxm/django-object-tools,sky-chen/django-object-tools | <INSERT> 'object_tools',
<INSERT_END> <REPLACE_OLD> 'object_tools',
'object_tools.tests',
]
ROOT_URLCONF <REPLACE_NEW> 'object_tools.tests'
]
ROOT_URLCONF <REPLACE_END> <|endoftext|> DEBUG = True
DATABASE_ENGINE = 'sqlite3'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
... | Put object_tools in the correct order in settings
DEBUG = True
DATABASE_ENGINE = 'sqlite3'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
SECRET_KEY = '123'
INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.contenttypes',
'djan... |
05aa314ac9b5d38bb7a30e30aced9b27b2797888 | python/ql/test/experimental/dataflow/tainttracking/defaultAdditionalTaintStep/test_syntax.py | python/ql/test/experimental/dataflow/tainttracking/defaultAdditionalTaintStep/test_syntax.py | # Add taintlib to PATH so it can be imported during runtime without any hassle
import sys; import os; sys.path.append(os.path.dirname(os.path.dirname((__file__))))
from taintlib import *
# This has no runtime impact, but allows autocomplete to work
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ..taintlib... | Add tests for non-async constructs | Python: Add tests for non-async constructs
| Python | mit | github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql | <INSERT> # Add taintlib to PATH so it can be imported during runtime without any hassle
import sys; import os; sys.path.append(os.path.dirname(os.path.dirname((__file__))))
from taintlib import *
# This has no runtime impact, but allows autocomplete to work
from typing import TYPE_CHECKING
if TYPE_CHECKING:
<INSERT_E... | Python: Add tests for non-async constructs
| |
5da51e1820c03a76dfdb9926023848b7399691da | inthe_am/taskmanager/models/usermetadata.py | inthe_am/taskmanager/models/usermetadata.py | from django.conf import settings
from django.contrib.auth.models import User
from django.db import models
class UserMetadata(models.Model):
user = models.ForeignKey(
User, related_name="metadata", unique=True, on_delete=models.CASCADE
)
tos_version = models.IntegerField(default=0)
tos_accepted... | from django.conf import settings
from django.contrib.auth.models import User
from django.db import models
class UserMetadata(models.Model):
user = models.OneToOneField(
User, related_name="metadata", on_delete=models.CASCADE
)
tos_version = models.IntegerField(default=0)
tos_accepted = models.... | Change mapping to avoid warning | Change mapping to avoid warning
| Python | agpl-3.0 | coddingtonbear/inthe.am,coddingtonbear/inthe.am,coddingtonbear/inthe.am,coddingtonbear/inthe.am,coddingtonbear/inthe.am | <REPLACE_OLD> models.ForeignKey(
<REPLACE_NEW> models.OneToOneField(
<REPLACE_END> <DELETE> unique=True, <DELETE_END> <|endoftext|> from django.conf import settings
from django.contrib.auth.models import User
from django.db import models
class UserMetadata(models.Model):
user = models.OneToOneField(
Use... | Change mapping to avoid warning
from django.conf import settings
from django.contrib.auth.models import User
from django.db import models
class UserMetadata(models.Model):
user = models.ForeignKey(
User, related_name="metadata", unique=True, on_delete=models.CASCADE
)
tos_version = models.Integer... |
02e7875bb8792741cfcf1b94561c5c5a418fcfbc | stable_baselines/__init__.py | stable_baselines/__init__.py | from stable_baselines.a2c import A2C
from stable_baselines.acer import ACER
from stable_baselines.acktr import ACKTR
# from stable_baselines.ddpg import DDPG
from stable_baselines.deepq import DeepQ
from stable_baselines.gail import GAIL
from stable_baselines.ppo1 import PPO1
from stable_baselines.ppo2 import PPO2
from... | from stable_baselines.a2c import A2C
from stable_baselines.acer import ACER
from stable_baselines.acktr import ACKTR
from stable_baselines.ddpg import DDPG
from stable_baselines.deepq import DeepQ
from stable_baselines.gail import GAIL
from stable_baselines.ppo1 import PPO1
from stable_baselines.ppo2 import PPO2
from s... | Revert "Try fixing circular import" | Revert "Try fixing circular import"
This reverts commit 1a23578be15c06c8d8688bcceffac4af2e980c95.
| Python | mit | hill-a/stable-baselines,hill-a/stable-baselines | <REPLACE_OLD> ACKTR
# from <REPLACE_NEW> ACKTR
from <REPLACE_END> <|endoftext|> from stable_baselines.a2c import A2C
from stable_baselines.acer import ACER
from stable_baselines.acktr import ACKTR
from stable_baselines.ddpg import DDPG
from stable_baselines.deepq import DeepQ
from stable_baselines.gail import GAIL
from... | Revert "Try fixing circular import"
This reverts commit 1a23578be15c06c8d8688bcceffac4af2e980c95.
from stable_baselines.a2c import A2C
from stable_baselines.acer import ACER
from stable_baselines.acktr import ACKTR
# from stable_baselines.ddpg import DDPG
from stable_baselines.deepq import DeepQ
from stable_baselines... |
958bb725cce490ecf5d9f2052e739d2b1fe84b3d | interface/backend/images/factories.py | interface/backend/images/factories.py | import factory
import factory.fuzzy
from backend.images import models
class ImageSeriesFactory(factory.django.DjangoModelFactory):
class Meta:
model = models.ImageSeries
patient_id = factory.Sequence(lambda n: "TEST-SERIES-%04d" % n)
series_instance_uid = factory.Sequence(lambda n: "1.3.6.1.4.1.... | import factory
import factory.fuzzy
from backend.images import models
class ImageSeriesFactory(factory.django.DjangoModelFactory):
class Meta:
model = models.ImageSeries
patient_id = factory.Sequence(lambda n: "TEST-SERIES-%04d" % n)
series_instance_uid = factory.Sequence(lambda n: "1.3.6.1.4.1.... | Make centroid factory locations a little more plausible | Make centroid factory locations a little more plausible
| Python | mit | vessemer/concept-to-clinic,vessemer/concept-to-clinic,vessemer/concept-to-clinic,vessemer/concept-to-clinic | <REPLACE_OLD> 511)
<REPLACE_NEW> 256)
<REPLACE_END> <REPLACE_OLD> 511)
<REPLACE_NEW> 256)
<REPLACE_END> <REPLACE_OLD> 63)
<REPLACE_NEW> 16)
<REPLACE_END> <|endoftext|> import factory
import factory.fuzzy
from backend.images import models
class ImageSeriesFactory(factory.django.DjangoModelFactory):
class... | Make centroid factory locations a little more plausible
import factory
import factory.fuzzy
from backend.images import models
class ImageSeriesFactory(factory.django.DjangoModelFactory):
class Meta:
model = models.ImageSeries
patient_id = factory.Sequence(lambda n: "TEST-SERIES-%04d" % n)
serie... |
7bf60d5ef1e6052044ebfedf1e2bf2dddc0940b8 | python/getmonotime.py | python/getmonotime.py | import getopt, sys
if __name__ == '__main__':
sippy_path = None
try:
opts, args = getopt.getopt(sys.argv[1:], 's:S:i:o:b')
except getopt.GetoptError:
usage()
for o, a in opts:
if o == '-S':
sippy_path = a.strip()
continue
if sippy_path != None:
... | Implement RTPP_LOG_TSTART and RTPP_LOG_TFORM="rel" env parameters to aid debugging. | Implement RTPP_LOG_TSTART and RTPP_LOG_TFORM="rel" env parameters
to aid debugging.
| Python | bsd-2-clause | sippy/rtp_cluster,sippy/rtp_cluster | <INSERT> import getopt, sys
if __name__ == '__main__':
<INSERT_END> <INSERT> sippy_path = None
try:
opts, args = getopt.getopt(sys.argv[1:], 's:S:i:o:b')
except getopt.GetoptError:
usage()
for o, a in opts:
if o == '-S':
sippy_path = a.strip()
continue
... | Implement RTPP_LOG_TSTART and RTPP_LOG_TFORM="rel" env parameters
to aid debugging.
| |
e184f5fea6425bc90ed1077fdd9cbacbaa12383e | django_select2/__init__.py | django_select2/__init__.py | # -*- coding: utf-8 -*-
"""
This is a Django_ integration of Select2_.
The app includes Select2 driven Django Widgets and Form Fields.
.. _Django: https://www.djangoproject.com/
.. _Select2: http://ivaynberg.github.com/select2/
"""
__version__ = "5.0.0"
| # -*- coding: utf-8 -*-
"""
This is a Django_ integration of Select2_.
The app includes Select2 driven Django Widgets and Form Fields.
.. _Django: https://www.djangoproject.com/
.. _Select2: http://ivaynberg.github.com/select2/
"""
__version__ = "5.0.1"
| Bump version number because v5.0.0 was taken on pypi due to mistake | Bump version number because v5.0.0 was taken on pypi due to mistake
| Python | apache-2.0 | DMOJ/django-select2,DMOJ/django-select2,anneFly/django-select2,anneFly/django-select2,applegrew/django-select2,rizumu/django-select2,anneFly/django-select2,applegrew/django-select2,rizumu/django-select2,rizumu/django-select2,applegrew/django-select2,DMOJ/django-select2 | <REPLACE_OLD> "5.0.0"
<REPLACE_NEW> "5.0.1"
<REPLACE_END> <|endoftext|> # -*- coding: utf-8 -*-
"""
This is a Django_ integration of Select2_.
The app includes Select2 driven Django Widgets and Form Fields.
.. _Django: https://www.djangoproject.com/
.. _Select2: http://ivaynberg.github.com/select2/
"""
__version_... | Bump version number because v5.0.0 was taken on pypi due to mistake
# -*- coding: utf-8 -*-
"""
This is a Django_ integration of Select2_.
The app includes Select2 driven Django Widgets and Form Fields.
.. _Django: https://www.djangoproject.com/
.. _Select2: http://ivaynberg.github.com/select2/
"""
__version__ = "... |
dd1c20c26dc959ec68180eadd324e1b2edfa4aef | mpinterfaces/tests/main_recipes/test_main_interface.py | mpinterfaces/tests/main_recipes/test_main_interface.py | from subprocess import call
# This test is simply calling a shell script, which calls a python main recipe
# (Originally a function used for ad-hoc manual testing) and verifies it behaved
# correctly. The reason for using a python file to call a shell script is so
# automatic python testing tools, like nose2, will aut... | Use Python to call our shell script test. | Use Python to call our shell script test.
This allows automated tools like nose2 to run it.
| Python | mit | joshgabriel/MPInterfaces,henniggroup/MPInterfaces,joshgabriel/MPInterfaces,henniggroup/MPInterfaces | <INSERT> from subprocess import call
# This test is simply calling a shell script, which calls a python main recipe
# (Originally a function used for ad-hoc manual testing) and verifies it behaved
# correctly. The reason for using a python file to call a shell script is so
# automatic python testing tools, like nose2,... | Use Python to call our shell script test.
This allows automated tools like nose2 to run it.
| |
ada5c5039d9a516fa9e6bc7741fbbbcd7f35d30f | migrations/0003_auto_20190327_1951.py | migrations/0003_auto_20190327_1951.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-03-27 19:51
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('announcements', '0002_auto_20141004_1330'),
]
operations = [
migrations.Al... | Update migrations for Django 1.11 and Python 3 | Update migrations for Django 1.11 and Python 3
| Python | mit | mback2k/django-app-announcements | <INSERT> # -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-03-27 19:51
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
<INSERT_END> <INSERT> dependencies = [
('announcements', '0002_auto_20141004_1330'),
]
operat... | Update migrations for Django 1.11 and Python 3
| |
4bd0637ad181c5ded8c6e5fa9ae79ab607b70aeb | geokey_dataimports/__init__.py | geokey_dataimports/__init__.py | """Main initialisation for extension."""
VERSION = (0, 2, 2)
__version__ = '.'.join(map(str, VERSION))
try:
from geokey.extensions.base import register
register(
'geokey_dataimports',
'Data Imports',
display_admin=True,
superuser=False,
version=__version__
)
excep... | """Main initialisation for extension."""
VERSION = (0, 3, 0)
__version__ = '.'.join(map(str, VERSION))
try:
from geokey.extensions.base import register
register(
'geokey_dataimports',
'Data Imports',
display_admin=True,
superuser=False,
version=__version__
)
excep... | Increment minor version number ahead of release. | Increment minor version number ahead of release. | Python | mit | ExCiteS/geokey-dataimports,ExCiteS/geokey-dataimports,ExCiteS/geokey-dataimports | <REPLACE_OLD> 2, 2)
__version__ <REPLACE_NEW> 3, 0)
__version__ <REPLACE_END> <|endoftext|> """Main initialisation for extension."""
VERSION = (0, 3, 0)
__version__ = '.'.join(map(str, VERSION))
try:
from geokey.extensions.base import register
register(
'geokey_dataimports',
'Data Imports',
... | Increment minor version number ahead of release.
"""Main initialisation for extension."""
VERSION = (0, 2, 2)
__version__ = '.'.join(map(str, VERSION))
try:
from geokey.extensions.base import register
register(
'geokey_dataimports',
'Data Imports',
display_admin=True,
superus... |
faf047e7ac3b9a703ffd76bd3c5de2e3ef5d93b6 | dear_astrid/test/test_rtm_importer.py | dear_astrid/test/test_rtm_importer.py | # pylint: disable=wildcard-import,unused-wildcard-import,missing-docstring
from __future__ import absolute_import
from unittest import TestCase
from nose.tools import *
from mock import *
from dear_astrid.rtm.importer import Importer as rtmimp
class TestRTMImport(TestCase):
def setUp(self):
self.patches = di... | # pylint: disable=wildcard-import,unused-wildcard-import,missing-docstring
from __future__ import absolute_import
from unittest import TestCase
from nose.tools import *
from mock import *
from dear_astrid.rtm.importer import Importer as rtmimp
class TestRTMImport(TestCase):
def setUp(self):
self.patches = di... | Change iteritems() to items() for future compatibility | Change iteritems() to items() for future compatibility
| Python | mit | rwstauner/dear_astrid,rwstauner/dear_astrid | <REPLACE_OLD> self.patches.iteritems():
<REPLACE_NEW> self.patches.items():
<REPLACE_END> <|endoftext|> # pylint: disable=wildcard-import,unused-wildcard-import,missing-docstring
from __future__ import absolute_import
from unittest import TestCase
from nose.tools import *
from mock import *
from dear_astrid.rtm.i... | Change iteritems() to items() for future compatibility
# pylint: disable=wildcard-import,unused-wildcard-import,missing-docstring
from __future__ import absolute_import
from unittest import TestCase
from nose.tools import *
from mock import *
from dear_astrid.rtm.importer import Importer as rtmimp
class TestRTMIm... |
9fda25c0a28f7965c2378dcd4b2106ca034052c3 | plumeria/plugins/have_i_been_pwned.py | plumeria/plugins/have_i_been_pwned.py | import plumeria.util.http as http
from plumeria import config
from plumeria.command import commands, CommandError
from plumeria.command.parse import Text
from plumeria.message.mappings import build_mapping
from plumeria.util.collections import SafeStructure
from plumeria.util.ratelimit import rate_limit
@commands.reg... | import plumeria.util.http as http
from plumeria import config
from plumeria.command import commands, CommandError
from plumeria.command.parse import Text
from plumeria.message.mappings import build_mapping
from plumeria.util.collections import SafeStructure
from plumeria.util.ratelimit import rate_limit
@commands.reg... | Handle missing accounts on HaveIBeenPwned properly. | Handle missing accounts on HaveIBeenPwned properly.
| Python | mit | sk89q/Plumeria,sk89q/Plumeria,sk89q/Plumeria | <INSERT> try:
<INSERT_END> <INSERT> <INSERT_END> <REPLACE_OLD> ])
<REPLACE_NEW> ])
except http.BadStatusCodeError as e:
<REPLACE_END> <REPLACE_OLD> not len(r.text().strip()):
<REPLACE_NEW> e.http_code == 404:
<REPLACE_END> <REPLACE_OLD> good.)")
<REPLACE_NEW> good.)")
else:
... | Handle missing accounts on HaveIBeenPwned properly.
import plumeria.util.http as http
from plumeria import config
from plumeria.command import commands, CommandError
from plumeria.command.parse import Text
from plumeria.message.mappings import build_mapping
from plumeria.util.collections import SafeStructure
from plum... |
3df68935d0c93135f6cf1749a6d730e3914156e1 | mint/lib/proxiedtransport.py | mint/lib/proxiedtransport.py | #
# Copyright (c) 2005-2009 rPath, Inc.
#
# All rights reserved
#
import urllib
from conary.repository import transport
class ProxiedTransport(transport.Transport):
"""
Transport class for contacting rUS through a proxy
"""
def __init__(self, *args, **kw):
# Override transport.XMLOpener with o... | #
# Copyright (c) 2005-2009 rPath, Inc.
#
# All rights reserved
#
import urllib
from conary.repository import transport
class ProxiedTransport(transport.Transport):
"""
Transport class for contacting rUS through a proxy
"""
def __init__(self, *args, **kw):
# Override transport.XMLOpener with o... | Fix latent bug in proxied XMLRPC that broke adding 5.8.x rUS (RBL-7945) | Fix latent bug in proxied XMLRPC that broke adding 5.8.x rUS (RBL-7945)
| Python | apache-2.0 | sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint | <REPLACE_OLD> resp[0][1][0]
class <REPLACE_NEW> resp[0][1]
class <REPLACE_END> <|endoftext|> #
# Copyright (c) 2005-2009 rPath, Inc.
#
# All rights reserved
#
import urllib
from conary.repository import transport
class ProxiedTransport(transport.Transport):
"""
Transport class for contacting rUS through a p... | Fix latent bug in proxied XMLRPC that broke adding 5.8.x rUS (RBL-7945)
#
# Copyright (c) 2005-2009 rPath, Inc.
#
# All rights reserved
#
import urllib
from conary.repository import transport
class ProxiedTransport(transport.Transport):
"""
Transport class for contacting rUS through a proxy
"""
def _... |
72384b3f06d4c68a94805e101f6cf4f820157834 | process.py | process.py | # encoding: utf-8
import sys
lines = sys.stdin.readlines()
# Contact details are expected to begin on the fourth line, following the
# header and a blank line, and extend until the next blank line. Lines with
# bullets (•) will be split into separate lines.
contact_lines = []
for line in lines[3:]:
lines.remove... | # encoding: utf-8
import sys
lines = sys.stdin.readlines()
# Contact details are expected to begin on the fourth line, following the
# header and a blank line, and extend until the next blank line. Lines with
# bullets (•) will be split into separate lines.
contact_lines = []
for line in lines[3:]:
lines.remove... | Fix display of tildes in PDF output. | Fix display of tildes in PDF output. | Python | apache-2.0 | davidbradway/resume,davidbradway/resume | <REPLACE_OLD> "".join(lines)
if <REPLACE_NEW> "".join(lines).replace('~', '$\sim$')
if <REPLACE_END> <|endoftext|> # encoding: utf-8
import sys
lines = sys.stdin.readlines()
# Contact details are expected to begin on the fourth line, following the
# header and a blank line, and extend until the next blank line. L... | Fix display of tildes in PDF output.
# encoding: utf-8
import sys
lines = sys.stdin.readlines()
# Contact details are expected to begin on the fourth line, following the
# header and a blank line, and extend until the next blank line. Lines with
# bullets (•) will be split into separate lines.
contact_lines = []
fo... |
454e8203295c7f51e1d660adcaf3d282ded5652f | scripts/cluster/craq/start_craq_router.py | scripts/cluster/craq/start_craq_router.py | #!/usr/bin/python
import sys
import subprocess
import time
def main():
subprocess.Popen('/home/meru/bmistree/new-craq-dist/craq-router-32 -d meru -p 10499 -z 192.168.1.30:9888', shell=True)
subprocess.Popen('/home/meru/bmistree/new-craq-dist/craq-router-32 -d meru -p 10498 -z 192.168.1.30:9888', shell=True)
... | #!/usr/bin/python
import sys
import subprocess
import time
def main():
subprocess.Popen('/home/meru/bmistree/new-craq-dist/craq-router-32 -d meru -p 10499 -z 192.168.1.7:9888', shell=True)
subprocess.Popen('/home/meru/bmistree/new-craq-dist/craq-router-32 -d meru -p 10498 -z 192.168.1.7:9888', shell=True)
r... | Make craq router script point at correct zookeeper node. | Make craq router script point at correct zookeeper node.
| Python | bsd-3-clause | sirikata/sirikata,sirikata/sirikata,sirikata/sirikata,sirikata/sirikata,sirikata/sirikata,sirikata/sirikata,sirikata/sirikata,sirikata/sirikata | <REPLACE_OLD> 192.168.1.30:9888', <REPLACE_NEW> 192.168.1.7:9888', <REPLACE_END> <REPLACE_OLD> 192.168.1.30:9888', <REPLACE_NEW> 192.168.1.7:9888', <REPLACE_END> <|endoftext|> #!/usr/bin/python
import sys
import subprocess
import time
def main():
subprocess.Popen('/home/meru/bmistree/new-craq-dist/craq-router-32 -d ... | Make craq router script point at correct zookeeper node.
#!/usr/bin/python
import sys
import subprocess
import time
def main():
subprocess.Popen('/home/meru/bmistree/new-craq-dist/craq-router-32 -d meru -p 10499 -z 192.168.1.30:9888', shell=True)
subprocess.Popen('/home/meru/bmistree/new-craq-dist/craq-router-32 -... |
8be5530e1fca59aff42b404b64324b68235bfd87 | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup, find_packages
import chagallpy
setup(
name='chagallpy',
version=chagallpy.__version__,
packages=find_packages(),
license='MIT',
description='CHArming GALLEry in PYthon',
long_description=open('README.md').read(),
author='Jan Pipek',
au... | #!/usr/bin/env python
from setuptools import setup, find_packages
import chagallpy
setup(
name='chagallpy',
version=chagallpy.__version__,
packages=find_packages(),
license='MIT',
description='CHArming GALLEry in PYthon',
long_description=open('README.md').read(),
author='Jan Pipek',
au... | Fix email address to be able to upload to pypi | Fix email address to be able to upload to pypi
| Python | mit | janpipek/chagallpy,janpipek/chagallpy,janpipek/chagallpy | <REPLACE_OLD> author_email='jan DOT pipek AT gmail COM',
<REPLACE_NEW> author_email='jan.pipek@gmail.com',
<REPLACE_END> <REPLACE_OLD> },
) <REPLACE_NEW> },
)
<REPLACE_END> <|endoftext|> #!/usr/bin/env python
from setuptools import setup, find_packages
import chagallpy
setup(
name='chagallpy',
version=chaga... | Fix email address to be able to upload to pypi
#!/usr/bin/env python
from setuptools import setup, find_packages
import chagallpy
setup(
name='chagallpy',
version=chagallpy.__version__,
packages=find_packages(),
license='MIT',
description='CHArming GALLEry in PYthon',
long_description=open('RE... |
7d621db3618db90679461550fb0c952417616402 | bot.py | bot.py | import asyncio
import configparser
import discord
from discord.ext import commands
class Bot(commands.Bot):
def __init__(self, config_filepath, command_prefix):
super().__init__(command_prefix)
self._load_config_data(config_filepath)
def _load_config_data(self, filepath):
config = configparser.ConfigParser()
... | import asyncio
import configparser
import discord
from discord.ext import commands
class Bot(commands.Bot):
def __init__(self, config_filepath, command_prefix):
super().__init__(command_prefix)
self._load_config_data(config_filepath)
def _load_config_data(self, filepath):
config = configparser.ConfigParser()
... | Add Bot.run and an on_ready message | Add Bot.run and an on_ready message
| Python | mit | MagiChau/ZonBot | <REPLACE_OLD> config['CARBON']['key']
def run(self):
pass <REPLACE_NEW> config['CARBON']['key']
async def on_ready(self):
print("Logged in as {}".format(self.user.name))
print("User ID: {}".format(self.user.id))
print("Library: {} - {}".format(discord.__title__, discord.__version__))
def run(self):
try:... | Add Bot.run and an on_ready message
import asyncio
import configparser
import discord
from discord.ext import commands
class Bot(commands.Bot):
def __init__(self, config_filepath, command_prefix):
super().__init__(command_prefix)
self._load_config_data(config_filepath)
def _load_config_data(self, filepath):
... |
cf2af4a006d2545bbe0ec9fc92d087d8ff6805f1 | cah.py | cah.py | STA_F= "/home/ormiret/cah/statements.txt"
ANS_F= "/home/ormiret/cah/answers.txt"
import random
def rand_line(filename):
with open(filename) as f:
lines = f.readlines()
return random.choice(lines).strip()
def statement():
return rand_line(STA_F)
def answer():
return rand_line(ANS_F)
def fill_... | STA_F= "statements.txt"
ANS_F= "answers.txt"
import random
def rand_line(filename):
with open(filename) as f:
lines = f.readlines()
return random.choice(lines).strip()
def statement():
return rand_line(STA_F)
def answer():
return rand_line(ANS_F)
def fill_statement():
statement = rand_li... | Fix path to statements and answers files. | Fix path to statements and answers files.
| Python | mit | ormiret/cards-against-hackspace,ormiret/cards-against-hackspace | <REPLACE_OLD> "/home/ormiret/cah/statements.txt"
ANS_F= "/home/ormiret/cah/answers.txt"
import <REPLACE_NEW> "statements.txt"
ANS_F= "answers.txt"
import <REPLACE_END> <|endoftext|> STA_F= "statements.txt"
ANS_F= "answers.txt"
import random
def rand_line(filename):
with open(filename) as f:
lines = f.readl... | Fix path to statements and answers files.
STA_F= "/home/ormiret/cah/statements.txt"
ANS_F= "/home/ormiret/cah/answers.txt"
import random
def rand_line(filename):
with open(filename) as f:
lines = f.readlines()
return random.choice(lines).strip()
def statement():
return rand_line(STA_F)
def answe... |
68ed2a5c2dfa24551ea936aa52e98525acbe9d42 | django_project/realtime/migrations/0035_ash_impact_file_path.py | django_project/realtime/migrations/0035_ash_impact_file_path.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('realtime', '0034_auto_20180208_1327'),
]
operations = [
migrations.AddField(
model_name='ash',
name=... | Add migration file for ash impact file path. | Add migration file for ash impact file path.
| Python | bsd-2-clause | AIFDR/inasafe-django,AIFDR/inasafe-django,AIFDR/inasafe-django,AIFDR/inasafe-django | <INSERT> # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
<INSERT_END> <INSERT> dependencies = [
('realtime', '0034_auto_20180208_1327'),
]
operations = [
migrations.AddField(
model... | Add migration file for ash impact file path.
| |
0fe990cf476dcd0cdea56c39de1dad6003d81851 | statbot/mention.py | statbot/mention.py | #
# mention.py
#
# statbot - Store Discord records for later analysis
# Copyright (c) 2017 Ammon Smith
#
# statbot is available free of charge under the terms of the MIT
# License. You are free to redistribute and/or modify it under those
# terms. It is distributed in the hopes that it will be useful, but
# WITHOUT ANY... | #
# mention.py
#
# statbot - Store Discord records for later analysis
# Copyright (c) 2017 Ammon Smith
#
# statbot is available free of charge under the terms of the MIT
# License. You are free to redistribute and/or modify it under those
# terms. It is distributed in the hopes that it will be useful, but
# WITHOUT ANY... | Change MentionType to use fixed enum values. | Change MentionType to use fixed enum values.
| Python | mit | strinking/statbot,strinking/statbot | <DELETE> auto, <DELETE_END> <REPLACE_OLD> auto()
<REPLACE_NEW> 0
<REPLACE_END> <REPLACE_OLD> auto()
<REPLACE_NEW> 1
<REPLACE_END> <REPLACE_OLD> auto()
<REPLACE_NEW> 2
<REPLACE_END> <|endoftext|> #
# mention.py
#
# statbot - Store Discord records for later analysis
# Copyright (c) 2017 Ammon Smith
#
# statbot is a... | Change MentionType to use fixed enum values.
#
# mention.py
#
# statbot - Store Discord records for later analysis
# Copyright (c) 2017 Ammon Smith
#
# statbot is available free of charge under the terms of the MIT
# License. You are free to redistribute and/or modify it under those
# terms. It is distributed in the h... |
6e3d80d13864510cf2def7a20660a40daa793e5e | setup.py | setup.py | from setuptools import setup, find_packages
import journal
setup(
name = 'journal',
version = journal.__version__,
author = journal.__author__,
author... | from setuptools import setup, find_packages
import journal
setup(
name = 'journal',
version = journal.__version__,
author = journal.__author__,
author... | Add argparse as install requirement for 2.5/2.6 systems | Add argparse as install requirement for 2.5/2.6 systems
| Python | mit | askedrelic/journal | <REPLACE_OLD> find_packages(),
test_suite = 'tests',
entry_points <REPLACE_NEW> find_packages(),
entry_points <REPLACE_END> <REPLACE_OLD> journal.main:main"""
)
<REPLACE_NEW> journal.main:main""",
install_requires = ['argparse'],
)
<REPLACE_END> <|endoftext|> from setuptools import setup, find_packages ... | Add argparse as install requirement for 2.5/2.6 systems
from setuptools import setup, find_packages
import journal
setup(
name = 'journal',
version = journ... |
fea2c0bc02a8323ad6c759ca63663499a538186e | onnx/__init__.py | onnx/__init__.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from .onnx_ml_pb2 import * # noqa
from .version import version as __version__ # noqa
import sys
def load(obj):
'''
Loads a binary protobuf that stores onnx gr... | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from .onnx_ml_pb2 import * # noqa
from .version import version as __version__ # noqa
# Import common subpackages so they're available when you 'import onnx'
import onn... | Undo BC-breaking change, restore 'import onnx' providing submodules. | Undo BC-breaking change, restore 'import onnx' providing submodules.
Signed-off-by: Edward Z. Yang <dbd597f5635f432486c5d365e9bb585b3eaa1853@fb.com>
| Python | apache-2.0 | onnx/onnx,onnx/onnx,onnx/onnx,onnx/onnx | <INSERT> # noqa
# Import common subpackages so they're available when you 'import onnx'
import onnx.helper # noqa
import onnx.checker # noqa
import onnx.defs <INSERT_END> <|endoftext|> from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import... | Undo BC-breaking change, restore 'import onnx' providing submodules.
Signed-off-by: Edward Z. Yang <dbd597f5635f432486c5d365e9bb585b3eaa1853@fb.com>
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from .onnx_ml_pb2 i... |
177c4d85c6110890ef1c6085bbe0fb6ae8b332a7 | setup.py | setup.py | #!/usr/bin/env python
from os import path
from setuptools import setup, find_packages
def read(name):
return open(path.join(path.dirname(__file__), name)).read()
setup(
name='django-basic-stats',
description=("django-basic-stats is a simple traffic statistics application. "
"It show late... | #!/usr/bin/env python
from os import path
from setuptools import setup, find_packages
def read(name):
return open(path.join(path.dirname(__file__), name)).read()
setup(
name='django-basic-stats',
description=("django-basic-stats is a simple traffic statistics application. "
"It show late... | Install templates with the egg. | Install templates with the egg.
| Python | mit | riklaunim/django-basic-stats,riklaunim/django-basic-stats | <INSERT> include_package_data=True,
<INSERT_END> <|endoftext|> #!/usr/bin/env python
from os import path
from setuptools import setup, find_packages
def read(name):
return open(path.join(path.dirname(__file__), name)).read()
setup(
name='django-basic-stats',
description=("django-basic-stats is a simp... | Install templates with the egg.
#!/usr/bin/env python
from os import path
from setuptools import setup, find_packages
def read(name):
return open(path.join(path.dirname(__file__), name)).read()
setup(
name='django-basic-stats',
description=("django-basic-stats is a simple traffic statistics application.... |
b73fa8f8daaef9130563cfa2f7d0546c6e393d33 | tools/dev/wc-ng/graph-data.py | tools/dev/wc-ng/graph-data.py | #!/usr/bin/env python
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
from matplotlib import pylab
import numpy as np
import csv
import sys
min_rev = 35000
data_reader = csv.reader(open('data.csv'))
data = []
for row in data_reader:
row = row[:-1]
if row[0] == 'Revision':
data.append(row)
... | Add yet another script, this one for doing an area graph of the wc-ng data collected by gather-data.sh. | Add yet another script, this one for doing an area graph of the wc-ng data
collected by gather-data.sh.
* tools/dev/wc-ng/graph-data.py:
New.
git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@880258 13f79535-47bb-0310-9956-ffa450edef68
| Python | apache-2.0 | YueLinHo/Subversion,YueLinHo/Subversion,wbond/subversion,YueLinHo/Subversion,YueLinHo/Subversion,wbond/subversion,YueLinHo/Subversion,wbond/subversion,YueLinHo/Subversion,wbond/subversion,wbond/subversion,YueLinHo/Subversion,wbond/subversion,wbond/subversion,YueLinHo/Subversion | <INSERT> #!/usr/bin/env python
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
from matplotlib import pylab
import numpy as np
import csv
import sys
min_rev = 35000
data_reader = csv.reader(open('data.csv'))
data = []
for row in data_reader:
<INSERT_END> <INSERT> row = row[:-1]
if row[0] == 'Revi... | Add yet another script, this one for doing an area graph of the wc-ng data
collected by gather-data.sh.
* tools/dev/wc-ng/graph-data.py:
New.
git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@880258 13f79535-47bb-0310-9956-ffa450edef68
| |
afb58da6ecc11a1c92d230bc2dcbb06464cc4f32 | percept/workflows/commands/run_flow.py | percept/workflows/commands/run_flow.py | """
Given a config file, run a given workflow
"""
from percept.management.commands import BaseCommand
from percept.utils.registry import registry, find_in_registry
from percept.workflows.base import NaiveWorkflow
from percept.utils.workflow import WorkflowWrapper, WorkflowLoader
import logging
log = logging.getLogger... | """
Given a config file, run a given workflow
"""
from percept.management.commands import BaseCommand
from percept.utils.registry import registry, find_in_registry
from percept.workflows.base import NaiveWorkflow
from percept.utils.workflow import WorkflowWrapper, WorkflowLoader
from optparse import make_option
import... | Add in a way to start a shell using the results of a workflow | Add in a way to start a shell using the results of a workflow
| Python | apache-2.0 | VikParuchuri/percept,VikParuchuri/percept | <REPLACE_OLD> WorkflowLoader
import <REPLACE_NEW> WorkflowLoader
from optparse import make_option
import IPython
import <REPLACE_END> <INSERT> option_list = BaseCommand.option_list + (make_option('--shell',
help='Whether or not to load a shell afterwards".')... | Add in a way to start a shell using the results of a workflow
"""
Given a config file, run a given workflow
"""
from percept.management.commands import BaseCommand
from percept.utils.registry import registry, find_in_registry
from percept.workflows.base import NaiveWorkflow
from percept.utils.workflow import Workflow... |
69a00f52db2f1c48839d8035871937c3bf938503 | AutoCopyrightEventListener.py | AutoCopyrightEventListener.py | #
# Copyright (c) 2012 by Lifted Studios. All Rights Reserved.
#
import sublime
import sublime_plugin
class AutoCopyrightEventListener(sublime_plugin.EventListener):
'''
Listener for application events.
'''
def on_pre_save(self, view):
'''
Called just before the view is saved.
'''
view.run_... | Add event listener to automatically update the copyright. | Add event listener to automatically update the copyright.
| Python | mit | lifted-studios/AutoCopyright,lifted-studios/AutoCopyright | <INSERT> #
# Copyright (c) 2012 by Lifted Studios. <INSERT_END> <INSERT> All Rights Reserved.
#
import sublime
import sublime_plugin
class AutoCopyrightEventListener(sublime_plugin.EventListener):
'''
Listener for application events.
'''
def on_pre_save(self, view):
'''
Called just before the view i... | Add event listener to automatically update the copyright.
| |
b252592eb40263994317d88ced43ddc4669a4975 | tests/run_tests.py | tests/run_tests.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Test runner for sqlparse."""
import optparse
import os
import sys
import unittest
test_mod = os.path.abspath(os.path.join(os.path.dirname(__file__), '../'))
if test_mod not in sys.path:
sys.path.insert(1, test_mod)
parser = optparse.OptionParser()
parser.add_opt... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Test runner for sqlparse."""
import optparse
import os
import sys
import unittest
test_mod = os.path.abspath(os.path.join(os.path.dirname(__file__), '../'))
if test_mod not in sys.path:
sys.path.insert(1, test_mod)
parser = optparse.OptionParser()
parser.add_opt... | Fix return code when running unittests. | Fix return code when running unittests.
| Python | bsd-3-clause | AndiDog/sqlparse,actsasgeek/sqlparse,zhongdai/sqlparse,tailhook/sqlparse,AndiDog/sqlparse,Yelp/sqlparse,Yelp/sqlparse,benekastah/sqlparse,actsasgeek/sqlparse,tailhook/sqlparse,Yelp/sqlparse,MariaPet/sqlparse,payne/sqlparse,adamgreenhall/sqlparse,andialbrecht/sqlparse,tailhook/sqlparse,adamgreenhall/sqlparse,payne/sqlpa... | <INSERT> return <INSERT_END> <INSERT> result = <INSERT_END> <INSERT> if not result.wasSuccessful():
return_code = 1
else:
return_code = 0
sys.exit(return_code)
<INSERT_END> <|endoftext|> #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Test runner for sqlparse."""
import optparse
import os... | Fix return code when running unittests.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Test runner for sqlparse."""
import optparse
import os
import sys
import unittest
test_mod = os.path.abspath(os.path.join(os.path.dirname(__file__), '../'))
if test_mod not in sys.path:
sys.path.insert(1, test_mod)
parser... |
afc0ace0767e29f8c2b71ed5ba7f8139e24fc020 | categories/serializers.py | categories/serializers.py | from .models import Category, Keyword, Subcategory
from rest_framework import serializers
class CategorySerializer(serializers.ModelSerializer):
class Meta:
model = Category
fields = ('pk', 'name', 'weight', 'comment_required')
class KeywordSerializer(serializers.ModelSerializer):
... | from .models import Category, Keyword, Subcategory
from rest_framework import serializers
class KeywordSerializer(serializers.ModelSerializer):
class Meta:
model = Keyword
fields = ('pk', 'name')
class KeywordListSerializer(serializers.ModelSerializer):
class Meta:
model ... | Add reverse relationship serializer to Category | Add reverse relationship serializer to Category
| Python | apache-2.0 | belatrix/BackendAllStars | <DELETE> CategorySerializer(serializers.ModelSerializer):
class Meta:
model = Category
fields = ('pk', 'name', 'weight', 'comment_required')
class <DELETE_END> <REPLACE_OLD> 'name')
<REPLACE_NEW> 'name')
class CategorySerializer(serializers.ModelSerializer):
subcategories = Subca... | Add reverse relationship serializer to Category
from .models import Category, Keyword, Subcategory
from rest_framework import serializers
class CategorySerializer(serializers.ModelSerializer):
class Meta:
model = Category
fields = ('pk', 'name', 'weight', 'comment_required')
class Key... |
f3c047a39f3d8438487ab31764d82afb7a86524e | apps/api/permissions.py | apps/api/permissions.py | from oauth2_provider.ext.rest_framework import TokenHasScope
from rest_framework.permissions import DjangoObjectPermissions
class TokenHasScopeOrUserHasObjectPermissionsOrWriteOnly(DjangoObjectPermissions, TokenHasScope):
"""
Allow anyone to write to this endpoint, but only the ones with the required scope to... | Add API permission class for HasScopeOrWriteOnly | Add API permission class for HasScopeOrWriteOnly
| Python | mit | dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4 | <INSERT> from oauth2_provider.ext.rest_framework import TokenHasScope
from rest_framework.permissions import DjangoObjectPermissions
class TokenHasScopeOrUserHasObjectPermissionsOrWriteOnly(DjangoObjectPermissions, TokenHasScope):
<INSERT_END> <INSERT> """
Allow anyone to write to this endpoint, but only the o... | Add API permission class for HasScopeOrWriteOnly
| |
0d1ec7d24e3b6272ccde8a2b02af35a29db145ab | setup.py | setup.py | import os
import setuptools
setuptools.setup(
name='lmj.sim',
version='0.0.2',
namespace_packages=['lmj'],
packages=setuptools.find_packages(),
author='Leif Johnson',
author_email='leif@leifjohnson.net',
description='Yet another OpenGL-with-physics simulation framework',
long_descriptio... | import os
import setuptools
setuptools.setup(
name='lmj.sim',
version='0.0.2',
namespace_packages=['lmj'],
packages=setuptools.find_packages(),
author='Leif Johnson',
author_email='leif@leifjohnson.net',
description='Yet another OpenGL-with-physics simulation framework',
long_descriptio... | Change dependency from PyODE to bindings included with ODE source. | Change dependency from PyODE to bindings included with ODE source.
| Python | mit | EmbodiedCognition/pagoda,EmbodiedCognition/pagoda | <REPLACE_OLD> 'PyODE'],
<REPLACE_NEW> 'Open-Dynamics-Engine'],
<REPLACE_END> <|endoftext|> import os
import setuptools
setuptools.setup(
name='lmj.sim',
version='0.0.2',
namespace_packages=['lmj'],
packages=setuptools.find_packages(),
author='Leif Johnson',
author_email='leif@leifjohnson.net'... | Change dependency from PyODE to bindings included with ODE source.
import os
import setuptools
setuptools.setup(
name='lmj.sim',
version='0.0.2',
namespace_packages=['lmj'],
packages=setuptools.find_packages(),
author='Leif Johnson',
author_email='leif@leifjohnson.net',
description='Yet an... |
2506af6a57f2c7c7e01eb4cd5e53cd200d78f54f | tests/gallery_test.py | tests/gallery_test.py | from __future__ import with_statement
from ass2m.ass2m import Ass2m
from ass2m.server import Server
from unittest import TestCase
from webtest import TestApp
from tempfile import mkdtemp
from PIL import Image
from StringIO import StringIO
import os
import shutil
class GalleryTest(TestCase):
def setUp(self):
... | Test for the gallery plugin | Test for the gallery plugin
| Python | agpl-3.0 | laurentb/assnet,laurentb/assnet | <REPLACE_OLD> <REPLACE_NEW> from __future__ import with_statement
from ass2m.ass2m import Ass2m
from ass2m.server import Server
from unittest import TestCase
from webtest import TestApp
from tempfile import mkdtemp
from PIL import Image
from StringIO import StringIO
import os
import shutil
class GalleryTest(TestCa... | Test for the gallery plugin
| |
2f27a175ffa777d4fe2aad41396e9da3f2c70216 | nbs/utils/validators.py | nbs/utils/validators.py | # -*- coding: utf-8-*-
def validate_cuit(cuit):
"from: http://python.org.ar/pyar/Recetario/ValidarCuit by Mariano Reingart"
# validaciones minimas
if len(cuit) != 13 or cuit[2] != "-" or cuit [11] != "-":
return False
base = [5, 4, 3, 2, 7, 6, 5, 4, 3, 2]
cuit = cuit.replace("-", "")
... | # -*- coding: utf-8-*-
import re
def validate_cuit(cuit):
"""
Validates CUIT (Argentina) - Clave Única de Identificación Triebutaria
from: http://python.org.ar/pyar/Recetario/ValidarCuit by Mariano Reingart
"""
cuit = str(cuit).replace("-", "") # normalize
# validaciones minimas
if not re.m... | Add cbu validator to utils module | Add cbu validator to utils module
| Python | mit | coyotevz/nobix-app | <REPLACE_OLD> utf-8-*-
def <REPLACE_NEW> utf-8-*-
import re
def <REPLACE_END> <REPLACE_OLD> "from: <REPLACE_NEW> """
Validates CUIT (Argentina) - Clave Única de Identificación Triebutaria
from: <REPLACE_END> <REPLACE_OLD> Reingart"
<REPLACE_NEW> Reingart
"""
cuit = str(cuit).replace("-", "") # norma... | Add cbu validator to utils module
# -*- coding: utf-8-*-
def validate_cuit(cuit):
"from: http://python.org.ar/pyar/Recetario/ValidarCuit by Mariano Reingart"
# validaciones minimas
if len(cuit) != 13 or cuit[2] != "-" or cuit [11] != "-":
return False
base = [5, 4, 3, 2, 7, 6, 5, 4, 3, 2]
... |
ac80535f35f42f22e85606c00deae7c0329367d9 | RainbowGenerator.py | RainbowGenerator.py | # Generate 2 colour combos from R-O-Y-G-B-Purple
# Implementation (c) 2017 Brig Young (github.com/Sonophoto)
# License: BSD-2c, i.e. Cite.
warm_colours = ["red", "orange", "yellow"]
cool_colours = ["green", "blue", "purple"]
list_of_colours = []
number_of_colours = 0
# Generate a set of colour tuples and output
for ... | Make the world a happier place with a Rainbow! | Make the world a happier place with a Rainbow!
| Python | bsd-2-clause | Sonophoto/PythonNotes,Sonophoto/PythonNotes | <INSERT> # Generate 2 colour combos from R-O-Y-G-B-Purple
# Implementation (c) 2017 Brig Young (github.com/Sonophoto)
# License: BSD-2c, i.e. Cite.
warm_colours = ["red", "orange", "yellow"]
cool_colours = ["green", "blue", "purple"]
list_of_colours = []
number_of_colours = 0
# Generate a set of colour tuples and ou... | Make the world a happier place with a Rainbow!
| |
bf069a93484bff41c7cb46975fc8c41a7280723a | pastas/version.py | pastas/version.py | # This is the only location where the version will be written and changed.
# Based on https://packaging.python.org/single_source_version/
__version__ = '0.9.4b'
| # This is the only location where the version will be written and changed.
# Based on https://packaging.python.org/single_source_version/
__version__ = '0.9.4'
| Prepare to update Master branch to v 0.9.4 | Prepare to update Master branch to v 0.9.4
| Python | mit | pastas/pasta,pastas/pastas,gwtsa/gwtsa | <REPLACE_OLD> '0.9.4b'
<REPLACE_NEW> '0.9.4'
<REPLACE_END> <|endoftext|> # This is the only location where the version will be written and changed.
# Based on https://packaging.python.org/single_source_version/
__version__ = '0.9.4'
| Prepare to update Master branch to v 0.9.4
# This is the only location where the version will be written and changed.
# Based on https://packaging.python.org/single_source_version/
__version__ = '0.9.4b'
|
707ded0f673f44b31d0762d8210a6b94074200e8 | troposphere/certificatemanager.py | troposphere/certificatemanager.py | from . import AWSObject, AWSProperty, Tags
class DomainValidationOption(AWSProperty):
props = {
'DomainName': (basestring, True),
'ValidationDomain': (basestring, True),
}
class Certificate(AWSObject):
resource_type = "AWS::CertificateManager::Certificate"
props = {
'DomainN... | # Copyright (c) 2012-2019, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
#
# *** Do not modify - this file is autogenerated ***
# Resource specification version: 15.1.0
from . import AWSObject
from . import AWSProperty
from troposphere import Tags
class DomainValidationOpti... | Update AWS::CertificateManager::Certificate per 2020-06-11 changes | Update AWS::CertificateManager::Certificate per 2020-06-11 changes
| Python | bsd-2-clause | cloudtools/troposphere,cloudtools/troposphere | <REPLACE_OLD> from <REPLACE_NEW> # Copyright (c) 2012-2019, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
#
# *** Do not modify - this file is autogenerated ***
# Resource specification version: 15.1.0
from <REPLACE_END> <REPLACE_OLD> AWSObject, AWSProperty, <REPLACE_NEW> AWS... | Update AWS::CertificateManager::Certificate per 2020-06-11 changes
from . import AWSObject, AWSProperty, Tags
class DomainValidationOption(AWSProperty):
props = {
'DomainName': (basestring, True),
'ValidationDomain': (basestring, True),
}
class Certificate(AWSObject):
resource_type = "A... |
2c2604527cfe0ceb3dbf052bbcaf9e2e660b9e47 | app.py | app.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# ephemeral by st0le
# quick way share text between your network devices
from flask import Flask, request, render_template, redirect, url_for
db = {}
app = Flask(__name__)
@app.route('/')
def get():
ip = request.remote_addr
return render_template("index.html", t... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# ephemeral by st0le
# quick way share text between your network devices
from flask import Flask, request, render_template, redirect, url_for
db = {}
app = Flask(__name__)
def get_client_ip(request):
# PythonAnywhere.com calls our service through a loabalancer
#... | Fix for PythonAnywhere LoadBalancer IP | Fix for PythonAnywhere LoadBalancer IP
| Python | mit | st0le/ephemeral,st0le/ephemeral | <REPLACE_OLD> Flask(__name__)
@app.route('/')
def <REPLACE_NEW> Flask(__name__)
def get_client_ip(request):
# PythonAnywhere.com calls our service through a loabalancer
# the remote_addr is therefore the IP of the loaabalancer, PythonAnywhere stores Client IP in header
if request.headers['X-Real-IP']: ret... | Fix for PythonAnywhere LoadBalancer IP
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ephemeral by st0le
# quick way share text between your network devices
from flask import Flask, request, render_template, redirect, url_for
db = {}
app = Flask(__name__)
@app.route('/')
def get():
ip = request.remote_addr
... |
f14913b76a4f6909130d5bf8eed9577740ff5b15 | artists/migrations/0005_auto_20170120_1802.py | artists/migrations/0005_auto_20170120_1802.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-01-20 20:02
from __future__ import unicode_literals
import artists.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('artists', '0004_auto_20170120_1647'),
]
operations = [
... | Add artist profile picture path | Add artist profile picture path
| Python | mit | perna/bandhunter,perna/bandhunter | <INSERT> # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-01-20 20:02
from __future__ import unicode_literals
import artists.models
from django.db import migrations, models
class Migration(migrations.Migration):
<INSERT_END> <INSERT> dependencies = [
('artists', '0004_auto_20170120_1647'),
... | Add artist profile picture path
| |
cc85fdf3b44b7a69b8d0406c170d409783687d2d | __TEMPLATE__.py | __TEMPLATE__.py | """Module docstring. This talks about the module."""
# -*- coding: utf-8 -*-
__author__ = """Chris Tabor (dxdstudio@gmail.com)"""
IS_MAIN = True if __name__ == '__main__' else False
if IS_MAIN:
from os import getcwd
from os import sys
sys.path.append(getcwd())
from MOAL.helpers.display import Section
... | """Module docstring. This talks about the module."""
# -*- coding: utf-8 -*-
__author__ = """Chris Tabor (dxdstudio@gmail.com)"""
IS_MAIN = True if __name__ == '__main__' else False
if IS_MAIN:
from os import getcwd
from os import sys
sys.path.append(getcwd())
from MOAL.helpers.display import Section
... | Use Docstring as default title value. | Use Docstring as default title value.
| Python | apache-2.0 | christabor/MoAL,christabor/MoAL,christabor/MoAL,christabor/MoAL,christabor/MoAL | <REPLACE_OLD> Section('SOME MODULE TITLE'):
<REPLACE_NEW> Section(__doc__):
<REPLACE_END> <|endoftext|> """Module docstring. This talks about the module."""
# -*- coding: utf-8 -*-
__author__ = """Chris Tabor (dxdstudio@gmail.com)"""
IS_MAIN = True if __name__ == '__main__' else False
if IS_MAIN:
from os impo... | Use Docstring as default title value.
"""Module docstring. This talks about the module."""
# -*- coding: utf-8 -*-
__author__ = """Chris Tabor (dxdstudio@gmail.com)"""
IS_MAIN = True if __name__ == '__main__' else False
if IS_MAIN:
from os import getcwd
from os import sys
sys.path.append(getcwd())
fro... |
a4341da7e35b95907436dfa557139dccbb03d962 | examples/red_green.py | examples/red_green.py |
# PS Move API
# Copyright (c) 2011 Thomas Perl <thp.io/about>
# All Rights Reserved
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'build'))
import time
import math
import psmove
move = psmove.PSMove()
i = 0
while True:
r = int(128+128*math.sin(i))
move.set_leds(r, 25... | Add a simple Python example | Add a simple Python example
| Python | bsd-2-clause | fourks/moveonpc,Hazer/moveonpc,seanjensengrey/moveonpc,cosmo1911/moveonpc,bab178/moveonpc,Zer01neDev/moveonpc,merryLee/moveonpc,Zer01neDev/moveonpc,fourks/moveonpc,bab178/moveonpc,merryLee/moveonpc,cosmo1911/moveonpc,seanjensengrey/moveonpc,cosmo1911/moveonpc,fourks/moveonpc,merryLee/moveonpc,seanjensengrey/moveonpc,se... | <INSERT>
# PS Move API
# Copyright (c) 2011 Thomas Perl <thp.io/about>
# All Rights Reserved
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'build'))
import time
import math
import psmove
move = psmove.PSMove()
i = 0
while True:
<INSERT_END> <INSERT> r = int(128+128*math.s... | Add a simple Python example
| |
1eaab9f929dc748e57865fb4c8717158e6c47fa5 | ureport/stats/migrations/0018_better_indexes.py | ureport/stats/migrations/0018_better_indexes.py | # Generated by Django 3.2.6 on 2021-10-13 12:37
from django.db import migrations
# language=SQL
INDEX_SQL_CONTACTACTIVITY_ORG_DATE_SCHEME_NOT_NULL = """
CREATE INDEX IF NOT EXISTS stats_contactactivity_org_id_date_scheme_not_null on stats_contactactivity (org_id, date, scheme) WHERE scheme IS NOT NULL;
"""
class Mi... | Add more index on contact activities | Add more index on contact activities
| Python | agpl-3.0 | rapidpro/ureport,Ilhasoft/ureport,Ilhasoft/ureport,rapidpro/ureport,rapidpro/ureport,Ilhasoft/ureport,Ilhasoft/ureport,rapidpro/ureport | <INSERT> # Generated by Django 3.2.6 on 2021-10-13 12:37
from django.db import migrations
# language=SQL
INDEX_SQL_CONTACTACTIVITY_ORG_DATE_SCHEME_NOT_NULL = """
CREATE INDEX IF NOT EXISTS stats_contactactivity_org_id_date_scheme_not_null on stats_contactactivity (org_id, date, scheme) WHERE scheme IS NOT NULL;
"""
... | Add more index on contact activities
| |
52a4a10d54374b08c5835d02077fd1edcdc547ac | tests/test_union_energy_grids/results.py | tests/test_union_energy_grids/results.py | #!/usr/bin/env python
import sys
# import statepoint
sys.path.insert(0, '../../src/utils')
import statepoint
# read in statepoint file
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.10.binary')
sp.read_results()
# set up output string
outstr = ''
... | #!/usr/bin/env python
import sys
sys.path.insert(0, '../../src/utils')
from openmc.statepoint import StatePoint
# read in statepoint file
if len(sys.argv) > 1:
print(sys.argv)
sp = StatePoint(sys.argv[1])
else:
sp = StatePoint('statepoint.10.binary')
sp.read_results()
# set up output string
outstr = ''
... | Fix import for statepoint for test_union_energy_grids | Fix import for statepoint for test_union_energy_grids
| Python | mit | smharper/openmc,paulromano/openmc,mit-crpg/openmc,bhermanmit/openmc,wbinventor/openmc,paulromano/openmc,samuelshaner/openmc,mit-crpg/openmc,smharper/openmc,samuelshaner/openmc,johnnyliu27/openmc,mit-crpg/openmc,lilulu/openmc,walshjon/openmc,shikhar413/openmc,liangjg/openmc,shikhar413/openmc,walshjon/openmc,paulromano/o... | <REPLACE_OLD> sys
# <REPLACE_NEW> sys
sys.path.insert(0, '../../src/utils')
from openmc.statepoint <REPLACE_END> <REPLACE_OLD> statepoint
sys.path.insert(0, '../../src/utils')
import statepoint
# <REPLACE_NEW> StatePoint
# <REPLACE_END> <REPLACE_OLD> sp = statepoint.StatePoint(sys.argv[1])
else:
<REPLACE_NEW> prin... | Fix import for statepoint for test_union_energy_grids
#!/usr/bin/env python
import sys
# import statepoint
sys.path.insert(0, '../../src/utils')
import statepoint
# read in statepoint file
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.10.binary')
... |
6e540d7125e76c2d4d7d06662ab283a5d698c86b | setup.py | setup.py | from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
import sys
requirements = [line.strip() for line in open('requirements.txt').readlines()]
class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = [... | from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
import sys
requirements = [line.strip() for line in open('requirements.txt').readlines()]
class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = [... | Add correct path to tests | Add correct path to tests
| Python | mit | tcmoore3/linear_solver | <REPLACE_OLD> pytest.main(['linear_solver'])
<REPLACE_NEW> pytest.main(['linear_solver/tests/tests.py'])
<REPLACE_END> <|endoftext|> from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
import sys
requirements = [line.strip() for line in open('requirements.txt').readlin... | Add correct path to tests
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
import sys
requirements = [line.strip() for line in open('requirements.txt').readlines()]
class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)... |
118523251af8861d20b92ce754b48e9911f100c7 | odsimport.py | odsimport.py | from odf.opendocument import load
from odf.table import Table, TableRow, TableCell
from odf.text import P
def import_ods(path):
doc = load(path)
db = {}
tables = doc.spreadsheet.getElementsByType(Table)
for table in tables:
db_table = []
db[table.getAttribute('name')] = db_table
... | from odf.opendocument import load
from odf.table import Table, TableRow, TableCell
from odf.namespaces import TABLENS
from odf.text import P
def import_ods(path):
doc = load(path)
db = {}
tables = doc.spreadsheet.getElementsByType(Table)
for table in tables:
db_table = []
db[table.ge... | Fix ods-import for column repeat | Fix ods-import for column repeat
| Python | bsd-2-clause | aholkner/PoliticalRPG,aholkner/PoliticalRPG | <INSERT> odf.namespaces import TABLENS
from <INSERT_END> <INSERT>
try:
repeat_count = int(cell.getAttribute('numbercolumnsrepeated'))
except:
repeat_count = 1
if not cell.nextSibling:
repeat_count = 1
... | Fix ods-import for column repeat
from odf.opendocument import load
from odf.table import Table, TableRow, TableCell
from odf.text import P
def import_ods(path):
doc = load(path)
db = {}
tables = doc.spreadsheet.getElementsByType(Table)
for table in tables:
db_table = []
db[table.getA... |
1da0f795cdedd1de3bdcc03d6171f9a143ee8e5b | backdrop/admin/config/development.py | backdrop/admin/config/development.py | LOG_LEVEL = "DEBUG"
SINGLE_SIGN_ON = True
BACKDROP_ADMIN_UI_HOST = "http://backdrop-admin.dev.gov.uk"
ALLOW_TEST_SIGNIN=True
SECRET_KEY = "something unique and secret"
DATABASE_NAME = "backdrop"
MONGO_HOST = 'localhost'
MONGO_PORT = 27017
try:
from development_environment import *
except ImportError:
from dev... | LOG_LEVEL = "DEBUG"
BACKDROP_ADMIN_UI_HOST = "http://backdrop-admin.dev.gov.uk"
ALLOW_TEST_SIGNIN=True
SECRET_KEY = "something unique and secret"
DATABASE_NAME = "backdrop"
MONGO_HOST = 'localhost'
MONGO_PORT = 27017
try:
from development_environment import *
except ImportError:
from development_environment_s... | Remove flag to enable single sign on | Remove flag to enable single sign on
| Python | mit | alphagov/backdrop,alphagov/backdrop,alphagov/backdrop | <REPLACE_OLD> "DEBUG"
SINGLE_SIGN_ON = True
BACKDROP_ADMIN_UI_HOST <REPLACE_NEW> "DEBUG"
BACKDROP_ADMIN_UI_HOST <REPLACE_END> <|endoftext|> LOG_LEVEL = "DEBUG"
BACKDROP_ADMIN_UI_HOST = "http://backdrop-admin.dev.gov.uk"
ALLOW_TEST_SIGNIN=True
SECRET_KEY = "something unique and secret"
DATABASE_NAME = "backdrop"
MONGO_... | Remove flag to enable single sign on
LOG_LEVEL = "DEBUG"
SINGLE_SIGN_ON = True
BACKDROP_ADMIN_UI_HOST = "http://backdrop-admin.dev.gov.uk"
ALLOW_TEST_SIGNIN=True
SECRET_KEY = "something unique and secret"
DATABASE_NAME = "backdrop"
MONGO_HOST = 'localhost'
MONGO_PORT = 27017
try:
from development_environment imp... |
53cae8a7d95832a0f95a537468552254028a0668 | tests/system/test_auth.py | tests/system/test_auth.py | import pytest
from inbox.models.session import session_scope
from client import InboxTestClient
from conftest import (timeout_loop, credentials, create_account, API_BASE)
@timeout_loop('sync_start')
def wait_for_sync_start(client):
return True if client.messages.first() else False
@timeout_loop('auth')
def wai... | import pytest
from inbox.models.session import session_scope
from client import InboxTestClient
from conftest import (timeout_loop, credentials, create_account, API_BASE)
from accounts import broken_credentials
@timeout_loop('sync_start')
def wait_for_sync_start(client):
return True if client.messages.first() el... | Add a system test to check for expected broken accounts | Add a system test to check for expected broken accounts
Summary:
This is the system test for D765 and finishes up the sync engine side
of T495 - checking for All Mail folder and failing gracefully if it's
absent.
This test specifically adds another check in `test_auth` based on a
new list of live, bad credentials in ... | Python | agpl-3.0 | gale320/sync-engine,Eagles2F/sync-engine,wakermahmud/sync-engine,nylas/sync-engine,ErinCall/sync-engine,wakermahmud/sync-engine,EthanBlackburn/sync-engine,closeio/nylas,jobscore/sync-engine,jobscore/sync-engine,Eagles2F/sync-engine,wakermahmud/sync-engine,closeio/nylas,nylas/sync-engine,EthanBlackburn/sync-engine,waker... | <REPLACE_OLD> API_BASE)
@timeout_loop('sync_start')
def <REPLACE_NEW> API_BASE)
from accounts import broken_credentials
@timeout_loop('sync_start')
def <REPLACE_END> <REPLACE_OLD> wait_for_sync_start(client)
<REPLACE_NEW> wait_for_sync_start(client)
errors = __import__('inbox.basicauth', fromlist=['basicauth'])
... | Add a system test to check for expected broken accounts
Summary:
This is the system test for D765 and finishes up the sync engine side
of T495 - checking for All Mail folder and failing gracefully if it's
absent.
This test specifically adds another check in `test_auth` based on a
new list of live, bad credentials in ... |
3ca3f9473d7031ef9536f56c253ba0a4b7e1ee6e | test/unit/ggrc/converters/test_query_helper.py | test/unit/ggrc/converters/test_query_helper.py | # Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
import unittest
import mock
from ggrc.converters import query_helper
class TestQueryHelper(unittest.TestCase):
def test_expression_keys(self):
""" test expression keys function
Make sure it wo... | # Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
import unittest
import mock
from ggrc.converters import query_helper
class TestQueryHelper(unittest.TestCase):
def test_expression_keys(self):
""" test expression keys function
Make sure it wo... | Update unit tests with new query helper names | Update unit tests with new query helper names
| Python | apache-2.0 | j0gurt/ggrc-core,AleksNeStu/ggrc-core,plamut/ggrc-core,j0gurt/ggrc-core,edofic/ggrc-core,andrei-karalionak/ggrc-core,josthkko/ggrc-core,andrei-karalionak/ggrc-core,AleksNeStu/ggrc-core,VinnieJohns/ggrc-core,AleksNeStu/ggrc-core,selahssea/ggrc-core,andrei-karalionak/ggrc-core,plamut/ggrc-core,plamut/ggrc-core,josthkko/g... | <INSERT> # pylint: disable=protected-access
# needed for testing protected function inside the query helper
<INSERT_END> <REPLACE_OLD> helper.expression_keys(expression))
<REPLACE_NEW> helper._expression_keys(expression))
<REPLACE_END> <|endoftext|> # Copyright (C) 2016 Google Inc.
# Licensed under http://www... | Update unit tests with new query helper names
# Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
import unittest
import mock
from ggrc.converters import query_helper
class TestQueryHelper(unittest.TestCase):
def test_expression_keys(self):
""" tes... |
3b047ef48ae89d49d98675a0720a856cee829deb | scripts/read_kest.py | scripts/read_kest.py | """
Reads thermal conductivity and statistics for a list of trials and saves results to a yaml file
"""
import os
import yaml
from thermof.parameters import k_parameters
from thermof.read import read_run_info, read_trial
# ---------------------------------------------------
main = '' ... | Add script for reading k for list of trials | Add script for reading k for list of trials
| Python | mit | kbsezginel/tee_mof,kbsezginel/tee_mof | <REPLACE_OLD> <REPLACE_NEW> """
Reads thermal conductivity and statistics for a list of trials and saves results to a yaml file
"""
import os
import yaml
from thermof.parameters import k_parameters
from thermof.read import read_run_info, read_trial
# ---------------------------------------------------
main =... | Add script for reading k for list of trials
| |
32637c1e9a37dc416df802805420d38f9af18d79 | django_lightweight_queue/management/commands/queue_configuration.py | django_lightweight_queue/management/commands/queue_configuration.py | from django.core.management.base import BaseCommand
from ... import app_settings
from ...utils import get_backend, load_extra_config
from ...cron_scheduler import get_cron_config
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('--config', action='store', default=None,
... | from django.core.management.base import BaseCommand
from ... import app_settings
from ...utils import get_backend, load_extra_config
from ...cron_scheduler import get_cron_config
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('--config', action='store', default=None,
... | Print the discovered queues in alphabetical order for convenience | Print the discovered queues in alphabetical order for convenience
| Python | bsd-3-clause | thread/django-lightweight-queue,thread/django-lightweight-queue | <REPLACE_OLD> app_settings.WORKERS.items():
<REPLACE_NEW> sorted(app_settings.WORKERS.items()):
<REPLACE_END> <|endoftext|> from django.core.management.base import BaseCommand
from ... import app_settings
from ...utils import get_backend, load_extra_config
from ...cron_scheduler import get_cron_config
class Comman... | Print the discovered queues in alphabetical order for convenience
from django.core.management.base import BaseCommand
from ... import app_settings
from ...utils import get_backend, load_extra_config
from ...cron_scheduler import get_cron_config
class Command(BaseCommand):
def add_arguments(self, parser):
... |
f306b2145d5bff7a3d399e14b60274c58c3bf098 | scripts/tests/test_box_migrate_to_external_account.py | scripts/tests/test_box_migrate_to_external_account.py | from nose.tools import *
from scripts.box.migrate_to_external_account import do_migration, get_targets
from framework.auth import Auth
from tests.base import OsfTestCase
from tests.factories import ProjectFactory, UserFactory
from website.addons.box.model import BoxUserSettings
from website.addons.box.tests.factori... | Add test for box migration script | Add test for box migration script
| Python | apache-2.0 | KAsante95/osf.io,aaxelb/osf.io,Nesiehr/osf.io,emetsger/osf.io,Nesiehr/osf.io,chrisseto/osf.io,Nesiehr/osf.io,saradbowman/osf.io,SSJohns/osf.io,binoculars/osf.io,mluo613/osf.io,leb2dg/osf.io,wearpants/osf.io,HalcyonChimera/osf.io,amyshi188/osf.io,kch8qx/osf.io,acshi/osf.io,saradbowman/osf.io,haoyuchen1992/osf.io,CenterF... | <REPLACE_OLD> <REPLACE_NEW> from nose.tools import *
from scripts.box.migrate_to_external_account import do_migration, get_targets
from framework.auth import Auth
from tests.base import OsfTestCase
from tests.factories import ProjectFactory, UserFactory
from website.addons.box.model import BoxUserSettings
from web... | Add test for box migration script
| |
16d99a20088e81045e34999b6045e9222d510cd5 | app.py | app.py | # -*- coding: UTF-8 -*-
"""
trytond_async.celery
Implementation of the celery app
This module is named celery because of the way celery workers lookup
the app when `--proj` argument is passed to the worker. For more details
see the celery documentation at:
http://docs.celeryproject.org/en/late... | # -*- coding: UTF-8 -*-
"""
trytond_async.celery
Implementation of the celery app
This module is named celery because of the way celery workers lookup
the app when `--proj` argument is passed to the worker. For more details
see the celery documentation at:
http://docs.celeryproject.org/en/late... | Use raven for logging if available | Use raven for logging if available
| Python | bsd-3-clause | fulfilio/trytond-async,tarunbhardwaj/trytond-async | <REPLACE_OLD> config
config.update_etc()
broker_url <REPLACE_NEW> config
try:
from raven import Client
from raven.contrib.celery import register_signal
except ImportError:
pass
else:
if os.environ.get('SENTRY_DSN'):
register_signal(Client(os.environ.get('SENTRY_DSN')))
config.update_etc()
... | Use raven for logging if available
# -*- coding: UTF-8 -*-
"""
trytond_async.celery
Implementation of the celery app
This module is named celery because of the way celery workers lookup
the app when `--proj` argument is passed to the worker. For more details
see the celery documentation at:
h... |
c4809f9f43129d092235738127b90dc62f593fb8 | steinie/app.py | steinie/app.py | from werkzeug import routing
from werkzeug import serving
from werkzeug import wrappers
from . import routes
class Steinie(routes.Router):
def __init__(self, host="127.0.0.1", port=5151, debug=False):
self.host = host
self.port = port
self.debug = debug
super(Steinie, self).__init... | from werkzeug import routing
from werkzeug import serving
from werkzeug import wrappers
from . import routes
class Steinie(routes.Router):
def __init__(self, host="127.0.0.1", port=5151, debug=False):
self.host = host
self.port = port
self.debug = debug
super(Steinie, self).__init... | Remove some commented out code | Remove some commented out code
| Python | apache-2.0 | tswicegood/steinie,tswicegood/steinie | <DELETE> # if not route.endswith('/'):
# route += '/'
<DELETE_END> <DELETE> # import ipdb; ipdb.set_trace()
<DELETE_END> <|endoftext|> from werkzeug import routing
from werkzeug import serving
from werkzeug import wrappers
from . import routes
class Steinie(routes.Router):
def __init_... | Remove some commented out code
from werkzeug import routing
from werkzeug import serving
from werkzeug import wrappers
from . import routes
class Steinie(routes.Router):
def __init__(self, host="127.0.0.1", port=5151, debug=False):
self.host = host
self.port = port
self.debug = debug
... |
3fb56e434182e5b28dcad0c547b0326ebe5be352 | main.py | main.py | from createCollection import createCollectionFile
from ObjectFactories.ItemFactory import ItemFactory
from DataObjects.Collection import Collection
import datetime, json, os.path, argparse
CONST_COLLECTIONS_NAME = 'collections'
def generateArgumentsFromParser():
parser = parser = argparse.ArgumentParser(descripti... | from createCollection import createCollectionFile
from ObjectFactories.ItemFactory import ItemFactory
from DataObjects.Collection import Collection
import datetime, json, os.path, argparse
CONST_COLLECTIONS_NAME = 'collections'
def generateArgumentsFromParser():
parser = parser = argparse.ArgumentParser(descripti... | Refactor create action into function | Refactor create action into function
| Python | apache-2.0 | AmosGarner/PyInventory | <INSERT> writeCollectionToFile(collectionFileName, arguments):
collection = generateNewCollection(arguments.username, arguments.collectionType, arguments.collectionName)
collectionFile = open(collectionFileName, 'w')
collectionFile.write(collection.toJSON())
collectionFile.close()
def <INSERT_END> <REP... | Refactor create action into function
from createCollection import createCollectionFile
from ObjectFactories.ItemFactory import ItemFactory
from DataObjects.Collection import Collection
import datetime, json, os.path, argparse
CONST_COLLECTIONS_NAME = 'collections'
def generateArgumentsFromParser():
parser = pars... |
39bc88808d9286f7d6a74120b8d8bade9888e41c | example_app/app.py | example_app/app.py | """This is an example app, demonstrating usage."""
import os
from flask import Flask
from flask_jsondash.charts_builder import charts
app = Flask(__name__)
app.config['SECRET_KEY'] = 'NOTSECURELOL'
app.config.update(
JSONDASH_FILTERUSERS=False,
JSONDASH_GLOBALDASH=False,
JSONDASH_GLOBAL_USER='global',
)... | """This is an example app, demonstrating usage."""
import os
from flask import Flask
from flask_jsondash.charts_builder import charts
app = Flask(__name__)
app.config['SECRET_KEY'] = 'NOTSECURELOL'
app.config.update(
JSONDASH_FILTERUSERS=False,
JSONDASH_GLOBALDASH=True,
JSONDASH_GLOBAL_USER='global',
)
... | Enable global by default in example. | Enable global by default in example.
| Python | mit | christabor/flask_jsondash,christabor/flask_jsondash,christabor/flask_jsondash | <REPLACE_OLD> JSONDASH_GLOBALDASH=False,
<REPLACE_NEW> JSONDASH_GLOBALDASH=True,
<REPLACE_END> <|endoftext|> """This is an example app, demonstrating usage."""
import os
from flask import Flask
from flask_jsondash.charts_builder import charts
app = Flask(__name__)
app.config['SECRET_KEY'] = 'NOTSECURELOL'
app.con... | Enable global by default in example.
"""This is an example app, demonstrating usage."""
import os
from flask import Flask
from flask_jsondash.charts_builder import charts
app = Flask(__name__)
app.config['SECRET_KEY'] = 'NOTSECURELOL'
app.config.update(
JSONDASH_FILTERUSERS=False,
JSONDASH_GLOBALDASH=False... |
502ef2c155aeaed7a2b9a2e4ad0471f34ef3790f | app/utils/utilities.py | app/utils/utilities.py | from re import search
from flask import g
from flask_restplus import abort
from flask_httpauth import HTTPBasicAuth
from app.models.user import User
from instance.config import Config
auth = HTTPBasicAuth() | from re import search
from flask import g
from flask_restplus import abort
from flask_httpauth import HTTPBasicAuth
from app.models.user import User
from instance.config import Config
auth = HTTPBasicAuth()
def validate_email(email):
''' Method to check that a valid email is provided '''
email_re = r"(^[a-zA-Z0... | Add validate_email and verify_token methods Methods to be used to: - check that a valid email is provided - check the token authenticity | Add validate_email and verify_token methods
Methods to be used to:
- check that a valid email is provided
- check the token authenticity
| Python | mit | Elbertbiggs360/buckelist-api | <REPLACE_OLD> HTTPBasicAuth() <REPLACE_NEW> HTTPBasicAuth()
def validate_email(email):
''' Method to check that a valid email is provided '''
email_re = r"(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)"
return True if search(email_re, email) else False
@auth.verify_token
def verify_token(token=None):
... | Add validate_email and verify_token methods
Methods to be used to:
- check that a valid email is provided
- check the token authenticity
from re import search
from flask import g
from flask_restplus import abort
from flask_httpauth import HTTPBasicAuth
from app.models.user import User
from instance.config import Con... |
9a30728493258d7dcf60b67a8c87489e1457df1a | kitchen/dashboard/templatetags/filters.py | kitchen/dashboard/templatetags/filters.py | """Dashboard template filters"""
from django import template
import littlechef
from kitchen.settings import REPO
register = template.Library()
@register.filter(name='get_role_list')
def get_role_list(run_list):
"""Returns the role sublist from the given run_list"""
prev_role_list = littlechef.lib.get_roles_... | """Dashboard template filters"""
from django import template
import littlechef
from kitchen.settings import REPO
register = template.Library()
@register.filter(name='get_role_list')
def get_role_list(run_list):
"""Returns the role sublist from the given run_list"""
if run_list:
all_roles = littleche... | Check 'role_list' before sending it to little_chef | Check 'role_list' before sending it to little_chef
| Python | apache-2.0 | edelight/kitchen,edelight/kitchen,edelight/kitchen,edelight/kitchen | <REPLACE_OLD> prev_role_list <REPLACE_NEW> if run_list:
all_roles <REPLACE_END> <REPLACE_OLD> littlechef.lib.get_roles_in_node({'run_list': <REPLACE_NEW> littlechef.lib.get_roles_in_node(
{'run_list': <REPLACE_END> <INSERT> <INSERT_END> <INSERT> <INSERT_END> <REPLACE_OLD> prev_role_list:
<R... | Check 'role_list' before sending it to little_chef
"""Dashboard template filters"""
from django import template
import littlechef
from kitchen.settings import REPO
register = template.Library()
@register.filter(name='get_role_list')
def get_role_list(run_list):
"""Returns the role sublist from the given run_li... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.