commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
fcc2a190a50327a2349dfbb8e93d3157a6c1f1e8 | Fix strange wording in version check docstring. | zenefits/sentry,BuildingLink/sentry,ifduyue/sentry,beeftornado/sentry,beeftornado/sentry,jean/sentry,jean/sentry,ifduyue/sentry,JackDanger/sentry,nicholasserra/sentry,gencer/sentry,fotinakis/sentry,mvaled/sentry,mvaled/sentry,daevaorn/sentry,jean/sentry,ifduyue/sentry,JamesMura/sentry,alexm92/sentry,daevaorn/sentry,fot... | src/sentry/utils/versioning.py | src/sentry/utils/versioning.py | from __future__ import absolute_import
import warnings
from collections import namedtuple
from sentry.exceptions import InvalidConfiguration
class Version(namedtuple('Version', 'major minor patch')):
def __str__(self):
return '.'.join(map(str, self))
def make_upgrade_message(service, modality, version... | from __future__ import absolute_import
import warnings
from collections import namedtuple
from sentry.exceptions import InvalidConfiguration
class Version(namedtuple('Version', 'major minor patch')):
def __str__(self):
return '.'.join(map(str, self))
def make_upgrade_message(service, modality, version... | bsd-3-clause | Python |
32c8289b1ca92cb346628838aefd5f08a182146d | Bump version. | lucidbard/mendeley-python-sdk,Mendeley/mendeley-python-sdk | mendeley/version.py | mendeley/version.py | __version__ = '0.1.1'
| __version__ = '0.1.0'
| apache-2.0 | Python |
85a459721aed653231a7cf7b62395d28716f2291 | drop stray print statement | newsapps/tarbell-0.8,newsapps/tarbell-0.8 | readme/config.py | readme/config.py | import imp
import os
import StringIO
"""
Google doc configuration. If not provided, no Google doc will be used.
See secrets.py to configure access.
"""
GOOGLE_DOC = {
'key': '0Ak3IIavLYTovdGRrdjBwbS1Gd3R4TEZoQXQtQk1fMnc',
}
"""
Set default context. These variables will be globally available to the template.
"""... | import imp
import os
import StringIO
"""
Google doc configuration. If not provided, no Google doc will be used.
See secrets.py to configure access.
"""
GOOGLE_DOC = {
'key': '0Ak3IIavLYTovdGRrdjBwbS1Gd3R4TEZoQXQtQk1fMnc',
}
"""
Set default context. These variables will be globally available to the template.
"""... | mit | Python |
6472ee8c76c3b82b0bd6f79eb6ce89eceafa029e | add new version (#25091) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-sphinxcontrib-serializinghtml/package.py | var/spack/repos/builtin/packages/py-sphinxcontrib-serializinghtml/package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PySphinxcontribSerializinghtml(PythonPackage):
"""sphinxcontrib-serializinghtml is a sphin... | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PySphinxcontribSerializinghtml(PythonPackage):
"""sphinxcontrib-serializinghtml is a sphin... | lgpl-2.1 | Python |
93778811dbb0d675fab46b33e79541c0fdf312bc | remove logic bugs in users.py, add user list | mmcco/bitcoindata,mmcco/bitcoindata | users.py | users.py | def parseInput(inputLine):
data = inputLine.split(",")
# allow data to be of length 5 or 7 because this function is used to parse both inputs.csv and newInputs.csv
if len(data) != 5 and len(data) != 7:
raise Exception("bad line in inputs - cannot parse -==- " + inputLine + " -==- length of parsed... | def parseInput(inputLine):
data = inputLine.split(",")
# allow data to be of length 5 or 7 because this function is used to parse both inputs.csv and newInputs.csv
if len(data) != 5 and len(data) != 7:
raise Exception("bad line in inputs - cannot parse -==- " + inputLine + " -==- length of parsed... | isc | Python |
2285b96b58ce80c89ab2659b64310bdd12ace2ed | add stop method | eplaut/python-butler | butler/butler.py | butler/butler.py | import inspect
from flask import Flask, request
from logbook import debug, info
class Butler(object):
def __init__(self):
self._app = Flask(__name__)
self.data = {}
self._register_urls()
@staticmethod
def _get_urls(function_name, function_object):
urls = []
args, _,... | import inspect
from flask import Flask
class Butler(object):
def __init__(self):
self._app = Flask(__name__)
self.data = {}
self._register_urls()
@staticmethod
def _get_urls(function_name, function_object):
urls = []
args, _, _, defaults = inspect.getargspec(functio... | apache-2.0 | Python |
bbc8eb62178dceb4bb90017b3341f8e70efe41e9 | Remove verbosity | ashwoods/cachefunk | cachefunk/cli.py | cachefunk/cli.py | import click
import click_log
from .funk import Funk
@click.group()
@click_log.init(__name__)
@click.option('--url', help="Sitemap.xml URL")
@click.option('--concurrent', '-c', default=False, help="Enable concurrency")
@click.option('--timeout', default=30, help="Request timeout")
@click.option('--verify-ssl', defau... | import click
import click_log
from .funk import Funk
@click.group()
@click_log.simple_verbosity_option()
@click_log.init(__name__)
@click.option('--url', help="Sitemap.xml URL")
@click.option('--concurrent', '-c', default=False, help="Enable concurrency")
@click.option('--timeout', default=30, help="Request timeout"... | mit | Python |
a00540f53c50322d94a990bd439e5eaaec01b09b | fix typo | schae234/Camoco,schae234/Camoco | camoco/Config.py | camoco/Config.py | #!/usr/env/python3
import os
import yaml
import pprint
import getpass
global cf
default_config = '''--- # YAML Camoco Configuration File
options:
basedir: ~/.camoco/
testdir: ~/build/LinkageIO/Camoco/tests/
alpha: 0.0001
debug: False
logging:
log_level: verbose
test:
force:
RefG... | #!/usr/env/python3
import os
import yaml
import pprint
import getpass
global cf
default_config = '''--- # YAML Camoco Configuration File
options:
basedir: ~/.camoco/
testdir: ~/build/LinkageIO/Camoco/tests/
alpha: 0.0001
debug: False
logging:
log_level: verbose
test:
force:
RefG... | mit | Python |
d199a1823183af20b2fe60b1ee57999223d6f362 | throw error when trying to run in old pythons | dc-uba/metrika | metrika/__main__.py | metrika/__main__.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
if sys.version_info < (3, 4):
raise Exception("must use python 3.4 or greater")
from metrika.engine import Engine
import glob
__author__ = 'Javier Pimás'
if __name__ == '__main__':
engine = Engine()
modules = []
for module_name in glob.glob... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from metrika.engine import Engine
import glob
__author__ = 'Javier Pimás'
if __name__ == '__main__':
engine = Engine()
modules = []
for module_name in glob.glob("measure_*.py"):
modules.append(__import__(module_name[:-3]))
for module in modul... | mit | Python |
fa438e0cd654e346c9baf3d3d6d18b8f0ab9614c | add reason paramenter to timeout stop | cigroup-ol/metaopt,cigroup-ol/metaopt,cigroup-ol/metaopt | metaopt/plugins/timeout.py | metaopt/plugins/timeout.py | # -*- coding: utf-8 -*-
# Future
from __future__ import absolute_import, division, print_function, \
unicode_literals, with_statement
# Standard Library
from threading import Timer
# First Party
from metaopt.plugins.plugin import Plugin
class TimeoutPlugin(Plugin):
"""
Abort an invocation after a certai... | # -*- coding: utf-8 -*-
# Future
from __future__ import absolute_import, division, print_function, \
unicode_literals, with_statement
# Standard Library
from threading import Timer
# First Party
from metaopt.plugins.plugin import Plugin
class TimeoutPlugin(Plugin):
"""
Abort an invocation after a certai... | bsd-3-clause | Python |
f65b3f57283a9358483bbea2ae31a5e8dbf72003 | Set module as instalable. | open-synergy/hr,Vauxoo/hr,feketemihai/hr,Endika/hr,thinkopensolutions/hr,iDTLabssl/hr,hbrunn/hr,yelizariev/hr,xpansa/hr,open-synergy/hr,vrenaville/hr,Eficent/hr,raycarnes/hr,charbeljc/hr,charbeljc/hr,VitalPet/hr,acsone/hr,Vauxoo/hr,Eficent/hr,damdam-s/hr,VitalPet/hr,Endika/hr,Antiun/hr,microcom/hr,hbrunn/hr,raycarnes/h... | hr_contract_hourly_rate/__openerp__.py | hr_contract_hourly_rate/__openerp__.py | # -*- coding:utf-8 -*-
##############################################################################
#
# Copyright (C) 2014 Savoir-faire Linux. All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as publish... | # -*- coding:utf-8 -*-
##############################################################################
#
# Copyright (C) 2014 Savoir-faire Linux. All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as publish... | agpl-3.0 | Python |
9453c3d424d7bac0a524fb18bdf0f37953c30c18 | use raw_children in gradnet node | jagill/treeano,jagill/treeano,diogo149/treeano,diogo149/treeano,diogo149/treeano,jagill/treeano | treeano/sandbox/nodes/gradnet.py | treeano/sandbox/nodes/gradnet.py | import theano
import theano.tensor as T
import treeano
import treeano.nodes as tn
from treeano.sandbox.nodes import batch_fold
fX = theano.config.floatX
@treeano.register_node("grad_net_interpolation")
class GradNetInterpolationNode(treeano.NodeImpl):
"""
interpolates outputs between 2 nodes
"""
... | import theano
import theano.tensor as T
import treeano
import treeano.nodes as tn
from treeano.sandbox.nodes import batch_fold
fX = theano.config.floatX
@treeano.register_node("grad_net_interpolation")
class GradNetInterpolationNode(treeano.NodeImpl):
"""
interpolates outputs between 2 nodes
"""
... | apache-2.0 | Python |
56d3fa9cfc19616aa8de9f38ff7cdbb91d1a2c66 | Use randrange instead of sample | vanhuyz/CycleGAN-TensorFlow,vanhuyz/CycleGAN-TensorFlow | utils.py | utils.py | import tensorflow as tf
import random
def convert2int(image):
""" Transfrom from float tensor ([-1.,1.]) to int image ([0,255])
"""
return tf.image.convert_image_dtype((image+1.0)/2.0, tf.uint8)
def convert2float(image):
""" Transfrom from int image ([0,255]) to float tensor ([-1.,1.])
"""
image = tf.imag... | import tensorflow as tf
import random
def convert2int(image):
""" Transfrom from float tensor ([-1.,1.]) to int image ([0,255])
"""
return tf.image.convert_image_dtype((image+1.0)/2.0, tf.uint8)
def convert2float(image):
""" Transfrom from int image ([0,255]) to float tensor ([-1.,1.])
"""
image = tf.imag... | mit | Python |
781503bc85bfd4d70b05f6463c7da207085b42a0 | Update for v1.12.1 | maxmind/minfraud-api-python,maxmind/minfraud-api-python | minfraud/version.py | minfraud/version.py | """Internal module for version (to prevent cyclic imports)"""
__version__ = "1.12.1"
| """Internal module for version (to prevent cyclic imports)"""
__version__ = "1.12.0"
| apache-2.0 | Python |
dd2d1e652dbed2469a86c9d0fb4ef0fc3bdf95a7 | Fix the pep8 warnings | dulaccc/cookiecutter-django-herokuapp,dulaccc/cookiecutter-django-herokuapp,dulaccc/cookiecutter-django-herokuapp,dulaccc/cookiecutter-django-herokuapp | {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/apps/site/trackers.py | {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/apps/site/trackers.py | import logging
import uuid
from django.conf import settings
import requests
from requests.exceptions import HTTPError
logger = logging.getLogger(__name__)
def generate_default_client_id():
"""Google advise to generate a UUID4 value"""
return uuid.uuid4()
def get_client_from_request(http_request):
"""... | import logging
import uuid
from django.conf import settings
import requests
from requests.exceptions import HTTPError
logger = logging.getLogger(__name__)
def generate_default_client_id():
"""Google advise to generate a UUID4 value"""
return uuid.uuid4()
def get_client_from_request(http_request):
"""... | mit | Python |
77fa5774a26674e353e98108b9074cd7589c375a | Allow updating tags. | OniOni/ril,OniOni/ril,OniOni/ril | lib/db/aiosqlite.py | lib/db/aiosqlite.py | from contextlib import contextmanager
import sqlite3
from .base import (
async_wrap,
BaseAsyncDB
)
class AsyncSQLite(BaseAsyncDB):
def __init__(self, name):
self.name = name
super().__init__()
@contextmanager
def open(self):
conn = sqlite3.connect(self.name)
yiel... | from contextlib import contextmanager
import sqlite3
from .base import (
async_wrap,
BaseAsyncDB
)
class AsyncSQLite(BaseAsyncDB):
def __init__(self, name):
self.name = name
super().__init__()
@contextmanager
def open(self):
conn = sqlite3.connect(self.name)
yiel... | apache-2.0 | Python |
3d4c8fbfb10410d4b79811cfdca64964f0ff8730 | Fix reset method | jakobkogler/pi_memorize_app | reciter.py | reciter.py | from pi_memorize.compute_pi import ComputePi
class Reciter:
def __init__(self):
self.computer = ComputePi()
self.current_calculated = 0
self.pi = ''
self.pos = 0
self.compute_pi(100)
def reset(self):
self.pos = 0
def check_next_digit(self, digit):
i... | from pi_memorize.compute_pi import ComputePi
class Reciter:
def __init__(self):
self.computer = ComputePi()
self.current_calculated = 0
self.pi = ''
self.pos = 0
self.compute_pi(100)
def reset():
self.pos = 0
def check_next_digit(self, digit):
if di... | mit | Python |
72351145d0fb31d9911e437f08dc2134d35de08f | check for missing gust info for gust plot, refs #54 | akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem | scripts/current/today_gust.py | scripts/current/today_gust.py | """
Generate analysis of Peak Wind Gust
"""
import sys
import numpy
import mx.DateTime
now = mx.DateTime.now()
import psycopg2
IEM = psycopg2.connect(database='iem', host='iemdb', user='nobody')
icursor = IEM.cursor()
from pyiem.plot import MapPlot
from pyiem.datatypes import speed
# Compute normal from the climat... | """
Generate analysis of Peak Wind Gust
"""
import sys
import numpy
import mx.DateTime
now = mx.DateTime.now()
import psycopg2
IEM = psycopg2.connect(database='iem', host='iemdb', user='nobody')
icursor = IEM.cursor()
from pyiem.plot import MapPlot
from pyiem.datatypes import speed
# Compute normal from the climat... | mit | Python |
3e9fe3ac1f261d66ee9842fa507752754ae3d5aa | Handle pull_request and create object | TooAngel/democratic-collaboration,TooAngel/democratic-collaboration,TooAngel/democratic-collaboration | src/server.py | src/server.py | import os
from flask import Flask, request
from flask.ext import restful # @UnresolvedImport
app = Flask(
__name__,
template_folder='../templates',
static_folder='../static'
)
api = restful.Api(app)
class PullRequest(Object):
def __init__(self, data):
self.data = data
def execute(self)... | import os
from flask import Flask, request
from flask.ext import restful # @UnresolvedImport
app = Flask(
__name__,
template_folder='../templates',
static_folder='../static'
)
api = restful.Api(app)
class Github(restful.Resource):
def handle_push(self, data):
print(data)
def post(self):... | agpl-3.0 | Python |
3d269a9a065828a75e53018c4a786daf06e70ab0 | Allow users to modify their own accounts in database (tastypie authorization). Still WIP. | WillianPaiva/1flow,1flow/1flow,1flow/1flow,WillianPaiva/1flow,WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow,WillianPaiva/1flow,1flow/1flow,1flow/1flow | oneflow/base/api.py | oneflow/base/api.py | # -*- coding: utf-8 -*-
import logging
from tastypie.authorization import Authorization # , DjangoAuthorization
from tastypie.exceptions import Unauthorized
from tastypie.authentication import (MultiAuthentication,
SessionAuthentication,
ApiKe... | # -*- coding: utf-8 -*-
import logging
from tastypie.authorization import Authorization # , DjangoAuthorization
from tastypie.exceptions import Unauthorized
from tastypie.authentication import (MultiAuthentication,
SessionAuthentication,
ApiKe... | agpl-3.0 | Python |
4325d3c27f6b380ff2b5876dad251323fa2af157 | Upgrade to v1.10.1 | biolink/ontobio,biolink/ontobio | ontobio/__init__.py | ontobio/__init__.py | from __future__ import absolute_import
__version__ = '1.10.1'
from .ontol_factory import OntologyFactory
from .ontol import Ontology, Synonym, TextDefinition
from .assoc_factory import AssociationSetFactory
from .io.ontol_renderers import GraphRenderer
| from __future__ import absolute_import
__version__ = '1.10.0'
from .ontol_factory import OntologyFactory
from .ontol import Ontology, Synonym, TextDefinition
from .assoc_factory import AssociationSetFactory
from .io.ontol_renderers import GraphRenderer
| bsd-3-clause | Python |
5e087e9d5b10fd7dbe2b47bd1f26cf287b75acb1 | Add status image in response (#206) | swapagarwal/JARVIS-on-Messenger,ZuZuD/JARVIS-on-Messenger,edadesd/JARVIS-on-Messenger,jaskaransarkaria/JARVIS-on-Messenger | modules/src/ping.py | modules/src/ping.py | import requests
from templates.generic import *
from templates.text import TextTemplate
from urlparse import urlparse
def process(input, entities):
output = {}
try:
url = entities['url'][0]['value']
if not urlparse(url).scheme:
url = "https://" + url
hostname = urlparse(url... | import requests
from templates.text import TextTemplate
from urlparse import urlparse
def process(input, entities):
output = {}
try:
url = entities['url'][0]['value']
if not urlparse(url).scheme:
url = "https://" + url
hostname = urlparse(url).hostname
if hostname i... | mit | Python |
7c0aa44424c761b24bb66f49968ba561130ff916 | Replace incorrect sha1sum | GunshipPenguin/billionaire_challenge,GunshipPenguin/billionaire_challenge | challenges/c4.py | challenges/c4.py | from challenge import Challenge
import flask
class c4(Challenge):
'''
Challenge 4
Cookies
'''
def __init__(self):
super()
self._id = '94fe6a3196c44b2cd7c2ea7776add10deb1fd968'
self._hints = {}
def get_response(self, app):
resp = app.send_static_file('c4/cookie.... | from challenge import Challenge
import flask
class c4(Challenge):
'''
Challenge 4
Cookies
'''
def __init__(self):
super()
self._id = '983d09117bf1d67d10356cea9e361bf3fc216d92'
self._hints = {}
def get_response(self, app):
resp = app.send_static_file('c4/cookie.... | mit | Python |
87a07437c2481f92286f01f988405b4f3cfc5d37 | Make school field foreign key of Departments table | LinuxTeam-teilar/cronos.teilar.gr,LinuxTeam-teilar/cronos.teilar.gr,LinuxTeam-teilar/cronos.teilar.gr | apps/accounts/models.py | apps/accounts/models.py | from apps.teilar.models import Departments
from django.contrib.auth.models import User
from django.db import models
class UserProfile(models.Model):
user = models.ForeignKey(User, unique = True)
dionysos_username = models.CharField(max_length = 15, unique = True)
dionysos_password = models.CharField(max_le... | from django.contrib.auth.models import User
from django.db import models
class UserProfile(models.Model):
user = models.ForeignKey(User, unique = True)
dionysos_username = models.CharField(max_length = 15, unique = True)
dionysos_password = models.CharField(max_length = 30)
eclass_username = models.Cha... | agpl-3.0 | Python |
31e3e10c919ecfcd54822b92306eab0f53ed86f4 | Fix deprecation message for `env_vars` renames, and extend by a version. (#17187) | pantsbuild/pants,pantsbuild/pants,pantsbuild/pants,pantsbuild/pants,pantsbuild/pants,pantsbuild/pants,pantsbuild/pants | src/python/pants/engine/environment.py | src/python/pants/engine/environment.py | # Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
from dataclasses import dataclass
from pants.base.deprecated import warn_or_error
from pants.engine.engine_aware import EngineAwareParameter
from pants.... | # Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
from dataclasses import dataclass
from pants.base.deprecated import warn_or_error
from pants.engine.engine_aware import EngineAwareParameter
from pants.... | apache-2.0 | Python |
73ecace51eca19db50e9a59d91a31fbcc106e111 | add a table to store likes log | nostray/nostray_prototype,nostray/nostray_prototype,nostray/nostray_prototype | operation/models.py | operation/models.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from datetime import datetime
from django.db import models
from register.models import UserInfo
#from animal.models import Animals
from community.models import Posts
# Create your models here.
class UserFavorite(models.Model):
FAV_TYPE_CHOICES = [
(1... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from datetime import datetime
from django.db import models
from register.models import UserInfo
#from animal.models import Animals
#from community.models import Posts
# Create your models here.
class UserFavorite(models.Model):
FAV_TYPE_CHOICES = [
(... | apache-2.0 | Python |
73f944bf9dec3cf8a62c8beb050d94c12e3a2a1e | Make mutations readonly in admin | IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site | apps/mutations/admin.py | apps/mutations/admin.py | #
# Copyright (C) 2016 Dr. Maha Farhat
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is d... | #
# Copyright (C) 2016 Dr. Maha Farhat
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is d... | agpl-3.0 | Python |
51854a3bb6715f35a69082fa558db38a9bf9694f | update setup | zhenzhai/edx-platform,zhenzhai/edx-platform,zhenzhai/edx-platform,zhenzhai/edx-platform,zhenzhai/edx-platform | common/lib/sandbox-packages/setup.py | common/lib/sandbox-packages/setup.py | from setuptools import setup
setup(
name="sandbox-packages",
version="0.2.72",
packages=[
"loncapa",
"verifiers",
"hint",
"hint.hint_class_helpers",
"hint.hint_class_helpers.expr_parser",
"hint.hint_class",
"hint.hint_class.first_Universal",
"... | from setuptools import setup
setup(
name="sandbox-packages",
version="0.2.71",
packages=[
"loncapa",
"verifiers",
"hint",
"hint.hint_class_helpers",
"hint.hint_class_helpers.expr_parser",
"hint.hint_class",
"hint.hint_class.first_Universal",
"... | agpl-3.0 | Python |
13e6eb89c7d37b4bfb4d397a4c8c62bedbbc0dff | Set Pfizer trial status as unknown when they're unknown | opentrials/processors,arthurSena/processors | processors/pfizer/extractors.py | processors/pfizer/extractors.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from .. import base
# Module API
def extract_source(record):
source = {
'id': 'pfizer',
'name': 'Pfizer',
'type': '... | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from .. import base
# Module API
def extract_source(record):
source = {
'id': 'pfizer',
'name': 'Pfizer',
'type': '... | mit | Python |
5520a96c6d4891f67ef0cb4fb8ba680bcf4e8eac | Fix upload.py once again | TeamHypersomnia/Hypersomnia,TeamHypersomnia/Hypersomnia,TeamHypersomnia/Hypersomnia,TeamHypersomnia/Hypersomnia,TeamHypersomnia/Hypersomnia,TeamHypersomnia/Augmentations,TeamHypersomnia/Augmentations | cmake/upload.py | cmake/upload.py | from wetransfer import TransferApi
import sys
x = TransferApi(sys.argv[2])
print( x.upload_file("test upload", sys.argv[1]) )
| from wetransfer import TransferApi
import sys
x = TransferApi(sys.argv[2])
print( x.upload_file(sys.argv[1], "test upload") )
| agpl-3.0 | Python |
71d2e1344e742e7c91127a7301d418eeb5c27fa4 | switch to psycopg2 native list support | spuriousdata/django-pgfields | pgfields/arrays.py | pgfields/arrays.py | import re
from psycopg2.extensions import adapt
from django.db import models
class ArrayField(models.Field):
description = "PostgreSQL array type"
field_type = ""
subtype = type(None)
__metaclass__ = models.SubfieldBase
def __init__(self, *args, **kwargs):
super(ArrayField, self).__init__... | import re
from psycopg2.extensions import adapt
from django.db import models
class ArrayField(models.Field):
description = "PostgreSQL array type"
field_type = ""
subtype = type(None)
__metaclass__ = models.SubfieldBase
def __init__(self, *args, **kwargs):
super(ArrayField, self).__init__... | mit | Python |
c7066fbe4b72647c6b7f68c36790bad14051126c | Change token handling | devicehive/devicehive-python | devicehive/api_handler.py | devicehive/api_handler.py | from devicehive.handlers.base_handler import BaseHandler
from devicehive.api import Api
class ApiHandler(BaseHandler):
"""Api handler class."""
def __init__(self, transport, handler_class=None, handler_options=None,
refresh_token=None, access_token=None):
assert handler_class is not ... | from devicehive.handlers.base_handler import BaseHandler
from devicehive.api import Api
class ApiHandler(BaseHandler):
"""Api handler class."""
def __init__(self, transport, handler_class=None, handler_options=None,
refresh_token=None, access_token=None):
assert handler_class is not ... | apache-2.0 | Python |
38bdff4d1d3bbf2416c6fe75036bf23d270f15a2 | Make plinth directory a package, add version | vignanl/Plinth,harry-7/Plinth,vignanl/Plinth,freedomboxtwh/Plinth,freedomboxtwh/Plinth,harry-7/Plinth,kkampardi/Plinth,jvalleroy/plinth-debian,jvalleroy/plinth-debian,jvalleroy/plinth-debian,vignanl/Plinth,kkampardi/Plinth,kkampardi/Plinth,kkampardi/Plinth,freedomboxtwh/Plinth,freedomboxtwh/Plinth,harry-7/Plinth,vignan... | plinth/__init__.py | plinth/__init__.py | #
# This file is part of Plinth.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distribute... | agpl-3.0 | Python | |
669a86174f6c78f4813aa7a07ce2782752c82ada | Update docs for telnet module (#35257) | thaim/ansible,thaim/ansible | lib/ansible/modules/commands/telnet.py | lib/ansible/modules/commands/telnet.py | # this is a virtual module that is entirely implemented server side
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1... | # this is a virtual module that is entirely implemented server side
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1... | mit | Python |
c86e50e72c19accb1be9c5b8d7912d4b8bee1a03 | make coinflip available for everyone | anlutro/botologist,x89/botologist,moopie/botologist,x89/botologist | plugins/default.py | plugins/default.py | import random
import re
import botologist.plugin
class DefaultPlugin(botologist.plugin.Plugin):
def __init__(self, bot, channel):
super().__init__(bot, channel)
self.insults = (
(re.compile(r'.*fuck(\s+you)\s*,?\s*'+self.bot.nick+'.*', re.IGNORECASE),
'fuck you too {nick}'),
(re.compile(r'.*'+self.bot... | import random
import re
import botologist.plugin
class DefaultPlugin(botologist.plugin.Plugin):
def __init__(self, bot, channel):
super().__init__(bot, channel)
self.insults = (
(re.compile(r'.*fuck(\s+you)\s*,?\s*'+self.bot.nick+'.*', re.IGNORECASE),
'fuck you too {nick}'),
(re.compile(r'.*'+self.bot... | mit | Python |
1d6dcf1a91b70237bd7841488b23f4a6e9c800e0 | Order class alphabetically | benjello/openfisca-france-indirect-taxation,antoinearnoud/openfisca-france-indirect-taxation,thomasdouenne/openfisca-france-indirect-taxation,openfisca/openfisca-france-indirect-taxation | openfisca_france_indirect_taxation/model/caracteristiques_menages/demographie.py | openfisca_france_indirect_taxation/model/caracteristiques_menages/demographie.py | # -*- coding: utf-8 -*-
# OpenFisca -- A versatile microsimulation software
# By: OpenFisca Team <contact@openfisca.fr>
#
# Copyright (C) 2011, 2012, 2013, 2014, 2015 OpenFisca Team
# https://github.com/openfisca
#
# This file is part of OpenFisca.
#
# OpenFisca is free software; you can redistribute it and/or modify... | # -*- coding: utf-8 -*-
# OpenFisca -- A versatile microsimulation software
# By: OpenFisca Team <contact@openfisca.fr>
#
# Copyright (C) 2011, 2012, 2013, 2014, 2015 OpenFisca Team
# https://github.com/openfisca
#
# This file is part of OpenFisca.
#
# OpenFisca is free software; you can redistribute it and/or modify... | agpl-3.0 | Python |
5dab5edfcadc812d9cd0ddeef2a1f3b7814faaf8 | Fix converter | QualiSystems/Azure-Shell,QualiSystems/Azure-Shell | drivers/deployment_drivers/azure_vm/converters/resource_context_converter.py | drivers/deployment_drivers/azure_vm/converters/resource_context_converter.py | from cloudshell.cp.azure.models.deploy_azure_vm_resource_model import DeployAzureVMResourceModel
class ResourceContextConverter(object):
def __init__(self):
pass
def resource_context_to_deployment_resource_model(self, resource, deployment_credentials):
"""
Converts a context to a depl... | from cloudshell.cp.azure.models.deploy_azure_vm_resource_model import DeployAzureVMResourceModel
class ResourceContextConverter(object):
def __init__(self):
pass
def resource_context_to_deployment_resource_model(self, resource, deployment_credentials):
"""
Converts a context to a depl... | apache-2.0 | Python |
bfe25f9bc1e6fe196bb703badb65693e67334b42 | Update insight params | rgardner/ouimeaux,aktur/ouimeaux,aktur/ouimeaux,fritz-fritz/ouimeaux,iancmcc/ouimeaux,bennytheshap/ouimeaux,sstangle73/ouimeaux,tomjmul/wemo,rgardner/ouimeaux,fujita-shintaro/ouimeaux,aktur/ouimeaux,tomjmul/wemo,bennytheshap/ouimeaux,m-kiuchi/ouimeaux,sstangle73/ouimeaux,drock371/ouimeaux,fritz-fritz/ouimeaux,m-kiuchi/... | ouimeaux/device/insight.py | ouimeaux/device/insight.py | from datetime import datetime
from .switch import Switch
class Insight(Switch):
def __repr__(self):
return '<WeMo Insight "{name}">'.format(name=self.name)
@property
def insight_params(self):
params = self.insight.GetInsightParams().get('InsightParams')
(
state, # 0 i... | from .switch import Switch
class Insight(Switch):
def __repr__(self):
return '<WeMo Insight "{name}">'.format(name=self.name)
@property
def insight_params(self):
params = self.insight.GetInsightParams().get('InsightParams')
['1',
'1401624771',
'493',
'513',
'161285',
'1209600',
'20... | bsd-3-clause | Python |
7b9b38acc0ee3b0c2c142bb45705bd019dda7eb0 | Remove print out line | coyotevz/nobix-app | nbs/api/supplier.py | nbs/api/supplier.py | # -*- coding: utf-8 -*-
from flask import Blueprint, jsonify
from nbs.models import Supplier
from nbs.schema import SupplierSchema
supplier_api = Blueprint('api.supplier', __name__, url_prefix='/api/suppliers')
supplier_schema = SupplierSchema()
suppliers_schema = SupplierSchema(many=True)
@supplier_api.route('', me... | # -*- coding: utf-8 -*-
from flask import Blueprint, jsonify
from nbs.models import Supplier
from nbs.schema import SupplierSchema
supplier_api = Blueprint('api.supplier', __name__, url_prefix='/api/suppliers')
supplier_schema = SupplierSchema()
suppliers_schema = SupplierSchema(many=True)
@supplier_api.route('', me... | mit | Python |
6e1d8f467886c5d1301d93c9fbc9e148f3972748 | Fix for interactive mode | jamesxia4/neleval,andychisholm/neleval,andychisholm/neleval,wikilinks/neleval,jamesxia4/neleval,wikilinks/neleval | neleval/interact.py | neleval/interact.py | def run_ipython(local):
try:
from IPython.frontend.terminal.embed import TerminalInteractiveShell
shell = TerminalInteractiveShell(user_ns=local)
shell.mainloop()
except ImportError:
# IPython < 0.11
# Explicitly pass an empty list as arguments, because otherwise
... | def run_ipython(self, local):
try:
from IPython.frontend.terminal.embed import TerminalInteractiveShell
shell = TerminalInteractiveShell(user_ns=local)
shell.mainloop()
except ImportError:
# IPython < 0.11
# Explicitly pass an empty list as arguments, because otherwise
... | apache-2.0 | Python |
ccf5dbf001e12e27e8e0d1f1b41a3c768884611b | Customize category admin #8 | GoWebyCMS/goweby-core-dev,GoWebyCMS/goweby-core-dev,GoWebyCMS/goweby-core-dev | portfolio/admin.py | portfolio/admin.py | from django.contrib import admin
from .models import Project, Category
# Register your models here.
class ProjectAdmin(admin.ModelAdmin):
model = Project
list_display = ('name', 'short_description', 'category', 'status', )
prepopulated_fields = {'slug': ('name',)}
class CategoryAdmin(admin.ModelAdmin):
... | from django.contrib import admin
from .models import Project
# Register your models here.
class ProjectAdmin(admin.ModelAdmin):
model = Project
list_display = ('name', 'short_description', 'category', 'status', )
prepopulated_fields = {'slug': ('name',)}
admin.site.register(Project, ProjectAdmin)
| mit | Python |
3248e5e0b800e2e68bd28595233423523783715b | use simple elmenent factory for video | ZeitOnline/zeit.content.article,ZeitOnline/zeit.content.article,ZeitOnline/zeit.content.article | src/zeit/content/article/edit/video.py | src/zeit/content/article/edit/video.py | # Copyright (c) 2010 gocept gmbh & co. kg
# See also LICENSE.txt
from zeit.cms.i18n import MessageFactory as _
import gocept.lxml.interfaces
import grokcore.component
import lxml.objectify
import zeit.brightcove.asset
import zeit.cms.content.interfaces
import zeit.cms.interfaces
import zeit.content.article.edit.block
... | # Copyright (c) 2010 gocept gmbh & co. kg
# See also LICENSE.txt
from zeit.cms.i18n import MessageFactory as _
import gocept.lxml.interfaces
import grokcore.component
import lxml.objectify
import zeit.brightcove.asset
import zeit.cms.content.interfaces
import zeit.cms.interfaces
import zeit.content.article.edit.block
... | bsd-3-clause | Python |
093385eb83906d29220eee982e1da1ea6487d021 | fix a leftover pytz thing | moopie/botologist,anlutro/botologist | plugins/tvseries.py | plugins/tvseries.py | import logging
import requests
from botologist.util import parse_dt, time_until
import botologist.plugin
log = logging.getLogger(__name__)
def get_next_episode_info(show, tz='UTC'):
query = {'q': show, 'embed': 'nextepisode'}
try:
response = requests.get('http://api.tvmaze.com/singlesearch/shows', query)
respo... | import logging
import requests
from botologist.util import parse_dt, time_until
import botologist.plugin
log = logging.getLogger(__name__)
def get_next_episode_info(show, tz=pytz.timezone('UTC')):
query = {'q': show, 'embed': 'nextepisode'}
try:
response = requests.get('http://api.tvmaze.com/singlesearch/shows',... | mit | Python |
f3181cad6f8c60cef5ee2cc469d5b430880a27a7 | fix sending the right command | ryansb/netHUD | nethud/nh_client.py | nethud/nh_client.py | """
An example client. Run simpleserv.py first before running this.
"""
import json
from twisted.internet import reactor, protocol
# a client protocol
class NethackClient(protocol.Protocol):
"""Once connected, send a message, then print the result."""
def connectionMade(self):
self.send_message('a... | """
An example client. Run simpleserv.py first before running this.
"""
import json
from twisted.internet import reactor, protocol
# a client protocol
class NethackClient(protocol.Protocol):
"""Once connected, send a message, then print the result."""
def connectionMade(self):
self.send_message('a... | mit | Python |
c5e3030c49b3a9efc6b1b621f4c8538997246be1 | bump version to 0.8.1 | EvanDarwin/poster3 | poster/__init__.py | poster/__init__.py | # Copyright (c) 2010 Chris AtLee
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distri... | # Copyright (c) 2010 Chris AtLee
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distri... | mit | Python |
0a02dcc4e71cf4015ff6bc0ed2b6a61033c7d945 | Add development_status and maintainers key in template | OCA/maintainer-tools,acsone/maintainer-tools,acsone/maintainer-tools,acsone/maintainer-tools,acsone/maintainers-tools,Yajo/maintainer-tools,OCA/maintainer-tools,OCA/maintainer-tools,Yajo/maintainer-tools,acsone/maintainer-tools,Yajo/maintainer-tools,OCA/maintainer-tools,acsone/maintainers-tools,acsone/maintainers-tools... | template/module/__openerp__.py | template/module/__openerp__.py | # -*- coding: utf-8 -*-
# Copyright <YEAR(S)> <AUTHOR(S)>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Module name",
"summary": "Module summary",
"version": "8.0.1.0.0",
"development_status": "Alpha|Beta|Production/Stable|Mature",
"category": "Uncategorized",
"webs... | # -*- coding: utf-8 -*-
# Copyright <YEAR(S)> <AUTHOR(S)>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Module name",
"summary": "Module summary",
"version": "8.0.1.0.0",
"category": "Uncategorized",
"website": "https://github.com/OCA/<repo>" or "https://github.com/OCA/... | agpl-3.0 | Python |
83e4aa9e482635c72e7787b40311542b2f189fb3 | Update import script for Peterborough (closes #998) | DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_peterborough.py | polling_stations/apps/data_collection/management/commands/import_peterborough.py | from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = 'E06000031'
addresses_name = 'parl.2017-06-08/Version 1/Democracy_Club__08June2017 (1).tsvv'
stations_name = 'parl.2017-06-08/Version 1/Democracy_Club__08June20... | from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = 'E06000031'
addresses_name = 'Democracy_Club__04May2017_peterborough.tsv'
stations_name = 'Democracy_Club__04May2017_peterborough.tsv'
elections = [
... | bsd-3-clause | Python |
c3321617a2b6db54781590a7e364153d8c35cf96 | include DJANGO_SETTINGS_MODULE | materialsproject/MPContribs,materialsproject/MPContribs,materialsproject/MPContribs,materialsproject/MPContribs | configure_settings.py | configure_settings.py | import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'test_site.settings')
from django.conf import settings
if not settings.configured:
from test_site import settings as test_site_settings
settings.configure(test_site_settings)
| from django.conf import settings
if not settings.configured:
from test_site import settings as test_site_settings
settings.configure(test_site_settings)
| mit | Python |
2a0ff6cf6af1615986ae361b764f421fa50a135d | fix bug introduce in migration :-( | geometalab/osmaxx-frontend,geometalab/osmaxx,geometalab/osmaxx-frontend,geometalab/osmaxx-frontend,geometalab/osmaxx,geometalab/osmaxx-frontend,geometalab/osmaxx,geometalab/drf-utm-zone-info,geometalab/drf-utm-zone-info,geometalab/osmaxx | osmaxx/excerptexport/migrations/0025_move_bounding_geometry_20160503_1639.py | osmaxx/excerptexport/migrations/0025_move_bounding_geometry_20160503_1639.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-05-03 14:39
from __future__ import unicode_literals
from django.contrib.gis.geos import Polygon, MultiPolygon
from django.db import migrations
def multi_polygon_from(bounding_geometry_old):
bb = bounding_geometry_old
west, south, east, north = bb.so... | # -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-05-03 14:39
from __future__ import unicode_literals
from django.contrib.gis.geos import Polygon, MultiPolygon
from django.db import migrations
def multi_polygon_from(bounding_geometry_old):
bb = bounding_geometry_old
west, south, east, north = bb.so... | mit | Python |
e9a4d534a07ac2cda9aa8d2e69216b1390f62da8 | Create separate hospital app | EMSTrack/WebServerAndClient,EMSTrack/WebServerAndClient,EMSTrack/WebServerAndClient | login/serializers.py | login/serializers.py | from rest_framework import serializers
from django.contrib.auth.models import User
from .models import Profile, AmbulancePermission, HospitalPermission
from ambulances.models import Ambulance
from hospital.models import Hospital
# Profile serializers
class AmbulancePermissionSerializer(serializers.ModelSerializer... | from rest_framework import serializers
from django.contrib.auth.models import User
from .models import Profile, AmbulancePermission, HospitalPermission
from ambulances.models import Ambulance, Hospital
# Profile serializers
class AmbulancePermissionSerializer(serializers.ModelSerializer):
ambulance_id = seri... | bsd-3-clause | Python |
adaee1b36e42d2017f902369a27a9cac47cc5c7e | revise what the text displays | IanDCarroll/xox | Scenery/scriptographer_desk.py | Scenery/scriptographer_desk.py | from Training.observer_abilities import *
class Scriptographer(Observer):
def __init__(self):
self.start = """Welcome to XOX,
a Noughts and Crosses Game you can never win
no matter how hard you try."""
self.select = """Type 1 to go first and not win, or
Type 2 to go second and not win."""
... | from Training.observer_abilities import *
class Scriptographer(Observer):
def __init__(self):
self.start = """
Welcome to XOX,
a Noughts and Crosses Game you can never win
no matter how hard you try."""
self.select = """
Type 1 to go first and not win, or
Type 2 to go second and not win."""
... | mit | Python |
1374adbdc372b21cc04c8e488ef00e1f2b82134a | reformat code | 20tab/python-gmaps,swistakm/python-gmaps | src/gmaps/directions.py | src/gmaps/directions.py | # -*- coding: utf-8 -*-
from gmaps.client import Client
class Directions(Client):
DIRECTIONS_URL = 'directions/'
@staticmethod
def latlon_or_address(place):
if isinstance(place, basestring):
output = place
elif isinstance(place, dict):
try:
output =... | # -*- coding: utf-8 -*-
from gmaps.client import Client
class Directions(Client):
DIRECTIONS_URL = 'directions/'
@staticmethod
def latlon_or_address(place):
if isinstance(place, basestring):
output = place
elif isinstance(place, dict):
try:
output =... | bsd-2-clause | Python |
43c8436636796a0ec9bb7ca825b32eeb27934c5e | create app user, pep8 shit | histograph/aws,histograph/aws | machines/machines.py | machines/machines.py | __author__ = 'wires'
def repo(init, n):
# add file repository key
init.write_file(
'machines/%s/apt-repo.gpg.key' % n,
'/root/%s/apt-repo.gpg.key' % n)
def installer(init, n):
# add install script
init.write_file(
'machines/%s/install.sh' % n,
'/root/%s/install.sh' % ... | __author__ = 'wires'
def repo(init, n):
# add file repository key
init.write_file('machines/%s/apt-repo.gpg.key' % n, '/root/%s/apt-repo.gpg.key' % n)
def installer(init, n):
# add install script
init.write_file('machines/%s/install.sh' % n, '/root/%s/install.sh' % n, permissions='0755')
# run in... | mit | Python |
40bb8f55011f3426058313075cbb5f04cd9bfb97 | Fix formatting: use single quotes | Davidyuk/witcoin,Davidyuk/witcoin | main/translations.py | main/translations.py | from django.utils.translation import ungettext_lazy, ugettext_lazy, pgettext_lazy
"""
Removing this code causes makemessages to comment out those PO entries, so don't do that
unless you find a better way to do this
http://stackoverflow.com/questions/7625991/how-to-properly-add-entries-for-computed-values-to-the-django... | from django.utils.translation import ungettext_lazy, ugettext_lazy, pgettext_lazy
"""
Removing this code causes makemessages to comment out those PO entries, so don't do that
unless you find a better way to do this
http://stackoverflow.com/questions/7625991/how-to-properly-add-entries-for-computed-values-to-the-django... | agpl-3.0 | Python |
6ada17adf7a462ca60b64de3e6543b6d5552cbd4 | Revert "update prepare_deploy_cfg.py" | kbase/coexpression,kbase/coexpression,kbase/coexpression,kbase/coexpression,kbase/coexpression | scripts/prepare_deploy_cfg.py | scripts/prepare_deploy_cfg.py | import sys
from jinja2 import Template
from ConfigParser import ConfigParser
if __name__ == "__main__":
if len(sys.argv) != 3:
print("Usage: <program> <deploy_cfg_template_file> <file_with_properties>")
print("Properties from <file_with_properties> will be applied to <deploy_cfg_template_file>")
... | import sys
import os
import os.path
from jinja2 import Template
try:
from configparser import ConfigParser
from io import StringIO
except ImportError:
from ConfigParser import ConfigParser
from StringIO import StringIO
if __name__ == "__main__":
if len(sys.argv) != 3:
print("Usage: <program... | mit | Python |
85f10f1df50ee51255f8288014ed0eca89af6860 | bump version to 0.0.2 | magenta/note-seq,magenta/note-seq,magenta/note-seq | note_seq/version.py | note_seq/version.py | # Copyright 2020 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | # Copyright 2020 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | apache-2.0 | Python |
bd5979b831f430c80f460ecb836dcc8bd6a8996b | Fix filters. | bitlair/synlogistics,bitlair/synlogistics,bitlair/synlogistics,bitlair/synlogistics,bitlair/synlogistics | ajax/views.py | ajax/views.py | """
SynLogistics AJAX JSON server interaction for common search boxes and
generic interactive components.
"""
#
# Copyright (C) by Wilco Baan Hofman <wilco@baanhofman.nl> 2011
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as pub... | """
SynLogistics AJAX JSON server interaction for common search boxes and
generic interactive components.
"""
#
# Copyright (C) by Wilco Baan Hofman <wilco@baanhofman.nl> 2011
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as pub... | agpl-3.0 | Python |
30167ec52e6a494a771568d501733b26cb3c8f21 | Create all models on database connection | MartinMartimeo/avalon,MartinMartimeo/avalon | base/application.py | base/application.py | #!/usr/bin/python
# -*- encoding: utf-8 -*-
"""
"""
__author__ = 'Martin Martimeo <martin@martimeo.de>'
__date__ = '30.08.13 - 18:00'
import os
from alembic.util import memoized_property
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, scoped_session, object_session
from tornado.web i... | #!/usr/bin/python
# -*- encoding: utf-8 -*-
"""
"""
__author__ = 'Martin Martimeo <martin@martimeo.de>'
__date__ = '30.08.13 - 18:00'
import os
from alembic.util import memoized_property
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, scoped_session, object_session
from tornado.web i... | agpl-3.0 | Python |
10dd331d986476b5aed4792bf8632d177b226300 | Append to previous commit | geo-fluid-dynamics/phaseflow-fenics | phaseflow/output.py | phaseflow/output.py | def write_solution(output_format, solution_files, W, _w, current_time):
w = _w.leaf_node()
velocity, pressure, temperature = w.split()
velocity.rename("u", "velocity")
pressure.rename("p", "pressure")
temperature.rename("theta", "temperature")
if output_form... | def write_solution(output_format, solution_files, W, _w, current_time):
w = _w.leaf_node()
velocity, pressure, temperature = w.split()
velocity.rename("u", "velocity")
pressure.rename("p", "pressure")
temperature.rename("theta", "temperature")
if output_form... | mit | Python |
11ff484af1b9a620b16432562d84420849f7f482 | fix pylint issues | scylladb/scylla-cluster-tests,scylladb/scylla-cluster-tests,scylladb/scylla-cluster-tests,scylladb/scylla-longevity-tests,scylladb/scylla-longevity-tests,scylladb/scylla-longevity-tests,scylladb/scylla-cluster-tests,scylladb/scylla-cluster-tests | sdcm/sct_events/decorators.py | sdcm/sct_events/decorators.py | # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be usefu... | # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be usefu... | agpl-3.0 | Python |
d6d6fb17da2a21570d0b90afaf175b9c83a9f14a | print prompt to stderr and secret to stdout | Zemanta/py-secretcrypt | secretcrypt/encrypt_secret.py | secretcrypt/encrypt_secret.py | """
Encrypts secrets. Reads secrets as user input or from standard input.
Usage:
encrypt-secret [options] kms [--region=<region_name>] <key_id>
encrypt-secret [options] local
encrypt-secret [options] plain
Options:
--region=<region_name> AWS Region Name [default: us-east-1]
--multiline Mult... | """
Encrypts secrets. Reads secrets as user input or from standard input.
Usage:
encrypt-secret [options] kms [--region=<region_name>] <key_id>
encrypt-secret [options] local
encrypt-secret [options] plain
Options:
--region=<region_name> AWS Region Name [default: us-east-1]
--multiline Mult... | apache-2.0 | Python |
bed2b59d7019df0a9bd8b2968c01e0a84c5f9416 | test runner must accept both *args and **kwargs) | hobson/pug,hobson/pug,hobson/pug,hobson/pug | pug/test/runner.py | pug/test/runner.py | from django.test.simple import DjangoTestSuiteRunner
class NullTestRunner(DjangoTestSuiteRunner):
""" A test runner to test without database creation or automatic test*.py discovery"""
def run_tests(self, *args, **kwargs):
"""Override the running of tests entirely (including discovery, and DB mainten... | from django.test.simple import DjangoTestSuiteRunner
class NullTestRunner(DjangoTestSuiteRunner):
""" A test runner to test without database creation or automatic test*.py discovery"""
def run_tests(self, **kwargs):
"""Override the running of tests entirely (including discovery, and DB maintenance)""... | mit | Python |
420beb9e4cf84fb2239df4808d6aefbd02a692d8 | hide names now that I'm doing yuck import * | mitar/pychecker,mitar/pychecker | pychecker2/util.py | pychecker2/util.py |
class BaseVisitor:
def visit(self, unused_node):
"method is really overridden by compiler.visitor.ASTVisitor"
assert 0, 'Unreachable'
def visitChildren(self, n):
for c in n.getChildNodes():
self.visit(c)
def try_if_exclusive(stmt_node1, stmt_node2):
from compiler... | from compiler import ast
class BaseVisitor:
def visit(self, unused_node):
"method is really overridden by compiler.visitor.ASTVisitor"
assert 0, 'Unreachable'
def visitChildren(self, n):
for c in n.getChildNodes():
self.visit(c)
def try_if_exclusive(stmt_node1, stmt_... | bsd-3-clause | Python |
3451bce47b75d3763df942efbc79c3c11094470b | support multiple folder levels | wq/wq.db,wq/wq.db,wq/wq.db | contrib/files/util.py | contrib/files/util.py | from PIL import Image, ImageOps
import StringIO
import os
from wq.io.util import guess_type
import subprocess
from django.conf import settings
def generate_image(image, size):
size = int(size)
path = os.path.join(settings.MEDIA_ROOT, image)
name = os.path.basename(image)
mime = guess_type(path)
if... | from PIL import Image, ImageOps
import StringIO
import os
from wq.io.util import guess_type
import subprocess
from django.conf import settings
def generate_image(image, size):
size = int(size)
path = '%s/%s' % (settings.MEDIA_ROOT, image)
mime = guess_type(path)
image = os.path.basename(image)
if ... | mit | Python |
ac3f701e8772e74869a928866d0d81629afea727 | configure requires an app argument. | ohsu-qin/qiutil | test/helpers/logging_helper.py | test/helpers/logging_helper.py | """
This test logging_helper module configures test case logging to print
debug messages to stdout.
"""
from qiutil.logging_helper import (configure, logger)
configure(app='qiutil', level='DEBUG')
| """
This test logging_helper module configures test case logging to print
debug messages to stdout.
"""
from qiutil.logging_helper import (configure, logger)
configure(filename=None, level='DEBUG')
| bsd-2-clause | Python |
3323d042ad42ce48e647116d88df4674a8773a76 | add handling for lists of dicts etc | ajtowns/beanbag | beanbag/attrdict.py | beanbag/attrdict.py | #!/usr/bin/env python
from . import namespace
class AttrDict(namespace.SettableHierarchialBase):
"""Allow access to dictionary via attributes as well as
array-style references."""
def __init__(self, basedict=None):
"""Provide an AttrDict view of a dictionary.
:param basedict: diction... | #!/usr/bin/env python
from . import namespace
class AttrDict(namespace.SettableHierarchialBase):
"""Allow access to dictionary via attributes as well as
array-style references."""
def __init__(self, basedict=None):
"""Provide an AttrDict view of a dictionary.
:param basedict: diction... | mit | Python |
85db39e36c99e800e1008605213d1c25108b035d | Allow specifying jumpkind with creating a Path via PathGenerator.blank_path() | angr/angr,GuardianRG/angr,iamahuman/angr,cureHsu/angr,tyb0807/angr,mingderwang/angr,fjferrer/angr,angr/angr,zhuyue1314/angr,axt/angr,cureHsu/angr,chubbymaggie/angr,schieb/angr,lowks/angr,fjferrer/angr,zhuyue1314/angr,schieb/angr,chubbymaggie/angr,GuardianRG/angr,axt/angr,mingderwang/angr,avain/angr,schieb/angr,angr/ang... | angr/paths.py | angr/paths.py | import logging
l = logging.getLogger('angr.states')
class PathGenerator(object):
def __init__(self, project):
self._project = project
def blank_path(self, state=None, jumpkind='Ijk_Boring', *args, **kwargs):
'''
blank_point - Returns a start path, representing a clean start of symboli... | import logging
l = logging.getLogger('angr.states')
class PathGenerator(object):
def __init__(self, project):
self._project = project
def blank_path(self, state=None, *args, **kwargs):
'''
blank_point - Returns a start path, representing a clean start of symbolic execution.
''... | bsd-2-clause | Python |
36338da7ab0f054dfeb96b97edd42f27126786c7 | fix the name change from workbench_client to client_helper | SuperCowPowers/workbench,SuperCowPowers/workbench,djtotten/workbench,djtotten/workbench,djtotten/workbench,SuperCowPowers/workbench | workbench/clients/pcap_report.py | workbench/clients/pcap_report.py | """This client pulls PCAP 'views' (view summarize what's in a sample)."""
import zerorpc
import os
import pprint
import client_helper
import flask
STATIC_DIR = os.path.join(os.path.dirname(
os.path.abspath(__file__)), '../data/')
APP = flask.Flask(__name__, template_folder=STATIC_DIR,
static_fo... | """This client pulls PCAP 'views' (view summarize what's in a sample)."""
import zerorpc
import os
import pprint
import workbench_client
import flask
STATIC_DIR = os.path.join(os.path.dirname(
os.path.abspath(__file__)), '../data/')
APP = flask.Flask(__name__, template_folder=STATIC_DIR,
static... | mit | Python |
6648b8b31a027b0db515bd130fde20069eb21cb1 | adjust formats | tumluliu/mmspa,tumluliu/mmspa,tumluliu/mmspa,tumluliu/mmspa | demo/python/benchmark.py | demo/python/benchmark.py | #!/usr/bin/env python
import sys
import time
from termcolor import colored
from pymmspa4pg import *
source_list = []
target_list = []
def load_routing_options(
sources_file_path,
targets_file_path,
options_file_path):
with open(sources_file_path) as sources_file:
source_list = [so... | #!/usr/bin/env python
import sys
import time
from termcolor import colored
from pymmspa4pg import *
source_list = []
target_list = []
def load_routing_options(
sources_file_path,
targets_file_path,
options_file_path):
with open(sources_file_path) as sources_file:
source_list = [so... | mit | Python |
9c3175e1f2b2e87f3bb0effb405264dd212d1524 | Bump dev version. | bharadwajyarlagadda/pydash,dgilland/pydash,jacobbridges/pydash | pydash/__meta__.py | pydash/__meta__.py | """Define project metadata
"""
__all__ = [
'__title__',
'__summary__',
'__url__',
'__version__',
'__author__',
'__email__',
'__license__',
]
__title__ = 'pydash'
__summary__ = ('A utility library for doing "stuff" in a functional way. '
'Based on the Lo-Dash Javascript libra... | """Define project metadata
"""
__all__ = [
'__title__',
'__summary__',
'__url__',
'__version__',
'__author__',
'__email__',
'__license__',
]
__title__ = 'pydash'
__summary__ = ('A utility library for doing "stuff" in a functional way. '
'Based on the Lo-Dash Javascript libra... | mit | Python |
a72bced4ffe7e00b63de42a8532fa87f452ff9d3 | Improve docstring | RonnyPfannschmidt/setuptools_scm,pypa/setuptools_scm,pypa/setuptools_scm,RonnyPfannschmidt/setuptools_scm | setuptools_scm/file_finder.py | setuptools_scm/file_finder.py | import os
def scm_find_files(path, scm_files, scm_dirs):
""" setuptools compatible file finder that follows symlinks
- path: the root directory from which to search
- scm_files: set of scm controlled files and symlinks
(including symlinks to directories)
- scm_dirs: set of scm controlled direct... | import os
def scm_find_files(path, scm_files, scm_dirs):
""" setuptools compatible file finder that follows symlinks
- path: the root directory from which to search
- scm_files: set of scm controlled files and symlinks
(including symlinks to directories)
- scm_dirs: set of scm controlled direct... | mit | Python |
213f5f1aab3f0c5911ca0473693ca0f8d5bce0da | call 'get_nvprof_counters' in main | undertherain/benchmarker,undertherain/benchmarker,undertherain/benchmarker,undertherain/benchmarker | benchmarker/__main__.py | benchmarker/__main__.py | """CLI entry point module"""
import sys
import json
import argparse
import os
from .util import sysinfo
# from .benchmarker import run
from benchmarker.util import abstractprocess
from benchmarker.util.cute_device import get_cute_device_str
from .util.io import save_json
from benchmarker.perf import get_counters
from... | """CLI entry point module"""
import sys
import json
import argparse
import os
from .util import sysinfo
# from .benchmarker import run
from benchmarker.util import abstractprocess
from benchmarker.util.cute_device import get_cute_device_str
from .util.io import save_json
from benchmarker.perf import get_counters
de... | mpl-2.0 | Python |
011decc9531beed876bbbaa09d4af6a554faf90b | Correct sorting by id function | mapzen/TileStache,moskvax/TileStache,moskvax/TileStache,mapzen/TileStache,moskvax/TileStache,mapzen/TileStache | TileStache/Goodies/VecTiles/sort.py | TileStache/Goodies/VecTiles/sort.py | # sort functions to apply to features
def _sort_features_by_key(features, key):
features.sort(key=key)
return features
def _by_feature_id(feature):
wkb, properties, fid = feature
return properties.get('id')
def _by_area(feature):
wkb, properties, fid = feature
return properties.get('area')... | # sort functions to apply to features
def _sort_features_by_key(features, key):
features.sort(key=key)
return features
def _by_feature_id(feature):
wkb, properties, fid = feature
return fid
def _by_area(feature):
wkb, properties, fid = feature
return properties.get('area')
def _sort_by_a... | bsd-3-clause | Python |
a09a9cc0fafd85bd8fea2d7241554e5e17e03daf | add return value | spencerpomme/coconuts-on-fire,spencerpomme/coconuts-on-fire,spencerpomme/coconuts-on-fire,spencerpomme/coconuts-on-fire,spencerpomme/coconuts-on-fire,spencerpomme/coconuts-on-fire | baidu_API.py | baidu_API.py | """
A simple script that uses Baidu Place API to search certain kinds of place
in a range of circular space.
This API can be called maximum 2000 times per day.
"""
import requests, json
# import psycopg2
mykey = "IniXfqhsWAyZQpkmh5FtEVv0" # my developer key
city = "韶关"
place = "公园"
coor1 = (39.915, 116.404)
coor2 = ... | """
A simple script that uses Baidu Place API to search certain kinds of place
in a range of circular space.
This API can be called maximum 2000 times per day.
"""
import requests, json
# import psycopg2
mykey = "IniXfqhsWAyZQpkmh5FtEVv0" # my developer key
city = "韶关"
place = "公园"
coor1 = (39.915, 116.404)
coor2 = ... | apache-2.0 | Python |
48459de0d8e966f72e6617bbfbe9d6f6c9564abe | add missing dependencies in motortwt demo | aio-libs/aiohttp_admin,aio-libs/aiohttp_admin,jettify/aiohttp_admin,jettify/aiohttp_admin,aio-libs/aiohttp_admin,jettify/aiohttp_admin,jettify/aiohttp_admin | demos/motortwit/setup.py | demos/motortwit/setup.py | import os
import re
from setuptools import find_packages, setup
def read_version():
regexp = re.compile(r"^__version__\W*=\W*'([\d.abrc]+)'")
init_py = os.path.join(os.path.dirname(__file__),
'motortwit', '__init__.py')
with open(init_py) as f:
for line in f:
... | import os
import re
from setuptools import find_packages, setup
def read_version():
regexp = re.compile(r"^__version__\W*=\W*'([\d.abrc]+)'")
init_py = os.path.join(os.path.dirname(__file__),
'motortwit', '__init__.py')
with open(init_py) as f:
for line in f:
... | apache-2.0 | Python |
05f8dbb01393ea11314e4c1c208647c49136f9d9 | fix admin | Ecotrust/hnfp,Ecotrust/hnfp,Ecotrust/hnfp,Ecotrust/hnfp,Ecotrust/hnfp | hnfp/admin.py | hnfp/admin.py | from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from .models import Post, PublicManager, Question, Category, Survey, Response, AnswerText, AnswerRadio, AnswerSelect, AnswerInteger, AnswerSelectMultiple, AOI
# Blog posts for forum
@admin.regi... | from django.contrib import admin
#from django.contrib.auth.admin import UserAdmin
#from django.contrib.auth.models import User
from hnfp.models import *
# Blog posts for forum
@admin.register(Post)
class PostAdmin(admin.ModelAdmin):
list_display = ('title', 'publish', 'allow_comments')
list_filter = ('publish... | isc | Python |
f7a8fef0586e5bf065d40720d0f9f4a94826f570 | Return None in get_git_root on error | blue-yonder/pyscaffold,cpaulik/pyscaffold,cpaulik/pyscaffold,blue-yonder/pyscaffold | pyscaffold/repo.py | pyscaffold/repo.py | # -*- coding: utf-8 -*-
"""
Functionality for working with a git repository
"""
from __future__ import absolute_import, print_function
from os.path import join as join_path
from subprocess import CalledProcessError
from six import string_types
from . import utils
from .shell import git
__author__ = "Florian Wilhelm... | # -*- coding: utf-8 -*-
"""
Functionality for working with a git repository
"""
from __future__ import absolute_import, print_function
from os.path import join as join_path
from subprocess import CalledProcessError
from six import string_types
from . import utils
from .shell import git
__author__ = "Florian Wilhelm... | mit | Python |
611c814866cb64a7c6fc0ce8f8818dce9217cf91 | Fix DJANGAE_RUNSERVER_IGNORED_FILES_REGEXES default setting to include html too | grzes/djangae,kirberich/djangae,potatolondon/djangae,grzes/djangae,asendecka/djangae,asendecka/djangae,kirberich/djangae,potatolondon/djangae,grzes/djangae,kirberich/djangae,asendecka/djangae | djangae/settings_base.py | djangae/settings_base.py | DEFAULT_FILE_STORAGE = 'djangae.storage.BlobstoreStorage'
FILE_UPLOAD_MAX_MEMORY_SIZE = 1024 * 1024
FILE_UPLOAD_HANDLERS = (
'djangae.storage.BlobstoreFileUploadHandler',
'django.core.files.uploadhandler.MemoryFileUploadHandler',
)
DATABASES = {
'default': {
'ENGINE': 'djangae.db.backends.appengine... | DEFAULT_FILE_STORAGE = 'djangae.storage.BlobstoreStorage'
FILE_UPLOAD_MAX_MEMORY_SIZE = 1024 * 1024
FILE_UPLOAD_HANDLERS = (
'djangae.storage.BlobstoreFileUploadHandler',
'django.core.files.uploadhandler.MemoryFileUploadHandler',
)
DATABASES = {
'default': {
'ENGINE': 'djangae.db.backends.appengine... | bsd-3-clause | Python |
a15ad60f41103bb2ee1b50f1b70a388f2fe9fc2b | Make OnCall.slug unique | wking/django-on-call | django_on_call/models.py | django_on_call/models.py | import datetime
from django.db import models
class OnCall (models.Model):
slug = models.SlugField(
unique=True,
verbose_name='on-call slot',
help_text='Identify this among other possible on-call positions')
rule = models.TextField(
verbose_name='on-call rule',
help_tex... | import datetime
from django.db import models
class OnCall (models.Model):
slug = models.SlugField(
verbose_name='on-call slot',
help_text='Identify this among other possible on-call positions')
rule = models.TextField(
verbose_name='on-call rule',
help_text=(
'Pyth... | bsd-2-clause | Python |
6ae83f01eacceb140435e72a216fa88bd97f2b0c | Add support for logging module | ljvmiranda921/pyswarms,ljvmiranda921/pyswarms | pyswarms/utils/console_utils.py | pyswarms/utils/console_utils.py | # -*- coding: utf-8 -*-
""" console_utils.py: various tools for printing into console """
# Import from __future__
from __future__ import with_statement
from __future__ import absolute_import
from __future__ import print_function
# Import modules
import logging
def cli_print(message, verbosity, threshold, logger):
... | # -*- coding: utf-8 -*-
""" console_utils.py: various tools for printing into console """
def cli_print(message, verbosity, threshold):
"""Helper function to print console output
Parameters
----------
message : str
the message to be printed into the console
verbosity : int
verbosi... | mit | Python |
37cc678a85987ed6440c584e04d34efc0712bca8 | fix property call | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | custom/icds/models.py | custom/icds/models.py | from __future__ import absolute_import
from __future__ import unicode_literals
from django.db import models
from django.utils.functional import cached_property
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from corehq.apps.app_manager.dbaccessors import get... | from __future__ import absolute_import
from __future__ import unicode_literals
from django.db import models
from django.utils.functional import cached_property
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from corehq.apps.app_manager.dbaccessors import get... | bsd-3-clause | Python |
93eef442ccf019e12178e482cae5362b889b28cd | update AUC once again | ExaScience/smurff,ExaScience/smurff,ExaScience/smurff,ExaScience/smurff,ExaScience/smurff,ExaScience/smurff | python/test/test_noisemodels.py | python/test/test_noisemodels.py | import numpy as np
import scipy.sparse
import smurff
import pytest
verbose = 0
seed = 1234
# 4 different types of side info
def no_side_info(U):
return None
def sparse_side_info(U):
return smurff.make_sparse(U, 0.5, seed=seed)
def binary_side_info(U):
F = np.digitize(U, bins = [.0])
F = scipy.sparse... | import numpy as np
import scipy.sparse
import smurff
import pytest
verbose = 0
seed = 1234
# 4 different types of side info
def no_side_info(U):
return None
def sparse_side_info(U):
return smurff.make_sparse(U, 0.5, seed=seed)
def binary_side_info(U):
F = np.digitize(U, bins = [.0])
F = scipy.sparse... | mit | Python |
436dc1ab60e483c264be9f94c4a9f3f7950270a5 | fix typo "dependancies" | logonmy/pyinotify,rhelmer/pyinotify,peterbe/pyinotify,andir/pyinotify,blueyed/pyinotify,judecalvillo/pyinotify,blueyed/pyinotify,bici-zhuguangzu/pyinotify,rhelmer/pyinotify,seb-m/pyinotify,bici-zhuguangzu/pyinotify,seb-m/pyinotify,peterbe/pyinotify,peterbe/pyinotify,logonmy/pyinotify,bici-zhuguangzu/pyinotify,seb-m/pyi... | python2/examples/autocompile.py | python2/examples/autocompile.py | #!/usr/bin/env python
#
# Usage:
# ./autocompile.py path ext1,ext2,extn cmd
#
# Blocks monitoring |path| and its subdirectories for modifications on
# files ending with suffix |extk|. Run |cmd| each time a modification
# is detected. |cmd| is optional and defaults to 'make'.
#
# Example:
# ./autocompile.py /my-late... | #!/usr/bin/env python
#
# Usage:
# ./autocompile.py path ext1,ext2,extn cmd
#
# Blocks monitoring |path| and its subdirectories for modifications on
# files ending with suffix |extk|. Run |cmd| each time a modification
# is detected. |cmd| is optional and defaults to 'make'.
#
# Example:
# ./autocompile.py /my-late... | mit | Python |
5f30d91d35d090e28925613365d5d1f31f0259d2 | Fix for broken zeroconf publishing. | ties/flask-daapserver,basilfx/flask-daapserver | daapserver/bonjour.py | daapserver/bonjour.py | import zeroconf
import socket
class Bonjour(object):
"""
"""
def __init__(self):
"""
"""
self.zeroconf = zeroconf.Zeroconf()
self.servers = {}
def publish(self, server):
"""
"""
if server in self.servers:
self.unpublish(server)
... | import zeroconf
import socket
class Bonjour(object):
"""
"""
def __init__(self):
"""
"""
self.zeroconf = zeroconf.Zeroconf()
self.servers = {}
def publish(self, server):
"""
"""
if server in self.servers:
self.unpublish(server)
... | mit | Python |
1c288ede44ae6efa8a0730fd66128bd527bc9ca7 | fix hatt tables | harrisony/uni-latex-template | bin/build-hatt-table.py | bin/build-hatt-table.py | #!/usr/bin/env python3
import subprocess
import re
import sys
RESULT_RE = re.compile(r'(T|F|[^ |])')
BASIC_PROPOSITION_RE = re.compile(r'([A-Za-z]+)')
REPLACEMENTS = {'~': r'\neg', '&': r'\wedge', '|': r'\vee', '<->': r'\leftrightarrow', '->': r'\rightarrow'}
wresult = subprocess.check_output(['hatt', '-e', sys.arg... | #!/usr/bin/env python3
import subprocess
import re
import sys
RESULT_RE = re.compile(r'(T|F|[^ |])')
BASIC_PROPOSITION_RE = re.compile(r'([A-Za-z]+)')
REPLACEMENTS = {'~': r'\neg', '&': r'\wedge', '|': r'\vee', '<->': r'\leftrightarrow', '->': r'\rightarrow'}
wresult = subprocess.check_output(['hatt', '-e', sys.arg... | unlicense | Python |
3ad02623eeb9b008b777ff5fc80cf674b9476d3b | bump version for release | bcicen/docker-replay | docker_replay/version.py | docker_replay/version.py | __version__ = (1, 2)
version = '%d.%d' % __version__
| __version__ = (1, 1)
version = '%d.%d' % __version__
| mit | Python |
c4d3473bbbb561b8ca6431d2ca87bd6bfcf12600 | Refactor into a class | helenst/turbot-securities-cambodia | scraper.py | scraper.py | # -*- coding: utf-8 -*-
import json
import datetime
import requests
import turbotlib
from bs4 import BeautifulSoup
SOURCE_URL = 'http://www.secc.gov.kh/english/m52.php?pn=6'
FETCH_REAL_DATA = False
def normalize(text):
return " ".join(token.strip() for token in text.split())
class Page(object):
def __init... | # -*- coding: utf-8 -*-
import json
import datetime
import requests
import turbotlib
from bs4 import BeautifulSoup
SOURCE_URL = 'http://www.secc.gov.kh/english/m52.php?pn=6'
FETCH_REAL_DATA = False
def normalize(text):
return " ".join(token.strip() for token in text.split())
def process_entry(row, category, n... | mit | Python |
bbbaa04fb7badd7ea0b6817aed6cb4a93d878b6d | fix comment typo | zerodb/zerodb,zerodb/zerodb,zero-db/zerodb,zero-db/zerodb | zerodb/catalog/indexes/common.py | zerodb/catalog/indexes/common.py | from repoze.catalog.indexes.common import *
_marker = ()
class CallableDiscriminatorMixin(object):
"""
Compatibility function which makes index pickleable
"""
def _init_discriminator(self, discriminator):
if isinstance(discriminator, tuple):
self.discriminator, = discriminator
... | from repoze.catalog.indexes.common import *
_marker = ()
class CallableDiscriminatorMixin(object):
"""
Compatibility function which makes index pickleable
"""
def _init_discriminator(self, discriminator):
if isinstance(discriminator, tuple):
self.discriminator, = discriminator
... | agpl-3.0 | Python |
f7ce8651ba496dd814a68bd380f20dc6707c618f | Update XENVIF | xenserver/win-installer,OwenSmith/win-installer,OwenSmith/win-installer,xenserver/win-installer,xenserver/win-installer,OwenSmith/win-installer,xenserver/win-installer,OwenSmith/win-installer,xenserver/win-installer,OwenSmith/win-installer | manifestspecific.py | manifestspecific.py | # Copyright (c) Citrix Systems Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms,
# with or without modification, are permitted provided
# that the following conditions are met:
#
# * Redistributions of source code must retain the above
# copyright notice, this list of conditions a... | # Copyright (c) Citrix Systems Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms,
# with or without modification, are permitted provided
# that the following conditions are met:
#
# * Redistributions of source code must retain the above
# copyright notice, this list of conditions a... | bsd-2-clause | Python |
8b132c0614a2d87bdd90e6ad1e32829496ea4d2b | Fix lint | apihackers/wapps,apihackers/wapps,apihackers/wapps,apihackers/wapps | wapps/pytest.py | wapps/pytest.py | import pytest
from pytest_factoryboy import register, LazyFixture
from django_jinja.base import dict_from_context
from django.template import RequestContext, engines
from django.middleware import csrf
from django.utils.encoding import smart_text
from django.utils.functional import SimpleLazyObject
def pytest_confi... | import pytest
from pytest_factoryboy import register, LazyFixture
from django_jinja.base import dict_from_context
from django.template import RequestContext, engines
from django.middleware import csrf
from django.utils.encoding import smart_text
from django.utils.functional import SimpleLazyObject
def pytest_confi... | mit | Python |
7da8741afed458bac9de692ba99464fa10e062ad | Update thresholds for better readings | amcolash/WaterPi,amcolash/WaterIoT,amcolash/WaterIoT,amcolash/WaterPi,amcolash/WaterIoT,amcolash/WaterPi,amcolash/WaterIoT,amcolash/WaterPi | water_analog.py | water_analog.py | #!/usr/bin/env python
from __future__ import division # treat all division as non-integer division (remainders)
import mraa
import time
import signal
import sys
import auth
import twitter
import json
# Path to use for web server / checkout and data
PATH='/home/root/WaterIoT/'
# Define "enable" for the sensor
SENSOR... | #!/usr/bin/env python
from __future__ import division # treat all division as non-integer division (remainders)
import mraa
import time
import signal
import sys
import auth
import twitter
import json
# Path to use for web server / checkout and data
PATH='/home/root/WaterIoT/'
# Define "enable" for the sensor
SENSOR... | mit | Python |
fb95b52e512d43f635b4d94af3eef1272c4d6723 | add __all__ to minimize star-imports | arogozhnikov/einops | einops/__init__.py | einops/__init__.py | __author__ = 'Alex Rogozhnikov'
__version__ = '0.1'
__all__ = ['rearrange', 'reduce', 'parse_shape', 'asnumpy', 'EinopsError']
from .einops import rearrange, reduce, parse_shape, asnumpy, EinopsError
| __author__ = 'Alex Rogozhnikov'
__version__ = '0.1'
from .einops import rearrange, reduce, parse_shape, asnumpy, EinopsError
| mit | Python |
660e3d159cb1b72e074418d348cd9e793fcff42e | fix search view | auto-mat/django-webmap-corpus | webmap/views.py | webmap/views.py | """Views for the webmap app."""
# from django.views.generic import TemplateView
from webmap import models
from django import http
from django.views.decorators.gzip import gzip_page
from django.views.decorators.cache import never_cache, cache_page
from django.shortcuts import get_object_or_404
from django.contrib.gis.s... | """Views for the webmap app."""
# from django.views.generic import TemplateView
from webmap import models
from django import http
from django.views.decorators.gzip import gzip_page
from django.views.decorators.cache import never_cache, cache_page
from django.shortcuts import get_object_or_404
from django.contrib.gis.s... | mit | Python |
37bb62a411f19f1462b8ecdab674478a2bee3bcc | Mark test_localized_download_links as xfail due to bug 1445077 (#5504) | sgarrity/bedrock,alexgibson/bedrock,flodolo/bedrock,pascalchevrel/bedrock,flodolo/bedrock,ericawright/bedrock,ericawright/bedrock,MichaelKohler/bedrock,sgarrity/bedrock,mozilla/bedrock,mozilla/bedrock,craigcook/bedrock,alexgibson/bedrock,MichaelKohler/bedrock,pascalchevrel/bedrock,sylvestre/bedrock,kyoshino/bedrock,cra... | tests/functional/test_download_l10n.py | tests/functional/test_download_l10n.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from bs4 import BeautifulSoup
import pytest
import requests
PAGE_PATHS = (
'/firefox/all/',
'/firefox/beta/all... | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from bs4 import BeautifulSoup
import pytest
import requests
PAGE_PATHS = (
'/firefox/all/',
'/firefox/beta/all... | mpl-2.0 | Python |
8412a75a47b4f83f63bb547b5fd5e7d01c28c0a7 | migrate TestTrafficHistory to pytest #580 | agdsn/pycroft,agdsn/pycroft,agdsn/pycroft,agdsn/pycroft,agdsn/pycroft | tests/lib/user/test_traffic_history.py | tests/lib/user/test_traffic_history.py | from datetime import timedelta
import pytest
from pycroft.lib.user import traffic_history
from pycroft.model.user import User
from tests.factories import TrafficVolumeLastWeekFactory, UserFactory
class TestTrafficHistory:
@pytest.fixture(scope="class")
def user(self, class_session) -> User:
return U... | from datetime import datetime, timedelta
from pycroft.lib.user import traffic_history
from tests.legacy_base import FactoryDataTestBase
from tests.factories import TrafficVolumeLastWeekFactory, UserFactory
class TestTrafficHistory(FactoryDataTestBase):
def create_factories(self):
super().create_factories... | apache-2.0 | Python |
975e7cbe97dee1ab5c2fe4aaa17083d53e4095ee | Update set_ops.py | djrlj694/Python-Demo | set_ops.py | set_ops.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Function declarations
# INSPIRATION: http://www.saltycrane.com/blog/2008/01/how-to-find-intersection-and-union-of/
""" NOTES:
- requires Python 2.4 or greater
- elements of the lists must be hashable
- order of the original lists is not preserved
"""
def... | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Function declarations
# INSPIRATION: http://www.saltycrane.com/blog/2008/01/how-to-find-intersection-and-union-of/
""" NOTES:
- requires Python 2.4 or greater
- elements of the lists must be hashable
- order of the original lists is not preserved
"""
def... | unlicense | Python |
77cdf4de05b3edfe3231ffd831af38b290b178a1 | Add a little doc and callbacks | hydroshare/django_docker_processes,JeffHeard/django_docker_processes | signals.py | signals.py | from django.core.signals import Signal
process_finished = Signal(providing_args=['result_text', 'result_data', 'files', 'profile','logs'])
process_aborted = Signal(providing_args=['error_text','result_data','profile','logs'])
| from django.core.signals import Signal
process_completed = Signal(providing_args=['result_text', 'result_data', 'files', 'profile','logs'])
process_aborted = Signal(providing_args=['error_text','result_data','profile','logs'])
| bsd-3-clause | Python |
d1e55fd64649d4099a803b3d5016ee58a62cd2b5 | Rearrange object creation and linking for sanity | endrift/bmdstream | bmdstream.py | bmdstream.py | #!/usr/bin/python3
import gi
import threading
gi.require_version('Gst', '1.0')
from gi.repository import Gst, GObject
GObject.threads_init()
Gst.init(None)
class AudioResampler(Gst.Bin):
def __init__(self):
super(AudioResampler, self).__init__()
convert = Gst.ElementFactory.make('audioconvert', None)
resample... | #!/usr/bin/python3
import gi
import threading
gi.require_version('Gst', '1.0')
from gi.repository import Gst, GObject
GObject.threads_init()
Gst.init(None)
class AudioResampler(Gst.Bin):
def __init__(self):
super(AudioResampler, self).__init__()
convert = Gst.ElementFactory.make('audioconvert', None)
resample... | mit | Python |
ba9356668072d70c08969f76991db2a28c693de3 | Create utils.py | ahmia/ahmia-site,ahmia/ahmia-site,ahmia/ahmia-site | ahmia/ahmia/utils.py | ahmia/ahmia/utils.py | """ Utility fonctions """
from elasticsearch import Elasticsearch
from django.conf import settings
def get_elasticsearch_object():
""" Creating an elasticsearch object to query the index """
try:
es_servers = settings.ELASTICSEARCH_SERVERS
es_servers = es_servers if isinstance(es_servers, list... | """ Utility fonctions """
from elasticsearch import Elasticsearch
from django.conf import settings
def get_elasticsearch_object():
""" Creating an elasticsearch object to query the index """
try:
es_servers = settings.ELASTICSEARCH_SERVERS
es_servers = es_servers if isinstance(es_servers, list... | bsd-3-clause | Python |
51af1fbe2c659f0c106519cf75a6acd93b2606a0 | Add callback validation to router plugin | numberoverzero/bottom | tests/unit/test_plugins/test_router.py | tests/unit/test_plugins/test_router.py | import pytest
from bottom.plugins.router import Router
@pytest.fixture
def router(client):
return Router(client)
def test_router_registers_callback(router, client, flush):
called = False
name = "foo"
message = "test {}".format(name)
expected_nick = "nick"
expected_target = "target"
@rou... | import pytest
from bottom.plugins.router import Router
@pytest.fixture
def router(client):
return Router(client)
def test_decorator_returns_original(router):
def original_func(nick, target, fields):
pass
wrapped_func = router.route("pattern")(original_func)
assert wrapped_func is original_f... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.