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
a02ed17f79bba6e948c3b38d70ed6c2adbf1d0eb
py/tables.py
py/tables.py
import sqlalchemy import sqlalchemy.ext.declarative Base = sqlalchemy.ext.declarative.declarative_base() class Post(Base): __tablename__ = "posts" id = sqlalchemy.Column(sqlalchemy.Integer, primary_key = True) title = sqlalchemy.Column(sqlalchemy.String) body = sqlalchemy.Column(sqlalchemy.Text,) #Should be text...
import sqlalchemy import sqlalchemy.ext.declarative Base = sqlalchemy.ext.declarative.declarative_base() class Post(Base): __tablename__ = "posts" id = sqlalchemy.Column(sqlalchemy.Integer, primary_key = True) title = sqlalchemy.Column(sqlalchemy.String) body = sqlalchemy.Column(sqlalchemy.Text,) #Should be text...
Change type of time_posted to DATETIME and add author column
Change type of time_posted to DATETIME and add author column
Python
mit
ollien/Timpani,ollien/Timpani,ollien/Timpani
<REPLACE_OLD> sqlalchemy.Column(sqlalchemy.Time) class <REPLACE_NEW> sqlalchemy.Column(sqlalchemy.DateTime) author = sqlalchemy.Column(sqlalchemy.String) class <REPLACE_END> <|endoftext|> import sqlalchemy import sqlalchemy.ext.declarative Base = sqlalchemy.ext.declarative.declarative_base() class Post(Base): __t...
Change type of time_posted to DATETIME and add author column import sqlalchemy import sqlalchemy.ext.declarative Base = sqlalchemy.ext.declarative.declarative_base() class Post(Base): __tablename__ = "posts" id = sqlalchemy.Column(sqlalchemy.Integer, primary_key = True) title = sqlalchemy.Column(sqlalchemy.Strin...
3e2be4a8a597cfaa11b625eb6a94a4a18061df9b
readux/__init__.py
readux/__init__.py
__version_info__ = (1, 6, 1, None) # Dot-connect all but the last. Last is dash-connected if not None. __version__ = '.'.join([str(i) for i in __version_info__[:-1]]) if __version_info__[-1] is not None: __version__ += ('-%s' % (__version_info__[-1],)) # context processor to add version to the template environm...
__version_info__ = (1, 7, 0, 'dev') # Dot-connect all but the last. Last is dash-connected if not None. __version__ = '.'.join([str(i) for i in __version_info__[:-1]]) if __version_info__[-1] is not None: __version__ += ('-%s' % (__version_info__[-1],)) # context processor to add version to the template environ...
Update develop version to 1.7-dev since 1.6 is in production
Update develop version to 1.7-dev since 1.6 is in production
Python
apache-2.0
emory-libraries/readux,emory-libraries/readux,emory-libraries/readux
<REPLACE_OLD> 6, 1, None) # <REPLACE_NEW> 7, 0, 'dev') # <REPLACE_END> <|endoftext|> __version_info__ = (1, 7, 0, 'dev') # Dot-connect all but the last. Last is dash-connected if not None. __version__ = '.'.join([str(i) for i in __version_info__[:-1]]) if __version_info__[-1] is not None: __version__ += ('-%s...
Update develop version to 1.7-dev since 1.6 is in production __version_info__ = (1, 6, 1, None) # Dot-connect all but the last. Last is dash-connected if not None. __version__ = '.'.join([str(i) for i in __version_info__[:-1]]) if __version_info__[-1] is not None: __version__ += ('-%s' % (__version_info__[-1],))...
e2b5df2501571b51e4a37ee5b7c7f16ededd5995
astm/constants.py
astm/constants.py
# -*- coding: utf-8 -*- # # Copyright (C) 2012 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # #: :mod:`astm.protocol` base encoding. ENCODING = 'latin-1' #: Message start token. STX = b'\x02' #: M...
# -*- coding: utf-8 -*- # # Copyright (C) 2012 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # #: ASTM specification base encoding. ENCODING = 'latin-1' #: Message start token. STX = b'\x02' #: Mes...
Fix description about global ENCODING.
Fix description about global ENCODING.
Python
bsd-3-clause
tectronics/python-astm,Iskander1b/python-astm,eddiep1101/python-astm,andrexmd/python-astm,pombreda/python-astm,kxepal/python-astm,LogicalKnight/python-astm,123412345/python-astm,tinoshot/python-astm,MarcosHaenisch/python-astm,Alwnikrotikz/python-astm,asingla87/python-astm,mhaulo/python-astm,AlanZatarain/python-astm,bri...
<REPLACE_OLD> :mod:`astm.protocol` <REPLACE_NEW> ASTM specification <REPLACE_END> <|endoftext|> # -*- coding: utf-8 -*- # # Copyright (C) 2012 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # #: ASTM...
Fix description about global ENCODING. # -*- coding: utf-8 -*- # # Copyright (C) 2012 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # #: :mod:`astm.protocol` base encoding. ENCODING = 'latin-1' #:...
ffd4c52155acd7d04939e766ebe63171b580a2fa
src/__init__.py
src/__init__.py
import os import logging from kaa.base import ipc from client import * from server import * __all__ = [ 'connect' ] # connected client object _client = None def connect(epgdb, logfile='/tmp/kaa-epg.log', loglevel=logging.INFO): """ """ global _client # get server filename server = os.path.join(...
import os import logging from socket import gethostbyname, gethostname from kaa.base import ipc from client import * from server import * __all__ = [ 'connect', 'DEFAULT_EPG_PORT', 'GuideClient', 'GuideServer' ] # connected client object _client = None def connect(epgdb, address='127.0.0.1', logfile='/tmp/kaa-epg.l...
Add the ability to use inet socket as well.
Add the ability to use inet socket as well. git-svn-id: ffaf500d3baede20d2f41eac1d275ef07405e077@1236 a8f5125c-1e01-0410-8897-facf34644b8e
Python
lgpl-2.1
freevo/kaa-epg
<REPLACE_OLD> logging from <REPLACE_NEW> logging from socket import gethostbyname, gethostname from <REPLACE_END> <REPLACE_OLD> 'connect' <REPLACE_NEW> 'connect', 'DEFAULT_EPG_PORT', 'GuideClient', 'GuideServer' <REPLACE_END> <INSERT> address='127.0.0.1', <INSERT_END> <DELETE> # get server filename server = os.pa...
Add the ability to use inet socket as well. git-svn-id: ffaf500d3baede20d2f41eac1d275ef07405e077@1236 a8f5125c-1e01-0410-8897-facf34644b8e import os import logging from kaa.base import ipc from client import * from server import * __all__ = [ 'connect' ] # connected client object _client = None def connect(epgdb...
a28f6a45f37d906a9f9901d46d683c3ca5406da4
code/csv2map.py
code/csv2map.py
# csv2map.py -- Convert .csv into a .map format # Description of MAP format: http://pngu.mgh.harvard.edu/~purcell/plink/data.shtml#map # # jean-daniel.granet@mines-paristech.fr import sys import argparse def main(): parser = argparse.ArgumentParser(description='Convert .csv to .map') parser.add_argument('cs...
# csv2map.py -- Convert .csv into a .map format # Description of MAP format: http://pngu.mgh.harvard.edu/~purcell/plink/data.shtml#map # # jean-daniel.granet@mines-paristech.fr import sys import argparse def main(): parser = argparse.ArgumentParser(description='Convert .csv to .map') parser.add_argument('cs...
Add infos about MAP file
Add infos about MAP file
Python
mit
chagaz/sfan,chagaz/sfan,chagaz/sfan,chagaz/sfan,chagaz/sfan
<REPLACE_OLD> create') <REPLACE_NEW> create. Fields will be : num chromosome (1-22, X, Y or 0 if unplaced), snp identifier, Genetic distance (morgans) = 0, Base-pair position (bp units)') <REPLACE_END> <|endoftext|> # csv2map.py -- Convert .csv into a .map format # Description of MAP format: http://pngu.mgh.harvard...
Add infos about MAP file # csv2map.py -- Convert .csv into a .map format # Description of MAP format: http://pngu.mgh.harvard.edu/~purcell/plink/data.shtml#map # # jean-daniel.granet@mines-paristech.fr import sys import argparse def main(): parser = argparse.ArgumentParser(description='Convert .csv to .map') ...
21e76ae7d9e7679007d90e842e28df46a8c0fc97
itorch-runner.py
itorch-runner.py
# coding: utf-8 import sys, getopt import os import json import datetime from subprocess import call current_date = str(datetime.datetime.now()).replace(' ', '!') output_file_name = './tmp_itorch_exec-'+current_date+'.lua' if __name__ == "__main__": if len(sys.argv) > 0: input_file = open(sys.argv[1], 'r') wit...
# coding: utf-8 import sys, getopt import os import json import datetime from subprocess import call current_date = str(datetime.datetime.now()).replace(' ', '!') output_file_name = './tmp_itorch_exec-'+current_date+'.lua' if __name__ == "__main__": if len(sys.argv) > 0: input_file = open(sys.argv[1], 'r') wit...
Fix missing new line symbol for last line in notebook cell
Fix missing new line symbol for last line in notebook cell
Python
mit
AlexMili/itorch-runner
<REPLACE_OLD> 'code': <REPLACE_NEW> 'code' and len(item['source']) > 0: item['source'][-1] = item['source'][-1]+'\n' <REPLACE_END> <|endoftext|> # coding: utf-8 import sys, getopt import os import json import datetime from subprocess import call current_date = str(datetime.datetime.now()).replace(' ', '!'...
Fix missing new line symbol for last line in notebook cell # coding: utf-8 import sys, getopt import os import json import datetime from subprocess import call current_date = str(datetime.datetime.now()).replace(' ', '!') output_file_name = './tmp_itorch_exec-'+current_date+'.lua' if __name__ == "__main__": if len(...
5853c4449ff3e2ac04e96ab8c601609b4b24f267
flaskapp.py
flaskapp.py
import io import dont_tread_on_memes import flask app = flask.Flask(__name__) @app.route("/", defaults={"caption": "tread on"}) @app.route("/<caption>/") def main(caption): flag = dont_tread_on_memes.dont_me(caption) data = io.BytesIO() flag.save(data, "PNG") data.seek(0) return flask.send_file...
import io import dont_tread_on_memes import flask app = flask.Flask(__name__) @app.route("/", defaults={"caption": "tread on"}) @app.route("/<caption>/") def main(caption): # Color argument color = flask.request.args.get("color") if color is None: color = "black" # Allow disabling of forma...
Implement some URL parameter options
Implement some URL parameter options
Python
mit
controversial/dont-tread-on-memes
<INSERT> # Color argument color = flask.request.args.get("color") if color is None: color = "black" # Allow disabling of formatting should_format = flask.request.args.get("format") if should_format == "false": <INSERT_END> <REPLACE_OLD> dont_tread_on_memes.dont_me(caption) <REPLACE...
Implement some URL parameter options import io import dont_tread_on_memes import flask app = flask.Flask(__name__) @app.route("/", defaults={"caption": "tread on"}) @app.route("/<caption>/") def main(caption): flag = dont_tread_on_memes.dont_me(caption) data = io.BytesIO() flag.save(data, "PNG") d...
384cb60a488b03ac992c3496658c299f3393b807
tests/TestConfigFileLoading.py
tests/TestConfigFileLoading.py
import unittest import src import sys from io import StringIO class TestConfigFileLoading(unittest.TestCase): filepath_prefix = '' @classmethod def setUpClass(cls): if sys.argv[0].endswith('nosetests'): cls.filepath_prefix = "./resources/config/" else: cls.filepat...
import unittest import src import sys from io import StringIO class TestConfigFileLoading(unittest.TestCase): filepath_prefix = '' @classmethod def setUpClass(cls): if sys.argv[0].endswith('nosetests'): cls.filepath_prefix = "./resources/config/" else: cls.filepat...
Make test names lower case prefix
Make test names lower case prefix
Python
bsd-3-clause
sky-uk/bslint
<REPLACE_OLD> TestReadJsonCorrectly(self): <REPLACE_NEW> testReadJsonCorrectly(self): <REPLACE_END> <REPLACE_OLD> TestReadJsonBadFileName(self): <REPLACE_NEW> testReadJsonBadFileName(self): <REPLACE_END> <REPLACE_OLD> TestLoadConfigFileCheckRead(self): <REPLACE_NEW> testLoadConfigFileCheckRead(self): <REPLACE_END...
Make test names lower case prefix import unittest import src import sys from io import StringIO class TestConfigFileLoading(unittest.TestCase): filepath_prefix = '' @classmethod def setUpClass(cls): if sys.argv[0].endswith('nosetests'): cls.filepath_prefix = "./resources/config/" ...
42a43d6594efc21ab29ea079f758df5bd2ec3c41
Homeworks/HW1/Problem1.py
Homeworks/HW1/Problem1.py
"""Problem 1: Break math Break math using a computer. To be a bit more specific, demonstrate a numerical calculation using the computer language of your choice where the answer is demonstrably wrong. I'll want to see the code you used, preferably something brief and punchy, and then the result. For full credit, fix mat...
Add hw 1 problem 1 solution
Add hw 1 problem 1 solution
Python
mit
dankolbman/NumericalAnalysis
<INSERT> """Problem 1: Break math Break math using a computer. To be a bit more specific, demonstrate a numerical calculation using the computer language of your choice where the answer is demonstrably wrong. I'll want to see the code you used, preferably something brief and punchy, and then the result. For full credit...
Add hw 1 problem 1 solution
76d1930367418ffc01c9629b686557d0bd979f03
CodeFights/rockPaperScissors.py
CodeFights/rockPaperScissors.py
#!/usr/local/bin/python # Code Fights Rock Paper Scissors Problem from itertools import combinations def rockPaperScissors(players): return sorted([[b, a] for a, b in combinations(players, 2)] + [[a, b] for a, b in combinations(players, 2)]) def main(): tests = [ [ ["t...
Solve Code Fights rock paper scissors problem
Solve Code Fights rock paper scissors problem
Python
mit
HKuz/Test_Code
<REPLACE_OLD> <REPLACE_NEW> #!/usr/local/bin/python # Code Fights Rock Paper Scissors Problem from itertools import combinations def rockPaperScissors(players): return sorted([[b, a] for a, b in combinations(players, 2)] + [[a, b] for a, b in combinations(players, 2)]) def main(): tests ...
Solve Code Fights rock paper scissors problem
ba0a4aff1ea21670712b35061570805e62bb4159
Instanssi/admin_blog/forms.py
Instanssi/admin_blog/forms.py
# -*- coding: utf-8 -*- from django import forms from uni_form.helper import FormHelper from uni_form.layout import Submit, Layout, Fieldset, ButtonHolder from Instanssi.ext_blog.models import BlogEntry class BlogEntryForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(BlogEntryForm, self)._...
# -*- coding: utf-8 -*- from django import forms from uni_form.helper import FormHelper from uni_form.layout import Submit, Layout, Fieldset, ButtonHolder from Instanssi.ext_blog.models import BlogEntry class BlogEntryForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(BlogEntryForm, self)._...
Add date field to edit form.
admin_blog: Add date field to edit form.
Python
mit
Instanssi/Instanssi.org,Instanssi/Instanssi.org,Instanssi/Instanssi.org,Instanssi/Instanssi.org
<INSERT> 'date', <INSERT_END> <REPLACE_OLD> ('title','text','public') <REPLACE_NEW> ('title','text','public','date') <REPLACE_END> <|endoftext|> # -*- coding: utf-8 -*- from django import forms from uni_form.helper import FormHelper from uni_form.layout import Submit, Layout, Fieldset, ButtonHolder fro...
admin_blog: Add date field to edit form. # -*- coding: utf-8 -*- from django import forms from uni_form.helper import FormHelper from uni_form.layout import Submit, Layout, Fieldset, ButtonHolder from Instanssi.ext_blog.models import BlogEntry class BlogEntryForm(forms.ModelForm): def __init__(self, *args, **kwa...
7ac48c9a474f5a0edd10121f58442326d6e8d75c
backend/geonature/core/command/__init__.py
backend/geonature/core/command/__init__.py
import os import sys from geonature.core.command.main import main import geonature.core.command.create_gn_module # Load modules commands from geonature.utils.env import ROOT_DIR plugin_folder = os.path.join(str(ROOT_DIR), 'external_modules') sys.path.insert(0, os.path.join(plugin_folder)) for dirname in os.listdir(...
import os import sys from pathlib import Path from geonature.core.command.main import main import geonature.core.command.create_gn_module # Load modules commands from geonature.utils.env import ROOT_DIR def import_cmd(dirname): try: print("Import module {}".format(dirname)) module_cms = __impo...
TEST : gestion des exceptions de type FileNotFoundError lors de l'import des commandes d'un module
TEST : gestion des exceptions de type FileNotFoundError lors de l'import des commandes d'un module
Python
bsd-2-clause
PnEcrins/GeoNature,PnEcrins/GeoNature,PnEcrins/GeoNature,PnEcrins/GeoNature
<REPLACE_OLD> sys from <REPLACE_NEW> sys from pathlib import Path from <REPLACE_END> <REPLACE_OLD> ROOT_DIR plugin_folder <REPLACE_NEW> ROOT_DIR def import_cmd(dirname): try: print("Import module {}".format(dirname)) module_cms = __import__( "{}.backend.commands.geonature_cmd".forma...
TEST : gestion des exceptions de type FileNotFoundError lors de l'import des commandes d'un module import os import sys from geonature.core.command.main import main import geonature.core.command.create_gn_module # Load modules commands from geonature.utils.env import ROOT_DIR plugin_folder = os.path.join(str(ROOT_D...
f0251c2638f1242655b514eb4d8fddf16c655ad0
test/test_data_uri.py
test/test_data_uri.py
import os import unittest from node import data_uri TEST_TXT_FILE = "data_uri_test.txt" TEST_CONTENTS = "foo\n" class TestDataURI(unittest.TestCase): def setUp(self): with open(TEST_TXT_FILE, 'w') as f: f.write(TEST_CONTENTS) def tearDown(self): os.remove(TEST_TXT_FILE) def...
Add tests for data_uri module
Add tests for data_uri module Address reviewer comments
Python
mit
bglassy/OpenBazaar,bankonme/OpenBazaar,bankonme/OpenBazaar,atsuyim/OpenBazaar,rllola/OpenBazaar,NolanZhao/OpenBazaar,mirrax/OpenBazaar,bglassy/OpenBazaar,matiasbastos/OpenBazaar,habibmasuro/OpenBazaar,NolanZhao/OpenBazaar,saltduck/OpenBazaar,akhavr/OpenBazaar,mirrax/OpenBazaar,matiasbastos/OpenBazaar,NolanZhao/OpenBaza...
<REPLACE_OLD> <REPLACE_NEW> import os import unittest from node import data_uri TEST_TXT_FILE = "data_uri_test.txt" TEST_CONTENTS = "foo\n" class TestDataURI(unittest.TestCase): def setUp(self): with open(TEST_TXT_FILE, 'w') as f: f.write(TEST_CONTENTS) def tearDown(self): os.r...
Add tests for data_uri module Address reviewer comments
cb83a61df5ed82dd9af7ebd3c01d00a3d88e3491
infosystem/subsystem/domain/resource.py
infosystem/subsystem/domain/resource.py
from infosystem.database import db from infosystem.common.subsystem import entity class Domain(entity.Entity, db.Model): attributes = ['active', 'name', 'parent_id'] attributes += entity.Entity.attributes active = db.Column(db.Boolean(), nullable=False) name = db.Column(db.String(60), nullable=False...
from infosystem.database import db from infosystem.common.subsystem import entity class Domain(entity.Entity, db.Model): attributes = ['name', 'parent_id'] attributes += entity.Entity.attributes name = db.Column(db.String(60), nullable=False, unique=True) parent_id = db.Column( db.CHAR(32), ...
Remove attribute from domain and get from entity
Remove attribute from domain and get from entity
Python
apache-2.0
samueldmq/infosystem
<REPLACE_OLD> ['active', 'name', <REPLACE_NEW> ['name', <REPLACE_END> <DELETE> active = db.Column(db.Boolean(), nullable=False) <DELETE_END> <INSERT> active, <INSERT_END> <REPLACE_OLD> updated_at, updated_by) <REPLACE_NEW> <REPLACE_END> <REPLACE_OLD> self.active = active <REPLACE_NEW> updated_a...
Remove attribute from domain and get from entity from infosystem.database import db from infosystem.common.subsystem import entity class Domain(entity.Entity, db.Model): attributes = ['active', 'name', 'parent_id'] attributes += entity.Entity.attributes active = db.Column(db.Boolean(), nullable=False) ...
696be529ceaef9a9ab6fa43d599456d92336c083
lglass/database/mongodb.py
lglass/database/mongodb.py
# coding: utf-8 import urllib.parse import pymongo import pymongo.database import pymongo.uri_parser import lglass.database.base import lglass.rpsl @lglass.database.base.register("mongodb") class MongoDBDatabase(lglass.database.base.Database): def __init__(self, mongo, database="lglass"): if isinstance(mongo, st...
Implement database driver for MongoDB
Implement database driver for MongoDB
Python
mit
fritz0705/lglass
<REPLACE_OLD> <REPLACE_NEW> # coding: utf-8 import urllib.parse import pymongo import pymongo.database import pymongo.uri_parser import lglass.database.base import lglass.rpsl @lglass.database.base.register("mongodb") class MongoDBDatabase(lglass.database.base.Database): def __init__(self, mongo, database="lglass...
Implement database driver for MongoDB
191b6cb9b772efb9c03eff36f7295c59c6dcd026
web/examples/extendcube.py
web/examples/extendcube.py
import argparse import empaths import dbconfig import dbconfighayworth5nm import numpy as np import urllib, urllib2 import cStringIO import sys import anncube import anndb import zindex def main(): parser = argparse.ArgumentParser(description='Cutout a portion of the database.') parser.add_argument('id', action=...
Move to home. Not sure that this builds.
Move to home. Not sure that this builds.
Python
apache-2.0
openconnectome/open-connectome,neurodata/ndstore,openconnectome/open-connectome,neurodata/ndstore,openconnectome/open-connectome,neurodata/ndstore,openconnectome/open-connectome,openconnectome/open-connectome,openconnectome/open-connectome,neurodata/ndstore
<REPLACE_OLD> <REPLACE_NEW> import argparse import empaths import dbconfig import dbconfighayworth5nm import numpy as np import urllib, urllib2 import cStringIO import sys import anncube import anndb import zindex def main(): parser = argparse.ArgumentParser(description='Cutout a portion of the database.') pars...
Move to home. Not sure that this builds.
29aeca4df24c84cecd48f0893da94624dab0e1c7
manage.py
manage.py
import os from app import create_app from flask.ext.script import Manager app = create_app(os.getenv('FLASK_CONFIG') or 'default') manager = Manager(app) if __name__ == '__main__': manager.run()
import os from app import create_app, db from app.models import User from flask.ext.script import Manager app = create_app(os.getenv('FLASK_CONFIG') or 'default') manager = Manager(app) @manager.command def adduser(email, username, admin=False): """ Register a new user""" from getpass import getpass password ...
Add a custom script command to add a user to the database
Add a custom script command to add a user to the database
Python
mit
finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is
<REPLACE_OLD> create_app from <REPLACE_NEW> create_app, db from app.models import User from <REPLACE_END> <REPLACE_OLD> Manager(app) if <REPLACE_NEW> Manager(app) @manager.command def adduser(email, username, admin=False): """ Register a new user""" from getpass import getpass password = getpass() password2...
Add a custom script command to add a user to the database import os from app import create_app from flask.ext.script import Manager app = create_app(os.getenv('FLASK_CONFIG') or 'default') manager = Manager(app) if __name__ == '__main__': manager.run()
d20039737d1e25f4462c4865347fa22411045677
budgetsupervisor/users/models.py
budgetsupervisor/users/models.py
from django.db import models from django.contrib.auth.models import AbstractUser from django.conf import settings from django.db.models.signals import post_save from saltedge.factory import get_saltedge_app class User(AbstractUser): pass class ProfileManager(models.Manager): def create_in_saltedge(self, pro...
from django.db import models from django.contrib.auth.models import AbstractUser from django.conf import settings from django.db.models.signals import post_save from saltedge.factory import get_saltedge_app class User(AbstractUser): pass class ProfileManager(models.Manager): def create_in_saltedge(self, pro...
Add placeholder for removing customer from saltedge
Add placeholder for removing customer from saltedge
Python
mit
ltowarek/budget-supervisor
<REPLACE_OLD> profile.save() class <REPLACE_NEW> profile.save() def remove_from_saltedge(self, profile): pass class <REPLACE_END> <|endoftext|> from django.db import models from django.contrib.auth.models import AbstractUser from django.conf import settings from django.db.models.signals import post_sav...
Add placeholder for removing customer from saltedge from django.db import models from django.contrib.auth.models import AbstractUser from django.conf import settings from django.db.models.signals import post_save from saltedge.factory import get_saltedge_app class User(AbstractUser): pass class ProfileManager(...
06dc2190d64e312b3b8285e69a0d50342bc55b46
tests/integration/test_proxy.py
tests/integration/test_proxy.py
# -*- coding: utf-8 -*- '''Test using a proxy.''' # External imports import multiprocessing import pytest requests = pytest.importorskip("requests") from six.moves import socketserver, SimpleHTTPServer from six.moves.urllib.request import urlopen # Internal imports import vcr class Proxy(SimpleHTTPServer.SimpleHTT...
# -*- coding: utf-8 -*- '''Test using a proxy.''' # External imports import multiprocessing import pytest from six.moves import socketserver, SimpleHTTPServer from six.moves.urllib.request import urlopen # Internal imports import vcr # Conditional imports requests = pytest.importorskip("requests") class Proxy(Sim...
Fix format string for Python 2.6
Fix format string for Python 2.6
Python
mit
kevin1024/vcrpy,graingert/vcrpy,kevin1024/vcrpy,graingert/vcrpy
<REPLACE_OLD> pytest requests = pytest.importorskip("requests") from <REPLACE_NEW> pytest from <REPLACE_END> <REPLACE_OLD> vcr class <REPLACE_NEW> vcr # Conditional imports requests = pytest.importorskip("requests") class <REPLACE_END> <REPLACE_OLD> proxy_server(httpbin): <REPLACE_NEW> proxy_server(): <REPLACE...
Fix format string for Python 2.6 # -*- coding: utf-8 -*- '''Test using a proxy.''' # External imports import multiprocessing import pytest requests = pytest.importorskip("requests") from six.moves import socketserver, SimpleHTTPServer from six.moves.urllib.request import urlopen # Internal imports import vcr clas...
516f4ff71a062247bb026bf43257362c7386e403
test.py
test.py
# test for logic import sys, operator, random Base1 = sys.argv[1] Base2 = sys.argv[2] Base3 = sys.argv[3] Base4 = sys.argv[4] Base5 = sys.argv[5] Base6 = sys.argv[6] Level = 10 #relation = {1: Base1, 2: Base2, 3: Base3, 4: Base4, 5: Base5, 6: Base6} relation = [(1, int(Base1)), (2, int(Base2)), (3, int(Base3)), (4...
Test script for logic added
Test script for logic added
Python
apache-2.0
Phixia/WildEncounter
<REPLACE_OLD> <REPLACE_NEW> # test for logic import sys, operator, random Base1 = sys.argv[1] Base2 = sys.argv[2] Base3 = sys.argv[3] Base4 = sys.argv[4] Base5 = sys.argv[5] Base6 = sys.argv[6] Level = 10 #relation = {1: Base1, 2: Base2, 3: Base3, 4: Base4, 5: Base5, 6: Base6} relation = [(1, int(Base1)), (2, int...
Test script for logic added
4299f4f410f768066aaacf885ff0a38e8af175c9
intro-django/readit/books/forms.py
intro-django/readit/books/forms.py
from django import forms from .models import Book class ReviewForm(forms.Form): """ Form for reviewing a book """ is_favourite = forms.BooleanField( label = 'Favourite?', help_text = 'In your top 100 books of all time?', required = False, ) review = forms.CharField( widget = forms.Textarea, min_lengt...
from django import forms from .models import Book class ReviewForm(forms.Form): """ Form for reviewing a book """ is_favourite = forms.BooleanField( label = 'Favourite?', help_text = 'In your top 100 books of all time?', required = False, ) review = forms.CharField( widget = forms.Textarea, min_lengt...
Add custom form validation enforcing that each new book is unique
Add custom form validation enforcing that each new book is unique
Python
mit
nirajkvinit/python3-study,nirajkvinit/python3-study,nirajkvinit/python3-study,nirajkvinit/python3-study
<REPLACE_OLD> 'authors'] <REPLACE_NEW> 'authors'] def clean(self): # Super the clean method to maintain main validation and error messages super(BookForm, self).clean() try: title = self.cleaned_data.get('title') authors = self.cleaned_data.get('authors') book = Book.objects.get(title=title, authors=a...
Add custom form validation enforcing that each new book is unique from django import forms from .models import Book class ReviewForm(forms.Form): """ Form for reviewing a book """ is_favourite = forms.BooleanField( label = 'Favourite?', help_text = 'In your top 100 books of all time?', required = False, )...
174c570d69d0958aa734794ffb7712ea37e70c6f
parse.py
parse.py
import sys import configparser def main(): config = configparser.ConfigParser(strict=False) try: section = sys.argv[1] config_key = sys.argv[2] config_value = sys.argv[3] except IndexError: print("Usage: cat test.ini | python parse.py <section> <option> <value>") s...
import sys import configparser def main(): config = configparser.ConfigParser(strict=False) try: section = sys.argv[1] config_key = sys.argv[2] config_value = sys.argv[3] except IndexError: print("Usage: cat test.ini | python parse.py <section> <option> <value>") s...
Add new key to existing section.
Add new key to existing section.
Python
mit
tonigrigoriu/ini-parser
<REPLACE_OLD> """ Try <REPLACE_NEW> """Try <REPLACE_END> <REPLACE_OLD> section. """ <REPLACE_NEW> section.""" <REPLACE_END> <INSERT> else: config.set(section, config_key, config_value) <INSERT_END> <|endoftext|> import sys import configparser def main(): config = con...
Add new key to existing section. import sys import configparser def main(): config = configparser.ConfigParser(strict=False) try: section = sys.argv[1] config_key = sys.argv[2] config_value = sys.argv[3] except IndexError: print("Usage: cat test.ini | python parse.py <sec...
62a76827ecf7c148101b62925dea04f63709012a
sublime/User/update_user_settings.py
sublime/User/update_user_settings.py
import json import urllib2 import sublime import sublime_plugin GIST_URL = u'https://raw.githubusercontent.com/RomuloOliveira/dot-files/master/sublime/User/Preferences.sublime-settings' # noqa class UpdateUserSettingsCommand(sublime_plugin.TextCommand): def run(self, edit): gist_settings = self._g...
import json import urllib import sublime import sublime_plugin GIST_URL = 'https://raw.githubusercontent.com/RomuloOliveira/dot-files/master/sublime/User/Preferences.sublime-settings' # noqa class UpdateUserSettingsCommand(sublime_plugin.TextCommand): def run(self, edit): gist_settings = self._get_set...
Update command to work with sublime 3
Update command to work with sublime 3
Python
apache-2.0
RomuloOliveira/dot-files,RomuloOliveira/unix-files,RomuloOliveira/dot-files
<REPLACE_OLD> urllib2 import <REPLACE_NEW> urllib import <REPLACE_END> <REPLACE_OLD> u'https://raw.githubusercontent.com/RomuloOliveira/dot-files/master/sublime/User/Preferences.sublime-settings' <REPLACE_NEW> 'https://raw.githubusercontent.com/RomuloOliveira/dot-files/master/sublime/User/Preferences.sublime-settings...
Update command to work with sublime 3 import json import urllib2 import sublime import sublime_plugin GIST_URL = u'https://raw.githubusercontent.com/RomuloOliveira/dot-files/master/sublime/User/Preferences.sublime-settings' # noqa class UpdateUserSettingsCommand(sublime_plugin.TextCommand): def run(self,...
f6cba028766b1b12686c515c8ffa05ffb23992d4
opps/views/tests/test_generic_list.py
opps/views/tests/test_generic_list.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from django.test import TestCase, Client from django.contrib.auth.models import User from django.utils import timezone from opps.articles.models import Post, Link from opps.channels.models import Channel class TestTemplateName(TestCase): def setUp(self): sel...
Write basic test on generic list views
Write basic test on generic list views
Python
mit
williamroot/opps,opps/opps,jeanmask/opps,opps/opps,williamroot/opps,jeanmask/opps,YACOWS/opps,opps/opps,YACOWS/opps,YACOWS/opps,YACOWS/opps,opps/opps,jeanmask/opps,williamroot/opps,williamroot/opps,jeanmask/opps
<REPLACE_OLD> <REPLACE_NEW> #!/usr/bin/env python # -*- coding: utf-8 -*- from django.test import TestCase, Client from django.contrib.auth.models import User from django.utils import timezone from opps.articles.models import Post, Link from opps.channels.models import Channel class TestTemplateName(TestCase): ...
Write basic test on generic list views
c06f653cb6763f1d1b64797aa48e65820652f981
tests/alerts/test_open_port_violation.py
tests/alerts/test_open_port_violation.py
from positive_alert_test_case import PositiveAlertTestCase from negative_alert_test_case import NegativeAlertTestCase from alert_test_suite import AlertTestSuite class TestAlertOpenPortViolation(AlertTestSuite): alert_filename = "open_port_violation" # This event is the default positive event that will caus...
Add unit-tests for open port violation alert
Add unit-tests for open port violation alert
Python
mpl-2.0
Phrozyn/MozDef,ameihm0912/MozDef,ameihm0912/MozDef,jeffbryner/MozDef,jeffbryner/MozDef,mpurzynski/MozDef,mozilla/MozDef,mozilla/MozDef,jeffbryner/MozDef,gdestuynder/MozDef,mozilla/MozDef,mozilla/MozDef,Phrozyn/MozDef,mpurzynski/MozDef,mpurzynski/MozDef,gdestuynder/MozDef,ameihm0912/MozDef,gdestuynder/MozDef,Phrozyn/Moz...
<REPLACE_OLD> <REPLACE_NEW> from positive_alert_test_case import PositiveAlertTestCase from negative_alert_test_case import NegativeAlertTestCase from alert_test_suite import AlertTestSuite class TestAlertOpenPortViolation(AlertTestSuite): alert_filename = "open_port_violation" # This event is the default ...
Add unit-tests for open port violation alert
27d975bf84122ec62f96ddae4777e177d562bf7e
thinc/extra/load_nlp.py
thinc/extra/load_nlp.py
import spacy SPACY_MODELS = {} def get_spacy(lang, parser=False, tagger=False, entity=False): global SPACY_MODELS if spacy is None: raise ImportError("Could not import spacy. Is it installed?") if lang not in SPACY_MODELS: SPACY_MODELS[lang] = spacy.load( lang, parser=parser, t...
Add loader for spaCy, with singleton
Add loader for spaCy, with singleton
Python
mit
spacy-io/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc
<INSERT> import spacy SPACY_MODELS = {} def get_spacy(lang, parser=False, tagger=False, entity=False): <INSERT_END> <INSERT> global SPACY_MODELS if spacy is None: raise ImportError("Could not import spacy. Is it installed?") if lang not in SPACY_MODELS: SPACY_MODELS[lang] = spacy.load( ...
Add loader for spaCy, with singleton
653ae451e204905b8295e424ca86c20d60ee686c
settings/__init__.py
settings/__init__.py
import yaml import utils with open('settings.yml') as settings_file: YML = yaml.safe_load(settings_file) IMAGE = utils.Settings(YML['image']) SNAP = utils.Settings(YML['snap']) DROPBOX_TOKEN_FILE = "./dropbox.txt" WORKING_DIRECTORY = "/home/pi/time-lapse" IMAGES_DIRECTORY = WORKING_DIRECTORY + "/images" ...
import glob import yaml import utils with open('settings.yml') as settings_file: YML = yaml.safe_load(settings_file) IMAGE = utils.Settings(YML['image']) SNAP = utils.Settings(YML['snap']) DROPBOX_TOKEN_FILE = "./dropbox.txt" WORKING_DIRECTORY = "/home/pi/time-lapse" IMAGES_DIRECTORY = WORKING_DIRECTORY ...
Make a class to manage job settings
Make a class to manage job settings
Python
mit
projectweekend/Pi-Camera-Time-Lapse,projectweekend/Pi-Camera-Time-Lapse
<INSERT> glob import <INSERT_END> <REPLACE_OLD> "/jobs" <REPLACE_NEW> "/jobs" class Setting(object): def __init__(self, settings_dict): self.__dict__.update(settings_dict) class Job(object): def __init__(self): self.image = None self.snap = None self.__load_job_data() ...
Make a class to manage job settings import yaml import utils with open('settings.yml') as settings_file: YML = yaml.safe_load(settings_file) IMAGE = utils.Settings(YML['image']) SNAP = utils.Settings(YML['snap']) DROPBOX_TOKEN_FILE = "./dropbox.txt" WORKING_DIRECTORY = "/home/pi/time-lapse" IMAGES_DIREC...
5d663ae690f0c488f7a38f4556c30b169389c441
flaskiwsapp/projects/models/target.py
flaskiwsapp/projects/models/target.py
''' Created on Sep 24, 2016 @author: rtorres ''' from flaskiwsapp.database import SurrogatePK, Model, db, reference_col, relationship, Column from sqlalchemy.dialects.postgresql.base import ENUM from sqlalchemy_utils.types.url import URLType from flask_validator.constraints.internet import ValidateURL AREAS = ('Poli...
''' Created on Sep 24, 2016 @author: rtorres ''' from flaskiwsapp.database import SurrogatePK, Model, db, reference_col, relationship, Column from sqlalchemy.dialects.postgresql.base import ENUM AREAS = ('Policies', 'Billing', 'Claims', 'Reports') class Target(SurrogatePK, Model): """A user of the app.""" ...
Remove import from testing packages
Remove import from testing packages
Python
mit
rafasis1986/EngineeringMidLevel,rafasis1986/EngineeringMidLevel,rafasis1986/EngineeringMidLevel,rafasis1986/EngineeringMidLevel,rafasis1986/EngineeringMidLevel
<REPLACE_OLD> ENUM from sqlalchemy_utils.types.url import URLType from flask_validator.constraints.internet import ValidateURL AREAS <REPLACE_NEW> ENUM AREAS <REPLACE_END> <|endoftext|> ''' Created on Sep 24, 2016 @author: rtorres ''' from flaskiwsapp.database import SurrogatePK, Model, db, reference_col, relation...
Remove import from testing packages ''' Created on Sep 24, 2016 @author: rtorres ''' from flaskiwsapp.database import SurrogatePK, Model, db, reference_col, relationship, Column from sqlalchemy.dialects.postgresql.base import ENUM from sqlalchemy_utils.types.url import URLType from flask_validator.constraints.internet...
96b283adbb3156e77aee012a9fb8aba9d67343a9
src/bitmessageqt/widgets.py
src/bitmessageqt/widgets.py
from PyQt4 import uic import os.path import sys def resource_path(path): try: return os.path.join(sys._MEIPASS, path) except: return os.path.join(os.path.dirname(__file__), path) def load(path, widget): uic.loadUi(resource_path(path), widget)
from PyQt4 import uic import os.path import sys from shared import codePath def resource_path(resFile): baseDir = codePath() for subDir in ["ui", "bitmessageqt"]: if os.path.isdir(os.path.join(baseDir, subDir)) and os.path.isfile(os.path.join(baseDir, subDir, resFile)): return os.path.join(...
Change UI loading for frozen
Change UI loading for frozen
Python
mit
mailchuck/PyBitmessage,mailchuck/PyBitmessage,mailchuck/PyBitmessage,mailchuck/PyBitmessage
<REPLACE_OLD> sys def resource_path(path): <REPLACE_NEW> sys from shared import codePath def resource_path(resFile): <REPLACE_END> <REPLACE_OLD> try: <REPLACE_NEW> baseDir = codePath() for subDir in ["ui", "bitmessageqt"]: if os.path.isdir(os.path.join(baseDir, subDir)) and os.path.isfile(os.path.join...
Change UI loading for frozen from PyQt4 import uic import os.path import sys def resource_path(path): try: return os.path.join(sys._MEIPASS, path) except: return os.path.join(os.path.dirname(__file__), path) def load(path, widget): uic.loadUi(resource_path(path), widget)
140ff37058eefe4ab79932d96cff4a90aa7b113e
contrib/tests/test_bind_provider.py
contrib/tests/test_bind_provider.py
import unittest from mock import patch, Mock, MagicMock import os import sys from bind.provider import Provider class TestBindProvider(unittest.TestCase): @patch('subprocess.check_output') @patch('bind.provider.unit_get') def test_first_setup(self, ugm, spcom): spcom.return_value = '10.0.0.1' ...
import unittest from mock import patch, Mock, MagicMock import os import sys from bind.provider import Provider class TestBindProvider(unittest.TestCase): @patch('subprocess.check_output') @patch('bind.provider.unit_get') def test_first_setup(self, ugm, spcom): ugm.return_value = '10.0.0.1' ...
Correct bind provider mock in tests
Correct bind provider mock in tests
Python
mit
chuckbutler/DNS-Charm,chuckbutler/DNS-Charm
<REPLACE_OLD> spcom.return_value <REPLACE_NEW> ugm.return_value <REPLACE_END> <|endoftext|> import unittest from mock import patch, Mock, MagicMock import os import sys from bind.provider import Provider class TestBindProvider(unittest.TestCase): @patch('subprocess.check_output') @patch('bind.provider.unit...
Correct bind provider mock in tests import unittest from mock import patch, Mock, MagicMock import os import sys from bind.provider import Provider class TestBindProvider(unittest.TestCase): @patch('subprocess.check_output') @patch('bind.provider.unit_get') def test_first_setup(self, ugm, spcom): ...
4eeec96f3c79b9584278639293631ab787132f67
custom/ewsghana/reminders/third_soh_reminder.py
custom/ewsghana/reminders/third_soh_reminder.py
from corehq.apps.locations.models import SQLLocation from corehq.apps.users.models import CommCareUser from custom.ewsghana.reminders.second_soh_reminder import SecondSOHReminder class ThirdSOHReminder(SecondSOHReminder): def get_users_messages(self): for sql_location in SQLLocation.objects.filter(domain...
from corehq.apps.locations.dbaccessors import get_web_users_by_location from corehq.apps.locations.models import SQLLocation from corehq.apps.reminders.util import get_preferred_phone_number_for_recipient from corehq.apps.users.models import CommCareUser from custom.ewsghana.reminders.second_soh_reminder import SecondS...
Send third soh also to web users
Send third soh also to web users
Python
bsd-3-clause
qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
<INSERT> corehq.apps.locations.dbaccessors import get_web_users_by_location from <INSERT_END> <INSERT> corehq.apps.reminders.util import get_preferred_phone_number_for_recipient from <INSERT_END> <REPLACE_OLD> SecondSOHReminder class <REPLACE_NEW> SecondSOHReminder from custom.ewsghana.utils import send_sms, has_noti...
Send third soh also to web users from corehq.apps.locations.models import SQLLocation from corehq.apps.users.models import CommCareUser from custom.ewsghana.reminders.second_soh_reminder import SecondSOHReminder class ThirdSOHReminder(SecondSOHReminder): def get_users_messages(self): for sql_location in...
dd5276a3cf434267b6a94647c07b55065efd37b0
setup.py
setup.py
from setuptools import setup import sys sys.path.insert(0, 'src') from rosdep2 import __version__ setup(name='rosdep', version= __version__, packages=['rosdep2', 'rosdep2.platforms'], package_dir = {'':'src'}, # data_files=[('man/man1', ['doc/man/rosdep.1'])], install_requires = ['rospkg...
from setuptools import setup import sys sys.path.insert(0, 'src') from rosdep2 import __version__ setup(name='rosdep', version= __version__, packages=['rosdep2', 'rosdep2.platforms'], package_dir = {'':'src'}, # data_files=[('man/man1', ['doc/man/rosdep.1'])], install_requires = ['rospkg...
Add test deps on nose, mock.
Add test deps on nose, mock.
Python
bsd-3-clause
alessandro-aglietti/rosdep,spaghetti-/rosdep,georgepar/rosdep,alessandro-aglietti/rosdep,wkentaro/rosdep,spaghetti-/rosdep,ros-infrastructure/rosdep,allenh1/rosdep,ros-infrastructure/rosdep,sorki/rosdep,georgepar/rosdep,sorki/rosdep,wkentaro/rosdep,aymanim/rosdep,allenh1/rosdep,aymanim/rosdep
<INSERT> setup_requires = ['nose>=1.0'], test_suite = 'nose.collector', test_requires = ['mock'], <INSERT_END> <|endoftext|> from setuptools import setup import sys sys.path.insert(0, 'src') from rosdep2 import __version__ setup(name='rosdep', version= __version__, packages=['rosdep2', ...
Add test deps on nose, mock. from setuptools import setup import sys sys.path.insert(0, 'src') from rosdep2 import __version__ setup(name='rosdep', version= __version__, packages=['rosdep2', 'rosdep2.platforms'], package_dir = {'':'src'}, # data_files=[('man/man1', ['doc/man/rosdep.1'])], ...
4812103b4d9be418aecdc64341fb32be7865f113
core/backends/IUnikernelBackend.py
core/backends/IUnikernelBackend.py
from abc import ABCMeta, abstractmethod class IUnikernelBackend(object): """ Interface that must be implemented by every Unikernel Backend. It contains method stubs used by the REST API provider and other components. Redefinition of functions decorated with @asbstractmethod is compulsory. """ ...
Add interface for unikernel backends to implement
Add interface for unikernel backends to implement
Python
apache-2.0
onyb/dune,adyasha/dune,adyasha/dune,adyasha/dune
<REPLACE_OLD> <REPLACE_NEW> from abc import ABCMeta, abstractmethod class IUnikernelBackend(object): """ Interface that must be implemented by every Unikernel Backend. It contains method stubs used by the REST API provider and other components. Redefinition of functions decorated with @asbstractmeth...
Add interface for unikernel backends to implement
cc4be37ef6d1ed2b8d89f14a051514d56f05b43b
setup.py
setup.py
#!/usr/bin/env python # coding=utf-8 __author__ = 'kulakov.ilya@gmail.com' from setuptools import setup setup(name="Power", version="1.0", description="Cross-platform system power status information.", author="Ilya Kulakov", author_email="kulakov.ilya@gmail.com", url="https://github.com/Kentzo/Po...
#!/usr/bin/env python # coding=utf-8 __author__ = 'kulakov.ilya@gmail.com' from setuptools import setup setup(name="Power", version="1.0", description="Cross-platform system power status information.", author="Ilya Kulakov", author_email="kulakov.ilya@gmail.com", url="https://github.com/Kentzo/Po...
Fix wrong install requirement name.
Fix wrong install requirement name.
Python
mit
Kentzo/Power
<REPLACE_OLD> install_requires=['pyobjc-core <REPLACE_NEW> install_requires=['pyobjc <REPLACE_END> <REPLACE_OLD> 2.3.2a0'] ) <REPLACE_NEW> 2.3'] ) <REPLACE_END> <|endoftext|> #!/usr/bin/env python # coding=utf-8 __author__ = 'kulakov.ilya@gmail.com' from setuptools import setup setup(name="Power", version="1.0...
Fix wrong install requirement name. #!/usr/bin/env python # coding=utf-8 __author__ = 'kulakov.ilya@gmail.com' from setuptools import setup setup(name="Power", version="1.0", description="Cross-platform system power status information.", author="Ilya Kulakov", author_email="kulakov.ilya@gmail.com", ...
10caef4f58f7176ccce3ba65d9d068dc393e7905
playhouse/mysql_ext.py
playhouse/mysql_ext.py
try: import mysql.connector as mysql_connector except ImportError: mysql_connector = None from peewee import ImproperlyConfigured from peewee import MySQLDatabase class MySQLConnectorDatabase(MySQLDatabase): def _connect(self): if mysql_connector is None: raise ImproperlyConfigured('M...
Add support for MySQL-Connector python driver.
Add support for MySQL-Connector python driver.
Python
mit
coleifer/peewee,coleifer/peewee,coleifer/peewee
<INSERT> try: <INSERT_END> <INSERT> import mysql.connector as mysql_connector except ImportError: mysql_connector = None from peewee import ImproperlyConfigured from peewee import MySQLDatabase class MySQLConnectorDatabase(MySQLDatabase): def _connect(self): if mysql_connector is None: ...
Add support for MySQL-Connector python driver.
55464daa00ca68b07737433b0983df4667432a9c
system/plugins/info.py
system/plugins/info.py
__author__ = 'Gareth Coles' import weakref class Info(object): data = None core = None info = None def __init__(self, yaml_data, plugin_object=None): """ :param yaml_data: :type yaml_data: dict :return: """ self.data = yaml_data if plugin_...
__author__ = 'Gareth Coles' import weakref class Info(object): data = None core = None info = None def __init__(self, yaml_data, plugin_object=None): """ :param yaml_data: :type yaml_data: dict :return: """ self.data = yaml_data if plugin_...
Fix missing dependencies on core
Fix missing dependencies on core
Python
artistic-2.0
UltrosBot/Ultros,UltrosBot/Ultros
<INSERT> self.core.dependencies = [] <INSERT_END> <|endoftext|> __author__ = 'Gareth Coles' import weakref class Info(object): data = None core = None info = None def __init__(self, yaml_data, plugin_object=None): """ :param yaml_data: :type yaml_data: dict...
Fix missing dependencies on core __author__ = 'Gareth Coles' import weakref class Info(object): data = None core = None info = None def __init__(self, yaml_data, plugin_object=None): """ :param yaml_data: :type yaml_data: dict :return: """ self.da...
c81eb510c72511c1f692f02f7bb63ef4caa51d27
apps/concept/management/commands/update_concept_totals.py
apps/concept/management/commands/update_concept_totals.py
from optparse import make_option import sys from django.core.management.base import BaseCommand from education.models import Concept class Command(BaseCommand): args = "" help = "Update concept total_question counts (post db import)" def handle(self, *args, **options): for concept in Concept.o...
from optparse import make_option import sys from django.core.management.base import BaseCommand from concept.models import Concept class Command(BaseCommand): args = "" help = "Update concept total_question counts (post db import)" def handle(self, *args, **options): for concept in Concept.obj...
Add management functions for migration
Add management functions for migration
Python
bsd-3-clause
mfitzp/smrtr,mfitzp/smrtr
<REPLACE_OLD> education.models <REPLACE_NEW> concept.models <REPLACE_END> <|endoftext|> from optparse import make_option import sys from django.core.management.base import BaseCommand from concept.models import Concept class Command(BaseCommand): args = "" help = "Update concept total_question counts (post db ...
Add management functions for migration from optparse import make_option import sys from django.core.management.base import BaseCommand from education.models import Concept class Command(BaseCommand): args = "" help = "Update concept total_question counts (post db import)" def handle(self, *args, **op...
c078cc3fc0cf86b01fcec6c5ea6de9c4d3ee4ef5
CSVTODSS.py
CSVTODSS.py
from hec.script import MessageBox from hec.heclib.dss import HecDss from hec.heclib.util import HecTime from hec.io import TimeSeriesContainer import java import csv try : try : #print 'Jython version: ', sys.version NUM_METADATA_LINES = 3; DSS_FILE_PATH = './2008_2_Events/2008_2_Events_for...
Store .csv daily precipitation in hec .dss database
Store .csv daily precipitation in hec .dss database - Store precipitation data in .dss before running HEC-HMS model - Also updated the Jython version of Hec-dssuve into 2.5 More details - http://resourceoptimism.blogspot.com/2017/03/store-csv-data-on-hec-dssuve-dss-for.html
Python
apache-2.0
gihankarunarathne/udp,gihankarunarathne/udp
<REPLACE_OLD> <REPLACE_NEW> from hec.script import MessageBox from hec.heclib.dss import HecDss from hec.heclib.util import HecTime from hec.io import TimeSeriesContainer import java import csv try : try : #print 'Jython version: ', sys.version NUM_METADATA_LINES = 3; DSS_FILE_PATH = './20...
Store .csv daily precipitation in hec .dss database - Store precipitation data in .dss before running HEC-HMS model - Also updated the Jython version of Hec-dssuve into 2.5 More details - http://resourceoptimism.blogspot.com/2017/03/store-csv-data-on-hec-dssuve-dss-for.html
990d98b323e21d8824b2aead8700f56d66fe6ba3
plasmapy/utils/__init__.py
plasmapy/utils/__init__.py
from .checks import (check_quantity, check_relativistic, _check_quantity, _check_relativistic) from .exceptions import (PlasmaPyError, PhysicsError, RelativityError, AtomicError, ...
from .checks import (check_quantity, check_relativistic, _check_quantity, _check_relativistic) from .exceptions import (PlasmaPyError, PhysicsError, RelativityError, AtomicError, ...
Fix AppVeyor build or break it in a different way
Fix AppVeyor build or break it in a different way
Python
bsd-3-clause
StanczakDominik/PlasmaPy
<REPLACE_OLD> assert_can_handle_nparray, ) import <REPLACE_NEW> assert_can_handle_nparray, ) from . import <REPLACE_END> <|endoftext|> from .checks import (check_quantity, check_relativistic, _check_quantity, _check_relativistic) from .exceptions import ...
Fix AppVeyor build or break it in a different way from .checks import (check_quantity, check_relativistic, _check_quantity, _check_relativistic) from .exceptions import (PlasmaPyError, PhysicsError, Relati...
e6cf9cb9d27523fd72242f6ea137d14bff5f2039
interface/plugin/farmanager/02title/__init__.py
interface/plugin/farmanager/02title/__init__.py
""" Gets plugin info from global fields Low-level Far Manager API is here: * https://api.farmanager.com/en/exported_functions/getglobalinfow.html """ __title__ = "02fields" __author__ = "anatoly techtonik <techtonik@gmail.com>" __license__ = "Public Domain" # --- utility functions --- import hashlib def getu...
Add 02title/ plugin that gets own info from global fields
Add 02title/ plugin that gets own info from global fields
Python
unlicense
techtonik/discovery,techtonik/discovery,techtonik/discovery
<REPLACE_OLD> <REPLACE_NEW> """ Gets plugin info from global fields Low-level Far Manager API is here: * https://api.farmanager.com/en/exported_functions/getglobalinfow.html """ __title__ = "02fields" __author__ = "anatoly techtonik <techtonik@gmail.com>" __license__ = "Public Domain" # --- utility functions ...
Add 02title/ plugin that gets own info from global fields
f23cfabee531a6aaa050b647b9ae54ad047335ea
ixdjango/logging_.py
ixdjango/logging_.py
""" Logging Handler """ import logging import logging.handlers import os import re import socket class IXAFormatter(logging.Formatter): """ A formatter for IXA logging environment. """ HOSTNAME = re.sub( r':\d+$', '', os.environ.get('SITE_DOMAIN', socket.gethostname())) FORMAT = '%(ascti...
""" Logging Handler """ import logging import logging.handlers import os import re import socket import time class IXAFormatter(logging.Formatter): """ A formatter for IXA logging environment. """ HOSTNAME = re.sub( r':\d+$', '', os.environ.get('SITE_DOMAIN', socket.gethostname())) FORMA...
Change time format to properly formatted UTC
Change time format to properly formatted UTC [#46004]
Python
mit
infoxchange/ixdjango
<REPLACE_OLD> socket class <REPLACE_NEW> socket import time class <REPLACE_END> <REPLACE_OLD> '%b %d %H:%M:%S' <REPLACE_NEW> '%Y-%m-%dT%H:%M:%SZ' converter = time.gmtime <REPLACE_END> <|endoftext|> """ Logging Handler """ import logging import logging.handlers import os import re import socket import time...
Change time format to properly formatted UTC [#46004] """ Logging Handler """ import logging import logging.handlers import os import re import socket class IXAFormatter(logging.Formatter): """ A formatter for IXA logging environment. """ HOSTNAME = re.sub( r':\d+$', '', os.environ.get('SI...
30567284410b9bb7154b8d39e5dfe7bc4bb1b269
herald/migrations/0006_auto_20170825_1813.py
herald/migrations/0006_auto_20170825_1813.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.8 on 2017-08-25 23:13 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('herald', '0005_merge_201704...
Add migration for on_delete SET_NULL
Add migration for on_delete SET_NULL
Python
mit
worthwhile/django-herald,jproffitt/django-herald,jproffitt/django-herald,worthwhile/django-herald
<INSERT> # -*- coding: utf-8 -*- # Generated by Django 1.9.8 on 2017-08-25 23:13 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): <INSERT_END> <INSERT> dependencies = [ ...
Add migration for on_delete SET_NULL
a222b37f17ababdac028a202dccbf0a990dad055
src/robot_motion_control/scripts/node_gpio_output.py
src/robot_motion_control/scripts/node_gpio_output.py
#!/usr/bin/env python import rospy from std_msgs.msg import String def motion_topic_callback(data): rospy.loginfo(rospy.get_caller_id() + "Moving %s", data.data) def motion_topic_listener(): rospy.init_node('GpioOutput', anonymous=True) rospy.Subscriber("MOTION_TOPIC", String, motion_topic_callback) ...
Add a node for simple gpio control
Add a node for simple gpio control
Python
mit
Aditya90/zeroborgRobot,Aditya90/zeroborgRobot
<INSERT> #!/usr/bin/env python import rospy from std_msgs.msg import String def motion_topic_callback(data): <INSERT_END> <INSERT> rospy.loginfo(rospy.get_caller_id() + "Moving %s", data.data) def motion_topic_listener(): rospy.init_node('GpioOutput', anonymous=True) rospy.Subscriber("MOTION_TOPIC", Strin...
Add a node for simple gpio control
64744628725d20bda7f5c931db81037e3de8efcb
setup.py
setup.py
import os from setuptools import setup, find_packages here = os.path.abspath(os.path.dirname(__file__)) README = open(os.path.join(here, 'README.rst')).read() CHANGES = open(os.path.join(here, 'CHANGES.txt')).read() requires = [ 'pyramid', 'pyramid_debugtoolbar', 'waitress', ] setup(name='acmeio', ...
import os from setuptools import setup, find_packages here = os.path.abspath(os.path.dirname(__file__)) README = open(os.path.join(here, 'README.rst')).read() CHANGES = open(os.path.join(here, 'CHANGES.txt')).read() requires = [ 'pyramid', 'pyramid_debugtoolbar', 'waitress', # PyBit and dependencies ...
Add pybit and its dependencies to this package's dependency list.
Add pybit and its dependencies to this package's dependency list.
Python
agpl-3.0
Connexions/acmeio
<INSERT> # PyBit and dependencies 'pybit', 'psycopg2', 'amqplib', 'jsonpickle', <INSERT_END> <|endoftext|> import os from setuptools import setup, find_packages here = os.path.abspath(os.path.dirname(__file__)) README = open(os.path.join(here, 'README.rst')).read() CHANGES = open(os.path.join(here...
Add pybit and its dependencies to this package's dependency list. import os from setuptools import setup, find_packages here = os.path.abspath(os.path.dirname(__file__)) README = open(os.path.join(here, 'README.rst')).read() CHANGES = open(os.path.join(here, 'CHANGES.txt')).read() requires = [ 'pyramid', 'p...
99b1610fad7224d2efe03547c5114d2f046f50ca
bin/cgroup-limits.py
bin/cgroup-limits.py
#!/usr/bin/python env_vars = {} def read_file(path): try: with open(path, 'r') as f: return f.read().strip() except IOError: return None def get_memory_limit(): limit = read_file('/sys/fs/cgroup/memory/memory.limit_in_bytes') if limit: env_vars['MEMORY_LIMIT_IN_B...
#!/usr/bin/python from __future__ import print_function import sys env_vars = {} def read_file(path): try: with open(path, 'r') as f: return f.read().strip() except IOError: return None def get_memory_limit(): limit = read_file('/sys/fs/cgroup/memory/memory.limit_in_bytes')...
Print warnings to standard error
Print warnings to standard error
Python
apache-2.0
soltysh/sti-base,mfojtik/sti-base,hhorak/sti-base,bparees/sti-base,openshift/sti-base,sclorg/s2i-base-container,openshift/sti-base,mfojtik/sti-base,bparees/sti-base
<REPLACE_OLD> #!/usr/bin/python env_vars <REPLACE_NEW> #!/usr/bin/python from __future__ import print_function import sys env_vars <REPLACE_END> <REPLACE_OLD> limit: <REPLACE_NEW> limit is None: print("Warning: Can't detect memory limit from cgroups", file=sys.stderr) return <REPL...
Print warnings to standard error #!/usr/bin/python env_vars = {} def read_file(path): try: with open(path, 'r') as f: return f.read().strip() except IOError: return None def get_memory_limit(): limit = read_file('/sys/fs/cgroup/memory/memory.limit_in_bytes') if limit: ...
ff7c952e991d6bb6b47d02ec5fc9b66584187cc2
fake_player_data.py
fake_player_data.py
"""Generate fake data for testing purposes.""" from faker import Faker from random import randint from GoPlayer import Player from pprint import pprint fake = Faker() names = [fake.name() for x in range(49)] ids = [x for x in range(49)] ranks = [randint(-30, 7) for x in range(49)] player_info = list(zip(names, ids,...
Create fake data for testing
Create fake data for testing
Python
mit
unyth/tournament_graph
<INSERT> """Generate fake data for testing purposes.""" from faker import Faker from random import randint from GoPlayer import Player from pprint import pprint fake = Faker() names = [fake.name() for x in range(49)] ids = [x for x in range(49)] ranks = [randint(-30, 7) for x in range(49)] player_info = list(zip(na...
Create fake data for testing
e889b37d6db1ca29e874e11cdc122159fe9da136
trigrams.py
trigrams.py
# -*- coding: utf-8 -*- """Generate random story using trigrams.""" import io import string def read_file(): """Open and read file input.""" f = io.open('sherlock_small.txt', 'r') lines = ''.join(f.readlines()) print(lines) return lines def strip_punct(text): """Do stuff.""" # strip punc...
# -*- coding: utf-8 -*- """Generate random story using trigrams.""" import io import string def read_file(): """Open and read file input.""" f = io.open('sherlock_small.txt', 'r') lines = ''.join(f.readlines()) # print(lines) return lines def strip_punct(text): """Do stuff.""" # strip pu...
Add return statement to strip_punct
Add return statement to strip_punct
Python
mit
bgarnaat/401_trigrams
<INSERT> # <INSERT_END> <INSERT> text = <INSERT_END> <REPLACE_OLD> ') text <REPLACE_NEW> ') return text text <REPLACE_END> <REPLACE_OLD> read_file() strip_punct(text) <REPLACE_NEW> read_file() print(strip_punct(text)) <REPLACE_END> <|endoftext|> # -*- coding: utf-8 -*- """Generate random story using trigrams....
Add return statement to strip_punct # -*- coding: utf-8 -*- """Generate random story using trigrams.""" import io import string def read_file(): """Open and read file input.""" f = io.open('sherlock_small.txt', 'r') lines = ''.join(f.readlines()) print(lines) return lines def strip_punct(text):...
b7e657134c21b62e78453b11f0745e0048e346bf
examples/simple_distribution.py
examples/simple_distribution.py
import sys import time from random import shuffle from vania.fair_distributor import FairDistributor def main(): # User input for the number of targets and objects. users = ['user1', 'user2'] tasks = ['task1', 'task2'] preferences = [ [1, 2], [2, 1], ] # Run solver start_t...
import sys import time from random import shuffle from vania.fair_distributor import FairDistributor def main(): # User input for the number of targets and objects. users = ['user1', 'user2'] tasks = ['task1', 'task2'] preferences = [ [1, 2], [2, 1], ] # Run solver distrib...
Remove time metrics from the simple example
Remove time metrics from the simple example
Python
mit
Hackathonners/vania
<DELETE> start_time = time.time() <DELETE_END> <REPLACE_OLD> distributor.distribute(output='problem.lp') elapsed_time = time.time() - start_time <REPLACE_NEW> distributor.distribute(output='problem.lp') <REPLACE_END> <|endoftext|> import sys import time from random import shuffle from vania.fair_distributor...
Remove time metrics from the simple example import sys import time from random import shuffle from vania.fair_distributor import FairDistributor def main(): # User input for the number of targets and objects. users = ['user1', 'user2'] tasks = ['task1', 'task2'] preferences = [ [1, 2], ...
76a9ffd876a7bd678e64c5c0055a020cf775137d
random_walks.py
random_walks.py
import numpy as np from matplotlib import pylab as plt np.random.seed(31415926) # Set a seed for reproducibility N_STEPS = 1000 random_data = np.random.randint(0, 2, N_STEPS) # A symmetric random walk random_walk = np.where(random_data > 0, 1, -1).cumsum() N_WALKS = 1000 random_data_matrix = np.random.randint(0, 2...
Add a symmetric random walk script
Add a symmetric random walk script
Python
mit
yassineAlouini/ml-experiments,yassineAlouini/ml-experiments
<INSERT> import numpy as np from matplotlib import pylab as plt np.random.seed(31415926) <INSERT_END> <INSERT> # Set a seed for reproducibility N_STEPS = 1000 random_data = np.random.randint(0, 2, N_STEPS) # A symmetric random walk random_walk = np.where(random_data > 0, 1, -1).cumsum() N_WALKS = 1000 random_data_m...
Add a symmetric random walk script
23e1d5d8dbac5bba45f50092d4d10aba6e0ed730
cortex/__init__.py
cortex/__init__.py
from .dataset import Dataset, Volume, Vertex, VolumeRGB, VertexRGB, Volume2D, Vertex2D from . import align, volume, quickflat, webgl, segment, options from .database import db from .utils import * from .quickflat import make_figure as quickshow load = Dataset.from_file try: from . import webgl from .webgl import sh...
from .dataset import Dataset, Volume, Vertex, VolumeRGB, VertexRGB, Volume2D, Vertex2D from . import align, volume, quickflat, webgl, segment, options from .database import db from .utils import * from .quickflat import make_figure as quickshow try: from . import formats except ImportError: raise ImportError("You ar...
Add warning for source directory import
Add warning for source directory import
Python
bsd-2-clause
gallantlab/pycortex,gallantlab/pycortex,gallantlab/pycortex,gallantlab/pycortex,gallantlab/pycortex
<REPLACE_OLD> quickshow load <REPLACE_NEW> quickshow try: from . import formats except ImportError: raise ImportError("You are running pycortex from the source directory. Don't do that!") load <REPLACE_END> <REPLACE_OLD> dep() <REPLACE_NEW> dep() <REPLACE_END> <|endoftext|> from .dataset import Dataset, Volume, V...
Add warning for source directory import from .dataset import Dataset, Volume, Vertex, VolumeRGB, VertexRGB, Volume2D, Vertex2D from . import align, volume, quickflat, webgl, segment, options from .database import db from .utils import * from .quickflat import make_figure as quickshow load = Dataset.from_file try: f...
3786aea82868eb6b08d99a0caa59b9f7ae6446c9
integration_test_generateSyntheticData.py
integration_test_generateSyntheticData.py
# -*- coding: utf-8 -*- import unittest import numpy as np import numpy.testing as npt from dipy.core.gradients import gradient_table from generateSyntheticData import (generateSyntheticInputs, generateSyntheticOutputsFromMultiTensorModel) class integration_test_generateSyntheticDa...
Test that shapes of input and output match up
Test that shapes of input and output match up
Python
bsd-3-clause
jsjol/GaussianProcessRegressionForDiffusionMRI,jsjol/GaussianProcessRegressionForDiffusionMRI
<REPLACE_OLD> <REPLACE_NEW> # -*- coding: utf-8 -*- import unittest import numpy as np import numpy.testing as npt from dipy.core.gradients import gradient_table from generateSyntheticData import (generateSyntheticInputs, generateSyntheticOutputsFromMultiTensorModel) class integra...
Test that shapes of input and output match up
82cfbc71873b652d64e04b01c36b1cd9d06b2f44
setup.py
setup.py
from setuptools import setup REPO_URL = 'http://github.com/datasciencebr/serenata-toolbox' setup( author='Serenata de Amor', classifiers=[ 'Development Status :: 4 - Beta', 'Intended Audience :: Science/Research', 'License :: OSI Approved :: MIT License', 'Programming Language...
from setuptools import setup REPO_URL = 'http://github.com/datasciencebr/serenata-toolbox' setup( author='Serenata de Amor', classifiers=[ 'Development Status :: 4 - Beta', 'Intended Audience :: Science/Research', 'License :: OSI Approved :: MIT License', 'Programming Language...
Fix the version to correct one
Fix the version to correct one
Python
mit
datasciencebr/serenata-toolbox
<REPLACE_OLD> version='9.0.4' ) <REPLACE_NEW> version='9.1.0' ) <REPLACE_END> <|endoftext|> from setuptools import setup REPO_URL = 'http://github.com/datasciencebr/serenata-toolbox' setup( author='Serenata de Amor', classifiers=[ 'Development Status :: 4 - Beta', 'Intended Audience :: Scie...
Fix the version to correct one from setuptools import setup REPO_URL = 'http://github.com/datasciencebr/serenata-toolbox' setup( author='Serenata de Amor', classifiers=[ 'Development Status :: 4 - Beta', 'Intended Audience :: Science/Research', 'License :: OSI Approved :: MIT License...
17cdae7f50a7ed15c4e8a84cdb0000a32f824c5f
examples/outh/getaccesstoken.py
examples/outh/getaccesstoken.py
import webbrowser import tweepy """ Query the user for their consumer key/secret then attempt to fetch a valid access token. """ if __name__ == "__main__": consumer_key = raw_input('Consumer key: ').strip() consumer_secret = raw_input('Consumer secret: ').strip() auth = tweepy.OAuthHandler(consu...
Add an oauth example script.
Add an oauth example script.
Python
mit
xrg/tweepy,raymondethan/tweepy,damchilly/tweepy,mlinsey/tweepy,ze-phyr-us/tweepy,obskyr/tweepy,markunsworth/tweepy,edsu/tweepy,kcompher/tweepy,yared-bezum/tweepy,tuxos/tweepy,alexhanna/tweepy,nickmalleson/tweepy,iamjakob/tweepy,cogniteev/tweepy,cinemapub/bright-response,nickmalleson/tweepy,conversocial/tweepy,cinemapub...
<INSERT> import webbrowser import tweepy """ <INSERT_END> <INSERT> Query the user for their consumer key/secret then attempt to fetch a valid access token. """ if __name__ == "__main__": consumer_key = raw_input('Consumer key: ').strip() consumer_secret = raw_input('Consumer secret: ').strip() au...
Add an oauth example script.
83ca7677ac77d55f9ba978f2988b18faa9e74424
secondhand/urls.py
secondhand/urls.py
from django.conf.urls import patterns, include, url from tastypie.api import Api from tracker.api import UserResource, TaskResource, WorkSessionResource # Uncomment the next two lines to enable the admin: # from django.contrib import admin # admin.autodiscover() # tracker API. v1_api = Api(api_name='v1') v1_api.regis...
from django.conf.urls import patterns, include, url from tastypie.api import Api from tracker.api import UserResource, TaskResource, WorkSessionResource, \ RegistrationResource # Uncomment the next two lines to enable the admin: # from django.contrib import admin # admin.autodiscover() # tracker API. v1_api = Api...
Fix minor issue, reorganize imports, and register the RegistrationResource with the API.
Fix minor issue, reorganize imports, and register the RegistrationResource with the API.
Python
mit
GeneralMaximus/secondhand
<REPLACE_OLD> WorkSessionResource # <REPLACE_NEW> WorkSessionResource, \ RegistrationResource # <REPLACE_END> <REPLACE_OLD> Api(api_name='v1') v1_api.register(UserResource()) v1_api.register(TaskResource()) v1_api.register(WorkSessionResource()) urlpatterns <REPLACE_NEW> Api(api_name='v1') v1_api.register(UserRe...
Fix minor issue, reorganize imports, and register the RegistrationResource with the API. from django.conf.urls import patterns, include, url from tastypie.api import Api from tracker.api import UserResource, TaskResource, WorkSessionResource # Uncomment the next two lines to enable the admin: # from django.contrib im...
a634d90e4ac80027466782975007de33afcb4c28
etc/wpt-summarize.py
etc/wpt-summarize.py
#!/usr/bin/env python # Copyright 2019 The Servo Project Developers. See the COPYRIGHT # file at the top-level directory of this distribution. # # Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or # http://www.apache.org/licenses/LICENSE-2.0> or the MIT license # <LICENSE-MIT or http://opensource.org/l...
Add a script to extra logs for particular test filenames from full WPT logs.
Add a script to extra logs for particular test filenames from full WPT logs.
Python
mpl-2.0
KiChjang/servo,DominoTree/servo,splav/servo,splav/servo,DominoTree/servo,KiChjang/servo,KiChjang/servo,DominoTree/servo,splav/servo,DominoTree/servo,splav/servo,splav/servo,KiChjang/servo,DominoTree/servo,splav/servo,DominoTree/servo,DominoTree/servo,splav/servo,DominoTree/servo,KiChjang/servo,splav/servo,DominoTree/se...
<REPLACE_OLD> <REPLACE_NEW> #!/usr/bin/env python # Copyright 2019 The Servo Project Developers. See the COPYRIGHT # file at the top-level directory of this distribution. # # Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or # http://www.apache.org/licenses/LICENSE-2.0> or the MIT license # <LICENSE-M...
Add a script to extra logs for particular test filenames from full WPT logs.
5b50b96b35c678ca17b069630875a9d86e2cbca3
scripts/i18n/commons.py
scripts/i18n/commons.py
# -*- coding: utf-8 -*- msg = { 'en': { 'commons-file-moved' : u'[[:File:%s|File]] moved to [[:commons:File:%s|commons]].', 'commons-file-now-available' : u'File is now available on Wikimedia Commons.', 'commons-nowcommons-template' : 'en': u'{{subst:ncd|%s}}', }, 'qqq...
# -*- coding: utf-8 -*- msg = { 'en': { 'commons-file-moved' : u'[[:File:%s|File]] moved to [[:commons:File:%s|commons]].', 'commons-file-now-available' : u'File is now available on Wikimedia Commons.', }, 'qqq': { 'commons-file-now-available' : u'Edit summary when the bot has moved...
Remove the template for now.
Remove the template for now. git-svn-id: 9a050473c2aca1e14f53d73349e19b938c2cf203@9344 6a7f98fc-eeb0-4dc1-a6e2-c2c589a08aa6
Python
mit
legoktm/pywikipedia-rewrite
<REPLACE_OLD> Commons.', 'commons-nowcommons-template' <REPLACE_NEW> Commons.', }, 'qqq': { 'commons-file-now-available' <REPLACE_END> <DELETE> 'en': u'{{subst:ncd|%s}}', }, 'qqq': { 'commons-file-now-available': <DELETE_END> <REPLACE_OLD> 'commons-file-moved': <REPLACE_NEW> 'commons-file-moved'...
Remove the template for now. git-svn-id: 9a050473c2aca1e14f53d73349e19b938c2cf203@9344 6a7f98fc-eeb0-4dc1-a6e2-c2c589a08aa6 # -*- coding: utf-8 -*- msg = { 'en': { 'commons-file-moved' : u'[[:File:%s|File]] moved to [[:commons:File:%s|commons]].', 'commons-file-now-available' : u'File...
2a6a7b6fff73e6622ac8a4cdc97fa2701225691d
vigir_ltl_specification/src/vigir_ltl_specification/task_specification.py
vigir_ltl_specification/src/vigir_ltl_specification/task_specification.py
#!/usr/bin/env python import os import pprint import preconditions as precond from gr1_specification import GR1Specification from gr1_formulas import GR1Formula, FastSlowFormula """ Module's docstring #TODO """ VIGIR_ROOT_DIR = os.environ['VIGIR_ROOT_DIR'] class TaskSpecification(GR1Specification): """...""" d...
Add module for task-specific specs
[vigir_ltl_specification] Add module for task-specific specs
Python
bsd-3-clause
team-vigir/vigir_behavior_synthesis,team-vigir/vigir_behavior_synthesis
<REPLACE_OLD> <REPLACE_NEW> #!/usr/bin/env python import os import pprint import preconditions as precond from gr1_specification import GR1Specification from gr1_formulas import GR1Formula, FastSlowFormula """ Module's docstring #TODO """ VIGIR_ROOT_DIR = os.environ['VIGIR_ROOT_DIR'] class TaskSpecification(GR1Sp...
[vigir_ltl_specification] Add module for task-specific specs
3beffa750d68c2104b740193f0386be464829a1a
libpb/__init__.py
libpb/__init__.py
"""FreeBSD port building infrastructure.""" from __future__ import absolute_import from . import event def stop(kill=False, kill_clean=False): """Stop building ports and cleanup.""" from os import killpg from signal import SIGTERM, SIGKILL from .builder import builders from .env import cpus, flags from ....
"""FreeBSD port building infrastructure.""" from __future__ import absolute_import from . import event def stop(kill=False, kill_clean=False): """Stop building ports and cleanup.""" from os import killpg from signal import SIGTERM, SIGKILL from .builder import builders from .env import cpus, flags from ....
Use SystemExit, not exit() to initiate a shutdown.
Use SystemExit, not exit() to initiate a shutdown. exit() has unintented side affects, such as closing stdin, that are undesired as stdin is assumed to be writable while libpb/event/run unwinds (i.e. Top monitor).
Python
bsd-2-clause
DragonSA/portbuilder,DragonSA/portbuilder
<REPLACE_OLD> exit(254) <REPLACE_NEW> raise SystemExit(254) <REPLACE_END> <|endoftext|> """FreeBSD port building infrastructure.""" from __future__ import absolute_import from . import event def stop(kill=False, kill_clean=False): """Stop building ports and cleanup.""" from os import killpg from signal imp...
Use SystemExit, not exit() to initiate a shutdown. exit() has unintented side affects, such as closing stdin, that are undesired as stdin is assumed to be writable while libpb/event/run unwinds (i.e. Top monitor). """FreeBSD port building infrastructure.""" from __future__ import absolute_import from . import event...
7a20ee42aae2d2a6f5766ab4ec1ee4ef33fe14c8
madam_rest/__init__.py
madam_rest/__init__.py
from flask import Flask from madam import Madam app = Flask(__name__) app.from_object('config') asset_manager = Madam() asset_storage = app.config['ASSET_STORAGE'] from madam_rest import views
import madam from flask import Flask app = Flask(__name__) app.from_object('config') asset_manager = madam.Madam() asset_storage = madam.core.ShelveStorage(app.config['ASSET_STORAGE_PATH']) from madam_rest import views
Create shelve asset storage by default.
Create shelve asset storage by default.
Python
agpl-3.0
eseifert/madam-rest
<REPLACE_OLD> from <REPLACE_NEW> import madam from <REPLACE_END> <REPLACE_OLD> Flask from madam import Madam app <REPLACE_NEW> Flask app <REPLACE_END> <REPLACE_OLD> Madam() asset_storage <REPLACE_NEW> madam.Madam() asset_storage <REPLACE_END> <REPLACE_OLD> app.config['ASSET_STORAGE'] from <REPLACE_NEW> madam.core.Sh...
Create shelve asset storage by default. from flask import Flask from madam import Madam app = Flask(__name__) app.from_object('config') asset_manager = Madam() asset_storage = app.config['ASSET_STORAGE'] from madam_rest import views
fe50ea0dd1ceb51fdff455484cb5d2d32c94b076
spyder_unittest/__init__.py
spyder_unittest/__init__.py
from .unittest import UnitTestPlugin as PLUGIN_CLASS
# -*- coding:utf-8 -*- # ----------------------------------------------------------------------------- # Copyright (c) Spyder Project Developers # # Licensed under the terms of the MIT License # (see spyder/__init__.py for details) # ----------------------------------------------------------------------------- """Spyde...
Add version information and header
Add version information and header
Python
mit
jitseniesen/spyder-unittest
<REPLACE_OLD> from <REPLACE_NEW> # -*- coding:utf-8 -*- # ----------------------------------------------------------------------------- # Copyright (c) Spyder Project Developers # # Licensed under the terms of the MIT License # (see spyder/__init__.py for details) # -----------------------------------------------------...
Add version information and header from .unittest import UnitTestPlugin as PLUGIN_CLASS
dd5dc52e579e8571e7c888b536c0528002345394
setup.py
setup.py
from setuptools import setup #from osrm import __version__ with open("requirements.txt") as f: requirements = f.read().split('\n') setup( author_email="ustroetz@gmail.com", author="Ulric Stroetz, mthh", description="A Python wrapper around the OSRM API", install_requires=requirements, name='o...
from setuptools import setup #from osrm import __version__ with open("requirements.txt") as f: requirements = f.read().split('\n') setup( author_email="ustroetz@gmail.com", author="Uli Strötz, mthh", description="A Python wrapper around the OSRM API", install_requires=requirements, name='osrm...
Fix typo in author name
Fix typo in author name
Python
mit
ustroetz/python-osrm,mthh/python-osrm,mthh/python-osrm,ustroetz/python-osrm
<REPLACE_OLD> author="Ulric Stroetz, <REPLACE_NEW> author="Uli Strötz, <REPLACE_END> <|endoftext|> from setuptools import setup #from osrm import __version__ with open("requirements.txt") as f: requirements = f.read().split('\n') setup( author_email="ustroetz@gmail.com", author="Uli Strötz, mthh", de...
Fix typo in author name from setuptools import setup #from osrm import __version__ with open("requirements.txt") as f: requirements = f.read().split('\n') setup( author_email="ustroetz@gmail.com", author="Ulric Stroetz, mthh", description="A Python wrapper around the OSRM API", install_requires=...
dff9ab05d0d3f7f2a8f2e69d1d1e743966dfce51
vpn-proxy/app/management/commands/reset_tunnels.py
vpn-proxy/app/management/commands/reset_tunnels.py
from django.core.management.base import BaseCommand from app.models import Tunnel class Command(BaseCommand): help = "Create superuser if missing (Non Interactive)." def add_arguments(self, parser): parser.add_argument('tunnel', nargs='*', type=int) def handle(self, *args, **kwargs): if ...
Add reset tunnels management command
Add reset tunnels management command
Python
apache-2.0
pchristos/vpn-proxy,dimrozakis/vpn-proxy,pchristos/vpn-proxy,dimrozakis/vpn-proxy
<INSERT> from django.core.management.base import BaseCommand from app.models import Tunnel class Command(BaseCommand): <INSERT_END> <INSERT> help = "Create superuser if missing (Non Interactive)." def add_arguments(self, parser): parser.add_argument('tunnel', nargs='*', type=int) def handle(self,...
Add reset tunnels management command
a1e7a7cff8ee6d15dac1dee67a5ea5bd932252de
nemubot/message/printer/test_socket.py
nemubot/message/printer/test_socket.py
# Nemubot is a smart and modulable IM bot. # Copyright (C) 2012-2015 Mercier Pierre-Olivier # # 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 yo...
Add test for socket printer
Add test for socket printer
Python
agpl-3.0
nemunaire/nemubot,nbr23/nemubot
<REPLACE_OLD> <REPLACE_NEW> # Nemubot is a smart and modulable IM bot. # Copyright (C) 2012-2015 Mercier Pierre-Olivier # # 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 ...
Add test for socket printer
2341e59f7e93865ebe6816db1c6c79c84a3d09cc
setup.py
setup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os from distutils.core import setup setup( name='regulations-parser', url='https://github.com/cfpb/regulations-parser', author='CFPB', author_email='tech@cfpb.gov', license='CC0', version='0.1.0', description='eCFR Parser for eRegulation...
Make the parser an installable Python package
Make the parser an installable Python package
Python
cc0-1.0
grapesmoker/regulations-parser
<INSERT> #!/usr/bin/env python # -*- coding: utf-8 -*- import os from distutils.core import setup setup( <INSERT_END> <INSERT> name='regulations-parser', url='https://github.com/cfpb/regulations-parser', author='CFPB', author_email='tech@cfpb.gov', license='CC0', version='0.1.0', descriptio...
Make the parser an installable Python package
c64a9a586a5997c3a5a8683913e6a52075618ac8
virtool/uploads/models.py
virtool/uploads/models.py
import enum from sqlalchemy import Column, String, Boolean, Integer, DateTime, Enum from virtool.postgres import Base class UploadType(str, enum.Enum): hmm = "hmm" reference = "reference" reads = "reads" subtraction = "subtraction" class Upload(Base): __tablename__ = "uploads" id = Column...
import enum from sqlalchemy import Column, String, Boolean, Integer, DateTime, Enum from virtool.postgres import Base class UploadType(str, enum.Enum): hmm = "hmm" reference = "reference" reads = "reads" subtraction = "subtraction" class Upload(Base): __tablename__ = "uploads" id = Column...
Fix format issue with `__repr__`
Fix format issue with `__repr__`
Python
mit
virtool/virtool,igboyes/virtool,virtool/virtool,igboyes/virtool
<REPLACE_OLD> f"uploaded_at={self.uploaded_at}>" <REPLACE_NEW> f"uploaded_at={self.uploaded_at})>" <REPLACE_END> <|endoftext|> import enum from sqlalchemy import Column, String, Boolean, Integer, DateTime, Enum from virtool.postgres import Base class UploadType(str, enum.Enum): hmm = "hmm" reference = "re...
Fix format issue with `__repr__` import enum from sqlalchemy import Column, String, Boolean, Integer, DateTime, Enum from virtool.postgres import Base class UploadType(str, enum.Enum): hmm = "hmm" reference = "reference" reads = "reads" subtraction = "subtraction" class Upload(Base): __tablen...
5bb90727efb62525995caad3b52fd588d8b08298
pregnancy/urls.py
pregnancy/urls.py
from django.conf.urls import patterns, include, url # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() import contractions.views urlpatterns = patterns('', # Examples: # url(r'^$', 'pregnancy.views.home', name='home'), # url(r'^pregnancy/', include('...
from django.conf.urls import patterns, include, url # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() import contractions.views urlpatterns = patterns('', # Examples: # url(r'^$', 'pregnancy.views.home', name='home'), # url(r'^pregnancy/', include('...
Update url to point / to the contractions app
Update url to point / to the contractions app
Python
bsd-2-clause
dreinhold/pregnancy,dreinhold/pregnancy,dreinhold/pregnancy
<INSERT> url(r'^$', contractions.views.ContractionList.as_view(), name='ContractionList'), <INSERT_END> <|endoftext|> from django.conf.urls import patterns, include, url # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() import contractions.views urlpatterns...
Update url to point / to the contractions app from django.conf.urls import patterns, include, url # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() import contractions.views urlpatterns = patterns('', # Examples: # url(r'^$', 'pregnancy.views.home', na...
610c979d00b3b89f3f2b16d58e4b2a797b380d41
tests/fixtures/postgres.py
tests/fixtures/postgres.py
import pytest from sqlalchemy import text from sqlalchemy.exc import ProgrammingError from sqlalchemy.ext.asyncio import create_async_engine from sqlalchemy.ext.asyncio import AsyncSession from virtool.postgres import Base @pytest.fixture def test_pg_connection_string(request): return request.config.getoption("...
import pytest from sqlalchemy import text from sqlalchemy.exc import ProgrammingError from sqlalchemy.ext.asyncio import create_async_engine from sqlalchemy.ext.asyncio import AsyncSession from virtool.postgres import Base @pytest.fixture def test_pg_connection_string(request): return request.config.getoption("...
Add connection string for connecting to virtool database in order to create a test database
Add connection string for connecting to virtool database in order to create a test database
Python
mit
igboyes/virtool,virtool/virtool,igboyes/virtool,virtool/virtool
<INSERT> pg_connection_string = test_pg_connection_string.split('/') pg_connection_string[-1] = 'virtool' <INSERT_END> <REPLACE_OLD> create_async_engine("postgresql+asyncpg://virtool:virtool@localhost/virtool", <REPLACE_NEW> create_async_engine('/'.join(pg_connection_string), <REPLACE_END> <|endoftext|> import ...
Add connection string for connecting to virtool database in order to create a test database import pytest from sqlalchemy import text from sqlalchemy.exc import ProgrammingError from sqlalchemy.ext.asyncio import create_async_engine from sqlalchemy.ext.asyncio import AsyncSession from virtool.postgres import Base ...
c4b7bd5b74aaba210a05f946d59c98894b60b21f
tests/cli/test_pixel.py
tests/cli/test_pixel.py
""" Test ``yatsm line`` """ import os from click.testing import CliRunner import pytest from yatsm.cli.main import cli @pytest.mark.skipif("DISPLAY" not in os.environ, reason="requires display") def test_cli_pixel_pass_1(example_timeseries): """ Correctly run for one pixel """ runner = CliRunner() r...
Add test for pixel CLI
Add test for pixel CLI
Python
mit
ceholden/yatsm,c11/yatsm,ceholden/yatsm,valpasq/yatsm,c11/yatsm,valpasq/yatsm
<INSERT> """ Test ``yatsm line`` """ import os from click.testing import CliRunner import pytest from yatsm.cli.main import cli @pytest.mark.skipif("DISPLAY" not in os.environ, reason="requires display") def test_cli_pixel_pass_1(example_timeseries): <INSERT_END> <INSERT> """ Correctly run for one pixel """ ...
Add test for pixel CLI
aaa0f03a91f3326dc893175510a4ad35649ec371
pltpreview/view.py
pltpreview/view.py
"""Convenience functions for matplotlib plotting and image viewing.""" import numpy as np from matplotlib import pyplot as plt def show(image, blocking=False, **kwargs): """Show *image*. If *blocking* is False the call is nonblocking. *kwargs* are passed to matplotlib's ``imshow`` function. This command a...
"""Convenience functions for matplotlib plotting and image viewing.""" import numpy as np from matplotlib import pyplot as plt def show(image, blocking=False, **kwargs): """Show *image*. If *blocking* is False the call is nonblocking. *kwargs* are passed to matplotlib's ``imshow`` function. This command a...
Create new figure in plot command
Create new figure in plot command
Python
mit
tfarago/pltpreview
<REPLACE_OLD> nonblocking. <REPLACE_NEW> nonblocking. This command always creates a new figure. <REPLACE_END> <INSERT> plt.figure() <INSERT_END> <|endoftext|> """Convenience functions for matplotlib plotting and image viewing.""" import numpy as np from matplotlib import pyplot as plt def show(image, blocking=F...
Create new figure in plot command """Convenience functions for matplotlib plotting and image viewing.""" import numpy as np from matplotlib import pyplot as plt def show(image, blocking=False, **kwargs): """Show *image*. If *blocking* is False the call is nonblocking. *kwargs* are passed to matplotlib's ``im...
e37e964bf9d2819c0234303d31ed2839c317be04
openquake/engine/tests/export/core_test.py
openquake/engine/tests/export/core_test.py
# Copyright (c) 2010-2014, GEM Foundation. # # OpenQuake 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. # # OpenQuake is distr...
# Copyright (c) 2010-2014, GEM Foundation. # # OpenQuake 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. # # OpenQuake is distr...
Fix a broken export test
Fix a broken export test
Python
agpl-3.0
gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine
<REPLACE_OLD> namespaces=nrml.PARSE_NS_MAP)) class <REPLACE_NEW> namespaces={'nrml': nrml.NRML05})) class <REPLACE_END> <|endoftext|> # Copyright (c) 2010-2014, GEM Foundation. # # OpenQuake is free software: you can redistribute it and/or modify it # under the terms of the GNU Affero General Public License as pub...
Fix a broken export test # Copyright (c) 2010-2014, GEM Foundation. # # OpenQuake 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 versi...
81978240e48dbaac2567054b33617a1acabbb695
corehq/apps/app_manager/tasks.py
corehq/apps/app_manager/tasks.py
from celery.task import task from corehq.apps.users.models import CommCareUser @task def create_user_cases(domain_name): from corehq.apps.callcenter.utils import sync_usercase for user in CommCareUser.by_domain(domain_name): sync_usercase(user)
from celery.task import task from corehq.apps.users.models import CommCareUser @task(queue='background_queue') def create_user_cases(domain_name): from corehq.apps.callcenter.utils import sync_usercase for user in CommCareUser.by_domain(domain_name): sync_usercase(user)
Use background queue for creating user cases
Use background queue for creating user cases
Python
bsd-3-clause
qedsoftware/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq
<REPLACE_OLD> CommCareUser @task def <REPLACE_NEW> CommCareUser @task(queue='background_queue') def <REPLACE_END> <|endoftext|> from celery.task import task from corehq.apps.users.models import CommCareUser @task(queue='background_queue') def create_user_cases(domain_name): from corehq.apps.callcenter.utils i...
Use background queue for creating user cases from celery.task import task from corehq.apps.users.models import CommCareUser @task def create_user_cases(domain_name): from corehq.apps.callcenter.utils import sync_usercase for user in CommCareUser.by_domain(domain_name): sync_usercase(user)
eda80dd9a903a7baaddad123978981352de6d337
project/app/migrations/0003_auto_20170311_0837.py
project/app/migrations/0003_auto_20170311_0837.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.6 on 2017-03-11 16:37 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('app', '0002_auto_20170311_0811'), ] operations = [ migrations.AlterUniqueTogether( ...
Remove constraint on Session model
Remove constraint on Session model
Python
bsd-2-clause
barberscore/barberscore-api,barberscore/barberscore-api,dbinetti/barberscore-django,barberscore/barberscore-api,dbinetti/barberscore,dbinetti/barberscore,dbinetti/barberscore-django,barberscore/barberscore-api
<INSERT> # -*- coding: utf-8 -*- # Generated by Django 1.10.6 on 2017-03-11 16:37 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): <INSERT_END> <INSERT> dependencies = [ ('app', '0002_auto_20170311_0811'), ] operations = [ mi...
Remove constraint on Session model
8ebba2af62f7b917427fa1233ad81314f4e47102
shade/tests/unit/test_operator_noauth.py
shade/tests/unit/test_operator_noauth.py
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
Add test of OperatorCloud auth_type=None
Add test of OperatorCloud auth_type=None Ironic features a noauth mode which is intended for use in isolated trusted environments. As this is not a normal use case for shade, it is an increadibly important item to have a test for. Change-Id: If86b9df238982d912105fb08dcd59c9c85b7de4a
Python
apache-2.0
stackforge/python-openstacksdk,dtroyer/python-openstacksdk,stackforge/python-openstacksdk,openstack-infra/shade,dtroyer/python-openstacksdk,openstack-infra/shade,openstack/python-openstacksdk,jsmartin/shade,jsmartin/shade,openstack/python-openstacksdk
<REPLACE_OLD> <REPLACE_NEW> # Copyright (c) 2015 Hewlett-Packard Development Company, L.P. # # 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 #...
Add test of OperatorCloud auth_type=None Ironic features a noauth mode which is intended for use in isolated trusted environments. As this is not a normal use case for shade, it is an increadibly important item to have a test for. Change-Id: If86b9df238982d912105fb08dcd59c9c85b7de4a
8b2cb51c8913737c524e1b922aeb02c07bfb2afc
src/keybar/models/entry.py
src/keybar/models/entry.py
from django.db import models from django.utils.translation import ugettext_lazy as _ from uuidfield import UUIDField from keybar.utils.crypto import encrypt, get_salt class Entry(models.Model): id = UUIDField(auto=True, primary_key=True) created_by = models.ForeignKey('keybar.User') title = models.TextF...
from django.db import models from django.utils.translation import ugettext_lazy as _ from uuidfield import UUIDField from keybar.utils.crypto import encrypt, decrypt, get_salt class Entry(models.Model): id = UUIDField(auto=True, primary_key=True) created_by = models.ForeignKey('keybar.User') title = mod...
Add decrypt helper to Entry
Add decrypt helper to Entry
Python
bsd-3-clause
keybar/keybar
<INSERT> decrypt, <INSERT_END> <REPLACE_OLD> salt <REPLACE_NEW> salt def decrypt(self, password): return decrypt(self.value, password, bytes(self.salt)) <REPLACE_END> <|endoftext|> from django.db import models from django.utils.translation import ugettext_lazy as _ from uuidfield import UUIDField from k...
Add decrypt helper to Entry from django.db import models from django.utils.translation import ugettext_lazy as _ from uuidfield import UUIDField from keybar.utils.crypto import encrypt, get_salt class Entry(models.Model): id = UUIDField(auto=True, primary_key=True) created_by = models.ForeignKey('keybar.Us...
aa8117c288fc45743554450448178c47246b088f
devicehive/transport.py
devicehive/transport.py
def init(name, data_format_class, data_format_options, handler_class, handler_options): transport_class_name = '%sTransport' % name.title() transport_module = __import__('devicehive.transports.%s_transport' % name, fromlist=[transport_class_name]) return getattr(tr...
def init(name, data_format_class, data_format_options, handler_class, handler_options): transport_class_name = '%sTransport' % name.title() transport_module = __import__('devicehive.transports.%s_transport' % name, fromlist=[transport_class_name]) return getattr(tr...
Remove Request and Response classes
Remove Request and Response classes
Python
apache-2.0
devicehive/devicehive-python
<REPLACE_OLD> handler_options) class Request(object): """Request class.""" def __init__(self, url, action, request, **params): self.action = action self.request = request self.params = params self.params['url'] = url class Response(object): """Response class.""" def...
Remove Request and Response classes def init(name, data_format_class, data_format_options, handler_class, handler_options): transport_class_name = '%sTransport' % name.title() transport_module = __import__('devicehive.transports.%s_transport' % name, fromlist=[transpo...
4486009178284e83fdcae7b7a6e6b755a74f22a7
alg_cartesian_product.py
alg_cartesian_product.py
"""Cartesian product of same numbers with repeated times.""" class CartesianProduct(object): def _product_two(self, nums1, nums2): two_products = [] for i in range(len(nums1)): for j in range(len(nums2)): if isinstance(nums1[0], list): # nums1[i] is ...
Complete cartesian product for repeated
Complete cartesian product for repeated
Python
bsd-2-clause
bowen0701/algorithms_data_structures
<REPLACE_OLD> <REPLACE_NEW> """Cartesian product of same numbers with repeated times.""" class CartesianProduct(object): def _product_two(self, nums1, nums2): two_products = [] for i in range(len(nums1)): for j in range(len(nums2)): if isinstance(nums1[0], list): ...
Complete cartesian product for repeated
d80ee56ea6259265a534231a52146f9fd04c9689
taskflow/engines/__init__.py
taskflow/engines/__init__.py
# -*- coding: utf-8 -*- # Copyright (C) 2012 Yahoo! Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2...
# -*- coding: utf-8 -*- # Copyright (C) 2012 Yahoo! Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2...
Use oslo_utils eventletutils to warn about eventlet patching
Use oslo_utils eventletutils to warn about eventlet patching Change-Id: I86ba0de51b5c5789efae187ebc1c46ae32ff8b8b
Python
apache-2.0
jimbobhickville/taskflow,openstack/taskflow,jimbobhickville/taskflow,openstack/taskflow,junneyang/taskflow,pombredanne/taskflow-1,junneyang/taskflow,pombredanne/taskflow-1
<REPLACE_OLD> License. # promote <REPLACE_NEW> License. from oslo_utils import eventletutils as _eventletutils # Give a nice warning that if eventlet is being used these modules # are highly recommended to be patched (or otherwise bad things could # happen). _eventletutils.warn_eventlet_not_patched( expected_pa...
Use oslo_utils eventletutils to warn about eventlet patching Change-Id: I86ba0de51b5c5789efae187ebc1c46ae32ff8b8b # -*- coding: utf-8 -*- # Copyright (C) 2012 Yahoo! Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance...
792072f6e95101395f49f62ca6276eb287cbaf30
proxy.py
proxy.py
import sys import socket import threading def server_loop(local_host, local_port, remote_host, remote_port, receive_first): """ The proxy is represented by the local host and port. The remote host and port represent the service's server. """ server = socket.socket(socket.AF_INET, s...
Add the main server loop
Add the main server loop
Python
mit
inakidelamadrid/bhp_exercises
<REPLACE_OLD> <REPLACE_NEW> import sys import socket import threading def server_loop(local_host, local_port, remote_host, remote_port, receive_first): """ The proxy is represented by the local host and port. The remote host and port represent the service's server. """ server = so...
Add the main server loop
400c8de8a3a714da21c0e2b175c6e4adad3677b9
syft/__init__.py
syft/__init__.py
import importlib import pkgutil ignore_packages = set(['test']) def import_submodules(package, recursive=True): """ Import all submodules of a module, recursively, including subpackages :param package: package (name or actual module) :type package: str | module :rtype: dict[str, types.ModuleType] ...
import importlib import pkgutil ignore_packages = set(['test']) def import_submodules(package, recursive=True): """ Import all submodules of a module, recursively, including subpackages :param package: package (name or actual module) :type package: str | module :rtype: dict[str, types.ModuleType] ...
Check for the name of the submodule we'd like to ignore in a more general way.
Check for the name of the submodule we'd like to ignore in a more general way.
Python
apache-2.0
aradhyamathur/PySyft,sajalsubodh22/PySyft,OpenMined/PySyft,dipanshunagar/PySyft,sajalsubodh22/PySyft,dipanshunagar/PySyft,joewie/PySyft,cypherai/PySyft,cypherai/PySyft,joewie/PySyft,aradhyamathur/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft
<REPLACE_OLD> if(name <REPLACE_NEW> # test submodule names are 'syft.test.*', so this matches the 'ignore_packages' above if name.split('.')[1] <REPLACE_END> <REPLACE_OLD> ignore_packages): <REPLACE_NEW> ignore_packages: <REPLACE_END> <|endoftext|> import importlib import pkgutil ignore_packages = set(['test...
Check for the name of the submodule we'd like to ignore in a more general way. import importlib import pkgutil ignore_packages = set(['test']) def import_submodules(package, recursive=True): """ Import all submodules of a module, recursively, including subpackages :param package: package (name or actual mod...
b5bf391ca0303f877b39bed4c3266441a9b78b2b
src/waldur_mastermind/common/serializers.py
src/waldur_mastermind/common/serializers.py
from rest_framework import serializers def validate_options(options, attributes): fields = {} for name, option in options.items(): params = {} field_type = option.get('type', '') field_class = serializers.CharField if field_type == 'integer': field_class = seriali...
from rest_framework import serializers class StringListSerializer(serializers.ListField): child = serializers.CharField() FIELD_CLASSES = { 'integer': serializers.IntegerField, 'date': serializers.DateField, 'time': serializers.TimeField, 'money': serializers.IntegerField, 'boolean': seriali...
Fix validation of OpenStack select fields in request-based item form
Fix validation of OpenStack select fields in request-based item form [WAL-4035]
Python
mit
opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur
<REPLACE_OLD> serializers def <REPLACE_NEW> serializers class StringListSerializer(serializers.ListField): child = serializers.CharField() FIELD_CLASSES = { 'integer': serializers.IntegerField, 'date': serializers.DateField, 'time': serializers.TimeField, 'money': serializers.IntegerField, ...
Fix validation of OpenStack select fields in request-based item form [WAL-4035] from rest_framework import serializers def validate_options(options, attributes): fields = {} for name, option in options.items(): params = {} field_type = option.get('type', '') field_class = serializers...
315a5c25429b3910446714238c28382ba727add8
copywriting/urls.py
copywriting/urls.py
from django.conf.urls.defaults import * from .feed import blogFeed urlpatterns = patterns('copywriting', (r'^feed\.rss$', blogFeed()), (r'^feed/$', blogFeed()), (r'^tag/(?P<in_tag>\w+)/$', 'views.withTag'), ...
from django.conf.urls.defaults import * from .feed import blogFeed urlpatterns = patterns('copywriting', (r'^feed\.rss$', blogFeed()), (r'^feed/$', blogFeed()), (r'^tag/(?P<in_tag>\w[\w-]+)/$', 'views.withTag'), # (r'^(?P<year>\d+)/(?P<month>\d+)/(?P<day>\d+)/$', 'views.listBlogEntriesByYearMonthDay'),...
Allow slugs in url patterns
Allow slugs in url patterns
Python
mit
arteria/django-copywriting,arteria/django-copywriting
<DELETE> <DELETE_END> <DELETE> <DELETE_END> <REPLACE_OLD> (r'^tag/(?P<in_tag>\w+)/$', <REPLACE_NEW> (r'^tag/(?P<in_tag>\w[\w-]+)/$', <REPLACE_END> <REPLACE_OLD> (r'^(?P<requestYear>\d+)/(?P<requestMonth>\d+)/$', 'views.lis...
Allow slugs in url patterns from django.conf.urls.defaults import * from .feed import blogFeed urlpatterns = patterns('copywriting', (r'^feed\.rss$', blogFeed()), (r'^feed/$', blogFeed()), (r'^tag/(?P<in_tag>\w+)/$', ...
0a884d3c38cb1449a6fa5c650ed06cde647de4a8
settings/sqlite.py
settings/sqlite.py
from .base import * import os.path DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(SITE_ROOT, 'dev.db'), } } SESSION_COOKIE_DOMAIN = None HAYSTACK_SOLR_URL = 'http://localhost:8983/solr'
from .base import * import os.path DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(SITE_ROOT, 'dev.db'), } } SESSION_COOKIE_DOMAIN = None HAYSTACK_SOLR_URL = 'http://localhost:8983/solr' try: ...
Allow local settings override as well.
Allow local settings override as well.
Python
mit
singingwolfboy/readthedocs.org,laplaceliu/readthedocs.org,kenwang76/readthedocs.org,hach-que/readthedocs.org,fujita-shintaro/readthedocs.org,rtfd/readthedocs.org,tddv/readthedocs.org,raven47git/readthedocs.org,mhils/readthedocs.org,royalwang/readthedocs.org,johncosta/private-readthedocs.org,asampat3090/readthedocs.org,...
<REPLACE_OLD> 'http://localhost:8983/solr' <REPLACE_NEW> 'http://localhost:8983/solr' try: from local_settings import * except: pass <REPLACE_END> <|endoftext|> from .base import * import os.path DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3...
Allow local settings override as well. from .base import * import os.path DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(SITE_ROOT, 'dev.db'), } } SESSION_COOKIE_DOMAIN = None HAYSTACK_SOLR_URL ...
77af87198d1116b77df431d9139b30f76103dd64
fellowms/migrations/0023_auto_20160617_1350.py
fellowms/migrations/0023_auto_20160617_1350.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.5 on 2016-06-17 13:50 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('fellowms', '0022_event_report_url'), ] operations = [ migrations.AddField( ...
Add migration for latitute and longitude of event
Add migration for latitute and longitude of event
Python
bsd-3-clause
softwaresaved/fat,softwaresaved/fat,softwaresaved/fat,softwaresaved/fat
<INSERT> # -*- coding: utf-8 -*- # Generated by Django 1.9.5 on 2016-06-17 13:50 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): <INSERT_END> <INSERT> dependencies = [ ('fellowms', '0022_event_report_url'), ] operations = [ ...
Add migration for latitute and longitude of event
cfcce6d4002657f72afdd780af06b3bfa4d9e10d
neo/test/iotest/test_axonaio.py
neo/test/iotest/test_axonaio.py
""" Tests of neo.io.axonaio """ import unittest from neo.io.axonaio import AxonaIO from neo.test.iotest.common_io_test import BaseTestIO from neo.io.proxyobjects import (AnalogSignalProxy, SpikeTrainProxy, EventProxy, EpochProxy) from neo import (AnalogSignal, SpikeTrain) import quantities as pq impo...
""" Tests of neo.io.axonaio """ import unittest from neo.io.axonaio import AxonaIO from neo.test.iotest.common_io_test import BaseTestIO from neo.io.proxyobjects import (AnalogSignalProxy, SpikeTrainProxy, EventProxy, EpochProxy) from neo import (AnalogSignal, SpikeTrain) import quantities as pq impo...
Add new files to common io tests
Add new files to common io tests
Python
bsd-3-clause
apdavison/python-neo,NeuralEnsemble/python-neo,JuliaSprenger/python-neo,samuelgarcia/python-neo,INM-6/python-neo
<REPLACE_OLD> 'axona/axona_raw.set' <REPLACE_NEW> 'axona/axona_raw.set', 'axona/dataset_unit_spikes/20140815-180secs.set' <REPLACE_END> <|endoftext|> """ Tests of neo.io.axonaio """ import unittest from neo.io.axonaio import AxonaIO from neo.test.iotest.common_io_test import BaseTestIO from neo.io.proxyobje...
Add new files to common io tests """ Tests of neo.io.axonaio """ import unittest from neo.io.axonaio import AxonaIO from neo.test.iotest.common_io_test import BaseTestIO from neo.io.proxyobjects import (AnalogSignalProxy, SpikeTrainProxy, EventProxy, EpochProxy) from neo import (AnalogSignal, SpikeTr...
fed2e3f9bdb3a00b077b5e7df1aed4d927b77b6c
tests/clifford_test.py
tests/clifford_test.py
"""Test for the Clifford algebra drudge.""" from drudge import CliffordDrudge, Vec, inner_by_delta def test_clifford_drudge_by_quaternions(spark_ctx): """Test basic functionality of Clifford drudge by quaternions. """ dr = CliffordDrudge( spark_ctx, inner=lambda v1, v2: -inner_by_delta(v1, v2) ...
Add test for Clifford drudge by quaternions
Add test for Clifford drudge by quaternions
Python
mit
tschijnmo/drudge,tschijnmo/drudge,tschijnmo/drudge
<INSERT> """Test for the Clifford algebra drudge.""" from drudge import CliffordDrudge, Vec, inner_by_delta def test_clifford_drudge_by_quaternions(spark_ctx): <INSERT_END> <INSERT> """Test basic functionality of Clifford drudge by quaternions. """ dr = CliffordDrudge( spark_ctx, inner=lambda v1,...
Add test for Clifford drudge by quaternions
b1eba723dbdc068558ab34cc226c32bcb8bfa2ef
intake_bluesky/tests/test_core.py
intake_bluesky/tests/test_core.py
import event_model from intake_bluesky.core import documents_to_xarray def test_no_descriptors(): run_bundle = event_model.compose_run() start_doc = run_bundle.start_doc stop_doc = run_bundle.compose_stop() documents_to_xarray(start_doc=start_doc, stop_doc=stop_doc, descriptor_docs=[], ...
Test runs with no descriptors or no events.
TST: Test runs with no descriptors or no events.
Python
bsd-3-clause
ericdill/databroker,ericdill/databroker
<INSERT> import event_model from intake_bluesky.core import documents_to_xarray def test_no_descriptors(): <INSERT_END> <INSERT> run_bundle = event_model.compose_run() start_doc = run_bundle.start_doc stop_doc = run_bundle.compose_stop() documents_to_xarray(start_doc=start_doc, stop_doc=stop_doc, ...
TST: Test runs with no descriptors or no events.
f68daf88cd7fb6cad64a72ef48af5b9b616ca4c6
StudentsListHandler.py
StudentsListHandler.py
__author__ = 'Mael Beuget, Pierre Monnin & Thibaut Smith' from BaseHandler import * import logging from XMLAnalyser import XMLAnalyser from google.appengine.api import memcache class StudentsListHandler(BaseHandler): def __init__(self, request=None, response=None): self.initialize(request, response) ...
__author__ = 'Mael Beuget, Pierre Monnin & Thibaut Smith' from BaseHandler import * import logging from XMLAnalyser import XMLAnalyser from google.appengine.api import memcache class StudentsListHandler(BaseHandler): def __init__(self, request=None, response=None): self.initialize(request, response) ...
Change memcache expiration timing to 1 week
Change memcache expiration timing to 1 week
Python
mit
Videl/absentees-blackboard,Videl/absentees-blackboard
<REPLACE_OLD> time=7200); <REPLACE_NEW> time=604800); <REPLACE_END> <|endoftext|> __author__ = 'Mael Beuget, Pierre Monnin & Thibaut Smith' from BaseHandler import * import logging from XMLAnalyser import XMLAnalyser from google.appengine.api import memcache class StudentsListHandler(BaseHandler): def __init_...
Change memcache expiration timing to 1 week __author__ = 'Mael Beuget, Pierre Monnin & Thibaut Smith' from BaseHandler import * import logging from XMLAnalyser import XMLAnalyser from google.appengine.api import memcache class StudentsListHandler(BaseHandler): def __init__(self, request=None, response=None): ...
6bde135b964690d2c51fe944e52f2a9c9c9dadab
opps/db/_redis.py
opps/db/_redis.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from opps.db.conf import settings from redis import ConnectionPool from redis import Redis as RedisClient class Redis: def __init__(self, key_prefix, key_sufix): self.key_prefix = key_prefix self.key_sufix = key_sufix self.host = settings.OPPS...
#!/usr/bin/env python # -*- coding: utf-8 -*- from opps.db.conf import settings from redis import ConnectionPool from redis import Redis as RedisClient class Redis: def __init__(self, key_prefix, key_sufix): self.key_prefix = key_prefix self.key_sufix = key_sufix self.host = settings.OPPS...
Add method save, manager create or update on opps db redis
Add method save, manager create or update on opps db redis
Python
mit
jeanmask/opps,opps/opps,YACOWS/opps,jeanmask/opps,jeanmask/opps,williamroot/opps,williamroot/opps,williamroot/opps,YACOWS/opps,opps/opps,opps/opps,williamroot/opps,YACOWS/opps,YACOWS/opps,jeanmask/opps,opps/opps
<INSERT> def save(self, document): return self.conn.set(self.key(), document) <INSERT_END> <|endoftext|> #!/usr/bin/env python # -*- coding: utf-8 -*- from opps.db.conf import settings from redis import ConnectionPool from redis import Redis as RedisClient class Redis: def __init__(self, key_prefix,...
Add method save, manager create or update on opps db redis #!/usr/bin/env python # -*- coding: utf-8 -*- from opps.db.conf import settings from redis import ConnectionPool from redis import Redis as RedisClient class Redis: def __init__(self, key_prefix, key_sufix): self.key_prefix = key_prefix ...
1ed7d695eff134557990d8b1a5dffa51b6d1d2f6
distarray/run_tests.py
distarray/run_tests.py
# encoding: utf-8 # --------------------------------------------------------------------------- # Copyright (C) 2008-2014, IPython Development Team and Enthought, Inc. # Distributed under the terms of the BSD License. See COPYING.rst. # --------------------------------------------------------------------------- """...
# encoding: utf-8 # --------------------------------------------------------------------------- # Copyright (C) 2008-2014, IPython Development Team and Enthought, Inc. # Distributed under the terms of the BSD License. See COPYING.rst. # --------------------------------------------------------------------------- """...
Return returncode from shell command.
Return returncode from shell command.
Python
bsd-3-clause
enthought/distarray,RaoUmer/distarray,RaoUmer/distarray,enthought/distarray
<REPLACE_OLD> break <REPLACE_NEW> return proc.wait() <REPLACE_END> <INSERT> return <INSERT_END> <REPLACE_OLD> test() <REPLACE_NEW> sys.exit(test()) <REPLACE_END> <|endoftext|> # encoding: utf-8 # --------------------------------------------------------------------------- # Copyright (C) 2008-2014, IPython Developm...
Return returncode from shell command. # encoding: utf-8 # --------------------------------------------------------------------------- # Copyright (C) 2008-2014, IPython Development Team and Enthought, Inc. # Distributed under the terms of the BSD License. See COPYING.rst. # ------------------------------------------...
76ae560be419ac350d79db08772d6b7f5722754b
python/sparktestingbase/test/simple_streaming_test.py
python/sparktestingbase/test/simple_streaming_test.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
Add a second trivial streaming test to make sure our re-useing the spark context is ok
Add a second trivial streaming test to make sure our re-useing the spark context is ok
Python
apache-2.0
holdenk/spark-testing-base,holdenk/spark-testing-base,ponkin/spark-testing-base,joychugh/spark-testing-base,MiguelPeralvo/spark-testing-base,snithish/spark-testing-base,samklr/spark-testing-base,ghl3/spark-testing-base,MiguelPeralvo/spark-testing-base,MiguelPeralvo/spark-testing-base,jnadler/spark-testing-base,eyeem/sp...
<REPLACE_OLD> ")) <REPLACE_NEW> ")) @classmethod def noop(cls, f): return f.map(lambda x: x) <REPLACE_END> <REPLACE_OLD> expected) if <REPLACE_NEW> expected) def test_noop_transformation(self): input = [["hi"], ["hi holden"], ["bye"]] self.run_func(input, SimpleStreamingTe...
Add a second trivial streaming test to make sure our re-useing the spark context is ok # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses ...
aaf8ebb7b1b12b15ab96c2cd1d7cb053154e8d64
tests/lib/query_models/test_query_string_match.py
tests/lib/query_models/test_query_string_match.py
from positive_test_suite import PositiveTestSuite from negative_test_suite import NegativeTestSuite import os import sys sys.path.append(os.path.join(os.path.dirname(__file__), "../../lib")) from query_models import QueryStringMatch class TestQueryStringMatchPositiveTestSuite(PositiveTestSuite): def query_tests(...
from positive_test_suite import PositiveTestSuite from negative_test_suite import NegativeTestSuite import os import sys sys.path.append(os.path.join(os.path.dirname(__file__), "../../lib")) from query_models import QueryStringMatch hostname_test_regex = 'hostname: /(.*\.)*(sub|bus)+(\..*)*\.abc(\..*)*\.company\.com...
Add extra tests to query string query model
Add extra tests to query string query model
Python
mpl-2.0
ameihm0912/MozDef,jeffbryner/MozDef,mpurzynski/MozDef,gdestuynder/MozDef,jeffbryner/MozDef,ameihm0912/MozDef,mpurzynski/MozDef,Phrozyn/MozDef,Phrozyn/MozDef,mpurzynski/MozDef,Phrozyn/MozDef,gdestuynder/MozDef,ameihm0912/MozDef,Phrozyn/MozDef,mozilla/MozDef,jeffbryner/MozDef,ameihm0912/MozDef,jeffbryner/MozDef,gdestuynd...
<REPLACE_OLD> QueryStringMatch class <REPLACE_NEW> QueryStringMatch hostname_test_regex = 'hostname: /(.*\.)*(sub|bus)+(\..*)*\.abc(\..*)*\.company\.com/' class <REPLACE_END> <INSERT> ], QueryStringMatch(hostname_test_regex): [ {'hostname': 'host1.sub.abc.company.com'}, ...
Add extra tests to query string query model from positive_test_suite import PositiveTestSuite from negative_test_suite import NegativeTestSuite import os import sys sys.path.append(os.path.join(os.path.dirname(__file__), "../../lib")) from query_models import QueryStringMatch class TestQueryStringMatchPositiveTestS...
60fc1add06ffb54aff2b0bf1c28d0cb476d35aae
polling_stations/settings/local.example.py
polling_stations/settings/local.example.py
DATABASES = { "default": { "ENGINE": "django.contrib.gis.db.backends.postgis", "NAME": "polling_stations", "USER": "postgres", "PASSWORD": "", "HOST": "", # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP. "PORT": "", # Set to emp...
DATABASES = { "default": { "ENGINE": "django.contrib.gis.db.backends.postgis", "NAME": "polling_stations", "USER": "postgres", "PASSWORD": "", "HOST": "", # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP. "PORT": "", # Set to emp...
Send email to console as local default
Send email to console as local default
Python
bsd-3-clause
DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations
<REPLACE_OLD> True} <REPLACE_NEW> True} EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend" <REPLACE_END> <|endoftext|> DATABASES = { "default": { "ENGINE": "django.contrib.gis.db.backends.postgis", "NAME": "polling_stations", "USER": "postgres", "PASSWORD": "", ...
Send email to console as local default DATABASES = { "default": { "ENGINE": "django.contrib.gis.db.backends.postgis", "NAME": "polling_stations", "USER": "postgres", "PASSWORD": "", "HOST": "", # Empty for localhost through domain sockets or '127.0.0.1' for localhost throug...
ed5a151942ff6aeddeaab0fb2e23428821f89fc4
rovercode/drivers/grovepi_ultrasonic_ranger_binary.py
rovercode/drivers/grovepi_ultrasonic_ranger_binary.py
""" Class for communicating with the GrovePi ultrasonic ranger. Here we treat it as a binary sensor. """ import logging logging.basicConfig() LOGGER = logging.getLogger(__name__) LOGGER.setLevel(logging.getLevelName('INFO')) try: from GrovePi.Software.Python.grovepi import ultrasonicRead except ImportError: L...
""" Class for communicating with the GrovePi ultrasonic ranger. Here we treat it as a binary sensor. """ import logging logging.basicConfig() LOGGER = logging.getLogger(__name__) LOGGER.setLevel(logging.getLevelName('INFO')) try: from grovepi import ultrasonicRead except ImportError: LOGGER.warning("GrovePi l...
Fix grovepi import in sensor driver
Fix grovepi import in sensor driver
Python
apache-2.0
aninternetof/rover-code,aninternetof/rover-code,aninternetof/rover-code
<REPLACE_OLD> GrovePi.Software.Python.grovepi <REPLACE_NEW> grovepi <REPLACE_END> <|endoftext|> """ Class for communicating with the GrovePi ultrasonic ranger. Here we treat it as a binary sensor. """ import logging logging.basicConfig() LOGGER = logging.getLogger(__name__) LOGGER.setLevel(logging.getLevelName('INFO'...
Fix grovepi import in sensor driver """ Class for communicating with the GrovePi ultrasonic ranger. Here we treat it as a binary sensor. """ import logging logging.basicConfig() LOGGER = logging.getLogger(__name__) LOGGER.setLevel(logging.getLevelName('INFO')) try: from GrovePi.Software.Python.grovepi import ult...
bb59028a3dab81139a83f9a0eb8a4c58b9c25829
sample_application/app.py
sample_application/app.py
import os from flask import Blueprint, Flask from flask import Flask, g from views import blueprint, Resources, UnixTime, PrintArg, ExampleApiUsage from flask.ext.restful import Api from client import Client def create_app(): api = Api(blueprint) api.add_resource(Resources, '/resources') api.add_resource(UnixTim...
import os from flask import Blueprint, Flask from flask import Flask, g from views import blueprint, Resources, UnixTime, PrintArg, ExampleApiUsage from flask.ext.restful import Api from client import Client def create_app(): api = Api(blueprint) api.add_resource(Resources, '/resources') api.add_resource(UnixTim...
Change config import strategy to config.from_pyfile()
Change config import strategy to config.from_pyfile()
Python
mit
adsabs/adsabs-webservices-blueprint,jonnybazookatone/adsabs-webservices-blueprint
<REPLACE_OLD> app.config.from_object('sample_application.config') <REPLACE_NEW> app.config.from_pyfile('config.py') <REPLACE_END> <REPLACE_OLD> app.config.from_object('sample_application.local_config') <REPLACE_NEW> app.config.from_pyfile('local_config.py') <REPLACE_END> <REPLACE_OLD> ImportError: <REPLACE_NEW> IO...
Change config import strategy to config.from_pyfile() import os from flask import Blueprint, Flask from flask import Flask, g from views import blueprint, Resources, UnixTime, PrintArg, ExampleApiUsage from flask.ext.restful import Api from client import Client def create_app(): api = Api(blueprint) api.add_resou...
6e67a9e8eedd959d9d0193e746a375099e9784ef
toodlepip/consoles.py
toodlepip/consoles.py
class Console(object): def __init__(self, shell, stdout): self._shell = shell self._stdout = stdout def run(self, description, command, **kwargs): return self.run_all(description, [command], **kwargs) def run_all(self, description, commands, quiet=False, cwd=None): ...
class Console(object): def __init__(self, shell, stdout): self._shell = shell self._stdout = stdout def run(self, description, command, **kwargs): return self.run_all(description, [command], **kwargs) def run_all(self, description, commands, quiet=False, cwd=None): ...
Use bytes instead of str where appropriate for Python 3
Use bytes instead of str where appropriate for Python 3
Python
bsd-2-clause
mwilliamson/toodlepip
<REPLACE_OLD> self._stdout.write('\033[1m') self._stdout.write(description) self._stdout.write("\n") self._stdout.write('\033[0m') <REPLACE_NEW> self._stdout.write(b'\033[1m') self._stdout.write(description.encode("utf8")) self._stdout.write(b"\n") self._stdout.write(b'\...
Use bytes instead of str where appropriate for Python 3 class Console(object): def __init__(self, shell, stdout): self._shell = shell self._stdout = stdout def run(self, description, command, **kwargs): return self.run_all(description, [command], **kwargs) def run_...
3243f199fb46d2d6f95ae9afd18b1570f9b5f529
astatsscraper/parsing.py
astatsscraper/parsing.py
def parse_app_page(response): # Should always be able to grab a title title = response.xpath('//div[@class = "panel panel-default panel-gameinfo"]/div[@class = "panel-heading"]/text()').extract()[0].strip() # Parse times into floats time_to_hundo = response.xpath('//table[@class = "Default1000"]/tr/td[s...
def parse_app_page(response): # Should always be able to grab a title title = response.xpath('//div[@class = "panel panel-default panel-gameinfo"]/div[@class = "panel-heading"]/text()').extract()[0].strip() # Parse times into floats time_to_hundo = response.xpath('//table[@class = "Default1000"]/tr/td[s...
Fix up bad last commit
Fix up bad last commit
Python
mit
SingingTree/AStatsScraper,SingingTree/AStatsScraper
<REPLACE_OLD> } def <REPLACE_NEW> } def <REPLACE_END> <REPLACE_OLD> relative_url[:len('Steam_Game_Info.php?AppID=')] <REPLACE_NEW> { 'app_id' : relative_url[len('Steam_Game_Info.php?AppID='):] } <REPLACE_END> <|endoftext|> def parse_app_page(response): # Should always be able to gra...
Fix up bad last commit def parse_app_page(response): # Should always be able to grab a title title = response.xpath('//div[@class = "panel panel-default panel-gameinfo"]/div[@class = "panel-heading"]/text()').extract()[0].strip() # Parse times into floats time_to_hundo = response.xpath('//table[@class ...
393d06be7c5056985d16c039b8181fc05f40f9e0
ci/testsettings.py
ci/testsettings.py
# This file is exec'd from settings.py, so it has access to and can # modify all the variables in settings.py. # If this file is changed in development, the development server will # have to be manually restarted because changes will not be noticed # immediately. DEBUG = False # include database settings to use Mari...
# This file is exec'd from settings.py, so it has access to and can # modify all the variables in settings.py. # If this file is changed in development, the development server will # have to be manually restarted because changes will not be noticed # immediately. DEBUG = False # include database settings to use Mari...
Tweak travis-ci settings for haystack setup and test
Tweak travis-ci settings for haystack setup and test
Python
apache-2.0
Princeton-CDH/derrida-django,Princeton-CDH/derrida-django,Princeton-CDH/derrida-django,Princeton-CDH/derrida-django
<REPLACE_OLD> }, } HAYSTACK_TEST_CONNECTIONS <REPLACE_NEW> }, } # must be defined for initial setup HAYSTACK_CONNECTIONS <REPLACE_END> <REPLACE_OLD> } } # <REPLACE_NEW> } } # for unit tests, that swap test connection in for default HAYSTACK_TEST_CONNECTIONS = HAYSTACK_CONNECTIONS # <REPLACE_END> <|endofte...
Tweak travis-ci settings for haystack setup and test # This file is exec'd from settings.py, so it has access to and can # modify all the variables in settings.py. # If this file is changed in development, the development server will # have to be manually restarted because changes will not be noticed # immediately. ...
d147d8865dc4b82eaff87d0d4dd65ba7f4622a90
django/contrib/admin/__init__.py
django/contrib/admin/__init__.py
from django.contrib.admin.options import ModelAdmin, HORIZONTAL, VERTICAL from django.contrib.admin.options import StackedInline, TabularInline from django.contrib.admin.sites import AdminSite, site def autodiscover(): """ Auto-discover INSTALLED_APPS admin.py modules and fail silently when not present. T...
# ACTION_CHECKBOX_NAME is unused, but should stay since its import from here # has been referenced in documentation. from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME from django.contrib.admin.options import ModelAdmin, HORIZONTAL, VERTICAL from django.contrib.admin.options import StackedInline, TabularInli...
Revert the removal of an unused import (in [14175]) that was referenced in documentation. Thanks for noticing, clong.
Revert the removal of an unused import (in [14175]) that was referenced in documentation. Thanks for noticing, clong. git-svn-id: http://code.djangoproject.com/svn/django/trunk@14359 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --HG-- extra : convert_revision : e026073455a73c9fe9a9f026b76ac783b2a12d23
Python
bsd-3-clause
adieu/django-nonrel,heracek/django-nonrel,adieu/django-nonrel,heracek/django-nonrel,adieu/django-nonrel,heracek/django-nonrel
<INSERT> # ACTION_CHECKBOX_NAME is unused, but should stay since its import <INSERT_END> <INSERT> here # has been referenced in documentation. from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME from <INSERT_END> <|endoftext|> # ACTION_CHECKBOX_NAME is unused, but should stay since its import from here # has ...
Revert the removal of an unused import (in [14175]) that was referenced in documentation. Thanks for noticing, clong. git-svn-id: http://code.djangoproject.com/svn/django/trunk@14359 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --HG-- extra : convert_revision : e026073455a73c9fe9a9f026b76ac783b2a12d23 from django.contrib.ad...
18fec1124bb86f90183350e7b9c86eb946a01884
whatchanged/main.py
whatchanged/main.py
#!/usr/bin/env python from __future__ import absolute_import, print_function # Standard library from os import walk from os.path import exists, isdir, join # Local library from .util import is_py_file from .diff import diff_files def main(): import sys if sys.argv < 3: print('Usage: %s <module1> <...
#!/usr/bin/env python from __future__ import absolute_import, print_function # Standard library from os import walk from os.path import exists, isdir, join # Local library from .util import is_py_file from .diff import diff_files def main(): import sys if len(sys.argv) < 3: print('Usage: %s <packa...
Fix minor bug in length comparison.
Fix minor bug in length comparison.
Python
bsd-2-clause
punchagan/what-changed
<REPLACE_OLD> sys.argv <REPLACE_NEW> len(sys.argv) <REPLACE_END> <REPLACE_OLD> <module1> <module2>' <REPLACE_NEW> <package1/module1> <package2/module2>' <REPLACE_END> <|endoftext|> #!/usr/bin/env python from __future__ import absolute_import, print_function # Standard library from os import walk from os.path import e...
Fix minor bug in length comparison. #!/usr/bin/env python from __future__ import absolute_import, print_function # Standard library from os import walk from os.path import exists, isdir, join # Local library from .util import is_py_file from .diff import diff_files def main(): import sys if sys.argv < 3:...
98aea2115cb6c5101379be2320a6fb0735a32490
helenae/web/views.py
helenae/web/views.py
from flask import render_template from flask_app import app @app.route('/') def index(): return render_template('index.html')
# -*- coding: utf-8 -*- import datetime from hashlib import sha256 from time import gmtime, strftime import sqlalchemy from flask import render_template, redirect, url_for from flask_app import app, db_connection, dbTables from forms import RegisterForm @app.route('/', methods=('GET', 'POST')) def index(): retur...
Add routes for other pages
Add routes for other pages
Python
mit
Relrin/Helenae,Relrin/Helenae,Relrin/Helenae
<REPLACE_OLD> from <REPLACE_NEW> # -*- coding: utf-8 -*- import datetime from hashlib import sha256 from time import gmtime, strftime import sqlalchemy from <REPLACE_END> <REPLACE_OLD> render_template from <REPLACE_NEW> render_template, redirect, url_for from <REPLACE_END> <REPLACE_OLD> app @app.route('/') def <REPLA...
Add routes for other pages from flask import render_template from flask_app import app @app.route('/') def index(): return render_template('index.html')