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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a144706bc53f439b7c45b31eb9e6ca5241e3b1a3 | scripts/check_process.py | scripts/check_process.py | #!/usr/bin/env python
'''Checks processes'''
#===============================================================================
# Import modules
#===============================================================================
# Standard Library
import os
import subprocess
import logging
# Third party modules
# App... | #!/usr/bin/env python
'''Checks processes'''
#===============================================================================
# Import modules
#===============================================================================
# Standard Library
import os
import subprocess
import logging
# Third party modules
# App... | Downgrade script already running to info | Downgrade script already running to info
| Python | mit | ninjawil/weather-station,ninjawil/weather-station,ninjawil/weather-station,ninjawil/weather-station,ninjawil/weather-station,ninjawil/weather-station,ninjawil/weather-station | <REPLACE_OLD> logger.error('Script <REPLACE_NEW> logger.info('Script <REPLACE_END> <REPLACE_OLD> logger.error(other_script_found)
<REPLACE_NEW> logger.info(other_script_found)
<REPLACE_END> <|endoftext|> #!/usr/bin/env python
'''Checks processes'''
#=================================================================... | Downgrade script already running to info
#!/usr/bin/env python
'''Checks processes'''
#===============================================================================
# Import modules
#===============================================================================
# Standard Library
import os
import subprocess
imp... |
a5409ca51e95b4d6ca99a63e0422ca1fe8d344f8 | tags/templatetags/tags_tags.py | tags/templatetags/tags_tags.py | # -*- coding: utf8 -*-
from __future__ import unicode_literals
from __future__ import absolute_import
from django import template
from django.db.models.loading import get_model
from ..models import CustomTag
register = template.Library()
@register.assignment_tag
def get_obj_list(app, model, obj):
'''
Retu... | # -*- coding: utf8 -*-
from __future__ import unicode_literals
from __future__ import absolute_import
from django import template
from django.core.exceptions import ObjectDoesNotExist
from django.db.models.loading import get_model
from django.http import Http404
from ..models import CustomTag
register = template.Li... | Fix server error in tag search for non-existing tag. | Fix server error in tag search for non-existing tag.
| Python | bsd-3-clause | ugoertz/django-familio,ugoertz/django-familio,ugoertz/django-familio,ugoertz/django-familio | <INSERT> django.core.exceptions import ObjectDoesNotExist
from <INSERT_END> <REPLACE_OLD> get_model
from <REPLACE_NEW> get_model
from django.http import Http404
from <REPLACE_END> <INSERT> try:
<INSERT_END> <INSERT> <INSERT_END> <INSERT> except ObjectDoesNotExist:
raise Http404
<INSERT_END> <... | Fix server error in tag search for non-existing tag.
# -*- coding: utf8 -*-
from __future__ import unicode_literals
from __future__ import absolute_import
from django import template
from django.db.models.loading import get_model
from ..models import CustomTag
register = template.Library()
@register.assignment_t... |
73d0225b64ec82c7a8142dbac023be499b41fe0f | figures.py | figures.py | #! /usr/bin/env python
import sys
import re
import yaml
FILE = sys.argv[1]
YAML = sys.argv[2]
TYPE = sys.argv[3]
header = open(YAML, "r")
text = open(FILE, "r")
copy = open(FILE+"_NEW", "wt")
docs = yaml.load_all(header)
for doc in docs:
if not doc == None:
if 'figure' in doc.keys():
for li... | #! /usr/bin/env python
import sys
import re
import yaml
FILE = sys.argv[1]
YAML = sys.argv[2]
TYPE = sys.argv[3]
header = open(YAML, "r")
text = open(FILE, "r")
copy = open(FILE+"_NEW", "wt")
docs = yaml.load_all(header)
for doc in docs:
if not doc == None:
if 'figure' in doc.keys():
for li... | Make the python script silent | Make the python script silent
| Python | mit | PoisotLab/PLMT | <DELETE> print line
<DELETE_END> <DELETE> print f
<DELETE_END> <|endoftext|> #! /usr/bin/env python
import sys
import re
import yaml
FILE = sys.argv[1]
YAML = sys.argv[2]
TYPE = sys.argv[3]
header = open(YAML, "r")
text = open(FILE, "r")
copy = open(FILE+"_NEW", "w... | Make the python script silent
#! /usr/bin/env python
import sys
import re
import yaml
FILE = sys.argv[1]
YAML = sys.argv[2]
TYPE = sys.argv[3]
header = open(YAML, "r")
text = open(FILE, "r")
copy = open(FILE+"_NEW", "wt")
docs = yaml.load_all(header)
for doc in docs:
if not doc == None:
if 'figure' in... |
248023106d4e881110a646e9d078ecad4f58e24d | pipelogger.py | pipelogger.py | #!/usr/bin/env python
#
import argparse
import os
import syslog
parser = argparse.ArgumentParser(
description='Syslog messages as read from a pipe')
parser.add_argument('-i', '--ident',
help='Use the given identifier for syslogging',
required=True)
parser.add_argument('pipe', help='Pipe file to read log records f... | Add a Python program which reads from a pipe and writes the data it gets to syslog. | Add a Python program which reads from a pipe and writes the data it gets
to syslog.
| Python | bsd-3-clause | tonnerre/pipelogger | <REPLACE_OLD> <REPLACE_NEW> #!/usr/bin/env python
#
import argparse
import os
import syslog
parser = argparse.ArgumentParser(
description='Syslog messages as read from a pipe')
parser.add_argument('-i', '--ident',
help='Use the given identifier for syslogging',
required=True)
parser.add_argument('pipe', help='Pi... | Add a Python program which reads from a pipe and writes the data it gets
to syslog.
| |
0d2c04790fb6c97b37f6e0700bb0162796e3dc4c | tests/web_api/test_scale_serialization.py | tests/web_api/test_scale_serialization.py | # -*- coding: utf-8 -*-
from openfisca_web_api.loader.parameters import walk_node
from openfisca_core.parameters import ParameterNode, Scale
def test_amount_scale():
parameters = []
metadata = {'location':'foo', 'version':'1', 'repository_url':'foo'}
root_node = ParameterNode(data = {})
amount_scale_d... | Add unit tests for AmountTaxScale serialization | Add unit tests for AmountTaxScale serialization
| Python | agpl-3.0 | openfisca/openfisca-core,openfisca/openfisca-core | <INSERT> # -*- coding: utf-8 -*-
from openfisca_web_api.loader.parameters import walk_node
from openfisca_core.parameters import ParameterNode, Scale
def test_amount_scale():
<INSERT_END> <INSERT> parameters = []
metadata = {'location':'foo', 'version':'1', 'repository_url':'foo'}
root_node = ParameterNode... | Add unit tests for AmountTaxScale serialization
| |
1bbffc2152ea1c48b47153005beeb2974b682f3c | bot/actions/action.py | bot/actions/action.py | from bot.api.api import Api
from bot.storage import Config, State, Cache
from bot.utils.dictionaryobject import DictionaryObject
class Event(DictionaryObject):
pass
class Update(Event):
def __init__(self, update, is_pending):
super().__init__()
self.update = update
self.is_pending = ... | from bot.api.api import Api
from bot.storage import Config, State, Cache
from bot.utils.dictionaryobject import DictionaryObject
class Event(DictionaryObject):
pass
class Update(Event):
def __init__(self, update, is_pending):
super().__init__()
self.update = update
self.is_pending = ... | Fix for_each incorrectly using lazy map operator | Fix for_each incorrectly using lazy map operator
| Python | agpl-3.0 | alvarogzp/telegram-bot,alvarogzp/telegram-bot | <REPLACE_OLD> map(func, self.actions)
class <REPLACE_NEW> for action in self.actions:
func(action)
class <REPLACE_END> <|endoftext|> from bot.api.api import Api
from bot.storage import Config, State, Cache
from bot.utils.dictionaryobject import DictionaryObject
class Event(DictionaryObject):
pass
... | Fix for_each incorrectly using lazy map operator
from bot.api.api import Api
from bot.storage import Config, State, Cache
from bot.utils.dictionaryobject import DictionaryObject
class Event(DictionaryObject):
pass
class Update(Event):
def __init__(self, update, is_pending):
super().__init__()
... |
a0dd71a6b56ed8f88f29691edd7a65d84656e019 | anki-blitz.py | anki-blitz.py | # -*- coding: utf-8 -*-
# Blitz speed reading trainer add-on for Anki
#
# Copyright (C) 2016 Jakub Szypulka, Dave Shifflett
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 o... | # -*- coding: utf-8 -*-
# Blitz speed reading trainer add-on for Anki
#
# Copyright (C) 2016 Jakub Szypulka, Dave Shifflett
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 o... | Increase time limits to 2 and 5 seconds | Increase time limits to 2 and 5 seconds
| Python | mit | jaksz/anki-blitz | <REPLACE_OLD> 1:
<REPLACE_NEW> 2:
<REPLACE_END> <REPLACE_OLD> 3:
<REPLACE_NEW> 5:
<REPLACE_END> <|endoftext|> # -*- coding: utf-8 -*-
# Blitz speed reading trainer add-on for Anki
#
# Copyright (C) 2016 Jakub Szypulka, Dave Shifflett
#
# This program is free software: you can redistribute it and/or modify
# it un... | Increase time limits to 2 and 5 seconds
# -*- coding: utf-8 -*-
# Blitz speed reading trainer add-on for Anki
#
# Copyright (C) 2016 Jakub Szypulka, Dave Shifflett
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Fre... |
66ea7be70d37c8431d6daef976c6d5c9a7407ea0 | examples/example_injury.py | examples/example_injury.py | #!/usr/bin/env python
from tabulate import tabulate
from mlbgame import injury
import dateutil.parser
from datetime import datetime
team_id = 117 # Houston Astros
i = injury.Injury(team_id)
injuries = []
for inj in i.injuries:
team = inj.team_name
injury = ['{0}, {1} ({2})'.format(inj.name_last, inj.name_fir... | Add example for injury class | Add example for injury class
| Python | mit | panzarino/mlbgame,zachpanz88/mlbgame | <INSERT> #!/usr/bin/env python
from tabulate import tabulate
from mlbgame import injury
import dateutil.parser
from datetime import datetime
team_id = 117 # Houston Astros
i = injury.Injury(team_id)
injuries = []
for inj in i.injuries:
<INSERT_END> <INSERT> team = inj.team_name
injury = ['{0}, {1} ({2})'.form... | Add example for injury class
| |
6b358e001c270b4ee735550c829a47c4ee4118b4 | setup.py | setup.py | from setuptools import setup
setup(
name='syslog2IRC',
version='0.8',
description='A proxy to forward syslog messages to IRC',
url='http://homework.nwsnet.de/releases/c474/#syslog2irc',
author='Jochen Kupperschmidt',
author_email='homework@nwsnet.de',
license='MIT',
classifiers=[
... | # -*- coding: utf-8 -*-
import codecs
from setuptools import setup
with codecs.open('README.rst', encoding='utf-8') as f:
long_description = f.read()
setup(
name='syslog2IRC',
version='0.8',
description='A proxy to forward syslog messages to IRC',
long_description=long_description,
url='ht... | Include README content as long description. | Include README content as long description.
| Python | mit | Emantor/syslog2irc,homeworkprod/syslog2irc | <REPLACE_OLD> from <REPLACE_NEW> # -*- coding: utf-8 -*-
import codecs
from <REPLACE_END> <REPLACE_OLD> setup
setup(
<REPLACE_NEW> setup
with codecs.open('README.rst', encoding='utf-8') as f:
long_description = f.read()
setup(
<REPLACE_END> <INSERT> long_description=long_description,
<INSERT_END> <|en... | Include README content as long description.
from setuptools import setup
setup(
name='syslog2IRC',
version='0.8',
description='A proxy to forward syslog messages to IRC',
url='http://homework.nwsnet.de/releases/c474/#syslog2irc',
author='Jochen Kupperschmidt',
author_email='homework@nwsnet.de... |
5c442db8a6352c21325f372486409d44ad3f5b76 | ServerBackup.py | ServerBackup.py | #!/usr/bin/python2
import LogUncaught, ConfigParser, logging, os
sbConfig = ConfigParser.RawConfigParser()
sbConfig.read('scripts.cfg')
# Logger File Handler
sbLFH = logging.FileHandler(sbConfig.get('ServerBackup', 'log_location'))
sbLFH.setLevel(logging.DEBUG)
# Logger Formatter
sbLFORMAT = logging.Formatter('[%(as... | #!/usr/bin/python2
import LogUncaught, ConfigParser, logging, PushBullet, os
from time import localtime, strftime
sbConfig = ConfigParser.RawConfigParser()
sbConfig.read('scripts.cfg')
# Logger File Handler
sbLFH = logging.FileHandler(sbConfig.get('ServerBackup', 'log_location'))
sbLFH.setLevel(logging.DEBUG)
# Logg... | Backup directory is made, and a notification is sent and logged if the directory doesn't exist | Backup directory is made, and a notification is sent and logged if the directory doesn't exist
| Python | mit | dwieeb/usr-local-bin | <REPLACE_OLD> os
sbConfig <REPLACE_NEW> PushBullet, os
from time import localtime, strftime
sbConfig <REPLACE_END> <DELETE> <DELETE_END> <REPLACE_OLD> 'backup_location')
<REPLACE_NEW> 'backup_location')
date = strftime("%m_%d_%Y_%H_%M_%S", localtime())
sbFolder = sbLocation + "backup_" + date + "/"
os.makedirs(s... | Backup directory is made, and a notification is sent and logged if the directory doesn't exist
#!/usr/bin/python2
import LogUncaught, ConfigParser, logging, os
sbConfig = ConfigParser.RawConfigParser()
sbConfig.read('scripts.cfg')
# Logger File Handler
sbLFH = logging.FileHandler(sbConfig.get('ServerBackup', 'log_lo... |
7c37d4f95897ddbc061ec0a84185a19899b85b89 | compile_for_dist.py | compile_for_dist.py | #!/ms/dist/python/PROJ/core/2.5.2-1/bin/python
# ex: set expandtab softtabstop=4 shiftwidth=4: -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# Copyright (C) 2008 Morgan Stanley
#
# This module is part of Aquilon
"""Add /ms/dist to traceback of files compiled in /ms/dev."""
import sys
import py_compile
import re
... | #!/usr/bin/env python2.6
# ex: set expandtab softtabstop=4 shiftwidth=4: -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# Copyright (C) 2008 Morgan Stanley
#
# This module is part of Aquilon
"""Add /ms/dist to traceback of files compiled in /ms/dev."""
import sys
import py_compile
import re
def main(args=None):... | Update shebang to use /usr/bin/env. | Update shebang to use /usr/bin/env.
Remove the /ms/dist reference.
| Python | apache-2.0 | quattor/aquilon-protocols,quattor/aquilon-protocols | <REPLACE_OLD> #!/ms/dist/python/PROJ/core/2.5.2-1/bin/python
# <REPLACE_NEW> #!/usr/bin/env python2.6
# <REPLACE_END> <|endoftext|> #!/usr/bin/env python2.6
# ex: set expandtab softtabstop=4 shiftwidth=4: -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# Copyright (C) 2008 Morgan Stanley
#
# This module is part of A... | Update shebang to use /usr/bin/env.
Remove the /ms/dist reference.
#!/ms/dist/python/PROJ/core/2.5.2-1/bin/python
# ex: set expandtab softtabstop=4 shiftwidth=4: -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# Copyright (C) 2008 Morgan Stanley
#
# This module is part of Aquilon
"""Add /ms/dist to traceback of fi... |
35111353ab8d8cae320b49520fe693114fed160f | bin/parsers/DeploysServiceLookup.py | bin/parsers/DeploysServiceLookup.py |
if 'r2' in alert['resource'].lower():
alert['service'] = [ 'R2' ]
elif 'content-api' in alert['resource'].lower():
alert['service'] = [ 'ContentAPI' ]
elif 'flexible' in alert['resource'].lower():
alert['service'] = [ 'FlexibleContent' ]
elif 'frontend' in alert['resource'].lower():
alert['service'] = ... |
if alert['resource'].startswith('R1'):
alert['service'] = [ 'R1' ]
elif alert['resource'].startswith('R2'):
alert['service'] = [ 'R2' ]
elif 'content-api' in alert['resource'].lower():
alert['service'] = [ 'ContentAPI' ]
elif alert['resource'].startswith('frontend'):
alert['service'] = [ 'Frontend' ]
e... | Add more service lookups for Deploys | Add more service lookups for Deploys
| Python | apache-2.0 | guardian/alerta,0312birdzhang/alerta,skob/alerta,mrkeng/alerta,guardian/alerta,mrkeng/alerta,guardian/alerta,0312birdzhang/alerta,mrkeng/alerta,0312birdzhang/alerta,skob/alerta,skob/alerta,mrkeng/alerta,guardian/alerta,skob/alerta | <REPLACE_OLD> 'r2' in alert['resource'].lower():
<REPLACE_NEW> alert['resource'].startswith('R1'):
alert['service'] = [ 'R1' ]
elif alert['resource'].startswith('R2'):
<REPLACE_END> <INSERT> alert['resource'].startswith('frontend'):
alert['service'] = [ 'Frontend' ]
elif <INSERT_END> <REPLACE_OLD> 'frontend' ... | Add more service lookups for Deploys
if 'r2' in alert['resource'].lower():
alert['service'] = [ 'R2' ]
elif 'content-api' in alert['resource'].lower():
alert['service'] = [ 'ContentAPI' ]
elif 'flexible' in alert['resource'].lower():
alert['service'] = [ 'FlexibleContent' ]
elif 'frontend' in alert['resou... |
a38f46566b18803d0b5ab0d75a267ee9ac3ceea3 | doc/examples/viennagrid_wrapper/io.py | doc/examples/viennagrid_wrapper/io.py | #!/usr/bin/env python
#
# This example shows how to read and write mesh files using the low-level ViennaGrid
# wrapper for Python (viennagrid.wrapper).
from __future__ import print_function
# In this example, we will set up a domain of triangles in the cartesian 3D
# space from the contents of a Netgen mesh file.
# ... | Write an example of the use of the Netgen reader. | Write an example of the use of the Netgen reader.
| Python | mit | jonancm/viennagrid-python,jonancm/viennagrid-python,jonancm/viennagrid-python | <REPLACE_OLD> <REPLACE_NEW> #!/usr/bin/env python
#
# This example shows how to read and write mesh files using the low-level ViennaGrid
# wrapper for Python (viennagrid.wrapper).
from __future__ import print_function
# In this example, we will set up a domain of triangles in the cartesian 3D
# space from the conte... | Write an example of the use of the Netgen reader.
| |
13208d4656adcf52a5842200ee1d9e079fdffc2b | bin/rate_limit_watcher.py | bin/rate_limit_watcher.py | #!/usr/bin/env python
import requests
URL = 'http://tutorials.pluralsight.com/gh_rate_limit'
def main():
resp = requests.get(URL)
if resp.status_code == 200:
print resp.content
else:
print 'Failed checking rate limit, status_code: %d' % (resp.status_code)
if __name__ == '__main__':
... | #!/usr/bin/env python
"""
Script to print out Github API rate limit for REPO_OWNER user i.e. the main
github user account used for the guides-cms application.
"""
import argparse
from datetime import datetime
import requests
DOMAIN = 'http://tutorials.pluralsight.com/'
URL = '/gh_rate_limit'
def main(domain):
... | Print rate limits from new JSON response url in a pretty, parsable format | Print rate limits from new JSON response url in a pretty, parsable format
| Python | agpl-3.0 | paulocheque/guides-cms,paulocheque/guides-cms,pluralsight/guides-cms,pluralsight/guides-cms,pluralsight/guides-cms,paulocheque/guides-cms | <REPLACE_OLD> python
import requests
URL = 'http://tutorials.pluralsight.com/gh_rate_limit'
def main():
<REPLACE_NEW> python
"""
Script to print out Github API rate limit for REPO_OWNER user i.e. the main
github user account used for the guides-cms application.
"""
import argparse
from datetime import datetime
im... | Print rate limits from new JSON response url in a pretty, parsable format
#!/usr/bin/env python
import requests
URL = 'http://tutorials.pluralsight.com/gh_rate_limit'
def main():
resp = requests.get(URL)
if resp.status_code == 200:
print resp.content
else:
print 'Failed checking rate lim... |
84ccc5489b4d3dfdf1883bb777cd597bd9cb8e53 | src/test/testclasses.py | src/test/testclasses.py |
from nose.tools import *
from libeeyore.builtins import add_builtins
from libeeyore.classvalues import *
from libeeyore.environment import EeyEnvironment
from libeeyore.cpp.cppvalues import *
from libeeyore.cpp.cpprenderer import EeyCppRenderer
from eeyasserts import assert_multiline_equal
def test_Static_variable_... |
from nose.tools import *
from libeeyore.builtins import add_builtins
from libeeyore.classvalues import *
from libeeyore.environment import EeyEnvironment
from libeeyore.cpp.cppvalues import *
from libeeyore.cpp.cpprenderer import EeyCppRenderer
from eeyasserts import assert_multiline_equal
def test_Static_variable_... | Add a test that demonstrates calling a function within a class definition. | Add a test that demonstrates calling a function within a class definition.
| Python | mit | andybalaam/pepper,andybalaam/pepper,andybalaam/pepper,andybalaam/pepper,andybalaam/pepper | <REPLACE_OLD> )
<REPLACE_NEW> )
def test_Member_function_can_be_executed():
"""
Note this test may turn out to be incorrect. Python would respond with:
TypeError: unbound method myfunc() must be called with X instance as
first argument (got int instance instead)
"""
env = EeyEnviro... | Add a test that demonstrates calling a function within a class definition.
from nose.tools import *
from libeeyore.builtins import add_builtins
from libeeyore.classvalues import *
from libeeyore.environment import EeyEnvironment
from libeeyore.cpp.cppvalues import *
from libeeyore.cpp.cpprenderer import EeyCppRender... |
9467cfc4fa3f0bd2c269f3d7b61460ddc6851f9f | tests/test_dfw_uncomparables.py | tests/test_dfw_uncomparables.py | """Test dfw.uncomparables."""
from check import Check
from proselint.checks.wallace import uncomparables as chk
class TestCheck(Check):
"""The test class for dfw.uncomparables."""
__test__ = True
@property
def this_check(self):
"""Bolierplate."""
return chk
def test_sample_phr... | """Test dfw.uncomparables."""
from check import Check
from proselint.checks.wallace import uncomparables as chk
class TestCheck(Check):
"""The test class for dfw.uncomparables."""
__test__ = True
@property
def this_check(self):
"""Bolierplate."""
return chk
def test_sample_phr... | Add test for exception to uncomparable check | Add test for exception to uncomparable check
| Python | bsd-3-clause | jstewmon/proselint,amperser/proselint,jstewmon/proselint,amperser/proselint,jstewmon/proselint,amperser/proselint,amperser/proselint,amperser/proselint | <INSERT> def test_constitutional(self):
"""Don't flag 'more perfect'."""
assert self.passes("""A more perfect union.""")
<INSERT_END> <|endoftext|> """Test dfw.uncomparables."""
from check import Check
from proselint.checks.wallace import uncomparables as chk
class TestCheck(Check):
"""The t... | Add test for exception to uncomparable check
"""Test dfw.uncomparables."""
from check import Check
from proselint.checks.wallace import uncomparables as chk
class TestCheck(Check):
"""The test class for dfw.uncomparables."""
__test__ = True
@property
def this_check(self):
"""Bolierplate."... |
f9f41ec4f27ba5fd19ca82d4c04b13bed6627d23 | app/PRESUBMIT.py | app/PRESUBMIT.py | #!/usr/bin/python
# Copyright (c) 2009 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.
"""Makes sure that the app/ code is cpplint clean."""
INCLUDE_CPP_FILES_ONLY = (
r'.*\.cc$', r'.*\.h$'
)
EXCLUDE = (
# Autogener... | #!/usr/bin/python
# Copyright (c) 2009 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.
"""Makes sure that the app/ code is cpplint clean."""
INCLUDE_CPP_FILES_ONLY = (
r'.*\.cc$', r'.*\.h$'
)
EXCLUDE = (
# Autogener... | Make all changes to app/ run on all trybot platforms, not just the big three. Anyone who's changing a header here may break the chromeos build. | Make all changes to app/ run on all trybot platforms, not just the big three.
Anyone who's changing a header here may break the chromeos build.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/2838027
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@51000 0039d316-1c4b-4281-b951-d872f2087c98
| Python | bsd-3-clause | rogerwang/chromium,Fireblend/chromium-crosswalk,dednal/chromium.src,TheTypoMaster/chromium-crosswalk,Fireblend/chromium-crosswalk,nacl-webkit/chrome_deps,ChromiumWebApps/chromium,dushu1203/chromium.src,ChromiumWebApps/chromium,junmin-zhu/chromium-rivertrail,junmin-zhu/chromium-rivertrail,Fireblend/chromium-crosswalk,zc... | <REPLACE_OLD> results
<REPLACE_NEW> results
def GetPreferredTrySlaves():
return ['win', 'linux', 'linux_view', 'linux_chromeos', 'mac']
<REPLACE_END> <|endoftext|> #!/usr/bin/python
# Copyright (c) 2009 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that ca... | Make all changes to app/ run on all trybot platforms, not just the big three.
Anyone who's changing a header here may break the chromeos build.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/2838027
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@51000 0039d316-1c4b-4281-b951-d872f2087c98
#!/usr... |
27b1d403540503f6e9d0ccd679918e3efe63ecf7 | tests/test_navigation.py | tests/test_navigation.py | def get_menu_titles(page) -> list:
page.wait_for_load_state()
menu_list = page.query_selector_all("//*[@class='toctree-wrapper compound']/ul/li/a")
return [title.as_element().inner_text() for title in menu_list]
flag = True
def test_check_titles(page):
global flag
if(flag):
page.goto("i... | def get_menu_titles(page) -> list:
page.wait_for_load_state()
menu_list = page.query_selector_all("//*[@class='toctree-wrapper compound']/ul/li/a")
return [title.as_element().inner_text() for title in menu_list]
flag = True
def test_check_titles(page):
global flag
if(flag):
page.goto("i... | Delete debug comments and tool | Delete debug comments and tool
| Python | agpl-3.0 | PyAr/PyZombis,PyAr/PyZombis,PyAr/PyZombis | <DELETE> page.set_viewport_size({"width": 1050, "height": 600})
<DELETE_END> <DELETE> # check titles for all sub-toctree content
# list_url = page.split("/")[3::]
# new_url = "/".join(list_url)
# test_check_titles(new_url)
<DELETE_END> <|endoftext|> de... | Delete debug comments and tool
def get_menu_titles(page) -> list:
page.wait_for_load_state()
menu_list = page.query_selector_all("//*[@class='toctree-wrapper compound']/ul/li/a")
return [title.as_element().inner_text() for title in menu_list]
flag = True
def test_check_titles(page):
global flag
... |
7d130a447786c61c7bfbe6bfe2d87b2c28e32eb6 | shut-up-bird.py | shut-up-bird.py | #!/usr/bin/env python
#
from __future__ import print_function
import os
import sys
import argparse
import logging
| #!/usr/bin/env python
from __future__ import print_function
import os
import sys
import argparse
import json
import tweepy
import pystache
import webbrowser
CONFIG_FILE = '.shut-up-bird.conf'
def tweep_login(consumer_key, consumer_secret, token='', secret=''):
auth = tweepy.OAuthHandler(consumer_key, consumer_se... | Add OAuth authentication and config settings load/save | Add OAuth authentication and config settings load/save
| Python | mit | petarov/shut-up-bird | <REPLACE_OLD> python
#
from <REPLACE_NEW> python
from <REPLACE_END> <REPLACE_OLD> logging
<REPLACE_NEW> json
import tweepy
import pystache
import webbrowser
CONFIG_FILE = '.shut-up-bird.conf'
def tweep_login(consumer_key, consumer_secret, token='', secret=''):
auth = tweepy.OAuthHandler(consumer_key, consumer_s... | Add OAuth authentication and config settings load/save
#!/usr/bin/env python
#
from __future__ import print_function
import os
import sys
import argparse
import logging
|
e0695ca25c4f9f51233ee006c2a3e00bee473203 | all-domains/algorithms/sorting/insertion-sort-part-1/solution.py | all-domains/algorithms/sorting/insertion-sort-part-1/solution.py | # https://www.hackerrank.com/challenges/insertionsort1
# Python 3
def formatted_print(items):
formatted = ' '.join([str(item) for item in items])
print(formatted)
def insertionSort(items):
# The value to insert is the right most element
length = len(items)-1
value_to_insert = items[length]
s... | Implement the beginning of insertion sort | Implement the beginning of insertion sort
https://www.hackerrank.com/challenges/insertionsort1
| Python | mit | arvinsim/hackerrank-solutions | <REPLACE_OLD> <REPLACE_NEW> # https://www.hackerrank.com/challenges/insertionsort1
# Python 3
def formatted_print(items):
formatted = ' '.join([str(item) for item in items])
print(formatted)
def insertionSort(items):
# The value to insert is the right most element
length = len(items)-1
value_to... | Implement the beginning of insertion sort
https://www.hackerrank.com/challenges/insertionsort1
| |
09b5a3f531a3d0498aae21f2c8014b77df5f8d41 | version.py | version.py | # Update uProxy version in all relevant places.
#
# Run with:
# python version.py <new version>
# e.g. python version.py 0.8.10
import json
import collections
import sys
import re
manifest_files = [
'src/chrome/app/dist_build/manifest.json',
'src/chrome/app/dev_build/manifest.json',
'src... | # Update uProxy version in all relevant places.
#
# Run with:
# python version.py <new version>
# e.g. python version.py 0.8.10
import json
import collections
import sys
import re
manifest_files = [
'src/chrome/app/manifest.json',
'src/chrome/extension/manifest.json',
'src/firefox/packag... | Update manifest files being bumped. | Update manifest files being bumped.
| Python | apache-2.0 | itplanes/uproxy,chinarustin/uproxy,uProxy/uproxy,dhkong88/uproxy,dhkong88/uproxy,MinFu/uproxy,itplanes/uproxy,jpevarnek/uproxy,dhkong88/uproxy,jpevarnek/uproxy,chinarustin/uproxy,roceys/uproxy,roceys/uproxy,dhkong88/uproxy,uProxy/uproxy,uProxy/uproxy,qida/uproxy,chinarustin/uproxy,roceys/uproxy,chinarustin/uproxy,MinFu... | <REPLACE_OLD> 'src/chrome/app/dist_build/manifest.json',
<REPLACE_NEW> 'src/chrome/app/manifest.json',
<REPLACE_END> <REPLACE_OLD> 'src/chrome/app/dev_build/manifest.json',
'src/chrome/extension/dist_build/manifest.json',
'src/chrome/extension/dev_build/manifest.json',
<REPLACE_NEW> 'src/chrome/e... | Update manifest files being bumped.
# Update uProxy version in all relevant places.
#
# Run with:
# python version.py <new version>
# e.g. python version.py 0.8.10
import json
import collections
import sys
import re
manifest_files = [
'src/chrome/app/dist_build/manifest.json',
'src/chrome/app/dev... |
bf7daa5f6695f6150d65646592ffb47b35fb45db | setup.py | setup.py | from setuptools import setup, find_packages
setup(
name='lightstep',
version='2.2.0',
description='LightStep Python OpenTracing Implementation',
long_description='',
author='LightStep',
license='',
install_requires=['thrift==0.9.2',
'jsonpickle',
... | from setuptools import setup, find_packages
setup(
name='lightstep',
version='2.2.0',
description='LightStep Python OpenTracing Implementation',
long_description='',
author='LightStep',
license='',
install_requires=['thrift==0.9.2',
'jsonpickle',
... | Remove explicit OT dep; we get it via basictracer | Remove explicit OT dep; we get it via basictracer
| Python | mit | lightstephq/lightstep-tracer-python | <REPLACE_OLD> 'basictracer>=2.2,<2.3',
'opentracing>=1.2,<1.3'],
<REPLACE_NEW> 'basictracer>=2.2,<2.3'],
<REPLACE_END> <|endoftext|> from setuptools import setup, find_packages
setup(
name='lightstep',
version='2.2.0',
description='LightStep Python OpenTracing Implementation',
l... | Remove explicit OT dep; we get it via basictracer
from setuptools import setup, find_packages
setup(
name='lightstep',
version='2.2.0',
description='LightStep Python OpenTracing Implementation',
long_description='',
author='LightStep',
license='',
install_requires=['thrift==0.9.2',
... |
286cba2b3e7cf323835acd07f1e3bb510d74bcb2 | biopsy/tests.py | biopsy/tests.py | # -*- coding: utf-8 -*-
from django.test import TestCase
from django.db import models
from biopsy.models import Biopsy
class BiopsyTest(TestCase):
def biopy_test(self):
biopsy = Biopsy(
clinical_information= "clinica",
macroscopic= "macroscopia",
microscopic= "microscopia",
conclusion= "conclusao",
... | # -*- coding: utf-8 -*-
from django.test import TestCase
from django.db import models
from biopsy.models import Biopsy
class BiopsyTest(TestCase):
def biopy_test(self):
biopsy = Biopsy(
clinical_information= "clinica",
macroscopic= "macroscopia",
microscopic= "microscopia",
conclusion= "conclusao",
... | Add status and exam in test Biopsy | Add status and exam in test Biopsy
| Python | mit | msfernandes/anato-hub,msfernandes/anato-hub,msfernandes/anato-hub,msfernandes/anato-hub | <REPLACE_OLD> "legenda"
)
biopsy.save()
self.assertEquals("clinica",biopsy.clinical_information)
self.assertEquals("macroscopia",biopsy.macroscopic)
self.assertEquals("microscopia",biopsy.microscopic)
self.assertEquals("conclusao",biopsy.conclusion)
self.assertEquals("nota",biopsy.notes)
self.assertEq... | Add status and exam in test Biopsy
# -*- coding: utf-8 -*-
from django.test import TestCase
from django.db import models
from biopsy.models import Biopsy
class BiopsyTest(TestCase):
def biopy_test(self):
biopsy = Biopsy(
clinical_information= "clinica",
macroscopic= "macroscopia",
microscopic= "microscop... |
d6f6d41665f58e68833b57d8b0d04d113f2c86a9 | ideascube/conf/idb_jor_zaatari.py | ideascube/conf/idb_jor_zaatari.py | """Ideaxbox for Zaatari, Jordan"""
from .idb import * # noqa
from django.utils.translation import ugettext_lazy as _
IDEASCUBE_PLACE_NAME = _("city")
COUNTRIES_FIRST = ['SY', 'JO']
TIME_ZONE = 'Asia/Amman'
LANGUAGE_CODE = 'ar'
LOAN_DURATION = 14
MONITORING_ENTRY_EXPORT_FIELDS = ['serial', 'user_id', 'birth_year', 'ge... | """Ideaxbox for Zaatari, Jordan"""
from .idb_jor_azraq import * # noqa
ENTRY_ACTIVITY_CHOICES = []
| Make zaatari import from azraq | Make zaatari import from azraq
| Python | agpl-3.0 | ideascube/ideascube,ideascube/ideascube,ideascube/ideascube,ideascube/ideascube | <REPLACE_OLD> .idb <REPLACE_NEW> .idb_jor_azraq <REPLACE_END> <REPLACE_OLD> noqa
from django.utils.translation import ugettext_lazy as _
IDEASCUBE_PLACE_NAME <REPLACE_NEW> noqa
ENTRY_ACTIVITY_CHOICES <REPLACE_END> <REPLACE_OLD> _("city")
COUNTRIES_FIRST = ['SY', 'JO']
TIME_ZONE = 'Asia/Amman'
LANGUAGE_CODE = 'ar'
LOA... | Make zaatari import from azraq
"""Ideaxbox for Zaatari, Jordan"""
from .idb import * # noqa
from django.utils.translation import ugettext_lazy as _
IDEASCUBE_PLACE_NAME = _("city")
COUNTRIES_FIRST = ['SY', 'JO']
TIME_ZONE = 'Asia/Amman'
LANGUAGE_CODE = 'ar'
LOAN_DURATION = 14
MONITORING_ENTRY_EXPORT_FIELDS = ['seria... |
97f70e4d285a2ce231442f6544927671ca959c38 | Graphs/nodes_at_same_level.py | Graphs/nodes_at_same_level.py | import unittest
"""
Write a function to connect all adjacent nodes at same level in binary tree.
"""
class Node:
def __init__(self, key, left=None, right=None):
self.key = key
self.left = left
self.right = right
self.next_right = None
def connect_level(root):
if root is None... | Connect nodes at same level in binary tree | Connect nodes at same level in binary tree
| Python | mit | prathamtandon/g4gproblems | <REPLACE_OLD> <REPLACE_NEW> import unittest
"""
Write a function to connect all adjacent nodes at same level in binary tree.
"""
class Node:
def __init__(self, key, left=None, right=None):
self.key = key
self.left = left
self.right = right
self.next_right = None
def connect_leve... | Connect nodes at same level in binary tree
| |
b8f03556991cabab858bb31e5c8cb2f043ad14ce | packages/pcl-reference-assemblies.py | packages/pcl-reference-assemblies.py | import glob
import os
import shutil
class PCLReferenceAssembliesPackage(Package):
def __init__(self):
Package.__init__(self,
name='mono-pcl-profiles',
version='2013-10-23',
sources=['http://storage.bos.xamarin.com/mono-pcl/58/5825e... | import glob
import os
import shutil
class PCLReferenceAssembliesPackage(Package):
def __init__(self):
Package.__init__(self,
name='mono-pcl-profiles-2013-10-25',
version='2013-10-25',
sources=['http://storage.bos.xamarin.com/bot-pr... | Use a versioned filename for the PCL profiles. | Use a versioned filename for the PCL profiles.
| Python | mit | mono/bockbuild,mono/bockbuild | <REPLACE_OLD> name='mono-pcl-profiles',
version='2013-10-23',
sources=['http://storage.bos.xamarin.com/mono-pcl/58/5825e0404974d87799504a0df75ea4dca91f9bfe/mono-pcl-profiles.tar.gz'])
<REPLACE_NEW> name='mono-pcl-profiles-2013-10-25',
version='... | Use a versioned filename for the PCL profiles.
import glob
import os
import shutil
class PCLReferenceAssembliesPackage(Package):
def __init__(self):
Package.__init__(self,
name='mono-pcl-profiles',
version='2013-10-23',
sources=['... |
039f6fa4b26b747432138a8bf9e2754c6daafec3 | byceps/blueprints/api/decorators.py | byceps/blueprints/api/decorators.py | """
byceps.blueprints.api.decorators
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from functools import wraps
from typing import Optional
from flask import abort, request
from werkzeug.datastructures import WWWAuthenticate
fro... | """
byceps.blueprints.api.decorators
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from functools import wraps
from typing import Optional
from flask import abort, request
from werkzeug.datastructures import WWWAuthenticate
fro... | Add `invalid_token` error to `WWW-Authenticate` header if API token is suspended | Add `invalid_token` error to `WWW-Authenticate` header if API token is suspended
| Python | bsd-3-clause | homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps | <REPLACE_OLD> api_service
def <REPLACE_NEW> api_service
from ...services.authentication.api.transfer.models import ApiToken
def <REPLACE_END> <REPLACE_OLD> if not _has_valid_api_token():
<REPLACE_NEW> api_token = _find_valid_api_token()
if api_token is None:
<REPLACE_END> <REPLACE_OLD> www_authenticate=w... | Add `invalid_token` error to `WWW-Authenticate` header if API token is suspended
"""
byceps.blueprints.api.decorators
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from functools import wraps
from typing import Optional
from fl... |
5aa48facaf77d8fb6919c960659dfa41f3f1ad78 | fabfile.py | fabfile.py | import os
from fabric.api import *
def unit():
current_dir = os.path.dirname(__file__)
command = " ".join(["PYTHONPATH=$PYTHONPATH:%s/videolog" % current_dir,
"nosetests", "-s", "--verbose", "--with-coverage",
"--cover-package=videolog", "tests/unit/*"])
local(command)
| import os
from fabric.api import *
def clean():
current_dir = os.path.dirname(__file__)
local("find %s -name '*.pyc' -exec rm -f {} \;" % current_dir)
local("rm -rf %s/build" % current_dir)
def unit():
clean()
current_dir = os.path.dirname(__file__)
command = " ".join(["PYTHONPATH=$PYTHONPATH... | Add task clean() to remove *.pyc files | Add task clean() to remove *.pyc files
| Python | mit | rcmachado/pyvideolog | <INSERT> clean():
current_dir = os.path.dirname(__file__)
local("find %s -name '*.pyc' -exec rm -f {} \;" % current_dir)
local("rm -rf %s/build" % current_dir)
def <INSERT_END> <INSERT> clean()
<INSERT_END> <|endoftext|> import os
from fabric.api import *
def clean():
current_dir = os.path.dirnam... | Add task clean() to remove *.pyc files
import os
from fabric.api import *
def unit():
current_dir = os.path.dirname(__file__)
command = " ".join(["PYTHONPATH=$PYTHONPATH:%s/videolog" % current_dir,
"nosetests", "-s", "--verbose", "--with-coverage",
"--cover-package=videolog", "tests/unit/*"... |
40711777de24d30cfe771f172b221cfdf460d8eb | rng.py | rng.py | from random import randint
def get_random_number(start=1, end=10):
"""Generates and returns random number between :start: and :end:"""
return randint(start, end)
| def get_random_number(start=1, end=10):
"""https://xkcd.com/221/"""
return 4
| Revert "Fix python random number generator." | Revert "Fix python random number generator."
| Python | mit | 1yvT0s/illacceptanything,dushmis/illacceptanything,dushmis/illacceptanything,ultranaut/illacceptanything,caioproiete/illacceptanything,triggerNZ/illacceptanything,dushmis/illacceptanything,oneminot/illacceptanything,TheWhiteLlama/illacceptanything,ds84182/illacceptanything,caioproiete/illacceptanything,paladique/illacc... | <REPLACE_OLD> from random import randint
def <REPLACE_NEW> def <REPLACE_END> <REPLACE_OLD> """Generates and returns random number between :start: and :end:"""
<REPLACE_NEW> """https://xkcd.com/221/"""
<REPLACE_END> <REPLACE_OLD> randint(start, end)
<REPLACE_NEW> 4
<REPLACE_END> <|endoftext|> def get_random_number(... | Revert "Fix python random number generator."
from random import randint
def get_random_number(start=1, end=10):
"""Generates and returns random number between :start: and :end:"""
return randint(start, end)
|
5398a864449db0a1d6ec106ddb839fff3b6afcda | mopidy_frontpanel/frontend.py | mopidy_frontpanel/frontend.py | from __future__ import unicode_literals
import logging
from mopidy.core import CoreListener
import pykka
import .menu import BrowseMenu
import .painter import Painter
logger = logging.getLogger(__name__)
class FrontPanel(pykka.ThreadingActor, CoreListener):
def __init__(self, config, core):
super(Fron... | from __future__ import unicode_literals
import logging
from mopidy.core import CoreListener
import pykka
import .menu import BrowseMenu
import .painter import Painter
logger = logging.getLogger(__name__)
class FrontPanel(pykka.ThreadingActor, CoreListener):
def __init__(self, config, core):
super(Fron... | Handle playback changes in FrontPanel | Handle playback changes in FrontPanel
| Python | apache-2.0 | nick-bulleid/mopidy-frontpanel | <REPLACE_OLD> self.menu.handleInput(input)
<REPLACE_NEW> if (input == "play"):
pass
elif (input == "pause"):
pass
elif (input == "stop"):
pass
elif (input == "vol_up"):
pass
elif (input == "vol_down"):
pass
else:
... | Handle playback changes in FrontPanel
from __future__ import unicode_literals
import logging
from mopidy.core import CoreListener
import pykka
import .menu import BrowseMenu
import .painter import Painter
logger = logging.getLogger(__name__)
class FrontPanel(pykka.ThreadingActor, CoreListener):
def __init__(... |
017e7cae2aac65e405edf341c00a7052b8b13fa6 | minimal/ipython_notebook_config.py | minimal/ipython_notebook_config.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Configuration file for ipython-notebook.
c = get_config()
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8888
# Whether to trust or not X-Scheme/X-Forwarded-Proto and X-Real-Ip/X-Forwarded-
# For headerssent by the upstream reverse proxy... | Set up an IPython config for the minimal image | Set up an IPython config for the minimal image
| Python | bsd-3-clause | mjbright/docker-demo-images,danielballan/docker-demo-images,Zsailer/docker-jupyter-teaching,odewahn/docker-demo-images,modulexcite/docker-demo-images,parente/docker-demo-images,CognitiveScale/docker-demo-images,ericdill/docker-demo-images,pelucid/docker-demo-images,willjharmer/docker-demo-images,CognitiveScale/docker-d... | <INSERT> #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Configuration file for ipython-notebook.
c = get_config()
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8888
# Whether to trust or not X-Scheme/X-Forwarded-Proto and X-Real-Ip/X-Forwarded-
# For headerssent by the upstream reve... | Set up an IPython config for the minimal image
| |
e4dd679f20a066c86a87a42199f66b288a314fcf | scons-tools/gmcs.py | scons-tools/gmcs.py | import os.path
import SCons.Builder
import SCons.Node.FS
import SCons.Util
csccom = "$CSC $CSCFLAGS $_CSCLIBPATH -r:$_CSCLIBS -out:${TARGET.abspath} $SOURCES"
csclibcom = "$CSC -t:library $CSCLIBFLAGS $_CSCLIBPATH $_CSCLIBS -out:${TARGET.abspath} $SOURCES"
McsBuilder = SCons.Builder.Builder(action = '$CSCCOM',
... | import os.path
import SCons.Builder
import SCons.Node.FS
import SCons.Util
csccom = "$CSC $CSCFLAGS $_CSCLIBPATH -r:$_CSCLIBS -out:${TARGET.abspath} $SOURCES"
csclibcom = "$CSC -t:library $CSCLIBFLAGS $_CSCLIBPATH $_CSCLIBS -out:${TARGET.abspath} $SOURCES"
McsBuilder = SCons.Builder.Builder(action = '$CSCCOM',
... | Use -platform:anycpu while compiling .NET assemblies | Use -platform:anycpu while compiling .NET assemblies | Python | lgpl-2.1 | eyecreate/tapcfg,juhovh/tapcfg,zhanleewo/tapcfg,eyecreate/tapcfg,zhanleewo/tapcfg,juhovh/tapcfg,juhovh/tapcfg,zhanleewo/tapcfg,eyecreate/tapcfg,zhanleewo/tapcfg,juhovh/tapcfg,zhanleewo/tapcfg,juhovh/tapcfg,eyecreate/tapcfg,eyecreate/tapcfg,juhovh/tapcfg | <INSERT> <INSERT_END> <REPLACE_OLD> = SCons.Util.CLVar('')
<REPLACE_NEW> = SCons.Util.CLVar('-platform:anycpu')
env['CSCLIBFLAGS'] = SCons.Util.CLVar('-platform:anycpu')
<REPLACE_END> <INSERT> <INSERT_END> <INSERT> <INSERT_END> <|endoftext|> import os.path
import SCons.Builder
import SCons.Node.FS
import SCon... | Use -platform:anycpu while compiling .NET assemblies
import os.path
import SCons.Builder
import SCons.Node.FS
import SCons.Util
csccom = "$CSC $CSCFLAGS $_CSCLIBPATH -r:$_CSCLIBS -out:${TARGET.abspath} $SOURCES"
csclibcom = "$CSC -t:library $CSCLIBFLAGS $_CSCLIBPATH $_CSCLIBS -out:${TARGET.abspath} $SOURCES"
McsBuil... |
fc2aafecf45716067c5bf860a877be2dfca4b7d3 | satsolver/hamilton.py | satsolver/hamilton.py | #!/usr/bin/python
"""
Conversion of the Hamiltonian cycle problem to SAT.
"""
from boolean import *
def hamiltonian_cycle(l):
"""
Convert a directed graph to an instance of SAT that is satisfiable
precisely when the graph has a Hamiltonian cycle.
The graph is given as a list of ordered tuples repres... | Add a conversion from the Hamiltonian cycle problem to SAT | Add a conversion from the Hamiltonian cycle problem to SAT
| Python | mit | jaanos/LVR-2016,jaanos/LVR-2016 | <REPLACE_OLD> <REPLACE_NEW> #!/usr/bin/python
"""
Conversion of the Hamiltonian cycle problem to SAT.
"""
from boolean import *
def hamiltonian_cycle(l):
"""
Convert a directed graph to an instance of SAT that is satisfiable
precisely when the graph has a Hamiltonian cycle.
The graph is given as a ... | Add a conversion from the Hamiltonian cycle problem to SAT
| |
862753353a09400d0d99960ef2cd6d70fb9b4a7e | tests/top_destinations_tests.py | tests/top_destinations_tests.py | import unittest
import datetime
import json
import sys
sys.path.append('..')
import sabre_dev_studio
import sabre_dev_studio.sabre_exceptions as sabre_exceptions
'''
requires config.json in the same directory for api authentication
{
"sabre_client_id": -----,
"sabre_client_secret": -----
}
'''
class TestBasicTopD... | Add tests for top destinations | Add tests for top destinations
| Python | mit | Jamil/sabre_dev_studio | <REPLACE_OLD> <REPLACE_NEW> import unittest
import datetime
import json
import sys
sys.path.append('..')
import sabre_dev_studio
import sabre_dev_studio.sabre_exceptions as sabre_exceptions
'''
requires config.json in the same directory for api authentication
{
"sabre_client_id": -----,
"sabre_client_secret": ---... | Add tests for top destinations
| |
ed326fba4f44552eeb206f3c5af9ad6f5e89ca44 | localeurl/models.py | localeurl/models.py | from django.conf import settings
from django.core import urlresolvers
from django.utils import translation
from localeurl import utils
def reverse(*args, **kwargs):
reverse_kwargs = kwargs.get('kwargs', {})
locale = utils.supported_language(reverse_kwargs.pop('locale',
translation.get_language()))
... | from django.conf import settings
from django.core import urlresolvers
from django.utils import translation
from localeurl import utils
def reverse(*args, **kwargs):
reverse_kwargs = kwargs.get('kwargs', {})
if reverse_kwargs!=None:
locale = utils.supported_language(reverse_kwargs.pop('locale',
... | Handle situation when kwargs is None | Handle situation when kwargs is None
| Python | mit | eugena/django-localeurl | <INSERT> if reverse_kwargs!=None:
<INSERT_END> <INSERT> <INSERT_END> <INSERT> else:
locale = translation.get_language()
<INSERT_END> <|endoftext|> from django.conf import settings
from django.core import urlresolvers
from django.utils import translation
from localeurl import utils
def reverse(*... | Handle situation when kwargs is None
from django.conf import settings
from django.core import urlresolvers
from django.utils import translation
from localeurl import utils
def reverse(*args, **kwargs):
reverse_kwargs = kwargs.get('kwargs', {})
locale = utils.supported_language(reverse_kwargs.pop('locale',
... |
a84dde598297495fe6f0f8b233b3a3761b0df7d4 | tests/functional/test_warning.py | tests/functional/test_warning.py |
def test_environ(script, tmpdir):
"""$PYTHONWARNINGS was added in python2.7"""
demo = tmpdir.join('warnings_demo.py')
demo.write('''
from pip._internal.utils import deprecation
deprecation.install_warning_logger()
from logging import basicConfig
basicConfig()
from warnings import warn
warn("deprecated!",... | import textwrap
def test_environ(script, tmpdir):
"""$PYTHONWARNINGS was added in python2.7"""
demo = tmpdir.join('warnings_demo.py')
demo.write(textwrap.dedent('''
from logging import basicConfig
from pip._internal.utils import deprecation
deprecation.install_warning_logger()
... | Update test to check newer logic | Update test to check newer logic
| Python | mit | pypa/pip,pfmoore/pip,pypa/pip,pradyunsg/pip,rouge8/pip,xavfernandez/pip,pradyunsg/pip,rouge8/pip,xavfernandez/pip,xavfernandez/pip,rouge8/pip,sbidoul/pip,sbidoul/pip,techtonik/pip,techtonik/pip,techtonik/pip,pfmoore/pip | <REPLACE_OLD>
def <REPLACE_NEW> import textwrap
def <REPLACE_END> <REPLACE_OLD> demo.write('''
from <REPLACE_NEW> demo.write(textwrap.dedent('''
from logging import basicConfig
from <REPLACE_END> <REPLACE_OLD> deprecation
deprecation.install_warning_logger()
from logging import basicConfig
basicConf... | Update test to check newer logic
def test_environ(script, tmpdir):
"""$PYTHONWARNINGS was added in python2.7"""
demo = tmpdir.join('warnings_demo.py')
demo.write('''
from pip._internal.utils import deprecation
deprecation.install_warning_logger()
from logging import basicConfig
basicConfig()
from warnin... |
b202e1cc5e6c5aa65c3ed22ad1e78ec505fa36c4 | cmsplugin_rst/forms.py | cmsplugin_rst/forms.py | from cmsplugin_rst.models import RstPluginModel
from django import forms
help_text = '<a href="http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html">Reference</a>'
class RstPluginForm(forms.ModelForm):
body = forms.CharField(
widget=forms.Textarea(attrs={
'rows':... | from cmsplugin_rst.models import RstPluginModel
from django import forms
help_text = '<a href="http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html">Reference</a>'
class RstPluginForm(forms.ModelForm):
body = forms.CharField(
widget=forms.Textarea(attrs={
'rows':... | Add "fields" attribute to ModelForm. | Add "fields" attribute to ModelForm.
| Python | bsd-3-clause | pakal/cmsplugin-rst,ojii/cmsplugin-rst | <REPLACE_OLD> RstPluginModel <REPLACE_NEW> RstPluginModel
fields = ["name", "body"] <REPLACE_END> <|endoftext|> from cmsplugin_rst.models import RstPluginModel
from django import forms
help_text = '<a href="http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html">Reference</a>'
class RstPluginForm... | Add "fields" attribute to ModelForm.
from cmsplugin_rst.models import RstPluginModel
from django import forms
help_text = '<a href="http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html">Reference</a>'
class RstPluginForm(forms.ModelForm):
body = forms.CharField(
widget=forms.Textar... |
abf6af81b5f97ca6b6bb479adb1abfdf502d2a9b | utils/solve-all.py | utils/solve-all.py | import os
import subprocess
import sys
import time
paths = []
for path, dirs, files in os.walk('puzzles'):
for file in files:
paths.append(os.path.join(path, file))
for path in paths:
for method in ['human', 'hybrid']:
start = time.time()
try:
output = subprocess.check_outp... | Add a wrapper to solve all puzzles in ./puzzles and print out timings (timeout after a minute) | Add a wrapper to solve all puzzles in ./puzzles and print out timings (timeout after a minute)
| Python | bsd-3-clause | jpverkamp/takuzu | <INSERT> import os
import subprocess
import sys
import time
paths = []
for path, dirs, files in os.walk('puzzles'):
<INSERT_END> <INSERT> for file in files:
paths.append(os.path.join(path, file))
for path in paths:
for method in ['human', 'hybrid']:
start = time.time()
try:
... | Add a wrapper to solve all puzzles in ./puzzles and print out timings (timeout after a minute)
| |
ede7a27ca8862bdd1b9b0b7a113b80d055492ae1 | debexpo/config/__init__.py | debexpo/config/__init__.py | import os.path
import pylons
from paste.deploy import appconfig
def easy_app_init(ini_path):
ini_path = os.path.abspath(ini_path)
assert os.path.exists(ini_path)
# Initialize Pylons app
conf = appconfig('config:' + ini_path)
import debexpo.config.environment
pylons.config = debexpo.config.env... | Add a simple app initialization function since paster shell is busted | Add a simple app initialization function since paster shell is busted
| Python | mit | jonnylamb/debexpo,jadonk/debexpo,jonnylamb/debexpo,jonnylamb/debexpo,swvist/Debexpo,jadonk/debexpo,swvist/Debexpo,swvist/Debexpo,jadonk/debexpo | <INSERT> import os.path
import pylons
from paste.deploy import appconfig
def easy_app_init(ini_path):
<INSERT_END> <INSERT> ini_path = os.path.abspath(ini_path)
assert os.path.exists(ini_path)
# Initialize Pylons app
conf = appconfig('config:' + ini_path)
import debexpo.config.environment
pylo... | Add a simple app initialization function since paster shell is busted
| |
ba4a3caef1f361992aa7887d1f434510060d434f | hackingignores.py | hackingignores.py | #!/usr/bin/python3
import collections
import glob
# Run from openstack git org directory
# Format
# Rule: [repo]
result = collections.defaultdict(list)
for file in glob.glob("*/tox.ini"):
repo = file.split('/')[0]
with open(file) as f:
for line in f.readlines():
if line.startswith("igno... | Add code to track which hacking rules are ignored | Add code to track which hacking rules are ignored
| Python | apache-2.0 | jogo/hackingignores | <REPLACE_OLD> <REPLACE_NEW> #!/usr/bin/python3
import collections
import glob
# Run from openstack git org directory
# Format
# Rule: [repo]
result = collections.defaultdict(list)
for file in glob.glob("*/tox.ini"):
repo = file.split('/')[0]
with open(file) as f:
for line in f.readlines():
... | Add code to track which hacking rules are ignored
| |
46009d28e2b6285722287ccbeaa8d2f9c6c47fde | ldap_dingens/default_config.py | ldap_dingens/default_config.py | from datetime import timedelta
class DefaultConfiguration:
DEBUG = False
MAIL_SERVER = "localhost"
MAIL_PORT = 25
MAIL_USER = None
MAIL_PASSWORD = None
MAIL_CAFILE = None
INVITATION_SUBJECT = "Invitation to join the FSFW!"
TOKEN_BYTES = 5
TOKEN_LIFETIME = timedelta(days=7)
L... | from datetime import timedelta
class DefaultConfiguration:
DEBUG = False
MAIL_SERVER = "localhost"
MAIL_PORT = 25
MAIL_USER = None
MAIL_PASSWORD = None
MAIL_CAFILE = None
INVITATION_SUBJECT = "Invitation to join the FSFW!"
TOKEN_BYTES = 5
TOKEN_LIFETIME = timedelta(days=7)
L... | Remove pointless default values from DefaultConfiguration | Remove pointless default values from DefaultConfiguration
| Python | agpl-3.0 | fsfw-dresden/ldap-dingens,fsfw-dresden/ldap-dingens | <DELETE> #: Host name of the LDAP server
<DELETE_END> <REPLACE_OLD> "localhost"
#: str.format string to create a DN which refers to a user with a given
#: loginname
LDAP_USER_DN_FORMAT = "uid={loginname},ou=Account,dc=fsfw-dresden,dc=de"
#: the DN to bind to for admin activity (create new users, c... | Remove pointless default values from DefaultConfiguration
from datetime import timedelta
class DefaultConfiguration:
DEBUG = False
MAIL_SERVER = "localhost"
MAIL_PORT = 25
MAIL_USER = None
MAIL_PASSWORD = None
MAIL_CAFILE = None
INVITATION_SUBJECT = "Invitation to join the FSFW!"
TO... |
22ae3a2e9a236de61c078d234d920a3e6bc62d7b | pylisp/application/lispd/address_tree/ddt_container_node.py | pylisp/application/lispd/address_tree/ddt_container_node.py | '''
Created on 1 jun. 2013
@author: sander
'''
from .container_node import ContainerNode
class DDTContainerNode(ContainerNode):
pass
| '''
Created on 1 jun. 2013
@author: sander
'''
from .container_node import ContainerNode
class DDTContainerNode(ContainerNode):
'''
A ContainerNode that indicates that we are responsible for this part of
the DDT tree.
'''
| Add a bit of docs | Add a bit of docs
| Python | bsd-3-clause | steffann/pylisp | <REPLACE_OLD> pass
<REPLACE_NEW> '''
A ContainerNode that indicates that we are responsible for this part of
the DDT tree.
'''
<REPLACE_END> <|endoftext|> '''
Created on 1 jun. 2013
@author: sander
'''
from .container_node import ContainerNode
class DDTContainerNode(ContainerNode):
'''
A Contai... | Add a bit of docs
'''
Created on 1 jun. 2013
@author: sander
'''
from .container_node import ContainerNode
class DDTContainerNode(ContainerNode):
pass
|
c24a7287d0ac540d6ef6dcf353b06ee42aaa7a43 | serrano/decorators.py | serrano/decorators.py | from functools import wraps
from django.conf import settings
from django.http import HttpResponse
from django.contrib.auth import authenticate, login
def get_token(request):
return request.REQUEST.get('token', '')
def check_auth(func):
@wraps(func)
def inner(self, request, *args, **kwargs):
auth... | from functools import wraps
from django.conf import settings
from django.http import HttpResponse
from django.contrib.auth import authenticate, login
def get_token(request):
"Attempts to retrieve a token from the request."
if 'token' in request.REQUEST:
return request.REQUEST['token']
if 'HTTP_API... | Add support for extracting the token from request headers | Add support for extracting the token from request headers
Clients can now set the `Api-Token` header instead of supplying the
token as a GET or POST parameter. | Python | bsd-2-clause | chop-dbhi/serrano,rv816/serrano_night,rv816/serrano_night,chop-dbhi/serrano | <REPLACE_OLD> return request.REQUEST.get('token', '')
def <REPLACE_NEW> "Attempts to retrieve a token from the request."
if 'token' in request.REQUEST:
return request.REQUEST['token']
if 'HTTP_API_TOKEN' in request.META:
return request.META['HTTP_API_TOKEN']
return ''
def <REPLACE_END> <... | Add support for extracting the token from request headers
Clients can now set the `Api-Token` header instead of supplying the
token as a GET or POST parameter.
from functools import wraps
from django.conf import settings
from django.http import HttpResponse
from django.contrib.auth import authenticate, login
def get... |
83ed5ca9bc388dbe9b2d82510842a99b3a2e5ce7 | src/personalisation/middleware.py | src/personalisation/middleware.py | from personalisation.models import AbstractBaseRule, Segment
class SegmentMiddleware(object):
"""Middleware for testing and putting a user in a segment"""
def __init__(self, get_response=None):
self.get_response = get_response
def __call__(self, request):
segments = Segment.objects.all()... | from personalisation.models import AbstractBaseRule, Segment
class SegmentMiddleware(object):
"""Middleware for testing and putting a user in a segment"""
def __init__(self, get_response=None):
self.get_response = get_response
def __call__(self, request):
segments = Segment.objects.all()... | Create empty 'segments' object in session if none exists | Create empty 'segments' object in session if none exists
| Python | mit | LabD/wagtail-personalisation,LabD/wagtail-personalisation,LabD/wagtail-personalisation | <INSERT> if not request.session.get('segments'):
request.session['segments'] = []
<INSERT_END> <|endoftext|> from personalisation.models import AbstractBaseRule, Segment
class SegmentMiddleware(object):
"""Middleware for testing and putting a user in a segment"""
def __init__(self, get_r... | Create empty 'segments' object in session if none exists
from personalisation.models import AbstractBaseRule, Segment
class SegmentMiddleware(object):
"""Middleware for testing and putting a user in a segment"""
def __init__(self, get_response=None):
self.get_response = get_response
def __call_... |
35f41aa03285180e380274ba95e882906f4cbbc8 | setup.py | setup.py | import os
import sys
import re
from setuptools import setup, find_packages
v = open(os.path.join(os.path.dirname(__file__), 'dogpile', 'cache', '__init__.py'))
VERSION = re.compile(r".*__version__ = '(.*?)'", re.S).match(v.read()).group(1)
v.close()
readme = os.path.join(os.path.dirname(__file__), 'README.rst')
set... | import os
import sys
import re
from setuptools import setup, find_packages
v = open(os.path.join(os.path.dirname(__file__), 'dogpile', 'cache', '__init__.py'))
VERSION = re.compile(r".*__version__ = '(.*?)'", re.S).match(v.read()).group(1)
v.close()
readme = os.path.join(os.path.dirname(__file__), 'README.rst')
set... | Add missing test Mako test dependency. | Add missing test Mako test dependency.
| Python | bsd-3-clause | thruflo/dogpile.cache,thruflo/dogpile.cache | <REPLACE_OLD> 'mock'],
)
<REPLACE_NEW> 'mock', 'Mako'],
)
<REPLACE_END> <|endoftext|> import os
import sys
import re
from setuptools import setup, find_packages
v = open(os.path.join(os.path.dirname(__file__), 'dogpile', 'cache', '__init__.py'))
VERSION = re.compile(r".*__version__ = '(.*?)'", re.S).match(v.read())... | Add missing test Mako test dependency.
import os
import sys
import re
from setuptools import setup, find_packages
v = open(os.path.join(os.path.dirname(__file__), 'dogpile', 'cache', '__init__.py'))
VERSION = re.compile(r".*__version__ = '(.*?)'", re.S).match(v.read()).group(1)
v.close()
readme = os.path.join(os.pa... |
5c435749b043f0605e9d1b5279a5a8fd4a5a1c25 | pyfolio/tests/test_nbs.py | pyfolio/tests/test_nbs.py | #!/usr/bin/env python
"""
simple example script for running notebooks and reporting exceptions.
Usage: `checkipnb.py foo.ipynb [bar.ipynb [...]]`
Each cell is submitted to the kernel, and checked for errors.
"""
import os
import glob
from runipy.notebook_runner import NotebookRunner
from IPython.nbformat.current impor... | #!/usr/bin/env python
"""
simple example script for running notebooks and reporting exceptions.
Usage: `checkipnb.py foo.ipynb [bar.ipynb [...]]`
Each cell is submitted to the kernel, and checked for errors.
"""
import os
import glob
from runipy.notebook_runner import NotebookRunner
from IPython.nbformat.current impor... | Make nb_tests for bayesian optional because PyMC3 is not a hard dependency | TST: Make nb_tests for bayesian optional because PyMC3 is not a hard dependency
| Python | apache-2.0 | ChinaQuants/pyfolio,chayapan/pyfolio,ChinaQuants/pyfolio,quantopian/pyfolio,YihaoLu/pyfolio,quantopian/pyfolio,femtotrader/pyfolio,femtotrader/pyfolio,YihaoLu/pyfolio | <REPLACE_OLD> glob.glob(path):
<REPLACE_NEW> glob.glob(path):
# See if bayesian is useable before we run a test
if ipynb.endswith('bayesian.ipynb'):
try:
import pyfolio.bayesian # NOQA
except:
continue
<REPLACE_END> <|endoftext|> #!/usr/bin/en... | TST: Make nb_tests for bayesian optional because PyMC3 is not a hard dependency
#!/usr/bin/env python
"""
simple example script for running notebooks and reporting exceptions.
Usage: `checkipnb.py foo.ipynb [bar.ipynb [...]]`
Each cell is submitted to the kernel, and checked for errors.
"""
import os
import glob
from... |
e89faebd357cc9c929950ef38cafc97524dee205 | setup.py | setup.py | from setuptools import setup, find_packages
import os
version = '0.1'
long_description = (
open('README.txt').read()
+ '\n' +
'Contributors\n'
'============\n'
+ '\n' +
open('CONTRIBUTORS.txt').read()
+ '\n' +
open('CHANGES.txt').read()
+ '\n')
requires = ['pyramid', 'PasteScript'... | from setuptools import setup, find_packages
import os
version = '0.1'
long_description = (
open('README.txt').read()
+ '\n' +
'Contributors\n'
'============\n'
+ '\n' +
open('CONTRIBUTORS.txt').read()
+ '\n' +
open('CHANGES.txt').read()
+ '\n')
requires = ['pyramid', 'PasteScript'... | Comment out numpy, scipy which cause problems in buildout | Comment out numpy, scipy which cause problems in buildout
| Python | apache-2.0 | mistio/mist.monitor,mistio/mist.monitor | <REPLACE_OLD> 'pymongo', <REPLACE_NEW> 'pymongo',]# <REPLACE_END> <|endoftext|> from setuptools import setup, find_packages
import os
version = '0.1'
long_description = (
open('README.txt').read()
+ '\n' +
'Contributors\n'
'============\n'
+ '\n' +
open('CONTRIBUTORS.txt').read()
+ '\n' +
... | Comment out numpy, scipy which cause problems in buildout
from setuptools import setup, find_packages
import os
version = '0.1'
long_description = (
open('README.txt').read()
+ '\n' +
'Contributors\n'
'============\n'
+ '\n' +
open('CONTRIBUTORS.txt').read()
+ '\n' +
open('CHANGES.txt... |
5e1272c7c442c759116d6f85fc587514ce97b667 | scripts/list-components.py | scripts/list-components.py | """Prints the names of components installed on a WMT executor."""
import os
import yaml
wmt_executor = os.environ['wmt_executor']
cfg_file = 'wmt-config-' + wmt_executor + '.yaml'
try:
with open(cfg_file, 'r') as fp:
cfg = yaml.safe_load(fp)
except IOError:
raise
components = cfg['components'].keys(... | Add script to print components installed on executor | Add script to print components installed on executor
It reads them from the YAML file output from `cmt-config`.
| Python | mit | csdms/wmt-metadata | <INSERT> """Prints the names of components installed on a WMT executor."""
import os
import yaml
wmt_executor = os.environ['wmt_executor']
cfg_file = 'wmt-config-' + wmt_executor + '.yaml'
try:
<INSERT_END> <INSERT> with open(cfg_file, 'r') as fp:
cfg = yaml.safe_load(fp)
except IOError:
raise
compon... | Add script to print components installed on executor
It reads them from the YAML file output from `cmt-config`.
| |
b65b0ed8d09d4a22164f16ed60f7c5b71d6f54db | setup.py | setup.py | import setuptools
from gitvendor.version import Version
from setuptools import find_packages
CLASSIFIERS = [
'Development Status :: 3 - Alpha',
'License :: OSI Approved :: MIT License',
'Environment :: Console',
'Topic :: Software Development'
]
setuptools.setup(name='git-vendor',
ver... | import setuptools
from gitvendor.version import Version
from setuptools import find_packages
CLASSIFIERS = [
'Development Status :: 3 - Alpha',
'License :: OSI Approved :: MIT License',
'Environment :: Console',
'Topic :: Software Development'
]
setuptools.setup(name='git-vendor',
ver... | Move download_url and bump version | Move download_url and bump version
| Python | mit | chuckbutler/git-vendor | <REPLACE_OLD> version=Version('0.0.1').number,
<REPLACE_NEW> version=Version('0.0.3').number,
<REPLACE_END> <INSERT> download_url='https://github.com/chuckbutler/git-vendor/releases/',
<INSERT_END> <|endoftext|> import setuptools
from gitvendor.version import Version
from setuptools import find_packa... | Move download_url and bump version
import setuptools
from gitvendor.version import Version
from setuptools import find_packages
CLASSIFIERS = [
'Development Status :: 3 - Alpha',
'License :: OSI Approved :: MIT License',
'Environment :: Console',
'Topic :: Software Development'
]
setuptools.setup(nam... |
96421cfe9711c77fb27a028d8e942bffd3059dd3 | project/api/urls.py | project/api/urls.py | from project.api.views import ChannelViewSet, MessageViewSet, UserViewSet
from django.conf.urls import url, include
from rest_framework.authtoken import views
from rest_framework.routers import DefaultRouter
from rest_framework.schemas import get_schema_view
from rest_framework.authtoken import views
schema_view = ge... | from project.api.views import ChannelViewSet, MessageViewSet, UserViewSet
from django.conf.urls import url, include
from rest_framework.authtoken import views
from rest_framework.routers import DefaultRouter
from rest_framework.schemas import get_schema_view
from rest_framework.authtoken import views
schema_view = ge... | Fix regex for registration url | Fix regex for registration url
| Python | mit | djstein/messages-grailed | <REPLACE_OLD> url(r'^registration/$', <REPLACE_NEW> url(r'^registration/', <REPLACE_END> <|endoftext|> from project.api.views import ChannelViewSet, MessageViewSet, UserViewSet
from django.conf.urls import url, include
from rest_framework.authtoken import views
from rest_framework.routers import DefaultRouter
from rest... | Fix regex for registration url
from project.api.views import ChannelViewSet, MessageViewSet, UserViewSet
from django.conf.urls import url, include
from rest_framework.authtoken import views
from rest_framework.routers import DefaultRouter
from rest_framework.schemas import get_schema_view
from rest_framework.authtoken... |
4ce1742472fc636aebd176a33b5fa7a819713fe7 | setup.py | setup.py | import re
from setuptools import setup
_versionRE = re.compile(r'__version__\s*=\s*\"([^\"]+)\"')
# read the version number for the settings file
with open('lib/glyphConstruction.py', "r") as settings:
code = settings.read()
found = _versionRE.search(code)
assert found is not None, "glyphConstruction __ver... | import re
from setuptools import setup
_versionRE = re.compile(r'__version__\s*=\s*\"([^\"]+)\"')
# read the version number for the settings file
with open('Lib/glyphConstruction.py', "r") as settings:
code = settings.read()
found = _versionRE.search(code)
assert found is not None, "glyphConstruction __ver... | Fix case of file path | Fix case of file path
It is impossible to build/install this on Linux with this path broken because
all file systems are case sensitive. I'll assume this only slipped by because
it was only ever tested on Windows or another case insensitive filesystem. | Python | mit | typemytype/GlyphConstruction,moyogo/glyphconstruction,moyogo/glyphconstruction,typemytype/GlyphConstruction | <REPLACE_OLD> open('lib/glyphConstruction.py', <REPLACE_NEW> open('Lib/glyphConstruction.py', <REPLACE_END> <|endoftext|> import re
from setuptools import setup
_versionRE = re.compile(r'__version__\s*=\s*\"([^\"]+)\"')
# read the version number for the settings file
with open('Lib/glyphConstruction.py', "r") as setti... | Fix case of file path
It is impossible to build/install this on Linux with this path broken because
all file systems are case sensitive. I'll assume this only slipped by because
it was only ever tested on Windows or another case insensitive filesystem.
import re
from setuptools import setup
_versionRE = re.compile(... |
8032fd5bf99b7c235e75617b45c77e38dcba4ec7 | core/migrations/0023_alter_homepage_featured_section_integer_block.py | core/migrations/0023_alter_homepage_featured_section_integer_block.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import wagtail.wagtailcore.fields
import wagtail.wagtailcore.blocks
import wagtail.wagtailimages.blocks
import wagtail.wagtailimages.models
class Migration(migrations.Migration):
dependencies = [
('c... | Add migration for homepage featured-section integer_block | Add migration for homepage featured-section integer_block
| Python | bsd-3-clause | PARINetwork/pari,PARINetwork/pari,PARINetwork/pari,PARINetwork/pari | <INSERT> # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import wagtail.wagtailcore.fields
import wagtail.wagtailcore.blocks
import wagtail.wagtailimages.blocks
import wagtail.wagtailimages.models
class Migration(migrations.Migration):
<INSERT_END> <INSERT> ... | Add migration for homepage featured-section integer_block
| |
39228ca69262511b1d0efbfc437dda19c097d530 | logger.py | logger.py | from time import strftime
"""logger.py: A simple logging module"""
__author__ = "Prajesh Ananthan"
def printDebug(text):
print(strftime('%d/%b/%Y %H:%M:%S DEBUG | {}'.format(text)))
def printInfo(text):
print(strftime('%d/%b/%Y %H:%M:%S INFO | {}'.format(text)))
def printWarning(text):
print(strftim... | from time import strftime
"""logger.py: A simple logging module"""
__author__ = "Prajesh Ananthan"
def DEBUG(text):
print(strftime('%d/%b/%Y %H:%M:%S DEBUG | {}'.format(text)))
def INFO(text):
print(strftime('%d/%b/%Y %H:%M:%S INFO | {}'.format(text)))
def WARNING(text):
print(strftime('%d/%b/%Y %H:... | Update on the method names | Update on the method names
| Python | mit | prajesh-ananthan/Tools | <REPLACE_OLD> printDebug(text):
<REPLACE_NEW> DEBUG(text):
<REPLACE_END> <REPLACE_OLD> printInfo(text):
<REPLACE_NEW> INFO(text):
<REPLACE_END> <REPLACE_OLD> printWarning(text):
<REPLACE_NEW> WARNING(text):
<REPLACE_END> <INSERT> {}'.format(text)))
def ERROR(text):
print(strftime('%d/%b/%Y %H:%M:%S ERROR | ... | Update on the method names
from time import strftime
"""logger.py: A simple logging module"""
__author__ = "Prajesh Ananthan"
def printDebug(text):
print(strftime('%d/%b/%Y %H:%M:%S DEBUG | {}'.format(text)))
def printInfo(text):
print(strftime('%d/%b/%Y %H:%M:%S INFO | {}'.format(text)))
def printWarn... |
8332dc01c3c743543f4c3faff44da84436ae5da2 | planner/forms.py | planner/forms.py | from django.contrib.auth.forms import AuthenticationForm
from django import forms
from django.core.validators import MinLengthValidator
from .models import PoolingUser
from users.forms import UserCreationForm
class LoginForm(AuthenticationForm):
username = forms.CharField(widget=forms.EmailInput(attrs={'placehold... | from django.contrib.auth.forms import AuthenticationForm
from django import forms
from django.core.validators import MinLengthValidator
from .models import PoolingUser, Trip, Step
from users.forms import UserCreationForm
class LoginForm(AuthenticationForm):
username = forms.CharField(widget=forms.EmailInput(attrs... | Add Trip and Step ModelForms | Add Trip and Step ModelForms
| Python | mit | livingsilver94/getaride,livingsilver94/getaride,livingsilver94/getaride | <REPLACE_OLD> PoolingUser
from <REPLACE_NEW> PoolingUser, Trip, Step
from <REPLACE_END> <INSERT> TripForm(forms.ModelForm):
class Meta:
model = Trip
fields = ['date_origin', 'max_num_passengers']
class StepForm(forms.ModelForm):
class Meta:
model = Step
fields = ['origin', 'des... | Add Trip and Step ModelForms
from django.contrib.auth.forms import AuthenticationForm
from django import forms
from django.core.validators import MinLengthValidator
from .models import PoolingUser
from users.forms import UserCreationForm
class LoginForm(AuthenticationForm):
username = forms.CharField(widget=form... |
aa9cb1bc1a04de4e4a4a787881123e2a60aaeb4e | docs/apps.py | docs/apps.py | import certifi
from django.apps import AppConfig
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from elasticsearch_dsl.connections import connections
class DocsConfig(AppConfig):
name = 'docs'
verbose_name = _('Documentation')
def ready(self):
super(DocsC... | import certifi
from django.apps import AppConfig
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from elasticsearch_dsl.connections import connections
class DocsConfig(AppConfig):
name = 'docs'
verbose_name = _('Documentation')
def ready(self):
super(DocsC... | Increase the ES timeout to 1 minute. | Increase the ES timeout to 1 minute.
| Python | bsd-3-clause | rmoorman/djangoproject.com,hassanabidpk/djangoproject.com,relekang/djangoproject.com,django/djangoproject.com,khkaminska/djangoproject.com,django/djangoproject.com,hassanabidpk/djangoproject.com,gnarf/djangoproject.com,vxvinh1511/djangoproject.com,xavierdutreilh/djangoproject.com,hassanabidpk/djangoproject.com,django/d... | <INSERT> 'timeout': 60.0,
<INSERT_END> <|endoftext|> import certifi
from django.apps import AppConfig
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from elasticsearch_dsl.connections import connections
class DocsConfig(AppConfig):
name = 'docs'
verbos... | Increase the ES timeout to 1 minute.
import certifi
from django.apps import AppConfig
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from elasticsearch_dsl.connections import connections
class DocsConfig(AppConfig):
name = 'docs'
verbose_name = _('Documentation')
... |
808fdc4351254c8f5b32d5997803562091121044 | cinderella/cinderella/settings/production.py | cinderella/cinderella/settings/production.py | from .base import *
DEBUG = False
ALLOWED_HOSTS = ['188.226.249.33', 'cinderella.li']
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': os.environ['DB_NAME'],
'USER': os.environ['DB_USER'],
'PASSWORD': os.environ['DB_PASSWORD'],
'HOST':... | from .base import *
DEBUG = False
ALLOWED_HOSTS = ['cinderella.li']
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': os.environ['DB_NAME'],
'USER': os.environ['DB_USER'],
'PASSWORD': os.environ['DB_PASSWORD'],
'HOST': '127.0.0.1',
... | Remove IP from allowed hosts | Remove IP from allowed hosts
| Python | mit | jasisz/cinderella,jasisz/cinderella | <REPLACE_OLD> ['188.226.249.33', 'cinderella.li']
DATABASES <REPLACE_NEW> ['cinderella.li']
DATABASES <REPLACE_END> <|endoftext|> from .base import *
DEBUG = False
ALLOWED_HOSTS = ['cinderella.li']
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': os.environ... | Remove IP from allowed hosts
from .base import *
DEBUG = False
ALLOWED_HOSTS = ['188.226.249.33', 'cinderella.li']
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': os.environ['DB_NAME'],
'USER': os.environ['DB_USER'],
'PASSWORD': os.environ['... |
967ed5fa4297bc4091a0474eab95f6b082c4bba2 | PythonWhiteLibrary/setup.py | PythonWhiteLibrary/setup.py | import distutils.sysconfig
from distutils.core import setup
setup(name = 'robotframework-whitelibrary',
version = '0.0.1',
description = 'Windows GUI testing library for Robot Framework',
author = 'SALabs',
url = 'https://github.com/Omenia/robotframework-whitelibrary... | import distutils.sysconfig
from distutils.core import setup
setup(name = 'robotframework-whitelibrary',
version = '0.0.1',
description = 'Windows GUI testing library for Robot Framework',
author = 'SALabs',
url = 'https://github.com/Omenia/robotframework-whitelibrary... | Revert "Trying to fix the path" | Revert "Trying to fix the path"
This reverts commit f89b139ba7e17af8bc7ca42a8cc9a3f821825454.
| Python | apache-2.0 | Omenia/robotframework-whitelibrary,Omenia/robotframework-whitelibrary | <REPLACE_OLD> ["../WhiteLibrary/bin/CSWhiteLibrary.dll"]},
<REPLACE_NEW> ["WhiteLibrary/bin/CSWhiteLibrary.dll"]},
<REPLACE_END> <|endoftext|> import distutils.sysconfig
from distutils.core import setup
setup(name = 'robotframework-whitelibrary',
version = '0.0.1',
description = 'Windows GUI... | Revert "Trying to fix the path"
This reverts commit f89b139ba7e17af8bc7ca42a8cc9a3f821825454.
import distutils.sysconfig
from distutils.core import setup
setup(name = 'robotframework-whitelibrary',
version = '0.0.1',
description = 'Windows GUI testing library for Robot Framework',
auth... |
b6b1117df271dae8adefa8cb8d3413b73fb393ce | touchpad_listener/touchpad_listener.py | touchpad_listener/touchpad_listener.py |
import serial
import sonic
sonic_pi = sonic.SonicPi()
connection = serial.Serial('/dev/tty.usbmodem1421', 115200)
while True:
line = connection.readline()
command, argument = line.strip().split(' ', 1)
if command == 'pad':
number = int(argument)
sonic_pi.run('cue :pad, number: {}'.format... |
import serial
import sonic
import glob
sonic_pi = sonic.SonicPi()
connection = serial.Serial(glob.glob('/dev/tty.usbmodem*')[0], 115200)
while True:
line = connection.readline()
command, argument = line.strip().split(' ', 1)
if command == 'pad':
number = int(argument)
sonic_pi.run('cue :... | Use `glob` to find an appropriate serial ttry | Use `glob` to find an appropriate serial ttry | Python | bsd-2-clause | CoderDojoScotland/coderdojo-sequencer,jonathanhogg/coderdojo-sequencer | <REPLACE_OLD> sonic
sonic_pi <REPLACE_NEW> sonic
import glob
sonic_pi <REPLACE_END> <REPLACE_OLD> serial.Serial('/dev/tty.usbmodem1421', <REPLACE_NEW> serial.Serial(glob.glob('/dev/tty.usbmodem*')[0], <REPLACE_END> <|endoftext|>
import serial
import sonic
import glob
sonic_pi = sonic.SonicPi()
connection = seria... | Use `glob` to find an appropriate serial ttry
import serial
import sonic
sonic_pi = sonic.SonicPi()
connection = serial.Serial('/dev/tty.usbmodem1421', 115200)
while True:
line = connection.readline()
command, argument = line.strip().split(' ', 1)
if command == 'pad':
number = int(argument)
... |
2a1f1ca653fcd0a8fbaa465ba664da0a1ede6306 | simuvex/s_run.py | simuvex/s_run.py | #!/usr/bin/env python
from .s_ref import RefTypes
import s_options as o
class SimRun:
def __init__(self, options = None, mode = None):
# the options and mode
if options is None:
options = o.default_options[mode]
self.options = options
self.mode = mode
self._exits = [ ]
self._refs = { }
self.option... | #!/usr/bin/env python
from .s_ref import RefTypes
import s_options as o
class SimRun(object):
def __init__(self, options = None, mode = None):
# the options and mode
if options is None:
options = o.default_options[mode]
self.options = options
self.mode = mode
self._exits = [ ]
self._refs = { }
sel... | Make SimRun a new-style Python class. | Make SimRun a new-style Python class.
| Python | bsd-2-clause | chubbymaggie/simuvex,iamahuman/angr,chubbymaggie/angr,chubbymaggie/simuvex,angr/angr,zhuyue1314/simuvex,schieb/angr,iamahuman/angr,angr/angr,tyb0807/angr,f-prettyland/angr,axt/angr,tyb0807/angr,f-prettyland/angr,chubbymaggie/angr,angr/angr,schieb/angr,iamahuman/angr,schieb/angr,tyb0807/angr,angr/simuvex,axt/angr,chubby... | <REPLACE_OLD> SimRun:
def <REPLACE_NEW> SimRun(object):
def <REPLACE_END> <|endoftext|> #!/usr/bin/env python
from .s_ref import RefTypes
import s_options as o
class SimRun(object):
def __init__(self, options = None, mode = None):
# the options and mode
if options is None:
options = o.default_options[mode]
... | Make SimRun a new-style Python class.
#!/usr/bin/env python
from .s_ref import RefTypes
import s_options as o
class SimRun:
def __init__(self, options = None, mode = None):
# the options and mode
if options is None:
options = o.default_options[mode]
self.options = options
self.mode = mode
self._exits ... |
bda42a4630e8b9e720443b6785ff2e3435bfdfa6 | pybaseball/team_results.py | pybaseball/team_results.py | import pandas as pd
import requests
from bs4 import BeautifulSoup
# TODO: raise error if year > current year or < first year of a team's existence
# TODO: team validation. return error if team does not exist.
# TODO: sanitize team inputs (force to all caps)
def get_soup(season, team):
# get most recent year's sched... | Add code for getting team schedule and game outcomes | Add code for getting team schedule and game outcomes
| Python | mit | jldbc/pybaseball | <REPLACE_OLD> <REPLACE_NEW> import pandas as pd
import requests
from bs4 import BeautifulSoup
# TODO: raise error if year > current year or < first year of a team's existence
# TODO: team validation. return error if team does not exist.
# TODO: sanitize team inputs (force to all caps)
def get_soup(season, team):
#... | Add code for getting team schedule and game outcomes
| |
bcd5ea69815405508d7f862754f910fe381172b9 | responsive/context_processors.py | responsive/context_processors.py | from django.core.exceptions import ImproperlyConfigured
from .conf import settings
from .utils import Device
def device(request):
responsive_middleware = 'responsive.middleware.ResponsiveMiddleware'
if responsive_middleware not in settings.MIDDLEWARE_CLASSES:
raise ImproperlyConfigured(
"... | from django.core.exceptions import ImproperlyConfigured
from .conf import settings
from .utils import Device
def device(request):
responsive_middleware = 'responsive.middleware.ResponsiveMiddleware'
if responsive_middleware not in settings.MIDDLEWARE_CLASSES:
raise ImproperlyConfigured(
"... | Update message for missing ResponsiveMiddleware | Update message for missing ResponsiveMiddleware
| Python | bsd-3-clause | mishbahr/django-responsive2,mishbahr/django-responsive2 | <REPLACE_OLD> "responsive context_processors requires <REPLACE_NEW> "You must enable <REPLACE_END> <REPLACE_OLD> responsive middleware to <REPLACE_NEW> 'ResponsiveMiddleware'. Edit your <REPLACE_END> <REPLACE_OLD> "be installed. Edit your MIDDLEWARE_CLASSES <REPLACE_NEW> "MIDDLEWARE_CLASSES <REPLACE_END> <|endoftext|>... | Update message for missing ResponsiveMiddleware
from django.core.exceptions import ImproperlyConfigured
from .conf import settings
from .utils import Device
def device(request):
responsive_middleware = 'responsive.middleware.ResponsiveMiddleware'
if responsive_middleware not in settings.MIDDLEWARE_CLASSES:
... |
89363fb720d259b60f9ec6d9872f59db1a28e14c | examples/Gauss_example.py | examples/Gauss_example.py | import sys
import time
import numpy as np
from abcpy.core import *
from abcpy.distributions import *
from distributed import Client
from dask.dot import dot_graph
from functools import partial
import matplotlib
import matplotlib.pyplot as plt
def normal_simu(n, mu, prng=None, latents=None):
if latents is None:
... | Add script variant of the Gauss example | Add script variant of the Gauss example
| Python | bsd-3-clause | lintusj1/elfi,elfi-dev/elfi,elfi-dev/elfi,HIIT/elfi,lintusj1/elfi | <REPLACE_OLD> <REPLACE_NEW> import sys
import time
import numpy as np
from abcpy.core import *
from abcpy.distributions import *
from distributed import Client
from dask.dot import dot_graph
from functools import partial
import matplotlib
import matplotlib.pyplot as plt
def normal_simu(n, mu, prng=None, latents=None... | Add script variant of the Gauss example
| |
37b175b6a6ac3f0fd7fdaa5c2ed6435c159a29c2 | py/optimal-division.py | py/optimal-division.py | from fractions import Fraction
class Solution(object):
def optimalDivision(self, nums):
"""
:type nums: List[int]
:rtype: str
"""
min_result, max_result = dict(), dict()
min_offset, max_offset = dict(), dict()
lnums = len(nums)
def print_ans(start, end... | Add py solution for 553. Optimal Division | Add py solution for 553. Optimal Division
553. Optimal Division: https://leetcode.com/problems/optimal-division/
Approach1
Bottom-up DP
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | <REPLACE_OLD> <REPLACE_NEW> from fractions import Fraction
class Solution(object):
def optimalDivision(self, nums):
"""
:type nums: List[int]
:rtype: str
"""
min_result, max_result = dict(), dict()
min_offset, max_offset = dict(), dict()
lnums = len(nums)
... | Add py solution for 553. Optimal Division
553. Optimal Division: https://leetcode.com/problems/optimal-division/
Approach1
Bottom-up DP
| |
689dd5cb67516fd091a69e39708b547c66f96750 | nap/dataviews/models.py | nap/dataviews/models.py |
from .fields import Field
from .views import DataView
from django.utils.six import with_metaclass
class MetaView(type):
def __new__(mcs, name, bases, attrs):
meta = attrs.get('Meta', None)
try:
model = meta.model
except AttributeError:
if name != 'ModelDataView'... |
from django.db.models.fields import NOT_PROVIDED
from django.utils.six import with_metaclass
from . import filters
from .fields import Field
from .views import DataView
# Map of ModelField name -> list of filters
FIELD_FILTERS = {
'DateField': [filters.DateFilter],
'TimeField': [filters.TimeFilter],
'Da... | Add Options class Add field filters lists Start proper model field introspection | Add Options class
Add field filters lists
Start proper model field introspection
| Python | bsd-3-clause | limbera/django-nap,MarkusH/django-nap | <INSERT> django.db.models.fields import NOT_PROVIDED
from django.utils.six import with_metaclass
from . import filters
from <INSERT_END> <REPLACE_OLD> DataView
from django.utils.six import with_metaclass
class <REPLACE_NEW> DataView
# Map of ModelField name -> list of filters
FIELD_FILTERS = {
'DateField': [f... | Add Options class
Add field filters lists
Start proper model field introspection
from .fields import Field
from .views import DataView
from django.utils.six import with_metaclass
class MetaView(type):
def __new__(mcs, name, bases, attrs):
meta = attrs.get('Meta', None)
try:
model ... |
189c7a7c982739cd7a3026e34a9969ea9278a12b | api/data/src/lib/middleware.py | api/data/src/lib/middleware.py | import os
import re
class SetBaseEnv(object):
"""
Figure out which port we are on if we are running and set it.
So that the links will be correct.
Not sure if we need this always...
"""
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request... | import os
class SetBaseEnv(object):
"""
Figure out which port we are on if we are running and set it.
So that the links will be correct.
Not sure if we need this always...
"""
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
... | Fix so we can do :5000 queries from api container | Fix so we can do :5000 queries from api container
| Python | mit | xeor/hohu,xeor/hohu,xeor/hohu,xeor/hohu | <REPLACE_OLD> os
import re
class <REPLACE_NEW> os
class <REPLACE_END> <REPLACE_OLD> os.environ.get('HTTP_PORT'):
<REPLACE_NEW> os.environ.get('HTTP_PORT') and ':' not in request.META['HTTP_HOST']:
<REPLACE_END> <|endoftext|> import os
class SetBaseEnv(object):
"""
Figure out which port we are on if we a... | Fix so we can do :5000 queries from api container
import os
import re
class SetBaseEnv(object):
"""
Figure out which port we are on if we are running and set it.
So that the links will be correct.
Not sure if we need this always...
"""
def __init__(self, get_response):
self.get_resp... |
c8360831ab2fa4d5af2929a85beca4a1f33ef9d1 | travis_settings.py | travis_settings.py | # Settings used for running tests in Travis
#
# Load default settings
# noinspection PyUnresolvedReferences
from settings import *
# Database
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'alexia_test', ... | # Settings used for running tests in Travis
#
# Load default settings
# noinspection PyUnresolvedReferences
from settings import *
# Database
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'alexia_test', ... | Use MySQL database backend in Travis CI. | Use MySQL database backend in Travis CI.
| Python | bsd-3-clause | Inter-Actief/alexia,Inter-Actief/alexia,Inter-Actief/alexia,Inter-Actief/alexia | <REPLACE_OLD> 'django.db.backends.sqlite3', <REPLACE_NEW> 'django.db.backends.mysql', <REPLACE_END> <REPLACE_OLD> '',
<REPLACE_NEW> 'travis',
<REPLACE_END> <|endoftext|> # Settings used for running tests in Travis
#
# Load default settings
# noinspection PyUnresolvedReferences
from settings import *
# Database
DATA... | Use MySQL database backend in Travis CI.
# Settings used for running tests in Travis
#
# Load default settings
# noinspection PyUnresolvedReferences
from settings import *
# Database
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle... |
9e9910346f7bacdc2a4fc2e92ecb8237bf38275e | plumbium/environment.py | plumbium/environment.py | """
plumbium.environment
====================
Module containing the get_environment function.
"""
import os
try:
import pip
except ImportError:
pass
import socket
def get_environment():
"""Obtain information about the executing environment.
Captures:
* installed Python packages using pip (i... | """
plumbium.environment
====================
Module containing the get_environment function.
"""
import os
try:
import pip
except ImportError:
pass
import socket
def get_environment():
"""Obtain information about the executing environment.
Captures:
* installed Python packages using pip (i... | Stop pylint complaining about bare-except | Stop pylint complaining about bare-except
| Python | mit | jstutters/Plumbium | <REPLACE_OLD> except:
<REPLACE_NEW> except: # pylint: disable=bare-except
<REPLACE_END> <|endoftext|> """
plumbium.environment
====================
Module containing the get_environment function.
"""
import os
try:
import pip
except ImportError:
pass
import socket
def get_environment():
"""Obtain inf... | Stop pylint complaining about bare-except
"""
plumbium.environment
====================
Module containing the get_environment function.
"""
import os
try:
import pip
except ImportError:
pass
import socket
def get_environment():
"""Obtain information about the executing environment.
Captures:
... |
bd243742f65a8fd92f4a773ce485cdc6f03f4a84 | kevin/leet/copy_list_with_random_pointers.py | kevin/leet/copy_list_with_random_pointers.py | """
https://leetcode.com/explore/challenge/card/february-leetcoding-challenge-2021/585/week-2-february-8th-february-14th/3635/
"""
class Node:
def __init__(self, x: int, next: 'Node'=None, random: 'Node'=None):
self.val = int(x)
self.next = next
self.random = random
class Solution:
def... | Add Copy List with Random Pointer LeetCode problem | Add Copy List with Random Pointer LeetCode problem
- No tests though
| Python | mit | kalyons11/kevin,kalyons11/kevin | <REPLACE_OLD> <REPLACE_NEW> """
https://leetcode.com/explore/challenge/card/february-leetcoding-challenge-2021/585/week-2-february-8th-february-14th/3635/
"""
class Node:
def __init__(self, x: int, next: 'Node'=None, random: 'Node'=None):
self.val = int(x)
self.next = next
self.random = ra... | Add Copy List with Random Pointer LeetCode problem
- No tests though
| |
52609334bdd25eb89dbc67b75921029c37babd63 | setup.py | setup.py | import os
import sys
from setuptools import setup
__author__ = 'Ryan McGrath <ryan@venodesigns.net>'
__version__ = '2.10.0'
packages = [
'twython',
'twython.streaming'
]
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()
setup(
# Basic package information.
na... | import os
import sys
from setuptools import setup
__author__ = 'Ryan McGrath <ryan@venodesigns.net>'
__version__ = '2.10.0'
packages = [
'twython',
'twython.streaming'
]
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()
setup(
# Basic package information.
na... | Update description and long description | Update description and long description
[ci skip]
| Python | mit | joebos/twython,Oire/twython,fibears/twython,Devyani-Divs/twython,Hasimir/twython,akarambir/twython,ping/twython,vivek8943/twython,ryanmcgrath/twython,Fueled/twython | <REPLACE_OLD> twython',
description='An easy (and up to date) way to access <REPLACE_NEW> twython stream',
description='Actively maintained, pure Python wrapper for the <REPLACE_END> <REPLACE_OLD> data with Python.',
long_description=open('README.rst').read(),
<REPLACE_NEW> API. Supports both normal and st... | Update description and long description
[ci skip]
import os
import sys
from setuptools import setup
__author__ = 'Ryan McGrath <ryan@venodesigns.net>'
__version__ = '2.10.0'
packages = [
'twython',
'twython.streaming'
]
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.ex... |
e14ceda6370b506b80f65d45abd36c9f728e5699 | pitchfork/manage_globals/forms.py | pitchfork/manage_globals/forms.py | # Copyright 2014 Dave Kludt
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | # Copyright 2014 Dave Kludt
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | Rework imports so not having to specify every type of field. Alter field definitions to reflect change | Rework imports so not having to specify every type of field. Alter field definitions to reflect change
| Python | apache-2.0 | rackerlabs/pitchfork,oldarmyc/pitchfork,rackerlabs/pitchfork,oldarmyc/pitchfork,rackerlabs/pitchfork,oldarmyc/pitchfork | <REPLACE_OLD> TextField, SelectField, IntegerField, BooleanField,\
PasswordField, TextAreaField, SubmitField, HiddenField, RadioField
from wtforms import <REPLACE_NEW> fields, <REPLACE_END> <REPLACE_OLD> TextField('Verb:', <REPLACE_NEW> fields.TextField('Verb:', <REPLACE_END> <REPLACE_OLD> BooleanField('Active:')
... | Rework imports so not having to specify every type of field. Alter field definitions to reflect change
# Copyright 2014 Dave Kludt
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# htt... |
79a1f426e22f3c213bbb081f4ca23ccf1a6f61d7 | openedx/core/djangoapps/content/block_structure/migrations/0005_trim_leading_slashes_in_data_path.py | openedx/core/djangoapps/content/block_structure/migrations/0005_trim_leading_slashes_in_data_path.py | """
Data migration to convert absolute paths in block_structure.data to be relative.
This has only been tested with MySQL, though it should also work for Postgres as
well. This is necessary to manually correct absolute paths in the "data" field
of the block_structure table. For S3 storage, having a path that starts wi... | Convert block_structure.data to relative paths (TNL-8335) | fix: Convert block_structure.data to relative paths (TNL-8335)
In order to upgrade to Django > 2.2.20, we can't continue to use
absolute paths in the block_structure's data FileField. This used to
work for S3, but it will not work going forward due to a security fix
in Django 2.2.21.
This data migration will remove t... | Python | agpl-3.0 | eduNEXT/edunext-platform,eduNEXT/edunext-platform,eduNEXT/edunext-platform,eduNEXT/edunext-platform | <REPLACE_OLD> <REPLACE_NEW> """
Data migration to convert absolute paths in block_structure.data to be relative.
This has only been tested with MySQL, though it should also work for Postgres as
well. This is necessary to manually correct absolute paths in the "data" field
of the block_structure table. For S3 storage,... | fix: Convert block_structure.data to relative paths (TNL-8335)
In order to upgrade to Django > 2.2.20, we can't continue to use
absolute paths in the block_structure's data FileField. This used to
work for S3, but it will not work going forward due to a security fix
in Django 2.2.21.
This data migration will remove t... | |
e308575d9723c90d3a15e5e8de45b0232c5d0b75 | parse_ast.py | parse_ast.py | """Parse python code into the abstract syntax tree and represent as JSON"""
from __future__ import print_function
import ast
from itertools import chain, count
import json
import sys
def dictify(obj):
if hasattr(obj, "__dict__"):
result = {k: dictify(v) for k, v in chain(obj.__dict__.items(), [("classname... | Add basic ast to json converter | Add basic ast to json converter
| Python | mit | RishiRamraj/wensleydale | <REPLACE_OLD> <REPLACE_NEW> """Parse python code into the abstract syntax tree and represent as JSON"""
from __future__ import print_function
import ast
from itertools import chain, count
import json
import sys
def dictify(obj):
if hasattr(obj, "__dict__"):
result = {k: dictify(v) for k, v in chain(obj._... | Add basic ast to json converter
| |
7f62587e099b9ef59731b6387030431b09f663f9 | bot_chucky/helpers.py | bot_chucky/helpers.py | """ Helper classes """
import facebook
import requests as r
class FacebookData:
def __init__(self, token):
"""
:param token: Facebook Page token
:param _api: Instance of the GraphAPI object
"""
self.token = token
self._api = facebook.GraphAPI(self.token)
def g... | """ Helper classes """
import facebook
import requests as r
class FacebookData:
def __init__(self, token):
"""
:param token: Facebook Page token
:param _api: Instance of the GraphAPI object
"""
self.token = token
self._api = facebook.GraphAPI(self.token)
def g... | Add StackOverFlowData, not completed yet | Add StackOverFlowData, not completed yet
| Python | mit | MichaelYusko/Bot-Chucky | <REPLACE_OLD> info
<REPLACE_NEW> info
class StackOverFlowData:
params = {}
def get_answer_by_title(self, title):
pass
<REPLACE_END> <|endoftext|> """ Helper classes """
import facebook
import requests as r
class FacebookData:
def __init__(self, token):
"""
:param token: Faceb... | Add StackOverFlowData, not completed yet
""" Helper classes """
import facebook
import requests as r
class FacebookData:
def __init__(self, token):
"""
:param token: Facebook Page token
:param _api: Instance of the GraphAPI object
"""
self.token = token
self._api ... |
e42c2f6607d59706358fbd0a81163d793d1bebfb | plumeria/plugins/server_control.py | plumeria/plugins/server_control.py | import asyncio
import io
import re
from plumeria.command import commands, CommandError
from plumeria.message import Message
from plumeria.message.image import read_image
from plumeria.perms import server_admins_only
from plumeria.transport.transport import ForbiddenError
@commands.register('icon set', category='Mana... | import asyncio
import io
import re
from plumeria.command import commands, CommandError
from plumeria.message import Message
from plumeria.message.image import read_image
from plumeria.perms import server_admins_only
from plumeria.transport.transport import ForbiddenError
@commands.register('icon set', category='Mana... | Fix typo in docs for /icon set. | Fix typo in docs for /icon set.
| Python | mit | sk89q/Plumeria,sk89q/Plumeria,sk89q/Plumeria | <REPLACE_OLD> set icon
<REPLACE_NEW> icon set
<REPLACE_END> <|endoftext|> import asyncio
import io
import re
from plumeria.command import commands, CommandError
from plumeria.message import Message
from plumeria.message.image import read_image
from plumeria.perms import server_admins_only
from plumeria.transport.t... | Fix typo in docs for /icon set.
import asyncio
import io
import re
from plumeria.command import commands, CommandError
from plumeria.message import Message
from plumeria.message.image import read_image
from plumeria.perms import server_admins_only
from plumeria.transport.transport import ForbiddenError
@commands.re... |
964da81ef5a90130a47ff726839798a7a7b716ef | buildcert.py | buildcert.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
from subprocess import call
from ca import app, db, mail
from ca.models import Request
from flask import Flask, render_template
from flask_mail import Message
def mail_certificate(id, email):
msg = Message('Freifunk Vpn03 Key', sender = 'no-reply@ca... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
from subprocess import call
from ca import app, db, mail
from ca.models import Request
from flask import Flask, render_template
from flask_mail import Message
def mail_certificate(id, email):
with app.app_context():
msg = Message('Freifunk V... | Add app.context() to populate context for render_template | Add app.context() to populate context for render_template
| Python | mit | freifunk-berlin/ca.berlin.freifunk.net,freifunk-berlin/ca.berlin.freifunk.net,freifunk-berlin/ca.berlin.freifunk.net | <INSERT> with app.app_context():
<INSERT_END> <INSERT> <INSERT_END> <INSERT> <INSERT_END> <INSERT> <INSERT_END> <INSERT> <INSERT_END> <|endoftext|> #!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
from subprocess import call
from ca import app, db, mail
from ca.models import Reque... | Add app.context() to populate context for render_template
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
from subprocess import call
from ca import app, db, mail
from ca.models import Request
from flask import Flask, render_template
from flask_mail import Message
def mail_certificate(id, email):
... |
08a7389e5be0d3f7a9e6c4e12b13f82da50480b1 | reference/gittaggers.py | reference/gittaggers.py | from setuptools.command.egg_info import egg_info
import subprocess
import time
class EggInfoFromGit(egg_info):
"""Tag the build with git commit timestamp.
If a build tag has already been set (e.g., "egg_info -b", building
from source package), leave it alone.
"""
def git_timestamp_tag(self):
... | from setuptools.command.egg_info import egg_info
import subprocess
import time
class EggInfoFromGit(egg_info):
"""Tag the build with git commit timestamp.
If a build tag has already been set (e.g., "egg_info -b", building
from source package), leave it alone.
"""
def git_timestamp_tag(self):
... | Fix Python packaging to use correct git log for package time/version stamps (2nd try) | Fix Python packaging to use correct git log for package time/version stamps (2nd try)
| Python | apache-2.0 | chapmanb/cwltool,brainstorm/common-workflow-language,curoverse/common-workflow-language,chapmanb/cwltool,hmenager/common-workflow-language,common-workflow-language/cwltool,foreveremain/common-workflow-language,StarvingMarvin/common-workflow-language,jeremiahsavage/cwltool,foreveremain/common-workflow-language,satra/com... | <REPLACE_OLD> '--format=format:%ct', '..']).strip()
<REPLACE_NEW> '--format=format:%ct']).strip()
<REPLACE_END> <|endoftext|> from setuptools.command.egg_info import egg_info
import subprocess
import time
class EggInfoFromGit(egg_info):
"""Tag the build with git commit timestamp.
If a build tag has already ... | Fix Python packaging to use correct git log for package time/version stamps (2nd try)
from setuptools.command.egg_info import egg_info
import subprocess
import time
class EggInfoFromGit(egg_info):
"""Tag the build with git commit timestamp.
If a build tag has already been set (e.g., "egg_info -b", building
... |
299aa432b3183e9db418f0735511330763c8141b | botbot/fileinfo.py | botbot/fileinfo.py | """File information"""
import os
import time
import pwd
import stat
import hashlib
from .config import CONFIG
def get_file_hash(path):
"""Get md5 hash of a file"""
def reader(fo):
"""Generator which feeds bytes to the md5 hasher"""
while True:
b = fo.read(128)
if len(b)... | """File information"""
import os
import pwd
import hashlib
from .config import CONFIG
def reader(fo):
"""Generator which feeds bytes to the md5 hasher"""
while True:
b = fo.read(128)
if len(b) > 0:
yield b
else:
raise StopIteration()
def get_file_hash(path):
... | Move reader() generator out of file hasher | Move reader() generator out of file hasher
| Python | mit | jackstanek/BotBot,jackstanek/BotBot | <DELETE> time
import <DELETE_END> <DELETE> stat
import <DELETE_END> <DELETE> get_file_hash(path):
"""Get md5 hash of a file"""
def <DELETE_END> <DELETE> <DELETE_END> <DELETE> <DELETE_END> <DELETE> <DELETE_END> <DELETE> <DELETE_END> <DELETE> <DELETE_END> <DELETE> <DELETE_END> <DELETE> ... | Move reader() generator out of file hasher
"""File information"""
import os
import time
import pwd
import stat
import hashlib
from .config import CONFIG
def get_file_hash(path):
"""Get md5 hash of a file"""
def reader(fo):
"""Generator which feeds bytes to the md5 hasher"""
while True:
... |
84acc00a3f6d09b4212b6728667af583b45e5a99 | km_api/know_me/tests/serializers/test_profile_list_serializer.py | km_api/know_me/tests/serializers/test_profile_list_serializer.py | from know_me import serializers
def test_serialize(profile_factory):
"""
Test serializing a profile.
"""
profile = profile_factory()
serializer = serializers.ProfileListSerializer(profile)
expected = {
'id': profile.id,
'name': profile.name,
'quote': profile.quote,
... | from know_me import serializers
def test_create(user_factory):
"""
Saving a serializer containing valid data should create a new
profile.
"""
user = user_factory()
data = {
'name': 'John',
'quote': "Hi, I'm John",
'welcome_message': 'This is my profile.',
}
ser... | Add test for creating profile from serializer. | Add test for creating profile from serializer.
| Python | apache-2.0 | knowmetools/km-api,knowmetools/km-api,knowmetools/km-api,knowmetools/km-api | <INSERT> test_create(user_factory):
"""
Saving a serializer containing valid data should create a new
profile.
"""
user = user_factory()
data = {
'name': 'John',
'quote': "Hi, I'm John",
'welcome_message': 'This is my profile.',
}
serializer = serializers.Profile... | Add test for creating profile from serializer.
from know_me import serializers
def test_serialize(profile_factory):
"""
Test serializing a profile.
"""
profile = profile_factory()
serializer = serializers.ProfileListSerializer(profile)
expected = {
'id': profile.id,
'name': p... |
9f95715cc7260d02d88781c208f6a6a167496015 | aiohttp_json_api/jsonpointer/__init__.py | aiohttp_json_api/jsonpointer/__init__.py | """
Extended JSONPointer from python-json-pointer_
==============================================
.. _python-json-pointer: https://github.com/stefankoegl/python-json-pointer
"""
import typing
from jsonpointer import JsonPointer as BaseJsonPointer
class JSONPointer(BaseJsonPointer):
def __init__(self, pointer):... | """
Extended JSONPointer from python-json-pointer_
==============================================
.. _python-json-pointer: https://github.com/stefankoegl/python-json-pointer
"""
import typing
from jsonpointer import JsonPointer as BaseJsonPointer
class JSONPointer(BaseJsonPointer):
def __init__(self, pointer):... | Fix bug with JSONPointer if part passed via __truediv__ is integer | Fix bug with JSONPointer if part passed via __truediv__ is integer
| Python | mit | vovanbo/aiohttp_json_api | <REPLACE_OLD> self.parts.copy()
<REPLACE_NEW> self.parts.copy()
if isinstance(path, int):
path = str(path)
<REPLACE_END> <|endoftext|> """
Extended JSONPointer from python-json-pointer_
==============================================
.. _python-json-pointer: https://github.com/stefankoegl/python... | Fix bug with JSONPointer if part passed via __truediv__ is integer
"""
Extended JSONPointer from python-json-pointer_
==============================================
.. _python-json-pointer: https://github.com/stefankoegl/python-json-pointer
"""
import typing
from jsonpointer import JsonPointer as BaseJsonPointer
... |
a3e537dc7e91785bb45bfe4d5a788c26d52653b1 | command_line/make_sphinx_html.py | command_line/make_sphinx_html.py | # LIBTBX_SET_DISPATCHER_NAME dev.xia2.make_sphinx_html
from __future__ import division
from libtbx import easy_run
import libtbx.load_env
import os.path as op
import shutil
import os
import sys
if (__name__ == "__main__") :
xia2_dir = libtbx.env.find_in_repositories("xia2", optional=False)
assert (xia2_dir is not... | # LIBTBX_SET_DISPATCHER_NAME dev.xia2.make_sphinx_html
from __future__ import division
import libtbx.load_env
from dials.util.procrunner import run_process
import shutil
import os
if (__name__ == "__main__") :
xia2_dir = libtbx.env.find_in_repositories("xia2", optional=False)
assert (xia2_dir is not None)
dest_... | Check make exit codes and stop on error | Check make exit codes and stop on error
| Python | bsd-3-clause | xia2/xia2,xia2/xia2 | <REPLACE_OLD> division
from libtbx <REPLACE_NEW> division
import libtbx.load_env
from dials.util.procrunner <REPLACE_END> <REPLACE_OLD> easy_run
import libtbx.load_env
import os.path as op
import <REPLACE_NEW> run_process
import <REPLACE_END> <REPLACE_OLD> os
import sys
if <REPLACE_NEW> os
if <REPLACE_END> <REPLACE_O... | Check make exit codes and stop on error
# LIBTBX_SET_DISPATCHER_NAME dev.xia2.make_sphinx_html
from __future__ import division
from libtbx import easy_run
import libtbx.load_env
import os.path as op
import shutil
import os
import sys
if (__name__ == "__main__") :
xia2_dir = libtbx.env.find_in_repositories("xia2", ... |
5997e30e05d51996345e3154c5495683e3229410 | app/taskqueue/celeryconfig.py | app/taskqueue/celeryconfig.py | # Copyright (C) 2014 Linaro Ltd.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distribute... | # Copyright (C) 2014 Linaro Ltd.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distribute... | Increase ack on broker to 4 hours. | Increase ack on broker to 4 hours.
Change-Id: I4a1f0fc6d1c07014896ef6b34336396d4b30bfdd
| Python | lgpl-2.1 | kernelci/kernelci-backend,joyxu/kernelci-backend,joyxu/kernelci-backend,joyxu/kernelci-backend,kernelci/kernelci-backend | <REPLACE_OLD> 10800,
<REPLACE_NEW> 60*60*4,
<REPLACE_END> <|endoftext|> # Copyright (C) 2014 Linaro Ltd.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# Lice... | Increase ack on broker to 4 hours.
Change-Id: I4a1f0fc6d1c07014896ef6b34336396d4b30bfdd
# Copyright (C) 2014 Linaro Ltd.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version... |
9658033dab279828975183f94f8c8641891f4ea9 | froide/helper/api_utils.py | froide/helper/api_utils.py | from collections import OrderedDict
from rest_framework.pagination import LimitOffsetPagination
from rest_framework.response import Response
from rest_framework.serializers import ListSerializer
from rest_framework.utils.serializer_helpers import ReturnDict
class CustomLimitOffsetPagination(LimitOffsetPagination):
... | from collections import OrderedDict
from rest_framework.pagination import LimitOffsetPagination
from rest_framework.response import Response
from rest_framework.serializers import ListSerializer
from rest_framework.utils.serializer_helpers import ReturnDict
class CustomLimitOffsetPagination(LimitOffsetPagination):
... | Add max limit to api pagination | Add max limit to api pagination | Python | mit | fin/froide,fin/froide,fin/froide,stefanw/froide,stefanw/froide,fin/froide,stefanw/froide,stefanw/froide,stefanw/froide | <INSERT> max_limit = 50
<INSERT_END> <|endoftext|> from collections import OrderedDict
from rest_framework.pagination import LimitOffsetPagination
from rest_framework.response import Response
from rest_framework.serializers import ListSerializer
from rest_framework.utils.serializer_helpers import ReturnDict
cla... | Add max limit to api pagination
from collections import OrderedDict
from rest_framework.pagination import LimitOffsetPagination
from rest_framework.response import Response
from rest_framework.serializers import ListSerializer
from rest_framework.utils.serializer_helpers import ReturnDict
class CustomLimitOffsetPagi... |
94d6ac50b4ce48aec51d5f32989d8d4aea938868 | {{cookiecutter.repo_name}}/setup.py | {{cookiecutter.repo_name}}/setup.py | import os
from setuptools import setup, find_packages
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name = "{{cookiecutter.repo_name}}",
version = "{{cookiecutter.version}}",
author = "{{cookiecutter.full_name}}",
author_email = "{{cookiecutter.email}}"... | import os
from setuptools import setup, find_packages
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name = "{{cookiecutter.repo_name}}",
version = "{{cookiecutter.version}}",
author = "{{cookiecutter.full_name}}",
author_email = "{{cookiecutter.email}}"... | Set up console script for main | Set up console script for main
| Python | mit | hackebrot/cookiedozer,hackebrot/cookiedozer | <INSERT> entry_points={
'console_scripts': [
'{{cookiecutter.repo_name}}={{cookiecutter.repo_name}}.main:main'
]
},
<INSERT_END> <|endoftext|> import os
from setuptools import setup, find_packages
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read(... | Set up console script for main
import os
from setuptools import setup, find_packages
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name = "{{cookiecutter.repo_name}}",
version = "{{cookiecutter.version}}",
author = "{{cookiecutter.full_name}}",
author_... |
48edfcddca89c506107035bd804fa536d3dec84d | geotrek/signage/migrations/0013_auto_20200423_1255.py | geotrek/signage/migrations/0013_auto_20200423_1255.py | # Generated by Django 2.0.13 on 2020-04-23 12:55
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('signage', '0012_auto_20200406_1411'),
]
operations = [
migrations.RemoveField(
model_name='bla... | # Generated by Django 2.0.13 on 2020-04-23 12:55
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('signage', '0012_auto_20200406_1411'),
]
operations = [
migrations.RunSQL(sql=[("DELETE FROM geotrek.signag... | Remove element with deleted=true before removefield | Remove element with deleted=true before removefield
| Python | bsd-2-clause | makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek | <INSERT> migrations.RunSQL(sql=[("DELETE FROM geotrek.signage_blade WHERE deleted=TRUE;", )]),
<INSERT_END> <|endoftext|> # Generated by Django 2.0.13 on 2020-04-23 12:55
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
... | Remove element with deleted=true before removefield
# Generated by Django 2.0.13 on 2020-04-23 12:55
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('signage', '0012_auto_20200406_1411'),
]
operations = [
... |
5e5e58b705d30df62423ec8bb6018c6807114580 | providers/io/osf/registrations/apps.py | providers/io/osf/registrations/apps.py | from share.provider import ProviderAppConfig
from .harvester import OSFRegistrationsHarvester
class AppConfig(ProviderAppConfig):
name = 'providers.io.osf.registrations'
version = '0.0.1'
title = 'osf_registrations'
long_title = 'Open Science Framework Registrations'
home_page = 'http://api.osf.io... | Add the app config for osf registrations | Add the app config for osf registrations
| Python | apache-2.0 | laurenbarker/SHARE,aaxelb/SHARE,aaxelb/SHARE,zamattiac/SHARE,zamattiac/SHARE,laurenbarker/SHARE,CenterForOpenScience/SHARE,laurenbarker/SHARE,aaxelb/SHARE,zamattiac/SHARE,CenterForOpenScience/SHARE,CenterForOpenScience/SHARE | <INSERT> from share.provider import ProviderAppConfig
from .harvester import OSFRegistrationsHarvester
class AppConfig(ProviderAppConfig):
<INSERT_END> <INSERT> name = 'providers.io.osf.registrations'
version = '0.0.1'
title = 'osf_registrations'
long_title = 'Open Science Framework Registrations'
... | Add the app config for osf registrations
| |
08d1db2f6031d3496309ae290e4d760269706d26 | meinberlin/config/settings/dev.py | meinberlin/config/settings/dev.py | from .base import *
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
for template_engine in TEMPLATES:
template_engine['OPTIONS']['debug'] = True
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'qid$h1o8&wh#p(j)lifis*5-rf@lbiy8%^3l4x%@b$z(tli@ab'
try... | from .base import *
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
for template_engine in TEMPLATES:
template_engine['OPTIONS']['debug'] = True
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'qid$h1o8&wh#p(j)lifis*5-rf@lbiy8%^3l4x%@b$z(tli@ab'
try... | Print tracebacks that happened in tasks | Print tracebacks that happened in tasks
| Python | agpl-3.0 | liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin | <REPLACE_OLD> pass
try:
<REPLACE_NEW> pass
LOGGING = {
'version': 1,
'handlers': {
'console': {
'class': 'logging.StreamHandler'},
},
'loggers': {'background_task': {'handlers': ['console'], 'level': 'INFO'}}}
try:
<REPLACE_END> <|endoftext|> ... | Print tracebacks that happened in tasks
from .base import *
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
for template_engine in TEMPLATES:
template_engine['OPTIONS']['debug'] = True
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'qid$h1o8&wh#p(j... |
0de3ca1439acec9191932a51e222aabc8b957047 | mosql/__init__.py | mosql/__init__.py | # -*- coding: utf-8 -*-
VERSION = (0, 11,)
__author__ = 'Mosky <http://mosky.tw>'
__version__ = '.'.join(str(v) for v in VERSION)
| # -*- coding: utf-8 -*-
VERSION = (0, 12,)
__author__ = 'Mosky <http://mosky.tw>'
__version__ = '.'.join(str(v) for v in VERSION)
| Change the version to v0.12 | Change the version to v0.12
| Python | mit | moskytw/mosql | <REPLACE_OLD> 11,)
__author__ <REPLACE_NEW> 12,)
__author__ <REPLACE_END> <|endoftext|> # -*- coding: utf-8 -*-
VERSION = (0, 12,)
__author__ = 'Mosky <http://mosky.tw>'
__version__ = '.'.join(str(v) for v in VERSION)
| Change the version to v0.12
# -*- coding: utf-8 -*-
VERSION = (0, 11,)
__author__ = 'Mosky <http://mosky.tw>'
__version__ = '.'.join(str(v) for v in VERSION)
|
ee4faf2e1a81fe400d818a5a7337cf562c968d2e | quantecon/common_messages.py | quantecon/common_messages.py | """
Warnings Module
===============
Contains a collection of warning messages for consistent package wide notifications
"""
#-Numba-#
numba_import_fail_message = "Numba import failed. Falling back to non-optimized routine." | """
Warnings Module
===============
Contains a collection of warning messages for consistent package wide notifications
"""
#-Numba-#
numba_import_fail_message = ("Numba import failed. Falling back to non-optimized routines.\n"
"This will reduce the overall performance of this package.\n... | Update warning message if numba import fails | Update warning message if numba import fails
| Python | bsd-3-clause | gxxjjj/QuantEcon.py,agutieda/QuantEcon.py,andybrnr/QuantEcon.py,oyamad/QuantEcon.py,QuantEcon/QuantEcon.py,andybrnr/QuantEcon.py,gxxjjj/QuantEcon.py,QuantEcon/QuantEcon.py,dingliumath/quant-econ,mgahsan/QuantEcon.py,jviada/QuantEcon.py,dingliumath/quant-econ,agutieda/QuantEcon.py,jviada/QuantEcon.py,mgahsan/QuantEcon.p... | <REPLACE_OLD> "Numba <REPLACE_NEW> ("Numba <REPLACE_END> <DELETE> <DELETE_END> <REPLACE_OLD> routine." <REPLACE_NEW> routines.\n"
"This will reduce the overall performance of this package.\n"
"To install please use the anaconda distribution.\n"
... | Update warning message if numba import fails
"""
Warnings Module
===============
Contains a collection of warning messages for consistent package wide notifications
"""
#-Numba-#
numba_import_fail_message = "Numba import failed. Falling back to non-optimized routine." |
3e0b015da6a2c9ef648e54959e6f3aab1509a036 | kippt_reader/settings/production.py | kippt_reader/settings/production.py | from os import environ
import dj_database_url
from .base import *
INSTALLED_APPS += (
'djangosecure',
)
PRODUCTION_MIDDLEWARE_CLASSES = (
'djangosecure.middleware.SecurityMiddleware',
)
MIDDLEWARE_CLASSES = PRODUCTION_MIDDLEWARE_CLASSES + MIDDLEWARE_CLASSES
DATABASES = {'default': dj_database_url.config(... | from os import environ
import dj_database_url
from .base import *
INSTALLED_APPS += (
'djangosecure',
)
PRODUCTION_MIDDLEWARE_CLASSES = (
'djangosecure.middleware.SecurityMiddleware',
)
MIDDLEWARE_CLASSES = PRODUCTION_MIDDLEWARE_CLASSES + MIDDLEWARE_CLASSES
DATABASES = {'default': dj_database_url.config(... | Add SECURE_REDIRECT_EXEMPT to old HTTP callbacks | Add SECURE_REDIRECT_EXEMPT to old HTTP callbacks | Python | mit | jpadilla/feedleap,jpadilla/feedleap | <REPLACE_OLD> 'https')
<REPLACE_NEW> 'https')
SECURE_REDIRECT_EXEMPT = [
'^(?!hub/).*'
]
<REPLACE_END> <|endoftext|> from os import environ
import dj_database_url
from .base import *
INSTALLED_APPS += (
'djangosecure',
)
PRODUCTION_MIDDLEWARE_CLASSES = (
'djangosecure.middleware.SecurityMiddleware',... | Add SECURE_REDIRECT_EXEMPT to old HTTP callbacks
from os import environ
import dj_database_url
from .base import *
INSTALLED_APPS += (
'djangosecure',
)
PRODUCTION_MIDDLEWARE_CLASSES = (
'djangosecure.middleware.SecurityMiddleware',
)
MIDDLEWARE_CLASSES = PRODUCTION_MIDDLEWARE_CLASSES + MIDDLEWARE_CLASSES... |
0d80c81bbc6280e13d1702a9df210980e5852174 | utils/clear_redis.py | utils/clear_redis.py | """Utility for clearing all keys out of redis -- do not use in production!"""
import sys
from optparse import OptionParser
import redis
def option_parser():
parser = OptionParser()
parser.add_option("-f", "--force",
action="store_true", dest="force", default=False,
... | Add utility for clearing out redis keys from tests. | Add utility for clearing out redis keys from tests.
| Python | bsd-3-clause | harrissoerja/vumi,TouK/vumi,harrissoerja/vumi,TouK/vumi,vishwaprakashmishra/xmatrix,harrissoerja/vumi,TouK/vumi,vishwaprakashmishra/xmatrix,vishwaprakashmishra/xmatrix | <REPLACE_OLD> <REPLACE_NEW> """Utility for clearing all keys out of redis -- do not use in production!"""
import sys
from optparse import OptionParser
import redis
def option_parser():
parser = OptionParser()
parser.add_option("-f", "--force",
action="store_true", dest="force", defaul... | Add utility for clearing out redis keys from tests.
| |
5c000543ce943619ea89b2443395a2ee10c49ee0 | solutions/beecrowd/1010/1010.py | solutions/beecrowd/1010/1010.py | import sys
s = 0.0
for line in sys.stdin:
a, b, c = line.split()
a, b, c = int(a), int(b), float(c)
s += c * b
print(f'VALOR A PAGAR: R$ {s:.2f}')
| import sys
s = 0.0
for line in sys.stdin:
_, b, c = line.split()
b, c = int(b), float(c)
s += c * b
print(f'VALOR A PAGAR: R$ {s:.2f}')
| Refactor python version of Simple Calculate | Refactor python version of Simple Calculate
| Python | mit | deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playgr... | <REPLACE_OLD> a, <REPLACE_NEW> _, <REPLACE_END> <DELETE> a, <DELETE_END> <DELETE> int(a), <DELETE_END> <|endoftext|> import sys
s = 0.0
for line in sys.stdin:
_, b, c = line.split()
b, c = int(b), float(c)
s += c * b
print(f'VALOR A PAGAR: R$ {s:.2f}')
| Refactor python version of Simple Calculate
import sys
s = 0.0
for line in sys.stdin:
a, b, c = line.split()
a, b, c = int(a), int(b), float(c)
s += c * b
print(f'VALOR A PAGAR: R$ {s:.2f}')
|
79cb9edf45ed77cdaa851e45d71f10c69db41221 | benchexec/tools/yogar-cbmc-parallel.py | benchexec/tools/yogar-cbmc-parallel.py | """
BenchExec is a framework for reliable benchmarking.
This file is part of BenchExec.
Copyright (C) 2007-2015 Dirk Beyer
All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
ht... | """
BenchExec is a framework for reliable benchmarking.
This file is part of BenchExec.
Copyright (C) 2007-2015 Dirk Beyer
All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
ht... | Add forgotten program file for deployment | Add forgotten program file for deployment
| Python | apache-2.0 | ultimate-pa/benchexec,sosy-lab/benchexec,sosy-lab/benchexec,sosy-lab/benchexec,dbeyer/benchexec,ultimate-pa/benchexec,ultimate-pa/benchexec,dbeyer/benchexec,ultimate-pa/benchexec,ultimate-pa/benchexec,sosy-lab/benchexec,ultimate-pa/benchexec,sosy-lab/benchexec,dbeyer/benchexec,dbeyer/benchexec,sosy-lab/benchexec | <INSERT> REQUIRED_PATHS = [
"yogar-cbmc"
]
<INSERT_END> <|endoftext|> """
BenchExec is a framework for reliable benchmarking.
This file is part of BenchExec.
Copyright (C) 2007-2015 Dirk Beyer
All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
... | Add forgotten program file for deployment
"""
BenchExec is a framework for reliable benchmarking.
This file is part of BenchExec.
Copyright (C) 2007-2015 Dirk Beyer
All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You... |
f4c8f003a4ffdd8e64468d261aa2cd34d58f1b9d | src/compdb/__init__.py | src/compdb/__init__.py | import warnings
from signac import *
msg = "compdb was renamed to signac. Please import signac in the future."
warnings.warn(DeprecationWarning, msg)
| import warnings
from signac import *
__all__ = ['core', 'contrib', 'db']
msg = "compdb was renamed to signac. Please import signac in the future."
print('Warning!',msg)
warnings.warn(msg, DeprecationWarning)
| Add surrogate compdb package, linking to signac. | Add surrogate compdb package, linking to signac.
Provided to guarantee compatibility.
Prints warning on import.
| Python | bsd-3-clause | csadorf/signac,csadorf/signac | <REPLACE_OLD> *
msg <REPLACE_NEW> *
__all__ = ['core', 'contrib', 'db']
msg <REPLACE_END> <REPLACE_OLD> future."
warnings.warn(DeprecationWarning, msg)
<REPLACE_NEW> future."
print('Warning!',msg)
warnings.warn(msg, DeprecationWarning)
<REPLACE_END> <|endoftext|> import warnings
from signac import *
__all__ = ['co... | Add surrogate compdb package, linking to signac.
Provided to guarantee compatibility.
Prints warning on import.
import warnings
from signac import *
msg = "compdb was renamed to signac. Please import signac in the future."
warnings.warn(DeprecationWarning, msg)
|
11c22561bd0475f9b58befd8bb47068c7c3a652a | api/players/management/commands/update_all_player_mmrs.py | api/players/management/commands/update_all_player_mmrs.py | import time
from datetime import timedelta
from django.core.management.base import BaseCommand, CommandError
from django.db.models import Q
from django.utils import timezone
from players.models import Player
class Command(BaseCommand):
def handle(self, *args, **options):
start_date = timezone.now() - ti... | Add management command to update all player MMRs | Add management command to update all player MMRs
| Python | apache-2.0 | prattl/teamfinder,prattl/teamfinder,prattl/teamfinder,prattl/teamfinder | <INSERT> import time
from datetime import timedelta
from django.core.management.base import BaseCommand, CommandError
from django.db.models import Q
from django.utils import timezone
from players.models import Player
class Command(BaseCommand):
<INSERT_END> <INSERT> def handle(self, *args, **options):
st... | Add management command to update all player MMRs
| |
ac9d87bf486f8062d1c2d8122e2dc5660546a22f | menpofit/clm/expert/base.py | menpofit/clm/expert/base.py | import numpy as np
from menpofit.math.correlationfilter import mccf, imccf
# TODO: document me!
class IncrementalCorrelationFilterThinWrapper(object):
r"""
"""
def __init__(self, cf_callable=mccf, icf_callable=imccf):
self.cf_callable = cf_callable
self.icf_callable = icf_callable
def... | Add dummy wrapper for correlation filters | Add dummy wrapper for correlation filters
| Python | bsd-3-clause | grigorisg9gr/menpofit,yuxiang-zhou/menpofit,yuxiang-zhou/menpofit,grigorisg9gr/menpofit | <REPLACE_OLD> <REPLACE_NEW> import numpy as np
from menpofit.math.correlationfilter import mccf, imccf
# TODO: document me!
class IncrementalCorrelationFilterThinWrapper(object):
r"""
"""
def __init__(self, cf_callable=mccf, icf_callable=imccf):
self.cf_callable = cf_callable
self.icf_cal... | Add dummy wrapper for correlation filters
| |
be2d33152c07594465c9b838c060edeaa8bc6ddc | tests/main.py | tests/main.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from ParseArticleReferenceTest import ParseArticleReferenceTest
from SortReferencesVisitorTest import SortReferencesVisitorTest
from ParseEditTest import ParseEditTest
from ParseAlineaReferenceTest import ParseAlineaReferenceTest
from ParseAlineaDefinition... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from ParseArticleReferenceTest import ParseArticleReferenceTest
from SortReferencesVisitorTest import SortReferencesVisitorTest
from ParseEditTest import ParseEditTest
from ParseAlineaReferenceTest import ParseAlineaReferenceTest
from ParseAlineaDefinition... | Fix broken reference to ParseSentenceDefinitionTest. | Fix broken reference to ParseSentenceDefinitionTest.
| Python | mit | Legilibre/duralex | <DELETE> ParseSentenceDefinitionTest import ParseSentenceDefinitionTest
from <DELETE_END> <|endoftext|> #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from ParseArticleReferenceTest import ParseArticleReferenceTest
from SortReferencesVisitorTest import SortReferencesVisitorTest
from ParseEditTest impor... | Fix broken reference to ParseSentenceDefinitionTest.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from ParseArticleReferenceTest import ParseArticleReferenceTest
from SortReferencesVisitorTest import SortReferencesVisitorTest
from ParseEditTest import ParseEditTest
from ParseAlineaReferenceTest impo... |
fb986717d5016b1cb3c6b953020ff2aff037b3dc | call_server/extensions.py | call_server/extensions.py | # define flask extensions in separate file, to resolve import dependencies
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
from flask_caching import Cache
cache = Cache()
from flask_assets import Environment
assets = Environment()
from flask_babel import Babel
babel = Babel()
from flask_mail import Mail
... | # define flask extensions in separate file, to resolve import dependencies
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
from flask_caching import Cache
cache = Cache()
from flask_assets import Environment
assets = Environment()
from flask_babel import Babel
babel = Babel()
from flask_mail import Mail
... | Include script-src unsafe-eval to allow underscore templating Long term, we should pre-compile with webpack to avoid needing this | Include script-src unsafe-eval to allow underscore templating
Long term, we should pre-compile with webpack to avoid needing this
| Python | agpl-3.0 | OpenSourceActivismTech/call-power,spacedogXYZ/call-power,18mr/call-congress,spacedogXYZ/call-power,spacedogXYZ/call-power,18mr/call-congress,OpenSourceActivismTech/call-power,OpenSourceActivismTech/call-power,spacedogXYZ/call-power,OpenSourceActivismTech/call-power,18mr/call-congress,18mr/call-congress | <INSERT> '\'unsafe-eval\'', <INSERT_END> <REPLACE_OLD> 'fonts.gstatic.com'],
}
talisman <REPLACE_NEW> 'fonts.gstatic.com'],
}
# unsafe-inline needed to render <script> tags without nonce
# unsafe-eval needed to run bootstrap templates
talisman <REPLACE_END> <|endoftext|> # define flask extensions in separate file, to r... | Include script-src unsafe-eval to allow underscore templating
Long term, we should pre-compile with webpack to avoid needing this
# define flask extensions in separate file, to resolve import dependencies
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
from flask_caching import Cache
cache = Cache()
from ... |
0e98d0fae4a81deec57ae162b8db5bcf950b3ea3 | cnxarchive/sql/migrations/20160128110515_mimetype_on_files_table.py | cnxarchive/sql/migrations/20160128110515_mimetype_on_files_table.py | # -*- coding: utf-8 -*-
"""\
- Add a ``media_type`` column to the ``files`` table.
- Move the mimetype value from ``module_files`` to ``files``.
"""
from __future__ import print_function
import sys
def up(cursor):
# Add a ``media_type`` column to the ``files`` table.
cursor.execute("ALTER TABLE files ADD COL... | Move mimetype column from module_files to files | Move mimetype column from module_files to files
| Python | agpl-3.0 | Connexions/cnx-archive,Connexions/cnx-archive | <REPLACE_OLD> <REPLACE_NEW> # -*- coding: utf-8 -*-
"""\
- Add a ``media_type`` column to the ``files`` table.
- Move the mimetype value from ``module_files`` to ``files``.
"""
from __future__ import print_function
import sys
def up(cursor):
# Add a ``media_type`` column to the ``files`` table.
cursor.execu... | Move mimetype column from module_files to files
| |
4cb1b6b8656d4e3893b3aa8fe5766b507afa6d24 | cmsplugin_rt/button/cms_plugins.py | cmsplugin_rt/button/cms_plugins.py | from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from cms.models.pluginmodel import CMSPlugin
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from models import *
bootstrap_module_name = _("Widgets")
layout_module_name = _("Layout elements")
ge... | from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from cms.models.pluginmodel import CMSPlugin
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from models import *
bootstrap_module_name = _("Widgets")
layout_module_name = _("Layout elements")
ge... | Make Button plugin usable inside Text plugin | Make Button plugin usable inside Text plugin
| Python | bsd-3-clause | RacingTadpole/cmsplugin-rt | <INSERT> text_enabled = True
<INSERT_END> <|endoftext|> from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from cms.models.pluginmodel import CMSPlugin
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from models import *
bootstrap_module_name... | Make Button plugin usable inside Text plugin
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from cms.models.pluginmodel import CMSPlugin
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from models import *
bootstrap_module_name = _("Widgets"... |
ee8acd5a476b0dcce9b79f70e4c70186ea4d5dc0 | miniutils.py | miniutils.py | import __builtin__
def any(it):
for obj in it:
if obj:
return True
def all(it):
for obj in it:
if not obj:
return False
return True
def max(it, key=None):
if key is not None:
k, value = max((key(value), value) for value in it)
return value
r... | import __builtin__
def any(it):
for obj in it:
if obj:
return True
return False
def all(it):
for obj in it:
if not obj:
return False
return True
def max(it, key=None):
if key is not None:
k, value = max((key(value), value) for value in it)
r... | Return an actual bool from any() | Return an actual bool from any()
| Python | bsd-2-clause | markflorisson/minivect,markflorisson/minivect | <REPLACE_OLD> True
def <REPLACE_NEW> True
return False
def <REPLACE_END> <|endoftext|> import __builtin__
def any(it):
for obj in it:
if obj:
return True
return False
def all(it):
for obj in it:
if not obj:
return False
return True
def max(it, key=None):
... | Return an actual bool from any()
import __builtin__
def any(it):
for obj in it:
if obj:
return True
def all(it):
for obj in it:
if not obj:
return False
return True
def max(it, key=None):
if key is not None:
k, value = max((key(value), value) for value... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.