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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
0ebac1925b3d4b32188a6f2c9e40760b21d933ce | backend/uclapi/dashboard/app_helpers.py | backend/uclapi/dashboard/app_helpers.py | from binascii import hexlify
import os
def generate_api_token():
key = hexlify(os.urandom(30)).decode()
dashes_key = ""
for idx, char in enumerate(key):
if idx % 15 == 0 and idx != len(key)-1:
dashes_key += "-"
else:
dashes_key += char
final = "uclapi" + dashes... | from binascii import hexlify
from random import choice
import os
import string
def generate_api_token():
key = hexlify(os.urandom(30)).decode()
dashes_key = ""
for idx, char in enumerate(key):
if idx % 15 == 0 and idx != len(key)-1:
dashes_key += "-"
else:
dashes_k... | Add helpers to the dashboard code to generate OAuth keys | Add helpers to the dashboard code to generate OAuth keys
| Python | mit | uclapi/uclapi,uclapi/uclapi,uclapi/uclapi,uclapi/uclapi | <REPLACE_OLD> hexlify
import os
def <REPLACE_NEW> hexlify
from random import choice
import os
import string
def <REPLACE_END> <REPLACE_OLD> final
<REPLACE_NEW> final
def generate_app_client_id():
client_id = ''.join(random.choice(string.digits, k=16))
client_id += "."
client_id += ''.join(random.choi... | Add helpers to the dashboard code to generate OAuth keys
from binascii import hexlify
import os
def generate_api_token():
key = hexlify(os.urandom(30)).decode()
dashes_key = ""
for idx, char in enumerate(key):
if idx % 15 == 0 and idx != len(key)-1:
dashes_key += "-"
else:
... |
6602471252a7c8e3dd3ab94db54e45fccfc6e62f | yarn_api_client/__init__.py | yarn_api_client/__init__.py | # -*- coding: utf-8 -*-
__version__ = '0.3.6'
__all__ = ['ApplicationMaster', 'HistoryServer', 'NodeManager', 'ResourceManager']
from .application_master import ApplicationMaster
from .history_server import HistoryServer
from .node_manager import NodeManager
from .resource_manager import ResourceManager
| # -*- coding: utf-8 -*-
__version__ = '0.3.7.dev'
__all__ = ['ApplicationMaster', 'HistoryServer', 'NodeManager', 'ResourceManager']
from .application_master import ApplicationMaster
from .history_server import HistoryServer
from .node_manager import NodeManager
from .resource_manager import ResourceManager
| Prepare for next development iteration | Prepare for next development iteration
| Python | bsd-3-clause | toidi/hadoop-yarn-api-python-client | <REPLACE_OLD> '0.3.6'
__all__ <REPLACE_NEW> '0.3.7.dev'
__all__ <REPLACE_END> <|endoftext|> # -*- coding: utf-8 -*-
__version__ = '0.3.7.dev'
__all__ = ['ApplicationMaster', 'HistoryServer', 'NodeManager', 'ResourceManager']
from .application_master import ApplicationMaster
from .history_server import HistoryServer
fr... | Prepare for next development iteration
# -*- coding: utf-8 -*-
__version__ = '0.3.6'
__all__ = ['ApplicationMaster', 'HistoryServer', 'NodeManager', 'ResourceManager']
from .application_master import ApplicationMaster
from .history_server import HistoryServer
from .node_manager import NodeManager
from .resource_manag... |
9baf9ede15fa988b5da711605b67cc5bbbbc5b36 | wanorlan/wanorlan.py | wanorlan/wanorlan.py | import time
import datetime
import subprocess
import json
import sys
import re
PING_RTT_REGEX = re.compile('rtt.+=\s*([\d.]+)')
def get_status(ip, timeout):
t0 = time.time()
error = subprocess.call(['ping', '-c', '1', '-W', str(timeout), ip],
stdout=sys.stderr.fileno(),
... | Add simple script for logging to diagnose WAN vs LAN connection issues | Add simple script for logging to diagnose WAN vs LAN connection issues
| Python | mit | DouglasOrr/Snippets,DouglasOrr/Snippets,DouglasOrr/Snippets,DouglasOrr/Snippets,DouglasOrr/Snippets,DouglasOrr/Snippets,DouglasOrr/Snippets,DouglasOrr/Snippets | <REPLACE_OLD> <REPLACE_NEW> import time
import datetime
import subprocess
import json
import sys
import re
PING_RTT_REGEX = re.compile('rtt.+=\s*([\d.]+)')
def get_status(ip, timeout):
t0 = time.time()
error = subprocess.call(['ping', '-c', '1', '-W', str(timeout), ip],
stdout=s... | Add simple script for logging to diagnose WAN vs LAN connection issues
| |
bef2796fc1df98d15c7198ee26b2526f42150b59 | infrastructure/migrations/0016_auto_20210907_0131.py | infrastructure/migrations/0016_auto_20210907_0131.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2021-09-06 23:31
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('infrastructure', '0015_financialyear_active'),
]
... | Add migration for annual spend changes | Add migration for annual spend changes
| Python | mit | Code4SA/municipal-data,Code4SA/municipal-data,Code4SA/municipal-data,Code4SA/municipal-data | <REPLACE_OLD> <REPLACE_NEW> # -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2021-09-06 23:31
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('infrastructure', '0015_financ... | Add migration for annual spend changes
| |
842007194a9a5736d8e33d6152cd1bfe934e24bc | smashcache/cache/filler.py | smashcache/cache/filler.py | # Copyright (c) 2015 Sachi King
#
# 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... | # Copyright (c) 2015 Sachi King
#
# 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... | Fix print with subsition instead of concat | Fix print with subsition instead of concat
| Python | apache-2.0 | nakato/smashcache | <REPLACE_OLD> returned" + <REPLACE_NEW> returned %s" % <REPLACE_END> <|endoftext|> # Copyright (c) 2015 Sachi King
#
# 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... | Fix print with subsition instead of concat
# Copyright (c) 2015 Sachi King
#
# 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 requir... |
d5049edc8567cebf936bb07847906c5400f9a6d9 | ceph_deploy/tests/unit/hosts/test_suse.py | ceph_deploy/tests/unit/hosts/test_suse.py | from ceph_deploy.hosts import suse
class TestSuseInit(object):
def setup(self):
self.host = suse
def test_choose_init_default(self):
self.host.release = None
init_type = self.host.choose_init()
assert init_type == "sysvinit"
def test_choose_init_SLE_11(self):
... | from ceph_deploy.hosts import suse
from ceph_deploy.hosts.suse.install import map_components
class TestSuseInit(object):
def setup(self):
self.host = suse
def test_choose_init_default(self):
self.host.release = None
init_type = self.host.choose_init()
assert init_type == "sysv... | Add tests for component to SUSE package mapping | Add tests for component to SUSE package mapping
Signed-off-by: David Disseldorp <589a549dc9f982d9f46aeeb82a09ab6d87ccf1d8@suse.de>
| Python | mit | zhouyuan/ceph-deploy,shenhequnying/ceph-deploy,ceph/ceph-deploy,ghxandsky/ceph-deploy,zhouyuan/ceph-deploy,imzhulei/ceph-deploy,SUSE/ceph-deploy,Vicente-Cheng/ceph-deploy,ceph/ceph-deploy,branto1/ceph-deploy,trhoden/ceph-deploy,trhoden/ceph-deploy,osynge/ceph-deploy,ghxandsky/ceph-deploy,SUSE/ceph-deploy,branto1/ceph-d... | <REPLACE_OLD>
class <REPLACE_NEW>
from ceph_deploy.hosts.suse.install import map_components
class <REPLACE_END> <REPLACE_OLD> "systemd"
<REPLACE_NEW> "systemd"
class TestSuseMapComponents(object):
def test_valid(self):
pkgs = map_components(['ceph-osd', 'ceph-common', 'ceph-radosgw'])
assert '... | Add tests for component to SUSE package mapping
Signed-off-by: David Disseldorp <589a549dc9f982d9f46aeeb82a09ab6d87ccf1d8@suse.de>
from ceph_deploy.hosts import suse
class TestSuseInit(object):
def setup(self):
self.host = suse
def test_choose_init_default(self):
self.host.release = None
... |
b74be667803abed58c08a298d5a806692d2fab74 | setup.py | setup.py | #!/usr/bin/env python
# -*- coding: utf8 -*-
import os.path
from setuptools import setup, find_packages
def get_version():
"""
Loads the current module version from version.py and returns
it.
:returns: module version identifier.
:rtype: str
"""
local_results = {}
version_file_path = o... | #!/usr/bin/env python
# -*- coding: utf8 -*-
import os.path
from setuptools import setup, find_packages
def get_version():
"""
Loads the current module version from version.py and returns
it.
:returns: module version identifier.
:rtype: str
"""
local_results = {}
version_file_path = o... | Use README.md for the long description. | Use README.md for the long description.
| Python | mit | TkTech/pytextql | <INSERT> with open('README.md', 'rb') as readme:
long_description = readme.read()
<INSERT_END> <REPLACE_OLD> long_description=__doc__,
<REPLACE_NEW> long_description=long_description,
<REPLACE_END> <|endoftext|> #!/usr/bin/env python
# -*- coding: utf8 -*-
import os.path
from setuptools import setup, fin... | Use README.md for the long description.
#!/usr/bin/env python
# -*- coding: utf8 -*-
import os.path
from setuptools import setup, find_packages
def get_version():
"""
Loads the current module version from version.py and returns
it.
:returns: module version identifier.
:rtype: str
"""
loc... |
e2ce9ad697cd686e91b546f6f3aa7b24b5e9266f | masters/master.tryserver.chromium.angle/master_site_config.py | masters/master.tryserver.chromium.angle/master_site_config.py | # Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""ActiveMaster definition."""
from config_bootstrap import Master
class TryServerANGLE(Master.Master4a):
project_name = 'ANGLE Try Server'
master_port... | # Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""ActiveMaster definition."""
from config_bootstrap import Master
class TryServerANGLE(Master.Master4a):
project_name = 'ANGLE Try Server'
master_port... | Add buildbucket service account to Angle master. | Add buildbucket service account to Angle master.
BUG=577560
TBR=nodir@chromium.org
Review URL: https://codereview.chromium.org/1624703003
git-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@298368 0039d316-1c4b-4281-b951-d872f2087c98
| Python | bsd-3-clause | eunchong/build,eunchong/build,eunchong/build,eunchong/build | <INSERT> service_account_file = 'service-account-chromium-tryserver.json'
buildbucket_bucket = 'master.tryserver.chromium.linux'
<INSERT_END> <|endoftext|> # Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file... | Add buildbucket service account to Angle master.
BUG=577560
TBR=nodir@chromium.org
Review URL: https://codereview.chromium.org/1624703003
git-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@298368 0039d316-1c4b-4281-b951-d872f2087c98
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source ... |
528759e6ba579de185616190e3e514938989a54e | tests/console/asciimatics/widgets/testcheckbox.py | tests/console/asciimatics/widgets/testcheckbox.py |
from scriptcore.testing.testcase import TestCase
from scriptcore.console.asciimatics.widgets.checkbox import CheckBox
from asciimatics.widgets import CheckBox as ACheckBox
class TestCheckBox(TestCase):
def test_checkbox(self):
"""
Test the checkbox
:return: void
"""
c... |
from scriptcore.testing.testcase import TestCase
from scriptcore.console.asciimatics.widgets.checkbox import CheckBox
from asciimatics.widgets import CheckBox as ACheckBox
class TestCheckBox(TestCase):
def test_checkbox(self):
"""
Test the checkbox
:return: void
"""
c... | Check if checkbox value has updated. | Check if checkbox value has updated.
| Python | apache-2.0 | LowieHuyghe/script-core | <INSERT> self.assert_equal(value, checkbox.value)
<INSERT_END> <|endoftext|>
from scriptcore.testing.testcase import TestCase
from scriptcore.console.asciimatics.widgets.checkbox import CheckBox
from asciimatics.widgets import CheckBox as ACheckBox
class TestCheckBox(TestCase):
def test_checkbox(sel... | Check if checkbox value has updated.
from scriptcore.testing.testcase import TestCase
from scriptcore.console.asciimatics.widgets.checkbox import CheckBox
from asciimatics.widgets import CheckBox as ACheckBox
class TestCheckBox(TestCase):
def test_checkbox(self):
"""
Test the checkbox
:... |
32ea27cfa3994984d8d8f8db09522f6c31b0524f | every_election/apps/organisations/migrations/0059_add_sennedd_to_org_types.py | every_election/apps/organisations/migrations/0059_add_sennedd_to_org_types.py | # Generated by Django 2.2.16 on 2020-12-18 09:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("organisations", "0058_remove_division_organisation_fk"),
]
operations = [
migrations.AlterField(
model_name="organisation",
... | Add 'senedd' to choices for organisation_type | Add 'senedd' to choices for organisation_type
| Python | bsd-3-clause | DemocracyClub/EveryElection,DemocracyClub/EveryElection,DemocracyClub/EveryElection | <REPLACE_OLD> <REPLACE_NEW> # Generated by Django 2.2.16 on 2020-12-18 09:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("organisations", "0058_remove_division_organisation_fk"),
]
operations = [
migrations.AlterField(
m... | Add 'senedd' to choices for organisation_type
| |
536bdc4e3ca9c68621d518cdaea8b119301f2dc3 | plugins/linux/lxde_set_wallpaper.py | plugins/linux/lxde_set_wallpaper.py | import os
import sys
from .. import SetWallpaper
class LXDESetWallpaper(SetWallpaper):
def __init__(self, config):
super(LXDESetWallpaper, self).__init__(config)
def platform_check(self):
return sys.platform == 'linux2' and self.config['linux.desktop-environment'] == 'lxde'
def set(self)... | import sys
from .. import SetWallpaper
class LXDESetWallpaper(SetWallpaper):
def __init__(self, config):
super(LXDESetWallpaper, self).__init__(config)
self.cycle = 0
def platform_check(self):
return sys.platform == 'linux2' and self.config['linux.desktop-environment'] == 'lxde'
... | Revert "Conforming LXDESetWallpaper plugin to conform with keep option (DarwinSetWallpaper), also FastForward merge" | Revert "Conforming LXDESetWallpaper plugin to conform with keep option (DarwinSetWallpaper), also FastForward merge"
This reverts commit 7212d223fe95d3042348bb29d9bd353308be2347.
I really should learn to test before I push to github.
| Python | mit | loktacar/wallpapermaker | <DELETE> os
import <DELETE_END> <REPLACE_OLD> self).__init__(config)
<REPLACE_NEW> self).__init__(config)
self.cycle = 0
<REPLACE_END> <REPLACE_OLD> os.system('pcmanfm --set-wallpaper=%s')
<REPLACE_NEW> import os
<REPLACE_END> <REPLACE_OLD> if not self.config['keep']:
<REPLACE_NEW> # TODO: Find a better... | Revert "Conforming LXDESetWallpaper plugin to conform with keep option (DarwinSetWallpaper), also FastForward merge"
This reverts commit 7212d223fe95d3042348bb29d9bd353308be2347.
I really should learn to test before I push to github.
import os
import sys
from .. import SetWallpaper
class LXDESetWallpaper(SetWallpa... |
3581c3c71bdf3ff84961df4b328f0bfc2adf0bc7 | apps/provider/urls.py | apps/provider/urls.py | from __future__ import absolute_import
from __future__ import unicode_literals
from django.conf.urls import patterns, include, url
from .views import *
urlpatterns = patterns('',
url(r'^pjson/push$', pjson_provider_push, name="pjson_provider_push"),
url(r'^fhir/practitioner/push$', fhir_practitioner_push, ... | from __future__ import absolute_import
from __future__ import unicode_literals
from django.conf.urls import patterns, include, url
from .views import *
urlpatterns = patterns('',
url(r'^pjson/push$', pjson_provider_push, name="pjson_provider_push"),
url(r'^fhir/practitioner/push$', fhir_practitioner_push, ... | Add url for update vs. push for pract and org | Add url for update vs. push for pract and org
| Python | apache-2.0 | TransparentHealth/hhs_oauth_client,TransparentHealth/hhs_oauth_client,TransparentHealth/hhs_oauth_client,TransparentHealth/hhs_oauth_client | <REPLACE_OLD> name="fhir_organization_push"),
)
<REPLACE_NEW> name="fhir_organization_push"),
url(r'^fhir/practitioner/update$', fhir_practitioner_update, name="fhir_practitioner_update"),
url(r'^fhir/organization/update$', fhir_organization_update, name="fhir_organization_update"),
)
<REPLACE_END> <|endo... | Add url for update vs. push for pract and org
from __future__ import absolute_import
from __future__ import unicode_literals
from django.conf.urls import patterns, include, url
from .views import *
urlpatterns = patterns('',
url(r'^pjson/push$', pjson_provider_push, name="pjson_provider_push"),
url(r'^fhi... |
e059af57acec9c077ddb348ac6dd84ff58d312fe | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='blanc-basic-pages',
version='0.2.1',
description='Blanc Basic Pages for Django',
long_description=open('README.rst').read(),
url='https://github.com/blancltd/blanc-basic-pages',
maintainer='Alex Tomkins',
maintai... | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='blanc-basic-pages',
version='0.2.1',
description='Blanc Basic Pages for Django',
long_description=open('README.rst').read(),
url='https://github.com/blancltd/blanc-basic-pages',
maintainer='Alex Tomkins',
maintai... | Fix dependencies for Django 1.7 | Fix dependencies for Django 1.7
Older versions of django-mptt will generate warnings
| Python | bsd-3-clause | blancltd/blanc-basic-pages | <REPLACE_OLD> 'django-mptt>=0.6.0',
'django-mptt-admin==0.1.8',
<REPLACE_NEW> 'django-mptt>=0.6.1',
'django-mptt-admin>=0.1.8',
<REPLACE_END> <|endoftext|> #!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='blanc-basic-pages',
version='0.2.1',
description='Blan... | Fix dependencies for Django 1.7
Older versions of django-mptt will generate warnings
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='blanc-basic-pages',
version='0.2.1',
description='Blanc Basic Pages for Django',
long_description=open('README.rst').read(),
url='htt... |
bc7bf2a09fe430bb2048842626ecbb476bc6b40c | script/generate_amalgamation.py | script/generate_amalgamation.py | #!/usr/bin/env python
import sys
from os.path import basename, dirname, join
import re
INCLUDE_PATTERN = re.compile(r'^\s*#include "([\w.]+)"')
seen_files = set()
out = sys.stdout
def add_file(filename):
bname = basename(filename)
# Only include each file at most once.
if bname in seen_files:
return
see... | #!/usr/bin/env python
import sys
from os.path import basename, dirname, join
import re
INCLUDE_PATTERN = re.compile(r'^\s*#include "([\w.]+)"')
WREN_DIR = dirname(dirname(realpath(__file__)))
seen_files = set()
out = sys.stdout
# Prints a plain text file, adding comment markers.
def add_comment_file(filename):
wi... | Print LICENSE on top of the amalgamation | Print LICENSE on top of the amalgamation
| Python | mit | Rohansi/wren,Nelarius/wren,minirop/wren,foresterre/wren,munificent/wren,Nave-Neel/wren,foresterre/wren,Nave-Neel/wren,Nelarius/wren,minirop/wren,Nelarius/wren,Nelarius/wren,foresterre/wren,foresterre/wren,bigdimboom/wren,minirop/wren,bigdimboom/wren,munificent/wren,Rohansi/wren,munificent/wren,bigdimboom/wren,munificen... | <REPLACE_OLD> "([\w.]+)"')
seen_files <REPLACE_NEW> "([\w.]+)"')
WREN_DIR = dirname(dirname(realpath(__file__)))
seen_files <REPLACE_END> <REPLACE_OLD> sys.stdout
def <REPLACE_NEW> sys.stdout
# Prints a plain text file, adding comment markers.
def add_comment_file(filename):
with open(filename, 'r') as f:
for... | Print LICENSE on top of the amalgamation
#!/usr/bin/env python
import sys
from os.path import basename, dirname, join
import re
INCLUDE_PATTERN = re.compile(r'^\s*#include "([\w.]+)"')
seen_files = set()
out = sys.stdout
def add_file(filename):
bname = basename(filename)
# Only include each file at most once.
... |
b03dff0d6964d886f122936d097c3d4acc0582db | proper_parens.py | proper_parens.py | #!/usr/bin/env python
from __future__ import print_function
from __future__ import unicode_literals
def safe_input(prompt):
"""Return user input after catching KeyboardInterrupt and EOFError"""
try:
reply = raw_input(prompt)
except (EOFError, KeyboardInterrupt):
quit()
else:
re... | #!/usr/bin/env python
from __future__ import print_function
from __future__ import unicode_literals
def safe_input(prompt):
"""Return user input after catching KeyboardInterrupt and EOFError"""
try:
reply = raw_input(prompt)
except (EOFError, KeyboardInterrupt):
quit()
else:
re... | Add function for broken and groundwork for other objectives | Add function for broken and groundwork for other objectives
| Python | mit | constanthatz/data-structures | <REPLACE_OLD> where_open <REPLACE_NEW> open_index <REPLACE_END> <REPLACE_OLD> value.find("(")
<REPLACE_NEW> [i for i, val in enumerate(reply) if val == "("]
<REPLACE_END> <REPLACE_OLD> where_close <REPLACE_NEW> close_index <REPLACE_END> <REPLACE_OLD> value.find(")")
<REPLACE_NEW> [i for i, val in enumerate(reply) i... | Add function for broken and groundwork for other objectives
#!/usr/bin/env python
from __future__ import print_function
from __future__ import unicode_literals
def safe_input(prompt):
"""Return user input after catching KeyboardInterrupt and EOFError"""
try:
reply = raw_input(prompt)
except (EOFE... |
44d5974fafdddb09a684882fc79662ae4c509f57 | names/__init__.py | names/__init__.py | from os.path import abspath, join, dirname
import random
__title__ = 'names'
__version__ = '0.2'
__author__ = 'Trey Hunner'
__license__ = 'MIT'
full_path = lambda filename: abspath(join(dirname(__file__), filename))
FILES = {
'first:male': full_path('dist.male.first'),
'first:female': full_path('dist.fema... | from os.path import abspath, join, dirname
import random
__title__ = 'names'
__version__ = '0.2'
__author__ = 'Trey Hunner'
__license__ = 'MIT'
full_path = lambda filename: abspath(join(dirname(__file__), filename))
FILES = {
'first:male': full_path('dist.male.first'),
'first:female': full_path('dist.fema... | Fix unicode string syntax for Python 3 | Fix unicode string syntax for Python 3
| Python | mit | treyhunner/names,treyhunner/names | <REPLACE_OLD> u"%s %s" % (get_first_name(gender), <REPLACE_NEW> unicode("%s %s").format(get_first_name(gender), <REPLACE_END> <|endoftext|> from os.path import abspath, join, dirname
import random
__title__ = 'names'
__version__ = '0.2'
__author__ = 'Trey Hunner'
__license__ = 'MIT'
full_path = lambda filename: abs... | Fix unicode string syntax for Python 3
from os.path import abspath, join, dirname
import random
__title__ = 'names'
__version__ = '0.2'
__author__ = 'Trey Hunner'
__license__ = 'MIT'
full_path = lambda filename: abspath(join(dirname(__file__), filename))
FILES = {
'first:male': full_path('dist.male.first'),
... |
e31099e964f809a8a6ebcb071c7c2b57e17248c2 | reviewboard/changedescs/evolutions/changedesc_user.py | reviewboard/changedescs/evolutions/changedesc_user.py | from __future__ import unicode_literals
from django_evolution.mutations import AddField
from django.db import models
MUTATIONS = [
AddField('ChangeDescription', 'user', models.ForeignKey, blank=True,
related_model='auth.User'),
]
| from __future__ import unicode_literals
from django_evolution.mutations import AddField
from django.db import models
MUTATIONS = [
AddField('ChangeDescription', 'user', models.ForeignKey, null=True,
related_model='auth.User'),
]
| Fix evolution for change description users | Fix evolution for change description users
Trivial change
| Python | mit | sgallagher/reviewboard,chipx86/reviewboard,chipx86/reviewboard,chipx86/reviewboard,sgallagher/reviewboard,davidt/reviewboard,brennie/reviewboard,reviewboard/reviewboard,sgallagher/reviewboard,davidt/reviewboard,reviewboard/reviewboard,reviewboard/reviewboard,sgallagher/reviewboard,brennie/reviewboard,brennie/reviewboar... | <REPLACE_OLD> blank=True,
<REPLACE_NEW> null=True,
<REPLACE_END> <|endoftext|> from __future__ import unicode_literals
from django_evolution.mutations import AddField
from django.db import models
MUTATIONS = [
AddField('ChangeDescription', 'user', models.ForeignKey, null=True,
related_model='auth.... | Fix evolution for change description users
Trivial change
from __future__ import unicode_literals
from django_evolution.mutations import AddField
from django.db import models
MUTATIONS = [
AddField('ChangeDescription', 'user', models.ForeignKey, blank=True,
related_model='auth.User'),
]
|
00e4663940ed1d22e768b3de3d1c645c8649aecc | src/WhiteLibrary/keywords/items/textbox.py | src/WhiteLibrary/keywords/items/textbox.py | from TestStack.White.UIItems import TextBox
from WhiteLibrary.keywords.librarycomponent import LibraryComponent
from WhiteLibrary.keywords.robotlibcore import keyword
class TextBoxKeywords(LibraryComponent):
@keyword
def input_text_to_textbox(self, locator, input):
"""
Writes text to a textbox... | from TestStack.White.UIItems import TextBox
from WhiteLibrary.keywords.librarycomponent import LibraryComponent
from WhiteLibrary.keywords.robotlibcore import keyword
class TextBoxKeywords(LibraryComponent):
@keyword
def input_text_to_textbox(self, locator, input_value):
"""
Writes text to a t... | Change to better argument name | Change to better argument name
| Python | apache-2.0 | Omenia/robotframework-whitelibrary,Omenia/robotframework-whitelibrary | <REPLACE_OLD> input):
<REPLACE_NEW> input_value):
<REPLACE_END> <REPLACE_OLD> ``input`` <REPLACE_NEW> ``input_value`` <REPLACE_END> <REPLACE_OLD> input
<REPLACE_NEW> input_value
<REPLACE_END> <|endoftext|> from TestStack.White.UIItems import TextBox
from WhiteLibrary.keywords.librarycomponent import LibraryCompon... | Change to better argument name
from TestStack.White.UIItems import TextBox
from WhiteLibrary.keywords.librarycomponent import LibraryComponent
from WhiteLibrary.keywords.robotlibcore import keyword
class TextBoxKeywords(LibraryComponent):
@keyword
def input_text_to_textbox(self, locator, input):
"""
... |
76600b63940da9322673ce6cd436129a7d65f10d | scripts/ec2/terminate_all.py | scripts/ec2/terminate_all.py | #!/usr/bin/env python
##########################################################################
# scripts/ec2/terminate_all.py
#
# Part of Project Thrill - http://project-thrill.org
#
# Copyright (C) 2015 Timo Bingmann <tb@panthema.net>
#
# All rights reserved. Published under the BSD-2 license in the LICENSE file.
##... | #!/usr/bin/env python
##########################################################################
# scripts/ec2/terminate_all.py
#
# Part of Project Thrill - http://project-thrill.org
#
# Copyright (C) 2015 Timo Bingmann <tb@panthema.net>
#
# All rights reserved. Published under the BSD-2 license in the LICENSE file.
##... | Add import statement for os | Add import statement for os | Python | bsd-2-clause | manpen/thrill,manpen/thrill,manpen/thrill,manpen/thrill,manpen/thrill | <REPLACE_OLD> boto3
from <REPLACE_NEW> boto3
import os
from <REPLACE_END> <|endoftext|> #!/usr/bin/env python
##########################################################################
# scripts/ec2/terminate_all.py
#
# Part of Project Thrill - http://project-thrill.org
#
# Copyright (C) 2015 Timo Bingmann <tb@panthema... | Add import statement for os
#!/usr/bin/env python
##########################################################################
# scripts/ec2/terminate_all.py
#
# Part of Project Thrill - http://project-thrill.org
#
# Copyright (C) 2015 Timo Bingmann <tb@panthema.net>
#
# All rights reserved. Published under the BSD-2 lic... |
72796a97a24c512cf43fd9559d6e6b47d2f72e72 | preferences/models.py | preferences/models.py | import uuid
from django.db import models
from django.contrib.auth.models import User
from opencivicdata.models.people_orgs import Person
from django.contrib.auth.models import User
class Preferences(models.Model):
user = models.OneToOneField(User, related_name='preferences')
address = models.CharField(max_le... | import uuid
from django.db import models
from django.contrib.auth.models import User
from opencivicdata.models.people_orgs import Person
class Preferences(models.Model):
user = models.OneToOneField(User, related_name='preferences')
address = models.CharField(max_length=100, blank=True, null=True)
lat = mo... | Allow address to be null | Allow address to be null
| Python | mit | jamesturk/tot,jamesturk/tot,jamesturk/tot,jamesturk/tot,jamesturk/tot | <REPLACE_OLD> Person
from django.contrib.auth.models import User
class <REPLACE_NEW> Person
class <REPLACE_END> <REPLACE_OLD> blank=True)
<REPLACE_NEW> blank=True, null=True)
<REPLACE_END> <|endoftext|> import uuid
from django.db import models
from django.contrib.auth.models import User
from opencivicdata.models... | Allow address to be null
import uuid
from django.db import models
from django.contrib.auth.models import User
from opencivicdata.models.people_orgs import Person
from django.contrib.auth.models import User
class Preferences(models.Model):
user = models.OneToOneField(User, related_name='preferences')
address... |
6b5ab66b7fb3d514c05bf3cf69023b1e119e1797 | stock_picking_list/9.0.1.0.0/post-migration.py | stock_picking_list/9.0.1.0.0/post-migration.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenUpgrade module for Odoo
# @copyright 2015-Today: Odoo Community Association
# @author: Stephane LE CORNEC
#
# This program is free software: you can redistribute it and/or modify
# it under the ... | ADD mig scripts for picking list | ADD mig scripts for picking list
| Python | agpl-3.0 | ingadhoc/stock | <INSERT> # -*- coding: utf-8 -*-
##############################################################################
#
# <INSERT_END> <INSERT> OpenUpgrade module for Odoo
# @copyright 2015-Today: Odoo Community Association
# @author: Stephane LE CORNEC
#
# This program is free software: you can redistribute it an... | ADD mig scripts for picking list
| |
09c2e6fff38e5c47391c0f8e948089e3efd26337 | serfnode/handler/file_utils.py | serfnode/handler/file_utils.py | import os
from tempfile import mkstemp
import time
class atomic_write(object):
"""Perform an atomic write to a file.
Use as::
with atomic_write('/my_file') as f:
f.write('foo')
"""
def __init__(self, filepath):
"""
:type filepath: str
"""
self.fi... | import os
from tempfile import mkstemp
import time
class atomic_write(object):
"""Perform an atomic write to a file.
Use as::
with atomic_write('/my_file') as f:
f.write('foo')
"""
def __init__(self, filepath):
"""
:type filepath: str
"""
self.fi... | Allow waiting for multiple files | Allow waiting for multiple files | Python | mit | waltermoreira/serfnode,waltermoreira/serfnode,waltermoreira/serfnode | <REPLACE_OLD> wait_for_file(filepath, <REPLACE_NEW> wait_for_files(*filepath, <REPLACE_END> <REPLACE_OLD> a file.
<REPLACE_NEW> files.
<REPLACE_END> <REPLACE_OLD> os.path.exists(filepath):
<REPLACE_NEW> all(os.path.exists(f) for f in filepath):
<REPLACE_END> <|endoftext|> import os
from tempfile import mkstemp
im... | Allow waiting for multiple files
import os
from tempfile import mkstemp
import time
class atomic_write(object):
"""Perform an atomic write to a file.
Use as::
with atomic_write('/my_file') as f:
f.write('foo')
"""
def __init__(self, filepath):
"""
:type filepath... |
d1504f3c3129c926bd9897a6660669f146e64c38 | cachupy/cachupy.py | cachupy/cachupy.py | import datetime
class Cache:
EXPIRE_IN = 'expire_in'
def __init__(self):
self.store = {}
def get(self, key):
"""Gets a value based upon a key."""
self._check_expiry(key)
return self.store[key]['value']
def set(self, dictionary, expire_in):
"""Sets a d... | import datetime
class Cache:
EXPIRE_IN = 'expire_in'
VALUE = 'value'
def __init__(self):
self.lock = False
self.store = {}
def get(self, key):
"""Gets a value based upon a key."""
self._check_expiry(key)
return self.store[key][Cache.VALUE]
def set... | Change signature of set() method. | Change signature of set() method.
| Python | mit | patrickbird/cachupy | <REPLACE_OLD> 'expire_in'
<REPLACE_NEW> 'expire_in'
VALUE = 'value'
<REPLACE_END> <INSERT> self.lock = False
<INSERT_END> <REPLACE_OLD> self.store[key]['value']
<REPLACE_NEW> self.store[key][Cache.VALUE]
<REPLACE_END> <REPLACE_OLD> dictionary, expire_in):
<REPLACE_NEW> expire_in, *args):
<REPLACE_... | Change signature of set() method.
import datetime
class Cache:
EXPIRE_IN = 'expire_in'
def __init__(self):
self.store = {}
def get(self, key):
"""Gets a value based upon a key."""
self._check_expiry(key)
return self.store[key]['value']
def set(self, dictiona... |
73bf27a95944f67feb254d90b90cfa31165dc4cb | tests/UselessSymbolsRemove/CycleTest.py | tests/UselessSymbolsRemove/CycleTest.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 19.08.2017 16:13
:Licence GNUv3
Part of grammpy-transforms
"""
from unittest import main, TestCase
from grammpy import *
from grammpy_transforms import *
class S(Nonterminal): pass
class A(Nonterminal): pass
class B(Nonterminal): pass
class C(Nonterminal): p... | Add cycle test of remove useless symbols | Add cycle test of remove useless symbols
| Python | mit | PatrikValkovic/grammpy | <REPLACE_OLD> <REPLACE_NEW> #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 19.08.2017 16:13
:Licence GNUv3
Part of grammpy-transforms
"""
from unittest import main, TestCase
from grammpy import *
from grammpy_transforms import *
class S(Nonterminal): pass
class A(Nonterminal): pass
class B(Nonterminal):... | Add cycle test of remove useless symbols
| |
52982c735f729ddf0a9c020d495906c4a4899462 | txircd/modules/rfc/umode_i.py | txircd/modules/rfc/umode_i.py | from twisted.plugin import IPlugin
from txircd.module_interface import IMode, IModuleData, Mode, ModuleData
from txircd.utils import ModeType
from zope.interface import implements
class InvisibleMode(ModuleData, Mode):
implements(IPlugin, IModuleData, IMode)
name = "InvisibleMode"
core = True
affe... | from twisted.plugin import IPlugin
from txircd.module_interface import IMode, IModuleData, Mode, ModuleData
from txircd.utils import ModeType
from zope.interface import implements
class InvisibleMode(ModuleData, Mode):
implements(IPlugin, IModuleData, IMode)
name = "InvisibleMode"
core = True
affe... | Make the invisible check action not necessarily require an accompanying channel | Make the invisible check action not necessarily require an accompanying channel
| Python | bsd-3-clause | Heufneutje/txircd,ElementalAlchemist/txircd | <REPLACE_OLD> "showchanneluser" <REPLACE_NEW> "showchanneluser", "showuser" <REPLACE_END> <REPLACE_OLD> self.isInvisible) <REPLACE_NEW> self.isInvisibleChan),
("modeactioncheck-user-i-showuser", 1, self.isInvisibleUser) <REPLACE_END> <REPLACE_OLD> isInvisible(self, <REPLACE_NEW> isInvisibleChan(self, <R... | Make the invisible check action not necessarily require an accompanying channel
from twisted.plugin import IPlugin
from txircd.module_interface import IMode, IModuleData, Mode, ModuleData
from txircd.utils import ModeType
from zope.interface import implements
class InvisibleMode(ModuleData, Mode):
implements(IPlu... |
0388ab2bb8ad50aa40716a1c5f83f5e1f400bb32 | scripts/start_baxter.py | scripts/start_baxter.py | #!/usr/bin/python
from baxter_myo.arm_controller import ArmController
from baxter_myo.config_reader import ConfigReader
def main():
c = ConfigReader("demo_config")
c.parse_all()
s = ArmController('right', c.right_angles, c.push_thresh)
s.move_loop()
if __name__ == "__main__":
main()
| #!/usr/bin/python
import time
import rospy
from baxter_myo.arm_controller import ArmController
from baxter_myo.config_reader import ConfigReader
def main():
c = ConfigReader("demo_config")
c.parse_all()
s = ArmController('right', c.right_angles, c.push_thresh)
while not rospy.is_shutdown():
s... | Enable ctrl-c control with rospy | Enable ctrl-c control with rospy
| Python | mit | ipab-rad/baxter_myo,ipab-rad/myo_baxter_pc,ipab-rad/myo_baxter_pc,ipab-rad/baxter_myo | <REPLACE_OLD> #!/usr/bin/python
from <REPLACE_NEW> #!/usr/bin/python
import time
import rospy
from <REPLACE_END> <REPLACE_OLD> s.move_loop()
if <REPLACE_NEW> while not rospy.is_shutdown():
s.step()
if <REPLACE_END> <|endoftext|> #!/usr/bin/python
import time
import rospy
from baxter_myo.arm_controller impo... | Enable ctrl-c control with rospy
#!/usr/bin/python
from baxter_myo.arm_controller import ArmController
from baxter_myo.config_reader import ConfigReader
def main():
c = ConfigReader("demo_config")
c.parse_all()
s = ArmController('right', c.right_angles, c.push_thresh)
s.move_loop()
if __name__ == "... |
8be551ad39f3aedff5ea0ceb536378ea0e851864 | src/waldur_auth_openid/management/commands/import_openid_accounts.py | src/waldur_auth_openid/management/commands/import_openid_accounts.py | from __future__ import unicode_literals
from django.conf import settings
from django.contrib.auth import get_user_model
from django.db import transaction
from waldur_core.core.utils import DryRunCommand
User = get_user_model()
class Command(DryRunCommand):
help_text = 'Append civil number with country code for... | from __future__ import unicode_literals
from django.conf import settings
from django.contrib.auth import get_user_model
from django.db import transaction
from waldur_core.core.utils import DryRunCommand
User = get_user_model()
class Command(DryRunCommand):
help_text = 'Append civil number with country code for... | Print out civil_number before and after | Print out civil_number before and after [WAL-2172]
| Python | mit | opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind | <DELETE> if not dry_run:
<DELETE_END> <REPLACE_OLD> user.civil_number <REPLACE_NEW> new_civil_number <REPLACE_END> <INSERT> self.stdout.write('Username: %s, before: %s, after: %s' % (
user.username, user.civil_number, new_civil_number))
if not dry_r... | Print out civil_number before and after [WAL-2172]
from __future__ import unicode_literals
from django.conf import settings
from django.contrib.auth import get_user_model
from django.db import transaction
from waldur_core.core.utils import DryRunCommand
User = get_user_model()
class Command(DryRunCommand):
he... |
9e413449f6f85e0cf9465762e31e8f251e14c23e | spacy/tests/regression/test_issue1537.py | spacy/tests/regression/test_issue1537.py | '''Test Span.as_doc() doesn't segfault'''
from ...tokens import Doc
from ...vocab import Vocab
from ... import load as load_spacy
def test_issue1537():
string = 'The sky is blue . The man is pink . The dog is purple .'
doc = Doc(Vocab(), words=string.split())
doc[0].sent_start = True
for word in doc[... | '''Test Span.as_doc() doesn't segfault'''
from __future__ import unicode_literals
from ...tokens import Doc
from ...vocab import Vocab
from ... import load as load_spacy
def test_issue1537():
string = 'The sky is blue . The man is pink . The dog is purple .'
doc = Doc(Vocab(), words=string.split())
doc[0... | Fix unicode error in new test | Fix unicode error in new test
| Python | mit | spacy-io/spaCy,explosion/spaCy,explosion/spaCy,spacy-io/spaCy,recognai/spaCy,spacy-io/spaCy,explosion/spaCy,explosion/spaCy,honnibal/spaCy,honnibal/spaCy,aikramer2/spaCy,recognai/spaCy,honnibal/spaCy,recognai/spaCy,explosion/spaCy,recognai/spaCy,aikramer2/spaCy,recognai/spaCy,aikramer2/spaCy,honnibal/spaCy,aikramer2/sp... | <INSERT> __future__ import unicode_literals
from <INSERT_END> <|endoftext|> '''Test Span.as_doc() doesn't segfault'''
from __future__ import unicode_literals
from ...tokens import Doc
from ...vocab import Vocab
from ... import load as load_spacy
def test_issue1537():
string = 'The sky is blue . The man is pink .... | Fix unicode error in new test
'''Test Span.as_doc() doesn't segfault'''
from ...tokens import Doc
from ...vocab import Vocab
from ... import load as load_spacy
def test_issue1537():
string = 'The sky is blue . The man is pink . The dog is purple .'
doc = Doc(Vocab(), words=string.split())
doc[0].sent_st... |
321924fff843896fc67d3a4594d635546cf90bec | mycli/packages/expanded.py | mycli/packages/expanded.py | from .tabulate import _text_type
def pad(field, total, char=u" "):
return field + (char * (total - len(field)))
def get_separator(num, header_len, data_len):
sep = u"***************************[ %d. row ]***************************\n" % (num + 1)
return sep
def expanded_table(rows, headers):
header_... | from .tabulate import _text_type
def pad(field, total, char=u" "):
return field + (char * (total - len(field)))
def get_separator(num, header_len, data_len):
sep = u"***************************[ %d. row ]***************************\n" % (num + 1)
return sep
def expanded_table(rows, headers):
header_... | Make the null value consistent between vertical and tabular output. | Make the null value consistent between vertical and tabular output.
| Python | bsd-3-clause | MnO2/rediscli,martijnengler/mycli,qbdsoft/mycli,j-bennet/mycli,D-e-e-m-o/mycli,mdsrosa/mycli,martijnengler/mycli,mattn/mycli,jinstrive/mycli,webwlsong/mycli,brewneaux/mycli,danieljwest/mycli,thanatoskira/mycli,ksmaheshkumar/mycli,brewneaux/mycli,MnO2/rediscli,evook/mycli,webwlsong/mycli,j-bennet/mycli,evook/mycli,suzuk... | <INSERT> if value is None: value = '<null>'
<INSERT_END> <|endoftext|> from .tabulate import _text_type
def pad(field, total, char=u" "):
return field + (char * (total - len(field)))
def get_separator(num, header_len, data_len):
sep = u"***************************[ %d. row ]**********************... | Make the null value consistent between vertical and tabular output.
from .tabulate import _text_type
def pad(field, total, char=u" "):
return field + (char * (total - len(field)))
def get_separator(num, header_len, data_len):
sep = u"***************************[ %d. row ]***************************\n" % (nu... |
239f24cc5dc5c0f25436ca1bfcfc536e30d62587 | menu_generator/templatetags/menu_generator.py | menu_generator/templatetags/menu_generator.py | from django import template
from django.conf import settings
from .utils import get_menu_from_apps
from .. import defaults
from ..menu import generate_menu
register = template.Library()
@register.assignment_tag(takes_context=True)
def get_menu(context, menu_name):
"""
Returns a consumable menu list for a gi... | from django import template
from django.conf import settings
from .utils import get_menu_from_apps
from .. import defaults
from ..menu import generate_menu
register = template.Library()
@register.simple_tag(takes_context=True)
def get_menu(context, menu_name):
"""
Returns a consumable menu list for a given ... | Use simple_tag instead of assignment_tag | Use simple_tag instead of assignment_tag
The assignment_tag is depraceted and in django-2.0 removed.
Signed-off-by: Frantisek Lachman <bae095a6f6bdabf882218c81fdc3947ea1c10590@gmail.com>
| Python | mit | yamijuan/django-menu-generator,RADYConsultores/django-menu-generator | <REPLACE_OLD> template.Library()
@register.assignment_tag(takes_context=True)
def <REPLACE_NEW> template.Library()
@register.simple_tag(takes_context=True)
def <REPLACE_END> <|endoftext|> from django import template
from django.conf import settings
from .utils import get_menu_from_apps
from .. import defaults
from... | Use simple_tag instead of assignment_tag
The assignment_tag is depraceted and in django-2.0 removed.
Signed-off-by: Frantisek Lachman <bae095a6f6bdabf882218c81fdc3947ea1c10590@gmail.com>
from django import template
from django.conf import settings
from .utils import get_menu_from_apps
from .. import defaults
from .... |
342e6134a63c5b575ae8e4348a54f61350bca2da | parser/crimeparser/pipelinesEnricher.py | parser/crimeparser/pipelinesEnricher.py | from geopy import Nominatim
from geopy.extra.rate_limiter import RateLimiter
class GeoCodePipeline(object):
def open_spider(self, spider):
geolocator = Nominatim(timeout=5)
self.__geocodeFunc = RateLimiter(geolocator.geocode, min_delay_seconds=2)
def process_item(self, item, spider):
... | from geopy import Nominatim, Photon
from geopy.extra.rate_limiter import RateLimiter
class GeoCodePipeline(object):
def open_spider(self, spider):
geolocator = Photon(timeout=5)
self.__geocodeFunc = RateLimiter(geolocator.geocode, min_delay_seconds=2)
def process_item(self, item, spider):
... | Use Phonon instead of Nominatim for geo coding | Use Phonon instead of Nominatim for geo coding
Phonon is more fault tolerant to spelling mistakes.
| Python | mit | aberklotz/crimereport,aberklotz/crimereport,aberklotz/crimereport | <REPLACE_OLD> Nominatim
from <REPLACE_NEW> Nominatim, Photon
from <REPLACE_END> <REPLACE_OLD> Nominatim(timeout=5)
<REPLACE_NEW> Photon(timeout=5)
<REPLACE_END> <|endoftext|> from geopy import Nominatim, Photon
from geopy.extra.rate_limiter import RateLimiter
class GeoCodePipeline(object):
def open_spider(self... | Use Phonon instead of Nominatim for geo coding
Phonon is more fault tolerant to spelling mistakes.
from geopy import Nominatim
from geopy.extra.rate_limiter import RateLimiter
class GeoCodePipeline(object):
def open_spider(self, spider):
geolocator = Nominatim(timeout=5)
self.__geocodeFunc = Ra... |
80a1912ce69fd356d6c54bb00f946fbc7874a9ce | bluecanary/set_cloudwatch_alarm.py | bluecanary/set_cloudwatch_alarm.py | import boto3
from bluecanary.exceptions import NamespaceError
from bluecanary.utilities import throttle
@throttle()
def set_cloudwatch_alarm(identifier, **kwargs):
if not kwargs.get('Dimensions'):
kwargs['Dimensions'] = _get_dimensions(identifier, **kwargs)
if not kwargs.get('AlarmName'):
kw... | import boto3
from bluecanary.exceptions import NamespaceError
from bluecanary.utilities import throttle
@throttle()
def set_cloudwatch_alarm(identifier, **kwargs):
if not kwargs.get('Dimensions'):
kwargs['Dimensions'] = _get_dimensions(identifier, **kwargs)
if not kwargs.get('AlarmName'):
kw... | Allow multiple alarms for same metric type | Allow multiple alarms for same metric type
| Python | mit | voxy/bluecanary | <REPLACE_OLD> '{}_{}'.format(identifier, <REPLACE_NEW> '{}_{}'.format(identifier,
<REPLACE_END> <INSERT> if kwargs.get('AlarmNameModifier'):
kwargs['AlarmName'] = '{}_{}'.format(kwargs.get('AlarmName'),
kwargs.get('Alar... | Allow multiple alarms for same metric type
import boto3
from bluecanary.exceptions import NamespaceError
from bluecanary.utilities import throttle
@throttle()
def set_cloudwatch_alarm(identifier, **kwargs):
if not kwargs.get('Dimensions'):
kwargs['Dimensions'] = _get_dimensions(identifier, **kwargs)
... |
51965dc3b26abfd0f9fb730c3076ee16b13612bc | dadi/__init__.py | dadi/__init__.py | """
For examples of dadi's usage, see the examples directory in the source
distribution.
Documentation of all methods can be found in doc/api/index.html of the source
distribution.
"""
import logging
logging.basicConfig()
import Demographics1D
import Demographics2D
import Inference
import Integration
import Misc
impo... | """
For examples of dadi's usage, see the examples directory in the source
distribution.
Documentation of all methods can be found in doc/api/index.html of the source
distribution.
"""
import logging
logging.basicConfig()
import Demographics1D
import Demographics2D
import Inference
import Integration
import Misc
impo... | Hide spurious numpy warnings about divide by zeros and nans. | Hide spurious numpy warnings about divide by zeros and nans.
git-svn-id: 4c7b13231a96299fde701bb5dec4bd2aaf383fc6@429 979d6bd5-6d4d-0410-bece-f567c23bd345
| Python | bsd-3-clause | yangjl/dadi,ChenHsiang/dadi,cheese1213/dadi,ChenHsiang/dadi,RyanGutenkunst/dadi,cheese1213/dadi,niuhuifei/dadi,paulirish/dadi,beni55/dadi,yangjl/dadi,RyanGutenkunst/dadi,niuhuifei/dadi,beni55/dadi,paulirish/dadi | <REPLACE_OLD> 'Unknown'
<REPLACE_NEW> 'Unknown'
# When doing arithmetic with Spectrum objects (which are masked arrays), we
# often have masked values which generate annoying arithmetic warnings. Here
# we tell numpy to ignore such warnings. This puts greater onus on the user to
# check results, but for our use case ... | Hide spurious numpy warnings about divide by zeros and nans.
git-svn-id: 4c7b13231a96299fde701bb5dec4bd2aaf383fc6@429 979d6bd5-6d4d-0410-bece-f567c23bd345
"""
For examples of dadi's usage, see the examples directory in the source
distribution.
Documentation of all methods can be found in doc/api/index.html of the ... |
23675e41656cac48f390d97f065b36de39e27d58 | duckbot.py | duckbot.py | import discord
import duckbot_settings
import random
from discord.ext import commands
_DESCRIPTION = '''quack'''
bot = commands.Bot(command_prefix='/', description=_DESCRIPTION)
@bot.event
async def on_ready():
print('logged in: %s (%s)' % (bot.user.name, bot.user.id))
oauth_url = discord.utils.oauth_url(duckbot... | import discord
import duckbot_settings
import random
from discord.ext import commands
_DESCRIPTION = '''quack'''
bot = commands.Bot(command_prefix='/', description=_DESCRIPTION)
rand = random.SystemRandom()
@bot.event
async def on_ready():
print('logged in: %s (%s)' % (bot.user.name, bot.user.id))
oauth_url = di... | Add a real roll command | Add a real roll command
| Python | mit | andrewlin16/duckbot,andrewlin16/duckbot | <REPLACE_OLD> description=_DESCRIPTION)
@bot.event
async <REPLACE_NEW> description=_DESCRIPTION)
rand = random.SystemRandom()
@bot.event
async <REPLACE_END> <REPLACE_OLD> roll():
await bot.say('pretending to roll')
bot.run(duckbot_settings.TOKEN)
<REPLACE_NEW> roll():
lower_bound = 1
upper_boundb = 6
await bot.... | Add a real roll command
import discord
import duckbot_settings
import random
from discord.ext import commands
_DESCRIPTION = '''quack'''
bot = commands.Bot(command_prefix='/', description=_DESCRIPTION)
@bot.event
async def on_ready():
print('logged in: %s (%s)' % (bot.user.name, bot.user.id))
oauth_url = discor... |
5cfcf2615e46fc3ef550159e38dc51c7362543af | readux/books/management/commands/web_export.py | readux/books/management/commands/web_export.py | from eulfedora.server import Repository
from django.core.management.base import BaseCommand
import shutil
from readux.books import annotate, export
from readux.books.models import Volume
class Command(BaseCommand):
help = 'Construct web export of an annotated volume'
def add_arguments(self, parser):
... | from eulfedora.server import Repository
from eulxml.xmlmap import load_xmlobject_from_file
from django.core.management.base import BaseCommand
import shutil
from readux.books import annotate, export
from readux.books.models import Volume
from readux.books.tei import Facsimile
class Command(BaseCommand):
help = '... | Add an option to pass in generated TEI, for speed & troubleshooting | Add an option to pass in generated TEI, for speed & troubleshooting
| Python | apache-2.0 | emory-libraries/readux,emory-libraries/readux,emory-libraries/readux | <INSERT> eulxml.xmlmap import load_xmlobject_from_file
from <INSERT_END> <REPLACE_OLD> Volume
class <REPLACE_NEW> Volume
from readux.books.tei import Facsimile
class <REPLACE_END> <REPLACE_OLD> site')
<REPLACE_NEW> site')
parser.add_argument('--tei',
help='Use the specified TEI file instead o... | Add an option to pass in generated TEI, for speed & troubleshooting
from eulfedora.server import Repository
from django.core.management.base import BaseCommand
import shutil
from readux.books import annotate, export
from readux.books.models import Volume
class Command(BaseCommand):
help = 'Construct web export... |
19cd84480a739f9550258dc959637fe85f43af50 | fedora/release.py | fedora/release.py | '''
Information about this python-fedora release
'''
from fedora import _
NAME = 'python-fedora'
VERSION = '0.3.6'
DESCRIPTION = _('Python modules for interacting with Fedora services')
LONG_DESCRIPTION = _('''
The Fedora Project runs many different services. These services help us to
package software, develop new p... | '''
Information about this python-fedora release
'''
from fedora import _
NAME = 'python-fedora'
VERSION = '0.3.6'
DESCRIPTION = _('Python modules for interacting with Fedora Services')
LONG_DESCRIPTION = _('''
The Fedora Project runs many different services. These services help us to
package software, develop new p... | Correct minor typo in a string. | Correct minor typo in a string.
| Python | lgpl-2.1 | fedora-infra/python-fedora | <REPLACE_OLD> services')
LONG_DESCRIPTION <REPLACE_NEW> Services')
LONG_DESCRIPTION <REPLACE_END> <|endoftext|> '''
Information about this python-fedora release
'''
from fedora import _
NAME = 'python-fedora'
VERSION = '0.3.6'
DESCRIPTION = _('Python modules for interacting with Fedora Services')
LONG_DESCRIPTION = _... | Correct minor typo in a string.
'''
Information about this python-fedora release
'''
from fedora import _
NAME = 'python-fedora'
VERSION = '0.3.6'
DESCRIPTION = _('Python modules for interacting with Fedora services')
LONG_DESCRIPTION = _('''
The Fedora Project runs many different services. These services help us t... |
14fb663019038b80d42f212e0ad8169cd0d37e84 | neutron_lib/exceptions/address_group.py | neutron_lib/exceptions/address_group.py | # All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | # All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | Add address group in use exception | Add address group in use exception
Related change: https://review.opendev.org/#/c/751110/
Change-Id: I2a9872890ca4d5e59a9e266c1dcacd3488a3265c
| Python | apache-2.0 | openstack/neutron-lib,openstack/neutron-lib,openstack/neutron-lib,openstack/neutron-lib | <INSERT> AddressGroupInUse(exceptions.InUse):
message = _("Address group %(address_group_id)s is in use on one or more "
"security group rules.")
class <INSERT_END> <|endoftext|> # All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this... | Add address group in use exception
Related change: https://review.opendev.org/#/c/751110/
Change-Id: I2a9872890ca4d5e59a9e266c1dcacd3488a3265c
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may ob... |
32116cf93b30fc63394379b49e921f9e0ab2f652 | django_filepicker/widgets.py | django_filepicker/widgets.py | from django.conf import settings
from django.forms import widgets
#JS_URL is the url to the filepicker.io javascript library
JS_VERSION = 0
JS_URL = "//api.filepicker.io/v%d/filepicker.js" % (JS_VERSION)
if hasattr(settings, 'FILEPICKER_INPUT_TYPE'):
INPUT_TYPE = settings.FILEPICKER_INPUT_TYPE
else:
INPUT_TYP... | from django.conf import settings
from django.forms import widgets
#JS_URL is the url to the filepicker.io javascript library
JS_VERSION = 1
JS_URL = "//api.filepicker.io/v%d/filepicker.js" % (JS_VERSION)
if hasattr(settings, 'FILEPICKER_INPUT_TYPE'):
INPUT_TYPE = settings.FILEPICKER_INPUT_TYPE
else:
INPUT_TYP... | Use version 1 of Filepicker.js | Use version 1 of Filepicker.js | Python | mit | filepicker/filepicker-django,filepicker/filepicker-django,FundedByMe/filepicker-django,FundedByMe/filepicker-django | <REPLACE_OLD> 0
JS_URL <REPLACE_NEW> 1
JS_URL <REPLACE_END> <|endoftext|> from django.conf import settings
from django.forms import widgets
#JS_URL is the url to the filepicker.io javascript library
JS_VERSION = 1
JS_URL = "//api.filepicker.io/v%d/filepicker.js" % (JS_VERSION)
if hasattr(settings, 'FILEPICKER_INPUT_T... | Use version 1 of Filepicker.js
from django.conf import settings
from django.forms import widgets
#JS_URL is the url to the filepicker.io javascript library
JS_VERSION = 0
JS_URL = "//api.filepicker.io/v%d/filepicker.js" % (JS_VERSION)
if hasattr(settings, 'FILEPICKER_INPUT_TYPE'):
INPUT_TYPE = settings.FILEPICKER... |
c5fba0cc8acb482a0bc1c49ae5187ebc1232dba3 | tests/test_directions.py | tests/test_directions.py | import unittest
from shapely.geometry import LineString, Point
from directions.base import _parse_points
class DirectionsTest(unittest.TestCase):
def setUp(self):
self.p = [(1,2), (3,4), (5,6), (7,8)]
self.line = LineString(self.p)
def test_origin_dest(self):
result = _parse_points(s... | Add tests for the different input variations. | Add tests for the different input variations.
| Python | bsd-3-clause | asfaltboy/directions.py,jwass/directions.py,samtux/directions.py | <REPLACE_OLD> <REPLACE_NEW> import unittest
from shapely.geometry import LineString, Point
from directions.base import _parse_points
class DirectionsTest(unittest.TestCase):
def setUp(self):
self.p = [(1,2), (3,4), (5,6), (7,8)]
self.line = LineString(self.p)
def test_origin_dest(self):
... | Add tests for the different input variations.
| |
0ff0a3137ea938b7db8167d132b08b9e8620e864 | contrib/internal/run-pyflakes.py | contrib/internal/run-pyflakes.py | #!/usr/bin/env python
#
# Utility script to run pyflakes with the modules we care about and
# exclude errors we know to be fine.
import os
import subprocess
import sys
module_exclusions = [
'djblets',
'django_evolution',
'dist',
'ez_setup.py',
'settings_local.py',
'ReviewBoard.egg-info',
]
... | #!/usr/bin/env python
#
# Utility script to run pyflakes with the modules we care about and
# exclude errors we know to be fine.
import os
import subprocess
import sys
module_exclusions = [
'djblets',
'django_evolution',
'dist',
'ez_setup.py',
'htdocs',
'settings_local.py',
'ReviewBoard.e... | Exclude htdocs, because that just takes way too long to scan. | Exclude htdocs, because that just takes way too long to scan.
| Python | mit | atagar/ReviewBoard,atagar/ReviewBoard,sgallagher/reviewboard,chazy/reviewboard,chipx86/reviewboard,Khan/reviewboard,custode/reviewboard,atagar/ReviewBoard,Khan/reviewboard,chazy/reviewboard,atagar/ReviewBoard,bkochendorfer/reviewboard,davidt/reviewboard,asutherland/opc-reviewboard,Khan/reviewboard,Khan/reviewboard,beol... | <INSERT> 'htdocs',
<INSERT_END> <|endoftext|> #!/usr/bin/env python
#
# Utility script to run pyflakes with the modules we care about and
# exclude errors we know to be fine.
import os
import subprocess
import sys
module_exclusions = [
'djblets',
'django_evolution',
'dist',
'ez_setup.py',
'ht... | Exclude htdocs, because that just takes way too long to scan.
#!/usr/bin/env python
#
# Utility script to run pyflakes with the modules we care about and
# exclude errors we know to be fine.
import os
import subprocess
import sys
module_exclusions = [
'djblets',
'django_evolution',
'dist',
'ez_se... |
e1b0222c8a3ed39bf76af10484a94aa4cfe5adc8 | googlesearch/templatetags/search_tags.py | googlesearch/templatetags/search_tags.py | import math
from django import template
from ..conf import settings
register = template.Library()
@register.inclusion_tag('googlesearch/_pagination.html', takes_context=True)
def show_pagination(context, pages_to_show=10):
max_pages = int(math.ceil(context['total_results'] /
setting... | import math
from django import template
from ..conf import settings
register = template.Library()
@register.inclusion_tag('googlesearch/_pagination.html', takes_context=True)
def show_pagination(context, pages_to_show=10):
max_pages = int(math.ceil(context['total_results'] /
setting... | Remove last_page not needed anymore. | Remove last_page not needed anymore.
| Python | mit | hzdg/django-google-search,hzdg/django-google-search | <DELETE> last_page = int(context['current_page']) + pages_to_show - 1
last_page = max_pages if last_page > max_pages else last_page
<DELETE_END> <|endoftext|> import math
from django import template
from ..conf import settings
register = template.Library()
@register.inclusion_tag('googlesearch/_pagination.h... | Remove last_page not needed anymore.
import math
from django import template
from ..conf import settings
register = template.Library()
@register.inclusion_tag('googlesearch/_pagination.html', takes_context=True)
def show_pagination(context, pages_to_show=10):
max_pages = int(math.ceil(context['total_results'] /... |
96fe288cbd4c4399c83b4c3d56da6e427aaad0f9 | spicedham/digitdestroyer.py | spicedham/digitdestroyer.py | from spicedham.basewrapper import BaseWrapper
class DigitDestroyer(BaseWrapper):
def train(*args):
pass
def classify(self, response):
if all(map(unicode.isdigit, response)):
return 1
else:
return 0.5
| from spicedham.basewrapper import BaseWrapper
class DigitDestroyer(object):
def train(*args):
pass
def classify(self, response):
if all(map(unicode.isdigit, response)):
return 1
else:
return None
| Fix inheritence error and return value | Fix inheritence error and return value
It shouldn't inherit from BaseWrapper, but merely object.
It should return None instead of 0.5 so it will have no effect on the average.
| Python | mpl-2.0 | mozilla/spicedham,mozilla/spicedham | <REPLACE_OLD> DigitDestroyer(BaseWrapper):
<REPLACE_NEW> DigitDestroyer(object):
<REPLACE_END> <REPLACE_OLD> 0.5
<REPLACE_NEW> None
<REPLACE_END> <|endoftext|> from spicedham.basewrapper import BaseWrapper
class DigitDestroyer(object):
def train(*args):
pass
def classify(self, response):
if... | Fix inheritence error and return value
It shouldn't inherit from BaseWrapper, but merely object.
It should return None instead of 0.5 so it will have no effect on the average.
from spicedham.basewrapper import BaseWrapper
class DigitDestroyer(BaseWrapper):
def train(*args):
pass
def classify(self, re... |
e8f8b08ffb011ed705701f40c6a1a952c13d7c41 | analytics/test_analytics.py | analytics/test_analytics.py | # -*- encoding: utf-8
import pytest
from reports import NGINX_LOG_REGEX
@pytest.mark.parametrize('log_line', [
# Unusual methods
'0.0.0.0 - - [01/Jan/2001:00:00:00 +0000] "HEAD /example HTTP/1.0" 200 0 "http://referrer.org" "Example user agent" "1.2.3.4"',
'0.0.0.0 - - [01/Jan/2001:00:00:00 +0000] "OPTI... | Add a few tests for the analytics code | Add a few tests for the analytics code
| Python | mit | alexwlchan/alexwlchan.net,alexwlchan/alexwlchan.net,alexwlchan/alexwlchan.net,alexwlchan/alexwlchan.net,alexwlchan/alexwlchan.net | <INSERT> # -*- encoding: utf-8
import pytest
from reports import NGINX_LOG_REGEX
@pytest.mark.parametrize('log_line', [
<INSERT_END> <INSERT> # Unusual methods
'0.0.0.0 - - [01/Jan/2001:00:00:00 +0000] "HEAD /example HTTP/1.0" 200 0 "http://referrer.org" "Example user agent" "1.2.3.4"',
'0.0.0.0 - - [01/... | Add a few tests for the analytics code
| |
03f4ccf4168cdd39d3b8516346a31c4c3ac0ba49 | sieve/sieve.py | sieve/sieve.py | def sieve(n):
if n < 2:
return []
not_prime = set()
prime = [2]
for i in range(3, n+1, 2):
if i not in not_prime:
prime.append(i)
not_prime.update(range(i*i, n, i))
return prime
| def sieve(n):
if n < 2:
return []
not_prime = set()
prime = [2]
for i in range(3, n+1, 2):
if i not in not_prime:
prime.append(i)
not_prime.update(range(i*i, n+1, i))
return prime
| Fix bug where n is the square of a prime | Fix bug where n is the square of a prime
| Python | agpl-3.0 | CubicComet/exercism-python-solutions | <REPLACE_OLD> n, <REPLACE_NEW> n+1, <REPLACE_END> <|endoftext|> def sieve(n):
if n < 2:
return []
not_prime = set()
prime = [2]
for i in range(3, n+1, 2):
if i not in not_prime:
prime.append(i)
not_prime.update(range(i*i, n+1, i))
return prime
| Fix bug where n is the square of a prime
def sieve(n):
if n < 2:
return []
not_prime = set()
prime = [2]
for i in range(3, n+1, 2):
if i not in not_prime:
prime.append(i)
not_prime.update(range(i*i, n, i))
return prime
|
9353deefa7cc31fc4e9d01f29f7dab8c37b73a78 | setup.py | setup.py | from setuptools import setup, find_packages
# Dynamically calculate the version based on dbsettings.VERSION
version_tuple = (0, 4, None)
if version_tuple[2] is not None:
version = "%d.%d_%s" % version_tuple
else:
version = "%d.%d" % version_tuple[:2]
setup(
name='django-dbsettings',
version=version,
... | from setuptools import setup, find_packages
# Dynamically calculate the version based on dbsettings.VERSION
version_tuple = (0, 4, None)
if version_tuple[2] is not None:
if type(version_tuple[2]) == int:
version = "%d.%d.%s" % version_tuple
else:
version = "%d.%d_%s" % version_tuple
else:
v... | Allow version to have subrevision. | Allow version to have subrevision.
| Python | bsd-3-clause | helber/django-dbsettings,sciyoshi/django-dbsettings,zlorf/django-dbsettings,helber/django-dbsettings,DjangoAdminHackers/django-dbsettings,winfieldco/django-dbsettings,MiriamSexton/django-dbsettings,nwaxiomatic/django-dbsettings,DjangoAdminHackers/django-dbsettings,nwaxiomatic/django-dbsettings,zlorf/django-dbsettings,j... | <INSERT> if type(version_tuple[2]) == int:
version = "%d.%d.%s" % version_tuple
else:
<INSERT_END> <|endoftext|> from setuptools import setup, find_packages
# Dynamically calculate the version based on dbsettings.VERSION
version_tuple = (0, 4, None)
if version_tuple[2] is not None:
if type(vers... | Allow version to have subrevision.
from setuptools import setup, find_packages
# Dynamically calculate the version based on dbsettings.VERSION
version_tuple = (0, 4, None)
if version_tuple[2] is not None:
version = "%d.%d_%s" % version_tuple
else:
version = "%d.%d" % version_tuple[:2]
setup(
name='django... |
a135e5a0919f64984b1348c3956bd95dc183e874 | scripts/test_deployment.py | scripts/test_deployment.py | import os
import pytest
import requests
@pytest.fixture
def url():
return os.getenv("SITE", "http://localhost:5000")
def test_post_images(expect, url):
params = {"key": "iw", "lines": ["test", "deployment"]}
response = requests.post(f"{url}/api/images", json=params)
expect(response.status_code) == ... | import os
import pytest
import requests
@pytest.fixture
def url():
return os.getenv("SITE", "http://localhost:5000")
def test_post_images(expect, url):
params = {"key": "iw", "lines": ["test", "deployment"]}
response = requests.post(f"{url}/api/images", json=params)
expect(response.status_code) == ... | Add test for custom images | Add test for custom images
| Python | mit | jacebrowning/memegen,jacebrowning/memegen | <REPLACE_OLD> "image/jpeg"
<REPLACE_NEW> "image/jpeg"
def test_get_image_custom(expect, url):
response = requests.get(
f"{url}/custom/test.png?alt=https://www.gstatic.com/webp/gallery/1.jpg"
)
expect(response.status_code) == 200
expect(response.headers["Content-Type"]) == "image/png"
<REPLAC... | Add test for custom images
import os
import pytest
import requests
@pytest.fixture
def url():
return os.getenv("SITE", "http://localhost:5000")
def test_post_images(expect, url):
params = {"key": "iw", "lines": ["test", "deployment"]}
response = requests.post(f"{url}/api/images", json=params)
expe... |
0451c608525ee81e27c8f8ec78d31e50f0bed9d2 | box/models.py | box/models.py | BASE_URL = 'https://api.box.com/2.0'
FOLDERS_URL = '{}/folders/{{}}/items'.format(BASE_URL)
MAX_FOLDERS = 1000
class Client(object):
def __init__(self, provider_logic):
"""
Box client constructor
:param provider_logic: oauthclient ProviderLogic instance
:return:
"""
... | BASE_URL = 'https://api.box.com/2.0'
FOLDERS_URL = '{}/folders/{{}}/items'.format(BASE_URL)
MAX_FOLDERS = 1000
class Client(object):
def __init__(self, provider_logic):
"""
Box client constructor
:param provider_logic: oauthclient ProviderLogic instance
:return:
"""
... | Raise an exception when the API response is not successful | Raise an exception when the API response is not successful
| Python | apache-2.0 | rca/box | <REPLACE_OLD> params=params)
<REPLACE_NEW> params=params)
response.raise_for_status()
<REPLACE_END> <|endoftext|> BASE_URL = 'https://api.box.com/2.0'
FOLDERS_URL = '{}/folders/{{}}/items'.format(BASE_URL)
MAX_FOLDERS = 1000
class Client(object):
def __init__(self, provider_logic):
"""
... | Raise an exception when the API response is not successful
BASE_URL = 'https://api.box.com/2.0'
FOLDERS_URL = '{}/folders/{{}}/items'.format(BASE_URL)
MAX_FOLDERS = 1000
class Client(object):
def __init__(self, provider_logic):
"""
Box client constructor
:param provider_logic: oauthclie... |
8c05cb85c47db892dd13abbd91b3948c09b9a954 | statsmodels/tools/__init__.py | statsmodels/tools/__init__.py | from tools import add_constant, categorical
from datautils import Dataset
from statsmodels import NoseWrapper as Tester
test = Tester().test
| from tools import add_constant, categorical
from statsmodels import NoseWrapper as Tester
test = Tester().test
| Remove import of moved file | REF: Remove import of moved file
| Python | bsd-3-clause | josef-pkt/statsmodels,adammenges/statsmodels,saketkc/statsmodels,DonBeo/statsmodels,edhuckle/statsmodels,saketkc/statsmodels,wkfwkf/statsmodels,wzbozon/statsmodels,huongttlan/statsmodels,kiyoto/statsmodels,astocko/statsmodels,musically-ut/statsmodels,bsipocz/statsmodels,wwf5067/statsmodels,jstoxrocky/statsmodels,cbmoor... | <REPLACE_OLD> categorical
from datautils import Dataset
from <REPLACE_NEW> categorical
from <REPLACE_END> <|endoftext|> from tools import add_constant, categorical
from statsmodels import NoseWrapper as Tester
test = Tester().test
| REF: Remove import of moved file
from tools import add_constant, categorical
from datautils import Dataset
from statsmodels import NoseWrapper as Tester
test = Tester().test
|
de3aa6eed0fca73f3949ee5c584bcc79e1b98109 | setup.py | setup.py | from setuptools import setup, find_packages
setup(name='mutube',
version='0.1',
description='Scrape YouTube links from 4chan threads.',
url='https://github.com/AP-e/mutube',
license='unlicense',
classifiers=['Development Status :: 2 - Pre-Alpha',
'Programming Language :... | from setuptools import setup, find_packages
setup(name='mutube',
version='0.1',
description='Scrape YouTube links from 4chan threads.',
url='https://github.com/AP-e/mutube',
license='unlicense',
classifiers=['Development Status :: 2 - Pre-Alpha',
'Programming Language :... | Remove Python 3 only classifier | Remove Python 3 only classifier
| Python | unlicense | AP-e/mutube | <REPLACE_OLD> Python :: 3 :: Only'],
<REPLACE_NEW> Python'],
<REPLACE_END> <|endoftext|> from setuptools import setup, find_packages
setup(name='mutube',
version='0.1',
description='Scrape YouTube links from 4chan threads.',
url='https://github.com/AP-e/mutube',
license='unlicense',
cla... | Remove Python 3 only classifier
from setuptools import setup, find_packages
setup(name='mutube',
version='0.1',
description='Scrape YouTube links from 4chan threads.',
url='https://github.com/AP-e/mutube',
license='unlicense',
classifiers=['Development Status :: 2 - Pre-Alpha',
... |
01a86c09b768f6cc4e5bf9b389d09512f9e56ceb | sample_agent.py | sample_agent.py | import numpy as np
import matplotlib.pyplot as plt
class Agent(object):
def __init__(self, dim_action):
self.dim_action = dim_action
def act(self, ob, reward, done, vision):
#print("ACT!")
# Get an Observation from the environment.
# Each observation vectors are numpy array.
... | import numpy as np
import matplotlib.pyplot as plt
class Agent(object):
def __init__(self, dim_action):
self.dim_action = dim_action
def act(self, ob, reward, done, vision_on):
#print("ACT!")
# Get an Observation from the environment.
# Each observation vectors are numpy array... | Update to follow the new observation format (follow the vision input of OpenAI ATARI environment) | Update to follow the new observation format
(follow the vision input of OpenAI ATARI environment)
| Python | mit | travistang/late_fyt,travistang/late_fyt,ugo-nama-kun/gym_torcs,travistang/late_fyt,ugo-nama-kun/gym_torcs,ugo-nama-kun/gym_torcs,travistang/late_fyt,travistang/late_fyt,ugo-nama-kun/gym_torcs,ugo-nama-kun/gym_torcs,travistang/late_fyt,ugo-nama-kun/gym_torcs,travistang/late_fyt,ugo-nama-kun/gym_torcs | <REPLACE_OLD> vision):
<REPLACE_NEW> vision_on):
<REPLACE_END> <REPLACE_OLD> (3, 64, 64) <REPLACE_NEW> (64*64, 3) = (4096, 3) <REPLACE_END> <REPLACE_OLD> vision <REPLACE_NEW> vision_on <REPLACE_END> <INSERT> print(vision.shape)
<INSERT_END> <REPLACE_OLD> vision[i]
<REPLACE_NEW> vision[:, i].reshape((64,... | Update to follow the new observation format
(follow the vision input of OpenAI ATARI environment)
import numpy as np
import matplotlib.pyplot as plt
class Agent(object):
def __init__(self, dim_action):
self.dim_action = dim_action
def act(self, ob, reward, done, vision):
#print("ACT!")
... |
ab4ae040895c50da6cb0827f6461d1733c7fe30a | tests/test_plugin_states.py | tests/test_plugin_states.py | from contextlib import contextmanager
from os import path
from unittest import TestCase
from canaryd_packages import six
from dictdiffer import diff
from jsontest import JsonTest
from mock import patch
from canaryd.plugin import get_plugin_by_name
@six.add_metaclass(JsonTest)
class TestPluginStates(TestCase):
j... | from contextlib import contextmanager
from os import path
from unittest import TestCase
from dictdiffer import diff
from jsontest import JsonTest
from mock import patch
from canaryd_packages import six
from canaryd.plugin import get_plugin_by_name
class TestPluginRealStates(TestCase):
def run_plugin(self, plug... | Add real plugin state tests for plugins that always work (meta, containers, services). | Add real plugin state tests for plugins that always work (meta, containers, services).
| Python | mit | Oxygem/canaryd,Oxygem/canaryd | <DELETE> canaryd_packages import six
from <DELETE_END> <INSERT> canaryd_packages import six
from <INSERT_END> <REPLACE_OLD> get_plugin_by_name
@six.add_metaclass(JsonTest)
class <REPLACE_NEW> get_plugin_by_name
class TestPluginRealStates(TestCase):
def run_plugin(self, plugin_name):
plugin = get_plugin... | Add real plugin state tests for plugins that always work (meta, containers, services).
from contextlib import contextmanager
from os import path
from unittest import TestCase
from canaryd_packages import six
from dictdiffer import diff
from jsontest import JsonTest
from mock import patch
from canaryd.plugin import g... |
bac71c099f0196d5ab74a8ec08cedc32ab008e1c | graphite/post-setup-graphite-web.py | graphite/post-setup-graphite-web.py | #!/usr/bin/env python
import os
import random
import string
import sys
from django.utils.crypto import get_random_string
## Check if the script was already executed
flag_filename = '/opt/graphite/post-setup-complete'
if os.path.isfile(flag_filename):
sys.exit(0)
## Add SECRET_KEY to local_settings.py
settings... | #!/usr/bin/env python
import os
import random
import string
import sys
from django.utils.crypto import get_random_string
## Check if the script was already executed
flag_filename = '/opt/graphite/post-setup-complete'
if os.path.isfile(flag_filename):
sys.exit(0)
## Add SECRET_KEY to local_settings.py
settings... | Check if admin user exists before creating one | Check if admin user exists before creating one
| Python | mit | rvernica/Dockerfile,rvernica/docker-library,rvernica/docker-library | <REPLACE_OLD> range(20))
User.objects.create_superuser('admin', <REPLACE_NEW> range(20))
if not User.objects.filter(username='admin').exists():
User.objects.create_superuser('admin', <REPLACE_END> <REPLACE_OLD> password)
print <REPLACE_NEW> password)
print <REPLACE_END> <|endoftext|> #!/usr/bin/env python
im... | Check if admin user exists before creating one
#!/usr/bin/env python
import os
import random
import string
import sys
from django.utils.crypto import get_random_string
## Check if the script was already executed
flag_filename = '/opt/graphite/post-setup-complete'
if os.path.isfile(flag_filename):
sys.exit(0)
... |
210581cfef3d54b055ec9f9b1dc6d19b757a4d6e | cli/cli.py | cli/cli.py | import argparse
parser = argparse.ArgumentParser(prog='moocx', description='EdX MOOC Data Anaylysis')
parser.add_argument('-v', '--version', action='version', version='0.1.0')
parser.parse_args()
| Add cmd for getting version | Add cmd for getting version
| Python | mit | McGillX/edx_data_research,McGillX/edx_data_research,McGillX/edx_data_research | <REPLACE_OLD> <REPLACE_NEW> import argparse
parser = argparse.ArgumentParser(prog='moocx', description='EdX MOOC Data Anaylysis')
parser.add_argument('-v', '--version', action='version', version='0.1.0')
parser.parse_args()
<REPLACE_END> <|endoftext|> import argparse
parser = argparse.ArgumentParser(prog='moocx', d... | Add cmd for getting version
| |
d2ad097e08b8c5e9d318968f0a6f859f03f7c07a | mycli/packages/special/dbcommands.py | mycli/packages/special/dbcommands.py | import logging
from .main import special_command, RAW_QUERY, PARSED_QUERY
log = logging.getLogger(__name__)
@special_command('\\dt', '\\dt', 'List or describe tables.', arg_type=PARSED_QUERY, case_sensitive=True)
def list_tables(cur, arg=None, arg_type=PARSED_QUERY):
if arg:
query = 'SHOW FIELDS FROM {0}'... | import logging
from .main import special_command, RAW_QUERY, PARSED_QUERY
log = logging.getLogger(__name__)
@special_command('\\dt', '\\dt [table]', 'List or describe tables.', arg_type=PARSED_QUERY, case_sensitive=True)
def list_tables(cur, arg=None, arg_type=PARSED_QUERY):
if arg:
query = 'SHOW FIELDS F... | Change \dt syntax to add an optional table name. | Change \dt syntax to add an optional table name.
| Python | bsd-3-clause | mdsrosa/mycli,jinstrive/mycli,j-bennet/mycli,martijnengler/mycli,martijnengler/mycli,mdsrosa/mycli,danieljwest/mycli,j-bennet/mycli,jinstrive/mycli,shoma/mycli,danieljwest/mycli,shoma/mycli | <REPLACE_OLD> '\\dt', <REPLACE_NEW> '\\dt [table]', <REPLACE_END> <|endoftext|> import logging
from .main import special_command, RAW_QUERY, PARSED_QUERY
log = logging.getLogger(__name__)
@special_command('\\dt', '\\dt [table]', 'List or describe tables.', arg_type=PARSED_QUERY, case_sensitive=True)
def list_tables(c... | Change \dt syntax to add an optional table name.
import logging
from .main import special_command, RAW_QUERY, PARSED_QUERY
log = logging.getLogger(__name__)
@special_command('\\dt', '\\dt', 'List or describe tables.', arg_type=PARSED_QUERY, case_sensitive=True)
def list_tables(cur, arg=None, arg_type=PARSED_QUERY):
... |
9d105a62b29f0cd170343705bbe20c509d523e46 | osf_tests/test_handlers.py | osf_tests/test_handlers.py | import pytest
from nose.tools import assert_raises
from framework.celery_tasks import handlers
from website.project.tasks import on_node_updated
class TestCeleryHandlers:
@pytest.fixture()
def queue(self):
return handlers.queue()
def test_get_task_from_queue_not_there(self):
task = hand... | Add tests for new get_task_from_queue celery helper | Add tests for new get_task_from_queue celery helper
| Python | apache-2.0 | cslzchen/osf.io,caseyrollins/osf.io,mattclark/osf.io,aaxelb/osf.io,Johnetordoff/osf.io,pattisdr/osf.io,erinspace/osf.io,erinspace/osf.io,sloria/osf.io,pattisdr/osf.io,mfraezz/osf.io,caseyrollins/osf.io,cslzchen/osf.io,mattclark/osf.io,cslzchen/osf.io,felliott/osf.io,felliott/osf.io,brianjgeiger/osf.io,Johnetordoff/osf.... | <REPLACE_OLD> <REPLACE_NEW> import pytest
from nose.tools import assert_raises
from framework.celery_tasks import handlers
from website.project.tasks import on_node_updated
class TestCeleryHandlers:
@pytest.fixture()
def queue(self):
return handlers.queue()
def test_get_task_from_queue_not_the... | Add tests for new get_task_from_queue celery helper
| |
54f27f507820b5c9a7e832c46eb2a5ba3d918a2f | scripts/task/solver.py | scripts/task/solver.py | import numpy as np
from eigen3 import toEigen
import rbdyn as rbd
class WLSSolver(object):
def __init__(self):
self.tasks = []
def addTask(self, task, weight):
t = [task, weight]
self.tasks.append(t)
return t
def rmTask(self, taskDef):
self.tasks.remove(taskDef)
def solve(self, mb, ... | import numpy as np
from eigen3 import toEigenX
import rbdyn as rbd
class WLSSolver(object):
def __init__(self):
self.tasks = []
def addTask(self, task, weight):
t = [task, weight]
self.tasks.append(t)
return t
def rmTask(self, taskDef):
self.tasks.remove(taskDef)
def solve(self, mb,... | Fix a bad eigen vector cast. | Fix a bad eigen vector cast.
| Python | bsd-2-clause | jrl-umi3218/RBDyn,gergondet/RBDyn,gergondet/RBDyn,gergondet/RBDyn,jrl-umi3218/RBDyn,jrl-umi3218/RBDyn,jrl-umi3218/RBDyn,gergondet/RBDyn,gergondet/RBDyn | <REPLACE_OLD> toEigen
import <REPLACE_NEW> toEigenX
import <REPLACE_END> <REPLACE_OLD> toEigen(alpha2))
<REPLACE_NEW> toEigenX(alpha2))
<REPLACE_END> <|endoftext|> import numpy as np
from eigen3 import toEigenX
import rbdyn as rbd
class WLSSolver(object):
def __init__(self):
self.tasks = []
def addTask(... | Fix a bad eigen vector cast.
import numpy as np
from eigen3 import toEigen
import rbdyn as rbd
class WLSSolver(object):
def __init__(self):
self.tasks = []
def addTask(self, task, weight):
t = [task, weight]
self.tasks.append(t)
return t
def rmTask(self, taskDef):
self.tasks.remove(tas... |
9e067b8f53c8ee8afae63996e725614e5766059f | tests/aggregate/test_many_to_many_relationships.py | tests/aggregate/test_many_to_many_relationships.py | import sqlalchemy as sa
from sqlalchemy_utils.aggregates import aggregated
from tests import TestCase
class TestAggregatesWithManyToManyRelationships(TestCase):
dns = 'postgres://postgres@localhost/sqlalchemy_utils_test'
def create_models(self):
user_group = sa.Table('user_group', self.Base.metadata,... | Add tests for many to many aggregates | Add tests for many to many aggregates
| Python | bsd-3-clause | JackWink/sqlalchemy-utils,rmoorman/sqlalchemy-utils,marrybird/sqlalchemy-utils,konstantinoskostis/sqlalchemy-utils,cheungpat/sqlalchemy-utils,joshfriend/sqlalchemy-utils,tonyseek/sqlalchemy-utils,tonyseek/sqlalchemy-utils,joshfriend/sqlalchemy-utils,spoqa/sqlalchemy-utils | <REPLACE_OLD> <REPLACE_NEW> import sqlalchemy as sa
from sqlalchemy_utils.aggregates import aggregated
from tests import TestCase
class TestAggregatesWithManyToManyRelationships(TestCase):
dns = 'postgres://postgres@localhost/sqlalchemy_utils_test'
def create_models(self):
user_group = sa.Table('use... | Add tests for many to many aggregates
| |
bf7dd8bb6ff3e4a8f6412122ca23829c35554082 | contrib/examples/sensors/echo_flask_app.py | contrib/examples/sensors/echo_flask_app.py | from flask import request, Flask
from st2reactor.sensor.base import Sensor
class EchoFlaskSensor(Sensor):
def __init__(self, sensor_service, config):
super(EchoFlaskSensor, self).__init__(
sensor_service=sensor_service,
config=config
)
self._host = '127.0.0.1'
... | from flask import request, Flask
from st2reactor.sensor.base import Sensor
class EchoFlaskSensor(Sensor):
def __init__(self, sensor_service, config):
super(EchoFlaskSensor, self).__init__(
sensor_service=sensor_service,
config=config
)
self._host = '127.0.0.1'
... | Update the port to be an integer. | Update the port to be an integer.
Fix the port to be an integer. Use the format function for string formatting. | Python | apache-2.0 | StackStorm/st2,StackStorm/st2,nzlosh/st2,StackStorm/st2,StackStorm/st2,Plexxi/st2,nzlosh/st2,Plexxi/st2,Plexxi/st2,nzlosh/st2,nzlosh/st2,Plexxi/st2 | <REPLACE_OLD> EchoFlaskSensor(Sensor):
<REPLACE_NEW> EchoFlaskSensor(Sensor):
<REPLACE_END> <REPLACE_OLD> '5000'
<REPLACE_NEW> 5000
<REPLACE_END> <REPLACE_OLD> http://%s:%s%s' %
(self._host, <REPLACE_NEW> http://{}:{}{}'.format(
self._host, <REPLACE_END> <|endoftext|> from flask ... | Update the port to be an integer.
Fix the port to be an integer. Use the format function for string formatting.
from flask import request, Flask
from st2reactor.sensor.base import Sensor
class EchoFlaskSensor(Sensor):
def __init__(self, sensor_service, config):
super(EchoFlaskSensor, self).__init__(
... |
7b0bd58c359f5ea21af907cb90234171a6cfca5c | photobox/photobox.py | photobox/photobox.py | from photofolder import Photofolder
from folder import RealFolder
from gphotocamera import Gphoto
from main import Photobox
from rcswitch import RCSwitch
##########
# config #
##########
photodirectory = '/var/www/html/'
cheesepicfolder = '/home/pi/cheesepics/'
windowwidth = 1024
windowheight = 768
camera = Gphoto()
s... | from cheesefolder import Cheesefolder
from photofolder import Photofolder
from folder import RealFolder
from gphotocamera import Gphoto
from main import Photobox
from rcswitch import RCSwitch
##########
# config #
##########
photodirectory = '/var/www/html/'
cheesepicpath = '/home/pi/cheesepics/'
windowwidth = 1024
wi... | Use the correct chesefolder objects | Use the correct chesefolder objects
| Python | mit | MarkusAmshove/Photobox | <INSERT> cheesefolder import Cheesefolder
from <INSERT_END> <REPLACE_OLD> '/var/www/html/'
cheesepicfolder <REPLACE_NEW> '/var/www/html/'
cheesepicpath <REPLACE_END> <REPLACE_OLD> RealFolder(cheesepicfolder)
photofolder <REPLACE_NEW> RealFolder(cheesepicpath)
cheesef = Cheesefolder(cheesepicFolder)
photofolder <REPLACE... | Use the correct chesefolder objects
from photofolder import Photofolder
from folder import RealFolder
from gphotocamera import Gphoto
from main import Photobox
from rcswitch import RCSwitch
##########
# config #
##########
photodirectory = '/var/www/html/'
cheesepicfolder = '/home/pi/cheesepics/'
windowwidth = 1024
w... |
dbfa14401c0b50eb1a3cac413652cb975ee9d41f | ocw-ui/backend/tests/test_directory_helpers.py | ocw-ui/backend/tests/test_directory_helpers.py | import os
import unittest
from webtest import TestApp
from ..run_webservices import app
from ..directory_helpers import _get_clean_directory_path
test_app = TestApp(app)
class TestDirectoryPathCleaner(unittest.TestCase):
PATH_LEADER = '/tmp/foo'
VALID_CLEAN_DIR = '/tmp/foo/bar'
if not os.path.exists(PAT... | Add valid directory cleaner helper test | Add valid directory cleaner helper test
git-svn-id: https://svn.apache.org/repos/asf/incubator/climate/trunk@1563517 13f79535-47bb-0310-9956-ffa450edef68
Former-commit-id: a23ba7556854cb30faaa0dfc19fdbcc6cb67382c | Python | apache-2.0 | huikyole/climate,agoodm/climate,MJJoyce/climate,MBoustani/climate,agoodm/climate,MJJoyce/climate,kwhitehall/climate,MBoustani/climate,lewismc/climate,agoodm/climate,pwcberry/climate,MBoustani/climate,Omkar20895/climate,MJJoyce/climate,agoodm/climate,kwhitehall/climate,lewismc/climate,pwcberry/climate,huikyole/climate,r... | <INSERT> import os
import unittest
from webtest import TestApp
from ..run_webservices import app
from ..directory_helpers import _get_clean_directory_path
test_app = TestApp(app)
class TestDirectoryPathCleaner(unittest.TestCase):
<INSERT_END> <INSERT> PATH_LEADER = '/tmp/foo'
VALID_CLEAN_DIR = '/tmp/foo/bar'
... | Add valid directory cleaner helper test
git-svn-id: https://svn.apache.org/repos/asf/incubator/climate/trunk@1563517 13f79535-47bb-0310-9956-ffa450edef68
Former-commit-id: a23ba7556854cb30faaa0dfc19fdbcc6cb67382c
| |
67b243915ef95ff1b9337bc67053d18df372e79d | unitypack/enums.py | unitypack/enums.py | from enum import IntEnum
class RuntimePlatform(IntEnum):
OSXEditor = 0
OSXPlayer = 1
WindowsPlayer = 2
OSXWebPlayer = 3
OSXDashboardPlayer = 4
WindowsWebPlayer = 5
WindowsEditor = 7
IPhonePlayer = 8
PS3 = 9
XBOX360 = 10
Android = 11
NaCl = 12
LinuxPlayer = 13
FlashPlayer = 15
WebGLPlayer = 17
MetroPla... | from enum import IntEnum
class RuntimePlatform(IntEnum):
OSXEditor = 0
OSXPlayer = 1
WindowsPlayer = 2
OSXWebPlayer = 3
OSXDashboardPlayer = 4
WindowsWebPlayer = 5
WindowsEditor = 7
IPhonePlayer = 8
PS3 = 9
XBOX360 = 10
Android = 11
NaCl = 12
LinuxPlayer = 13
FlashPlayer = 15
WebGLPlayer = 17
MetroPla... | Add PSMPlayer and SamsungTVPlayer platforms | Add PSMPlayer and SamsungTVPlayer platforms
| Python | mit | andburn/python-unitypack | <INSERT> 26
PSMPlayer = <INSERT_END> <REPLACE_OLD> 27
<REPLACE_NEW> 27
SamsungTVPlayer = 28
<REPLACE_END> <|endoftext|> from enum import IntEnum
class RuntimePlatform(IntEnum):
OSXEditor = 0
OSXPlayer = 1
WindowsPlayer = 2
OSXWebPlayer = 3
OSXDashboardPlayer = 4
WindowsWebPlayer = 5
WindowsEditor = 7
IPho... | Add PSMPlayer and SamsungTVPlayer platforms
from enum import IntEnum
class RuntimePlatform(IntEnum):
OSXEditor = 0
OSXPlayer = 1
WindowsPlayer = 2
OSXWebPlayer = 3
OSXDashboardPlayer = 4
WindowsWebPlayer = 5
WindowsEditor = 7
IPhonePlayer = 8
PS3 = 9
XBOX360 = 10
Android = 11
NaCl = 12
LinuxPlayer = 13
... |
fc105f413e6683980c5d2fcc93a471ebbc9fecba | utils/files_provider.py | utils/files_provider.py | from string import Template
__author__ = 'maa'
templates_folder = 'file_templates_folder\\'
def create_and_full_fill_file(template_file_name, destination_file_path, file_name, kwargs):
template_file = open(templates_folder + template_file_name, 'r')
file_content = template_file.read()
template_file.clos... | from string import Template
__author__ = 'maa'
templates_folder = 'file_templates_folder\\'
def create_and_full_fill_file(template_file_name, destination_file_path, kwargs):
template_file = open(template_file_name, 'r')
file_content = template_file.read()
template_file.close()
template = Template(f... | Change method params because they are not necessary. | [dev] Change method params because they are not necessary.
| Python | apache-2.0 | amatkivskiy/baidu,amatkivskiy/baidu | <DELETE> file_name, <DELETE_END> <REPLACE_OLD> open(templates_folder + template_file_name, <REPLACE_NEW> open(template_file_name, <REPLACE_END> <REPLACE_OLD> open(destination_file_path + '\\' + file_name, <REPLACE_NEW> open(destination_file_path, <REPLACE_END> <|endoftext|> from string import Template
__author__ = 'ma... | [dev] Change method params because they are not necessary.
from string import Template
__author__ = 'maa'
templates_folder = 'file_templates_folder\\'
def create_and_full_fill_file(template_file_name, destination_file_path, file_name, kwargs):
template_file = open(templates_folder + template_file_name, 'r')
... |
f876c410ab39bd348f79ed2a256c09edd4225c56 | odo/backends/tests/test_dask_array.py | odo/backends/tests/test_dask_array.py | from __future__ import absolute_import, division, print_function
from odo.backends.dask_array import append, Array, merge
from dask.array.core import insert_to_ooc
from dask import core
from odo import convert, into
from odo.utils import tmpfile
import numpy as np
import bcolz
def eq(a, b):
c = a == b
if isi... | Migrate tests for dask array conversions from dask package. | Migrate tests for dask array conversions from dask package.
| Python | bsd-3-clause | Dannnno/odo,Dannnno/odo,ywang007/odo,ContinuumIO/odo,ContinuumIO/odo,ywang007/odo,cpcloud/odo,blaze/odo,cowlicks/odo,blaze/odo,alexmojaki/odo,quantopian/odo,alexmojaki/odo,cpcloud/odo,cowlicks/odo,quantopian/odo | <REPLACE_OLD> <REPLACE_NEW> from __future__ import absolute_import, division, print_function
from odo.backends.dask_array import append, Array, merge
from dask.array.core import insert_to_ooc
from dask import core
from odo import convert, into
from odo.utils import tmpfile
import numpy as np
import bcolz
def eq(a, ... | Migrate tests for dask array conversions from dask package.
| |
598911ebd93085926602a26e9bbf835df0bea0b6 | test/test_rcsparse.py | test/test_rcsparse.py | import unittest
from rcsparse import rcsfile
from os.path import dirname, join
REV_NUMBER = 0
REV_STATE = 3
class Test(unittest.TestCase):
def test_rcsfile(self):
f = rcsfile(join(dirname(__file__), 'data', 'patch-copyin_c,v'))
self.assertEquals(f.head, '1.1')
self.assertEquals(f.revs[f.h... | Add a test case for Simon Schubert's rcsparse library | Add a test case for Simon Schubert's rcsparse library
| Python | isc | ustuehler/git-cvs,ustuehler/git-cvs | <INSERT> import unittest
from rcsparse import rcsfile
from os.path import dirname, join
REV_NUMBER = 0
REV_STATE = 3
class Test(unittest.TestCase):
<INSERT_END> <INSERT> def test_rcsfile(self):
f = rcsfile(join(dirname(__file__), 'data', 'patch-copyin_c,v'))
self.assertEquals(f.head, '1.1')
... | Add a test case for Simon Schubert's rcsparse library
| |
6cfd296a86c1b475101c179a45a7453b76dcbfd5 | riak/util.py | riak/util.py | import collections
def quacks_like_dict(object):
"""Check if object is dict-like"""
return isinstance(object, collections.Mapping)
def deep_merge(a, b):
"""Merge two deep dicts non-destructively
Uses a stack to avoid maximum recursion depth exceptions
>>> a = {'a': 1, 'b': {1: 1, 2: ... | try:
from collections import Mapping
except ImportError:
# compatibility with Python 2.5
Mapping = dict
def quacks_like_dict(object):
"""Check if object is dict-like"""
return isinstance(object, Mapping)
def deep_merge(a, b):
"""Merge two deep dicts non-destructively
Uses a stack ... | Adjust for compatibility with Python 2.5 | Adjust for compatibility with Python 2.5
| Python | apache-2.0 | basho/riak-python-client,GabrielNicolasAvellaneda/riak-python-client,GabrielNicolasAvellaneda/riak-python-client,bmess/riak-python-client,basho/riak-python-client,basho/riak-python-client,bmess/riak-python-client | <INSERT> try:
from collections <INSERT_END> <REPLACE_OLD> collections
def <REPLACE_NEW> Mapping
except ImportError:
# compatibility with Python 2.5
Mapping = dict
def <REPLACE_END> <REPLACE_OLD> collections.Mapping)
<REPLACE_NEW> Mapping)
<REPLACE_END> <|endoftext|> try:
from collections import Mapp... | Adjust for compatibility with Python 2.5
import collections
def quacks_like_dict(object):
"""Check if object is dict-like"""
return isinstance(object, collections.Mapping)
def deep_merge(a, b):
"""Merge two deep dicts non-destructively
Uses a stack to avoid maximum recursion depth exceptions... |
5d278330812618d55ba4efafcb097e3f5ee6db04 | project/category/views.py | project/category/views.py | from flask import render_template, Blueprint, url_for, \
redirect, flash, request
from project.models import Category, Webinar
category_blueprint = Blueprint('category', __name__,)
@category_blueprint.route('/categories')
def index():
categories = Category.query.all()
return render_template('category/ca... | from flask import render_template, Blueprint, url_for, \
redirect, flash, request
from project.models import Category, Webinar
category_blueprint = Blueprint('category', __name__,)
@category_blueprint.route('/categories')
def index():
categories = Category.query.all()
return render_template('category/ca... | Add basic view to see category show page | Add basic view to see category show page
| Python | mit | dylanshine/streamschool,dylanshine/streamschool | <REPLACE_OLD> categories=categories)
<REPLACE_NEW> categories=categories)
@category_blueprint.route('/category/<category_slug>')
def show(category_slug):
category = Category.query.filter_by(slug=category_slug)
return render_template('category/category.html', category=category)
<REPLACE_END> <|endoftext|> fr... | Add basic view to see category show page
from flask import render_template, Blueprint, url_for, \
redirect, flash, request
from project.models import Category, Webinar
category_blueprint = Blueprint('category', __name__,)
@category_blueprint.route('/categories')
def index():
categories = Category.query.all... |
0aa757955d631df9fb8e6cbe3e372dcae56e2255 | django_mailbox/transports/imap.py | django_mailbox/transports/imap.py | from imaplib import IMAP4, IMAP4_SSL
from .base import EmailTransport, MessageParseError
class ImapTransport(EmailTransport):
def __init__(self, hostname, port=None, ssl=False, archive=''):
self.hostname = hostname
self.port = port
self.archive = archive
if ssl:
self.t... | from imaplib import IMAP4, IMAP4_SSL
from .base import EmailTransport, MessageParseError
class ImapTransport(EmailTransport):
def __init__(self, hostname, port=None, ssl=False, archive=''):
self.hostname = hostname
self.port = port
self.archive = archive
if ssl:
self.t... | Create archive folder if it does not exist. | Create archive folder if it does not exist.
| Python | mit | coddingtonbear/django-mailbox,ad-m/django-mailbox,Shekharrajak/django-mailbox,leifurhauks/django-mailbox | <REPLACE_OLD> == <REPLACE_NEW> is <REPLACE_END> <REPLACE_OLD> self.archive = False
<REPLACE_NEW> # If the archive folder does not exist, create it
self.server.create(self.archive)
<REPLACE_END> <|endoftext|> from imaplib import IMAP4, IMAP4_SSL
from .base import EmailTransport, MessageParseError
... | Create archive folder if it does not exist.
from imaplib import IMAP4, IMAP4_SSL
from .base import EmailTransport, MessageParseError
class ImapTransport(EmailTransport):
def __init__(self, hostname, port=None, ssl=False, archive=''):
self.hostname = hostname
self.port = port
self.archive... |
e5af653b2133b493c7888bb305488e932acb2274 | doc/examples/special/plot_hinton.py | doc/examples/special/plot_hinton.py | """
==============
Hinton diagram
==============
Hinton diagrams are useful for visualizing the values of a 2D array. Positive
and negative values represented by white and black squares, respectively, and
the size of each square represents the magnitude of each value.
The `special.hinton` function is based off of the... | """
==============
Hinton diagram
==============
Hinton diagrams are useful for visualizing the values of a 2D array: Positive
and negative values are represented by white and black squares, respectively,
and the size of each square represents the magnitude of each value.
``special.hinton`` is based off of the `Hinto... | Clean up hinton example text. | DOC: Clean up hinton example text.
| Python | bsd-3-clause | tonysyu/mpltools,matteoicardi/mpltools | <REPLACE_OLD> array. <REPLACE_NEW> array: <REPLACE_END> <INSERT> are <INSERT_END> <REPLACE_OLD> respectively, and
the <REPLACE_NEW> respectively,
and the <REPLACE_END> <REPLACE_OLD> value.
The `special.hinton` function <REPLACE_NEW> value.
``special.hinton`` <REPLACE_END> <REPLACE_OLD> Hinton demo <REPLACE_NEW> `Hint... | DOC: Clean up hinton example text.
"""
==============
Hinton diagram
==============
Hinton diagrams are useful for visualizing the values of a 2D array. Positive
and negative values represented by white and black squares, respectively, and
the size of each square represents the magnitude of each value.
The `special.... |
1ef1d7a973ce44943fc59315d1f962ed59f06e33 | seacucumber/backend.py | seacucumber/backend.py | """
This module contains the SESBackend class, which is what you'll want to set in
your settings.py::
EMAIL_BACKEND = 'seacucumber.backend.SESBackend'
"""
from django.core.mail.backends.base import BaseEmailBackend
from seacucumber.tasks import SendEmailTask
class SESBackend(BaseEmailBackend):
"""
A Djang... | """
This module contains the SESBackend class, which is what you'll want to set in
your settings.py::
EMAIL_BACKEND = 'seacucumber.backend.SESBackend'
"""
from django.core.mail.backends.base import BaseEmailBackend
from seacucumber.tasks import SendEmailTask
class SESBackend(BaseEmailBackend):
"""
A Djan... | Patch to send mails with UTF8 encoding | Patch to send mails with UTF8 encoding
Just a temp fix
| Python | mit | makielab/sea-cucumber,duointeractive/sea-cucumber | <REPLACE_OLD> SendEmailTask
class <REPLACE_NEW> SendEmailTask
class <REPLACE_END> <REPLACE_OLD> sent.
<REPLACE_NEW> sent.
<REPLACE_END> <REPLACE_OLD> message.message().as_string(),
<REPLACE_NEW> message.message().as_string().decode('utf8'),
<REPLACE_END> <REPLACE_OLD> num_sent
<REPLACE_NEW> num_sent
... | Patch to send mails with UTF8 encoding
Just a temp fix
"""
This module contains the SESBackend class, which is what you'll want to set in
your settings.py::
EMAIL_BACKEND = 'seacucumber.backend.SESBackend'
"""
from django.core.mail.backends.base import BaseEmailBackend
from seacucumber.tasks import SendEmailTask... |
e3d0bcb91f59616eb0aa8cc56f72315c362493cf | utils/webhistory/epiphany-history-to-ttl.py | utils/webhistory/epiphany-history-to-ttl.py | import xml.dom.minidom
from xml.dom.minidom import Node
import time
import sys, os
PROPERTIES = {2: ("nie:title", str),
3: ("nfo:uri", str),
4: ("nie:usageCounter", int),
6: ("nie:lastRefreshed", time.struct_time)}
# Use time.struct_time as type for dates, even when the format... | Add util to generate real webhistory | Add util to generate real webhistory
Added program that reads epiphany web browsing history and print it
in turtle format.
| Python | lgpl-2.1 | hoheinzollern/tracker,hoheinzollern/tracker,outofbits/tracker,outofbits/tracker,outofbits/tracker,hoheinzollern/tracker,outofbits/tracker,hoheinzollern/tracker,outofbits/tracker,hoheinzollern/tracker,outofbits/tracker,hoheinzollern/tracker,hoheinzollern/tracker,outofbits/tracker | <REPLACE_OLD> <REPLACE_NEW> import xml.dom.minidom
from xml.dom.minidom import Node
import time
import sys, os
PROPERTIES = {2: ("nie:title", str),
3: ("nfo:uri", str),
4: ("nie:usageCounter", int),
6: ("nie:lastRefreshed", time.struct_time)}
# Use time.struct_time as type fo... | Add util to generate real webhistory
Added program that reads epiphany web browsing history and print it
in turtle format.
| |
5f5f26a9d31c5c647d69e0400e381abd0ec103b0 | lwr/managers/util/env.py | lwr/managers/util/env.py |
RAW_VALUE_BY_DEFAULT = False
def env_to_statement(env):
''' Return the abstraction description of an environment variable definition
into a statement for shell script.
>>> env_to_statement(dict(name='X', value='Y'))
'X="Y"; export X'
>>> env_to_statement(dict(name='X', value='Y', raw=True))
... | Add missing file from previous commit (thanks Izzet Fatih). | Add missing file from previous commit (thanks Izzet Fatih).
| Python | apache-2.0 | jmchilton/pulsar,ssorgatem/pulsar,ssorgatem/pulsar,natefoo/pulsar,jmchilton/pulsar,galaxyproject/pulsar,jmchilton/lwr,natefoo/pulsar,jmchilton/lwr,galaxyproject/pulsar | <INSERT>
RAW_VALUE_BY_DEFAULT = False
def env_to_statement(env):
<INSERT_END> <INSERT> ''' Return the abstraction description of an environment variable definition
into a statement for shell script.
>>> env_to_statement(dict(name='X', value='Y'))
'X="Y"; export X'
>>> env_to_statement(dict(name='... | Add missing file from previous commit (thanks Izzet Fatih).
| |
b11bd211a117b695f2a1a2aa09763f4332e37ace | tests/ratings/test_rating_signals.py | tests/ratings/test_rating_signals.py | import pytest
from django.core.exceptions import ObjectDoesNotExist
from adhocracy4.ratings import models
@pytest.mark.django_db
def test_delete_of_content_object(rating):
question = rating.content_object
question.delete()
with pytest.raises(ObjectDoesNotExist):
models.Rating.objects.get(id=rat... | Add test for rating signals | Add test for rating signals
| Python | agpl-3.0 | liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4 | <INSERT> import pytest
from django.core.exceptions import ObjectDoesNotExist
from adhocracy4.ratings import models
@pytest.mark.django_db
def test_delete_of_content_object(rating):
<INSERT_END> <INSERT> question = rating.content_object
question.delete()
with pytest.raises(ObjectDoesNotExist):
mo... | Add test for rating signals
| |
07800eb26817458d2d12afeb3f670a2119533639 | setup.py | setup.py | from __future__ import unicode_literals
import re
from setuptools import find_packages, setup
def get_version(filename):
content = open(filename).read()
metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", content))
return metadata['version']
setup(
name='Mopidy-MusicBox-Webclient',
version=... | from __future__ import unicode_literals
import re
from setuptools import find_packages, setup
def get_version(filename):
content = open(filename).read()
metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", content))
return metadata['version']
setup(
name='Mopidy-MusicBox-Webclient',
version=... | Update URL to github repository. | Update URL to github repository.
| Python | apache-2.0 | pimusicbox/mopidy-musicbox-webclient,woutervanwijk/Mopidy-MusicBox-Webclient,woutervanwijk/Mopidy-MusicBox-Webclient,pimusicbox/mopidy-musicbox-webclient,woutervanwijk/Mopidy-MusicBox-Webclient,pimusicbox/mopidy-musicbox-webclient | <REPLACE_OLD> url='https://github.com/woutervanwijk/mopidy-musicbox-webclient',
<REPLACE_NEW> url='https://github.com/pimusicbox/mopidy-musicbox-webclient',
<REPLACE_END> <|endoftext|> from __future__ import unicode_literals
import re
from setuptools import find_packages, setup
def get_version(filename):
cont... | Update URL to github repository.
from __future__ import unicode_literals
import re
from setuptools import find_packages, setup
def get_version(filename):
content = open(filename).read()
metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", content))
return metadata['version']
setup(
name='Mopidy... |
9f82e6b96bf4702901f86374e8a05c3d550091e7 | app/soc/logic/helper/convert_db.py | app/soc/logic/helper/convert_db.py | #!/usr/bin/python2.5
#
# Copyright 2008 the Melange authors.
#
# 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... | Add a script to normalize user accounts | Add a script to normalize user accounts
Patch by: Sverre Rabbelier
| Python | apache-2.0 | MatthewWilkes/mw4068-packaging,MatthewWilkes/mw4068-packaging,MatthewWilkes/mw4068-packaging,MatthewWilkes/mw4068-packaging | <INSERT> #!/usr/bin/python2.5
#
# Copyright 2008 the Melange authors.
#
# 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
#
# <INSERT_END> <INSERT> http://www.apache.org/licenses/LICENSE-2.0
#
#... | Add a script to normalize user accounts
Patch by: Sverre Rabbelier
| |
a87d927acc42ba2fe4a82004ce919882024039a9 | kboard/board/forms.py | kboard/board/forms.py | from django import forms
from django.forms.utils import ErrorList
from django_summernote.widgets import SummernoteWidget
from .models import Post
EMPTY_TITLE_ERROR = "제목을 입력하세요"
EMPTY_CONTENT_ERROR = "내용을 입력하세요"
class DivErrorList(ErrorList):
def __str__(self):
return self.as_divs()
def as_divs(sel... | from django import forms
from django.forms.utils import ErrorList
from django_summernote.widgets import SummernoteWidget
from .models import Post
EMPTY_TITLE_ERROR = "제목을 입력하세요"
EMPTY_CONTENT_ERROR = "내용을 입력하세요"
class DivErrorList(ErrorList):
def __str__(self):
return self.as_divs()
def as_divs(sel... | Remove unnecessary attrs 'name' in title | Remove unnecessary attrs 'name' in title
| Python | mit | hyesun03/k-board,cjh5414/kboard,guswnsxodlf/k-board,hyesun03/k-board,darjeeling/k-board,cjh5414/kboard,kboard/kboard,kboard/kboard,kboard/kboard,guswnsxodlf/k-board,hyesun03/k-board,cjh5414/kboard,guswnsxodlf/k-board | <DELETE> 'name': 'post_title_text', <DELETE_END> <|endoftext|> from django import forms
from django.forms.utils import ErrorList
from django_summernote.widgets import SummernoteWidget
from .models import Post
EMPTY_TITLE_ERROR = "제목을 입력하세요"
EMPTY_CONTENT_ERROR = "내용을 입력하세요"
class DivErrorList(ErrorList):
def __... | Remove unnecessary attrs 'name' in title
from django import forms
from django.forms.utils import ErrorList
from django_summernote.widgets import SummernoteWidget
from .models import Post
EMPTY_TITLE_ERROR = "제목을 입력하세요"
EMPTY_CONTENT_ERROR = "내용을 입력하세요"
class DivErrorList(ErrorList):
def __str__(self):
... |
3a5a6db3b869841cf5c55eed2f5ec877a443a571 | chrome/test/functional/chromeos_html_terminal.py | chrome/test/functional/chromeos_html_terminal.py | #!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import pyauto_functional # must be imported before pyauto
import pyauto
class ChromeosHTMLTerminalTest(pyauto.PyUITes... | #!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import pyauto_functional # must be imported before pyauto
import pyauto
class ChromeosHTMLTerminalTest(pyauto.PyUITes... | Add uninstall HTML Terminal extension | Add uninstall HTML Terminal extension
BUG=
TEST=This is a test to uninstall HTML terminal extension
Review URL: https://chromiumcodereview.appspot.com/10332227
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@137790 0039d316-1c4b-4281-b951-d872f2087c98
| Python | bsd-3-clause | hgl888/chromium-crosswalk,markYoungH/chromium.src,hujiajie/pa-chromium,hujiajie/pa-chromium,TheTypoMaster/chromium-crosswalk,zcbenz/cefode-chromium,Chilledheart/chromium,timopulkkinen/BubbleFish,dushu1203/chromium.src,junmin-zhu/chromium-rivertrail,Pluto-tv/chromium-crosswalk,zcbenz/cefode-chromium,crosswalk-project/ch... | <REPLACE_OLD> testInstallHTMLTerminal(self):
<REPLACE_NEW> testInstallAndUninstallSecureShellExt(self):
<REPLACE_END> <REPLACE_OLD> installation.')
if <REPLACE_NEW> installation.')
# Uninstall HTML Terminal extension
self.assertTrue(self.UninstallExtensionById(ext_id),
msg='Failed to uni... | Add uninstall HTML Terminal extension
BUG=
TEST=This is a test to uninstall HTML terminal extension
Review URL: https://chromiumcodereview.appspot.com/10332227
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@137790 0039d316-1c4b-4281-b951-d872f2087c98
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Au... |
ec8d7b035617f9239a0a52be346d8611cf77cb6f | integration-tests/features/src/utils.py | integration-tests/features/src/utils.py | """Unsorted utility functions used in integration tests."""
import requests
def download_file_from_url(url):
"""Download file from the given URL and do basic check of response."""
assert url
response = requests.get(url)
assert response.status_code == 200
assert response.text is not None
return... | """Unsorted utility functions used in integration tests."""
import requests
import subprocess
def download_file_from_url(url):
"""Download file from the given URL and do basic check of response."""
assert url
response = requests.get(url)
assert response.status_code == 200
assert response.text is n... | Add few oc wrappers for future resiliency testing | Add few oc wrappers for future resiliency testing
Not used anywhere yet.
| Python | apache-2.0 | jpopelka/fabric8-analytics-common,tisnik/fabric8-analytics-common,jpopelka/fabric8-analytics-common,tisnik/fabric8-analytics-common,tisnik/fabric8-analytics-common,jpopelka/fabric8-analytics-common | <REPLACE_OLD> requests
def <REPLACE_NEW> requests
import subprocess
def <REPLACE_END> <REPLACE_OLD> l.split(',')]
<REPLACE_NEW> l.split(',')]
def oc_login(url, username, password, tls_verify=True):
"""Wrapper around `oc login`.
:param url: str, OpenShift URL
:param username: str, username
:param... | Add few oc wrappers for future resiliency testing
Not used anywhere yet.
"""Unsorted utility functions used in integration tests."""
import requests
def download_file_from_url(url):
"""Download file from the given URL and do basic check of response."""
assert url
response = requests.get(url)
assert ... |
7e0f1552ebdadb8f2023167afcd557bdc09b06f9 | scripts/analysis/plot_velocity_based_position_controller_data.py | scripts/analysis/plot_velocity_based_position_controller_data.py | import numpy as np
import matplotlib.pyplot as plt
import sys
if sys.argc < 2:
print "Usage ./plot_velocity_based_position_controller.py [File_name]"
sys.exit(-1)
data = np.genfromtxt(sys.argv[-1], delimiter=',')
# 0 for x, 1 for y 2 for z and 3 for yaw
plot_axis = 3;
ts = (data[:,0] - data[0, 0])/1e9
plt.fi... | Add plotting script for analyzing velocity based position controller | Add plotting script for analyzing velocity based position controller
| Python | mpl-2.0 | jhu-asco/aerial_autonomy,jhu-asco/aerial_autonomy,jhu-asco/aerial_autonomy,jhu-asco/aerial_autonomy,jhu-asco/aerial_autonomy,jhu-asco/aerial_autonomy | <INSERT> import numpy as np
import matplotlib.pyplot as plt
import sys
if sys.argc < 2:
<INSERT_END> <INSERT> print "Usage ./plot_velocity_based_position_controller.py [File_name]"
sys.exit(-1)
data = np.genfromtxt(sys.argv[-1], delimiter=',')
# 0 for x, 1 for y 2 for z and 3 for yaw
plot_axis = 3;
ts = (data... | Add plotting script for analyzing velocity based position controller
| |
51566a873372b23b5c05d376d346dab063f87437 | photutils/utils/tests/test_quantity_helpers.py | photutils/utils/tests/test_quantity_helpers.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Tests for the _quantity_helpers module.
"""
import astropy.units as u
import numpy as np
from numpy.testing import assert_equal
import pytest
from .._quantity_helpers import process_quantities
@pytest.mark.parametrize('all_units', (False, True))
de... | Add tests for quantity helpers | Add tests for quantity helpers
| Python | bsd-3-clause | larrybradley/photutils,astropy/photutils | <REPLACE_OLD> <REPLACE_NEW> # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Tests for the _quantity_helpers module.
"""
import astropy.units as u
import numpy as np
from numpy.testing import assert_equal
import pytest
from .._quantity_helpers import process_quantities
@pytest.mark.parametrize('... | Add tests for quantity helpers
| |
a635a8d58e46cf4ef1bc225f8824d73984971fee | countVowels.py | countVowels.py | """ Q6- Write a program that counts up the number of vowels contained in the string s. Valid vowels are: 'a', 'e', 'i',
'o', and 'u'. For example, if s = 'azcbobobegghakl', your program should print: Number of vowels: 5
"""
# Using the isVowel function from isVowel.py module (Answer of fifth question of Assignment 3)
... | Add the answer to the sixth question of Assignment 3 | Add the answer to the sixth question of Assignment 3
| Python | mit | SuyashD95/python-assignments | <INSERT> """ Q6- Write a program that counts up the number of vowels contained in the string s. Valid vowels are: 'a', 'e', 'i',
'o', and 'u'. For example, if s = 'azcbobobegghakl', your program should print: Number of vowels: 5
"""
# Using the isVowel function from isVowel.py module (Answer of fifth question of Assig... | Add the answer to the sixth question of Assignment 3
| |
4ac37e35396e2393a9bbe2e954674537747e384b | setup.py | setup.py | #!/usr/bin/python
import time
from datetime import date
from setuptools import setup
from pagekite.common import APPVER
import os
try:
# This borks sdist.
os.remove('.SELF')
except:
pass
setup(
name="pagekite",
version=APPVER.replace('github', 'dev%d' % (120*int(time.time()/120))),
license="AGPLv3+"... | #!/usr/bin/python
import time
from datetime import date
from setuptools import setup
from pagekite.common import APPVER
import os
try:
# This borks sdist.
os.remove('.SELF')
except:
pass
setup(
name="pagekite",
version=os.getenv(
'PAGEKITE_VERSION',
APPVER.replace('github', 'dev%d' % (12... | Make it possible to manually override version numbers | Make it possible to manually override version numbers
| Python | agpl-3.0 | pagekite/PyPagekite,pagekite/PyPagekite,pagekite/PyPagekite | <REPLACE_OLD> version=APPVER.replace('github', <REPLACE_NEW> version=os.getenv(
'PAGEKITE_VERSION',
APPVER.replace('github', <REPLACE_END> <REPLACE_OLD> (120*int(time.time()/120))),
<REPLACE_NEW> (120*int(time.time()/120)))),
<REPLACE_END> <|endoftext|> #!/usr/bin/python
import time
from datetime impo... | Make it possible to manually override version numbers
#!/usr/bin/python
import time
from datetime import date
from setuptools import setup
from pagekite.common import APPVER
import os
try:
# This borks sdist.
os.remove('.SELF')
except:
pass
setup(
name="pagekite",
version=APPVER.replace('github', 'dev%... |
5207550b9d19ff6823fb641e86e4851106ebd7f1 | bench/run-paper-nums.py | bench/run-paper-nums.py | #!/usr/bin/env python
devices = [
("hdd", "/dev/sdc1"),
("ssd-sam", "/dev/sdb1"),
("sdd-intel", "/dev/sdd2"),
("ram", "/dev/loop0"),
]
benches = [
("smallfile", "./smallfile /tmp/ft"),
("smallsync", "./smallsync /tmp/ft"),
("largefile", "./largefile /tmp/ft"),
... | Add script to run benchmarks for paper | Add script to run benchmarks for paper
| Python | mit | mit-pdos/fscq-impl,mit-pdos/fscq-impl,mit-pdos/fscq-impl,mit-pdos/fscq-impl,mit-pdos/fscq-impl | <REPLACE_OLD> <REPLACE_NEW> #!/usr/bin/env python
devices = [
("hdd", "/dev/sdc1"),
("ssd-sam", "/dev/sdb1"),
("sdd-intel", "/dev/sdd2"),
("ram", "/dev/loop0"),
]
benches = [
("smallfile", "./smallfile /tmp/ft"),
("smallsync", "./smallsync /tmp/ft"),
("largefile",... | Add script to run benchmarks for paper
| |
be0d4b9e2e62490cab62a39499e570bdab1ac2f5 | cmp_imgs.py | cmp_imgs.py | #!/bin/env python3
import numpy as np
import matplotlib.pyplot as plt
from scipy.ndimage import imread
def rgb2gray(img):
return np.dot(img, [0.299, 0.587, 0.114])
if __name__ == "__main__":
img_name = "1920x1080.jpg"
img = imread(img_name)
gray_img = rgb2gray(img)
plt.imshow(gray_img, cmap=plt.cm.gray)
pl... | Convert an image to grayscale and resize it. | Convert an image to grayscale and resize it.
| Python | mit | HKervadec/cmp_imgs | <INSERT> #!/bin/env python3
import numpy as np
import matplotlib.pyplot as plt
from scipy.ndimage import imread
def rgb2gray(img):
return np.dot(img, [0.299, 0.587, 0.114])
if __name__ == "__main__":
img_name = "1920x1080.jpg"
img = imread(img_name)
gray_img = rgb2gray(img)
plt.imshow(gray_img, cmap=plt.cm.... | Convert an image to grayscale and resize it.
| |
fea9c44be08719f0fcca98a1d531a83c9db4c6af | tests/test_urls.py | tests/test_urls.py | import pytest
from django.conf import settings
from pytest_django_test.compat import force_text
pytestmark = pytest.mark.urls('pytest_django_test.urls_overridden')
try:
from django.core.urlresolvers import is_valid_path
except ImportError:
from django.core.urlresolvers import resolve, Resolver404
def is... | import pytest
from django.conf import settings
from pytest_django_test.compat import force_text
try:
from django.core.urlresolvers import is_valid_path
except ImportError:
from django.core.urlresolvers import resolve, Resolver404
def is_valid_path(path, urlconf=None):
"""Return True if path reso... | Add test to confirm url cache is cleared | Add test to confirm url cache is cleared
| Python | bsd-3-clause | pombredanne/pytest_django,thedrow/pytest-django,ktosiek/pytest-django,tomviner/pytest-django | <REPLACE_OLD> force_text
pytestmark = pytest.mark.urls('pytest_django_test.urls_overridden')
try:
<REPLACE_NEW> force_text
try:
<REPLACE_END> <REPLACE_OLD> False
def <REPLACE_NEW> False
@pytest.mark.urls('pytest_django_test.urls_overridden')
def <REPLACE_END> <REPLACE_OLD> is_valid_path('/overridden_url/')
... | Add test to confirm url cache is cleared
import pytest
from django.conf import settings
from pytest_django_test.compat import force_text
pytestmark = pytest.mark.urls('pytest_django_test.urls_overridden')
try:
from django.core.urlresolvers import is_valid_path
except ImportError:
from django.core.urlresolve... |
a094b0978034869a32be1c541a4d396843819cfe | project/management/commands/generatesecretkey.py | project/management/commands/generatesecretkey.py | from django.core.management.templates import BaseCommand
from django.utils.crypto import get_random_string
import fileinput
from django.conf import settings
class Command(BaseCommand):
help = ("Replaces the SECRET_KEY VALUE in settings.py with a new one.")
def handle(self, *args, **options):
# Crea... | Add management command to generate a random secret key | Add management command to generate a random secret key
| Python | mit | Angoreher/xcero,Angoreher/xcero,Angoreher/xcero,magnet-cl/django-project-template-py3,magnet-cl/django-project-template-py3,Angoreher/xcero,magnet-cl/django-project-template-py3,magnet-cl/django-project-template-py3 | <INSERT> from django.core.management.templates import BaseCommand
from django.utils.crypto import get_random_string
import fileinput
from django.conf import settings
class Command(BaseCommand):
<INSERT_END> <INSERT> help = ("Replaces the SECRET_KEY VALUE in settings.py with a new one.")
def handle(self, *ar... | Add management command to generate a random secret key
| |
46a69b1795a5946c815c16a7d910d8c680e1ed7f | setup.py | setup.py | from setuptools import setup, find_packages
from io import open
setup(
name='django-debug-toolbar',
version='1.3.2',
description='A configurable set of panels that display various debug '
'information about the current request/response.',
long_description=open('README.rst', encoding='ut... | from setuptools import setup, find_packages
from io import open
setup(
name='django-debug-toolbar',
version='1.3.2',
description='A configurable set of panels that display various debug '
'information about the current request/response.',
long_description=open('README.rst', encoding='ut... | Correct spelling of Django in requirements | Correct spelling of Django in requirements
It seems that using 'django' instead of 'Django' has the consequence that "pip install django_debug_toolbar" has the consequence of installing the latest version of Django, even if you already have Django installed. | Python | bsd-3-clause | megcunningham/django-debug-toolbar,jazzband/django-debug-toolbar,pevzi/django-debug-toolbar,Endika/django-debug-toolbar,barseghyanartur/django-debug-toolbar,peap/django-debug-toolbar,tim-schilling/django-debug-toolbar,tim-schilling/django-debug-toolbar,barseghyanartur/django-debug-toolbar,jazzband/django-debug-toolbar,... | <REPLACE_OLD> 'django>=1.4.2',
<REPLACE_NEW> 'Django>=1.4.2',
<REPLACE_END> <|endoftext|> from setuptools import setup, find_packages
from io import open
setup(
name='django-debug-toolbar',
version='1.3.2',
description='A configurable set of panels that display various debug '
'informatio... | Correct spelling of Django in requirements
It seems that using 'django' instead of 'Django' has the consequence that "pip install django_debug_toolbar" has the consequence of installing the latest version of Django, even if you already have Django installed.
from setuptools import setup, find_packages
from io import o... |
7f6cd8f5444d92644642cadb84d7f958e0b6fce1 | examples/image_test.py | examples/image_test.py | import sys
import os
import pyglet.window
from pyglet.gl import *
from pyglet import clock
from pyglet.ext.scene2d import Image2d
from ctypes import *
if len(sys.argv) != 2:
print 'Usage: %s <PNG/JPEG filename>'%sys.argv[0]
sys.exit()
window = pyglet.window.Window(width=400, height=400)
image = Image2d.loa... | import sys
import os
import ctypes
import pyglet.window
from pyglet.gl import *
from pyglet import clock
from pyglet import image
if len(sys.argv) != 2:
print 'Usage: %s <PNG/JPEG filename>'%sys.argv[0]
sys.exit()
window = pyglet.window.Window(width=400, height=400)
image = image.load(sys.argv[1])
imx = imy ... | Use the core, make example more useful. | Use the core, make example more useful.
git-svn-id: d4fdfcd4de20a449196f78acc655f735742cd30d@874 14d46d22-621c-0410-bb3d-6f67920f7d95
| Python | bsd-3-clause | regular/pyglet-avbin-optimizations,regular/pyglet-avbin-optimizations,regular/pyglet-avbin-optimizations,regular/pyglet-avbin-optimizations | <REPLACE_OLD> os
import <REPLACE_NEW> os
import ctypes
import <REPLACE_END> <REPLACE_OLD> pyglet.ext.scene2d <REPLACE_NEW> pyglet <REPLACE_END> <REPLACE_OLD> Image2d
from ctypes import *
if <REPLACE_NEW> image
if <REPLACE_END> <REPLACE_OLD> height=400)
image <REPLACE_NEW> height=400)
image <REPLACE_END> <REPLACE_... | Use the core, make example more useful.
git-svn-id: d4fdfcd4de20a449196f78acc655f735742cd30d@874 14d46d22-621c-0410-bb3d-6f67920f7d95
import sys
import os
import pyglet.window
from pyglet.gl import *
from pyglet import clock
from pyglet.ext.scene2d import Image2d
from ctypes import *
if len(sys.argv) != 2:
pr... |
0323189a504f27f14d60c8c3ebdb40ea160d7f79 | source/clique/collection.py | source/clique/collection.py | # :coding: utf-8
# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips
# :license: See LICENSE.txt.
import re
class Collection(object):
'''Represent group of items that differ only by numerical component.'''
def __init__(self, head, tail, padding, indexes=None):
'''Initialise collection.
... | Add initial interface for Collection class with stubs for methods. | Add initial interface for Collection class with stubs for methods.
A Collection will represent a group of items with a common numerical
component.
| Python | apache-2.0 | 4degrees/clique | <REPLACE_OLD> <REPLACE_NEW> # :coding: utf-8
# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips
# :license: See LICENSE.txt.
import re
class Collection(object):
'''Represent group of items that differ only by numerical component.'''
def __init__(self, head, tail, padding, indexes=None):
'''I... | Add initial interface for Collection class with stubs for methods.
A Collection will represent a group of items with a common numerical
component.
| |
e4f0fc2cdd209bbadffae9f3da83b0585a64143f | accelerator/migrations/0077_add_program_overview_link_field_to_a_program.py | accelerator/migrations/0077_add_program_overview_link_field_to_a_program.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-05-15 14:16
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accelerator', '0076_change_description_to_textfield'),
]
operations = [
mi... | Add migration file form program overview link | [AC-6989] Add migration file form program overview link
| Python | mit | masschallenge/django-accelerator,masschallenge/django-accelerator | <REPLACE_OLD> <REPLACE_NEW> # -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-05-15 14:16
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accelerator', '0076_change_description_to_textfield'),
]
... | [AC-6989] Add migration file form program overview link
| |
5ac176fafd35bfa675e1718b74a8c6ef4dc74629 | skoleintra/pgWeekplans.py | skoleintra/pgWeekplans.py | #
# -*- encoding: utf-8 -*-
#
import re
import config
import surllib
import semail
import datetime
import urllib
URL_PREFIX = 'http://%s/Infoweb/Fi/' % config.HOSTNAME
URL_MAIN = URL_PREFIX + 'Ugeplaner.asp'
def docFindWeekplans(bs):
trs = bs.findAll('tr')
for line in trs:
if not line.has_key('clas... | #
# -*- encoding: utf-8 -*-
#
import re
import config
import surllib
import semail
import datetime
import urllib
URL_PREFIX = 'http://%s/Infoweb/Fi/' % config.HOSTNAME
URL_MAIN = URL_PREFIX + 'Ugeplaner.asp'
def docFindWeekplans(bs):
trs = bs.findAll('tr')
for line in trs:
if not line.has_key('cla... | Make code comply to PEP8 | Make code comply to PEP8
| Python | bsd-2-clause | bennyslbs/fskintra | <REPLACE_OLD> 'Ugeplaner.asp'
def <REPLACE_NEW> 'Ugeplaner.asp'
def <REPLACE_END> <INSERT> url.encode('iso-8859-1')
url = <INSERT_END> <REPLACE_OLD> urllib.quote(url.encode('iso-8859-1'), <REPLACE_NEW> urllib.quote(url, <REPLACE_END> <|endoftext|> #
# -*- encoding: utf-8 -*-
#
import re
import config
import... | Make code comply to PEP8
#
# -*- encoding: utf-8 -*-
#
import re
import config
import surllib
import semail
import datetime
import urllib
URL_PREFIX = 'http://%s/Infoweb/Fi/' % config.HOSTNAME
URL_MAIN = URL_PREFIX + 'Ugeplaner.asp'
def docFindWeekplans(bs):
trs = bs.findAll('tr')
for line in trs:
... |
42339932811493bdd398fda4f7a2322a94bdc2e9 | saleor/shipping/migrations/0018_default_zones_countries.py | saleor/shipping/migrations/0018_default_zones_countries.py | # Generated by Django 3.0.6 on 2020-06-05 14:35
from django.db import migrations
from ..utils import get_countries_without_shipping_zone
def assign_countries_in_default_shipping_zone(apps, schema_editor):
ShippingZone = apps.get_model("shipping", "ShippingZone")
qs = ShippingZone.objects.filter(default=True... | # Generated by Django 3.0.6 on 2020-06-05 14:35
from django.db import migrations
from django_countries import countries
def get_countries_without_shipping_zone(ShippingZone):
"""Return countries that are not assigned to any shipping zone."""
covered_countries = set()
for zone in ShippingZone.objects.all(... | Move utility function to migration | Move utility function to migration
| Python | bsd-3-clause | mociepka/saleor,mociepka/saleor,mociepka/saleor | <REPLACE_OLD> migrations
from ..utils <REPLACE_NEW> migrations
from django_countries <REPLACE_END> <REPLACE_OLD> get_countries_without_shipping_zone
def <REPLACE_NEW> countries
def get_countries_without_shipping_zone(ShippingZone):
"""Return countries that are not assigned to any shipping zone."""
covered_... | Move utility function to migration
# Generated by Django 3.0.6 on 2020-06-05 14:35
from django.db import migrations
from ..utils import get_countries_without_shipping_zone
def assign_countries_in_default_shipping_zone(apps, schema_editor):
ShippingZone = apps.get_model("shipping", "ShippingZone")
qs = Ship... |
0241e253c68ca6862a3da26d29a649f65c27ae36 | demos/chatroom/experiment.py | demos/chatroom/experiment.py | """Coordination chatroom game."""
import dallinger as dlgr
from dallinger.config import get_config
try:
unicode = unicode
except NameError: # Python 3
unicode = str
config = get_config()
def extra_settings():
config.register('network', unicode)
config.register('n', int)
class CoordinationChatroom... | """Coordination chatroom game."""
import dallinger as dlgr
from dallinger.compat import unicode
from dallinger.config import get_config
config = get_config()
def extra_settings():
config.register('network', unicode)
config.register('n', int)
class CoordinationChatroom(dlgr.experiments.Experiment):
"""... | Use compat for unicode import | Use compat for unicode import
| Python | mit | Dallinger/Dallinger,jcpeterson/Dallinger,jcpeterson/Dallinger,jcpeterson/Dallinger,Dallinger/Dallinger,Dallinger/Dallinger,jcpeterson/Dallinger,Dallinger/Dallinger,Dallinger/Dallinger,jcpeterson/Dallinger | <INSERT> dallinger.compat import unicode
from <INSERT_END> <REPLACE_OLD> get_config
try:
unicode = unicode
except NameError: # Python 3
unicode = str
config <REPLACE_NEW> get_config
config <REPLACE_END> <|endoftext|> """Coordination chatroom game."""
import dallinger as dlgr
from dallinger.compat import uni... | Use compat for unicode import
"""Coordination chatroom game."""
import dallinger as dlgr
from dallinger.config import get_config
try:
unicode = unicode
except NameError: # Python 3
unicode = str
config = get_config()
def extra_settings():
config.register('network', unicode)
config.register('n', in... |
469d73255365392a821d701b4df9098d97b7546a | judge/toyojjudge/taskrunner.py | judge/toyojjudge/taskrunner.py | import asyncio
import logging
logger = logging.getLogger(__name__)
class TaskRunner:
def __init__(self, sandbox_pool, languages, checkers):
self.sandbox_pool = sandbox_pool
self.languages = languages
self.checkers = checkers
async def run(self, task):
async with self.sandbox_p... | import asyncio
import logging
logger = logging.getLogger(__name__)
class TaskRunner:
def __init__(self, sandbox_pool, languages, checkers):
self.sandbox_pool = sandbox_pool
self.languages = languages
self.checkers = checkers
async def run(self, task):
async with self.sandbox_p... | Print running task, language and checker as INFO | judge: Print running task, language and checker as INFO
| Python | agpl-3.0 | johnchen902/toyoj,johnchen902/toyoj,johnchen902/toyoj,johnchen902/toyoj,johnchen902/toyoj,johnchen902/toyoj | <REPLACE_OLD> logger.debug("Running %s", task)
<REPLACE_NEW> language_name = task.submission.language_name
checker_name = task.testcase.checker_name
logger.info("Running %s, language %s, checker %s",
task, language_name, checker_name)
<REPLACE_END> <REPLACE_OLD> self.langua... | judge: Print running task, language and checker as INFO
import asyncio
import logging
logger = logging.getLogger(__name__)
class TaskRunner:
def __init__(self, sandbox_pool, languages, checkers):
self.sandbox_pool = sandbox_pool
self.languages = languages
self.checkers = checkers
asy... |
8842bbf45ffe2a76832075e053dce90a95964bcd | Bookie/bookie/tests/__init__.py | Bookie/bookie/tests/__init__.py | import ConfigParser
import os
import unittest
from pyramid.config import Configurator
from pyramid import testing
global_config = {}
ini = ConfigParser.ConfigParser()
ini.read('test.ini')
settings = dict(ini.items('app:bookie'))
def setup_db(settings):
""" We need to create the test sqlite database to run our t... | import ConfigParser
import os
import unittest
from pyramid.config import Configurator
from pyramid import testing
global_config = {}
ini = ConfigParser.ConfigParser()
# we need to pull the right ini for the test we want to run
# by default pullup test.ini, but we might want to test mysql, pgsql, etc
test_ini = os.en... | Add ability to set test ini via env variable | Add ability to set test ini via env variable
| Python | agpl-3.0 | charany1/Bookie,teodesson/Bookie,skmezanul/Bookie,teodesson/Bookie,skmezanul/Bookie,adamlincoln/Bookie,adamlincoln/Bookie,adamlincoln/Bookie,GreenLunar/Bookie,bookieio/Bookie,pombredanne/Bookie,wangjun/Bookie,adamlincoln/Bookie,pombredanne/Bookie,pombredanne/Bookie,skmezanul/Bookie,bookieio/Bookie,charany1/Bookie,Green... | <REPLACE_OLD> ConfigParser.ConfigParser()
ini.read('test.ini')
settings <REPLACE_NEW> ConfigParser.ConfigParser()
# we need to pull the right ini for the test we want to run
# by default pullup test.ini, but we might want to test mysql, pgsql, etc
test_ini = os.environ.get('BOOKIE_TEST_INI', None)
if test_ini:
ini... | Add ability to set test ini via env variable
import ConfigParser
import os
import unittest
from pyramid.config import Configurator
from pyramid import testing
global_config = {}
ini = ConfigParser.ConfigParser()
ini.read('test.ini')
settings = dict(ini.items('app:bookie'))
def setup_db(settings):
""" We need t... |
6fcc041c45dc426d570aa4c44e48c3fc9d8fd5c0 | settings/settings.py | settings/settings.py | # This file contains the project wide settings. It is not
# part of version control and it should be adapted to
# suit each deployment.
from os import environ
# Use the absolute path to the directory that stores the data.
# This can differ per deployment
DATA_DIRECTORY = "/cheshire3/clic/dbs/dickens/data/"
#TODO: ... | # This file contains the project wide settings. It is not
# part of version control and it should be adapted to
# suit each deployment.
from os import environ
# Use the absolute path to the directory that stores the data.
# This can differ per deployment
DATA_DIRECTORY = "/home/vagrant/code/clic-project/clic/dbs/di... | Update the setting DATA_DIRECTORY to match the vagrant setup | Update the setting DATA_DIRECTORY to match the vagrant setup
| Python | mit | CentreForCorpusResearch/clic,CentreForCorpusResearch/clic,CentreForResearchInAppliedLinguistics/clic,CentreForResearchInAppliedLinguistics/clic,CentreForResearchInAppliedLinguistics/clic,CentreForCorpusResearch/clic | <REPLACE_OLD> "/cheshire3/clic/dbs/dickens/data/"
#TODO: <REPLACE_NEW> "/home/vagrant/code/clic-project/clic/dbs/dickens/data/"
#TODO: <REPLACE_END> <|endoftext|> # This file contains the project wide settings. It is not
# part of version control and it should be adapted to
# suit each deployment.
from os import en... | Update the setting DATA_DIRECTORY to match the vagrant setup
# This file contains the project wide settings. It is not
# part of version control and it should be adapted to
# suit each deployment.
from os import environ
# Use the absolute path to the directory that stores the data.
# This can differ per deployment... |
1648cec8667611aa7fec4bff12f873f8e6294f82 | scripts/bodyconf.py | scripts/bodyconf.py | #!/usr/bin/python2
# -*- coding: utf-8 -*-
pixval = {
'hair': 10,
'head': 20,
'upper': 30,
'arms': 40,
'lower': 50,
'legs': 60,
'feet': 70
}
groups = [
[10, 20],
[30, 40],
[50, 60],
[70]
]
| #!/usr/bin/python2
# -*- coding: utf-8 -*-
pixval = {
'hair': 10,
'head': 20,
'upper': 30,
'arms': 40,
'lower': 50,
'legs': 60,
'feet': 70
}
groups = [
[10, 20],
[30, 40],
[50, 60],
[70],
[0,10,20,30,40,50,60,70]
]
| Add whole image as an input | Add whole image as an input
| Python | mit | Cysu/Person-Reid,Cysu/Person-Reid,Cysu/Person-Reid,Cysu/Person-Reid,Cysu/Person-Reid | <REPLACE_OLD> [70]
]
<REPLACE_NEW> [70],
[0,10,20,30,40,50,60,70]
]
<REPLACE_END> <|endoftext|> #!/usr/bin/python2
# -*- coding: utf-8 -*-
pixval = {
'hair': 10,
'head': 20,
'upper': 30,
'arms': 40,
'lower': 50,
'legs': 60,
'feet': 70
}
groups = [
[10, 20],
[30, 40],
[50,... | Add whole image as an input
#!/usr/bin/python2
# -*- coding: utf-8 -*-
pixval = {
'hair': 10,
'head': 20,
'upper': 30,
'arms': 40,
'lower': 50,
'legs': 60,
'feet': 70
}
groups = [
[10, 20],
[30, 40],
[50, 60],
[70]
]
|
93d0f11658c7417371ec2e040397c7a572559585 | django_remote_submission/consumers.py | django_remote_submission/consumers.py | """Manage websocket connections."""
# -*- coding: utf-8 -*-
import json
from channels import Group
from channels.auth import channel_session_user_from_http, channel_session_user
from .models import Job
@channel_session_user_from_http
def ws_connect(message):
message.reply_channel.send({
'accept': True,
... | """Manage websocket connections."""
# -*- coding: utf-8 -*-
import json
from channels import Group
from channels.auth import channel_session_user_from_http, channel_session_user
from .models import Job
import json
@channel_session_user_from_http
def ws_connect(message):
last_jobs = message.user.jobs.order_by('... | Send last jobs on initial connection | Send last jobs on initial connection
| Python | isc | ornl-ndav/django-remote-submission,ornl-ndav/django-remote-submission,ornl-ndav/django-remote-submission | <REPLACE_OLD> Job
@channel_session_user_from_http
def <REPLACE_NEW> Job
import json
@channel_session_user_from_http
def <REPLACE_END> <INSERT> last_jobs = message.user.jobs.order_by('-modified')[:10]
for job in last_jobs:
<INSERT_END> <REPLACE_OLD> 'accept': True,
<REPLACE_NEW> 'text': json.dumps... | Send last jobs on initial connection
"""Manage websocket connections."""
# -*- coding: utf-8 -*-
import json
from channels import Group
from channels.auth import channel_session_user_from_http, channel_session_user
from .models import Job
@channel_session_user_from_http
def ws_connect(message):
message.reply_c... |
903b33db0df2562df108f827177cb1dc0f39ed24 | setup.py | setup.py | #!/usr/bin/env python
import setuptools
setuptools.setup(
name='systemd-minecraft',
description='A systemd service file for one or more vanilla Minecraft servers',
author='Wurstmineberg',
author_email='mail@wurstmineberg.de',
py_modules=['minecraft'],
install_requires=[
'docopt',
... | #!/usr/bin/env python
import setuptools
setuptools.setup(
name='systemd-minecraft',
description='A systemd service file for one or more vanilla Minecraft servers',
author='Wurstmineberg',
author_email='mail@wurstmineberg.de',
py_modules=['minecraft'],
install_requires=[
'docopt',
... | Add dependency link for mcrcon | Add dependency link for mcrcon
| Python | mit | wurstmineberg/systemd-minecraft | <REPLACE_OLD> 'git+https://github.com/fenhl/python-loops.git#egg=loops'
<REPLACE_NEW> 'git+https://github.com/fenhl/python-loops.git#egg=loops',
'git+https://github.com/wurstmineberg/MCRcon.git#egg=mcrcon'
<REPLACE_END> <|endoftext|> #!/usr/bin/env python
import setuptools
setuptools.setup(
name='system... | Add dependency link for mcrcon
#!/usr/bin/env python
import setuptools
setuptools.setup(
name='systemd-minecraft',
description='A systemd service file for one or more vanilla Minecraft servers',
author='Wurstmineberg',
author_email='mail@wurstmineberg.de',
py_modules=['minecraft'],
install_re... |
fcde68e954eab9f1b158928f9d30633523d41d94 | corehq/apps/userreports/management/commands/resave_couch_forms_and_cases.py | corehq/apps/userreports/management/commands/resave_couch_forms_and_cases.py | from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import csv
import datetime
from django.core.management.base import BaseCommand
from corehq.util.couch import IterDB
from corehq.util.log import with_progress_bar
from couchforms.models import XFormIns... | Add mgmt cmd to re-save a list of form/case IDs | Add mgmt cmd to re-save a list of form/case IDs
https://manage.dimagi.com/default.asp?263644
| Python | bsd-3-clause | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | <REPLACE_OLD> <REPLACE_NEW> from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import csv
import datetime
from django.core.management.base import BaseCommand
from corehq.util.couch import IterDB
from corehq.util.log import with_progress_bar
from couc... | Add mgmt cmd to re-save a list of form/case IDs
https://manage.dimagi.com/default.asp?263644
| |
fa8b40b8ebc088f087ff76c36068fea67dae0824 | rnacentral/portal/management/commands/update_coordinate_names.py | rnacentral/portal/management/commands/update_coordinate_names.py | """
Copyright [2009-2017] EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or a... | Add management command for updating genome coordinate names using Ensembl-INSDC mapping | Add management command for updating genome coordinate names using Ensembl-INSDC mapping
| Python | apache-2.0 | RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode | <REPLACE_OLD> <REPLACE_NEW> """
Copyright [2009-2017] EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless re... | Add management command for updating genome coordinate names using Ensembl-INSDC mapping
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.