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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
e9cfb095ac4261c8bf959d1c9b904256c267178f | openfisca_web_api/tests/test_variables.py | openfisca_web_api/tests/test_variables.py | # -*- coding: utf-8 -*-
import json
from nose.tools import assert_equal, assert_greater, assert_in, assert_is_instance
from webob import Request
from . import common
def setup_module(module):
common.get_or_load_app()
def test_basic_call():
req = Request.blank('/api/1/variables', method = 'GET')
res ... | Add basic unit test about /variables endpoint | Add basic unit test about /variables endpoint
| Python | agpl-3.0 | openfisca/openfisca-web-api,openfisca/openfisca-web-api | <INSERT> # -*- coding: utf-8 -*-
import json
from nose.tools import assert_equal, assert_greater, assert_in, assert_is_instance
from webob import Request
from . import common
def setup_module(module):
<INSERT_END> <INSERT> common.get_or_load_app()
def test_basic_call():
req = Request.blank('/api/1/variab... | Add basic unit test about /variables endpoint
| |
6d507595b0e51ed4a366c3288eec808ac91e30bc | pyinfra/modules/virtualenv.py | pyinfra/modules/virtualenv.py | # pyinfra
# File: pyinfra/modules/pip.py
# Desc: manage virtualenvs
'''
Manage Python virtual environments
'''
from __future__ import unicode_literals
from pyinfra.api import operation
from pyinfra.modules import files
@operation
def virtualenv(
state, host,
path, python='python3', site_packages=False, alw... | # pyinfra
# File: pyinfra/modules/pip.py
# Desc: manage virtualenvs
'''
Manage Python virtual environments
'''
from __future__ import unicode_literals
from pyinfra.api import operation
from pyinfra.modules import files
@operation
def virtualenv(
state, host,
path, python='python3', site_packages=False, alw... | Fix no yield from in middle ages | Fix no yield from in middle ages
| Python | mit | Fizzadar/pyinfra,Fizzadar/pyinfra | <REPLACE_OLD> yield from <REPLACE_NEW> # no 'yield from' in python 2.7
for cmd in <REPLACE_END> <REPLACE_OLD> present=False)
<REPLACE_NEW> present=False):
yield cmd
<REPLACE_END> <|endoftext|> # pyinfra
# File: pyinfra/modules/pip.py
# Desc: manage virtualenvs
'''
Manage Python virtual environm... | Fix no yield from in middle ages
# pyinfra
# File: pyinfra/modules/pip.py
# Desc: manage virtualenvs
'''
Manage Python virtual environments
'''
from __future__ import unicode_literals
from pyinfra.api import operation
from pyinfra.modules import files
@operation
def virtualenv(
state, host,
path, python='... |
972b6ad21509e313d7cfd901b12020135e202c51 | logos/migrations/0004_auto_20160518_2120.py | logos/migrations/0004_auto_20160518_2120.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('logos', '0003_auto_20160217_2158'),
]
operations = [
migrations.DeleteModel(
name='CapturedUrls',
),
... | Add some old models deleted in logos/ migration | Add some old models deleted in logos/ migration
| Python | apache-2.0 | kiwiheretic/logos-v2,kiwiheretic/logos-v2,kiwiheretic/logos-v2,kiwiheretic/logos-v2 | <INSERT> # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
<INSERT_END> <INSERT> dependencies = [
('logos', '0003_auto_20160217_2158'),
]
operations = [
migrations.DeleteModel(
name=... | Add some old models deleted in logos/ migration
| |
e67c57128f88b61eac08e488e54343d48f1454c7 | ddcz/forms/authentication.py | ddcz/forms/authentication.py | import logging
from django import forms
from django.contrib.auth import forms as authforms
from ..models import UserProfile
logger = logging.getLogger(__name__)
class LoginForm(forms.Form):
nick = forms.CharField(label="Nick", max_length=20)
password = forms.CharField(label="Heslo", max_length=50, widget=f... | import logging
from django import forms
from django.contrib.auth import forms as authforms
from ..models import UserProfile
logger = logging.getLogger(__name__)
class LoginForm(forms.Form):
nick = forms.CharField(label="Nick", max_length=25)
password = forms.CharField(
label="Heslo", max_length=100... | Update LoginForm to match reality | Update LoginForm to match reality
| Python | mit | dracidoupe/graveyard,dracidoupe/graveyard,dracidoupe/graveyard,dracidoupe/graveyard | <REPLACE_OLD> max_length=20)
<REPLACE_NEW> max_length=25)
<REPLACE_END> <REPLACE_OLD> forms.CharField(label="Heslo", max_length=50, widget=forms.PasswordInput)
class <REPLACE_NEW> forms.CharField(
label="Heslo", max_length=100, widget=forms.PasswordInput
)
class <REPLACE_END> <|endoftext|> import logg... | Update LoginForm to match reality
import logging
from django import forms
from django.contrib.auth import forms as authforms
from ..models import UserProfile
logger = logging.getLogger(__name__)
class LoginForm(forms.Form):
nick = forms.CharField(label="Nick", max_length=20)
password = forms.CharField(lab... |
d88006087c7428295dafad5e27aab69c000cb278 | pyedgar/form10.py | pyedgar/form10.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Utilities for interacting with edgar forms.
"""
# import os
# import re
import logging
from . import localstore
from . import forms
# from . import plaintext
# from .htmlparse import RE_HTML_TAGS, convert_html_to_text, html_ent_re_sub
# from .. import exceptions as EX... | Add custom date and period to form 10 | Add custom date and period to form 10
| Python | mit | gaulinmp/pyedgar | <REPLACE_OLD> <REPLACE_NEW> #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Utilities for interacting with edgar forms.
"""
# import os
# import re
import logging
from . import localstore
from . import forms
# from . import plaintext
# from .htmlparse import RE_HTML_TAGS, convert_html_to_text, html_ent_re_sub
# fr... | Add custom date and period to form 10
| |
54fe88a3b8151c1a41ecd597ccf6a17db32d9af7 | ooni/nettests/blocking/meek_fronted_requests.py | ooni/nettests/blocking/meek_fronted_requests.py | # -*- encoding: utf-8 -*-
#
# :licence: see LICENSE
from twisted.python import usage
from ooni.templates import httpt
from ooni.utils import log
class UsageOptions(usage.Options):
optParameters = [ ['ExpectedBody', 'B',
'I’m just a happy little web server.\n',
'E... | Add meek fronted requests test | Add meek fronted requests test
| Python | bsd-2-clause | lordappsec/ooni-probe,juga0/ooni-probe,0xPoly/ooni-probe,0xPoly/ooni-probe,kdmurray91/ooni-probe,kdmurray91/ooni-probe,0xPoly/ooni-probe,Karthikeyan-kkk/ooni-probe,juga0/ooni-probe,kdmurray91/ooni-probe,kdmurray91/ooni-probe,lordappsec/ooni-probe,juga0/ooni-probe,0xPoly/ooni-probe,Karthikeyan-kkk/ooni-probe,juga0/ooni-... | <REPLACE_OLD> <REPLACE_NEW> # -*- encoding: utf-8 -*-
#
# :licence: see LICENSE
from twisted.python import usage
from ooni.templates import httpt
from ooni.utils import log
class UsageOptions(usage.Options):
optParameters = [ ['ExpectedBody', 'B',
'I’m just a happy little web server.\n',... | Add meek fronted requests test
| |
874477151ba07dd976dd53f604682f018a3c223f | yolk/__init__.py | yolk/__init__.py | """yolk.
Author: Rob Cakebread <cakebread at gmail>
License : BSD
"""
__version__ = '0.8.1'
| """yolk.
Author: Rob Cakebread <cakebread at gmail>
License : BSD
"""
__version__ = '0.8.2'
| Increment patch version to 0.8.2 | Increment patch version to 0.8.2
| Python | bsd-3-clause | myint/yolk,myint/yolk | <REPLACE_OLD> '0.8.1'
<REPLACE_NEW> '0.8.2'
<REPLACE_END> <|endoftext|> """yolk.
Author: Rob Cakebread <cakebread at gmail>
License : BSD
"""
__version__ = '0.8.2'
| Increment patch version to 0.8.2
"""yolk.
Author: Rob Cakebread <cakebread at gmail>
License : BSD
"""
__version__ = '0.8.1'
|
2e812af6b937091d65a0b83ead936894a2789d02 | rdflib/serializer.py | rdflib/serializer.py | """
Serializer plugin interface.
This module is useful for those wanting to write a serializer that can
plugin to rdflib. If you are wanting to invoke a serializer you likely
want to do so through the Graph class serialize method.
TODO: info for how to write a serializer that can plugin to rdflib.
See also rdflib.plu... | """
Serializer plugin interface.
This module is useful for those wanting to write a serializer that can
plugin to rdflib. If you are wanting to invoke a serializer you likely
want to do so through the Graph class serialize method.
TODO: info for how to write a serializer that can plugin to rdflib.
See also rdflib.plu... | Change to preferred encoding style. | Change to preferred encoding style.
UTF-8 -> utf-8
| Python | bsd-3-clause | RDFLib/rdflib,RDFLib/rdflib,RDFLib/rdflib,RDFLib/rdflib | <REPLACE_OLD> "UTF-8"
<REPLACE_NEW> "utf-8"
<REPLACE_END> <|endoftext|> """
Serializer plugin interface.
This module is useful for those wanting to write a serializer that can
plugin to rdflib. If you are wanting to invoke a serializer you likely
want to do so through the Graph class serialize method.
TODO: info fo... | Change to preferred encoding style.
UTF-8 -> utf-8
"""
Serializer plugin interface.
This module is useful for those wanting to write a serializer that can
plugin to rdflib. If you are wanting to invoke a serializer you likely
want to do so through the Graph class serialize method.
TODO: info for how to write a seri... |
48c008b4ac08114e30f4bee7a208d5d3fb925296 | problem1/steiner-simplegreedy.py | problem1/steiner-simplegreedy.py | import networkx as nx
from sys import argv
def main():
# G = nx.read_gml(argv[1])
G = nx.read_gml("steiner-small.gml")
T = [] # terminals
for v,d in G.nodes_iter(data=True):
if d['T'] == 1:
T.append(v)
U = T[:] # Steiner tree vertices
F = [] # Steiner tree edges
D = [] # cand... | Add partial simple greedy algorithm (baseline). | Add partial simple greedy algorithm (baseline).
| Python | mit | karulont/combopt | <REPLACE_OLD> <REPLACE_NEW> import networkx as nx
from sys import argv
def main():
# G = nx.read_gml(argv[1])
G = nx.read_gml("steiner-small.gml")
T = [] # terminals
for v,d in G.nodes_iter(data=True):
if d['T'] == 1:
T.append(v)
U = T[:] # Steiner tree vertices
F = [] # Steiner ... | Add partial simple greedy algorithm (baseline).
| |
b65293d2bc21a0385a6170e4fbd9ee7c4ce1c631 | mopidy/frontends/mpd/protocol/audio_output.py | mopidy/frontends/mpd/protocol/audio_output.py | from __future__ import unicode_literals
from mopidy.frontends.mpd.protocol import handle_request
@handle_request(r'^disableoutput "(?P<outputid>\d+)"$')
def disableoutput(context, outputid):
"""
*musicpd.org, audio output section:*
``disableoutput``
Turns an output off.
"""
if int(o... | from __future__ import unicode_literals
from mopidy.frontends.mpd.protocol import handle_request
@handle_request(r'^disableoutput "(?P<outputid>\d+)"$')
def disableoutput(context, outputid):
"""
*musicpd.org, audio output section:*
``disableoutput``
Turns an output off.
"""
if int(o... | Add TODO for handling unknown outpitid | mpd: Add TODO for handling unknown outpitid
| Python | apache-2.0 | quartz55/mopidy,diandiankan/mopidy,jcass77/mopidy,swak/mopidy,hkariti/mopidy,dbrgn/mopidy,vrs01/mopidy,rawdlite/mopidy,tkem/mopidy,hkariti/mopidy,bencevans/mopidy,jmarsik/mopidy,glogiotatidis/mopidy,swak/mopidy,pacificIT/mopidy,pacificIT/mopidy,liamw9534/mopidy,mokieyue/mopidy,bacontext/mopidy,SuperStarPL/mopidy,quartz... | <REPLACE_OLD> context.core.playback.set_mute(True)
@handle_request(r'^enableoutput <REPLACE_NEW> context.core.playback.set_mute(True)
# TODO Return proper error on unknown outputid
@handle_request(r'^enableoutput <REPLACE_END> <REPLACE_OLD> context.core.playback.set_mute(False)
@handle_request(r'^outputs$')
d... | mpd: Add TODO for handling unknown outpitid
from __future__ import unicode_literals
from mopidy.frontends.mpd.protocol import handle_request
@handle_request(r'^disableoutput "(?P<outputid>\d+)"$')
def disableoutput(context, outputid):
"""
*musicpd.org, audio output section:*
``disableoutput``
... |
25ba377b7254ed770360bb1ee5a6ef6cb631f564 | openedx/stanford/djangoapps/register_cme/admin.py | openedx/stanford/djangoapps/register_cme/admin.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from .models import ExtraInfo
class ExtraInfoAdmin(admin.ModelAdmin):
"""
Admin interface for ExtraInfo model.
"""
readonly_fields = (
'user',
)
class Meta(object):
model = Extr... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from .models import ExtraInfo
class ExtraInfoAdmin(admin.ModelAdmin):
"""
Admin interface for ExtraInfo model.
"""
list_display = (
'user',
'get_email',
'last_name',
'fir... | Make ExtraInfo list user-friendly in Django Admin | Make ExtraInfo list user-friendly in Django Admin
`Register_cme/extrainfo` in Django Admin was previously displaying users
as `ExtraInfo` objects which admins had to click on individually to see
each user's information. Each user is now displayed with fields:
username, email, last and first name. Username is clickable... | Python | agpl-3.0 | Stanford-Online/edx-platform,caesar2164/edx-platform,caesar2164/edx-platform,Stanford-Online/edx-platform,Stanford-Online/edx-platform,caesar2164/edx-platform,Stanford-Online/edx-platform,caesar2164/edx-platform | <INSERT> list_display = (
'user',
'get_email',
'last_name',
'first_name',
)
<INSERT_END> <INSERT> )
search_fields = (
'user__username',
'user__email',
'last_name',
'first_name',
<INSERT_END> <INSERT> def get_email(self, obj):
ret... | Make ExtraInfo list user-friendly in Django Admin
`Register_cme/extrainfo` in Django Admin was previously displaying users
as `ExtraInfo` objects which admins had to click on individually to see
each user's information. Each user is now displayed with fields:
username, email, last and first name. Username is clickable... |
3f4f55f3232546ea407672522f6223a9548b3167 | tests/pycurl_object_test.py | tests/pycurl_object_test.py | #! /usr/bin/env python
# -*- coding: iso-8859-1 -*-
# vi:ts=4:et
import pycurl
import unittest
import sys
class PycurlObjectTest(unittest.TestCase):
def setUp(self):
self.curl = pycurl.Curl()
def tearDown(self):
self.curl.close()
def test_set_attribute(self):
assert not h... | Add a test for general object behavior as it seems to be changed by python 3 patch | Add a test for general object behavior as it seems to be changed by python 3 patch
| Python | lgpl-2.1 | pycurl/pycurl,pycurl/pycurl,pycurl/pycurl | <INSERT> #! /usr/bin/env python
# -*- coding: iso-8859-1 -*-
# vi:ts=4:et
import pycurl
import unittest
import sys
class PycurlObjectTest(unittest.TestCase):
<INSERT_END> <INSERT> def setUp(self):
self.curl = pycurl.Curl()
def tearDown(self):
self.curl.close()
def test_set_attribu... | Add a test for general object behavior as it seems to be changed by python 3 patch
| |
a20507f980328e54adef30af696d7afd01bfd6d2 | buffer/tests/test_link.py | buffer/tests/test_link.py | from nose.tools import eq_, raises
from mock import MagicMock, patch
from buffer.models.link import Link
def test_links_shares():
'''
Test link's shares retrieving from constructor
'''
mocked_api = MagicMock()
mocked_api.get.return_value = {'shares': 123}
link = Link(api=mocked_api, url='www.google.co... | Test basic link api call | Test basic link api call
| Python | mit | vtemian/buffpy,bufferapp/buffer-python | <INSERT> from nose.tools import eq_, raises
from mock import MagicMock, patch
from buffer.models.link import Link
def test_links_shares():
<INSERT_END> <INSERT> '''
Test link's shares retrieving from constructor
'''
mocked_api = MagicMock()
mocked_api.get.return_value = {'shares': 123}
link = Link(api=... | Test basic link api call
| |
0498e1575f59880b4f7667f0d99bfbd993f2fcd5 | profiles/backends.py | profiles/backends.py | from django.contrib.auth import get_user_model
from django.contrib.auth.backends import ModelBackend
class CaseInsensitiveModelBackend(ModelBackend):
def authenticate(email=None, password=None, **kwargs):
"""
Created by LNguyen(
Date: 14Dec2017
Description: Method to handle backen... | from django.contrib.auth import get_user_model
from django.contrib.auth.backends import ModelBackend
class CaseInsensitiveModelBackend(ModelBackend):
def authenticate(email=None, password=None, **kwargs):
"""
Created by LNguyen(
Date: 14Dec2017
Description: Method to handle backen... | Fix issues with changing passwords | Fix issues with changing passwords
| Python | mit | gdit-cnd/RAPID,LindaTNguyen/RAPID,LindaTNguyen/RAPID,gdit-cnd/RAPID,gdit-cnd/RAPID,gdit-cnd/RAPID,gdit-cnd/RAPID,LindaTNguyen/RAPID,LindaTNguyen/RAPID,LindaTNguyen/RAPID | <INSERT> if (type(email)==str):
<INSERT_END> <INSERT> else:
user=UserModel.objects.get(email__exact=email)
<INSERT_END> <|endoftext|> from django.contrib.auth import get_user_model
from django.contrib.auth.backends import ModelBackend
class CaseInsensitiveModelBackend(ModelBa... | Fix issues with changing passwords
from django.contrib.auth import get_user_model
from django.contrib.auth.backends import ModelBackend
class CaseInsensitiveModelBackend(ModelBackend):
def authenticate(email=None, password=None, **kwargs):
"""
Created by LNguyen(
Date: 14Dec2017
... |
a1e90125199a12beaa132c4d1eba4c09be3f9ba0 | fileupload/serialize.py | fileupload/serialize.py | # encoding: utf-8
import mimetypes
import re
from django.core.urlresolvers import reverse
def order_name(name):
"""order_name -- Limit a text to 20 chars length, if necessary strips the
middle of the text and substitute it for an ellipsis.
name -- text to be limited.
"""
name = re.sub(r'^.*/', '... | # encoding: utf-8
import mimetypes
import re
from django.core.urlresolvers import reverse
def order_name(name):
"""order_name -- Limit a text to 20 chars length, if necessary strips the
middle of the text and substitute it for an ellipsis.
name -- text to be limited.
"""
name = re.sub(r'^.*/', '... | FIX add links to reports generated v2 | FIX add links to reports generated v2
| Python | mit | semitki/canales,semitki/canales,semitki/canales | <REPLACE_OLD> obj.file_type,
<REPLACE_NEW> instance.file_type,
<REPLACE_END> <|endoftext|> # encoding: utf-8
import mimetypes
import re
from django.core.urlresolvers import reverse
def order_name(name):
"""order_name -- Limit a text to 20 chars length, if necessary strips the
middle of the text and substitu... | FIX add links to reports generated v2
# encoding: utf-8
import mimetypes
import re
from django.core.urlresolvers import reverse
def order_name(name):
"""order_name -- Limit a text to 20 chars length, if necessary strips the
middle of the text and substitute it for an ellipsis.
name -- text to be limited... |
371be140dfbecff72d72cda580cd299badc6bc15 | aws_list_all/client.py | aws_list_all/client.py | import boto3
_CLIENTS = {}
def get_regions_for_service(service, regions=()):
"""Given a service name, return a list of region names where this service can have resources,
restricted by a possible set of regions."""
if service == "s3":
return ['us-east-1'] # s3 ListBuckets is a global request, so... | import boto3
_CLIENTS = {}
def get_regions_for_service(service, regions=()):
"""Given a service name, return a list of region names where this service can have resources,
restricted by a possible set of regions."""
if service == "s3":
return ['us-east-1'] # s3 ListBuckets is a global request, so... | Use us-east-1 to query route53 | Use us-east-1 to query route53
Route53 is a global service so doesn't belong to a region, but the API endpoint is in us-east-1.
This makes various listings now work, but not record sets.
Updates #4.
| Python | mit | JohannesEbke/aws_list_all | <INSERT> if service == "route53":
return ['us-east-1'] # route53 is a global service, but the endpoint is in us-east-1.
<INSERT_END> <|endoftext|> import boto3
_CLIENTS = {}
def get_regions_for_service(service, regions=()):
"""Given a service name, return a list of region names where this service ca... | Use us-east-1 to query route53
Route53 is a global service so doesn't belong to a region, but the API endpoint is in us-east-1.
This makes various listings now work, but not record sets.
Updates #4.
import boto3
_CLIENTS = {}
def get_regions_for_service(service, regions=()):
"""Given a service name, return a... |
0866695a2f60538d59277f45a69771664d6dee27 | setup.py | setup.py | import sys
import platform
from setuptools import setup, Extension
cpython = platform.python_implementation() == 'CPython'
is_glibc = platform.libc_ver()[0] == 'glibc'
libc_ok = is_glibc and platform.libc_ver()[1] >= '2.9'
windows = sys.platform.startswith('win')
min_win_version = windows and sys.version_info >= (3, 5... | import sys
import platform
from setuptools import setup, Extension
cpython = platform.python_implementation() == 'CPython'
is_glibc = platform.libc_ver()[0] == 'glibc'
if is_glibc:
glibc_ver = platform.libc_ver()[1]
libc_numeric = tuple(int(x) for x in glibc_ver.split('.') if x.isdigit())
libc_ok = libc_nu... | Fix glibc version detect string | Fix glibc version detect string
| Python | mit | agronholm/cbor2,agronholm/cbor2,agronholm/cbor2 | <REPLACE_OLD> 'glibc'
libc_ok = is_glibc and platform.libc_ver()[1] >= '2.9'
windows <REPLACE_NEW> 'glibc'
if is_glibc:
glibc_ver = platform.libc_ver()[1]
libc_numeric = tuple(int(x) for x in glibc_ver.split('.') if x.isdigit())
libc_ok = libc_numeric >= (2, 9)
else:
libc_ok = False
windows <REPLACE_END... | Fix glibc version detect string
import sys
import platform
from setuptools import setup, Extension
cpython = platform.python_implementation() == 'CPython'
is_glibc = platform.libc_ver()[0] == 'glibc'
libc_ok = is_glibc and platform.libc_ver()[1] >= '2.9'
windows = sys.platform.startswith('win')
min_win_version = wind... |
3279d68859d947f2e618e2770a9fd1b7ce3f26c9 | tests/test_cardxml.py | tests/test_cardxml.py | from hearthstone.enums import GameTag, Rarity
import utils
def test_all_tags_known():
"""
Iterate through the card database and check that all specified GameTags
are known in hearthstone.enums.GameTag
"""
unknown_tags = set()
known_tags = list(GameTag)
known_rarities = list(Rarity)
# Check the db loaded cor... | Add a test to verify that all GameTags are known | Add a test to verify that all GameTags are known
| Python | agpl-3.0 | Ragowit/fireplace,smallnamespace/fireplace,jleclanche/fireplace,beheh/fireplace,amw2104/fireplace,amw2104/fireplace,smallnamespace/fireplace,NightKev/fireplace,Ragowit/fireplace | <REPLACE_OLD> <REPLACE_NEW> from hearthstone.enums import GameTag, Rarity
import utils
def test_all_tags_known():
"""
Iterate through the card database and check that all specified GameTags
are known in hearthstone.enums.GameTag
"""
unknown_tags = set()
known_tags = list(GameTag)
known_rarities = list(Rarity... | Add a test to verify that all GameTags are known
| |
b1c8d27d2fdb44a98b33176bf7b14ef6d2d889d2 | scripts/add-extension.py | scripts/add-extension.py | #!/usr/bin/env python
# Note, you need to pip install python-magic to use this.
import magic
import os
import sys
def fix_with_magic(filename):
base, ext = os.path.splitext(filename)
if ext:
print "skipping {}".format(filename)
return
result = magic.from_file(filename, mime=True)
if ... | Add script to add extension based on mimetype | Add script to add extension based on mimetype
| Python | bsd-3-clause | shaleh/useful-things,shaleh/useful-things | <INSERT> #!/usr/bin/env python
# Note, you need to pip install python-magic to use this.
import magic
import os
import sys
def fix_with_magic(filename):
<INSERT_END> <INSERT> base, ext = os.path.splitext(filename)
if ext:
print "skipping {}".format(filename)
return
result = magic.from_fil... | Add script to add extension based on mimetype
| |
7c9ed9fbdc1b16ae1d59c1099e7190e6297bf584 | util/chplenv/chpl_tasks.py | util/chplenv/chpl_tasks.py | #!/usr/bin/env python
import sys, os
import chpl_arch, chpl_platform, chpl_compiler
from utils import memoize
import utils
@memoize
def get():
tasks_val = os.environ.get('CHPL_TASKS')
if not tasks_val:
arch_val = chpl_arch.get('target', get_lcd=True)
platform_val = chpl_platform.get()
... | #!/usr/bin/env python
import sys, os
import chpl_arch, chpl_platform, chpl_compiler, chpl_comm
from utils import memoize
import utils
@memoize
def get():
tasks_val = os.environ.get('CHPL_TASKS')
if not tasks_val:
arch_val = chpl_arch.get('target', get_lcd=True)
platform_val = chpl_platform.get... | Update chpl_task to only default to muxed when ugni comm is used. | Update chpl_task to only default to muxed when ugni comm is used.
This expands upon (and fixes) #1640 and #1635.
* [ ] Run printchplenv on mac and confirm it still works.
* [ ] Emulate cray-x* with module and confirm comm, tasks are ugni, muxed.
```bash
(
export CHPL_MODULE_HOME=$CHPL_HOME
export CHPL_HOST_PLATF... | Python | apache-2.0 | CoryMcCartan/chapel,chizarlicious/chapel,chizarlicious/chapel,hildeth/chapel,CoryMcCartan/chapel,chizarlicious/chapel,CoryMcCartan/chapel,chizarlicious/chapel,chizarlicious/chapel,CoryMcCartan/chapel,hildeth/chapel,CoryMcCartan/chapel,chizarlicious/chapel,hildeth/chapel,hildeth/chapel,hildeth/chapel,hildeth/chapel,hild... | <REPLACE_OLD> chpl_compiler
from <REPLACE_NEW> chpl_compiler, chpl_comm
from <REPLACE_END> <REPLACE_OLD> chpl_compiler.get('target')
<REPLACE_NEW> chpl_compiler.get('target')
comm_val = chpl_comm.get()
<REPLACE_END> <REPLACE_OLD> (platform_val.startswith('cray-x') <REPLACE_NEW> (comm_val == 'ugni' and
... | Update chpl_task to only default to muxed when ugni comm is used.
This expands upon (and fixes) #1640 and #1635.
* [ ] Run printchplenv on mac and confirm it still works.
* [ ] Emulate cray-x* with module and confirm comm, tasks are ugni, muxed.
```bash
(
export CHPL_MODULE_HOME=$CHPL_HOME
export CHPL_HOST_PLATF... |
16c8880c2b3d5f68ee25093057f949ed0f2e7a5c | toast/app.py | toast/app.py | from flask import Flask, jsonify
from flask import render_template
import urllib2
import json
app = Flask(__name__)
#@app.route("/")
#def hello():
# return render_template('index.html')
#
#@app.route("/dream/<dream>")
#def dream(dream):
# return render_template('dream.html', my_dream=dream)
#
#
@app.route("/dr... | from flask import Flask, jsonify
from flask import render_template
import urllib2
import json
app = Flask(__name__)
FAKE_DATA = [{'name':'toast',
'count':100},
{'name':'pizza',
'count':80},
{'name':'bread',
'count':60},
{'name':'butter',... | Clean up endpoint controllers and add test data. | Clean up endpoint controllers and add test data.
| Python | apache-2.0 | whiskeylover/idreamoftoast,whiskeylover/idreamoftoast,whiskeylover/idreamoftoast | <REPLACE_OLD> Flask(__name__)
#@app.route("/")
#def hello():
# <REPLACE_NEW> Flask(__name__)
FAKE_DATA = [{'name':'toast',
<REPLACE_END> <DELETE> return render_template('index.html')
#
#@app.route("/dream/<dream>")
#def dream(dream):
# <DELETE_END> <REPLACE_OLD> return render_template('dream.html', my_dream=dream)
#... | Clean up endpoint controllers and add test data.
from flask import Flask, jsonify
from flask import render_template
import urllib2
import json
app = Flask(__name__)
#@app.route("/")
#def hello():
# return render_template('index.html')
#
#@app.route("/dream/<dream>")
#def dream(dream):
# return render_template(... |
36df41cf3f5345ab599b5a748562aec2af414239 | python/crypto-square/crypto_square.py | python/crypto-square/crypto_square.py | import string
import math
import itertools
class CryptoSquare:
@classmethod
def encode(cls, msg):
if len(cls.normalize(msg)) == 0:
return ''
return ' '.join(cls.transpose_square(cls.squarify(cls.normalize(msg))))
@classmethod
def squarify(cls, msg):
return [msg[i:... | import string
import math
import itertools
class CryptoSquare:
@classmethod
def encode(cls, msg):
if len(cls.normalize(msg)) == 0:
return ''
return ' '.join(cls.transpose_square(cls.squarify(cls.normalize(msg))))
@classmethod
def squarify(cls, msg):
return [msg[i:... | Clean up transpose helper method | Clean up transpose helper method
| Python | mit | rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism | <REPLACE_OLD> cls.filter_out_none(cls.transpose_uneven_matrix(matrix))
<REPLACE_NEW> cls.transpose_uneven_matrix(matrix)
<REPLACE_END> <REPLACE_OLD> return list(itertools.zip_longest(*matrix))
@staticmethod
def filter_out_none(matrix):
<REPLACE_NEW> transposed_matrix = list(itertools.zip_longest(*matrix))
... | Clean up transpose helper method
import string
import math
import itertools
class CryptoSquare:
@classmethod
def encode(cls, msg):
if len(cls.normalize(msg)) == 0:
return ''
return ' '.join(cls.transpose_square(cls.squarify(cls.normalize(msg))))
@classmethod
def squarify... |
4008824b7b7bf8338b057bc0b594774cb055c794 | blinkylib/patterns/blinkypattern.py | blinkylib/patterns/blinkypattern.py | class BlinkyPattern(object):
def __init__(self, blinkytape):
self._blinkytape = blinkytape
self._animated = False
self._timebase_sec = 0.05
@property
def animated(self):
return self._animated
@property
def timebase_sec(self):
return self._timebase_sec
d... | class BlinkyPattern(object):
def __init__(self, blinkytape):
self._blinkytape = blinkytape
self._animated = False
self._timebase_sec = 0.01
@property
def animated(self):
return self._animated
@property
def timebase_sec(self):
return self._timebase_sec
d... | Decrease pattern timebase to 0.01 sec now that slow-mo bug is fixed | Decrease pattern timebase to 0.01 sec now that slow-mo bug is fixed
| Python | mit | jonspeicher/blinkyfun | <REPLACE_OLD> 0.05
<REPLACE_NEW> 0.01
<REPLACE_END> <|endoftext|> class BlinkyPattern(object):
def __init__(self, blinkytape):
self._blinkytape = blinkytape
self._animated = False
self._timebase_sec = 0.01
@property
def animated(self):
return self._animated
@propert... | Decrease pattern timebase to 0.01 sec now that slow-mo bug is fixed
class BlinkyPattern(object):
def __init__(self, blinkytape):
self._blinkytape = blinkytape
self._animated = False
self._timebase_sec = 0.05
@property
def animated(self):
return self._animated
@property... |
85db39e36c99e800e1008605213d1c25108b035d | angr/paths.py | angr/paths.py | import logging
l = logging.getLogger('angr.states')
class PathGenerator(object):
def __init__(self, project):
self._project = project
def blank_path(self, state=None, *args, **kwargs):
'''
blank_point - Returns a start path, representing a clean start of symbolic execution.
''... | import logging
l = logging.getLogger('angr.states')
class PathGenerator(object):
def __init__(self, project):
self._project = project
def blank_path(self, state=None, jumpkind='Ijk_Boring', *args, **kwargs):
'''
blank_point - Returns a start path, representing a clean start of symboli... | Allow specifying jumpkind with creating a Path via PathGenerator.blank_path() | Allow specifying jumpkind with creating a Path via PathGenerator.blank_path()
| Python | bsd-2-clause | angr/angr,GuardianRG/angr,iamahuman/angr,cureHsu/angr,tyb0807/angr,mingderwang/angr,fjferrer/angr,angr/angr,zhuyue1314/angr,axt/angr,cureHsu/angr,chubbymaggie/angr,schieb/angr,lowks/angr,fjferrer/angr,zhuyue1314/angr,schieb/angr,chubbymaggie/angr,GuardianRG/angr,axt/angr,mingderwang/angr,avain/angr,schieb/angr,angr/ang... | <INSERT> jumpkind='Ijk_Boring', <INSERT_END> <REPLACE_OLD> s)
<REPLACE_NEW> s, jumpkind=jumpkind)
<REPLACE_END> <|endoftext|> import logging
l = logging.getLogger('angr.states')
class PathGenerator(object):
def __init__(self, project):
self._project = project
def blank_path(self, state=None, jump... | Allow specifying jumpkind with creating a Path via PathGenerator.blank_path()
import logging
l = logging.getLogger('angr.states')
class PathGenerator(object):
def __init__(self, project):
self._project = project
def blank_path(self, state=None, *args, **kwargs):
'''
blank_point - Ret... |
a81e3f43b83fb003b9708e3a7a581da1dc9190c1 | django_project/api/urls.py | django_project/api/urls.py | # -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
from .views import LocalitiesAPI, LocalityAPI
urlpatterns = patterns(
'',
url(
r'^localities$', LocalitiesAPI.as_view(),
name='api_localities'
),
url(
r'^localitiy/(?P<uuid>\w{32})$', LocalityAPI.as_view(),
... | # -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
from .views import LocalitiesAPI, LocalityAPI
urlpatterns = patterns(
'',
url(
r'^localities$', LocalitiesAPI.as_view(),
name='api_localities'
),
url(
r'^locality/(?P<uuid>\w{32})$', LocalityAPI.as_view(),
... | Fix spelling for api/locality/:uuid URL | Fix spelling for api/locality/:uuid URL
Closes #121
| Python | bsd-2-clause | ismailsunni/healthsites,ismailsunni/healthsites,ismailsunni/healthsites,ismailsunni/healthsites | <REPLACE_OLD> r'^localitiy/(?P<uuid>\w{32})$', <REPLACE_NEW> r'^locality/(?P<uuid>\w{32})$', <REPLACE_END> <|endoftext|> # -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
from .views import LocalitiesAPI, LocalityAPI
urlpatterns = patterns(
'',
url(
r'^localities$', LocalitiesAPI.as_v... | Fix spelling for api/locality/:uuid URL
Closes #121
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
from .views import LocalitiesAPI, LocalityAPI
urlpatterns = patterns(
'',
url(
r'^localities$', LocalitiesAPI.as_view(),
name='api_localities'
),
url(
r'^loc... |
869bafa9aadf45c2beb3e6f4e3d3751d2d6baf8f | subversion/bindings/swig/python/tests/core.py | subversion/bindings/swig/python/tests/core.py | import unittest, os
import svn.core
class SubversionCoreTestCase(unittest.TestCase):
"""Test cases for the basic SWIG Subversion core"""
def test_SubversionException(self):
self.assertEqual(svn.core.SubversionException().args, ())
self.assertEqual(svn.core.SubversionException('error message').args,
... | import unittest, os
import svn.core
class SubversionCoreTestCase(unittest.TestCase):
"""Test cases for the basic SWIG Subversion core"""
def test_SubversionException(self):
self.assertEqual(svn.core.SubversionException().args, ())
self.assertEqual(svn.core.SubversionException('error message').args,
... | Add a regression test for the bug fixed in r28485. | Add a regression test for the bug fixed in r28485.
* subversion/bindings/swig/python/tests/core.py
(SubversionCoreTestCase.test_SubversionException): Test explicit
exception fields.
git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@868579 13f79535-47bb-0310-9956-ffa450edef68
| Python | apache-2.0 | wbond/subversion,wbond/subversion,YueLinHo/Subversion,YueLinHo/Subversion,YueLinHo/Subversion,wbond/subversion,wbond/subversion,YueLinHo/Subversion,YueLinHo/Subversion,wbond/subversion,wbond/subversion,YueLinHo/Subversion,wbond/subversion,YueLinHo/Subversion,YueLinHo/Subversion | <REPLACE_OLD> 1))
<REPLACE_NEW> 1))
self.assertEqual(svn.core.SubversionException('error message', 1).apr_err,
1)
self.assertEqual(svn.core.SubversionException('error message', 1).message,
'error message')
<REPLACE_END> <|endoftext|> import unittest, os
import svn.... | Add a regression test for the bug fixed in r28485.
* subversion/bindings/swig/python/tests/core.py
(SubversionCoreTestCase.test_SubversionException): Test explicit
exception fields.
git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@868579 13f79535-47bb-0310-9956-ffa450edef68
import unittest, os
import svn.... |
5b97d56f8c8f751896b00c6cb1b3f360ea06ecf2 | setup.py | setup.py | import sys
if sys.version_info < (2, 7):
print sys.stderr, "{}: need Python 2.7 or later.".format(sys.argv[0])
print sys.stderror, "Your python is {}".format(sys.version)
sys.exit(1)
from setuptools import setup
setup(
name = "python-json-logger",
version = "0.0.1",
url = "http://github.com/ma... | import sys
if sys.version_info < (2, 7):
print sys.stderr, "{}: need Python 2.7 or later.".format(sys.argv[0])
print sys.stderror, "Your python is {}".format(sys.version)
sys.exit(1)
from setuptools import setup
setup(
name = "python-json-logger",
version = "0.0.1",
url = "http://github.com/ma... | Use trove classifiers from official list | Use trove classifiers from official list
(aligned with https://pypi.python.org/pypi?%3Aaction=list_classifiers)
| Python | bsd-2-clause | bbc/python-json-logger,madzak/python-json-logger | <REPLACE_OLD> 1 <REPLACE_NEW> 3 <REPLACE_END> <REPLACE_OLD> 'Operation <REPLACE_NEW> 'Operating <REPLACE_END> <INSERT> System :: <INSERT_END> <|endoftext|> import sys
if sys.version_info < (2, 7):
print sys.stderr, "{}: need Python 2.7 or later.".format(sys.argv[0])
print sys.stderror, "Your python is {}".forma... | Use trove classifiers from official list
(aligned with https://pypi.python.org/pypi?%3Aaction=list_classifiers)
import sys
if sys.version_info < (2, 7):
print sys.stderr, "{}: need Python 2.7 or later.".format(sys.argv[0])
print sys.stderror, "Your python is {}".format(sys.version)
sys.exit(1)
from setup... |
ed044a79347fcde11416c51a5c577fe2cc467050 | pyfr/readers/base.py | pyfr/readers/base.py | # -*- coding: utf-8 -*-
import uuid
from abc import ABCMeta, abstractmethod
class BaseReader(object):
__metaclass__ = ABCMeta
@abstractmethod
def __init__(self):
pass
@abstractmethod
def _to_raw_pyfrm(self):
pass
def to_pyfrm(self):
mesh = self._to_raw_pyfrm()
... | # -*- coding: utf-8 -*-
import re
import uuid
import itertools as it
from abc import ABCMeta, abstractmethod
import numpy as np
class BaseReader(object):
__metaclass__ = ABCMeta
@abstractmethod
def __init__(self):
pass
@abstractmethod
def _to_raw_pyfrm(self):
pass
def _op... | Add some simple optimizations into the mesh reader classes. | Add some simple optimizations into the mesh reader classes.
This yields a ~1.5% performance improvement.
| Python | bsd-3-clause | tjcorona/PyFR,tjcorona/PyFR,BrianVermeire/PyFR,tjcorona/PyFR,Aerojspark/PyFR,iyer-arvind/PyFR | <REPLACE_OLD> uuid
from <REPLACE_NEW> re
import uuid
import itertools as it
from <REPLACE_END> <REPLACE_OLD> abstractmethod
class <REPLACE_NEW> abstractmethod
import numpy as np
class <REPLACE_END> <INSERT> _optimize(self, mesh):
# Sort interior interfaces
for f in it.ifilter(lambda f: re.match('... | Add some simple optimizations into the mesh reader classes.
This yields a ~1.5% performance improvement.
# -*- coding: utf-8 -*-
import uuid
from abc import ABCMeta, abstractmethod
class BaseReader(object):
__metaclass__ = ABCMeta
@abstractmethod
def __init__(self):
pass
@abstractmethod
... |
3874ca578c52879d9861213e321f6ece9e67f10b | sopel/modules/ping.py | sopel/modules/ping.py | # coding=utf8
"""
ping.py - Sopel Ping Module
Author: Sean B. Palmer, inamidst.com
About: http://sopel.chat
"""
from __future__ import unicode_literals
import random
from sopel.module import rule, priority, thread
@rule(r'(?i)(hi|hello|hey),? $nickname[ \t]*$')
def hello(bot, trigger):
if trigger.owner:
... | # coding=utf8
"""
ping.py - Sopel Ping Module
Author: Sean B. Palmer, inamidst.com
About: http://sopel.chat
"""
from __future__ import unicode_literals
import random
from sopel.module import rule, priority, thread
@rule(r'(?i)(hi|hello|hey),? $nickname[ \t]*$')
def hello(bot, trigger):
greeting = random.choice((... | Stop Sopel from relying rudely to the bot's owner. | Stop Sopel from relying rudely to the bot's owner.
| Python | mit | Uname-a/knife_scraper,Uname-a/knife_scraper,Uname-a/knife_scraper | <DELETE> if trigger.owner:
greeting = random.choice(('Fuck off,', 'Screw you,', 'Go away'))
else:
<DELETE_END> <|endoftext|> # coding=utf8
"""
ping.py - Sopel Ping Module
Author: Sean B. Palmer, inamidst.com
About: http://sopel.chat
"""
from __future__ import unicode_literals
import random
from sop... | Stop Sopel from relying rudely to the bot's owner.
# coding=utf8
"""
ping.py - Sopel Ping Module
Author: Sean B. Palmer, inamidst.com
About: http://sopel.chat
"""
from __future__ import unicode_literals
import random
from sopel.module import rule, priority, thread
@rule(r'(?i)(hi|hello|hey),? $nickname[ \t]*$')
def... |
a968cbcd4b5a2aec5e1253221598eb53f9f0c2e9 | osgtest/tests/test_10_condor.py | osgtest/tests/test_10_condor.py | import os
import osgtest.library.core as core
import unittest
class TestStartCondor(unittest.TestCase):
def test_01_start_condor(self):
core.config['condor.lockfile'] = '/var/lock/subsys/condor_master'
core.state['condor.started-service'] = False
core.state['condor.running-service'] = Fals... | import os
from osgtest.library import core, osgunittest
import unittest
class TestStartCondor(osgunittest.OSGTestCase):
def test_01_start_condor(self):
core.config['condor.lockfile'] = '/var/lock/subsys/condor_master'
core.state['condor.started-service'] = False
core.state['condor.running-... | Update 10_condor to use OkSkip functionality | Update 10_condor to use OkSkip functionality
git-svn-id: 884a03e47e2adb735d896e55bb5ad6bc3421ba19@16522 4e558342-562e-0410-864c-e07659590f8c
| Python | apache-2.0 | efajardo/osg-test,efajardo/osg-test | <REPLACE_OLD> os
import osgtest.library.core as core
import <REPLACE_NEW> os
from osgtest.library import core, osgunittest
import <REPLACE_END> <REPLACE_OLD> TestStartCondor(unittest.TestCase):
<REPLACE_NEW> TestStartCondor(osgunittest.OSGTestCase):
<REPLACE_END> <REPLACE_OLD> if core.missing_rpm('condor'):
... | Update 10_condor to use OkSkip functionality
git-svn-id: 884a03e47e2adb735d896e55bb5ad6bc3421ba19@16522 4e558342-562e-0410-864c-e07659590f8c
import os
import osgtest.library.core as core
import unittest
class TestStartCondor(unittest.TestCase):
def test_01_start_condor(self):
core.config['condor.lockfil... |
4976931febdbddec362411b62c7574d4a26368d5 | launch_instance.py | launch_instance.py | # License under the MIT License - see LICENSE
import boto.ec2
import os
import time
def launch(key_name, region='us-west-2', image_id='ami-5189a661',
instance_type='t2.micro', security_groups='launch-wizard-1',
user_data=None):
'''
'''
if not isinstance(security_groups, list):
... | # License under the MIT License - see LICENSE
import boto.ec2
import os
import time
def launch(key_name, region='us-west-2', image_id='ami-5189a661',
instance_type='t2.micro', security_groups='launch-wizard-1',
user_data=None, initial_check=True):
'''
'''
if not isinstance(security... | Make the initialization wait optional | Make the initialization wait optional
| Python | mit | Astroua/aws_controller,Astroua/aws_controller | <REPLACE_OLD> user_data=None):
<REPLACE_NEW> user_data=None, initial_check=True):
<REPLACE_END> <INSERT> if initial_check:
<INSERT_END> <INSERT> <INSERT_END> <INSERT> <INSERT_END> <INSERT> <INSERT_END> <|endoftext|> # License under the MIT License - see LICENSE
import boto.ec2
import os
import ti... | Make the initialization wait optional
# License under the MIT License - see LICENSE
import boto.ec2
import os
import time
def launch(key_name, region='us-west-2', image_id='ami-5189a661',
instance_type='t2.micro', security_groups='launch-wizard-1',
user_data=None):
'''
'''
if not ... |
b91efc73046fe1df8e7678e50464daf6a36ddab1 | char_map.py | char_map.py | char_map = {
'a': 3,
'b': 6,
'c': 9,
'd': 12,
'e': 15,
'f': 18,
'g': 21,
'h': 24,
'i': 27,
'j': 30,
'k': 33,
'l': 36,
'm': 39,
'n': 42,
'o': 45,
'p': 48,
'q': 51,
'r': 54,
's': 57,
't': 60,
'u': 63,
'v': 66,
'w': 69,
'x': 72... | Create mapping of characters to percentage values | Create mapping of characters to percentage values
| Python | mit | eddiezane/hackpack-cloudbit,eddiezane/hackpack-cloudbit | <INSERT> char_map = {
<INSERT_END> <INSERT> 'a': 3,
'b': 6,
'c': 9,
'd': 12,
'e': 15,
'f': 18,
'g': 21,
'h': 24,
'i': 27,
'j': 30,
'k': 33,
'l': 36,
'm': 39,
'n': 42,
'o': 45,
'p': 48,
'q': 51,
'r': 54,
's': 57,
't': 60,
'u': 63,
'v'... | Create mapping of characters to percentage values
| |
1cb22dfdf9882de7aa6e977c79d80eac7158873e | tools/win32build/doall.py | tools/win32build/doall.py | import subprocess
import os
PYVER = "2.5"
# Bootstrap
subprocess.check_call(['python', 'prepare_bootstrap.py'])
# Build binaries
subprocess.check_call(['python', 'build.py', '-p', PYVER], cwd = 'bootstrap-%s' % PYVER)
# Build installer using nsis
subprocess.check_call(['makensis', 'numpy-superinstaller.... | Add top script to generate binaries from scratch. | Add top script to generate binaries from scratch.
git-svn-id: 77a43f9646713b91fea7788fad5dfbf67e151ece@5553 94b884b6-d6fd-0310-90d3-974f1d3f35e1
| Python | bsd-3-clause | efiring/numpy-work,teoliphant/numpy-refactor,Ademan/NumPy-GSoC,teoliphant/numpy-refactor,efiring/numpy-work,efiring/numpy-work,illume/numpy3k,chadnetzer/numpy-gaurdro,jasonmccampbell/numpy-refactor-sprint,illume/numpy3k,illume/numpy3k,jasonmccampbell/numpy-refactor-sprint,efiring/numpy-work,jasonmccampbell/numpy-refact... | <REPLACE_OLD> <REPLACE_NEW> import subprocess
import os
PYVER = "2.5"
# Bootstrap
subprocess.check_call(['python', 'prepare_bootstrap.py'])
# Build binaries
subprocess.check_call(['python', 'build.py', '-p', PYVER], cwd = 'bootstrap-%s' % PYVER)
# Build installer using nsis
subprocess.check_call(['make... | Add top script to generate binaries from scratch.
git-svn-id: 77a43f9646713b91fea7788fad5dfbf67e151ece@5553 94b884b6-d6fd-0310-90d3-974f1d3f35e1
| |
5ce0e1a3320ac994737436803b8bd0923142e0af | htdocs/json/vtec_events.py | htdocs/json/vtec_events.py | #!/usr/bin/env python
"""Listing of VTEC events for a WFO and year"""
import cgi
import sys
import json
def report(wfo, year):
"""Generate a report of VTEC ETNs used for a WFO and year
Args:
wfo (str): 3 character WFO identifier
year (int): year to run for
"""
import psycopg2
pgcon... | Add quick hack of a VTEC listing, will make JSON when time permits | Add quick hack of a VTEC listing, will make JSON when time permits | Python | mit | akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem | <REPLACE_OLD> <REPLACE_NEW> #!/usr/bin/env python
"""Listing of VTEC events for a WFO and year"""
import cgi
import sys
import json
def report(wfo, year):
"""Generate a report of VTEC ETNs used for a WFO and year
Args:
wfo (str): 3 character WFO identifier
year (int): year to run for
"""
... | Add quick hack of a VTEC listing, will make JSON when time permits
| |
b38edc2a192151324855d50e9e172f0fd96b9064 | mda/finance.py | mda/finance.py | from __future__ import division
import numpy as np
import pandas as pd
import urllib2
# __author__ = 'mattmcd'
class LseReader:
def __init__(self):
dataLoc = '/home/mattmcd/Work/Data/'
ftseFile = dataLoc + 'FTSE100.csv'
self.ftse100 = pd.read_csv( ftseFile )
self.prefixURL = 'h... | Read prices from Google Finance | Read prices from Google Finance
| Python | apache-2.0 | mattmcd/PyAnalysis | <INSERT> from __future__ import division
import numpy as np
import pandas as pd
import urllib2
# __author__ = 'mattmcd'
class LseReader:
<INSERT_END> <INSERT> def __init__(self):
dataLoc = '/home/mattmcd/Work/Data/'
ftseFile = dataLoc + 'FTSE100.csv'
self.ftse100 = pd.read_csv( ftseFile... | Read prices from Google Finance
| |
132932747a1f7da67413b9c0cf7916707c1e3d19 | src/python/services/CVMFSAppVersions.py | src/python/services/CVMFSAppVersions.py | """CVMFS Servcice."""
import os
import re
import cherrypy
import html
from natsort import natsorted
version_re = re.compile(r"^release-(\d{1,3}\.\d{1,3}\.\d{1,3})$")
@cherrypy.popargs('appid')
class CVMFSAppVersions(object):
"""
CVMFS App Version checking service.
CVMFS Service to get the list of versio... | """CVMFS Servcice."""
import os
import re
import cherrypy
import html
from natsort import natsorted
VERSION_RE = re.compile(r"^release-(\d{1,3}\.\d{1,3}\.\d{1,3})$")
@cherrypy.popargs('appid')
class CVMFSAppVersions(object):
"""
CVMFS App Version checking service.
CVMFS Service to get the list of versio... | Change the re const name to uppercase. | Change the re const name to uppercase.
| Python | mit | alexanderrichards/LZProduction,alexanderrichards/LZProduction,alexanderrichards/LZProduction,alexanderrichards/LZProduction | <REPLACE_OLD> natsorted
version_re <REPLACE_NEW> natsorted
VERSION_RE <REPLACE_END> <REPLACE_OLD> version_re.findall(dir_):
<REPLACE_NEW> VERSION_RE.findall(dir_):
<REPLACE_END> <|endoftext|> """CVMFS Servcice."""
import os
import re
import cherrypy
import html
from natsort import natsorted
VERSION_RE = re.compile... | Change the re const name to uppercase.
"""CVMFS Servcice."""
import os
import re
import cherrypy
import html
from natsort import natsorted
version_re = re.compile(r"^release-(\d{1,3}\.\d{1,3}\.\d{1,3})$")
@cherrypy.popargs('appid')
class CVMFSAppVersions(object):
"""
CVMFS App Version checking service.
... |
f18957ca1986317e8987183633c39f1987e316c4 | pgcontents/__init__.py | pgcontents/__init__.py | from .checkpoints import PostgresCheckpoints
from .pgmanager import PostgresContentsManager
__all__ = [
'PostgresCheckpoints',
'PostgresContentsManager',
]
| # Do this first so that we bail early with a useful message if the user didn't
# specify [ipy3] or [ipy4].
try:
import IPython # noqa
except ImportError:
raise ImportError(
"No IPython installation found.\n"
"To install pgcontents with the latest Jupyter Notebook"
" run 'pip install pgc... | Add warning if IPython isn't installed. | DOC: Add warning if IPython isn't installed.
| Python | apache-2.0 | quantopian/pgcontents | <REPLACE_OLD> from <REPLACE_NEW> # Do this first so that we bail early with a useful message if the user didn't
# specify [ipy3] or [ipy4].
try:
import IPython # noqa
except ImportError:
raise ImportError(
"No IPython installation found.\n"
"To install pgcontents with the latest Jupyter Noteboo... | DOC: Add warning if IPython isn't installed.
from .checkpoints import PostgresCheckpoints
from .pgmanager import PostgresContentsManager
__all__ = [
'PostgresCheckpoints',
'PostgresContentsManager',
]
|
60d8413940119c64db89ded7854850912947e135 | var/spack/packages/mbedtls/package.py | var/spack/packages/mbedtls/package.py | from spack import *
class Mbedtls(Package):
"""
mbed TLS (formerly known as PolarSSL) makes it trivially easy for developers to include cryptographic and SSL/TLS capabilities in their (embedded) products, facilitating this functionality with a minimal coding footprint.
"""
homepage = "https://tls.mbed.... | Support mbedtls, an alternative SSL library | Support mbedtls, an alternative SSL library
| Python | lgpl-2.1 | lgarren/spack,LLNL/spack,tmerrick1/spack,LLNL/spack,TheTimmy/spack,mfherbst/spack,krafczyk/spack,LLNL/spack,iulian787/spack,skosukhin/spack,krafczyk/spack,TheTimmy/spack,mfherbst/spack,matthiasdiener/spack,iulian787/spack,matthiasdiener/spack,tmerrick1/spack,mfherbst/spack,lgarren/spack,TheTimmy/spack,EmreAtes/spack,Th... | <INSERT> from spack import *
class Mbedtls(Package):
<INSERT_END> <INSERT> """
mbed TLS (formerly known as PolarSSL) makes it trivially easy for developers to include cryptographic and SSL/TLS capabilities in their (embedded) products, facilitating this functionality with a minimal coding footprint.
"""
... | Support mbedtls, an alternative SSL library
| |
2a1adeaa61e61531f8f69a459b098b4ecf147941 | tornado/test/__init__.py | tornado/test/__init__.py | import asyncio
import sys
# Use the selector event loop on windows. Do this in tornado/test/__init__.py
# instead of runtests.py so it happens no matter how the test is run (such as
# through editor integrations).
if sys.platform == "win32" and hasattr(asyncio, "WindowsSelectorEventLoopPolicy"):
asyncio.set_event_... | Use selector event loop on windows. | test: Use selector event loop on windows.
This gets most of the tests working again on windows with py38.
| Python | apache-2.0 | bdarnell/tornado,dongpinglai/my_tornado,tornadoweb/tornado,bdarnell/tornado,bdarnell/tornado,lilydjwg/tornado,tornadoweb/tornado,dongpinglai/my_tornado,allenl203/tornado,bdarnell/tornado,mivade/tornado,allenl203/tornado,allenl203/tornado,mivade/tornado,allenl203/tornado,mivade/tornado,tornadoweb/tornado,lilydjwg/tornad... | <INSERT> import asyncio
import sys
# Use the selector event loop on windows. Do this in tornado/test/__init__.py
# instead of runtests.py so it happens no matter how the test is run (such as
# through editor integrations).
if sys.platform == "win32" and hasattr(asyncio, "WindowsSelectorEventLoopPolicy"):
<INSERT_END>... | test: Use selector event loop on windows.
This gets most of the tests working again on windows with py38.
| |
4daca355a9ba2807b9f992199e6a1ca78d3678fd | wordpress_formatter.py | wordpress_formatter.py | import sys
def fixFormat(file_name):
original = open(file_name, 'r')
fixed_copy = open("fixed_" + file_name, 'w')
for line in original:
line = line.replace('<', '<')
line = line.replace('>', '>')
line = line.replace(""", '"')
fixed_copy.write(line)
orig... | Add core functionality for formatter | Add core functionality for formatter
| Python | mit | HenryDangPRG/WordPress-Code-Formatter | <INSERT> import sys
def fixFormat(file_name):
<INSERT_END> <INSERT> original = open(file_name, 'r')
fixed_copy = open("fixed_" + file_name, 'w')
for line in original:
line = line.replace('<', '<')
line = line.replace('>', '>')
line = line.replace(""", '"')
fi... | Add core functionality for formatter
| |
2046d82addab9ec83dbb85a2d08c727a52065d8b | deckglue/models.py | deckglue/models.py | from django.db import models
# Create your models here.
| from django.contrib.auth.models import Permission
from django.db.models.signals import post_save, pre_delete
from django.dispatch import receiver
from cardbox.card_model import Card
from cardbox.deck_model import Deck
from guardian.shortcuts import assign_perm, get_users_with_perms
from guardian.models import UserOb... | Add signal hooks to create practice objects | Add signal hooks to create practice objects
| Python | mit | DummyDivision/Tsune,DummyDivision/Tsune,DummyDivision/Tsune | <REPLACE_OLD> django.db import models
# Create your models here.
<REPLACE_NEW> django.contrib.auth.models import Permission
from django.db.models.signals import post_save, pre_delete
from django.dispatch import receiver
from cardbox.card_model import Card
from cardbox.deck_model import Deck
from guardian.shortcuts im... | Add signal hooks to create practice objects
from django.db import models
# Create your models here.
|
d2d03e89b0c89bc78c4087b5ad6a4f543301f927 | Bindings/Python/tests/test_component_interface.py | Bindings/Python/tests/test_component_interface.py | import os
import unittest
import opensim as osim
test_dir = os.path.join(os.path.dirname(os.path.abspath(osim.__file__)),
'tests')
# Silence warning messages if mesh (.vtp) files cannot be found.
osim.Model.setDebugLevel(0)
class TestComponentInterface(unittest.TestCase):
def test_printC... | import os
import unittest
import opensim as osim
test_dir = os.path.join(os.path.dirname(os.path.abspath(osim.__file__)),
'tests')
# Silence warning messages if mesh (.vtp) files cannot be found.
osim.Model.setDebugLevel(0)
class TestComponentInterface(unittest.TestCase):
def test_printC... | Update the number of components listed in the model. | Update the number of components listed in the model.
| Python | apache-2.0 | opensim-org/opensim-core,opensim-org/opensim-core,opensim-org/opensim-core,opensim-org/opensim-core,opensim-org/opensim-core,opensim-org/opensim-core,opensim-org/opensim-core | <REPLACE_OLD> 98)
<REPLACE_NEW> 126)
<REPLACE_END> <|endoftext|> import os
import unittest
import opensim as osim
test_dir = os.path.join(os.path.dirname(os.path.abspath(osim.__file__)),
'tests')
# Silence warning messages if mesh (.vtp) files cannot be found.
osim.Model.setDebugLevel(0)
c... | Update the number of components listed in the model.
import os
import unittest
import opensim as osim
test_dir = os.path.join(os.path.dirname(os.path.abspath(osim.__file__)),
'tests')
# Silence warning messages if mesh (.vtp) files cannot be found.
osim.Model.setDebugLevel(0)
class TestComp... |
b7627255c04e51ebb28f31365cff28ee9abcd05c | openspending/ui/test/functional/test_home.py | openspending/ui/test/functional/test_home.py | from .. import ControllerTestCase, url
class TestHomeController(ControllerTestCase):
def test_index(self):
response = self.app.get(url(controller='home', action='index'))
assert 'OpenSpending' in response
def test_locale(self):
response = self.app.get(url(controller='home', action='lo... | from .. import ControllerTestCase, url
class TestHomeController(ControllerTestCase):
def test_index(self):
response = self.app.get(url(controller='home', action='index'))
assert 'OpenSpending' in response
def test_locale(self):
response = self.app.get(url(controller='home', action='se... | Fix test for locale route generation. | Fix test for locale route generation. | Python | agpl-3.0 | CivicVision/datahub,spendb/spendb,johnjohndoe/spendb,pudo/spendb,johnjohndoe/spendb,nathanhilbert/FPA_Core,openspending/spendb,CivicVision/datahub,spendb/spendb,johnjohndoe/spendb,USStateDept/FPA_Core,USStateDept/FPA_Core,openspending/spendb,pudo/spendb,CivicVision/datahub,nathanhilbert/FPA_Core,spendb/spendb,openspend... | <REPLACE_OLD> action='locale'))
<REPLACE_NEW> action='set_locale'))
<REPLACE_END> <|endoftext|> from .. import ControllerTestCase, url
class TestHomeController(ControllerTestCase):
def test_index(self):
response = self.app.get(url(controller='home', action='index'))
assert 'OpenSpending' in resp... | Fix test for locale route generation.
from .. import ControllerTestCase, url
class TestHomeController(ControllerTestCase):
def test_index(self):
response = self.app.get(url(controller='home', action='index'))
assert 'OpenSpending' in response
def test_locale(self):
response = self.ap... |
6dde06470c9cd868319b1b4615d3065b61a6bc2c | sqlcop/cli.py | sqlcop/cli.py | import sys
import sqlparse
from .checks import has_cross_join
def parse_file(filename):
import json
with open(filename, 'r') as fh:
return json.load(fh)
CHECKS = (
(has_cross_join, 'query contains cross join'),
)
def check_query(el):
"""
Run each of the defined checks on a query.
"... | import sys
import sqlparse
from .checks import has_cross_join
def parse_file(filename):
return open(filename, 'r').readlines()
CHECKS = (
(has_cross_join, 'query contains cross join'),
)
def check_query(el):
"""
Run each of the defined checks on a query.
"""
stmt = sqlparse.parse(el)
f... | Work with plain SQL files | Work with plain SQL files
| Python | bsd-3-clause | freshbooks/sqlcop | <REPLACE_OLD> import json
with <REPLACE_NEW> return <REPLACE_END> <REPLACE_OLD> 'r') as fh:
return json.load(fh)
CHECKS <REPLACE_NEW> 'r').readlines()
CHECKS <REPLACE_END> <REPLACE_OLD> query, tests <REPLACE_NEW> query <REPLACE_END> <REPLACE_OLD> queries.iteritems():
<REPLACE_NEW> queries:
<REPLACE_EN... | Work with plain SQL files
import sys
import sqlparse
from .checks import has_cross_join
def parse_file(filename):
import json
with open(filename, 'r') as fh:
return json.load(fh)
CHECKS = (
(has_cross_join, 'query contains cross join'),
)
def check_query(el):
"""
Run each of the defin... |
c231987c532885fa7bc5e8d2afc8b7a30a2ce297 | bayesian_methods_for_hackers/simulate_messages_ch02.py | bayesian_methods_for_hackers/simulate_messages_ch02.py | import json
import matplotlib
import numpy as np
import pymc as pm
from matplotlib import pyplot as plt
def main():
matplotlibrc_path = '/home/noel/repo/playground/matplotlibrc.json'
matplotlib.rcParams.update(json.load(open(matplotlibrc_path)))
tau = pm.rdiscrete_uniform(0, 80)
print tau
alpha ... | import json
import matplotlib
import numpy as np
import pymc as pm
from matplotlib import pyplot as plt
def main():
tau = pm.rdiscrete_uniform(0, 80)
print tau
alpha = 1. / 20.
lambda_1, lambda_2 = pm.rexponential(alpha, 2)
print lambda_1, lambda_2
data = np.r_[pm.rpoisson(lambda_1, tau), pm... | Change of repo name. Update effected paths | Change of repo name. Update effected paths
| Python | mit | noelevans/sandpit,noelevans/sandpit,noelevans/sandpit,noelevans/sandpit,noelevans/sandpit,noelevans/sandpit | <DELETE> matplotlibrc_path = '/home/noel/repo/playground/matplotlibrc.json'
matplotlib.rcParams.update(json.load(open(matplotlibrc_path)))
<DELETE_END> <|endoftext|> import json
import matplotlib
import numpy as np
import pymc as pm
from matplotlib import pyplot as plt
def main():
tau = pm.rdiscrete_unif... | Change of repo name. Update effected paths
import json
import matplotlib
import numpy as np
import pymc as pm
from matplotlib import pyplot as plt
def main():
matplotlibrc_path = '/home/noel/repo/playground/matplotlibrc.json'
matplotlib.rcParams.update(json.load(open(matplotlibrc_path)))
tau = pm.rdiscr... |
f5c74e6869b54bf6d16bb8493d3c76e9fb65bec5 | createdb.py | createdb.py | #!/usr/bin/env python
import sys
import fedmsg.config
import fmn.lib.models
config = fedmsg.config.load_config()
uri = config.get('fmn.sqlalchemy.uri')
if not uri:
raise ValueError("fmn.sqlalchemy.uri must be present")
if '-h' in sys.argv or '--help'in sys.argv:
print "createdb.py [--with-dev-data]"
sys.... | #!/usr/bin/env python
import sys
import fedmsg.config
import fmn.lib.models
config = fedmsg.config.load_config()
uri = config.get('fmn.sqlalchemy.uri')
if not uri:
raise ValueError("fmn.sqlalchemy.uri must be present")
if '-h' in sys.argv or '--help'in sys.argv:
print "createdb.py [--with-dev-data]"
sys.... | Add the desktop context to the setup script. | Add the desktop context to the setup script.
| Python | lgpl-2.1 | jeremycline/fmn,jeremycline/fmn,jeremycline/fmn | <INSERT> context4 = fmn.lib.models.Context.create(
session, name="desktop", description="fedmsg-notify",
detail_name="None", icon="console",
placeholder="There's no need to put a value here"
)
<INSERT_END> <|endoftext|> #!/usr/bin/env python
import sys
import fedmsg.config
import fmn.li... | Add the desktop context to the setup script.
#!/usr/bin/env python
import sys
import fedmsg.config
import fmn.lib.models
config = fedmsg.config.load_config()
uri = config.get('fmn.sqlalchemy.uri')
if not uri:
raise ValueError("fmn.sqlalchemy.uri must be present")
if '-h' in sys.argv or '--help'in sys.argv:
... |
6e2a484ac46279c6a077fb135d7e5f66605e9b88 | mox/app.py | mox/app.py | from flask import Flask
from flask.ext.mongoengine import MongoEngine
from views import mocks
import os
app = Flask(__name__)
app.config["MONGODB_SETTINGS"] = {
"db": "mox"
}
app.config["SECRET_KEY"] = "KeepThisS3cr3t"
if os.environ.get('PRODUCTION'):
app.config["MONGODB_SETTINGS"]["host"] = os.environ.get("PROD_MO... | from flask import Flask
from flask.ext.mongoengine import MongoEngine
from views import mocks
import os
app = Flask(__name__)
app.config["MONGODB_SETTINGS"] = {
"db": "mox"
}
app.config["SECRET_KEY"] = "KeepThisS3cr3t"
if os.environ.get('HEROKU') == 1:
app.config["MONGODB_SETTINGS"]["host"] = os.environ.get("MONGOD... | Fix up settings for Heroku | Fix up settings for Heroku
| Python | mit | abouzek/mox,abouzek/mox | <REPLACE_OLD> os.environ.get('PRODUCTION'):
app.config["MONGODB_SETTINGS"]["host"] <REPLACE_NEW> os.environ.get('HEROKU') == 1:
app.config["MONGODB_SETTINGS"]["host"] <REPLACE_END> <REPLACE_OLD> os.environ.get("PROD_MONGODB")
db <REPLACE_NEW> os.environ.get("MONGODB_URI")
db <REPLACE_END> <|endoftext|> from flask i... | Fix up settings for Heroku
from flask import Flask
from flask.ext.mongoengine import MongoEngine
from views import mocks
import os
app = Flask(__name__)
app.config["MONGODB_SETTINGS"] = {
"db": "mox"
}
app.config["SECRET_KEY"] = "KeepThisS3cr3t"
if os.environ.get('PRODUCTION'):
app.config["MONGODB_SETTINGS"]["host... |
6dcfacb5c76305bb227674eac6d926e54a26f45c | utils.py | utils.py | import platform
RUNNING_IN_HELL = platform.system() == 'Windows'
RUNNING_IN_STEVE_JOBS = platform.system() == 'Darwin'
RUNNING_IN_GANOO_LOONIX = platform.system() == 'Linux' | import platform
import io
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
RUNNING_IN_HELL = platform.system() == 'Windows'
RUNNING_IN_STEVE_JOBS = platform.system() == 'Darwin'
RUNNING_IN_GANOO_LOONIX = platform.system() == 'Linux'
def Pixmap2StringIO(pixmap):
byteArray = QBy... | Write Pixmap to a StringIO for uploading. | Write Pixmap to a StringIO for uploading.
| Python | mit | miniCruzer/postit-desktop | <REPLACE_OLD> platform
RUNNING_IN_HELL <REPLACE_NEW> platform
import io
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
RUNNING_IN_HELL <REPLACE_END> <REPLACE_OLD> 'Linux' <REPLACE_NEW> 'Linux'
def Pixmap2StringIO(pixmap):
byteArray = QByteArray()
buffer = QBuffer(byteAr... | Write Pixmap to a StringIO for uploading.
import platform
RUNNING_IN_HELL = platform.system() == 'Windows'
RUNNING_IN_STEVE_JOBS = platform.system() == 'Darwin'
RUNNING_IN_GANOO_LOONIX = platform.system() == 'Linux' |
ce279fa1000f3212c25c6fcbe04e8849abed9bb7 | pyp2rpmlib/package_data.py | pyp2rpmlib/package_data.py | class PackageData(object):
def __init__(self, local_file, name, version):
self.local_file = local_file
self.name = name
self.version = version
def __getattr__(self, name):
if name in self.__dict__:
return self.__dict__[name]
return 'TODO:'
@property
... | import subprocess
import time
class PackageData(object):
def __init__(self, local_file, name, version):
self.local_file = local_file
self.name = name
self.version = version
def __getattr__(self, name):
if name in self.__dict__:
return self.__dict__[name]
re... | Add functionality to construct changelog entries | Add functionality to construct changelog entries
| Python | mit | joequant/pyp2rpm,MichaelMraka/pyp2rpm,fedora-python/pyp2rpm,yuokada/pyp2rpm,pombredanne/pyp2rpm,henrysher/spec4pypi,mcyprian/pyp2rpm | <REPLACE_OLD> class <REPLACE_NEW> import subprocess
import time
class <REPLACE_END> <REPLACE_OLD> 'python-%s'
class <REPLACE_NEW> 'python-%s'
@property
def changelog_date_packager(self):
packager = subprocess.Popen('rpmdev-packager', stdout = subprocess.PIPE).communicate()[0].strip()
date_str... | Add functionality to construct changelog entries
class PackageData(object):
def __init__(self, local_file, name, version):
self.local_file = local_file
self.name = name
self.version = version
def __getattr__(self, name):
if name in self.__dict__:
return self.__dict_... |
301f23067dde512f56ba5bf2201b666d125ffc96 | setup.py | setup.py | import sys
import os
from cx_Freeze import setup, Executable
paths = []
paths.extend(sys.path)
paths.append('whacked4')
build_exe_options = {
'packages': [],
'path': paths,
'include_files': ['res', 'cfg', 'docs', 'LICENSE', 'README.md'],
'optimize': 2,
'include_msvcr': True
}
build_exe_options['path'].append('sr... | import sys
import os
from cx_Freeze import setup, Executable
paths = []
paths.extend(sys.path)
paths.append('src')
build_exe_options = {
'path': paths,
'packages': ['whacked4'],
'include_files': ['res', 'cfg', 'docs', 'LICENSE', 'README.md'],
'optimize': 2,
'include_msvcr': True
}
base = None
if sys.platform ==... | Update distutils script. Release builds still twice the size though... | Update distutils script. Release builds still twice the size though...
| Python | bsd-2-clause | GitExl/WhackEd4,GitExl/WhackEd4 | <REPLACE_OLD> []
paths.extend(sys.path)
paths.append('whacked4')
build_exe_options <REPLACE_NEW> []
paths.extend(sys.path)
paths.append('src')
build_exe_options <REPLACE_END> <REPLACE_OLD> {
'packages': [],
'path': paths,
'include_files': <REPLACE_NEW> {
'path': paths,
'packages': ['whacked4'],
'include_files':... | Update distutils script. Release builds still twice the size though...
import sys
import os
from cx_Freeze import setup, Executable
paths = []
paths.extend(sys.path)
paths.append('whacked4')
build_exe_options = {
'packages': [],
'path': paths,
'include_files': ['res', 'cfg', 'docs', 'LICENSE', 'README.md'],
'opt... |
185e8db639f7f74702f9d741f7c01eeebce73d50 | comics/aggregator/feedparser.py | comics/aggregator/feedparser.py | from __future__ import absolute_import
import datetime as dt
import feedparser
from types import StringTypes
from comics.aggregator.lxmlparser import LxmlParser
class FeedParser(object):
def __init__(self, url):
self.raw_feed = feedparser.parse(url)
def for_date(self, date):
return [Entry(e)... | from __future__ import absolute_import
import datetime as dt
import feedparser
from types import StringTypes
from comics.aggregator.lxmlparser import LxmlParser
class FeedParser(object):
def __init__(self, url):
self.raw_feed = feedparser.parse(url)
def for_date(self, date):
return [Entry(e)... | Replace inner function with lambda in FeedParser.has_tag() | Replace inner function with lambda in FeedParser.has_tag()
| Python | agpl-3.0 | datagutten/comics,klette/comics,jodal/comics,datagutten/comics,datagutten/comics,jodal/comics,klette/comics,klette/comics,jodal/comics,datagutten/comics,jodal/comics | <DELETE> def matches_tag(item):
return item.term == tag
<DELETE_END> <REPLACE_OLD> len(filter(matches_tag, self.raw_entry['tags']))):
<REPLACE_NEW> len(filter(lambda t: t.term == tag, self.raw_entry.tags))):
<REPLACE_END> <|endoftext|> from __future__ import absolute_import
import datetime as dt
... | Replace inner function with lambda in FeedParser.has_tag()
from __future__ import absolute_import
import datetime as dt
import feedparser
from types import StringTypes
from comics.aggregator.lxmlparser import LxmlParser
class FeedParser(object):
def __init__(self, url):
self.raw_feed = feedparser.parse(... |
dbfdeea5f080c444a4d4abf6bdf81632bbab917a | IPython/core/tests/test_shellapp.py | IPython/core/tests/test_shellapp.py | # -*- coding: utf-8 -*-
"""Tests for shellapp module.
Authors
-------
* Bradley Froehle
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2012 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING... | Add test for `__file__` behavior in `ipython <file>` | Add test for `__file__` behavior in `ipython <file>`
| Python | bsd-3-clause | ipython/ipython,ipython/ipython | <REPLACE_OLD> <REPLACE_NEW> # -*- coding: utf-8 -*-
"""Tests for shellapp module.
Authors
-------
* Bradley Froehle
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2012 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full lice... | Add test for `__file__` behavior in `ipython <file>`
| |
c8afee155a27632f85891688c096d2fa2b6988e9 | ckanext/ckanext-apply_permissions_for_service/ckanext/apply_permissions_for_service/logic/auth.py | ckanext/ckanext-apply_permissions_for_service/ckanext/apply_permissions_for_service/logic/auth.py | from ckan.plugins import toolkit
from ckanext.apply_permissions_for_service import model
def service_permission_application_list(context, data_dict):
return {'success': True}
def service_permission_application_show(context, data_dict):
permission_application_id = toolkit.get_or_bust(data_dict, 'id')
ap... | from ckan.plugins import toolkit
from ckanext.apply_permissions_for_service import model
def service_permission_application_list(context, data_dict):
return {'success': True}
def service_permission_application_show(context, data_dict):
permission_application_id = toolkit.get_or_bust(data_dict, 'id')
ap... | Use generator instead of list. | Use generator instead of list.
Co-authored-by: Teemu Erkkola <ee6c9b9748887a4d25e9c1c5e0aff697ac55fd56@gofore.com> | Python | mit | vrk-kpa/api-catalog,vrk-kpa/api-catalog,vrk-kpa/api-catalog,vrk-kpa/api-catalog | <REPLACE_OLD> [org.get('id') <REPLACE_NEW> (org.get('id') <REPLACE_END> <REPLACE_OLD> membership_organizations]
<REPLACE_NEW> membership_organizations)
<REPLACE_END> <|endoftext|> from ckan.plugins import toolkit
from ckanext.apply_permissions_for_service import model
def service_permission_application_list(context... | Use generator instead of list.
Co-authored-by: Teemu Erkkola <ee6c9b9748887a4d25e9c1c5e0aff697ac55fd56@gofore.com>
from ckan.plugins import toolkit
from ckanext.apply_permissions_for_service import model
def service_permission_application_list(context, data_dict):
return {'success': True}
def service_permissio... |
49f5802a02a550cc8cee3be417426a83c31de5c9 | Source/Git/Experiments/git_log.py | Source/Git/Experiments/git_log.py | #!/usr/bin/python3
import sys
import git
r = git.Repo( sys.argv[1] )
def printTree( tree, indent=0 ):
prefix = ' '*indent
print( prefix, '-' * 16 )
print( prefix, 'Tree path %s' % (tree.path,) )
for blob in tree:
print( prefix, '%s %s (%s)' % (blob.type, blob.path, blob.hexsha) )
for chi... | #!/usr/bin/python3
import sys
import git
r = git.Repo( sys.argv[1] )
def printTree( tree, indent=0 ):
prefix = ' '*indent
print( prefix, '-' * 16 )
print( prefix, 'Tree path %s' % (tree.path,) )
for blob in tree:
print( prefix, '%s %s (%s)' % (blob.type, blob.path, blob.hexsha) )
for chi... | Exit the loop early when experimenting. | Exit the loop early when experimenting. | Python | apache-2.0 | barry-scott/scm-workbench,barry-scott/scm-workbench,barry-scott/scm-workbench | <REPLACE_OLD> )
<REPLACE_NEW> )
if index > 1:
break
<REPLACE_END> <|endoftext|> #!/usr/bin/python3
import sys
import git
r = git.Repo( sys.argv[1] )
def printTree( tree, indent=0 ):
prefix = ' '*indent
print( prefix, '-' * 16 )
print( prefix, 'Tree path %s' % (tree.path,) )
for blob in... | Exit the loop early when experimenting.
#!/usr/bin/python3
import sys
import git
r = git.Repo( sys.argv[1] )
def printTree( tree, indent=0 ):
prefix = ' '*indent
print( prefix, '-' * 16 )
print( prefix, 'Tree path %s' % (tree.path,) )
for blob in tree:
print( prefix, '%s %s (%s)' % (blob.type... |
c1ce60a964a1ef46b7d971fe91f007f3cf94d558 | setup.py | setup.py | #!/usr/bin/env python3
# encoding: utf-8
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(
name='autoprop',
version='0.0.0',
author='Kale Kundert',
author_email='kale@thekunderts.net',
long_description=open('README.rst').read(),
url='https://... | #!/usr/bin/env python3
# encoding: utf-8
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(
name='autoprop',
version='0.0.0',
author='Kale Kundert',
author_email='kale@thekunderts.net',
long_description=open('README.rst').read(),
url='https://... | Upgrade the development status to beta. | Upgrade the development status to beta.
| Python | mit | kalekundert/autoprop | <REPLACE_OLD> 2 <REPLACE_NEW> 4 <REPLACE_END> <REPLACE_OLD> Pre-Alpha',
<REPLACE_NEW> Beta',
<REPLACE_END> <REPLACE_OLD> 2',
<REPLACE_NEW> 2.6',
<REPLACE_END> <REPLACE_OLD> 3',
<REPLACE_NEW> 3.3',
<REPLACE_END> <|endoftext|> #!/usr/bin/env python3
# encoding: utf-8
try:
from setuptools import setup
except Im... | Upgrade the development status to beta.
#!/usr/bin/env python3
# encoding: utf-8
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(
name='autoprop',
version='0.0.0',
author='Kale Kundert',
author_email='kale@thekunderts.net',
long_description=ope... |
1d77b6645e28f1e614502f6bd9bb5458383ecdcf | jacquard/tests/test_config.py | jacquard/tests/test_config.py | import io
import sys
import tempfile
import textwrap
from jacquard.config import load_config
CONFIG_FILE = """
[storage]
engine = dummy
url = dummy
[directory]
engine = dummy
[test_section]
test_key = test_value
"""
def load_test_config(extra=''):
f = io.StringIO(CONFIG_FILE + textwrap.dedent(extra))
retu... | Add tests for config loading | Add tests for config loading
| Python | mit | prophile/jacquard,prophile/jacquard | <REPLACE_OLD> <REPLACE_NEW> import io
import sys
import tempfile
import textwrap
from jacquard.config import load_config
CONFIG_FILE = """
[storage]
engine = dummy
url = dummy
[directory]
engine = dummy
[test_section]
test_key = test_value
"""
def load_test_config(extra=''):
f = io.StringIO(CONFIG_FILE + tex... | Add tests for config loading
| |
48e14060eefd09976624e939eb924405a9b247e4 | chatterbot/__init__.py | chatterbot/__init__.py | """
ChatterBot is a machine learning, conversational dialog engine.
"""
from .chatterbot import ChatBot
__version__ = '0.5.1'
__author__ = 'Gunther Cox'
__email__ = 'gunthercx@gmail.com'
__url__ = 'https://github.com/gunthercox/ChatterBot'
| """
ChatterBot is a machine learning, conversational dialog engine.
"""
from .chatterbot import ChatBot
__version__ = '0.5.2'
__author__ = 'Gunther Cox'
__email__ = 'gunthercx@gmail.com'
__url__ = 'https://github.com/gunthercox/ChatterBot'
| Update release version to 0.5.2 | Update release version to 0.5.2
| Python | bsd-3-clause | Reinaesaya/OUIRL-ChatBot,maclogan/VirtualPenPal,Gustavo6046/ChatterBot,Reinaesaya/OUIRL-ChatBot,gunthercox/ChatterBot,davizucon/ChatterBot,vkosuri/ChatterBot | <REPLACE_OLD> '0.5.1'
__author__ <REPLACE_NEW> '0.5.2'
__author__ <REPLACE_END> <|endoftext|> """
ChatterBot is a machine learning, conversational dialog engine.
"""
from .chatterbot import ChatBot
__version__ = '0.5.2'
__author__ = 'Gunther Cox'
__email__ = 'gunthercx@gmail.com'
__url__ = 'https://github.com/guntherc... | Update release version to 0.5.2
"""
ChatterBot is a machine learning, conversational dialog engine.
"""
from .chatterbot import ChatBot
__version__ = '0.5.1'
__author__ = 'Gunther Cox'
__email__ = 'gunthercx@gmail.com'
__url__ = 'https://github.com/gunthercox/ChatterBot'
|
ffaac071ade9e1d05b12dec0d57b23b38c4975d7 | setup.py | setup.py | #!/usr/bin/env python
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
readme = open('README.rst').read()
history = open('HISTORY.rst').read().replace('.. :changelog:', '')
setup(
name='binaryornot',
version='0.4.0',
description=(
'Ultra-lightweight... | #!/usr/bin/env python
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
readme = open('README.rst').read()
history = open('HISTORY.rst').read().replace('.. :changelog:', '')
setup(
name='binaryornot',
version='0.4.0',
description=(
'Ultra-lightweight ... | Update trove classifier to Stable. Update my info. | Update trove classifier to Stable. Update my info.
| Python | bsd-3-clause | audreyr/binaryornot,audreyr/binaryornot,audreyr/binaryornot | <REPLACE_OLD> python
try:
<REPLACE_NEW> python
try:
<REPLACE_END> <REPLACE_OLD> Roy',
author_email='audreyr@gmail.com',
<REPLACE_NEW> Roy Greenfeld',
author_email='aroy@alum.mit.edu',
<REPLACE_END> <REPLACE_OLD> 4 <REPLACE_NEW> 5 <REPLACE_END> <REPLACE_OLD> Beta',
<REPLACE_NEW> Production/Stable',
<REP... | Update trove classifier to Stable. Update my info.
#!/usr/bin/env python
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
readme = open('README.rst').read()
history = open('HISTORY.rst').read().replace('.. :changelog:', '')
setup(
name='binaryornot',
version='... |
51f32076e8708c55420989b660323cdfd9fc6650 | cycy/interpreter.py | cycy/interpreter.py | from cycy import compiler
from cycy.parser.sourceparser import parse
class CyCy(object):
"""
The main CyCy interpreter.
"""
def run(self, bytecode):
pass
def interpret(source):
print "Hello, world!"
return
bytecode = compiler.Context.to_bytecode(parse(source.getContent()))
... | from cycy import compiler
from cycy.parser.sourceparser import parse
class CyCy(object):
"""
The main CyCy interpreter.
"""
def run(self, bytecode):
pass
def interpret(source):
bytecode = compiler.Context.to_bytecode(parse(source))
CyCy().run(bytecode)
| Break the tests to show us we're not writing RPython. | Break the tests to show us we're not writing RPython.
| Python | mit | Magnetic/cycy,Magnetic/cycy,Magnetic/cycy | <DELETE> print "Hello, world!"
return
<DELETE_END> <REPLACE_OLD> compiler.Context.to_bytecode(parse(source.getContent()))
<REPLACE_NEW> compiler.Context.to_bytecode(parse(source))
<REPLACE_END> <|endoftext|> from cycy import compiler
from cycy.parser.sourceparser import parse
class CyCy(object):
"""
... | Break the tests to show us we're not writing RPython.
from cycy import compiler
from cycy.parser.sourceparser import parse
class CyCy(object):
"""
The main CyCy interpreter.
"""
def run(self, bytecode):
pass
def interpret(source):
print "Hello, world!"
return
bytecode = compil... |
b6f3c619e8c3fa375ac9b66e7ce555c77f02f152 | pytest_raisesregexp/plugin.py | pytest_raisesregexp/plugin.py | import re
import py.code
import pytest
def pytest_namespace():
return {'raises_regexp': raises_regexp}
class raises_regexp(object):
def __init__(self, expected_exception, regexp):
self.exception = expected_exception
self.regexp = regexp
self.excinfo = None
def __enter__(self):
... | import re
import py.code
import pytest
def pytest_namespace():
return {'raises_regexp': raises_regexp}
class raises_regexp(object):
def __init__(self, expected_exception, regexp):
self.exception = expected_exception
self.regexp = regexp
self.excinfo = None
def __enter__(self):
... | Add originally raised exception value to pytest error message | Add originally raised exception value to pytest error message
| Python | mit | kissgyorgy/pytest-raisesregexp | <REPLACE_OLD> %s' <REPLACE_NEW> %s\n%s' <REPLACE_END> <REPLACE_OLD> self.exception))
<REPLACE_NEW> self.exception, repr(exc_val)))
<REPLACE_END> <|endoftext|> import re
import py.code
import pytest
def pytest_namespace():
return {'raises_regexp': raises_regexp}
class raises_regexp(object):
def __init__(... | Add originally raised exception value to pytest error message
import re
import py.code
import pytest
def pytest_namespace():
return {'raises_regexp': raises_regexp}
class raises_regexp(object):
def __init__(self, expected_exception, regexp):
self.exception = expected_exception
self.regexp =... |
e98134e112482cd6f3f01148994b331c9cb6f6ba | tests/__init__.py | tests/__init__.py | # -*- coding: utf-8 -*-
from flask import Flask
from flask_split import split
from redis import Redis
class TestCase(object):
def setup_method(self, method):
self.redis = Redis()
self.redis.flushall()
self.app = Flask(__name__)
self.app.debug = True
self.app.secret_key = '... | # -*- coding: utf-8 -*-
from flask import Flask
from flask_split import split
from flask_split.core import _get_redis_connection
class TestCase(object):
def setup_method(self, method):
self.app = Flask(__name__)
self.app.debug = True
self.app.secret_key = 'very secret'
self.app.re... | Fix redis initialization in tests | Fix redis initialization in tests
| Python | mit | jpvanhal/flask-split,jpvanhal/flask-split,jpvanhal/flask-split | <REPLACE_OLD> redis <REPLACE_NEW> flask_split.core <REPLACE_END> <REPLACE_OLD> Redis
class <REPLACE_NEW> _get_redis_connection
class <REPLACE_END> <DELETE> self.redis = Redis()
self.redis.flushall()
<DELETE_END> <INSERT> self.redis = _get_redis_connection()
self.redis.flushall()
<INS... | Fix redis initialization in tests
# -*- coding: utf-8 -*-
from flask import Flask
from flask_split import split
from redis import Redis
class TestCase(object):
def setup_method(self, method):
self.redis = Redis()
self.redis.flushall()
self.app = Flask(__name__)
self.app.debug = T... |
a472cf675ee91b7f0506fd7f958ebe0225e052e7 | setup.py | setup.py | # -*- coding: utf-8 -*-
import os
from setuptools import setup
def read(fname):
try:
return open(os.path.join(os.path.dirname(__file__), fname)).read()
except:
return ''
setup(
name='todoist-python',
version='7.0.13',
packages=['todoist', 'todoist.managers'],
author='Doist Team... | # -*- coding: utf-8 -*-
import os
from setuptools import setup
def read(fname):
try:
return open(os.path.join(os.path.dirname(__file__), fname)).read()
except:
return ''
setup(
name='todoist-python',
version='7.0.14',
packages=['todoist', 'todoist.managers'],
author='Doist Team... | Update the PyPI version to 7.0.14. | Update the PyPI version to 7.0.14.
| Python | mit | Doist/todoist-python | <REPLACE_OLD> version='7.0.13',
<REPLACE_NEW> version='7.0.14',
<REPLACE_END> <|endoftext|> # -*- coding: utf-8 -*-
import os
from setuptools import setup
def read(fname):
try:
return open(os.path.join(os.path.dirname(__file__), fname)).read()
except:
return ''
setup(
name='todoist-pytho... | Update the PyPI version to 7.0.14.
# -*- coding: utf-8 -*-
import os
from setuptools import setup
def read(fname):
try:
return open(os.path.join(os.path.dirname(__file__), fname)).read()
except:
return ''
setup(
name='todoist-python',
version='7.0.13',
packages=['todoist', 'todois... |
eac89e401d64079f4a3ef05ce7078cbefea271df | tests/system/shared/mainwin.py | tests/system/shared/mainwin.py |
def invokeMenuItem(menu, item):
menuObject = waitForObjectItem("{type='QMenuBar' visible='true'}", menu)
activateItem(menuObject)
activateItem(waitForObjectItem(menuObject, item))
def openQmakeProject(projectPath):
invokeMenuItem("File", "Open File or Project...")
waitForObject("{name='QFileDialog... |
def invokeMenuItem(menu, item):
menuObject = waitForObjectItem("{type='QMenuBar' visible='true'}", menu)
activateItem(menuObject)
activateItem(waitForObjectItem(menuObject, item))
def openQmakeProject(projectPath):
invokeMenuItem("File", "Open File or Project...")
waitForObject("{name='QFileDialog... | Fix openQmakeProject to match new combo value. | Fix openQmakeProject to match new combo value.
Change-Id: Ice0050bf1bb7af59eb57c1e9218d96b3114f4c08
Reviewed-on: http://codereview.qt.nokia.com/4129
Reviewed-by: Qt Sanity Bot <5581206bb7e0307f0d99eb71898ae6b694149ca5@ovi.com>
Reviewed-by: Christian Stenger <accbb51712d7b9c4fb108439d01e716148e5f9e6@nokia.com>
| Python | lgpl-2.1 | omniacreator/qtcreator,xianian/qt-creator,bakaiadam/collaborative_qt_creator,amyvmiwei/qt-creator,KDAB/KDAB-Creator,maui-packages/qt-creator,KDE/android-qt-creator,xianian/qt-creator,colede/qtcreator,darksylinc/qt-creator,Distrotech/qtcreator,azat/qtcreator,xianian/qt-creator,malikcjm/qtcreator,kuba1/qtcreator,kuba1/qt... | <REPLACE_OLD> "per <REPLACE_NEW> "For Each <REPLACE_END> <REPLACE_OLD> a <REPLACE_NEW> One <REPLACE_END> <REPLACE_OLD> and <REPLACE_NEW> And One <REPLACE_END> <|endoftext|>
def invokeMenuItem(menu, item):
menuObject = waitForObjectItem("{type='QMenuBar' visible='true'}", menu)
activateItem(menuObject)
acti... | Fix openQmakeProject to match new combo value.
Change-Id: Ice0050bf1bb7af59eb57c1e9218d96b3114f4c08
Reviewed-on: http://codereview.qt.nokia.com/4129
Reviewed-by: Qt Sanity Bot <5581206bb7e0307f0d99eb71898ae6b694149ca5@ovi.com>
Reviewed-by: Christian Stenger <accbb51712d7b9c4fb108439d01e716148e5f9e6@nokia.com>
def in... |
f9f9111ddafb7dfd0554d541befd3cc660169689 | apps/redirects/urls.py | apps/redirects/urls.py | from django.conf.urls.defaults import *
from util import redirect
urlpatterns = patterns('',
redirect(r'^b2g', 'firefoxos'),
redirect(r'^b2g/faq', 'firefoxos'),
redirect(r'^b2g/about', 'firefoxos'),
)
| from django.conf.urls.defaults import *
from util import redirect
urlpatterns = patterns('',
redirect(r'^b2g', 'firefoxos.firefoxos'),
redirect(r'^b2g/faq', 'firefoxos.firefoxos'),
redirect(r'^b2g/about', 'firefoxos.firefoxos'),
)
| Fix view name for b2g redirects | Fix view name for b2g redirects
bug 792482
| Python | mpl-2.0 | dudepare/bedrock,rishiloyola/bedrock,mahinthjoe/bedrock,ckprice/bedrock,davehunt/bedrock,davidwboswell/documentation_autoresponse,jpetto/bedrock,dudepare/bedrock,glogiotatidis/bedrock,kyoshino/bedrock,mahinthjoe/bedrock,MichaelKohler/bedrock,ckprice/bedrock,analytics-pros/mozilla-bedrock,analytics-pros/mozilla-bedrock,... | <REPLACE_OLD> 'firefoxos'),
<REPLACE_NEW> 'firefoxos.firefoxos'),
<REPLACE_END> <REPLACE_OLD> 'firefoxos'),
<REPLACE_NEW> 'firefoxos.firefoxos'),
<REPLACE_END> <REPLACE_OLD> 'firefoxos'),
<REPLACE_NEW> 'firefoxos.firefoxos'),
<REPLACE_END> <|endoftext|> from django.conf.urls.defaults import *
from util impo... | Fix view name for b2g redirects
bug 792482
from django.conf.urls.defaults import *
from util import redirect
urlpatterns = patterns('',
redirect(r'^b2g', 'firefoxos'),
redirect(r'^b2g/faq', 'firefoxos'),
redirect(r'^b2g/about', 'firefoxos'),
)
|
0a47c0b259dba0634e1287515c339e9a1e0306ae | folia2kaf.py | folia2kaf.py | """Create KAF file based on FoLiA file
Usage: python kaf2folia.py <file in>
"""
from pynlpl.formats import folia
from lxml import etree
# Load document
doc = folia.Document(file='medea-folia-no_events.xml')
# output document
root = etree.Element('KAF')
kaf_document = etree.ElementTree(root)
text = etree.SubElement(ro... | Add script to transform folia into kaf | Add script to transform folia into kaf
Added the first version of the script to transform folia xml into kaf.
The script is not finished, because it is still unknown what the folia
files will exactly look like.
| Python | apache-2.0 | NLeSC/embodied-emotions-scripts,NLeSC/embodied-emotions-scripts | <INSERT> """Create KAF file based on FoLiA file
Usage: python kaf2folia.py <file in>
"""
from pynlpl.formats import folia
from lxml import etree
# Load document
doc = folia.Document(file='medea-folia-no_events.xml')
# output document
root = etree.Element('KAF')
kaf_document = etree.ElementTree(root)
text = etree.SubE... | Add script to transform folia into kaf
Added the first version of the script to transform folia xml into kaf.
The script is not finished, because it is still unknown what the folia
files will exactly look like.
| |
980492cb76d0d72a005269a4fb9c1ec9767c10de | symfit/api.py | symfit/api.py | # Overwrite behavior of sympy objects to make more sense for this project.
import symfit.core.operators
# Expose useful objects.
from symfit.core.fit import (
Fit, Model, Constraint, ODEModel, ModelError, CallableModel,
CallableNumericalModel, GradientModel
)
from symfit.core.fit_results import FitResults
from... | # Overwrite behavior of sympy objects to make more sense for this project.
import symfit.core.operators
# Expose useful objects.
from symfit.core.fit import (
Fit, Model, ODEModel, ModelError, CallableModel,
CallableNumericalModel, GradientModel
)
from symfit.core.fit_results import FitResults
from symfit.core... | Remove Constraint objects from the API | Remove Constraint objects from the API
| Python | mit | tBuLi/symfit | <DELETE> Constraint, <DELETE_END> <|endoftext|> # Overwrite behavior of sympy objects to make more sense for this project.
import symfit.core.operators
# Expose useful objects.
from symfit.core.fit import (
Fit, Model, ODEModel, ModelError, CallableModel,
CallableNumericalModel, GradientModel
)
from symfit.cor... | Remove Constraint objects from the API
# Overwrite behavior of sympy objects to make more sense for this project.
import symfit.core.operators
# Expose useful objects.
from symfit.core.fit import (
Fit, Model, Constraint, ODEModel, ModelError, CallableModel,
CallableNumericalModel, GradientModel
)
from symfit... |
84b01f0015163dc016293162f1525be76329e602 | pythonforandroid/recipes/cryptography/__init__.py | pythonforandroid/recipes/cryptography/__init__.py | from pythonforandroid.recipe import CompiledComponentsPythonRecipe, Recipe
class CryptographyRecipe(CompiledComponentsPythonRecipe):
name = 'cryptography'
version = '2.4.2'
url = 'https://github.com/pyca/cryptography/archive/{version}.tar.gz'
depends = ['openssl', 'idna', 'asn1crypto', 'six', 'setupto... | from pythonforandroid.recipe import CompiledComponentsPythonRecipe, Recipe
class CryptographyRecipe(CompiledComponentsPythonRecipe):
name = 'cryptography'
version = '2.4.2'
url = 'https://github.com/pyca/cryptography/archive/{version}.tar.gz'
depends = ['openssl', 'idna', 'asn1crypto', 'six', 'setupto... | Move libraries from LDFLAGS to LIBS for cryptography recipe | Move libraries from LDFLAGS to LIBS for cryptography recipe
Because this is how you are supposed to do it, you must use LDFLAGS for linker flags and LDLIBS (or the equivalent LOADLIBES) for the libraries
| Python | mit | kronenpj/python-for-android,rnixx/python-for-android,PKRoma/python-for-android,germn/python-for-android,PKRoma/python-for-android,kronenpj/python-for-android,rnixx/python-for-android,germn/python-for-android,rnixx/python-for-android,kivy/python-for-android,PKRoma/python-for-android,rnixx/python-for-android,germn/python... | <REPLACE_OLD> openssl_recipe.link_flags(arch)
<REPLACE_NEW> openssl_recipe.link_dirs_flags(arch)
env['LIBS'] = openssl_recipe.link_libs_flags()
<REPLACE_END> <|endoftext|> from pythonforandroid.recipe import CompiledComponentsPythonRecipe, Recipe
class CryptographyRecipe(CompiledComponentsPythonRecipe):
... | Move libraries from LDFLAGS to LIBS for cryptography recipe
Because this is how you are supposed to do it, you must use LDFLAGS for linker flags and LDLIBS (or the equivalent LOADLIBES) for the libraries
from pythonforandroid.recipe import CompiledComponentsPythonRecipe, Recipe
class CryptographyRecipe(CompiledComp... |
600992d9bb3f357bdef8769a61b4829be8952573 | blazar/api/context.py | blazar/api/context.py | # Copyright (c) 2013 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | # Copyright (c) 2013 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Fix map issues with Python3 | Fix map issues with Python3
Partially implements: blueprint python-3
Change-Id: Ia7dfc2a28c311a378ca5ada477d18a5b741782b2
| Python | apache-2.0 | stackforge/blazar,openstack/blazar,ChameleonCloud/blazar,ChameleonCloud/blazar,stackforge/blazar,openstack/blazar | <REPLACE_OLD> roles=map(six.text_type.strip, headers['X-Roles'].split(',')),
<REPLACE_NEW> roles=list(map(six.text_type.strip, headers['X-Roles'].split(','))),
<REPLACE_END> <|endoftext|> # Copyright (c) 2013 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file... | Fix map issues with Python3
Partially implements: blueprint python-3
Change-Id: Ia7dfc2a28c311a378ca5ada477d18a5b741782b2
# Copyright (c) 2013 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy o... |
7f9c9b947948654d7557aa0fcfbb1c015521da9b | tests/modular_templates/routing.py | tests/modular_templates/routing.py | import unittest
from framework.routing import Rule
class RuleTestCase(unittest.TestCase):
def _make_rule(self, **kwargs):
def vf():
return {}
return Rule(
kwargs.get('routes', ['/', ]),
kwargs.get('methods', ['GET', ]),
kwargs.get('view_func', vf),... | import unittest
from framework.routing import Rule, json_renderer
class RuleTestCase(unittest.TestCase):
def _make_rule(self, **kwargs):
def vf():
return {}
return Rule(
kwargs.get('routes', ['/', ]),
kwargs.get('methods', ['GET', ]),
kwargs.get('v... | Fix RuleTestCase -> tests passing | Fix RuleTestCase -> tests passing
| Python | apache-2.0 | caneruguz/osf.io,brandonPurvis/osf.io,rdhyee/osf.io,KAsante95/osf.io,pattisdr/osf.io,KAsante95/osf.io,barbour-em/osf.io,HarryRybacki/osf.io,mluke93/osf.io,aaxelb/osf.io,jinluyuan/osf.io,ZobairAlijan/osf.io,wearpants/osf.io,sbt9uc/osf.io,ticklemepierce/osf.io,jnayak1/osf.io,caseyrygt/osf.io,kwierman/osf.io,adlius/osf.io... | <REPLACE_OLD> Rule
class <REPLACE_NEW> Rule, json_renderer
class <REPLACE_END> <REPLACE_OLD> kwargs.get('render_func'),
<REPLACE_NEW> kwargs.get('render_func', json_renderer),
<REPLACE_END> <REPLACE_OLD> self.assertTrue(callable(r.view_func)) <REPLACE_NEW> self.assertTrue(callable(r.view_func))
<REPLACE_END> <|e... | Fix RuleTestCase -> tests passing
import unittest
from framework.routing import Rule
class RuleTestCase(unittest.TestCase):
def _make_rule(self, **kwargs):
def vf():
return {}
return Rule(
kwargs.get('routes', ['/', ]),
kwargs.get('methods', ['GET', ]),
... |
2c696d7182bf6f857842e2ae95efa5eaa4fb2594 | setup.py | setup.py | from distutils.core import Extension, setup
from Cython.Build import cythonize
extensions = [
Extension('*', ['mathix/*.pyx']),
]
setup(
name='mathix',
author='Peith Vergil',
version='0.1',
ext_modules=cythonize(extensions)
)
| from distutils.core import Extension, setup
from Cython.Build import cythonize
try:
from Cython.Distutils import build_ext
except ImportError:
use_cython = False
else:
use_cython = True
if use_cython:
extensions = [
Extension('mathix.vector', ['mathix/vector.pyx']),
]
cmdclass = {
... | Add more classifiers. Check if Cython compilation is available or not. | Add more classifiers. Check if Cython compilation is available or not.
| Python | mit | PeithVergil/cython-example | <REPLACE_OLD> cythonize
extensions <REPLACE_NEW> cythonize
try:
from Cython.Distutils import build_ext
except ImportError:
use_cython = False
else:
use_cython = True
if use_cython:
extensions <REPLACE_END> <REPLACE_OLD> Extension('*', ['mathix/*.pyx']),
]
setup(
<REPLACE_NEW> Extension('math... | Add more classifiers. Check if Cython compilation is available or not.
from distutils.core import Extension, setup
from Cython.Build import cythonize
extensions = [
Extension('*', ['mathix/*.pyx']),
]
setup(
name='mathix',
author='Peith Vergil',
version='0.1',
ext_modules=cythonize(extensio... |
3c1203d5f4665873e34de9600c6cf18cbd7f7611 | moa/tools.py | moa/tools.py |
__all__ = ('to_bool', 'ConfigPropertyList')
from kivy.properties import ConfigParserProperty
from re import compile, split
from functools import partial
to_list_pat = compile(', *')
def to_bool(val):
'''
Takes anything and converts it to a bool type.
'''
if val == 'False':
return False
... |
__all__ = ('to_bool', 'ConfigPropertyList')
from kivy.properties import ConfigParserProperty
from re import compile, split
to_list_pat = compile('(?:, *)?\\n?')
def to_bool(val):
'''
Takes anything and converts it to a bool type.
'''
if val == 'False':
return False
return not not val
... | Add 2d list to ConfigProperty. | Add 2d list to ConfigProperty.
| Python | mit | matham/moa | <REPLACE_OLD> split
from functools import partial
to_list_pat = compile(', *')
def <REPLACE_NEW> split
to_list_pat = compile('(?:, *)?\\n?')
def <REPLACE_END> <INSERT> inner_list=False,
<INSERT_END> <INSERT> ''' Accepts either a list of a string. Nothing else.
'''
<INSERT_END> <REPL... | Add 2d list to ConfigProperty.
__all__ = ('to_bool', 'ConfigPropertyList')
from kivy.properties import ConfigParserProperty
from re import compile, split
from functools import partial
to_list_pat = compile(', *')
def to_bool(val):
'''
Takes anything and converts it to a bool type.
'''
if val == 'F... |
00fc7eff1f9c1d1ddcc61210c1a80f966e085d1f | course_discovery/apps/course_metadata/migrations/0191_add_microbachelors_program_type.py | course_discovery/apps/course_metadata/migrations/0191_add_microbachelors_program_type.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-07-26 18:14
from __future__ import unicode_literals
from django.db import migrations
SEAT_TYPES = ('audit', 'verified',)
PROGRAM_TYPES = ('MicroBachelors',)
def add_program_types(apps, schema_editor): # pylint: disable=unused-argument
SeatType = app... | Add MicroBachelors program_type Co-authored-by: Lise <albemarle> | MICROB-3: Add MicroBachelors program_type
Co-authored-by: Lise <albemarle>
| Python | agpl-3.0 | edx/course-discovery,edx/course-discovery,edx/course-discovery,edx/course-discovery | <INSERT> # -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-07-26 18:14
from __future__ import unicode_literals
from django.db import migrations
SEAT_TYPES = ('audit', 'verified',)
PROGRAM_TYPES = ('MicroBachelors',)
def add_program_types(apps, schema_editor): <INSERT_END> <INSERT> # pylint: disable=unus... | MICROB-3: Add MicroBachelors program_type
Co-authored-by: Lise <albemarle>
| |
3e25a1b44743bbf7d0bf1205cebe5bfb6a693fef | delete_whois.py | delete_whois.py | #!/usr/bin/env python
import os
import sys
import time
import getpass
import datetime
from common.appenginepatch.aecmd import setup_env
setup_env()
import ADNS
from adns import rr
from google.appengine.ext import db
from google.appengine.ext.remote_api import remote_api_stub
from google.appengine.api.datastore_erro... | Delete obsolete Whois model from the datastore. | Delete obsolete Whois model from the datastore.
| Python | mit | jcrocholl/nxdom,jcrocholl/nxdom | <REPLACE_OLD> <REPLACE_NEW> #!/usr/bin/env python
import os
import sys
import time
import getpass
import datetime
from common.appenginepatch.aecmd import setup_env
setup_env()
import ADNS
from adns import rr
from google.appengine.ext import db
from google.appengine.ext.remote_api import remote_api_stub
from google... | Delete obsolete Whois model from the datastore.
| |
745c03d3cc5ae31fb852ba7bfc9d0ad6a9ac4716 | unittests.py | unittests.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import const
import uniformdh
import obfsproxy.network.buffer as obfs_buf
class UniformDHTest( unittest.TestCase ):
def setUp( self ):
weAreServer = True
self.udh = uniformdh.new("A" * const.SHARED_SECRET_LENGTH, weAreServer)
de... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import const
import uniformdh
import obfsproxy.network.buffer as obfs_buf
class UniformDHTest( unittest.TestCase ):
def setUp( self ):
weAreServer = True
self.udh = uniformdh.new("A" * const.SHARED_SECRET_LENGTH, weAreServer)
de... | Add UniformDH unit test to test for invalid HMACs. | Add UniformDH unit test to test for invalid HMACs.
| Python | bsd-3-clause | isislovecruft/scramblesuit,isislovecruft/scramblesuit | <REPLACE_OLD> const.PUBLIC_KEY_LENGTH)
if <REPLACE_NEW> const.PUBLIC_KEY_LENGTH)
def test3_invalidHMAC( self ):
# Make the HMAC invalid.
handshake = self.udh.createHandshake()
if handshake[-1] != 'a':
handshake = handshake[:-1] + 'a'
else:
handshake = handsh... | Add UniformDH unit test to test for invalid HMACs.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import const
import uniformdh
import obfsproxy.network.buffer as obfs_buf
class UniformDHTest( unittest.TestCase ):
def setUp( self ):
weAreServer = True
self.udh = uniformdh.new("A... |
d38d26d1d613ba9550bb247eaed8af62bbd99d16 | setup.py | setup.py | import subprocess
import sys
from distutils.core import setup, Command
class TestCommand(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
errno = subprocess.call([sys.executable, 'test_facebook.py'])
raise... | import subprocess
import sys
from distutils.core import setup, Command
class TestCommand(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
errno = subprocess.call([sys.executable, 'test_facebook.py'])
raise... | Add method for adding users to a custom audience. | Add method for adding users to a custom audience.
| Python | mit | GallopLabs/facebook-ads-api,narrowcast/facebook-ads-api,taenyon/facebook-ads-api | <REPLACE_OLD> version='0.1.40',
<REPLACE_NEW> version='0.1.41',
<REPLACE_END> <|endoftext|> import subprocess
import sys
from distutils.core import setup, Command
class TestCommand(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def ... | Add method for adding users to a custom audience.
import subprocess
import sys
from distutils.core import setup, Command
class TestCommand(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
errno = subprocess.call(... |
333afea8d8a548948f24745490c700c98500e22f | mlab-ns-simulator/mlabsim/lookup.py | mlab-ns-simulator/mlabsim/lookup.py | """
This simulates the mlab-ns lookup request, whose code lives here:
https://code.google.com/p/m-lab/source/browse/server/mlabns/handlers/lookup.py?repo=ns
The difference in this module is that we don't support features which
ooni-support does not use and we augment features which ooni-support
would rely on if mlab-... | """
This simulates the mlab-ns lookup request, whose code lives here:
https://code.google.com/p/m-lab/source/browse/server/mlabns/handlers/lookup.py?repo=ns
The difference in this module is that we don't support features which
ooni-support does not use and we augment features which ooni-support
would rely on if mlab-... | Implement the current ``GET /ooni`` api. | Implement the current ``GET /ooni`` api.
| Python | apache-2.0 | hellais/ooni-support,m-lab/ooni-support,m-lab/ooni-support,hellais/ooni-support | <REPLACE_OLD> appengine.
"""
from <REPLACE_NEW> appengine.
"""
import json
from <REPLACE_END> <REPLACE_OLD> # FIXME - db <REPLACE_NEW> """db <REPLACE_END> <REPLACE_OLD> some simple memory structure holding info;
# the details will solidfy soon. This resource reads from
# this structure.
<REPLACE_... | Implement the current ``GET /ooni`` api.
"""
This simulates the mlab-ns lookup request, whose code lives here:
https://code.google.com/p/m-lab/source/browse/server/mlabns/handlers/lookup.py?repo=ns
The difference in this module is that we don't support features which
ooni-support does not use and we augment features... |
7217e2dcbec3e13d730e47e001d00c5fb8534468 | moa/__init__.py | moa/__init__.py | '''A framework for designing and running experiments in Python using Kivy.
'''
__version__ = '0.1-dev'
from kivy import kivy_home_dir
from os import environ
from os.path import join
from moa.logger import Logger
#: moa configuration filename
moa_config_fn = ''
if not environ.get('MOA_DOC_INCLUDE'):
moa_config_... | '''A framework for designing and running experiments in Python using Kivy.
'''
__version__ = '0.1-dev'
from kivy import kivy_home_dir
from os import environ
from os.path import join
if 'MOA_CLOCK' in environ:
from moa.clock import set_clock
set_clock(clock='moa')
from moa.logger import Logger
#: moa confi... | Add config option to start moa clock. | Add config option to start moa clock.
| Python | mit | matham/moa | <REPLACE_OLD> join
from <REPLACE_NEW> join
if 'MOA_CLOCK' in environ:
from moa.clock import set_clock
set_clock(clock='moa')
from <REPLACE_END> <|endoftext|> '''A framework for designing and running experiments in Python using Kivy.
'''
__version__ = '0.1-dev'
from kivy import kivy_home_dir
from os import e... | Add config option to start moa clock.
'''A framework for designing and running experiments in Python using Kivy.
'''
__version__ = '0.1-dev'
from kivy import kivy_home_dir
from os import environ
from os.path import join
from moa.logger import Logger
#: moa configuration filename
moa_config_fn = ''
if not environ.... |
82826f468186b737d63dffb2c79cfeff5a8d47a0 | examples/python3-urllib/run.py | examples/python3-urllib/run.py | import sys
import ssl
import urllib.error
import urllib.request
host = sys.argv[1]
port = sys.argv[2]
cafile = sys.argv[3] if len(sys.argv) > 3 else None
try:
urllib.request.urlopen("https://" + host + ":" + port, cafile=cafile)
except urllib.error.URLError as exc:
if not isinstance(exc.reason, ssl.SSLError):... | Add a Python3 + urllib example | Add a Python3 + urllib example
| Python | mit | ouspg/trytls,ouspg/trytls,ouspg/trytls,ouspg/trytls,ouspg/trytls,ouspg/trytls,ouspg/trytls,ouspg/trytls | <INSERT> import sys
import ssl
import urllib.error
import urllib.request
host = sys.argv[1]
port = sys.argv[2]
cafile = sys.argv[3] if len(sys.argv) > 3 else None
try:
<INSERT_END> <INSERT> urllib.request.urlopen("https://" + host + ":" + port, cafile=cafile)
except urllib.error.URLError as exc:
if not isinsta... | Add a Python3 + urllib example
| |
9a74f11d4adfafbddec2e86251ecef17c4196bf2 | tests/test_suite.py | tests/test_suite.py | #! /usr/bin/env python
from __future__ import absolute_import
import unittest
from . import unittest_neos
from . import unittest_sedumi_writer
def main():
""" The main function.
"""
loader = unittest.TestLoader()
suite = unittest.TestSuite()
suite.addTest(loader.loadTestsFromModule(unittest_neos... | #! /usr/bin/env python
""" Test suite.
"""
from __future__ import absolute_import
import sys
import unittest
from . import unittest_neos
from . import unittest_sedumi_writer
def main():
""" The main function.
Returns:
True if all tests are successful.
"""
loader = unittest.TestLoader()
sui... | Fix a bug to return error status code when tests are failed. | Fix a bug to return error status code when tests are failed.
| Python | mit | TrishGillett/pysdpt3glue,discardthree/PySDPT3glue,TrishGillett/pysdpt3glue,discardthree/PySDPT3glue,TrishGillett/pysdpt3glue | <REPLACE_OLD> python
from <REPLACE_NEW> python
""" Test suite.
"""
from <REPLACE_END> <INSERT> sys
import <INSERT_END> <REPLACE_OLD> function.
<REPLACE_NEW> function.
Returns:
True if all tests are successful.
<REPLACE_END> <REPLACE_OLD> unittest.TextTestRunner(verbosity=2).run(suite)
if <REPLACE_NEW> re... | Fix a bug to return error status code when tests are failed.
#! /usr/bin/env python
from __future__ import absolute_import
import unittest
from . import unittest_neos
from . import unittest_sedumi_writer
def main():
""" The main function.
"""
loader = unittest.TestLoader()
suite = unittest.TestSuite... |
4a1021ba1ad18cfcdb664c84c0ef5f0ef0aa6eae | madcore/libs/timeouts.py | madcore/libs/timeouts.py | # all the values are in seconds
ENDPOINT_UP_TIMEOUT = 60 * 10
MADCORE_UP_TIMEOUT = 60 * 60
DNS_RESOLVE_TIMEOUT = 60 * 30
DNS_UPDATE_TIMEOUT = 60 * 10
DOMAIN_HAS_SSL_CERTIFICATE_TIMEOUT = 60
| # all the values are in seconds
ENDPOINT_UP_TIMEOUT = 60 * 20
MADCORE_UP_TIMEOUT = 60 * 60
DNS_RESOLVE_TIMEOUT = 60 * 30
DNS_UPDATE_TIMEOUT = 60 * 10
DOMAIN_HAS_SSL_CERTIFICATE_TIMEOUT = 60
| Increase timeout for endpoint up | Increase timeout for endpoint up
| Python | mit | madcore-ai/cli,madcore-ai/cli | <REPLACE_OLD> 10
MADCORE_UP_TIMEOUT <REPLACE_NEW> 20
MADCORE_UP_TIMEOUT <REPLACE_END> <|endoftext|> # all the values are in seconds
ENDPOINT_UP_TIMEOUT = 60 * 20
MADCORE_UP_TIMEOUT = 60 * 60
DNS_RESOLVE_TIMEOUT = 60 * 30
DNS_UPDATE_TIMEOUT = 60 * 10
DOMAIN_HAS_SSL_CERTIFICATE_TIMEOUT = 60
| Increase timeout for endpoint up
# all the values are in seconds
ENDPOINT_UP_TIMEOUT = 60 * 10
MADCORE_UP_TIMEOUT = 60 * 60
DNS_RESOLVE_TIMEOUT = 60 * 30
DNS_UPDATE_TIMEOUT = 60 * 10
DOMAIN_HAS_SSL_CERTIFICATE_TIMEOUT = 60
|
cb5f74d83f1ed5d655823b87d25ff031e9cb4bc8 | test/test_utils.py | test/test_utils.py | import unittest
from LinkMeBot.utils import get_text_from_markdown, human_readable_download_number
class TestUtils(unittest.TestCase):
def test_get_text_from_markdown(self):
markdown = '**test** [^this](https://google.com) ~~is~~ _a_ test! https://google.com'
text = 'test this is a test!'
... | import unittest
from LinkMeBot.utils import get_text_from_markdown, human_readable_download_number
class TestUtils(unittest.TestCase):
def test_get_text_from_markdown(self):
markdown = '**test** [^this](https://google.com) ~~is~~ _a_ test! https://google.com'
text = 'test this is a test!'
... | Fix tests for human readable numbers | Fix tests for human readable numbers
| Python | mit | crisbal/PlayStoreLinks_Bot | <REPLACE_OLD> Thousand')
<REPLACE_NEW> thousand')
<REPLACE_END> <REPLACE_OLD> Million')
<REPLACE_NEW> million')
<REPLACE_END> <REPLACE_OLD> Million') <REPLACE_NEW> million') <REPLACE_END> <|endoftext|> import unittest
from LinkMeBot.utils import get_text_from_markdown, human_readable_download_number
class TestUti... | Fix tests for human readable numbers
import unittest
from LinkMeBot.utils import get_text_from_markdown, human_readable_download_number
class TestUtils(unittest.TestCase):
def test_get_text_from_markdown(self):
markdown = '**test** [^this](https://google.com) ~~is~~ _a_ test! https://google.com'
... |
7e7bd440a1e3f585464df3458070528d0100d456 | pyseidon/handlers/__init__.py | pyseidon/handlers/__init__.py | import pyseidon
import sys
def handle_script():
import runpy
"""
Allow the client to run an arbitrary Python script.
Here's sample usage:
```
def expensive_setup():
...
if __name__ == '__main__':
expensive_setup()
import pyseidon.handlers
pyseidon.handlers.handle_script()
```
"""
def handler():... | Add helper to run requested Python script | Add helper to run requested Python script
| Python | mit | gdb/pyseidon,gdb/pyseidon | <INSERT> import pyseidon
import sys
def handle_script():
<INSERT_END> <INSERT> import runpy
"""
Allow the client to run an arbitrary Python script.
Here's sample usage:
```
def expensive_setup():
...
if __name__ == '__main__':
expensive_setup()
import pyseidon.handlers
pyseidon.handlers.handle_scrip... | Add helper to run requested Python script
| |
d5b326d8d368d2ac75c6e078572df8c28704c163 | vcs/models.py | vcs/models.py | from django.db import models
class Activity(models.Model):
group = models.CharField(max_length=4)
grouptype = models.TextField()
groupdetail = models.TextField()
details = models.TextField()
disabled = models.BooleanField()
time = models.DecimalField(decimal_places=2, max_digits=10)
unique_... | from django.db import models
class Activity(models.Model):
group = models.CharField(max_length=4)
grouptype = models.TextField()
groupdetail = models.TextField()
details = models.TextField()
disabled = models.BooleanField()
time = models.DecimalField(decimal_places=2, max_digits=10)
unique_... | Use the app string version of foreign keying. It prevents a circular import. | Use the app string version of foreign keying. It prevents a circular import.
| Python | bsd-3-clause | AeroNotix/django-timetracker,AeroNotix/django-timetracker,AeroNotix/django-timetracker | <DELETE> from timetracker.tracker.models import Tbluser
<DELETE_END> <REPLACE_OLD> Tbluser,
<REPLACE_NEW> 'tracker.Tbluser',
<REPLACE_END> <|endoftext|> from django.db import models
class Activity(models.Model):
group = models.CharField(max_length=4)
grouptype = models.TextField()
groupdetail = model... | Use the app string version of foreign keying. It prevents a circular import.
from django.db import models
class Activity(models.Model):
group = models.CharField(max_length=4)
grouptype = models.TextField()
groupdetail = models.TextField()
details = models.TextField()
disabled = models.BooleanField... |
e7c6a1d5ca6c6ebd85976698e8c00ca761747b59 | apps/simple_compiler.py | apps/simple_compiler.py | from apps.decorators import on_command
from apps.slackutils import cat_token
from subprocess import check_output, CalledProcessError, STDOUT
import os
import re
@on_command(['!컴파일'])
def run(robot, channel, tokens, user, command):
'''C, C++, Python 소스 실행시켜드림'''
msg = ''
if len(tokens) < 2:
return ... | ADD FEATURE : simple C/C++ compiler | ADD FEATURE : simple C/C++ compiler
| Python | mit | dgu-dna/DNA-Bot | <REPLACE_OLD> <REPLACE_NEW> from apps.decorators import on_command
from apps.slackutils import cat_token
from subprocess import check_output, CalledProcessError, STDOUT
import os
import re
@on_command(['!컴파일'])
def run(robot, channel, tokens, user, command):
'''C, C++, Python 소스 실행시켜드림'''
msg = ''
if len... | ADD FEATURE : simple C/C++ compiler
| |
8732b76c56b25d77e7972706f3a335acf3986f14 | pod_manager/utils.py | pod_manager/utils.py | import logging
__all__ = [
'get_logger'
]
def get_logger(name):
logger = logging.getLogger(name)
# TODO: set level, add handler
return logger
| import sys
import logging
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver as get_libcloud_driver
from pod_manager.settings import LOG_LEVEL, LOG_FORMAT
from pod_manager.settings import PROVIDER, PROVIDER_CREDENTIALS, PROVIDER_KWARGS
__all__ = [
'get_logger',
'get... | Modify get_logger to set level and formatter, add get_driver method. | Modify get_logger to set level and formatter, add get_driver method.
| Python | apache-2.0 | racker/pod-manager | <REPLACE_OLD> logging
__all__ <REPLACE_NEW> sys
import logging
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver as get_libcloud_driver
from pod_manager.settings import LOG_LEVEL, LOG_FORMAT
from pod_manager.settings import PROVIDER, PROVIDER_CREDENTIALS, PROVIDER_KWARGS
... | Modify get_logger to set level and formatter, add get_driver method.
import logging
__all__ = [
'get_logger'
]
def get_logger(name):
logger = logging.getLogger(name)
# TODO: set level, add handler
return logger
|
88773c6757540c9f1d4dfca2a287512e74bdbc24 | python_scripts/mc_config.py | python_scripts/mc_config.py | #!/usr/bin/python
import yaml
import os.path
_config_file_base_name = 'mediawords.yml'
_config_file_name = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'mediawords.yml'))
def read_config():
yml_file = open(_config_file_name, 'rb')
config_file = yaml.load( yml_file )
return config_file
| #!/usr/bin/python
import yaml
import os.path
_config_file_base_name = 'mediawords.yml'
_config_file_name = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'mediawords.yml'))
_defaults_config_file_base_name = 'defaults.yml'
_defaults_config_file_name = os.path.abspath(os.path.join(os.path.dirname(__fil... | Read the defaults config file and merge it with mediawords.yml | Read the defaults config file and merge it with mediawords.yml
| Python | agpl-3.0 | berkmancenter/mediacloud,AchyuthIIIT/mediacloud,berkmancenter/mediacloud,AchyuthIIIT/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud,AchyuthIIIT/mediacloud,AchyuthIIIT/mediacloud,AchyuthIIIT/mediacloud,AchyuthIIIT/mediacloud,berkmancenter/mediacloud,AchyuthIIIT/mediacloud,AchyuthIIIT/mediacloud,AchyuthIIIT... | <REPLACE_OLD> 'mediawords.yml'))
def read_config():
<REPLACE_NEW> 'mediawords.yml'))
_defaults_config_file_base_name = 'defaults.yml'
_defaults_config_file_name = os.path.abspath(os.path.join(os.path.dirname(__file__), '../config', _defaults_config_file_base_name))
def _load_yml( file_path ):
<REPLACE_END> <REPLA... | Read the defaults config file and merge it with mediawords.yml
#!/usr/bin/python
import yaml
import os.path
_config_file_base_name = 'mediawords.yml'
_config_file_name = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'mediawords.yml'))
def read_config():
yml_file = open(_config_file_name, 'rb')
... |
abd2df6436d7a4a1304bf521c0f0a6c8922e5826 | src/benchmark_rank_filter.py | src/benchmark_rank_filter.py | #!/usr/bin/env python
import sys
import timeit
import numpy
from rank_filter import lineRankOrderFilter
def benchmark():
input_array = numpy.random.normal(size=(100, 101, 102))
output_array = numpy.empty_like(input_array)
lineRankOrderFilter(input_array, 25, 0.5, 0, output_array)
def main(*argv):
... | #!/usr/bin/env python
from __future__ import division
import sys
import timeit
import numpy
from rank_filter import lineRankOrderFilter
def benchmark():
input_array = numpy.random.normal(size=(100, 101, 102))
output_array = numpy.empty_like(input_array)
lineRankOrderFilter(input_array, 25, 0.5, 0, ou... | Use Python 3 division on Python 2 | Use Python 3 division on Python 2
Make sure that floating point division is used on Python 2. This
basically happens anyways as we have a floating point value divided by
an integral value. Still it is good to ensure that our average doesn't
get truncated by accident.
| Python | bsd-3-clause | nanshe-org/rank_filter,DudLab/rank_filter,jakirkham/rank_filter,jakirkham/rank_filter,nanshe-org/rank_filter,nanshe-org/rank_filter,DudLab/rank_filter,DudLab/rank_filter,jakirkham/rank_filter | <REPLACE_OLD> python
import <REPLACE_NEW> python
from __future__ import division
import <REPLACE_END> <|endoftext|> #!/usr/bin/env python
from __future__ import division
import sys
import timeit
import numpy
from rank_filter import lineRankOrderFilter
def benchmark():
input_array = numpy.random.normal(siz... | Use Python 3 division on Python 2
Make sure that floating point division is used on Python 2. This
basically happens anyways as we have a floating point value divided by
an integral value. Still it is good to ensure that our average doesn't
get truncated by accident.
#!/usr/bin/env python
import sys
import timeit
... |
7d9d6893a9fc01ccb74c27be4749ab512a3893a0 | tests/settings.py | tests/settings.py | import os
BASE_PATH = os.path.abspath(os.path.dirname(__file__))
MEDIA_ROOT = os.path.normpath(os.path.join(BASE_PATH, 'media'))
SECRET_KEY = 'not secret'
INSTALLED_APPS = ('simpleimages', 'tests')
TEMPLATE_DEBUG = DEBUG = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'N... | import os
BASE_PATH = os.path.abspath(os.path.dirname(__file__))
MEDIA_ROOT = os.path.normpath(os.path.join(BASE_PATH, 'media'))
SECRET_KEY = 'not secret'
INSTALLED_APPS = ('simpleimages', 'tests')
TEMPLATE_DEBUG = DEBUG = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
},
}
| Use in memory database for tests | Use in memory database for tests
| Python | mit | saulshanabrook/django-simpleimages | <DELETE> 'NAME': 'imagekit.db',
<DELETE_END> <|endoftext|> import os
BASE_PATH = os.path.abspath(os.path.dirname(__file__))
MEDIA_ROOT = os.path.normpath(os.path.join(BASE_PATH, 'media'))
SECRET_KEY = 'not secret'
INSTALLED_APPS = ('simpleimages', 'tests')
TEMPLATE_DEBUG = DEBUG = True
DATABASES = {
'def... | Use in memory database for tests
import os
BASE_PATH = os.path.abspath(os.path.dirname(__file__))
MEDIA_ROOT = os.path.normpath(os.path.join(BASE_PATH, 'media'))
SECRET_KEY = 'not secret'
INSTALLED_APPS = ('simpleimages', 'tests')
TEMPLATE_DEBUG = DEBUG = True
DATABASES = {
'default': {
'ENGINE': 'djang... |
13fdc81cb32842dc5e0f05d2aa84c997cd59daa3 | IPython/core/tests/test_logger.py | IPython/core/tests/test_logger.py | """Test IPython.core.logger"""
import nose.tools as nt
_ip = get_ipython()
def test_logstart_inaccessible_file():
try:
_ip.logger.logstart(logfname="/") # Opening that filename will fail.
except IOError:
pass
else:
nt.assert_true(False) # The try block should never pas... | Add test that, if we failed to open the log file, we don't try to write to it. | Add test that, if we failed to open the log file, we don't try to write to it.
| Python | bsd-3-clause | ipython/ipython,ipython/ipython | <INSERT> """Test IPython.core.logger"""
import nose.tools as nt
_ip = get_ipython()
def test_logstart_inaccessible_file():
<INSERT_END> <INSERT> try:
_ip.logger.logstart(logfname="/") # Opening that filename will fail.
except IOError:
pass
else:
nt.assert_true(False) # ... | Add test that, if we failed to open the log file, we don't try to write to it.
| |
b15c7c044b0c514285bcb8c29b7bcfc8cf777c8b | ormcache/tests/test_signals.py | ormcache/tests/test_signals.py | from django.core.cache import cache
from django.test import SimpleTestCase
from ormcache.signals import cache_hit, cache_missed, cache_invalidated
from ormcache.tests.testapp.models import CachedDummyModel
class SignalsTestCase(SimpleTestCase):
def setUp(self):
self.signal_called = False
self.in... | Add tests for the signals | Add tests for the signals
| Python | mit | educreations/django-ormcache | <REPLACE_OLD> <REPLACE_NEW> from django.core.cache import cache
from django.test import SimpleTestCase
from ormcache.signals import cache_hit, cache_missed, cache_invalidated
from ormcache.tests.testapp.models import CachedDummyModel
class SignalsTestCase(SimpleTestCase):
def setUp(self):
self.signal_c... | Add tests for the signals
| |
5dcfeb2a13f3ab9fe8b20e2620cbc15593cd56dc | pytest_watch/spooler.py | pytest_watch/spooler.py | # -*- coding: utf-8
from multiprocessing import Queue, Process, Event
class Timer(Process):
def __init__(self, interval, function, args=[], kwargs={}):
super(Timer, self).__init__()
self.interval = interval
self.function = function
self.args = args
self.kwargs = kwargs
... | from threading import Thread, Event
try:
from queue import Queue
except ImportError:
from Queue import Queue
class Timer(Thread):
def __init__(self, interval, function, args=[], kwargs={}):
super(Timer, self).__init__()
self.interval = interval
self.function = function
sel... | Use threading instead of multiprocessing. | Use threading instead of multiprocessing.
| Python | mit | blueyed/pytest-watch,rakjin/pytest-watch,ColtonProvias/pytest-watch,joeyespo/pytest-watch | <REPLACE_OLD> # -*- coding: utf-8
from multiprocessing <REPLACE_NEW> from threading <REPLACE_END> <REPLACE_OLD> Queue, Process, Event
class Timer(Process):
<REPLACE_NEW> Thread, Event
try:
from queue import Queue
except ImportError:
from Queue import Queue
class Timer(Thread):
<REPLACE_END> <|endoftext|... | Use threading instead of multiprocessing.
# -*- coding: utf-8
from multiprocessing import Queue, Process, Event
class Timer(Process):
def __init__(self, interval, function, args=[], kwargs={}):
super(Timer, self).__init__()
self.interval = interval
self.function = function
self.a... |
7d6c60898dd2708df07847253bca86049a33ed78 | SigmaPi/SigmaPi/urls.py | SigmaPi/SigmaPi/urls.py | from django.conf.urls import include, url
from django.conf import settings
from django.conf.urls.static import static
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = [
# Examples:
# url(r'^$', 'SigmaPi.views.home', name='home'),
# ur... | import warnings
from django.conf.urls import include, url
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
admin.autodiscover()
# Turns deprecation warnings into errors
warnings.simplefilter('error', DeprecationWarning)
urlpatterns = [
# Examples:
... | Fix admin URLs; turn deprecation warnings into errors | Fix admin URLs; turn deprecation warnings into errors
| Python | mit | sigmapi-gammaiota/sigmapi-web,sigmapi-gammaiota/sigmapi-web,sigmapi-gammaiota/sigmapi-web,sigmapi-gammaiota/sigmapi-web | <REPLACE_OLD> from <REPLACE_NEW> import warnings
from <REPLACE_END> <REPLACE_OLD> static
# Uncomment the next two lines to enable the admin:
from <REPLACE_NEW> static
from <REPLACE_END> <REPLACE_OLD> admin
admin.autodiscover()
urlpatterns <REPLACE_NEW> admin
admin.autodiscover()
# Turns deprecation warnings int... | Fix admin URLs; turn deprecation warnings into errors
from django.conf.urls import include, url
from django.conf import settings
from django.conf.urls.static import static
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = [
# Examples:
# ... |
f433a77ec569512e23d71827036652dd60065b15 | fabfile.py | fabfile.py | from fabric.api import execute, local, settings, task
@task
def docs():
local('make -C docs/ html')
@task
def autodocs():
auto(docs)
@task
def test(path=None):
path = path or 'tests/'
local('nosetests ' + path)
@task
def autotest(path=None):
auto(test, path=path)
@task
def coverage(path=No... | from fabric.api import execute, local, settings, task
@task
def docs():
local('make -C docs/ html')
@task
def autodocs():
auto(docs)
@task
def test(path=None):
path = path or 'tests/'
local('nosetests ' + path)
@task
def autotest(path=None):
auto(test, path=path)
@task
def coverage(path=No... | Add lint/autolint tasks for running flake8 on everything | fab: Add lint/autolint tasks for running flake8 on everything
| Python | apache-2.0 | jcass77/mopidy,ali/mopidy,bencevans/mopidy,dbrgn/mopidy,adamcik/mopidy,rawdlite/mopidy,pacificIT/mopidy,abarisain/mopidy,vrs01/mopidy,woutervanwijk/mopidy,mokieyue/mopidy,bencevans/mopidy,hkariti/mopidy,SuperStarPL/mopidy,mopidy/mopidy,diandiankan/mopidy,dbrgn/mopidy,tkem/mopidy,rawdlite/mopidy,kingosticks/mopidy,swak/... | <INSERT> path=path)
@task
def lint(path=None):
path = path or '.'
local('flake8 $(find %s -iname "*.py")' % path)
@task
def autolint(path=None):
auto(lint, <INSERT_END> <|endoftext|> from fabric.api import execute, local, settings, task
@task
def docs():
local('make -C docs/ html')
@task
def aut... | fab: Add lint/autolint tasks for running flake8 on everything
from fabric.api import execute, local, settings, task
@task
def docs():
local('make -C docs/ html')
@task
def autodocs():
auto(docs)
@task
def test(path=None):
path = path or 'tests/'
local('nosetests ' + path)
@task
def autotest(pat... |
b3889f8ff6d66963d4253d6796c3bb20dc9adbb7 | scripts/my_Param.py | scripts/my_Param.py | #=================================================
# Observation
#-------------------------------------------------
sstObsPath = '/clim_obs/obs/ocn/mo/tos/UKMETOFFICE-HadISST-v1-1/130122_HadISST_sst.nc'
tauxObsPath = '/clim_obs/obs/atm/mo/tauu/ERAINT/tauu_ERAINT_198901-200911.nc'
sstNameObs = 'sst'
tauxNameObs = 'tauu... | Add external driver and parameter file | Add external driver and parameter file
| Python | bsd-3-clause | eguil/ENSO_metrics,eguil/ENSO_metrics | <INSERT> #=================================================
# Observation
#-------------------------------------------------
sstObsPath = '/clim_obs/obs/ocn/mo/tos/UKMETOFFICE-HadISST-v1-1/130122_HadISST_sst.nc'
tauxObsPath = '/clim_obs/obs/atm/mo/tauu/ERAINT/tauu_ERAINT_198901-200911.nc'
sstNameObs = 'sst'
tauxNameOb... | Add external driver and parameter file
| |
1a2527afdc5cb9c948ac74a9925d90709d6150cc | seleniumbase/fixtures/constants.py | seleniumbase/fixtures/constants.py | """
This class containts some frequently-used constants
"""
class Environment:
QA = "qa"
STAGING = "staging"
PRODUCTION = "production"
MASTER = "master"
LOCAL = "local"
TEST = "test"
class Files:
DOWNLOADS_FOLDER = "downloaded_files"
ARCHIVED_DOWNLOADS_FOLDER = "archived_files"
cla... | """
This class containts some frequently-used constants
"""
class Environment:
QA = "qa"
STAGING = "staging"
PRODUCTION = "production"
MASTER = "master"
LOCAL = "local"
TEST = "test"
class Files:
DOWNLOADS_FOLDER = "downloaded_files"
ARCHIVED_DOWNLOADS_FOLDER = "archived_files"
cla... | Remove "htmlunit" from browser options | Remove "htmlunit" from browser options
| Python | mit | mdmintz/SeleniumBase,mdmintz/seleniumspot,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/seleniumspot,mdmintz/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase | <REPLACE_OLD> "phantomjs"
HTML_UNIT = "htmlunit"
<REPLACE_NEW> "phantomjs"
<REPLACE_END> <DELETE> None,
"htmlunit": <DELETE_END> <DELETE> None,
"htmlunit": <DELETE_END> <|endoftext|> """
This class containts some frequently-used constants
"""
class Environment:
QA = "qa"
STAGING = "sta... | Remove "htmlunit" from browser options
"""
This class containts some frequently-used constants
"""
class Environment:
QA = "qa"
STAGING = "staging"
PRODUCTION = "production"
MASTER = "master"
LOCAL = "local"
TEST = "test"
class Files:
DOWNLOADS_FOLDER = "downloaded_files"
ARCHIVED_D... |
fd5810c86f5998c2e2a7b96f09e82b40fbe2cc11 | string/first-str-substr-occr.py | string/first-str-substr-occr.py | # Implement a function that takes two strings, s and x, as arguments and finds the first occurrence of the string x in s. The function should return an integer indicating the index in s of the first occurrence of x. If there are no occurrences of x in s, return -1
def find_substring(string, substr):
string_len = len(... | # Implement a function that takes two strings, s and x, as arguments and finds the first occurrence of the string x in s. The function should return an integer indicating the index in s of the first occurrence of x. If there are no occurrences of x in s, return -1
def find_substring(string, substr):
string_len = len(... | Return -1 if no substring is found | Return -1 if no substring is found
| Python | mit | derekmpham/interview-prep,derekmpham/interview-prep | <REPLACE_OLD> 1
<REPLACE_NEW> 1
return -1
<REPLACE_END> <|endoftext|> # Implement a function that takes two strings, s and x, as arguments and finds the first occurrence of the string x in s. The function should return an integer indicating the index in s of the first occurrence of x. If there are no occurrences of... | Return -1 if no substring is found
# Implement a function that takes two strings, s and x, as arguments and finds the first occurrence of the string x in s. The function should return an integer indicating the index in s of the first occurrence of x. If there are no occurrences of x in s, return -1
def find_substring... |
5121a036b12a1e4b7eafb21cfbcf8c5cb39d9803 | script.py | script.py | import numpy as np
import pandas
def main():
data = pandas.read_csv('sarcasm_v2.csv').as_matrix()
# print(data.shape)
data[:, 0] = np.array([find_category(x) for x in data[:, 0]])
data[:, 1] = np.array([sarcasm(x) for x in data[:, 1]])
# print(data[0,1]) # should be 1 for sarcasm
def find_category(category):
re... | import numpy as np
import pandas
def main():
data = pandas.read_csv('sarcasm_v2.csv').as_matrix()
# print(data.shape)
data[:, 0] = np.array([find_category(x) for x in data[:, 0]])
data[:, 1] = np.array([sarcasm(x) for x in data[:, 1]])
# print(data[0,1]) # should be 1 for sarcasm
def find_category(category):
re... | Add TODO comment for get_data_index | Add TODO comment for get_data_index
| Python | mit | liuisaiah/Hack-Brown2017,LWprogramming/Hack-Brown2017 | <REPLACE_OLD> TODO
if <REPLACE_NEW> TODO: given a string as shown in the comment, extract the number in it, possibly with regex.
if <REPLACE_END> <|endoftext|> import numpy as np
import pandas
def main():
data = pandas.read_csv('sarcasm_v2.csv').as_matrix()
# print(data.shape)
data[:, 0] = np.array([find_category... | Add TODO comment for get_data_index
import numpy as np
import pandas
def main():
data = pandas.read_csv('sarcasm_v2.csv').as_matrix()
# print(data.shape)
data[:, 0] = np.array([find_category(x) for x in data[:, 0]])
data[:, 1] = np.array([sarcasm(x) for x in data[:, 1]])
# print(data[0,1]) # should be 1 for sarc... |
0ce28daf74ebff5a087ccda7db9d6bcfc77dfdf6 | telemetry/telemetry/internal/backends/chrome_inspector/inspector_serviceworker.py | telemetry/telemetry/internal/backends/chrome_inspector/inspector_serviceworker.py | # Copyright 2017 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.
from telemetry.core import exceptions
class InspectorServiceWorker(object):
def __init__(self, inspector_websocket, timeout):
self._websocket = inspe... | # Copyright 2017 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.
from telemetry.internal.backends.chrome_inspector import inspector_websocket
from telemetry.core import exceptions
class InspectorServiceWorker(object):
d... | Handle error code METHOD_NOT_FOUND_CODE in InspectorServiceWorker.StopAllWorkers() | Handle error code METHOD_NOT_FOUND_CODE in InspectorServiceWorker.StopAllWorkers()
DevTools method ServiceWorker.stopAllWorkers is supported from M63, so
calling this can return METHOD_NOT_FOUND_CODE error in previous browser.
This CL make InspectorServiceWorker.StopAllWorkers() handle this error.
If it receives this ... | Python | bsd-3-clause | catapult-project/catapult,catapult-project/catapult,catapult-project/catapult,catapult-project/catapult,catapult-project/catapult,catapult-project/catapult,catapult-project/catapult | <INSERT> telemetry.internal.backends.chrome_inspector import inspector_websocket
from <INSERT_END> <REPLACE_OLD> exceptions
class <REPLACE_NEW> exceptions
class <REPLACE_END> <REPLACE_OLD> inspector_websocket, <REPLACE_NEW> inspector_socket, <REPLACE_END> <REPLACE_OLD> inspector_websocket
<REPLACE_NEW> inspector_so... | Handle error code METHOD_NOT_FOUND_CODE in InspectorServiceWorker.StopAllWorkers()
DevTools method ServiceWorker.stopAllWorkers is supported from M63, so
calling this can return METHOD_NOT_FOUND_CODE error in previous browser.
This CL make InspectorServiceWorker.StopAllWorkers() handle this error.
If it receives this ... |
81fc515539474e720a9b96ef1bc5679e053952f9 | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(name='bettercache',
version='0.5.3',
description = "A suite of better cache tools for Django.",
license = "MIT",
author='Calvin Spealman',
author_email='ironfroggy@gmail.com',
url='http://github.com/ironfroggy/django-better... | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(name='bettercache',
version='0.5.3',
description = "A suite of better cache tools for Django.",
license = "MIT",
author='Calvin Spealman',
author_email='ironfroggy@gmail.com',
url='http://github.com/ironfroggy/django-better... | Add new requirements from CMG middleware | Add new requirements from CMG middleware
| Python | mit | ironfroggy/django-better-cache,ironfroggy/django-better-cache | <REPLACE_OLD> find_packages(),
)
<REPLACE_NEW> find_packages(),
install_requires = [
'celery >= 2.4.2',
'httplib2 >= 0.6.0',
],
)
<REPLACE_END> <|endoftext|> #!/usr/bin/env python
from setuptools import setup, find_packages
setup(name='bettercache',
version='0.5.3',
description = "A s... | Add new requirements from CMG middleware
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(name='bettercache',
version='0.5.3',
description = "A suite of better cache tools for Django.",
license = "MIT",
author='Calvin Spealman',
author_email='ironfroggy@gmail.com',
url='... |
335ce70414ffecbfc506ce2c22a5a7e4aeeca1a1 | sda/__init__.py | sda/__init__.py | # -*- coding: utf-8 -*-
"""sda
.. codeauthor:: John Lane <jlane@fanthreesixty.com>
"""
from sda import element
from sda import locators
from sda import mixins
from sda import page
from sda import site
from sda import structures
__author__ = 'jlane'
__email__ = 'jlane@fanthreesixty.com'
__license__ = "MIT"
__version... | # -*- coding: utf-8 -*-
"""sda
.. codeauthor:: John Lane <jlane@fanthreesixty.com>
"""
from sda import locators
from sda import mixins
from sda import structures
from sda.element import Element
from sda.page import Page
from sda.site import Site
__author__ = 'jlane'
__email__ = 'jlane@fanthreesixty.com'
__license__... | Streamline imports for Element, Page and Site | Streamline imports for Element, Page and Site
| Python | mit | jlane9/selenium_data_attributes,jlane9/selenium_data_attributes | <DELETE> element
from sda import <DELETE_END> <REPLACE_OLD> page
from sda <REPLACE_NEW> structures
from sda.element <REPLACE_END> <REPLACE_OLD> site
from sda <REPLACE_NEW> Element
from sda.page <REPLACE_END> <REPLACE_OLD> structures
__author__ <REPLACE_NEW> Page
from sda.site import Site
__author__ <REPLACE_END> <REP... | Streamline imports for Element, Page and Site
# -*- coding: utf-8 -*-
"""sda
.. codeauthor:: John Lane <jlane@fanthreesixty.com>
"""
from sda import element
from sda import locators
from sda import mixins
from sda import page
from sda import site
from sda import structures
__author__ = 'jlane'
__email__ = 'jlane@... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.