commit stringlengths 40 40 | old_file stringlengths 4 236 | new_file stringlengths 4 236 | old_contents stringlengths 1 3.26k | new_contents stringlengths 16 4.43k | subject stringlengths 16 624 | message stringlengths 17 3.29k | lang stringclasses 5
values | license stringclasses 13
values | repos stringlengths 5 91.5k |
|---|---|---|---|---|---|---|---|---|---|
6a0186eb0d0e822dded1e58d0381625ded887221 | serfnode/handler/parent_server.py | serfnode/handler/parent_server.py | #!/usr/bin/env python
import os
import select
import serf
def server():
"""A server for serf commands.
Commands are a string object that are passed to serf.
"""
os.mkfifo('/serfnode/parent')
pipe = os.fdopen(
os.open('/serfnode/parent', os.O_RDONLY | os.O_NONBLOCK), 'r', 0)
# open ... | #!/usr/bin/env python
import os
import select
import json
import serf
def server():
"""A server for serf commands.
Commands are a string object that are passed to serf.
"""
os.mkfifo('/serfnode/parent')
pipe = os.fdopen(
os.open('/serfnode/parent', os.O_RDONLY | os.O_NONBLOCK), 'r', 0)... | Make parent server more robust | Make parent server more robust
| Python | mit | waltermoreira/serfnode,waltermoreira/serfnode,waltermoreira/serfnode |
058cee7b5a3efcf6b6bd02a314f1223153cc797f | tools/TreeBest/fasta_header_converter.py | tools/TreeBest/fasta_header_converter.py | import json
import optparse
transcript_species_dict = dict()
sequence_dict = dict()
def readgene(gene):
for transcript in gene['Transcript']:
transcript_species_dict[transcript['id']] = transcript['species'].replace("_", "")
def read_fasta(fp):
for line in fp:
line = line.rstrip()
... | from __future__ import print_function
import json
import optparse
def read_gene_info(gene_info):
transcript_species_dict = dict()
for gene_dict in gene_info.values():
for transcript in gene_dict['Transcript']:
transcript_species_dict[transcript['id']] = transcript['species'].replace("_", ... | Use print() for Python3. No global variables. Optimisations | Use print() for Python3. No global variables. Optimisations
| Python | mit | TGAC/earlham-galaxytools,PerlaTroncosoRey/tgac-galaxytools,TGAC/tgac-galaxytools,anilthanki/tgac-galaxytools,TGAC/earlham-galaxytools,anilthanki/tgac-galaxytools,TGAC/earlham-galaxytools,wjurkowski/earlham-galaxytools,anilthanki/tgac-galaxytools,anilthanki/tgac-galaxytools,TGAC/earlham-galaxytools,anilthanki/tgac-galax... |
012bd4e09c7ed08ff79ce039a9682a5249fef1fc | plugins/clue/clue.py | plugins/clue/clue.py | from __future__ import unicode_literals
# don't convert to ascii in py2.7 when creating string to return
crontable = []
outputs = []
def process_message(data):
if data['channel'].startswith("D"):
outputs.append([data['channel'], "from repeat1 \"{}\" in channel {}".format(
data['text'], data['... | from __future__ import unicode_literals
# don't convert to ascii in py2.7 when creating string to return
crontable = []
outputs = []
def process_message(data):
outputs.append([data['channel'], "from repeat1 \"{}\" in channel {}".format(
data['text'], data['channel'])]
)
| Allow stony to talk in channels other than direct-message channels. | Allow stony to talk in channels other than direct-message channels.
A direct-message channel identifier always starts with the character
'D', (while other channels have identifiers that start with 'C'). By
lifting the restriction of the channel name starting with "D", stony
can now talk in any channel.
Note: There's ... | Python | mit | cworth-gh/stony |
c8d2d6a4eace2107639badd17983e048dc9259e5 | mfh.py | mfh.py | import os
import sys
import time
from multiprocessing import Process, Event
import mfhclient
import update
from arguments import parse
def main():
q = Event()
mfhclient_process = Process(
args=(args, q,),
name="mfhclient_process",
target=mfhclient.main,
)
mfhclient_process... | import os
import sys
import time
from multiprocessing import Process, Event
import mfhclient
import update
from arguments import parse
from settings import HONEYPORT
def main():
update_event = Event()
mfhclient_process = Process(
args=(args, update_event,),
name="mfhclient_process",
t... | Add condition to only launch client if -c or --client is specified | Add condition to only launch client if -c or --client is specified
| Python | mit | Zloool/manyfaced-honeypot |
ab6ca021430933b38788ad2ae19f27f8ed00ab54 | parse.py | parse.py | import sys
import simplejson as json
indentation = 0
lang_def = None
with open('language.json') as lang_def_file:
lang_def = json.loads(lang_def_file.read())
if lang_def is None:
print("error reading json language definition")
exit(1)
repl = lang_def['rules']
sin = sys.argv[1]
for r in repl:
sin =... | import sys
import simplejson as json
def translate(file='hello_world.py'):
lang_def = None
with open('language.json') as lang_def_file:
lang_def = json.loads(lang_def_file.read())
if lang_def is None:
print('error reading json language definition')
exit(1)
python_code = None
... | Add translate functionality via command line arguments | Add translate functionality via command line arguments
| Python | unlicense | philipdexter/build-a-lang |
e1569a514345a8c78d415011387d06aed5e6daa4 | webshack/cli.py | webshack/cli.py | """WebShack: Sensible web components.
Usage:
webshack get <package>...
webshack -h | --help
webshack --version
Options:
-h --help Show this screen.
--version Show version.
"""
import sys
from docopt import docopt
from termcolor import colored
from webshack.install_package import install_p... | """WebShack: Sensible web components.
Usage:
webshack list
webshack get <package>...
webshack -h | --help
webshack --version
Options:
-h --help Show this screen.
--version Show version.
"""
import sys
from docopt import docopt
from termcolor import colored
from webshack.install_package ... | Add a subcommand for listing packages | Add a subcommand for listing packages
| Python | mit | prophile/webshack |
4cb1b6b8656d4e3893b3aa8fe5766b507afa6d24 | cmsplugin_rt/button/cms_plugins.py | cmsplugin_rt/button/cms_plugins.py | from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from cms.models.pluginmodel import CMSPlugin
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from models import *
bootstrap_module_name = _("Widgets")
layout_module_name = _("Layout elements")
ge... | from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from cms.models.pluginmodel import CMSPlugin
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from models import *
bootstrap_module_name = _("Widgets")
layout_module_name = _("Layout elements")
ge... | Make Button plugin usable inside Text plugin | Make Button plugin usable inside Text plugin
| Python | bsd-3-clause | RacingTadpole/cmsplugin-rt |
cf843755f4edffb13deebac6c4e39cb44fff72e6 | statement_format.py | statement_format.py | import pandas as pd
def fn(row):
if row['Type'] == 'DIRECT DEBIT':
return 'DD'
if row['Type'] == 'DIRECT CREDIT' or row['Spending Category'] == 'INCOME':
return 'BP'
if row['Amount (GBP)'] < 0:
return 'SO'
raise Exception('Unintended state')
df = pd.read_csv('statement.csv')
... | import json
import pandas as pd
def fn(row):
if row['Type'] == 'DIRECT DEBIT':
return 'DD'
if row['Type'] == 'DIRECT CREDIT' or row['Spending Category'] == 'INCOME':
return 'BP'
if row['Amount (GBP)'] < 0:
return 'SO'
raise Exception('Unintended state')
df = pd.read_csv('stat... | Correct operation. Now to fix panda warnings | Correct operation. Now to fix panda warnings
| Python | mit | noelevans/sandpit,noelevans/sandpit,noelevans/sandpit,noelevans/sandpit,noelevans/sandpit,noelevans/sandpit |
1e6b0b6f53a4508c3e4218345b2ee57d48fbc8d1 | flask_app.py | flask_app.py | from flask import abort
from flask import Flask
from flask_caching import Cache
import main
app = Flask(__name__)
cache = Cache(app, config={'CACHE_TYPE': 'simple'})
@app.route('/')
def display_available():
content = ('<html>' +
'<head>' +
'<title>Restaurant Menu Parser</title>' +... | import json
from flask import abort
from flask import Flask
from flask_caching import Cache
import main
app = Flask(__name__)
cache = Cache(app, config={'CACHE_TYPE': 'simple'})
@app.route('/')
def display_available():
content = ('<html>' +
'<head>' +
'<title>Restaurant Menu Pars... | Return str instead of dict. | Return str instead of dict.
| Python | bsd-3-clause | talavis/kimenu |
9e4608b5cafcaf69718b3b187e143098ed74954f | examples/dispatcher/main.py | examples/dispatcher/main.py | import time
from osbrain import random_nameserver
from osbrain import run_agent
from osbrain import Agent
from osbrain import Proxy
def log(agent, message):
agent.log_info(message)
def rep_handler(agent, message):
if agent.i < 10:
if not agent.i % 5:
agent.send('rep', 5)
else:
... | import time
from osbrain import random_nameserver
from osbrain import run_agent
def log(agent, message):
agent.log_info(message)
def rep_handler(agent, message):
if agent.i < 10:
if not agent.i % 5:
agent.send('rep', 5)
else:
agent.send('rep', 1)
agent.i += 1
de... | Remove unused imports in example | Remove unused imports in example
| Python | apache-2.0 | opensistemas-hub/osbrain |
300471024ff16026d23bf60008d19784604b2eb3 | gala-training-crossval-sub.py | gala-training-crossval-sub.py | # IPython log file
from gala import classify
datas = []
labels = []
import numpy as np
list(map(np.shape, labels))
for i in range(3, 4):
data, label = classify.load_training_data_from_disk('training-data-%i.h5' % i, names=['data', 'labels'])
datas.append(data)
labels.append(label[:, 0])
X0 = np.conca... | # IPython log file
from gala import classify
datas = []
labels = []
import numpy as np
list(map(np.shape, labels))
for i in range(3, 4):
data, label = classify.load_training_data_from_disk('training-data-%i.h5' % i, names=['data', 'labels'])
datas.append(data)
labels.append(label[:, 0])
X0 = np.conca... | Add run for 72k samples | Add run for 72k samples
| Python | bsd-3-clause | jni/gala-scripts |
7842e714cf4345f11f59fc0915c86f1b2a836a9b | setup.py | setup.py | #!/usr/bin/env python
"""Installs geordi"""
import os
import sys
from distutils.core import setup
def long_description():
"""Get the long description from the README"""
return open(os.path.join(sys.path[0], 'README.txt')).read()
setup(
author='Brodie Rao',
author_email='brodie@sf.io',
classifiers... | #!/usr/bin/env python
"""Installs geordi"""
import os
import sys
from distutils.core import setup
def long_description():
"""Get the long description from the README"""
return open(os.path.join(sys.path[0], 'README.txt')).read()
setup(
author='Brodie Rao',
author_email='brodie@sf.io',
classifiers... | Update gprof2dot to a version that includes absolute times | Update gprof2dot to a version that includes absolute times
| Python | lgpl-2.1 | HurricaneLabs/geordi,goconnectome/geordi |
b5af31fba4bde1b90857d693b8277a3d2a0e3607 | rplugin/python3/deoplete/sources/go.py | rplugin/python3/deoplete/sources/go.py | import deoplete.util
from .base import Base
class Source(Base):
def __init__(self, vim):
Base.__init__(self, vim)
self.name = 'go'
self.mark = '[go]'
self.filetypes = ['go']
self.rank = 100
self.min_pattern_length = 0
self.is_bytepos = True
def get_com... | import deoplete.util
from .base import Base
class Source(Base):
def __init__(self, vim):
Base.__init__(self, vim)
self.name = 'go'
self.mark = '[go]'
self.filetypes = ['go']
self.min_pattern_length = 0
self.is_bytepos = True
def get_complete_api(self, findstar... | Remove rank to default set. deoplete will set 100 | Remove rank to default set. deoplete will set 100
Signed-off-by: Koichi Shiraishi <2e5bdfebde234ed3509bcfc18121c70b6631e207@gmail.com>
| Python | mit | zchee/deoplete-go,zchee/deoplete-go |
181a3aedff78f46beec703cb610a5ac6d3339f93 | source/bark/__init__.py | source/bark/__init__.py | # :coding: utf-8
# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips
# :license: See LICENSE.txt.
| # :coding: utf-8
# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips
# :license: See LICENSE.txt.
from .handler.distribute import Distribute
#: Top level handler responsible for relaying all logs to other handlers.
handle = Distribute()
| Set Distribute handler as default top level handler. | Set Distribute handler as default top level handler.
| Python | apache-2.0 | 4degrees/sawmill,4degrees/mill |
3c705ba62a6dae804ff2e2307d38c9c30d555e22 | build.py | build.py | import urllib2
if __name__ == '__main__':
gdal_version = '1.11.0'
# parse out the version info
major, minor, release = map(lambda x: int(x), gdal_version.split('.'))
gdal_download_uri = 'http://download.osgeo.org/gdal/'
if minor >= 10:
gdal_download_uri += gdal_version + '/'
local_gzi... | import sys
import os
import urllib2
if __name__ == '__main__':
version_info = lambda v: map(lambda x: int(x), v.split('.'))
# if the user provided an argument and it's a file, use that.
try:
source_filepath = sys.argv[1]
except IndexError:
source_filepath = ''
if os.path.exists(so... | Refactor to accommodate local gdal source archive | Refactor to accommodate local gdal source archive
| Python | mit | phargogh/gdal-build |
f122d1561c79bd46eb82ff64a15245171a4934e8 | insert_date.py | insert_date.py | import sublime
import sublime_plugin
from functools import partial
from format_date import FormatDate
class InsertDateCommand(sublime_plugin.TextCommand, FormatDate):
"""Prints Date according to given format string"""
def run(self, edit, format=None, prompt=False, tz_in=None, tz_out=None):
if prompt:... | import locale
from functools import partial
from format_date import FormatDate
import sublime
import sublime_plugin
class InsertDateCommand(sublime_plugin.TextCommand, FormatDate):
"""Prints Date according to given format string"""
def run(self, edit, format=None, prompt=False, tz_in=None, tz_out=None):
... | Add handling for non-unicode return values from datetime.strftime | Add handling for non-unicode return values from datetime.strftime
Hopefully fixes #3.
| Python | mit | FichteFoll/InsertDate,FichteFoll/InsertDate |
737dca75d26a90d627be09144db7441156fee981 | scraper/management/commands/run_scraper.py | scraper/management/commands/run_scraper.py | from django.core.management.base import NoArgsCommand
from scraper.models import Source
class Command(NoArgsCommand):
""" Crawl all active resources """
def handle_noargs(self, **options):
sources = Source.objects.filter(active=True)
for source in sources:
source.crawl()
| from django.core.management.base import NoArgsCommand
from scraper.models import Spider
class Command(NoArgsCommand):
""" Crawl all active resources """
def handle_noargs(self, **options):
spiders = Spider.objects.all()
for spider in spiders:
spider.crawl_content()
| Update management command to adapt new model | Update management command to adapt new model
| Python | mit | zniper/django-scraper,zniper/django-scraper |
4d414fe592bfd7f085f9aaea0b6992d28ad193ce | tcconfig/_common.py | tcconfig/_common.py | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>
"""
from __future__ import absolute_import
import dataproperty
import six
from ._error import NetworkInterfaceNotFoundError
ANYWHERE_NETWORK = "0.0.0.0/0"
def verify_network_interface(device):
try:
import netifaces
exc... | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>
"""
from __future__ import absolute_import
import dataproperty
import six
from ._error import NetworkInterfaceNotFoundError
ANYWHERE_NETWORK = "0.0.0.0/0"
def verify_network_interface(device):
try:
import netifaces
exc... | Change to use format method | Change to use format method
| Python | mit | thombashi/tcconfig,thombashi/tcconfig |
6bff4763f486f10e43890191244b33d5b609bfdd | flashcards/commands/sets.py | flashcards/commands/sets.py | """
flashcards.commands.sets
~~~~~~~~~~~~~~~~~~~
Contains the commands and subcommands related to the sets resource.
"""
import os
import click
from flashcards import sets
from flashcards import storage
@click.group('sets')
def sets_group():
"""Command related to the StudySet object """
pass
@click.comma... | """
flashcards.commands.sets
~~~~~~~~~~~~~~~~~~~
Contains the commands and subcommands related to the sets resource.
"""
import os
import click
from flashcards import sets
from flashcards import storage
@click.group('sets')
def sets_group():
"""Command related to the StudySet object """
pass
@click.comma... | Add docstring to select command. | Add docstring to select command.
| Python | mit | zergov/flashcards,zergov/flashcards |
efe588cbedc1100f2893c53503ddd30ac011cf06 | joku/checks.py | joku/checks.py | """
Specific checks.
"""
from discord.ext.commands import CheckFailure, check
def is_owner(ctx):
if ctx.bot.owner_id not in ["214796473689178133", ctx.bot.owner_id]:
raise CheckFailure(message="You are not the owner.")
return True
def has_permissions(**perms):
def predicate(ctx):
if ctx.... | """
Specific checks.
"""
from discord.ext.commands import CheckFailure, check
def is_owner(ctx):
if ctx.bot.owner_id not in ["214796473689178133", ctx.bot.owner_id]:
raise CheckFailure(message="You are not the owner.")
return True
def has_permissions(**perms):
def predicate(ctx):
if ctx.... | Add my ID as a hard override for has_permissions. | Add my ID as a hard override for has_permissions.
| Python | mit | MJB47/Jokusoramame,MJB47/Jokusoramame,MJB47/Jokusoramame |
06fd1674239de71ccbe52398516642d9b19b743b | setup.py | setup.py | #!/usr/bin/env python
from distutils.core import setup
from distutils.command.sdist import sdist as _sdist
class sdist(_sdist):
def run(self):
try:
import sys
sys.path.append("contrib")
import git2changes
print('generating CHANGES.txt')
with open... | #!/usr/bin/env python
from distutils.core import setup
from distutils.command.sdist import sdist as _sdist
class sdist(_sdist):
def run(self):
try:
import sys
sys.path.append("contrib")
import git2changes
print('generating CHANGES.txt')
with open... | Change repository URL to point to OpenPrinting's organisation | Change repository URL to point to OpenPrinting's organisation
| Python | mit | vitorbaptista/pyppd |
37b0387f9425c25a53c981dce3911e98c7ca14dd | test/test_config.py | test/test_config.py | import os
from nose.tools import *
from lctools import config
class TestConfig(object):
test_filename = "bebebe"
def setup(self):
fd = open(self.test_filename, 'w')
fd.write("[default]\n")
fd.write("foo = bar\n")
fd.close()
def test_basic_functionality(self):
con... | import os
import stat
from nose.tools import *
from lctools import config
class TestConfig(object):
test_filename = "bebebe"
def setup(self):
fd = open(self.test_filename, 'w')
fd.write("[default]\n")
fd.write("foo = bar\n")
fd.close()
os.chmod(self.test_filename, sta... | Add a test for config file permissions check. | Add a test for config file permissions check.
| Python | apache-2.0 | novel/lc-tools,novel/lc-tools |
62d275fbb27bf40a5b94e5e708dd9669a6d7270a | test/test_gossip.py | test/test_gossip.py | #!/usr/bin/env python
# Copyright (C) 2014:
# Gabes Jean, naparuba@gmail.com
import threading
from opsbro_test import *
from opsbro.gossip import gossiper
class TestGossip(OpsBroTest):
def setUp(self):
gossiper.init({}, threading.RLock(), '127.0.0.1', 6768, 'testing', 'super testing', 1, 'QQQQQQQQQQQ... | #!/usr/bin/env python
# Copyright (C) 2014:
# Gabes Jean, naparuba@gmail.com
import threading
import tempfile
from opsbro_test import *
from opsbro.gossip import gossiper
class TestGossip(OpsBroTest):
def setUp(self):
# We need to have a valid path for data
from opsbro.configurationmanager im... | TEST gossip was crashing as the data directory was not exists for history data Enh: now directory creation is by default recursive | Fix: TEST gossip was crashing as the data directory was not exists for history data
Enh: now directory creation is by default recursive
| Python | mit | naparuba/kunai,naparuba/kunai,naparuba/kunai,naparuba/opsbro,naparuba/opsbro,naparuba/kunai,naparuba/opsbro,naparuba/opsbro,naparuba/kunai,naparuba/kunai |
1175a7da5583f58915cfe7991ba250cb19db39f7 | pysswords/credential.py | pysswords/credential.py | import os
class Credential(object):
def __init__(self, name, login, password, comments):
self.name = name
self.login = login
self.password = password
self.comments = comments
def save(self, database_path):
credential_path = os.path.join(database_path, self.name)
... | import os
class Credential(object):
def __init__(self, name, login, password, comments):
self.name = name
self.login = login
self.password = password
self.comments = comments
def save(self, database_path):
credential_path = os.path.join(database_path, self.name)
... | Change string formating for Credential | Change string formating for Credential
| Python | mit | marcwebbie/passpie,scorphus/passpie,marcwebbie/pysswords,eiginn/passpie,marcwebbie/passpie,scorphus/passpie,eiginn/passpie |
5deb33c244242d36a16a8c08ff816368b345a8f3 | qr_code/qrcode/image.py | qr_code/qrcode/image.py | """
Import the required subclasses of :class:`~qrcode.image.base.BaseImage` from the qrcode library with a fallback to SVG
format when the Pillow library is not available.
"""
import logging
from qrcode.image.svg import SvgPathImage as _SvgPathImage
logger = logging.getLogger('django')
try:
from qrcode.image.pil im... | """
Import the required subclasses of :class:`~qrcode.image.base.BaseImage` from the qrcode library with a fallback to SVG
format when the Pillow library is not available.
"""
import logging
from qrcode.image.svg import SvgPathImage as _SvgPathImage
logger = logging.getLogger('django')
try:
from qrcode.image.pil i... | Exclude handling of the situation where Pillow is not available from test coverage. | Exclude handling of the situation where Pillow is not available from test coverage.
| Python | bsd-3-clause | dprog-philippe-docourt/django-qr-code,dprog-philippe-docourt/django-qr-code,dprog-philippe-docourt/django-qr-code |
a8a56f20dd76f61ec1ea6e99037490922d5cbcb1 | setup.py | setup.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 04.08.2017 19:00
:Licence GNUv3
Part of grammpy
"""
from distutils.core import setup
setup(
name='grammpy',
version='1.1.1',
packages=['grammpy', 'grammpy.Grammars', 'grammpy.exceptions'],
url='https://github.com/PatrikValkovic/grammpy',
... | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 04.08.2017 19:00
:Licence GNUv3
Part of grammpy
"""
from distutils.core import setup
setup(
name='grammpy',
version='1.1.1',
packages=['grammpy', 'grammpy.Grammars', 'grammpy.exceptions', 'grammpy.Rules'],
url='https://github.com/PatrikValko... | FIX missing Rules directory in package | FIX missing Rules directory in package
| Python | mit | PatrikValkovic/grammpy |
ab63395c1d8c9ec6bce13811965c8335463b0b78 | setup.py | setup.py | from distutils.core import setup, Extension
setup(name = "Indexer", version = "0.1", ext_modules = [Extension("rabin", ["src/rabin.c", ])])
| from distutils.core import setup, Extension
import os
os.environ['CFLAGS'] = "-Qunused-arguments"
setup(name = "Indexer", version = "0.1", ext_modules = [Extension("rabin", ["src/rabin.c", ])])
| Fix compile error on OS X 10.9 | Fix compile error on OS X 10.9
| Python | apache-2.0 | pombredanne/python-rabin-fingerprint,pombredanne/python-rabin-fingerprint,cschwede/python-rabin-fingerprint,cschwede/python-rabin-fingerprint |
006929cb8032f038522645a687f7385dcaa66b78 | setup.py | setup.py | from distutils.core import setup, Extension
from glob import glob
module1 = Extension('hashpumpy',
sources = glob('*.cpp'),
libraries = ['crypto'])
setup (name = 'hashpumpy',
version = '1.0',
author = 'Zach Riggle (Python binding), Brian Wallace (HashPump)',
... | from distutils.core import setup, Extension
from glob import glob
module1 = Extension('hashpumpy',
sources = glob('*.cpp'),
libraries = ['crypto'])
setup (name = 'hashpumpy',
version = '1.0',
author = 'Zach Riggle (Python binding), Brian Wallace (HashPump)',
... | Install header files to include/ | Install header files to include/
| Python | mit | bwall/HashPump,bwall/HashPump,christophetd/HashPump,christophetd/HashPump |
85697d8a1d79a599071fea4cc41216f3df3f3586 | setup.py | setup.py | from distutils.core import setup
setup(
name='flickruper',
version='0.1.0',
author='Igor Katson',
author_email='igor.katson@gmail.com',
py_modules=['flickruper'],
scripts=['bin/flickruper'],
entry_points={
'console_scripts': ['flickruper = flickruper:main'],
},
url='http://p... | from distutils.core import setup
setup(
name='flickruper',
version='0.1.0',
author='Igor Katson',
author_email='igor.katson@gmail.com',
py_modules=['flickruper'],
scripts=['bin/flickruper'],
entry_points={
'console_scripts': ['flickruper = flickruper:main'],
},
url='https://... | Make it installable with PyPI | Make it installable with PyPI
| Python | mit | ikatson/flickruper |
ce606a9dfce7506da0072832cb5ea7c96163d582 | setup.py | setup.py | from distutils.core import setup
setup(
name='Lookupy',
version='0.1',
author='Vineet Naik',
author_email='naikvin@gmail.com',
packages=['lookupy',],
license='MIT License',
description='Django QuerySet inspired interface to query list of dicts',
long_description=open('README.md').read()... | from distutils.core import setup
try:
long_desc = open('./README.md').read()
except IOError:
long_desc = 'See: https://github.com/naiquevin/lookupy/blob/master/README.md'
setup(
name='Lookupy',
version='0.1',
author='Vineet Naik',
author_email='naikvin@gmail.com',
packages=['lookupy',],
... | Handle building the package in absence of README.md | Handle building the package in absence of README.md
| Python | mit | naiquevin/lookupy |
46f0aa2f1dd219fa733b4e1e522c382d695ad8d6 | setup.py | setup.py | from distutils.core import setup
setup(
name='permission',
version='0.1.2',
author='Zhipeng Liu',
author_email='hustlzp@qq.com',
url='https://github.com/hustlzp/permission',
packages=['permission'],
license='LICENSE',
description='Simple permission control for Python Web Frameworks.',
... | from distutils.core import setup
setup(
name='permission',
version='0.1.3',
author='Zhipeng Liu',
author_email='hustlzp@qq.com',
url='https://github.com/hustlzp/permission',
packages=['permission'],
license='LICENSE',
description='Simple and flexible permission control for Flask app.',
... | Update description and bump version to 0.1.3 | Update description and bump version to 0.1.3
| Python | mit | hustlzp/permission |
504d515f03fffdc999cc21a9615ea659a4e29f3b | setup.py | setup.py | #!/usr/bin/env python
from distutils.core import setup
setup(name='Frappy',
version='0.1',
description='Framework for creating Web APIs in Python',
author='Luke Lee',
author_email='durdenmisc@gmail.com',
url='http://github.com/durden/frappy',
packages=['frappy', 'frappy.services', ... | #!/usr/bin/env python
from distutils.core import setup
setup(name='Frappy',
version='0.1',
description='Framework for creating Web APIs in Python',
author='Luke Lee',
author_email='durdenmisc@gmail.com',
url='http://github.com/durden/frappy',
packages=['frappy', 'frappy.services', ... | Add twitter services to install since they work again | Add twitter services to install since they work again
| Python | mit | durden/frappy |
0451c608525ee81e27c8f8ec78d31e50f0bed9d2 | box/models.py | box/models.py | BASE_URL = 'https://api.box.com/2.0'
FOLDERS_URL = '{}/folders/{{}}/items'.format(BASE_URL)
MAX_FOLDERS = 1000
class Client(object):
def __init__(self, provider_logic):
"""
Box client constructor
:param provider_logic: oauthclient ProviderLogic instance
:return:
"""
... | BASE_URL = 'https://api.box.com/2.0'
FOLDERS_URL = '{}/folders/{{}}/items'.format(BASE_URL)
MAX_FOLDERS = 1000
class Client(object):
def __init__(self, provider_logic):
"""
Box client constructor
:param provider_logic: oauthclient ProviderLogic instance
:return:
"""
... | Raise an exception when the API response is not successful | Raise an exception when the API response is not successful
| Python | apache-2.0 | rca/box |
082dd34f8c9090f8bcb48b460e8ccc0e80aa205c | setup.py | setup.py | from distutils.core import setup
requirements = []
with open('requirements.txt', 'r') as f:
for line in f:
requirements.append(str(line.strip()))
setup(
name='pp_api',
version='0.1dev',
packages=['pp_api', 'pp_api.server_data'],
license='MIT',
requires=requirements
) | from distutils.core import setup
setup(
name='pp_api',
version='0.1dev',
packages=['pp_api', 'pp_api.server_data'],
license='MIT',
requires=open('requirements.txt', 'r').read().split()
) | Revert "Fixed reading of requirements from the file" | Revert "Fixed reading of requirements from the file"
This reverts commit 29be75d
| Python | mit | artreven/pp_api |
87ee89bfa404a81d704fe775031599de84686bbe | braid/base.py | braid/base.py | from __future__ import absolute_import
from fabric.api import sudo, task, put
from twisted.python.filepath import FilePath
from braid import pypy, service, authbind, git, package, bazaar, postgres
@task
def bootstrap():
"""
Prepare the machine to be able to correctly install, configure and execute
twis... | from __future__ import absolute_import
from fabric.api import sudo, task, put
from twisted.python.filepath import FilePath
from braid import pypy, service, authbind, git, package, bazaar, postgres
@task
def bootstrap():
"""
Prepare the machine to be able to correctly install, configure and execute
twis... | Install some more packages for trac. | Install some more packages for trac.
| Python | mit | alex/braid,alex/braid |
fd50ce4b22b4f3d948a64ed400340c0fc744de49 | src/waldur_core/core/migrations/0008_changeemailrequest_uuid.py | src/waldur_core/core/migrations/0008_changeemailrequest_uuid.py | from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0007_changeemailrequest'),
]
operations = [
migrations.AddField(
model_name='changeemailrequest', name='uuid', field=models.UUIDField(),
),
]
| from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0007_changeemailrequest'),
]
operations = [
migrations.AddField(
model_name='changeemailrequest',
name='uuid',
field=models.UUIDField(null=True),... | Allow null values in UUID field. | Allow null values in UUID field.
| Python | mit | opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind |
a885ebda3774f9d81422a96265bde25f6a93e7bf | tasks.py | tasks.py | from invocations import docs
from invocations.testing import test
from invocations.packaging import release
from invoke import Collection
from invoke import run
from invoke import task
@task(help={
'pty': "Whether to run tests under a pseudo-tty",
})
def integration(pty=True):
"""Runs integration tests."""
... | from invocations import docs
from invocations.testing import test, integration, watch_tests
from invocations.packaging import release
from invoke import Collection
from invoke import run
from invoke import task
ns = Collection(test, integration, watch_tests, release, docs)
ns.configure({
'tests': {
'pack... | Use invocations' integration task, also add watch_tests | Use invocations' integration task, also add watch_tests
| Python | bsd-2-clause | bitprophet/releases |
49bed20629d4b2ef50026700b98694da4c2ce224 | tasks.py | tasks.py | # coding=utf-8
"""Useful task commands for development and maintenance."""
from invoke import run, task
@task
def clean():
"""Clean the project directory of unwanted files and directories."""
run('rm -rf gmusicapi_scripts.egg-info')
run('rm -rf .coverage')
run('rm -rf .tox')
run('rm -rf .cache')
run('rm -rf ... | # coding=utf-8
"""Useful task commands for development and maintenance."""
from invoke import run, task
@task
def clean():
"""Clean the project directory of unwanted files and directories."""
run('rm -rf gmusicapi_scripts.egg-info')
run('rm -rf .coverage')
run('rm -rf .tox')
run('rm -rf .cache')
run('rm -rf ... | Add task for building docs | Add task for building docs
| Python | mit | thebigmunch/gmusicapi-scripts |
e24f89366a8a58a29d26f58b8f21aba437ec1566 | tests/integration/runners/test_cache.py | tests/integration/runners/test_cache.py | # -*- coding: utf-8 -*-
'''
Tests for the salt-run command
'''
# Import Python libs
from __future__ import absolute_import
# Import Salt Testing libs
import tests.integration as integration
class ManageTest(integration.ShellCase):
'''
Test the manage runner
'''
def test_cache(self):
'''
... | # -*- coding: utf-8 -*-
'''
Tests for the salt-run command
'''
# Import Python libs
from __future__ import absolute_import
# Import Salt Testing libs
import tests.integration as integration
class ManageTest(integration.ShellCase):
'''
Test the manage runner
'''
def test_cache(self):
'''
... | Use a slightly more specific bank name | Use a slightly more specific bank name
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt |
e32be307fd99c0d38b514385e0af2c257a50d50b | mining/urls.py | mining/urls.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from .views import MainHandler, ProcessHandler, DashboardHandler
INCLUDE_URLS = [
(r"/process/(?P<slug>[\w-]+).json", ProcessHandler),
(r"/(?P<slug>[\w-]+)", DashboardHandler),
(r"/", MainHandler),
]
| #!/usr/bin/env python
# -*- coding: utf-8 -*-
from .views import MainHandler, ProcessHandler, DashboardHandler
from .views import ProcessWebSocketHandler
INCLUDE_URLS = [
(r"/process/(?P<slug>[\w-]+).ws", ProcessWebSocketHandler),
(r"/process/(?P<slug>[\w-]+).json", ProcessHandler),
(r"/process/(?P<slug>[... | Add URL enter in dynamic process | Add URL enter in dynamic process
| Python | mit | mining/mining,mlgruby/mining,jgabriellima/mining,mlgruby/mining,mlgruby/mining,chrisdamba/mining,seagoat/mining,chrisdamba/mining,AndrzejR/mining,avelino/mining,seagoat/mining,jgabriellima/mining,avelino/mining,mining/mining,AndrzejR/mining |
cafe4629666326fefab17784abac281e7fb226c7 | examples/confluence-get-group-members.py | examples/confluence-get-group-members.py | # coding: utf8
from atlassian import Confluence
confluence = Confluence(
url='http://localhost:8090',
username='admin',
password='admin')
# this example related get all user from group e.g. group_name
group_name = 'confluence-users'
flag = True
i = 0
limit = 50
result = []
while flag:
response = conflu... | # coding: utf8
from atlassian import Confluence
confluence = Confluence(
url='http://localhost:8090',
username='admin',
password='admin')
# this example related get all user from group e.g. group_name
group_name = 'confluence-users'
flag = True
i = 0
limit = 50
result = []
while flag:
response = conflu... | Add other side of condition | Add other side of condition
| Python | apache-2.0 | MattAgile/atlassian-python-api,AstroTech/atlassian-python-api,AstroTech/atlassian-python-api |
1c61a731bf33ee25e1bc1725455978064c59748b | parkings/api/public/parking_area_statistics.py | parkings/api/public/parking_area_statistics.py | from django.utils import timezone
from rest_framework import serializers, viewsets
from parkings.models import Parking, ParkingArea
class ParkingAreaStatisticsSerializer(serializers.ModelSerializer):
current_parking_count = serializers.SerializerMethodField()
def get_current_parking_count(self, area):
... | from django.utils import timezone
from rest_framework import serializers, viewsets
from parkings.models import Parking, ParkingArea
from ..common import WGS84InBBoxFilter
class ParkingAreaStatisticsSerializer(serializers.ModelSerializer):
current_parking_count = serializers.SerializerMethodField()
def get_... | Add bbox to parking area statistics view set | Add bbox to parking area statistics view set
| Python | mit | tuomas777/parkkihubi |
e922f526ce95b8a992004df91b08bf466d9eea15 | dbmigrator/cli.py | dbmigrator/cli.py | # -*- coding: utf-8 -*-
# ###
# Copyright (c) 2015, Rice University
# This software is subject to the provisions of the GNU Affero General
# Public License version 3 (AGPLv3).
# See LICENCE.txt for details.
# ###
import argparse
import os
import sys
from . import commands, utils
DEFAULTS = {
'migrations_directo... | # -*- coding: utf-8 -*-
# ###
# Copyright (c) 2015, Rice University
# This software is subject to the provisions of the GNU Affero General
# Public License version 3 (AGPLv3).
# See LICENCE.txt for details.
# ###
import argparse
import os
import sys
from . import commands, utils
DEFAULTS = {
}
def main(argv=s... | Remove default config path (development.ini) | Remove default config path (development.ini)
Towards #1
| Python | agpl-3.0 | karenc/db-migrator |
4539ebc92d59dd0388658fa482626185088222b8 | tests.py | tests.py | from __future__ import unicode_literals
from tqdm import format_interval, format_meter
def test_format_interval():
assert format_interval(60) == '01:00'
assert format_interval(6160) == '1:42:40'
assert format_interval(238113) == '66:08:33'
def test_format_meter():
assert format_meter(0, 1000, 13) ==... | from __future__ import unicode_literals
from StringIO import StringIO
import csv
from tqdm import format_interval, format_meter, tqdm
def test_format_interval():
assert format_interval(60) == '01:00'
assert format_interval(6160) == '1:42:40'
assert format_interval(238113) == '66:08:33'
def test_format_m... | Test that tqdm fails when iterating over a csv file | Test that tqdm fails when iterating over a csv file
| Python | mit | lrq3000/tqdm,kmike/tqdm |
7c5cf5eb9b59a499ab480ea571cbb9d8203c1a79 | tests/test_gdal.py | tests/test_gdal.py | """ Test gdal plugin functionality.
"""
import pytest
from imageio.testing import run_tests_if_main, get_test_dir
import imageio
from imageio.core import get_remote_file
test_dir = get_test_dir()
try:
from osgeo import gdal
except ImportError:
gdal = None
@pytest.mark.skipif('gdal is None')
def test_gdal_... | """ Test gdal plugin functionality.
"""
import pytest
from imageio.testing import run_tests_if_main, get_test_dir, need_internet
import imageio
from imageio.core import get_remote_file
test_dir = get_test_dir()
try:
from osgeo import gdal
except ImportError:
gdal = None
@pytest.mark.skipif('gdal is None')... | Mark gdal tests as requiring internet | Mark gdal tests as requiring internet | Python | bsd-2-clause | imageio/imageio |
54933f992af05ea3ac1edbb11e5873b9327a946e | script/lib/config.py | script/lib/config.py | #!/usr/bin/env python
import platform
import sys
BASE_URL = 'http://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = 'e375124044f9044ac88076eba0cd17361ee0997c'
ARCH = {
'cygwin': '32bit',
'darwin': '64bit',
'linux2': platform.architecture()[0],
'win32': '32bit',
}... | #!/usr/bin/env python
import platform
import sys
BASE_URL = 'http://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = '55efd338101e08691560192b2be0f9c3b1b0eb72'
ARCH = {
'cygwin': '32bit',
'darwin': '64bit',
'linux2': platform.architecture()[0],
'win32': '32bit',
}... | Upgrade libchromiumcontent to fix icu symbols | Upgrade libchromiumcontent to fix icu symbols
| Python | mit | JussMee15/electron,mrwizard82d1/electron,chriskdon/electron,seanchas116/electron,the-ress/electron,anko/electron,brenca/electron,kikong/electron,RobertJGabriel/electron,jacksondc/electron,etiktin/electron,arturts/electron,DivyaKMenon/electron,gerhardberger/electron,twolfson/electron,fffej/electron,mirrh/electron,Bionic... |
b8839302c0a4d8ada99a695f8829027fa433e05e | zerver/migrations/0232_make_archive_transaction_field_not_nullable.py | zerver/migrations/0232_make_archive_transaction_field_not_nullable.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('zerver', '0231_add_archive_transaction_model'),
]
operations = [
migrations.RunSQL("DELETE ... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
"""
Tables cannot have data deleted from them and be altered in a single transaction,
but we need the DELETEs to be atomic togeth... | Fix migration making archive_transaction field not null. | retention: Fix migration making archive_transaction field not null.
DELETing from archive tables and ALTERing ArchivedMessage needs to be
split into separate transactions.
zerver_archivedattachment_messages needs to be cleared out before
zerver_archivedattachment.
| Python | apache-2.0 | eeshangarg/zulip,shubhamdhama/zulip,zulip/zulip,brainwane/zulip,synicalsyntax/zulip,eeshangarg/zulip,andersk/zulip,hackerkid/zulip,hackerkid/zulip,timabbott/zulip,zulip/zulip,timabbott/zulip,synicalsyntax/zulip,tommyip/zulip,tommyip/zulip,rht/zulip,andersk/zulip,rishig/zulip,rht/zulip,timabbott/zulip,brainwane/zulip,ee... |
2a7322104eb4222517f8a1167597104c5daab0bc | notes-cli.py | notes-cli.py | import argparse
import yaml
from os.path import expanduser
def load_config_from(path):
with open(expanduser(path)) as file:
return yaml.load(file)
def parse_options():
parser = argparse.ArgumentParser()
parser.add_argument("command",
choices=["ls", "add", "rm", "edit", "view", "reinde... | import argparse
import yaml
import os
from os.path import expanduser, isdir
import whoosh.index as ix
from whoosh.fields import *
def load_config_from(path):
with open(expanduser(path)) as file:
return yaml.load(file)
def parse_options():
parser = argparse.ArgumentParser()
parser.add_argument("command",
... | Create or load index directory | Create or load index directory
| Python | mit | phss/notes-cli |
8b0c1fc8d06a4561b9241a92162a24a4df0efa34 | viper.py | viper.py | #!/usr/bin/env python3
from viper.interactive import *
if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-L', '--interactive-lexer', action='store_true', help='lexes input')
parser.add_argument('-S', '--interactive-sppf', action='store_true', help='lex... | #!/usr/bin/env python3
from viper.interactive import *
from viper.lexer import lex_file
from viper.grammar import GRAMMAR
if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-L', '--interactive-lexer', action='store_true', help='lexes input')
parser.add_... | Allow direct SPPF generation from interactive script | Allow direct SPPF generation from interactive script
| Python | apache-2.0 | pdarragh/Viper |
3598313c087651a85dce5e31d9fdc227dea0ccf4 | binary-search.py | binary-search.py | # iterative approach to binary search function (assume list has distinct elements and elements are in ascending order)
def binary_search(arr, data):
low = 0 # first element in array
high = len(arr) - 1 # last item in array
while low <= high: # iterate through "entire" array
middle = (low + high)/2
if arr[middl... | # iterative approach to binary search function (assume list has distinct elements and elements are in ascending order)
def binary_search(arr, data):
low = 0 # first element position in array
high = len(arr) - 1 # last element position in array
while low <= high: # iterate through "entire" array
middle = (low + hi... | Add test cases for python implementation of binary search function | Add test cases for python implementation of binary search function
| Python | mit | derekmpham/interview-prep,derekmpham/interview-prep |
1468d6e257d4f22f803549606cbd3e3245c2ce37 | redash/utils/comparators.py | redash/utils/comparators.py | from sqlalchemy import func
from sqlalchemy.ext.hybrid import Comparator
class CaseInsensitiveComparator(Comparator):
def __eq__(self, other):
return func.lower(self.__clause_element__()) == func.lower(other)
| from sqlalchemy import String
class CaseInsensitiveComparator(String.Comparator):
def __eq__(self, other):
return func.lower(self.__clause_element__()) == func.lower(other)
| Change CaseInsensitiveComparator to support all operations. | Change CaseInsensitiveComparator to support all operations.
| Python | bsd-2-clause | moritz9/redash,44px/redash,getredash/redash,alexanderlz/redash,alexanderlz/redash,moritz9/redash,44px/redash,44px/redash,denisov-vlad/redash,getredash/redash,getredash/redash,denisov-vlad/redash,getredash/redash,denisov-vlad/redash,chriszs/redash,denisov-vlad/redash,44px/redash,alexanderlz/redash,getredash/redash,chris... |
566e68d3b06d3aaba796f0cda57a42bb12cf6d79 | celery/__init__.py | celery/__init__.py | """Distributed Task Queue"""
from celery.distmeta import __version__, __author__, __contact__
from celery.distmeta import __homepage__, __docformat__
from celery.distmeta import VERSION, is_stable_release, version_with_meta
| """Distributed Task Queue"""
from celery.distmeta import __version__, __author__, __contact__
from celery.distmeta import __homepage__, __docformat__
from celery.distmeta import VERSION, is_stable_release, version_with_meta
from celery.decorators import task
from celery.task.base import Task, PeriodicTask
from celery.... | Make decorators.task, Task, PeriodicTask, apply* available from celery.py | Make decorators.task, Task, PeriodicTask, apply* available from celery.py
| Python | bsd-3-clause | cbrepo/celery,WoLpH/celery,ask/celery,mitsuhiko/celery,cbrepo/celery,mitsuhiko/celery,frac/celery,frac/celery,ask/celery,WoLpH/celery |
3f87d22624a5a27fdca2f82103aff6bda6491c70 | caribou/antler/antler_settings.py | caribou/antler/antler_settings.py | from caribou.settings.setting_types import *
from caribou.i18n import _
AntlerSettings = SettingsTopGroup(
_("Antler Preferences"), "/org/gnome/antler/", "org.gnome.antler",
[SettingsGroup("antler", _("Antler"), [
SettingsGroup("appearance", _("Appearance"), [
StringSett... | from caribou.settings.setting_types import *
from caribou.i18n import _
AntlerSettings = SettingsTopGroup(
_("Antler Preferences"), "/org/gnome/antler/", "org.gnome.antler",
[SettingsGroup("antler", _("Antler"), [
SettingsGroup("appearance", _("Appearance"), [
StringSett... | Add "full scale" to antler settings. | Add "full scale" to antler settings.
| Python | lgpl-2.1 | GNOME/caribou,GNOME/caribou,GNOME/caribou |
66602e67c06266735b58fd2bee8b55b7cac401b1 | archive/archive_report_ingest_status/src/test_archive_report_ingest_status.py | archive/archive_report_ingest_status/src/test_archive_report_ingest_status.py | # -*- encoding: utf-8 -*-
import uuid
import archive_report_ingest_status as report_ingest_status
def test_get_returns_status(dynamodb_resource, table_name):
guid = str(uuid.uuid4())
table = dynamodb_resource.Table(table_name)
table.put_item(Item={'id': guid})
event = {
'request_method': '... | # -*- encoding: utf-8 -*-
import uuid
import pytest
import archive_report_ingest_status as report_ingest_status
def test_get_returns_status(dynamodb_resource, table_name):
guid = str(uuid.uuid4())
table = dynamodb_resource.Table(table_name)
table.put_item(Item={'id': guid})
event = {
'req... | Add a test that a non-GET method is rejected | Add a test that a non-GET method is rejected
| Python | mit | wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api |
342c1c70e2fbf13bea87792b6a289f830fb95692 | letsencryptae/models.py | letsencryptae/models.py | # THIRD PARTY
from djangae.fields import CharField
from django.db import models
class Secret(models.Model):
created = models.DateTimeField(auto_now_add=True)
url_slug = CharField(primary_key=True)
secret = CharField()
def __unicode__(self):
return self.url_slug
def clean(self, *args, **k... | # THIRD PARTY
from djangae.fields import CharField
from django.db import models
class Secret(models.Model):
created = models.DateTimeField(auto_now_add=True)
url_slug = CharField(primary_key=True)
secret = CharField()
class Meta(object):
ordering = ('-created',)
def __unicode__(self):
... | Order Secret objects by `created` date. | Order Secret objects by `created` date.
| Python | mit | adamalton/letsencrypt-appengine |
a827279098ab2ef73778b15a76f738fedce9ed30 | tests.py | tests.py | import api
import unittest
import os
from getpass import getpass
class ApiTest(unittest.TestCase):
def setUp(self):
self.linode = api.Api(os.environ['LINODE_API_KEY'])
def testAvailLinodeplans(self):
available_plans = self.linode.avail_linodeplans()
self.assertTrue(isinstance(availabl... | import api
import unittest
import os
from getpass import getpass
class ApiTest(unittest.TestCase):
def setUp(self):
self.linode = api.Api(os.environ['LINODE_API_KEY'])
def testAvailLinodeplans(self):
available_plans = self.linode.avail_linodeplans()
self.assertTrue(isinstance(availabl... | Add a test case for test.echo | Add a test case for test.echo
| Python | mit | ryanshawty/linode-python,tjfontaine/linode-python |
2fcd13435d04622c7ec0915a77efb390ea9c09b1 | rcstreamlistener.py | rcstreamlistener.py | # rcstreamlistener.py
import urllib3.contrib.pyopenssl
import logging
from ipaddress import ip_address
from socketIO_client import SocketIO, BaseNamespace
urllib3.contrib.pyopenssl.inject_into_urllib3()
logging.basicConfig(level=logging.WARNING)
class MainNamespace(BaseNamespace):
def on_change(self, change):
... | # rcstreamlistener.py
import urllib3.contrib.pyopenssl
import logging
from ipaddress import ip_address
from socketIO_client import SocketIO, BaseNamespace
import template_adder
urllib3.contrib.pyopenssl.inject_into_urllib3()
logging.basicConfig(level=logging.WARNING)
class MainNamespace(BaseNamespace):
def on_cha... | Use if/else instead of try/except | Use if/else instead of try/except | Python | mit | piagetbot/enwikibot |
cf6e7bdbd9ec6968be8767f1bbcab09de6f8aace | codekitlang/command.py | codekitlang/command.py | # -*- coding: utf-8 -*-
import argparse
from . import compiler
def main():
parser = argparse.ArgumentParser(description='CodeKit Language Compiler.')
parser.add_argument('src', nargs=1, metavar='SOURCE')
parser.add_argument('dest', nargs=1, metavar='DEST')
parser.add_argument('--framework-paths', '-f... | # -*- coding: utf-8 -*-
import argparse
from . import compiler
def main():
parser = argparse.ArgumentParser(description='CodeKit Language Compiler.')
parser.add_argument('src', nargs=1, metavar='SOURCE')
parser.add_argument('dest', nargs=1, metavar='DEST')
parser.add_argument('--framework-paths', '-f... | Add interface to interpreter's "-m" option. | Add interface to interpreter's "-m" option.
| Python | bsd-3-clause | gjo/python-codekitlang,gjo/python-codekitlang |
f0af944db962bdb8ea764737860ce9168f779977 | perfkitbenchmarker/linux_packages/azure_credentials.py | perfkitbenchmarker/linux_packages/azure_credentials.py | # Copyright 2016 PerfKitBenchmarker Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | # Copyright 2016 PerfKitBenchmarker Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | Fix a bug in the Azure credentials package in which they would overwrite the directory. | Fix a bug in the Azure credentials package in which they would overwrite the directory.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=248750675
| Python | apache-2.0 | GoogleCloudPlatform/PerfKitBenchmarker,GoogleCloudPlatform/PerfKitBenchmarker,GoogleCloudPlatform/PerfKitBenchmarker,GoogleCloudPlatform/PerfKitBenchmarker |
6250427143245676a5efd7e5c55054b5b3a285fd | src/pushover_complete/__init__.py | src/pushover_complete/__init__.py | """A Python 3 package for interacting with *all* aspects of the Pushover API"""
from .error import PushoverCompleteError, BadAPIRequestError
from .pushover_api import PushoverAPI
__all__ = [
'PushoverCompleteError', 'BadAPIRequestError',
'PushoverAPI'
]
__version__ = '0.0.1'
__title__ = 'pushover_complete'
... | """A Python 3 package for interacting with *all* aspects of the Pushover API"""
from .error import PushoverCompleteError, BadAPIRequestError
from .pushover_api import PushoverAPI
__all__ = [
'PushoverCompleteError', 'BadAPIRequestError',
'PushoverAPI'
]
__version__ = '0.0.1'
__title__ = 'pushover_complete'
... | Add URL for project to the project metadata | Add URL for project to the project metadata
| Python | mit | scolby33/pushover_complete |
546140bee689fc63361977dafa600022396606e7 | audio_train.py | audio_train.py | #%% Setup.
import numpy as np
import scipy.io.wavfile
from keras.utils.visualize_util import plot
from keras.callbacks import TensorBoard, ModelCheckpoint
from keras.utils import np_utils
from eva.models.wavenet import Wavenet, compute_receptive_field
from eva.util.mutil import sparse_labels
#%% Data
RATE, DATA = s... | #%% Setup.
import numpy as np
import scipy.io.wavfile
from keras.utils.visualize_util import plot
from keras.callbacks import TensorBoard, ModelCheckpoint
from keras.utils import np_utils
from eva.models.wavenet import Wavenet, compute_receptive_field
from eva.util.mutil import sparse_labels
#%% Data
RATE, DATA = s... | Add train config to audio train | Add train config to audio train
| Python | apache-2.0 | israelg99/eva |
fd5674a1b36498e5d3a597203c180ded8c57d058 | morph_proxy.py | morph_proxy.py | # Run this with mitmdump -q -s morph_proxy.py
def request(context, flow):
# print out all the basic information to determine what request is being made
# coming from which container
# print flow.request.method
# print flow.request.host
# print flow.request.path
# print flow.request.scheme
# print flow.re... | # Run this with mitmdump -q -s morph_proxy.py
def response(context, flow):
text = flow.request.method + " " + flow.request.scheme + "://" + flow.request.host + flow.request.path + " FROM " + flow.request.client_conn.address[0] + " REQUEST SIZE " + str(len(flow.request.content)) + " RESPONSE SIZE " + str(len(flow.res... | Add request and response size | Add request and response size
| Python | agpl-3.0 | otherchirps/morph,openaustralia/morph,otherchirps/morph,otherchirps/morph,OpenAddressesUK/morph,otherchirps/morph,otherchirps/morph,openaustralia/morph,openaustralia/morph,otherchirps/morph,otherchirps/morph,OpenAddressesUK/morph,openaustralia/morph,OpenAddressesUK/morph,openaustralia/morph,openaustralia/morph,OpenAddr... |
c8cac2a2c1b42fde675b166272729c74c2c42cdc | x.py | x.py | #!/usr/bin/env python
# This file is only a "symlink" to bootstrap.py, all logic should go there.
import os
import sys
rust_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.join(rust_dir, "src", "bootstrap"))
import bootstrap
bootstrap.main()
| #!/usr/bin/env python
# This file is only a "symlink" to bootstrap.py, all logic should go there.
import os
import sys
# If this is python2, check if python3 is available and re-execute with that
# interpreter.
if sys.version_info.major < 3:
try:
# On Windows, `py -3` sometimes works.
# Try this ... | Choose the version of python at runtime (portable version) | Choose the version of python at runtime (portable version)
- Try `py -3` first for windows compatibility
- Fall back to `python3` if `py` doesn't work
| Python | apache-2.0 | aidancully/rust,graydon/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust |
f707daae978f6fb7c8b5cc8f66cac2820097ebde | attack.py | attack.py | from subprocess import Popen, PIPE
proc = Popen(["./badencrypt.py", "hello!!!"],stdout=PIPE)
hexCiphertext = proc.communicate()[0].strip()
#import pdb
#pdb.set_trace()
print hexCiphertext
proc = Popen(["./baddecrypt.py", hexCiphertext],stdout=PIPE)
output = proc.communicate()[0]
print output
| from subprocess import Popen, PIPE
proc = Popen(["./badencrypt.py", "hellooooworlddd"],stdout=PIPE)
hexCiphertext = proc.communicate()[0].strip()
import pdb
pdb.set_trace()
print hexCiphertext
print str(len(hexCiphertext)/16)+" blocks"
proc = Popen(["./baddecrypt.py", hexCiphertext],stdout=PIPE)
output = proc.commun... | Make a sixteen byte plaintext | Make a sixteen byte plaintext
| Python | mit | somethingnew2-0/CS642-HW4,somethingnew2-0/CS642-HW4 |
76dddab86552a1e65cdc8ed26bb0674c83d5697b | setup.py | setup.py | from distutils.core import setup
import pykka
setup(
name='Pykka',
version=pykka.get_version(),
author='Stein Magnus Jodal',
author_email='stein.magnus@jodal.no',
packages=['pykka'],
url='http://jodal.github.com/pykka/',
license='Apache License, Version 2.0',
description='Pykka is a co... | from distutils.core import setup
import pykka
setup(
name='Pykka',
version=pykka.get_version(),
author='Stein Magnus Jodal',
author_email='stein.magnus@jodal.no',
packages=['pykka'],
url='http://jodal.github.com/pykka/',
license='Apache License, Version 2.0',
description='Pykka is easy... | Update description and categories for PyPI | Update description and categories for PyPI
| Python | apache-2.0 | tempbottle/pykka,jodal/pykka,tamland/pykka |
c1498aebcb7d74d023be65055f19a89acf0ec546 | setup.py | setup.py | #!/usr/bin/env python
from distutils.core import setup
from distutils.file_util import copy_file
import platform
version = "0.1.0"
setup(name="riemann-sumd",
version=version,
description="Python agent for scheduling event generating processes and sending the results to Riemann",
author="Brian Hatfie... | #!/usr/bin/env python
from distutils.core import setup
from distutils.file_util import copy_file
import platform
version = "0.1.0"
setup(name="riemann-sumd",
version=version,
description="Python agent for scheduling event generating processes and sending the results to Riemann",
author="Brian Hatfie... | Remove copy_file call because it doesn't work right with bdist_deb | Remove copy_file call because it doesn't work right with bdist_deb
| Python | mit | crashlytics/riemann-sumd |
7c0c5631ff9f2d3511b7c460d22516b5b0393697 | setup.py | setup.py | #!/usr/bin/env python
import distutils.core
# Uploading to PyPI
# =================
# $ python setup.py register -r pypi
# $ python setup.py sdist upload -r pypi
version = '1.1'
distutils.core.setup(
name='linersock',
version=version,
author='Kale Kundert and Alex Mitchell',
packages=... | #!/usr/bin/env python
import distutils.core
# Uploading to PyPI
# =================
# $ python setup.py register -r pypi
# $ python setup.py sdist upload -r pypi
version = '1.2'
distutils.core.setup(
name='linersock',
version=version,
author='Kale Kundert and Alex Mitchell',
url='http... | Add six as a dependency. | Add six as a dependency.
| Python | mit | kalekundert/linersock,kalekundert/linersock |
e2ea8d08d5e6006136b74d00a2ee64d1e7858941 | plot_scores.py | plot_scores.py | from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
import argparse
import matplotlib.pyplot as plt
import pandas as pd
def main():
parser = argp... | from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
import argparse
import os
import matplotlib.pyplot as plt
import pandas as pd
def main():
par... | Support plotting multiple score files | Support plotting multiple score files
| Python | mit | toslunar/chainerrl,toslunar/chainerrl |
9a30728493258d7dcf60b67a8c87489e1457df1a | kitchen/dashboard/templatetags/filters.py | kitchen/dashboard/templatetags/filters.py | """Dashboard template filters"""
from django import template
import littlechef
from kitchen.settings import REPO
register = template.Library()
@register.filter(name='get_role_list')
def get_role_list(run_list):
"""Returns the role sublist from the given run_list"""
prev_role_list = littlechef.lib.get_roles_... | """Dashboard template filters"""
from django import template
import littlechef
from kitchen.settings import REPO
register = template.Library()
@register.filter(name='get_role_list')
def get_role_list(run_list):
"""Returns the role sublist from the given run_list"""
if run_list:
all_roles = littleche... | Check 'role_list' before sending it to little_chef | Check 'role_list' before sending it to little_chef
| Python | apache-2.0 | edelight/kitchen,edelight/kitchen,edelight/kitchen,edelight/kitchen |
0e9b8c2dbe5d3fbedf1b444819ca3820a9a13135 | utils.py | utils.py | # -*- coding: utf-8 -*-
import re
_strip_re = re.compile(ur'[\'"`‘’“”′″‴]+')
_punctuation_re = re.compile(ur'[\t !#$%&()*\-/<=>?@\[\\\]^_{|}:;,.…‒–—―]+')
def makename(text, delim=u'-', maxlength=50, filter=None):
u"""
Generate a Unicode name slug.
>>> makename('This is a title')
u'this-is-a-title'
... | # -*- coding: utf-8 -*-
import re
_strip_re = re.compile(ur'[\'"`‘’“”′″‴]+')
_punctuation_re = re.compile(ur'[\t +!#$%&()*\-/<=>?@\[\\\]^_{|}:;,.…‒–—―]+')
def makename(text, delim=u'-', maxlength=50, filter=None):
u"""
Generate a Unicode name slug.
>>> makename('This is a title')
u'this-is-a-title'
... | Remove + character from generated URLs | Remove + character from generated URLs
| Python | agpl-3.0 | hasgeek/funnel,piyushroshan/fossmeet,hasgeek/funnel,hasgeek/funnel,hasgeek/funnel,piyushroshan/fossmeet,jace/failconfunnel,jace/failconfunnel,piyushroshan/fossmeet,hasgeek/funnel,jace/failconfunnel |
5448e38d14589b7558513f51d0abf541790be817 | i3pystatus/core/command.py | i3pystatus/core/command.py | # from subprocess import CalledProcessError
import subprocess
def run_through_shell(command, enable_shell=False):
"""
Retrieves output of command
Returns tuple success (boolean)/ stdout(string) / stderr (string)
Don't use this function with programs that outputs lots of data since the output is saved... | # from subprocess import CalledProcessError
from collections import namedtuple
import subprocess
CommandResult = namedtuple("Result", ['rc', 'out', 'err'])
def run_through_shell(command, enable_shell=False):
"""
Retrieves output of command
Returns tuple success (boolean)/ stdout(string) / stderr (string)... | Use named tuple for return value | Use named tuple for return value
| Python | mit | m45t3r/i3pystatus,teto/i3pystatus,yang-ling/i3pystatus,opatut/i3pystatus,m45t3r/i3pystatus,juliushaertl/i3pystatus,Elder-of-Ozone/i3pystatus,MaicoTimmerman/i3pystatus,paulollivier/i3pystatus,onkelpit/i3pystatus,richese/i3pystatus,asmikhailov/i3pystatus,enkore/i3pystatus,juliushaertl/i3pystatus,eBrnd/i3pystatus,claria/i... |
4eecac0764e8abfc33c9e77b8eb6b700b536f1a0 | pull_me.py | pull_me.py | #!/usr/bin/env python
from random import randint
from time import sleep
from os import system
from easygui import msgbox
while True:
delay = randint(60, 2000)
sleep(delay)
system("aplay /usr/lib/libreoffice/share/gallery/sounds/kongas.wav")
msgbox("Hi Dan", "Time is up")
| #!/usr/bin/env python
from random import randint
from time import sleep
from os import system
import os.path
from easygui import msgbox
while True:
delay = randint(60, 2000)
sleep(delay)
if os.path.isfile("/usr/share/sounds/GNUstep/Glass.wav"):
system("aplay /usr/share/sounds/GNUstep/Glass.wav")
else:
... | Use Glass.wav if it exists. | Use Glass.wav if it exists.
| Python | apache-2.0 | dnuffer/carrot_slots |
9310e94a1406102bba109416f781f9d6330d0028 | tests/test_itunes.py | tests/test_itunes.py | """
test_itunes.py
Copyright © 2015 Alex Danoff. All Rights Reserved.
2015-08-02
This file tests the functionality provided by the itunes module.
"""
import unittest
from datetime import datetime
from itunes.itunes import parse_value
class ITunesTests(unittest.TestCase):
"""
Test cases for iTunes functiona... | """
test_itunes.py
Copyright © 2015 Alex Danoff. All Rights Reserved.
2015-08-02
This file tests the functionality provided by the itunes module.
"""
import unittest
from datetime import datetime
from itunes.itunes import parse_value, run_applescript
from itunes.exceptions import AppleScriptError
class ITunesTests... | Add test to make sure `run_applescript` throws on bad script | Add test to make sure `run_applescript` throws on bad script
| Python | mit | adanoff/iTunesTUI |
44d5974fafdddb09a684882fc79662ae4c509f57 | names/__init__.py | names/__init__.py | from os.path import abspath, join, dirname
import random
__title__ = 'names'
__version__ = '0.2'
__author__ = 'Trey Hunner'
__license__ = 'MIT'
full_path = lambda filename: abspath(join(dirname(__file__), filename))
FILES = {
'first:male': full_path('dist.male.first'),
'first:female': full_path('dist.fema... | from os.path import abspath, join, dirname
import random
__title__ = 'names'
__version__ = '0.2'
__author__ = 'Trey Hunner'
__license__ = 'MIT'
full_path = lambda filename: abspath(join(dirname(__file__), filename))
FILES = {
'first:male': full_path('dist.male.first'),
'first:female': full_path('dist.fema... | Fix unicode string syntax for Python 3 | Fix unicode string syntax for Python 3
| Python | mit | treyhunner/names,treyhunner/names |
07058595e43290524d28b53b5919fb76f16c618b | test/test_validators.py | test/test_validators.py | from unittest import TestCase
from win_unc import validators as V
class TestIsValidDriveLetter(TestCase):
def test_valid(self):
self.assertTrue(V.is_valid_drive_letter('A'))
self.assertTrue(V.is_valid_drive_letter('Z'))
self.assertTrue(V.is_valid_drive_letter('a'))
self.assertTrue... | from unittest import TestCase
from win_unc import validators as V
class TestIsValidDriveLetter(TestCase):
def test_valid(self):
self.assertTrue(V.is_valid_drive_letter('A'))
self.assertTrue(V.is_valid_drive_letter('Z'))
self.assertTrue(V.is_valid_drive_letter('a'))
self.assertTrue... | Add tests for UNC path validator | Add tests for UNC path validator
| Python | mit | CovenantEyes/py_win_unc,nithinphilips/py_win_unc |
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 |
8ea90a83318e4c1cb01b773435ef4861a459ac0f | indra/sources/utils.py | indra/sources/utils.py | # -*- coding: utf-8 -*-
"""Processor for remote INDRA JSON files."""
import requests
from typing import List
from ..statements import Statement, stmts_from_json
__all__ = [
'RemoteProcessor',
]
class RemoteProcessor:
"""A processor for INDRA JSON file to be retrieved by URL.
Parameters
----------... | # -*- coding: utf-8 -*-
"""Processor for remote INDRA JSON files."""
from collections import Counter
import requests
from typing import List
from ..statements import Statement, stmts_from_json
__all__ = [
'RemoteProcessor',
]
class RemoteProcessor:
"""A processor for INDRA JSON file to be retrieved by UR... | Implement autoloading and summary function | Implement autoloading and summary function
| Python | bsd-2-clause | sorgerlab/indra,sorgerlab/indra,sorgerlab/belpy,bgyori/indra,bgyori/indra,bgyori/indra,johnbachman/indra,sorgerlab/belpy,sorgerlab/indra,johnbachman/indra,sorgerlab/belpy,johnbachman/indra |
1009bd3b5e5941aff2f7b3852494ee19f085dcce | mediacloud/mediawords/db/exceptions/handler.py | mediacloud/mediawords/db/exceptions/handler.py | class McDatabaseHandlerException(Exception):
"""Database handler exception."""
pass
class McConnectException(McDatabaseHandlerException):
"""__connect() exception."""
pass
class McSchemaIsUpToDateException(McDatabaseHandlerException):
"""schema_is_up_to_date() exception."""
pass
class McQu... | class McDatabaseHandlerException(Exception):
"""Database handler exception."""
pass
class McConnectException(McDatabaseHandlerException):
"""__connect() exception."""
pass
class McSchemaIsUpToDateException(McDatabaseHandlerException):
"""schema_is_up_to_date() exception."""
pass
class McQu... | Add exception to be thrown by select() | Add exception to be thrown by select()
| Python | agpl-3.0 | berkmancenter/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud |
cb6fa6b54ca3e1908037a1b1a3399d8bd4b1be58 | djoser/compat.py | djoser/compat.py | from djoser.conf import settings
try:
from django.contrib.auth.password_validation import validate_password
except ImportError:
from password_validation import validate_password
__all__ = ['settings', 'validate_password']
def get_user_email(user):
email_field_name = get_user_email_field_name(user)
r... | from djoser.conf import settings
try:
from django.contrib.auth.password_validation import validate_password
except ImportError: # pragma: no cover
from password_validation import validate_password
__all__ = ['settings', 'validate_password']
def get_user_email(user):
email_field_name = get_user_email_fi... | Fix invalid fallback leading to circular calls | Fix invalid fallback leading to circular calls
Remove redundant finally
| Python | mit | sunscrapers/djoser,akalipetis/djoser,sunscrapers/djoser,sunscrapers/djoser,akalipetis/djoser |
ba6305578ad41519ea5f05296dda9732d538d5b3 | tests/test_pathutils.py | tests/test_pathutils.py | from os.path import join
import sublime
import sys
from unittest import TestCase
version = sublime.version()
if version < '3000':
from libsass import pathutils
else:
from sublime_libsass.libsass import pathutils
class test_pathutils(TestCase):
def test_subpaths(self):
path = join('/foo','bar','b... | from os.path import join
import sublime
import sys
from unittest import TestCase
from unittest.mock import patch
version = sublime.version()
if version < '3000':
from libsass import pathutils
else:
from sublime_libsass.libsass import pathutils
class test_pathutils(TestCase):
def test_subpaths(self):
... | Add unit test using mock | Add unit test using mock
| Python | mit | blitzrk/sublime_libsass,blitzrk/sublime_libsass |
407c6ceec878f60aa908ac12dd9cccc4c4dec9b4 | masters/master.chromium.chrome/master_gatekeeper_cfg.py | masters/master.chromium.chrome/master_gatekeeper_cfg.py | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from master import gatekeeper
from master import master_utils
# This is the list of the builder categories and the corresponding critical
# steps. If one cr... | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from master import gatekeeper
from master import master_utils
# This is the list of the builder categories and the corresponding critical
# steps. If one cr... | Modify gatekeeper config for master.chromium.chrome after switch to recipes | Modify gatekeeper config for master.chromium.chrome after switch to recipes
BUG=338501
Review URL: https://codereview.chromium.org/131033006
git-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@249524 0039d316-1c4b-4281-b951-d872f2087c98
| Python | bsd-3-clause | eunchong/build,eunchong/build,eunchong/build,eunchong/build |
dc2f8342bc9b9c921086948ed10f99de9bcbc76d | client/python/setup.py | client/python/setup.py | #!/usr/bin/env python
from distutils.core import setup
setup(name='Spiff',
version='0.1',
description="API to Spaceman Spiff",
author='Trever Fischer',
author_email='wm161@wm161.net',
url='http://github.com/synhak/spiff',
py_modules=['spiff']
)
| #!/usr/bin/env python
from distutils.core import setup
setup(name='Spiff',
version='0.1',
description="API to Spaceman Spiff",
author='Trever Fischer',
author_email='wm161@wm161.net',
url='http://github.com/synhak/spiff',
py_modules=['spiff'],
requires=['requests'],
)
| Add deps for python lib | Add deps for python lib
| Python | agpl-3.0 | SYNHAK/spiff,SYNHAK/spiff,SYNHAK/spiff |
9546faddab321eb508f358883faf45cbc7d48dd8 | calexicon/internal/tests/test_julian.py | calexicon/internal/tests/test_julian.py | import unittest
from calexicon.internal.julian import distant_julian_to_gregorian, julian_to_gregorian
class TestJulian(unittest.TestCase):
def test_distant_julian_to_gregorian(self):
self.assertEqual(distant_julian_to_gregorian(9999, 12, 1), (10000, 2, 12))
def test_julian_to_gregorian(self):
... | import unittest
from datetime import date as vanilla_date
from calexicon.internal.julian import distant_julian_to_gregorian, julian_to_gregorian
class TestJulian(unittest.TestCase):
def test_distant_julian_to_gregorian(self):
self.assertEqual(distant_julian_to_gregorian(9999, 12, 1), (10000, 2, 12))
... | Correct test - vanilla_date not tuple. | Correct test - vanilla_date not tuple.
| Python | apache-2.0 | jwg4/calexicon,jwg4/qual |
adb458132b4e633052c9e46e1dc4e67306f9fc6d | tikplay/database/models.py | tikplay/database/models.py | import sqlalchemy as sa
from database import Base
class Song(Base):
__tablename__ = 'songs'
song_hash = sa.Column(sa.String(40), primary_key=True)
filename = sa.Column(sa.Text, nullable=False)
play_count = sa.Column(sa.Integer, nullable=False)
artist = sa.Column(sa.Text, nullable=True)
title =... | import sqlalchemy as sa
from database import Base
class Song(Base):
__tablename__ = 'songs'
song_hash = sa.Column(sa.String(40), primary_key=True)
filename = sa.Column(sa.Text, nullable=False)
play_count = sa.Column(sa.Integer, nullable=False)
artist = sa.Column(sa.Text, nullable=True)
title =... | Add __repr__ and __str__ for DB model | Add __repr__ and __str__ for DB model
| Python | mit | tietokilta-saato/tikplay,tietokilta-saato/tikplay,tietokilta-saato/tikplay,tietokilta-saato/tikplay |
d7087cb309c028bdd56cf4c605d7c60eac3d4c0c | utils/custom_context.py | utils/custom_context.py | import discord
from discord.ext import commands
class CustomContext(commands.Context):
async def error(self, title: str, description: str = None):
em = discord.Embed(
title=f":no_entry_sign: {title}",
color=discord.Color.dark_red(),
description=description,
)
... | import discord
from discord.ext import commands
class CustomContext(commands.Context):
async def error(self, title: str, description: str = None):
em = discord.Embed(
title=f":no_entry_sign: {title}",
color=discord.Color.dark_red(),
description=description or '',
... | Remove 'None' in embed description | Remove 'None' in embed description
| Python | mit | Naught0/qtbot |
89593cc22f8de4bdb6d605b2e4d6e04b0d1fcd61 | microcosm_postgres/types.py | microcosm_postgres/types.py | """
Custom types.
"""
from six import text_type
from sqlalchemy.types import TypeDecorator, Unicode
class EnumType(TypeDecorator):
"""
SQLAlchemy enum type that persists the enum name (not value).
Note that this type is very similar to the `ChoiceType` from `sqlalchemy_utils`,
with the key differen... | """
Custom types.
"""
from enum import Enum
from six import text_type
from sqlalchemy.types import TypeDecorator, Unicode
class EnumType(TypeDecorator):
"""
SQLAlchemy enum type that persists the enum name (not value).
Note that this type is very similar to the `ChoiceType` from `sqlalchemy_utils`,
... | Handle non-enum inputs (if they are enum names) | Handle non-enum inputs (if they are enum names)
| Python | apache-2.0 | globality-corp/microcosm-postgres,globality-corp/microcosm-postgres |
c3d4000598a0d8dcbae91d11c36e8361887fa96a | storm/zope/schema.py | storm/zope/schema.py | #
# Copyright (c) 2006, 2007 Canonical
#
# Written by Gustavo Niemeyer <gustavo@niemeyer.net>
#
# This file is part of Storm Object Relational Mapper.
#
# Storm is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Found... | #
# Copyright (c) 2006, 2007 Canonical
#
# Written by Gustavo Niemeyer <gustavo@niemeyer.net>
#
# This file is part of Storm Object Relational Mapper.
#
# Storm is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Found... | Fix docstring and class name | Fix docstring and class name | Python | lgpl-2.1 | petrhosek/storm,PyMamba/mamba-storm,petrhosek/storm,petrhosek/storm,PyMamba/mamba-storm,PyMamba/mamba-storm |
02de17ee721d40ddcce9598d8a2ed82930240eda | server/python_django/file_uploader/__init__.py | server/python_django/file_uploader/__init__.py | """
@author: Ferdinand E. Silva
@email: ferdinandsilva@ferdinandsilva.com
@website: http://ferdinandsilva.com
"""
import os
class qqFileUploader(object):
def __init__(self, allowedExtensions=None, sizeLimit=1024):
self.allowedExtensions = allowedExtensions or []
self.sizeLimit = sizeLimit
de... | """
@author: Ferdinand E. Silva
@email: ferdinandsilva@ferdinandsilva.com
@website: http://ferdinandsilva.com
"""
import os
from django.utils import simplejson as json
class qqFileUploader(object):
def __init__(self, allowedExtensions=None, sizeLimit=1024):
self.allowedExtensions = allowedExtensions or [... | Improve the responses. In the case of the success the json was invalid. It required quotes | Improve the responses. In the case of the success the json was invalid. It required quotes
| Python | mit | SimonWaldherr/uploader,SimonWaldherr/uploader,SimonWaldherr/uploader,SimonWaldherr/uploader,SimonWaldherr/uploader,FineUploader/fine-uploader,FineUploader/fine-uploader,SimonWaldherr/uploader,FineUploader/fine-uploader,SimonWaldherr/uploader |
af413ab076bb74e93499455bc2fb761e4ec56702 | scent.py | scent.py | import os
import time
import subprocess
from sniffer.api import select_runnable, file_validator, runnable
try:
from pync import Notifier
except ImportError:
notify = None
else:
notify = Notifier.notify
watch_paths = ['mine/', 'tests/']
show_coverage = True
@select_runnable('python_tests')
@file_validat... | import os
import time
import subprocess
from sniffer.api import select_runnable, file_validator, runnable
try:
from pync import Notifier
except ImportError:
notify = None
else:
notify = Notifier.notify
watch_paths = ['mine/', 'tests/']
show_coverage = True
@select_runnable('python_tests')
@file_validat... | Disable tests the launch programs with 'watch' | Disable tests the launch programs with 'watch'
| Python | mit | jacebrowning/mine |
47a3c103344a5d6a558d8a5fa581c3440ca791e6 | erpnext/patches/4_0/countrywise_coa.py | erpnext/patches/4_0/countrywise_coa.py | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
frappe.reload_doc("setup", 'doctype', "company")
frappe.reload_doc("accounts", 'doctype', "account")
frappe.db.sql... | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
frappe.reload_doc("setup", 'doctype', "company")
frappe.reload_doc("accounts", 'doctype', "account")
frappe.db.sql... | Patch to update old accounts property | Patch to update old accounts property
| Python | agpl-3.0 | anandpdoshi/erpnext,anandpdoshi/erpnext,pombredanne/erpnext,gmarke/erpnext,Drooids/erpnext,suyashphadtare/test,suyashphadtare/vestasi-erp-final,mbauskar/omnitech-erpnext,treejames/erpnext,tmimori/erpnext,susuchina/ERPNEXT,gangadharkadam/smrterp,suyashphadtare/vestasi-update-erp,fuhongliang/erpnext,gsnbng/erpnext,hatwar... |
eaa99e12ef4b868e825ffe01f4eb9319e439827b | examples/face_detection/face_detect.py | examples/face_detection/face_detect.py | from scannerpy import Database, DeviceType, Job
from scannerpy.stdlib import pipelines
import subprocess
import cv2
import sys
import os.path
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/..')
import util
with Database() as db:
print('Ingesting video into Scanner ...')
[input_table], _ = db.in... | from scannerpy import Database, DeviceType, Job
from scannerpy.stdlib import pipelines
import subprocess
import cv2
import sys
import os.path
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/..')
import util
movie_path = util.download_video() if len(sys.argv) <= 1 else sys.argv[1]
print('Detecting faces ... | Update face detect example to take a path argument | Update face detect example to take a path argument
| Python | apache-2.0 | scanner-research/scanner,scanner-research/scanner,scanner-research/scanner,scanner-research/scanner |
627d79ae4950338c8a5a0d75bae244c9c0374d4a | friendlyurls/admin.py | friendlyurls/admin.py | from django.contrib import admin
from friendlyurls.models import *
class UrlMappingAdmin(admin.ModelAdmin):
list_display = ('friendly_path', 'resolved_url', 'content_type', 'object')
admin.site.register(UrlMapping, UrlMappingAdmin)
| from django.contrib import admin
from friendlyurls.models import *
class UrlMappingAdmin(admin.ModelAdmin):
list_display = ('friendly_path', 'resolved_url', 'content_type', 'object')
search_fields = ('friendly_path','content_type__name')
admin.site.register(UrlMapping, UrlMappingAdmin)
| Allow searching of vanity urls | Allow searching of vanity urls
| Python | bsd-3-clause | tachang/django_friendlyurls |
d0126b7e31c69ea7dd5cda4b9a3e931f5b8a8fbf | rest_framework/authtoken/views.py | rest_framework/authtoken/views.py | from rest_framework.views import APIView
from rest_framework import parsers
from rest_framework import renderers
from rest_framework.response import Response
from rest_framework.authtoken.models import Token
from rest_framework.authtoken.serializers import AuthTokenSerializer
class ObtainAuthToken(APIView):
throt... | from rest_framework.views import APIView
from rest_framework import parsers
from rest_framework import renderers
from rest_framework.response import Response
from rest_framework.authtoken.models import Token
from rest_framework.authtoken.serializers import AuthTokenSerializer
class ObtainAuthToken(APIView):
throt... | Set serializer_class on ObtainAuthToken view | Set serializer_class on ObtainAuthToken view
| Python | bsd-2-clause | kennydude/django-rest-framework,mgaitan/django-rest-framework,wedaly/django-rest-framework,arpheno/django-rest-framework,callorico/django-rest-framework,johnraz/django-rest-framework,nryoung/django-rest-framework,krinart/django-rest-framework,gregmuellegger/django-rest-framework,akalipetis/django-rest-framework,tigeran... |
4393740af93ae0ac1927e68c422e24735b0216c1 | infosystem/subsystem/policy/entity.py | infosystem/subsystem/policy/entity.py | from sqlalchemy import UniqueConstraint
from infosystem.common.subsystem import entity
from infosystem.database import db
class Policy(entity.Entity, db.Model):
attributes = ['id', 'capability_id', 'role_id', 'bypass']
domain_id = db.Column(db.CHAR(32), db.ForeignKey("domain.id"), nullable=False)
capabil... | from sqlalchemy import UniqueConstraint
from infosystem.common.subsystem import entity
from infosystem.database import db
class Policy(entity.Entity, db.Model):
attributes = ['id', 'capability_id', 'role_id', 'bypass']
domain_id = db.Column(db.CHAR(32), db.ForeignKey("domain.id"), nullable=False)
capabil... | Make role_id & bypass opt args in Policy __init__ | Make role_id & bypass opt args in Policy __init__
| Python | apache-2.0 | samueldmq/infosystem |
e99a4aa3fab84e112f5d82eafe9012f7e2be9447 | problem-static/Intro-Eval_50/admin/eval.py | problem-static/Intro-Eval_50/admin/eval.py | #!/usr/bin/python2.7
del __builtins__.__dict__['__import__']
del __builtins__.__dict__['reload']
flag = "eval_is_fun"
def main():
print "Hi, welcome to the flag database. We are under construction right now, so you cannot view the flags, or do anything."
while True:
command = raw_input("What would yo... | #!/usr/bin/python2.7
import sys
del __builtins__.__dict__['__import__']
del __builtins__.__dict__['reload']
flag = "eval_is_fun"
class UnbufferedStream(object):
def __init__(self, stream):
self.stream = stream
def write(self, data):
self.stream.write(data)
self.stream.flush()
def... | Fix Intro Eval with Unbuffered Streams | Fix Intro Eval with Unbuffered Streams
| Python | mit | james9909/IntroCTF,james9909/IntroCTF,james9909/IntroCTF,james9909/IntroCTF,james9909/IntroCTF,james9909/IntroCTF |
bdeb60d5e82e5eaaaaf805286bae29e9112af307 | us_ignite/common/management/commands/common_load_fixtures.py | us_ignite/common/management/commands/common_load_fixtures.py | import urlparse
from django.conf import settings
from django.core.management.base import BaseCommand
from django.contrib.sites.models import Site
class Command(BaseCommand):
def handle(self, *args, **options):
parsed_url = urlparse.urlparse(settings.SITE_URL)
Site.objects.all().update(domain=par... | import urlparse
from django.conf import settings
from django.core.management.base import BaseCommand
from django.contrib.sites.models import Site
from us_ignite.profiles.models import Interest
INTEREST_LIST = (
('SDN', 'sdn'),
('OpenFlow', 'openflow'),
('Ultra fast', 'ultra-fast'),
('Advanced wirele... | Add initial data for the ``Interest`` model. | Add initial data for the ``Interest`` model.
| Python | bsd-3-clause | us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite |
e73795b8ad016bba5b1ab5118a5153085a1e99b0 | nova/tests/functional/api_sample_tests/test_servers_ips.py | nova/tests/functional/api_sample_tests/test_servers_ips.py | # Copyright 2012 Nebula, Inc.
# Copyright 2013 IBM Corp.
#
# 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... | # Copyright 2012 Nebula, Inc.
# Copyright 2013 IBM Corp.
#
# 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... | Make it obvious where we're getting our names from | trivial: Make it obvious where we're getting our names from
Change-Id: Ib9aa790c8999e50a2a3587561604ff1e51666f38
Signed-off-by: Stephen Finucane <492121341a95b3c3aab646bed44634f739dd019b@redhat.com>
| Python | apache-2.0 | mahak/nova,mahak/nova,klmitch/nova,klmitch/nova,klmitch/nova,rahulunair/nova,mahak/nova,rahulunair/nova,openstack/nova,openstack/nova,rahulunair/nova,openstack/nova,klmitch/nova |
4e5ef4a04fd0b3b354b187ee6e8e8ef27337ad6f | xclib/dbmops.py | xclib/dbmops.py | import sys
import bsddb3
from xclib.utf8 import utf8, unutf8
def perform(args):
domain_db = bsddb3.hashopen(args.domain_db, 'c', 0o600)
if args.get:
print(unutf8(domain_db[utf8(args.get)]))
elif args.put:
domain_db[utf8(args.put[0])] = args.put[1]
elif args.delete:
del domain_db... | import sys
import bsddb3
from xclib.utf8 import utf8, unutf8
def perform(args):
domain_db = bsddb3.hashopen(args.domain_db, 'c', 0o600)
if args.get:
print(unutf8(domain_db[utf8(args.get)], 'illegal'))
elif args.put:
domain_db[utf8(args.put[0])] = args.put[1]
elif args.delete:
de... | Allow dumping illegal utf-8 contents | Allow dumping illegal utf-8 contents
| Python | mit | jsxc/xmpp-cloud-auth,jsxc/xmpp-cloud-auth,jsxc/xmpp-cloud-auth,jsxc/xmpp-cloud-auth |
53171f75a64a26dcec91facbdec95b2ed7f74338 | ironic/drivers/drac.py | ironic/drivers/drac.py | #
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under... | #
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under... | Add the PXE VendorPassthru interface to PXEDracDriver | Add the PXE VendorPassthru interface to PXEDracDriver
Without the PXE VendorPassthru interface to expose the "pass_deploy_info"
method in the vendor_passthru endpoint of the API the DRAC it can't
continue the deployment after the ramdisk is booted.
Closes-Bug: #1379705
Change-Id: I21042cbb95a486742abfcb430471d01cd73b... | Python | apache-2.0 | SauloAislan/ironic,dims/ironic,NaohiroTamura/ironic,hpproliant/ironic,bacaldwell/ironic,naterh/ironic,redhat-openstack/ironic,NaohiroTamura/ironic,ionutbalutoiu/ironic,SauloAislan/ironic,dims/ironic,openstack/ironic,Tan0/ironic,openstack/ironic,pshchelo/ironic,debayanray/ironic_backup,ionutbalutoiu/ironic,devananda/iro... |
84a2ece10b0e246564fd539eed119f46d44ca74d | tests/no_hadoop_bare_image_provider.py | tests/no_hadoop_bare_image_provider.py | # -*- coding: utf-8 -*-
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
... | # -*- coding: utf-8 -*-
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
... | Use bare image name dependent on base image name | Use bare image name dependent on base image name
| Python | apache-2.0 | prestodb/presto-admin,prestodb/presto-admin |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.