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 |
|---|---|---|---|---|---|---|---|---|
089ca7d724cc9f3de06e3ebd0dec3f9c1a03dec5 | drop unused dmp_compose() | diofant/diofant | diofant/polys/densetools.py | diofant/polys/densetools.py | """Advanced tools for dense recursive polynomials in ``K[x]`` or ``K[X]``."""
def dmp_eval_in(f, a, j, u, K):
"""Evaluate a polynomial at ``x_j = a`` in ``K[X]``."""
ring = K.poly_ring(*[f'_{i}' for i in range(u + 1)])
f = ring.from_list(f)
r = f.eval(x=j, a=a)
if ring.is_multivariate:
r =... | """Advanced tools for dense recursive polynomials in ``K[x]`` or ``K[X]``."""
def dmp_eval_in(f, a, j, u, K):
"""Evaluate a polynomial at ``x_j = a`` in ``K[X]``."""
ring = K.poly_ring(*[f'_{i}' for i in range(u + 1)])
f = ring.from_list(f)
r = f.eval(x=j, a=a)
if ring.is_multivariate:
r =... | bsd-3-clause | Python |
16431e33504838e29863ca56e01af558fd0d3f8d | Optimize validate_change_price_criteria_reduction validator | prozorro-sale/openprocurement.auctions.dgf | openprocurement/auctions/dgf/validation.py | openprocurement/auctions/dgf/validation.py | # -*- coding: utf-8 -*-
from openprocurement.api.utils import error_handler
def validate_change_price_criteria_reduction(request):
"""
Validate value, minimalStep, guarantee change
Value only decrease for not more that 50%
minimalStep, guarantee only decrease
"""
if request.context... | # -*- coding: utf-8 -*-
from openprocurement.api.utils import error_handler
def validate_change_price_criteria_reduction(request):
"""
Validate value, minimalStep, guarantee change
Value only decrease for not more that 50%
minimalStep, guarantee only decrease
"""
if request.context... | apache-2.0 | Python |
39fb243ac3b00a587424acf5a8eae76182ff6e25 | Fix double-kill issue (cf https://github.com/mozilla-services/circus/issues/685) | onitu/onitu,onitu/onitu,onitu/onitu | onitu/__main__.py | onitu/__main__.py | import sys
import signal
import simplejson
import circus
from redis import Redis
from zmq.eventloop import ioloop
from logbook import Logger
from utils import connect_to_redis
def load_drivers(*args, **kwargs):
redis = connect_to_redis()
with open(entries_file) as f:
entries = simplejson.load(f)
... | import sys
import simplejson
import circus
from redis import Redis
from zmq.eventloop import ioloop
from logbook import Logger
from utils import connect_to_redis
def load_drivers(*args, **kwargs):
redis = connect_to_redis()
with open(entries_file) as f:
entries = simplejson.load(f)
for name, ... | mit | Python |
081d788bea45b4c11663ddf10776cee737a7c503 | Bump to 1.5.2 dev. | 1tush/reviewboard,bkochendorfer/reviewboard,sgallagher/reviewboard,Khan/reviewboard,beol/reviewboard,atagar/ReviewBoard,atagar/ReviewBoard,brennie/reviewboard,1tush/reviewboard,beol/reviewboard,chipx86/reviewboard,chazy/reviewboard,reviewboard/reviewboard,atagar/ReviewBoard,Khan/reviewboard,brennie/reviewboard,sgallagh... | reviewboard/__init__.py | reviewboard/__init__.py | # The version of Review Board.
#
# This is in the format of:
#
# (Major, Minor, Micro, Patch, alpha/beta/rc/final, Release Number, Released)
#
VERSION = (1, 5, 2, 0, 'final', 0, False)
def get_version_string():
version = '%s.%s' % (VERSION[0], VERSION[1])
if VERSION[2]:
version += ".%s" % VERSION[2... | # The version of Review Board.
#
# This is in the format of:
#
# (Major, Minor, Micro, Patch, alpha/beta/rc/final, Release Number, Released)
#
VERSION = (1, 5, 1, 0, 'final', 0, True)
def get_version_string():
version = '%s.%s' % (VERSION[0], VERSION[1])
if VERSION[2]:
version += ".%s" % VERSION[2]... | mit | Python |
e1fb6406c3d0bfbd74e22fd4280ff4022cfcbf69 | add use 2 | pammirato/active_vision_dataset_processing,pammirato/active_vision_dataset_processing | data_loading/demo.py | data_loading/demo.py | import torch
import torchvision
import torchvision.transforms as transforms
import active_vision_dataset
#USE 1
##########from pytorch tutorial
#create a transform to normalize the images
transform=transforms.Compose([transforms.ToTensor(),
transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.... | import torch
import torchvision
import torchvision.transforms as transforms
import active_vision_dataset
#from pytorch tutorial
#create a transform to normalize the images
transform=transforms.Compose([transforms.ToTensor(),
transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5)),
... | mit | Python |
c8ae3484040f086e7bf51521cd622d281d0dd51a | fix some errors from the translation from 3-d to 1-d | zingale/powerspectrum_test | ps1d.py | ps1d.py | # create some "fake" 1-d multimode data and create a power spectrum to
# illustrate that we have the scaling and normalization correct
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import AxesGrid
# number of discrete points in real space to sample
N = 64
index = -4.0
xmin = 0.0
xm... | # create some "fake" 1-d multimode data and create a power spectrum to
# illustrate that we have the scaling and normalization correct
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import AxesGrid
# number of discrete points in real space to sample
N = 64
index = -4.0
xmin = 0.0
xm... | bsd-3-clause | Python |
87a3712c45cc7deeb631c3dacdd7e4268d01573c | Make run_keen_summaries runnable as a module | cslzchen/osf.io,caseyrollins/osf.io,cslzchen/osf.io,saradbowman/osf.io,HalcyonChimera/osf.io,baylee-d/osf.io,aaxelb/osf.io,caseyrollins/osf.io,adlius/osf.io,Johnetordoff/osf.io,saradbowman/osf.io,HalcyonChimera/osf.io,adlius/osf.io,brianjgeiger/osf.io,erinspace/osf.io,mattclark/osf.io,mfraezz/osf.io,brianjgeiger/osf.io... | scripts/analytics/run_keen_summaries.py | scripts/analytics/run_keen_summaries.py | import django
django.setup()
from framework.celery_tasks import app as celery_app
from scripts.analytics.user_summary import UserSummary
from scripts.analytics.node_summary import NodeSummary
from scripts.analytics.file_summary import FileSummary
from scripts.analytics.preprint_summary import PreprintSummary
from scri... | import django
django.setup()
from framework.celery_tasks import app as celery_app
from scripts.analytics.user_summary import UserSummary
from scripts.analytics.node_summary import NodeSummary
from scripts.analytics.file_summary import FileSummary
from scripts.analytics.preprint_summary import PreprintSummary
from scri... | apache-2.0 | Python |
00f481f9e19876337a29759e2da372cc0b25e4cd | Improve methods orhanization | globocom/dbaas-zabbix,globocom/dbaas-zabbix | dbaas_zabbix/provider.py | dbaas_zabbix/provider.py | # -*- coding: utf-8 -*-
import logging
LOG = logging.getLogger(__name__)
class ZabbixProvider(object):
__provider_name__ = None
__is_ha__ = None
def __init__(self, dbaas_api, zabbix_api):
self.dbaas_api = dbaas_api
self.api = zabbix_api(dbaas_api.endpoint)
self.api.login(user=dba... | # -*- coding: utf-8 -*-
import logging
LOG = logging.getLogger(__name__)
class ZabbixProvider(object):
__provider_name__ = None
__is_ha__ = None
def __init__(self, dbaas_api, zabbix_api):
self.dbaas_api = dbaas_api
self.api = zabbix_api(dbaas_api.endpoint)
self.api.login(user=dba... | bsd-3-clause | Python |
22f9cacc853c928c320c393e91cac93fce6c1b1e | clean up european flag dataviz | Udzu/pudzu,Udzu/pudzu | dataviz/euaverage.py | dataviz/euaverage.py | import sys
sys.path.append('..')
from charts import *
from bamboo import *
from statistics import mean
import seaborn as sns
# generate map
flags = pd.read_csv("datasets/countries.csv").split_columns(('nationality', 'tld', 'country'), "|").split_rows('country').set_index('country')
def colorfn(c):
if c not in fla... | import sys
sys.path.append('..')
from charts import *
from bamboo import *
from statistics import mean
import seaborn as sns
# generate map
flags = pd.read_csv("datasets/countries.csv").split_columns(('nationality', 'tld', 'country'), "|").split_rows('country').set_index('country')
def colorfn(c):
if c not in fla... | mit | Python |
0309877b1d2010c9c9e6b64926ae977e141b1009 | add support for downloading from FTP | OpenBounds/Processing | utils.py | utils.py |
import os
import ujson
import logging
import tempfile
import sys
from urlparse import urlparse
import shutil
import urllib2
from contextlib import closing
import click
import requests
CHUNK_SIZE = 1024
logging.basicConfig(level=logging.INFO)
def get_files(path):
"""Returns an iterable containing the full path... |
import os
import ujson
import logging
import tempfile
import sys
from urlparse import urlparse
import click
import requests
CHUNK_SIZE = 1024
logging.basicConfig(level=logging.INFO)
def get_files(path):
"""Returns an iterable containing the full path of all files in the
specified path.
:param path: s... | mit | Python |
3767616ffd66a6201f79ad61b02761802dabf406 | Fix order import on utils file | AndrzejR/mining,mlgruby/mining,AndrzejR/mining,seagoat/mining,chrisdamba/mining,mlgruby/mining,avelino/mining,seagoat/mining,mining/mining,jgabriellima/mining,chrisdamba/mining,jgabriellima/mining,mining/mining,avelino/mining,mlgruby/mining | utils.py | utils.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from pandas import tslib
def fix_render(value):
if type(value) is str:
try:
return unicode(value)
except UnicodeDecodeError:
return unicode(value.decode('latin1'))
elif type(value) is tslib.Timestamp:
return value.st... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from pandas import tslib
def fix_render(value):
if type(value) is str:
try:
return unicode(value)
except UnicodeDecodeError:
return unicode(value.decode('latin1'))
elif type(value) is tslib.Timestamp:
return value.strf... | mit | Python |
697a905fd52a69d38f42bcae3cc477428a4bf3d8 | Fix boto imports | reneepadgham/diverseui,reneepadgham/diverseui,reneepadgham/diverseui | utils.py | utils.py | import os
from boto import s3
from boto.s3.key import Key
from boto.s3.connection import OrdinaryCallingFormat
import requests
import uuid
# http://stackoverflow.com/a/42493144
def upload_url_to_s3(image_url):
image_res = requests.get(image_url, stream=True)
image = image_res.raw
image_data = image.read()... | import os
import boto
import boto.s3
from boto.s3.key import Key
from boto.s3.connection import OrdinaryCallingFormat
import requests
import uuid
# http://stackoverflow.com/a/42493144
def upload_url_to_s3(image_url):
image_res = requests.get(image_url, stream=True)
image = image_res.raw
image_data = image... | mit | Python |
978488e699f6742f3cda9ebb40e0c8f88b64201a | FIX http://www.openerp-italia.org | savoirfairelinux/OpenUpgrade,lgscofield/odoo,lightcn/odoo,lightcn/odoo,srsman/odoo,bplancher/odoo,nuuuboo/odoo,rschnapka/odoo,hanicker/odoo,ehirt/odoo,mszewczy/odoo,gorjuce/odoo,nagyistoce/odoo-dev-odoo,Gitlab11/odoo,tarzan0820/odoo,papouso/odoo,storm-computers/odoo,diagramsoftware/odoo,hbrunn/OpenUpgrade,SAM-IT-SA/odo... | addons/l10n_it/__openerp__.py | addons/l10n_it/__openerp__.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010
# Italian OpenERP Community (<http://www.openerp-italia.org>)
# Servabit srl
# Agile Business Group sagl
# Domsense srl
# Albato... | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010
# Italian OpenERP Community (<http://www.openerp-italia.com>)
# Servabit srl
# Agile Business Group sagl
# Domsense srl
# Albato... | agpl-3.0 | Python |
47405ef7ff3e21d71a4275403835c2a245c1cf7a | Fix tests | Yelp/paasta,gstarnberger/paasta,somic/paasta,Yelp/paasta,somic/paasta,gstarnberger/paasta | tests/test_check_mesos_resource_utilization.py | tests/test_check_mesos_resource_utilization.py | import mock
import contextlib
from paasta_tools import check_mesos_resource_utilization
def test_check_thresholds_mem_over():
with contextlib.nested(
mock.patch('paasta_tools.check_mesos_resource_utilization.fetch_mesos_stats'),
mock.patch('paasta_tools.check_mesos_resource_utilization.send_event'... | import mock
import contextlib
from paasta_tools import check_mesos_resource_utilization
def test_check_thresholds_mem_over():
with contextlib.nested(
mock.patch('paasta_tools.check_mesos_resource_utilization.fetch_mesos_stats'),
mock.patch('paasta_tools.check_mesos_resource_utilization.send_event'... | apache-2.0 | Python |
0bb1a5d97ba3bb5c8fa42b37ce111caf7205b2bd | Clean up a bit. | stackforge/akanda-appliance,openstack/akanda-appliance,stackforge/akanda-appliance,openstack/akanda-appliance,dreamhost/akanda-appliance,dreamhost/akanda-appliance | akanda/router/drivers/ping.py | akanda/router/drivers/ping.py | # Copyright 2014 DreamHost, LLC
#
# Author: DreamHost, LLC
#
# 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 applicabl... | # Copyright 2014 DreamHost, LLC
#
# Author: DreamHost, LLC
#
# 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 applicabl... | apache-2.0 | Python |
919b53684cf1ca72358794725acdf3c119d821e9 | Add WithIdentifier token type. | SunDwarf/asyncqlio | katagawa/sql/__init__.py | katagawa/sql/__init__.py | """
SQL generators for Katagawa.
"""
import abc
import typing
class Token(abc.ABC):
"""
Base class for a token.
"""
__slots__ = ()
def __init__(self, subtokens: typing.List['Token'] = None):
"""
:param subtokens: Any subtokens this token has.
"""
if subtokens is N... | """
SQL generators for Katagawa.
"""
import abc
import typing
class Token(abc.ABC):
"""
Base class for a token.
"""
__slots__ = ()
def __init__(self, subtokens: typing.List['Token']=None):
"""
:param subtokens: Any subtokens this token has.
"""
if subtokens is Non... | mit | Python |
8cae1820bf76d790c4ee8992d7f7397a0357daec | fix recorder module | dirkjot/kivy,matham/kivy,youprofit/kivy,manthansharma/kivy,jehutting/kivy,angryrancor/kivy,Ramalus/kivy,gonzafirewall/kivy,Cheaterman/kivy,Shyam10/kivy,yoelk/kivy,bhargav2408/kivy,bob-the-hamster/kivy,rnixx/kivy,Shyam10/kivy,el-ethan/kivy,manashmndl/kivy,adamkh/kivy,tony/kivy,iamutkarshtiwari/kivy,denys-duchier/kivy,th... | kivy/modules/recorder.py | kivy/modules/recorder.py | '''
Recorder module
===============
.. versionadded:: 1.1.0
Create an instance of :class:`~kivy.input.recorder.Recorder`, attach to the
class, and bind some keys to record / play sequences:
- F6: play the last record in a loop
- F7: read the latest recording
- F8: record input events
Configuration
-----... | '''
Recorder module
===============
.. versionadded:: 1.1.0
Create an instance of :class:`~kivy.input.recorder.Recorder`, attach to the
class, and bind some keys to record / play sequences:
- F6: play the last record in a loop
- F7: read the latest recording
- F8: record input events
Configuration
-----... | mit | Python |
989df1b03a3e404f14333f63ba0dadab094c59f8 | add more comments! | Statistica/676-candidates | amount_raised_by_candidate.py | amount_raised_by_candidate.py | # Written by Jonathan Saewitz, released May 24th, 2016 for Statisti.ca
# Released under the MIT License (https://opensource.org/licenses/MIT)
import csv, plotly.plotly as plotly, plotly.graph_objs as go, requests
from collections import Counter
from bs4 import BeautifulSoup
candidates=[]
with open('presidential_cand... | # Written by Jonathan Saewitz, released May 24th, 2016 for Statisti.ca
# Released under the MIT License (https://opensource.org/licenses/MIT)
import csv, plotly.plotly as plotly, plotly.graph_objs as go, requests
from collections import Counter
from bs4 import BeautifulSoup
candidates=[]
with open('presidential_cand... | mit | Python |
f199514af9deb61e47bdaf2736fd6797a230055a | update caniusepython3 package file change | chhantyal/py3readiness,chhantyal/py3readiness | utils.py | utils.py | import datetime
import json
import xmlrpclib
import pytz
import requests
from caniusepython3.pypi import all_py3_projects
BASE_URL = 'http://pypi.python.org/pypi'
SESSION = requests.Session()
def req_rpc(method, *args):
payload = xmlrpclib.dumps(args, method)
response = SESSION.post(
BASE_URL,
... | import datetime
import json
import xmlrpclib
import pytz
import requests
from caniusepython3 import all_py3_projects
BASE_URL = 'http://pypi.python.org/pypi'
SESSION = requests.Session()
def req_rpc(method, *args):
payload = xmlrpclib.dumps(args, method)
response = SESSION.post(
BASE_URL,
... | bsd-2-clause | Python |
a0b2274d85bbaf745419fca9e85bed856561f543 | Add GITLAB_HOOK parameter to config | pipex/gitbot,pipex/gitbot,pipex/gitbot | config.py | config.py | from __future__ import absolute_import
from __future__ import unicode_literals
class Config(object):
DEBUG = False
TESTING = False
# Host for the redis server
REDIS = 'redis'
# Gitlab hook url
GITLAB_HOOK = '/hooks/bWxNGVQij55cCZigeKDlXf9P6L14bKc4AhdPmPL5mEc='
# Define the application d... | from __future__ import absolute_import
from __future__ import unicode_literals
class Config(object):
DEBUG = False
TESTING = False
# Host for the redis server
REDIS = 'redis'
# Define the application directory
import os
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
# Log fil... | apache-2.0 | Python |
52cf137e369b6339c476b84d846210b4822f7a98 | Change default config to not display jobs and time. | egoddard/promptastic | config.py | config.py | # This is the configuration file which helps you customize your 'promptastic' installation.
# For instructions on how to use the promptastic.py script, see the README.
# Patched fonts are special fonts best suited for terminals
# True if the current terminal is using patched fonts (available at:
# https://github.com/L... | # This is the configuration file which helps you customize your 'promptastic' installation.
# For instructions on how to use the promptastic.py script, see the README.
# Patched fonts are special fonts best suited for terminals
# True if the current terminal is using patched fonts (available at:
# https://github.com/L... | apache-2.0 | Python |
6c23f27a7dd564989199d4e3232c20acfb71773d | Add a function to load a model | IshitaTakeshi/PCANet | utils.py | utils.py | import numpy as np
import pickle
from chainer.datasets import get_mnist, get_cifar10
from chainer.cuda import get_device
def check_gpu_enabled():
"""Return true if GPU is available"""
return get_device().id >= 0
def reshape_dataset(train, test):
def channels_last(X):
X = np.swapaxes(X, 1, 2)
... | import numpy as np
import pickle
from chainer.datasets import get_mnist, get_cifar10
from chainer.cuda import get_device
def check_gpu_enabled():
"""Return true if GPU is available"""
return get_device().id >= 0
def reshape_dataset(train, test):
def channels_last(X):
X = np.swapaxes(X, 1, 2)
... | mit | Python |
c713273fe145418113d750579f8b135dc513c3b8 | Delete default case for SQLALCHEMY_DATABASE_URI | Stark-Mountain/meetup-facebook-bot,Stark-Mountain/meetup-facebook-bot | config.py | config.py | import os
SQLALCHEMY_DATABASE_URI = os.environ['DATABASE_URL']
SQLALCHEMY_TRACK_MODIFICATIONS = False # supress deprecation warning
| import os
if os.environ.get('DATABASE_URL') is None:
SQLALCHEMY_DATABASE_URI = 'sqlite:///meetup.db'
else:
SQLALCHEMY_DATABASE_URI = os.environ['DATABASE_URL']
SQLALCHEMY_TRACK_MODIFICATIONS = False # supress deprecation warning
| mit | Python |
021be6d65789ca537afc22b8ee16b0a25bf497ea | Add recursive options for get_file_list | vladimirgamalian/pictools | utils.py | utils.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import shutil
import uuid
def is_image_file(f):
known_extensions = ('.bmp', '.jpg', '.jpeg', '.png')
return os.path.isfile(f) and f.lower().endswith(known_extensions)
def get_files_list(paths, recursive):
result = []
for path in paths:
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import shutil
import uuid
def is_image_file(f):
known_extensions = ('.bmp', '.jpg', '.jpeg', '.png')
return os.path.isfile(f) and f.lower().endswith(known_extensions)
def get_files_list(paths, recursive):
result = []
for path in paths:
... | mit | Python |
794be488d0fd8a7f6add1b2de040b586690124d6 | Disable all labhub commands in private | coala/corobo,coala/corobo | config.py | config.py | import logging
import os
COBOT_ROOT = os.environ.get('COBOT_ROOT', os.getcwd())
BACKEND = os.environ.get('BACKEND', 'Text')
BOT_EXTRA_BACKEND_DIR = os.path.join(COBOT_ROOT, 'err-backend-gitter')
HIDE_RESTRICTED_COMMANDS = True
BOT_DATA_DIR = os.path.join(COBOT_ROOT, 'data')
BOT_EXTRA_PLUGIN_DIR = COBOT_ROOT
BOT_L... | import logging
import os
COBOT_ROOT = os.environ.get('COBOT_ROOT', os.getcwd())
BACKEND = os.environ.get('BACKEND', 'Text')
BOT_EXTRA_BACKEND_DIR = os.path.join(COBOT_ROOT, 'err-backend-gitter')
HIDE_RESTRICTED_COMMANDS = True
BOT_DATA_DIR = os.path.join(COBOT_ROOT, 'data')
BOT_EXTRA_PLUGIN_DIR = COBOT_ROOT
BOT_L... | mit | Python |
f40d4ac86e791824991a9db8107710e86e20b4c4 | Update configuration | ranisalt/ardupet | ardupet.py | ardupet.py | """ArduPET is an office automation implementation. It is originally designed to
be use at the Tutorial Education Program (PET in pt-BR, hence the name) to turn
lamps on and off and unlock the door, while also checking the statuses.
Routes:
GET /lamp -- lists all lamps statuses
GET /lamp/<id> -- get the status of the l... | """ArduPET is an office automation implementation. It is originally designed to
be use at the Tutorial Education Program (PET in pt-BR, hence the name) to turn
lamps on and off and unlock the door, while also checking the statuses.
Routes:
GET /lamp -- lists all lamps statuses
GET /lamp/<id> -- get the status of the l... | mit | Python |
34e54041fe026b0be848d3b5bfe3e03e6d6f021a | Mark as playable not working just yet | ktaragorn/plugin.video.seriescravings | addon.py | addon.py | from xbmcswift2 import Plugin
from resources.lib.series_cravings import SeriesCravings
plugin = Plugin()
@plugin.route('/')
def index():
items = [
{
'label': "Favorites (Not Implemented)",
'path': 'http://s3.amazonaws.com/KA-youtube-converted/JwO_25S_eWE.mp4/JwO_25S_eWE.mp4',
},
{
... | from xbmcswift2 import Plugin
from resources.lib.series_cravings import SeriesCravings
plugin = Plugin()
@plugin.route('/')
def index():
items = [
{
'label': "Favorites (Not Implemented)",
'path': 'http://s3.amazonaws.com/KA-youtube-converted/JwO_25S_eWE.mp4/JwO_25S_eWE.mp4',
},
{
... | mit | Python |
5d5887edb943042250715f533780b118cfc5a546 | Add Docker class | luiscape/hdx-monitor-ageing-service,reubano/HDX-Age-API,KIGOTHO/hdx-age-api,KIGOTHO/hdx-age-api,luiscape/hdx-monitor-ageing-service,reubano/HDX-Age-API | config.py | config.py | import os
from os import path as p
# module vars
_user = 'reubano'
_basedir = p.dirname(__file__)
_database_path = p.join(_basedir, 'data', 'app.db')
# configurable vars
__APP_NAME__ = 'HDX-Age-API'
__YOUR_NAME__ = 'Reuben Cummings'
__YOUR_EMAIL__ = 'reubano@gmail.com'
__YOUR_WEBSITE__ = 'http://%s.github.io' % _user... | import os
from os import path as p
# module vars
_user = 'reubano'
_basedir = p.dirname(__file__)
# configurable vars
__APP_NAME__ = 'HDX-Age-API'
__YOUR_NAME__ = 'Reuben Cummings'
__YOUR_EMAIL__ = 'reubano@gmail.com'
__YOUR_WEBSITE__ = 'http://%s.github.io' % _user
# configuration
class Config(object):
#######... | mit | Python |
017566eaa9e41efe9dedb2f7ba9b4ef5e31d6104 | Add Arial SimSun | zlsun/fontfixer | config.py | config.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright © 2015 zlsun <zlsun1995@gmail.com>
#
# Distributed under terms of the MIT license.
ranges = {
'': (0, 0x2e7f),
'cjk': (0x2e80, 0xffff),
}
pref_sans = '''
sans
sans-serif
arial
Arial
Arial Black
Calibri
Comic Sans MS
Ca... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright © 2015 zlsun <zlsun1995@gmail.com>
#
# Distributed under terms of the MIT license.
ranges = {
'': (0, 0x2e7f),
'cjk': (0x2e80, 0xffff),
}
pref_sans = '''
sans
sans-serif
arial
Arial
Arial Black
Calibri
Comic Sans MS
Ca... | mit | Python |
2192d815077759b92231c806429d50a41890153a | Remove config that are no longer used. | alphagov/notifications-functional-tests,alphagov/notifications-functional-tests | config.py | config.py | import os
class Config(object):
ENVIRONMENT = os.environ['ENVIRONMENT']
NOTIFY_ADMIN_URL = os.environ[os.environ['ENVIRONMENT'] + '_NOTIFY_ADMIN_URL']
NOTIFY_API_URL = os.environ[os.environ['ENVIRONMENT'] + '_NOTIFY_API_URL']
TWILIO_TEST_NUMBER = os.environ[os.environ['ENVIRONMENT'] + '_TWILIO_TEST_NU... | import os
class Config(object):
ENVIRONMENT = os.environ['ENVIRONMENT']
NOTIFY_ADMIN_URL = os.environ[os.environ['ENVIRONMENT'] + '_NOTIFY_ADMIN_URL']
NOTIFY_API_URL = os.environ[os.environ['ENVIRONMENT'] + '_NOTIFY_API_URL']
TWILIO_TEST_NUMBER = os.environ[os.environ['ENVIRONMENT'] + '_TWILIO_TEST_NU... | mit | Python |
14240d867e42cf8ce587dbcc1ada5a6abe1c83fe | Add database_docs_dir. | ericholscher/pypi,ericholscher/pypi | config.py | config.py | import ConfigParser
class Config:
''' Read in the config and set up the vars with the correct type.
'''
def __init__(self, configfile, name):
# "name" argument no longer used
c = ConfigParser.ConfigParser()
c.read(configfile)
self.database_name = c.get('database', 'name')
... | import ConfigParser
class Config:
''' Read in the config and set up the vars with the correct type.
'''
def __init__(self, configfile, name):
# "name" argument no longer used
c = ConfigParser.ConfigParser()
c.read(configfile)
self.database_name = c.get('database', 'name')
... | bsd-3-clause | Python |
1ce17ebcb66be5b7bc9243a875a9d2925dd588a3 | Create bar plot functions and document functions | alexmilesyounger/ds_basics | s5v2.py | s5v2.py | from s5v1 import *
def plot_all_bars(prices_in_float, exported_figure_filename):
prices = list(map(int, prices_in_float)) # create a list of prices, maping the int() function onto each item in the price in float list
X = numpy.arange(len(prices)) # use numpy to arange (how?) the length of the prices variable, and th... | from s5v1 import *
| mit | Python |
f857039d2855550a816318e17a12fd7459123dd4 | format change | 54lihaoxin/leetcode_python | src/JumpGame/solution.py | src/JumpGame/solution.py | # Jump Game
#
# Given an array of non-negative integers, you are initially positioned at the first index of the array.
#
# Each element in the array represents your maximum jump length at that position.
#
# Determine if you are able to reach the last index.
#
# For example:
# A = [2,3,1,1,4], return true.
... | # Jump Game
#
# Given an array of non-negative integers, you are initially positioned at the first index of the array.
#
# Each element in the array represents your maximum jump length at that position.
#
# Determine if you are able to reach the last index.
#
# For example:
# A = [2,3,1,1,4], return true.
... | apache-2.0 | Python |
f7c824db81b89a767560042f06936cb5568974e7 | fix utf-8 encoding | duarte-pompeu/best-r-jokes,duarte-pompeu/best-r-jokes | main.py | main.py | #!/usr/bin/python2
import praw
import sqlite3
import subprocess
import config
# set to true when testing without tweeting/commiting
LOGGER = config.LOGGER
TESTING = config.TESTING
HIGH_SCORE = 500
TWITTER_LIMIT = 140
# database initialization
# sqlite> create table submissions(id text, url text);
DB = sqlite3.conn... | #!/usr/bin/python2
import praw
import sqlite3
import subprocess
import config
# set to true when testing without tweeting/commiting
LOGGER = config.LOGGER
TESTING = config.TESTING
HIGH_SCORE = 500
TWITTER_LIMIT = 140
# database initialization
# sqlite> create table submissions(id text, url text);
DB = sqlite3.conn... | mit | Python |
ac863c20ac4094168b07d6823241d55e985ba231 | Create custom test for Jinja2 | claudiopastorini/claudiopastorini.github.io,claudiopastorini/claudiopastorini.github.io,claudiopastorini/claudiopastorini.github.io | site.py | site.py | import sys
from flask import Flask, render_template
from flask_flatpages import FlatPages, flatpages
from flask_frozen import Freezer
DEBUG = True
FLATPAGES_AUTO_RELOAD = DEBUG
FLATPAGES_EXTENSION = '.md'
FREEZER_DESTINATION = 'dist'
app = Flask(__name__)
app.config.from_object(__name__)
pages = FlatPages(app)
freez... | import sys
from flask import Flask, render_template
from flask_flatpages import FlatPages, flatpages
from flask_frozen import Freezer
DEBUG = True
FLATPAGES_AUTO_RELOAD = DEBUG
FLATPAGES_EXTENSION = '.md'
FREEZER_DESTINATION = 'dist'
app = Flask(__name__)
app.config.from_object(__name__)
pages = FlatPages(app)
freez... | mit | Python |
596a88f7a8b2d0157fd365645fc59f3fa0767e7e | Remove Debug Prints | ollien/Slack-Welcome-Bot | main.py | main.py | import slackclient
import time
import os
slackClient = slackclient.SlackClient(os.environ["SLACK_TOKEN"])
slackClient.rtm_connect()
slackClient.api_call("channels.join", name="#electrical")
lastPingTime = 0
while True:
for message in slackClient.rtm_read():
if message["type"] == "team_join":
us... | import slackclient
import time
import os
slackClient = slackclient.SlackClient(os.environ["SLACK_TOKEN"])
slackClient.rtm_connect()
slackClient.api_call("channels.join", name="#electrical")
while True:
for message in slackClient.rtm_read():
print(message)
if message["type"] == "team_join":
... | mit | Python |
c61d5e84863dd67b5b76ec8031e624642f4c957c | Fix issue with wrong import | b123400/purescript-ide-sublime | main.py | main.py | from .ide.auto_complete import *
from .ide.command import plugin_unloaded
from .ide.error import *
from .ide.rebuild import *
from .ide.server import *
from .ide.settings import plugin_loaded
from .ide.text_command import *
from .ide.type_hints import *
| from .ide.command import plugin_unloaded
from .ide.error import *
from .ide.rebuild import *
from .ide.server import *
from .ide.settings import plugin_loaded
from .ide.text_command import *
from .ide.type_hints import *
from .ide.utility import *
| mit | Python |
701e7314b5211cfe3fca04b6d9d5c0b2070900fd | add pyqt4 not installed message | RoboCupULaval/UI-Debug | main.py | main.py | # Under MIT License, see LICENSE.txt
import sys
try:
from PyQt4.QtGui import QApplication
from Controller.MainController import MainController
except ImportError:
sys.stderr.write("PyQt4 n'est pas bien installé sur votre ordinateur. Veuillez installer une des versions " +
"disponibles ... | # Under MIT License, see LICENSE.txt
import sys
from PyQt4.QtGui import QApplication
from Controller.MainController import MainController
__author__ = 'RoboCupULaval'
if __name__ == '__main__':
app = QApplication(sys.argv)
f = MainController()
f.show()
sys.exit(app.exec_())
| mit | Python |
936f36fe45fcf055773e525e4ae9af7cc1bc2862 | revert to rflink | matt2005/pyrflink | main.py | main.py | """Example for using pyrflink."""
import rflink.rflink as rflink
import time
def event(update_type, nid):
"""Callback for rflink updates."""
print(update_type + " " + str(nid))
# To create a serial gateway.
GATEWAY = rflink.SerialGateway('/dev/ttyACM0', event, True)
GATEWAY.debug = True
GATEWAY.start()
time.... | """Example for using pyrflink."""
import rflink.rflink4 as rflink
import time
def event(update_type, nid):
"""Callback for rflink updates."""
print(update_type + " " + str(nid))
# To create a serial gateway.
GATEWAY = rflink.SerialGateway('/dev/ttyACM0', event, True)
GATEWAY.debug = True
GATEWAY.start()
time... | apache-2.0 | Python |
5ed1b9835a55c4fd0a5a8fe5b09e1a0ec315f31d | change plotting | cactusbin/nyt,cactusbin/nyt,cactusbin/nyt,cactusbin/nyt | main.py | main.py | import feedparser
import hashlib
import string
import random
import matplotlib.pyplot as plt
PRECISION = 1000000000000
def NYTPoliticalFeed():
url = "http://rss.nytimes.com/services/xml/rss/nyt/Politics.xml"
feed = feedparser.parse(url)
for item in feed["items"]:
yield item["title"]
def hash(stri... | import feedparser
import hashlib
import string
import random
import matplotlib.pyplot as plt
PRECISION = 1000000000000
def NYTPolitical():
# url = "http://onlineathens.com/taxonomy/term/4691/2/feed"
url = "http://rss.nytimes.com/services/xml/rss/nyt/Politics.xml"
feed = feedparser.parse(url)
for item i... | unlicense | Python |
a4013c7f33226915b3c1fb7863f3e96b24413591 | Add Error Message To Server | bshaffer/appengine-python-vm-hello,googlearchive/appengine-python-vm-hello,bshaffer/appengine-python-vm-hello,googlearchive/appengine-python-vm-hello | main.py | main.py | # Copyright 2015, Google, Inc.
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use
# this file except in compliance with the License. You may obtain a copy of the
# License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable
# law or agreed to in writing, software d... | # Copyright 2015, Google, Inc.
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use
# this file except in compliance with the License. You may obtain a copy of the
# License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable
# law or agreed to in writing, software d... | apache-2.0 | Python |
53fced45a6dc1f7613b9f769f8650c600ffb4571 | Use GPU properly. | jbeshir/dreampics_dreamserver,jbeshir/dreampics_dreamserver | main.py | main.py | #!/usr/bin/python
import io, os, sys
import web
from batcountry import BatCountry
from PIL import Image
import numpy as np
import config
from web.wsgiserver import CherryPyWSGIServer
CherryPyWSGIServer.ssl_certificate = config.ssl_certificate
CherryPyWSGIServer.ssl_private_key = config.ssl_private_key
CherryPyWSGIS... | #!/usr/bin/python
import io, os, sys
import web
from batcountry import BatCountry
from PIL import Image
import numpy as np
import config
from web.wsgiserver import CherryPyWSGIServer
CherryPyWSGIServer.ssl_certificate = config.ssl_certificate
CherryPyWSGIServer.ssl_private_key = config.ssl_private_key
urls = (
... | mit | Python |
e7fdb6ccb38fc0e6c3864889a50718d488c8009e | Add defaults to LIST command usage. | JcDelay/pycr | libpycr/commands/list.py | libpycr/commands/list.py | """
Display the list of changes given the input criterion.
"""
import argparse
import logging
from libpycr.exceptions import QueryError, PyCRError
from libpycr.gerrit import Gerrit
from libpycr.pager import Pager
from libpycr.utils.output import Formatter, NEW_LINE
from libpycr.utils.system import fail
def parse_co... | """
Display the list of changes given the input criterion.
"""
import argparse
import logging
from libpycr.exceptions import QueryError, PyCRError
from libpycr.gerrit import Gerrit
from libpycr.pager import Pager
from libpycr.utils.output import Formatter, NEW_LINE
from libpycr.utils.system import fail
def parse_co... | apache-2.0 | Python |
a8d54c0cb5871b4c509e4d3cbc9307b9877cd2e9 | add severals zipcode to KFCSpider | iandees/all-the-places,iandees/all-the-places,iandees/all-the-places | locations/spiders/kfc.py | locations/spiders/kfc.py | import json
import re
import scrapy
from locations.items import GeojsonPointItem
class KFCSpider(scrapy.Spider):
name = "kfc"
allowed_domains = ["www.kfc.com"]
def start_requests(self):
url = 'https://services.kfc.com/services/query/locations'
headers = {
'Accept-Language': '... | import json
import re
import scrapy
from locations.items import GeojsonPointItem
class KFCSpider(scrapy.Spider):
name = "kfc"
allowed_domains = ["www.kfc.com"]
def start_requests(self):
url = 'https://services.kfc.com/services/query/locations'
headers = {
'Accept-Language': 'e... | mit | Python |
cfd469f894f0df288f42c9178eb6227f6f628faa | Add new models to admin interface | xgds/xgds_status_board,xgds/xgds_status_board,xgds/xgds_status_board | xgds_status_board/admin.py | xgds_status_board/admin.py | # __BEGIN_LICENSE__
#Copyright (c) 2015, United States Government, as represented by the
#Administrator of the National Aeronautics and Space Administration.
#All rights reserved.
#
#The xGDS platform is licensed under the Apache License, Version 2.0
#(the "License"); you may not use this file except in compliance w... | # __BEGIN_LICENSE__
#Copyright (c) 2015, United States Government, as represented by the
#Administrator of the National Aeronautics and Space Administration.
#All rights reserved.
#
#The xGDS platform is licensed under the Apache License, Version 2.0
#(the "License"); you may not use this file except in compliance w... | apache-2.0 | Python |
d78a0311d61c2b963a683827ef71da17289cce7a | Return expression corrected | fmeus/raspberrypi,fmeus/raspberrypi,fmeus/raspberrypi,fmeus/raspberrypi,fmeus/raspberrypi | Rules.py | Rules.py | # -*- coding: utf-8 -*-
import MySQLdb as sql
class Rules:
__description = None
__preprocess = None
__postprocess = None
__query = None
__message = None
__output = None
__active = None
def connect( self, host, username, password, database ):
self.connection = sql.connect( host, username, password, databa... | # -*- coding: utf-8 -*-
import MySQLdb as sql
class Rules:
__description = None
__preprocess = None
__postprocess = None
__query = None
__message = None
__output = None
__active = None
def connect( self, host, username, password, database ):
self.connection = sql.connect( host, username, password, databa... | mit | Python |
9f0aead55b9d60488d5e03eefc13e455ae1f56f9 | change for travis | sdpython/pyquickhelper,sdpython/pyquickhelper,sdpython/pyquickhelper,sdpython/pyquickhelper | _unittests/ut_loghelper/test_run_cmd_exc.py | _unittests/ut_loghelper/test_run_cmd_exc.py | """
@brief test log(time=3s)
"""
import sys
import os
import unittest
try:
import src
except ImportError:
path = os.path.normpath(
os.path.abspath(
os.path.join(
os.path.split(__file__)[0],
"..",
"..")))
if path not in sys.path:
... | """
@brief test log(time=3s)
"""
import sys
import os
import unittest
try:
import src
except ImportError:
path = os.path.normpath(
os.path.abspath(
os.path.join(
os.path.split(__file__)[0],
"..",
"..")))
if path not in sys.path:
... | mit | Python |
b5adc88a1cca61537e01b1c07730b4215190ec7c | Remove uneccessary imports. | AeroNotix/django-timetracker,AeroNotix/django-timetracker,AeroNotix/django-timetracker | overtime/views.py | overtime/views.py | '''Views which are mapped from the URL objects in urls.py
.. moduleauthor:: Aaron France <aaron.france@hp.com>
:platform: All
:synopsis: Module which contains view functions that are mapped from urls
'''
from django.http import HttpResponse, Http404
from django.shortcuts import render_to_response
from dj... | '''Views which are mapped from the URL objects in urls.py
.. moduleauthor:: Aaron France <aaron.france@hp.com>
:platform: All
:synopsis: Module which contains view functions that are mapped from urls
'''
from django.http import HttpResponse, Http404, HttpResponseRedirect
from django.shortcuts import rend... | bsd-3-clause | Python |
1efeb2685f00329e7ea94bba646cde4a45a0a984 | add explicit export | aiven/aiven-client | aiven/client/__init__.py | aiven/client/__init__.py | # Copyright 2015, Aiven, https://aiven.io/
#
# This file is under the Apache License, Version 2.0.
# See the file `LICENSE` for details.
from .client import AivenClient
__all__ = ("AivenClient",)
| # Copyright 2015, Aiven, https://aiven.io/
#
# This file is under the Apache License, Version 2.0.
# See the file `LICENSE` for details.
from .client import AivenClient # noqa
| apache-2.0 | Python |
6cb5c307968c350da0253bfc37f314aea3b6453b | fix url | pmrowla/p101stat,pmrowla/p101stat,pmrowla/p101stat | p101stat/utils.py | p101stat/utils.py | # -*- coding: utf-8 -*-
"""Helper utilities and decorators."""
from __future__ import unicode_literals
import requests
from flask import flash
def flash_errors(form, category='warning'):
"""Flash all errors for a form."""
for field, errors in form.errors.items():
for error in errors:
flas... | # -*- coding: utf-8 -*-
"""Helper utilities and decorators."""
from __future__ import unicode_literals
import requests
from flask import flash
def flash_errors(form, category='warning'):
"""Flash all errors for a form."""
for field, errors in form.errors.items():
for error in errors:
flas... | bsd-3-clause | Python |
db136a4313c859495109e4ddaa0b715260526f63 | Fix string formatting for NotRegistered exception | chop-dbhi/django-webhooks,pombredanne/django-webhooks,pombredanne/django-webhooks,chop-dbhi/django-webhooks | webhooks/registry.py | webhooks/registry.py | import logging
from django.conf import settings
from django.utils.importlib import import_module
__all__ = ('events', 'register', 'unregister')
logger = logging.getLogger('webhooks')
class AlreadyRegistered(Exception):
pass
class NotRegistered(Exception):
pass
class Events(dict):
def register(self, eve... | import logging
from django.conf import settings
from django.utils.importlib import import_module
__all__ = ('events', 'register', 'unregister')
logger = logging.getLogger('webhooks')
class AlreadyRegistered(Exception):
pass
class NotRegistered(Exception):
pass
class Events(dict):
def register(self, eve... | bsd-2-clause | Python |
5418e591980f16dbc6d74bdffb6ed7a21586fa30 | Delete empty strings from npmrc | renalreg/radar,renalreg/radar,renalreg/radar,renalreg/radar | ansible/library/npm_config.py | ansible/library/npm_config.py | #!/usr/bin/env python
from ansible.module_utils.basic import *
import re
CONFIG_REGEX = re.compile('^\s*([^=]+)\s*=\s*(.*)\s*$')
def get_value(module, key, global_flag=False):
if global_flag:
cmd = ['npm', 'config', 'get', 'globalconfig']
else:
cmd = ['npm', 'config', 'get', 'userconfig']
... | #!/usr/bin/env python
from ansible.module_utils.basic import *
import re
CONFIG_REGEX = re.compile('^\s*([^=]+)\s*=\s*(.*)\s*$')
def get_value(module, key, global_flag=False):
if global_flag:
cmd = ['npm', 'config', 'get', 'globalconfig']
else:
cmd = ['npm', 'config', 'get', 'userconfig']
... | agpl-3.0 | Python |
10b85e7d17afc048a0e8909c18dd06cf83f41412 | Update to upstream SetHostNamePlugin | pellaeon/bsd-cloudinit,bincentvaret/bsd-cloudinit,pellaeon/bsd-cloudinit,CropCircleSys/bsd-cloudinit | cloudbaseinit/plugins/freebsd/sethostname.py | cloudbaseinit/plugins/freebsd/sethostname.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Cloudbase Solutions Srl
#
# 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/LICEN... | from cloudbaseinit.osutils import factory as osutils_factory
from cloudbaseinit.plugins import base
from cloudbaseinit.openstack.common import log as logging
LOG = logging.getLogger(__name__)
class SetHostNamePlugin(base.BasePlugin):
def execute(self, service, shared_data):
meta_data = service.get_meta_da... | apache-2.0 | Python |
b56872c4dde6e5a43cb30105af17f2c63d1b9046 | Update exercises/chat/online_examples/pairserver.py | introprogramming/exercises,introprogramming/exercises,introprogramming/exercises | exercises/chat/online_examples/pairserver.py | exercises/chat/online_examples/pairserver.py | # http://learning-0mq-with-pyzmq.readthedocs.org/en/latest/pyzmq/patterns/pair.html
import time
import zmq
port = "5556"
context = zmq.Context()
socket = context.socket(zmq.PAIR)
socket.bind("tcp://*:{}".format(port))
while True:
socket.send_string("Server message to client3")
msg = socket.recv()
print(... | # http://learning-0mq-with-pyzmq.readthedocs.org/en/latest/pyzmq/patterns/pair.html
import time
import zmq
port = "5556"
context = zmq.Context()
socket = context.socket(zmq.PAIR)
socket.bind("tcp://*:%s" % port)
while True:
socket.send_string("Server message to client3")
msg = socket.recv()
print(msg)
... | mit | Python |
361c726aff465fe55f13d85fa83ce7a18b86f711 | add auth | yoshiya0503/tornado-sample,yoshiya0503/tornado-sample | middleware.py | middleware.py | #! /usr/bin/env python3
# -*- encoding: utf-8 -*-
"""
Middlewares
this is test for auth and custom-header
"""
__author__ = 'Yoshiya Ito <myon53@gmail.com>'
__version__ = '0.0.1'
__date__ = '02 Jul 2015'
import asyncio
from functools import wraps
from tornado.platform.asyncio import AsyncIOMainLoop
from tornado import ... | #! /usr/bin/env python3
# -*- encoding: utf-8 -*-
"""
Middlewares
this is test for auth and custom-header
"""
__author__ = 'Yoshiya Ito <myon53@gmail.com>'
__version__ = '0.0.1'
__date__ = '02 Jul 2015'
import asyncio
from functools import wraps
from tornado.platform.asyncio import AsyncIOMainLoop
from tornado import ... | mit | Python |
7a68993cbb8e2d9beeca3556e126bd05b8e6cdd6 | Bump version to 0.0.13 | jammycakes/lambda-tools | lambda_tools/__init__.py | lambda_tools/__init__.py | VERSION = '0.0.13' | VERSION = '0.0.12' | mit | Python |
ccaf22170bbdbe0e4d7d98db6cdad506d32b62c9 | Index keys | codein/gist,codein/gist | typist.py | typist.py | #!/usr/bin/env python
import sys
import random
import curses
import json
from datetime import datetime
asdf = ['a','s', 'd', 'f']
jkl = ['j','k', 'l', ';']
g = ['g']
h = ['h']
run_from_vikky = ['r','f','v']
uncle_joes_mad = ['u','j','m']
to_get_betty = ['t','g','b']
you_have_nothing = ['y','h','n']
index_finger_righ... | #!/usr/bin/env python
import sys
import random
import curses
import json
from datetime import datetime
asdf = ['a','s', 'd', 'f']
jkl = ['j','k', 'l', ';']
g = ['g']
h = ['h']
progress_file = file('progress.json', 'r+')
try:
progress = json.load(progress_file)
except ValueError:
progress = {}
progress_file... | unlicense | Python |
7a5871a5d93ff4b4e43151667f144cad42041c5b | Update exercises/chat/online_examples/pub_server.py | introprogramming/exercises,introprogramming/exercises,introprogramming/exercises | exercises/chat/online_examples/pub_server.py | exercises/chat/online_examples/pub_server.py | # http://learning-0mq-with-pyzmq.readthedocs.org/en/latest/pyzmq/patterns/pubsub.html
import random
import sys
import time
import zmq
port = "5556"
if len(sys.argv) > 1:
port = sys.argv[1]
int(port)
context = zmq.Context()
socket = context.socket(zmq.PUB)
socket.bind("tcp://*:{}".format(port))
while True:
... | # http://learning-0mq-with-pyzmq.readthedocs.org/en/latest/pyzmq/patterns/pubsub.html
import random
import sys
import time
import zmq
port = "5556"
if len(sys.argv) > 1:
port = sys.argv[1]
int(port)
context = zmq.Context()
socket = context.socket(zmq.PUB)
socket.bind("tcp://*:{}".format(port))
while True:
... | mit | Python |
a4213a02f00ad9e791a7aa0e6c3b985aa43274a6 | Use 'cls' instead of 'self' for name of first argument to __new__(...) | tbabej/astropy,astropy/astropy,kelle/astropy,larrybradley/astropy,mhvk/astropy,aleksandr-bakanov/astropy,joergdietrich/astropy,tbabej/astropy,stargaser/astropy,bsipocz/astropy,MSeifert04/astropy,larrybradley/astropy,larrybradley/astropy,dhomeier/astropy,larrybradley/astropy,lpsinger/astropy,mhvk/astropy,MSeifert04/astr... | astropy/constants/constant.py | astropy/constants/constant.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
class Constant(float):
"""A physical or astronomical constant.
Objects of this class behave just like `float` values when used in
expressions, but they contain additional information
Attributes
----------
name : str
The ... | # Licensed under a 3-clause BSD style license - see LICENSE.rst
class Constant(float):
"""A physical or astronomical constant.
Objects of this class behave just like `float` values when used in
expressions, but they contain additional information
Attributes
----------
name : str
The ... | bsd-3-clause | Python |
99c61947657d320ec1dcc71b7428b32ff46ddaea | Update parameters in exercise placeholder to resolve #610 | pheanex/xpython,N-Parsons/exercism-python,exercism/python,exercism/xpython,pheanex/xpython,behrtam/xpython,exercism/python,jmluy/xpython,behrtam/xpython,jmluy/xpython,smalley/python,smalley/python,N-Parsons/exercism-python,exercism/xpython | exercises/point-mutations/point_mutations.py | exercises/point-mutations/point_mutations.py | def hamming_distance(dna_strand_1, dna_strand_2):
pass
| def hamming_distance():
pass
| mit | Python |
88291b655f37310bf0fa68351950737c7ec5a5d8 | add title, description when throwing a HTTP 400 | tonytan4ever/canary,tonytan4ever/canary,rackerlabs/canary,tonytan4ever/canary,tonytan4ever/canary,rackerlabs/canary,rackerlabs/canary,rackerlabs/canary | canary/transport/wsgi/v1_0/jobs.py | canary/transport/wsgi/v1_0/jobs.py | import json
import time
import falcon
from falcon.errors import HTTPBadRequest
from oslo.config import cfg
from canary.openstack.common import log
from canary.drivers.cassandradriver import CassandraStorageDriver
from canary.util import canonicalize
conf = cfg.CONF
conf(project='canary', prog='canary', args=[])
log... | import json
import time
import falcon
from falcon.errors import HTTPBadRequest
from oslo.config import cfg
from canary.openstack.common import log
from canary.drivers.cassandradriver import CassandraStorageDriver
from canary.util import canonicalize
conf = cfg.CONF
conf(project='canary', prog='canary', args=[])
log... | apache-2.0 | Python |
6daddb0e052fd460caf1184a38827ce2dda0c4b6 | Add check for existence of feature in count_generation | mkrnr/wikiwhere | main/count_generation.py | main/count_generation.py | '''
Created on May 3, 2016
@author: Martin Koerner <info@mkoerner.de>
'''
class CountGeneration(object):
def generate_counts(self,collected_features_array,feature_name):
feature_counts = {}
for instance in collected_features_array:
if feature_name in instance:
feature ... | '''
Created on May 3, 2016
@author: Martin Koerner <info@mkoerner.de>
'''
class CountGeneration(object):
def generate_counts(self,collected_features_array,feature_name):
feature_counts = {}
for instance in collected_features_array:
feature = instance[feature_name]
if featu... | mit | Python |
4984c9b905434df3739d9829d257ded3cf02526c | Revert "Fixing #10880 trailing slashes on legacy documentation." | nanuxbe/django,alawnchen/djangoproject.com,nanuxbe/django,gnarf/djangoproject.com,gnarf/djangoproject.com,vxvinh1511/djangoproject.com,rmoorman/djangoproject.com,hassanabidpk/djangoproject.com,rmoorman/djangoproject.com,xavierdutreilh/djangoproject.com,xavierdutreilh/djangoproject.com,hassanabidpk/djangoproject.com,nan... | django_website/urls/docs.py | django_website/urls/docs.py | from django.conf import settings
from django.conf.urls.defaults import *
from haystack.views import search_view_factory
from ..docs import views
urlpatterns = patterns('',
url(
r'^$',
views.index,
),
url(
r'^search/$',
search_view_factory(view_class=views.DocSearchView),
... | from django.conf import settings
from django.conf.urls.defaults import *
from haystack.views import search_view_factory
from ..docs import views
urlpatterns = patterns('',
url(
r'^$',
views.index,
),
url(
r'^search/$',
search_view_factory(view_class=views.DocSearchView),
... | bsd-3-clause | Python |
3f9d2bb1e6cf98b380d6cdf3935a47343975b660 | Make the j2.py script show its help information when no arguments are supplied by the user | google/j2cl,google/j2cl,google/j2cl,google/j2cl,google/j2cl | dev/j2.py | dev/j2.py | #!/usr/bin/python3
# Copyright 2021 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | #!/usr/bin/python3
# Copyright 2021 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | apache-2.0 | Python |
57dec943ece7057a56349045811e0041361f0f80 | Bump pillow from 3.4.1 to 6.2.0 in /solutionbox/image_classification (#729) | googledatalab/pydatalab,googledatalab/pydatalab,googledatalab/pydatalab | solutionbox/image_classification/setup.py | solutionbox/image_classification/setup.py | # Copyright 2017 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | # Copyright 2017 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | apache-2.0 | Python |
78be1f58d618077f42d04390baf97938d01df44f | Delete line loading an unnecessary module | jwarshaw/RaspberryDrive | models/analyze_pic_server.py | models/analyze_pic_server.py | from analyze import check_blob_in_direct_path
import os
import sys
sys.path.insert(0, os.getcwd())
from get_images_from_pi import get_image, get_image_x_times
get_image()
check_blob_in_direct_path(os.getcwd() + "/images/greg.jpg") | # import analyze
from analyze import check_blob_in_direct_path
import os
import sys
sys.path.insert(0, os.getcwd())
from get_images_from_pi import get_image, get_image_x_times
get_image()
check_blob_in_direct_path(os.getcwd() + "/images/greg.jpg") | mit | Python |
255d4c35987469dcbce9ed187dcfc4aea2a1a431 | Fix equation of OU process | toslunar/chainerrl,toslunar/chainerrl | chainerrl/explorers/additive_ou.py | chainerrl/explorers/additive_ou.py | from __future__ import division
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import absolute_import
from future import standard_library
from future.utils import with_metaclass
standard_library.install_aliases()
from logging import getLogger
from chainer import cuda
imp... | from __future__ import division
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import absolute_import
from future import standard_library
from future.utils import with_metaclass
standard_library.install_aliases()
from logging import getLogger
from chainer import cuda
imp... | mit | Python |
d00191d5e93e90e6ef3132cbe1e30162b07b5079 | Remove debug traces, add decode() to CN | Atilla106/members.atilla.org,Atilla106/members.atilla.org,Atilla106/members.atilla.org,Atilla106/members.atilla.org,Atilla106/members.atilla.org | accounts/ldap/migration.py | accounts/ldap/migration.py | import codecs
import ldap.modlist as modlist
import translitcodec
from django.conf import settings
from .connection.LDAPManager import LDAPManagerConnection
from .utils import generate_crypt_password, get_biggest_LDAP_uid
def migrate_to_LDAP(pending_user, password, connection=None):
password = generate_crypt_pa... | import codecs
import ldap.modlist as modlist
import translitcodec
from django.conf import settings
from .connection.LDAPManager import LDAPManagerConnection
from .utils import generate_crypt_password, get_biggest_LDAP_uid
def migrate_to_LDAP(pending_user, password, connection=None):
password = generate_crypt_pa... | mit | Python |
1269e1492b8dc8ddd1c7e18504efca77ef09a60b | change test runner djanto to django coverage | YACOWS/opps,williamroot/opps,jeanmask/opps,jeanmask/opps,opps/opps,YACOWS/opps,jeanmask/opps,williamroot/opps,opps/opps,jeanmask/opps,opps/opps,williamroot/opps,williamroot/opps,YACOWS/opps,YACOWS/opps,opps/opps | dev_settings.py | dev_settings.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
DEBUG = True
TEMPLATE_DEBUG = DEBUG
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': None
}
}
SITE_ID = 1
USE_I18N = True
USE_L10N = True
USE_TZ = False
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.Fil... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
DEBUG = True
TEMPLATE_DEBUG = DEBUG
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': None
}
}
SITE_ID = 1
USE_I18N = True
USE_L10N = True
USE_TZ = False
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.Fil... | mit | Python |
b8f8f5e582d970f8db38d802606d41e20691a2b7 | Update imagepalette.pyde | kantel/processingpy,kantel/processingpy,kantel/processingpy | sketches/imagepalette/imagepalette.pyde | sketches/imagepalette/imagepalette.pyde | # Nach einer Idee von Kevin Workman
# (https://happycoding.io/examples/p5js/images/image-palette)
WIDTH = 800
HEIGHT = 640
genuary23 = ["#264653", "#2a9d8f", "#e9c46a", "#f4a261", "#e76f51"]
def setup():
global img
size(WIDTH, HEIGHT)
this.surface.setTitle("Image Palette")
img = loadImage("akt.jpg")
... | # Nach einer Idee von Kevin Workman
# (https://happycoding.io/examples/p5js/images/image-palette)
WIDTH = 800
HEIGHT = 640
genuary23 = ["#264653", "#2a9d8f", "#e9c46a", "#f4a261", "#e76f51"]
riley2 = [color(230, 230, 230), color(235, 200, 55), color(115, 165, 215),
color(155, 195, 80), color(230, 135, 170),... | mit | Python |
827e99d2f2060cf2fd7051fb27607b6bc5b8a991 | Remove placeholder function and import utility methods | tml/python-hangman-2017-summer | words.py | words.py | """
Pick a word from /usr/share/dict/words
"""
import subprocess
from sys import exit
import random
| def choose(**kw):
return 'quality' | mit | Python |
d89a6082d44c6c33f99d8af2774a6368630d61bf | remove NeutralInline from ScenarioAdmin | jantoniomartin/condottieri_scenarios,jantoniomartin/condottieri_scenarios | admin.py | admin.py | from django.contrib import admin
import condottieri_scenarios.models as scenarios
from condottieri_scenarios.graphics import make_scenario_map
class ContenderInline(admin.TabularInline):
model = scenarios.Contender
extra = 1
ordering = ['country']
class SetupInline(admin.TabularInline):
model = scenarios.Setup
... | from django.contrib import admin
import condottieri_scenarios.models as scenarios
from condottieri_scenarios.graphics import make_scenario_map
class ContenderInline(admin.TabularInline):
model = scenarios.Contender
extra = 1
ordering = ['country']
class SetupInline(admin.TabularInline):
model = scenarios.Setup
... | agpl-3.0 | Python |
76408043a36ffff3fe397bf4301db37c2381d1e5 | Fix include of Django Admin URLs | gpodder/mygpo,gpodder/mygpo,gpodder/mygpo,gpodder/mygpo | mygpo/urls.py | mygpo/urls.py | import os.path
from django.conf.urls import include, url
from django.contrib import admin
from django.conf import settings
from django.contrib.staticfiles.views import serve
# strip the leading "/"
static_prefix = settings.STATIC_URL[1:]
# This URLs should be always be served, even during maintenance mode
urlpatterns... | import os.path
from django.conf.urls import include, url
from django.contrib import admin
from django.conf import settings
from django.contrib.staticfiles.views import serve
# strip the leading "/"
static_prefix = settings.STATIC_URL[1:]
# This URLs should be always be served, even during maintenance mode
urlpatterns... | agpl-3.0 | Python |
7807c00be1c6583773091f26cbb0164af35cba2c | Use qualified import for task.py | praekelt/molo,praekelt/molo,praekelt/molo,praekelt/molo | molo/profiles/admin_views.py | molo/profiles/admin_views.py | from wagtail.contrib.modeladmin.views import IndexView
from wagtail.wagtailadmin import messages
from django.utils.translation import ugettext as _
from django.shortcuts import redirect
from .task import send_export_email
class FrontendUsersAdminView(IndexView):
def send_export_email_to_celery(self, email, argume... | from wagtail.contrib.modeladmin.views import IndexView
from wagtail.wagtailadmin import messages
from django.utils.translation import ugettext as _
from task import send_export_email
from django.shortcuts import redirect
class FrontendUsersAdminView(IndexView):
def send_export_email_to_celery(self, email, argumen... | bsd-2-clause | Python |
4e75e742475236cf7358b4481a29a54eb607dd4d | Update regression test for variable-length pattern problem in the matcher. | aikramer2/spaCy,oroszgy/spaCy.hu,raphael0202/spaCy,spacy-io/spaCy,explosion/spaCy,oroszgy/spaCy.hu,oroszgy/spaCy.hu,explosion/spaCy,recognai/spaCy,raphael0202/spaCy,recognai/spaCy,honnibal/spaCy,raphael0202/spaCy,recognai/spaCy,honnibal/spaCy,aikramer2/spaCy,raphael0202/spaCy,explosion/spaCy,honnibal/spaCy,Gregory-Howa... | spacy/tests/regression/test_issue850.py | spacy/tests/regression/test_issue850.py | '''
Test Matcher matches with '*' operator and Boolean flag
'''
from __future__ import unicode_literals
from __future__ import print_function
import pytest
from ...matcher import Matcher
from ...vocab import Vocab
from ...attrs import LOWER
from ...tokens import Doc
def test_basic_case():
matcher = Matcher(Vocab... | '''
Test Matcher matches with '*' operator and Boolean flag
'''
from __future__ import unicode_literals
import pytest
from ...matcher import Matcher
from ...vocab import Vocab
from ...attrs import LOWER
from ...tokens import Doc
@pytest.mark.xfail
def test_issue850():
matcher = Matcher(Vocab())
IS_ANY_TOKEN ... | mit | Python |
63e84be2384667122d263ae9adf5030de92f69ac | clean up urls to match 1.8+ | fyndsi/Django-facebook,fyndsi/Django-facebook,selwin/Django-facebook,selwin/Django-facebook,selwin/Django-facebook,fyndsi/Django-facebook | django_facebook/urls.py | django_facebook/urls.py | from django.conf.urls import url
from django.conf import settings
# help autodiscovery a bit
from django_facebook import admin
from .views import connect, disconnect, example
from .example_views import *
urlpatterns = [
url(r'^connect/$', connect, name='facebook_connect'),
url(r'^disconnect/$',
discon... | try:
from django.conf.urls import patterns, url
except ImportError:
from django.conf.urls.defaults import patterns, url
from django.conf import settings
# help autodiscovery a bit
from django_facebook import admin
urlpatterns = patterns(
'django_facebook.views',
url(r'^connect/$', 'connect', name='fac... | bsd-3-clause | Python |
63abe58c2d2426d167c430f3cdfe757b44625f0c | add docstring | zanardo/zpgdb | zpgdb.py | zpgdb.py | # -*- coding: utf-8 -*-
"""This module provides a thin wrapper to access a PostgreSQL database,
with functions to create a connection per thread, context managers to
wrap transactions, etc"""
import psycopg2
import threading
HOST = PORT = DB = USER = PASS = None
_local = threading.local()
def getdb():
"Return ... | # -*- coding: utf-8 -*-
"""This module provides a thin wrapper to access a PostgreSQL database,
with functions to create a connection per thread, context managers to
wrap transactions, etc"""
import psycopg2
import threading
HOST = PORT = DB = USER = PASS = None
_local = threading.local()
def getdb():
if not h... | bsd-2-clause | Python |
fff0db630652a2124d1524788195df6df7fd34fc | Improve get_element function with error handling | totallyhuman/py-oeis | oeis.py | oeis.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
py-oeis
A Python library to access the OEIS.
Sumant Bhaskaruni
v0.1
"""
import requests
class NegativeIndexError(IndexError):
"""Raised when a negative index is passed."""
class IndexTooHighError(IndexError):
"""Raised when an index too high to handle is... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
py-oeis
A Python library to access the OEIS.
Sumant Bhaskaruni
v0.1
"""
import requests
class Sequence(object):
"""An object to represent a single OEIS sequence.
Initializer arguments:
number (int): The OEIS sequence ID
"""
def __init__(s... | mit | Python |
96450bb87d3511d9c7fe68fa0cdfa81dd8678bfd | Add the ability to automatically add discovered tests to INSTALLED_APPs | harukaeru/django-nose,krinart/django-nose,brilliant-org/django-nose,dgladkov/django-nose,sociateru/django-nose,daineX/django-nose,daineX/django-nose,franciscoruiz/django-nose,aristiden7o/django-nose,alexhayes/django-nose,360youlun/django-nose,mzdaniel/django-nose,franciscoruiz/django-nose,disqus/django-nose,harukaeru/d... | django_nose/plugin.py | django_nose/plugin.py | import os.path
import sys
from django.conf import settings
from django.db import connections, router
from django.db.models import signals
from django.db.models.loading import get_apps, get_models, load_app
class ResultPlugin(object):
"""
Captures the TestResult object for later inspection.
nose doesn't r... | import sys
class ResultPlugin(object):
"""
Captures the TestResult object for later inspection.
nose doesn't return the full test result object from any of its runner
methods. Pass an instance of this plugin to the TestProgram and use
``result`` after running the tests to get the TestResult objec... | bsd-3-clause | Python |
8c9b6a3eab2215a1510c45490acd180d42f50a8f | update version to 0.4.2-dev | Yubico/yubikey-manager,Yubico/yubikey-manager | ykman/__init__.py | ykman/__init__.py | # Copyright (c) 2015 Yubico AB
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditi... | # Copyright (c) 2015 Yubico AB
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditi... | bsd-2-clause | Python |
75afecbcf45104839207534fbabea212ec3b1eac | set version to 0.21.0 final | dannyroberts/eulxml,emory-libraries/eulxml | eulxml/__init__.py | eulxml/__init__.py | # file eulxml/__init__.py
#
# Copyright 2010,2011 Emory University Libraries
#
# 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
#
# ... | # file eulxml/__init__.py
#
# Copyright 2010,2011 Emory University Libraries
#
# 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
#
# ... | apache-2.0 | Python |
bfee65fc956ebeb5edaa8e17dc0b15bdf0f2f07b | return list of css links instead of generator | bubenkoff/django-select2,applegrew/django-select2,hobarrera/django-select2,strongriley/django-select2,SmithsonianEnterprises/django-select2,rizumu/django-select2,bubenkoff/django-select2,applegrew/django-select2,dulaccc/django-select2,strongriley/django-select2,pbs/django-select2,SmithsonianEnterprises/django-select2,d... | django_select2/media.py | django_select2/media.py | from django.conf import settings
from django.templatetags.static import static
from . import __BOOTSTRAP as BOOTSTRAP
# Local version of DEBUG
DEBUG = settings.configured and settings.DEBUG
def django_select2_static(file):
return static('django_select2/' + file)
def get_select2_js_libs():
if DEBUG:
... | from django.conf import settings
from django.templatetags.static import static
from . import __BOOTSTRAP as BOOTSTRAP
# Local version of DEBUG
DEBUG = settings.configured and settings.DEBUG
def django_select2_static(file):
return static('django_select2/' + file)
def get_select2_js_libs():
if DEBUG:
... | mit | Python |
662a4727837c1387d96cc1efbc2f22ea7b95a2d2 | call get_user_model once per method | PetrDlouhy/django-su,adamcharnock/django-su,adamcharnock/django-su,PetrDlouhy/django-su | django_su/backends.py | django_su/backends.py | # -*- coding: utf-8 -*-
from . import get_user_model
class SuBackend(object):
supports_inactive_user = False
def authenticate(self, request=None, su=False, user_id=None, **kwargs):
if not su:
return None
user_model = get_user_model()
try:
user = user_model._... | # -*- coding: utf-8 -*-
from . import get_user_model
class SuBackend(object):
supports_inactive_user = False
def authenticate(self, request=None, su=False, user_id=None, **kwargs):
if not su:
return None
try:
user = get_user_model()._default_manager.get(
... | mit | Python |
f67d4715e6fb76d9cd84e5db34136e211287c120 | Document floats checker | DMOJ/judge,DMOJ/judge,DMOJ/judge | dmoj/checkers/floats.py | dmoj/checkers/floats.py | def check(process_output, judge_output, precision, **kwargs):
from itertools import izip
# Discount empty lines
process_lines = filter(None, process_output.split('\n'))
judge_lines = filter(None, judge_output.split('\n'))
if len(process_lines) != len(judge_lines):
return False
... | def check(process_output, judge_output, precision, **kwargs):
from itertools import izip
process_lines = filter(None, process_output.split('\n'))
judge_lines = filter(None, judge_output.split('\n'))
if len(process_lines) != len(judge_lines):
return False
epsilon = 10 ** -int(precision)
t... | agpl-3.0 | Python |
702cae55268fa7ea123d0790773693e2991e43de | Add check for Python 3.5+ in test script | UK992/saltfs,rwaweber/saltfs,servo/saltfs,servo/saltfs,ALikhachev/saltfs,UK992/saltfs,setupminimal/saltfs,rwaweber/saltfs,rwaweber/saltfs,UK992/saltfs,setupminimal/saltfs,setupminimal/saltfs,ALikhachev/saltfs,ALikhachev/saltfs | test.py | test.py | #!/usr/bin/env python3
import importlib
import os
import sys
from tests.util import color, GREEN, RED, Failure, project_path
def is_python_script(dir_entry):
return dir_entry.name.endswith('.py') and dir_entry.is_file()
def run_tests(tests):
any_failures = False
for test_spec in tests:
test_d... | #!/usr/bin/env python3
import importlib
import os
import sys
from tests.util import color, GREEN, RED, Failure, project_path
def is_python_script(dir_entry):
return dir_entry.name.endswith('.py') and dir_entry.is_file()
def run_tests(tests):
any_failures = False
for test_spec in tests:
test_d... | apache-2.0 | Python |
aa8a54c765ace8f4aa3a88fd7a956d481b1484a2 | Move some functionality into the storage module | alexgarciac/scrapi,erinspace/scrapi,icereval/scrapi,mehanig/scrapi,erinspace/scrapi,mehanig/scrapi,jeffreyliu3230/scrapi,ostwald/scrapi,CenterForOpenScience/scrapi,felliott/scrapi,CenterForOpenScience/scrapi,fabianvf/scrapi,fabianvf/scrapi,felliott/scrapi | scrapi/util/__init__.py | scrapi/util/__init__.py | import os
import errno
import importlib
from urllib2 import quote
def import_consumer(consumer_name):
# TODO Make suer that consumer_name will always import the correct module
return importlib.import_module('scrapi.consumers.{}'.format(consumer_name))
# :: Str -> Str
def doc_id_to_path(doc_id):
replacem... | import os
import errno
import importlib
from scrapi import settings
def import_consumer(consumer_name):
# TODO Make suer that consumer_name will always import the correct module
return importlib.import_module('scrapi.consumers.{}'.format(consumer_name))
def build_norm_dir(consumer_name, timestamp, norm_doc... | apache-2.0 | Python |
74c726d5fa144bc2ef3e30e3934866ba852f308e | fix path_to_send path | CIRCL/AIL-framework,CIRCL/AIL-framework,CIRCL/AIL-framework,CIRCL/AIL-framework | bin/feeder/pystemon-feeder.py | bin/feeder/pystemon-feeder.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# This file is part of AIL framework - Analysis Information Leak framework
#
# This a simple feeder script feeding data from pystemon to AIL.
#
# Don't forget to set your pystemonpath and ensure that the
# configuration matches this script. Default is Redis DB 10.
#
# ht... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# This file is part of AIL framework - Analysis Information Leak framework
#
# This a simple feeder script feeding data from pystemon to AIL.
#
# Don't forget to set your pystemonpath and ensure that the
# configuration matches this script. Default is Redis DB 10.
#
# ht... | agpl-3.0 | Python |
e33c0e27417cb3b96330bf1a8ae877926b22ff6d | clarify 'tooltip' in multiline tooltip example | jakevdp/altair,altair-viz/altair | altair/vegalite/v2/examples/multiline_tooltip.py | altair/vegalite/v2/examples/multiline_tooltip.py | """
Multi-Line Tooltip
==================
This example shows how you can use selections and layers to create a
tooltip-like behavior tied to the x position of the cursor.
If you are looking for more standard tooltips, it is recommended to use the
tooltip encoding channel as shown in the
`Scatter Plot With Tooltips <htt... | """
Multi-Line Tooltip
==================
This example shows how you can use selections and layers to create a
multi-line tooltip that tracks the x position of the cursor.
To find the x-position of the cursor, we employ a little trick: we add some
transparent points with only an x encoding (no y encoding) and tie a
*n... | bsd-3-clause | Python |
30d29ffc64466f24447a76943894a9f25ed07545 | fix attribute error on handlers loading (cherry picked from commit cd9e9efd8587b5be9e3d9a4e7efeaf26b048b0d2) | caktus/rapidsms,caktus/rapidsms,unicefuganda/edtrac,lsgunth/rapidsms,catalpainternational/rapidsms,catalpainternational/rapidsms,unicefuganda/edtrac,catalpainternational/rapidsms,peterayeni/rapidsms,ehealthafrica-ci/rapidsms,ehealthafrica-ci/rapidsms,lsgunth/rapidsms,unicefuganda/edtrac,eHealthAfrica/rapidsms,peterayen... | lib/rapidsms/contrib/handlers/settings.py | lib/rapidsms/contrib/handlers/settings.py | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
INSTALLED_HANDLERS = None
EXCLUDED_HANDLERS = []
RAPIDSMS_HANDLERS_EXCLUDE_APPS = [] | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
INSTALLED_HANDLERS = None
EXCLUDED_HANDLERS = []
| bsd-3-clause | Python |
66a97c665583a66132f9eca86c6380e71452feca | Fix typings of deaf and mute in PartialMember | rapptz/discord.py,Rapptz/discord.py | discord/types/member.py | discord/types/member.py | """
The MIT License (MIT)
Copyright (c) 2015-present Rapptz
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, merg... | """
The MIT License (MIT)
Copyright (c) 2015-present Rapptz
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, merg... | mit | Python |
117dbc6861472d56519c8cdfe2de4bbb62a497a4 | Fix integration tests | wiaio/wia-python-sdk,wiaio/wia-python-sdk,wiaio/wia-python-sdk | wia/test/__init__.py | wia/test/__init__.py | try:
import unittest2 as unittest
except ImportError:
import unittest
import os
def all():
path = os.path.dirname(os.path.realpath(__file__))
return unittest.defaultTestLoader.discover(path)
def resources():
path = os.path.dirname(os.path.realpath(__file__))
return unittest.defaultTestLoader.... | import wia
import os
def all():
path = os.path.dirname(os.path.realpath(__file__))
return unittest2.defaultTestLoader.discover(path)
def resources():
path = os.path.dirname(os.path.realpath(__file__))
return unittest2.defaultTestLoader.discover(
os.path.join(path, "resources"))
| mit | Python |
5297d20c7800291f5f6b3aa37c4200a2c82e1a59 | update test_startup imports | masschallenge/django-accelerator,masschallenge/django-accelerator | accelerator/tests/test_startup.py | accelerator/tests/test_startup.py | # MIT License
# Copyright (c) 2017 MassChallenge, Inc.
from django.test import TestCase
from accelerator.tests.factories.startup_factory import StartupFactory
class TestStartup(TestCase):
def test_startup(self):
startup = StartupFactory()
self.assertTrue(startup.organization.name in str(startup))... | # MIT License
# Copyright (c) 2017 MassChallenge, Inc.
from django.test import TestCase
from .factories.startup_factory import StartupFactory
class TestStartup(TestCase):
def test_startup(self):
startup = StartupFactory()
self.assertTrue(startup.organization.name in str(startup))
| mit | Python |
fa8783f3307582dafcf636f5c94a7e4cff05724b | Fix error in loading trees | karel-brinda/prophyle,karel-brinda/prophyle,karel-brinda/prophyle,karel-brinda/prophyle | bin/tree_print_fasta_names.py | bin/tree_print_fasta_names.py | #! /usr/bin/env python3
import os
import shutil
import datetime
import sys
from ete3 import Tree
DEFAULT_FORMAT = 1
class TreeIndex:
def __init__(self,tree_newick_fn,format=DEFAULT_FORMAT):
self.tree_newick_fn=tree_newick_fn
self.tree=Tree(tree_newick_fn,format=format)
def process_node(self,node):
if node... | #! /usr/bin/env python3
import os
import shutil
import datetime
import sys
import argparse
from ete3 import Tree
import logging
DEFAULT_FORMAT = 1
class TreeIndex:
def __init__(self,tree_newick_fn,format=DEFAULT_FORMAT):
self.tree_newick_fn=tree_newick_fn
self.tree=read_newick(tree_newick_fn,format=format)
... | mit | Python |
2efaaee7bc0f43b6ed7c21dc9399b9df7865d099 | fix pulsar/trollius setup | EndPointCorp/lg_ros_nodes,EndPointCorp/lg_ros_nodes,EndPointCorp/lg_ros_nodes,EndPointCorp/lg_ros_nodes,EndPointCorp/lg_ros_nodes,EndPointCorp/lg_ros_nodes | lg_cms_director/setup.py | lg_cms_director/setup.py | #!/usr/bin/env python
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
d = generate_distutils_setup(
packages=[
'trollius',
'pulsar',
'pulsar.apps',
'pulsar.async',
'pulsar.utils',
'pulsar.apps.tasks',
'pulsar.app... | #!/usr/bin/env python
from distutils.core import setup
from catkin_pkg.packages import find_packages
from catkin_pkg.python_setup import generate_distutils_setup
d = generate_distutils_setup(
packages=find_packages('src'),
package_dir={'': 'src'},
scripts=[],
requires=[]
)
setup(**d)
# vim: tabstop=... | apache-2.0 | Python |
906a4e44e6396fe65e26e1efa9d28a4f950159d9 | Use better set comprehensions to check MIME type implementation | Ghostkeeper/Luna | plugins/data/datatype/__init__.py | plugins/data/datatype/__init__.py | #!/usr/bin/env python
#-*- coding: utf-8 -*-
#This software is distributed under the Creative Commons license (CC0) version 1.0. A copy of this license should have been distributed with this software.
#The license can also be read online: <https://creativecommons.org/publicdomain/zero/1.0/>. If this online license dif... | #!/usr/bin/env python
#-*- coding: utf-8 -*-
#This software is distributed under the Creative Commons license (CC0) version 1.0. A copy of this license should have been distributed with this software.
#The license can also be read online: <https://creativecommons.org/publicdomain/zero/1.0/>. If this online license dif... | cc0-1.0 | Python |
121e4eec15fdfef17fa7dad741b739465d208823 | update stimulus process script | sealhuang/brainCodingToolbox,CASIANICA/brainDecodingToolbox,CASIANICA/brainDecodingToolbox,sealhuang/brainDecodingToolbox,sealhuang/brainCodingToolbox,sealhuang/brainDecodingToolbox | brainDecTool/vim2/stim_pro.py | brainDecTool/vim2/stim_pro.py | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
import os
import numpy as np
from brainDecTool.util import configParser
from brainDecTool.timeseries import hrf
# config parser
cf = configParser.Config('config')
data_dir = cf.get('base', 'path')
stim_d... | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
import os
import numpy as np
from brainDecTool.util import configParser
from brainDecTool.timeseries import hrf
# config parser
cf = configParser.Config('config')
data_dir = cf.get('base', 'path')
stim_d... | bsd-3-clause | Python |
a20c6d072d70c535ed1f116fc04016c834ea9c14 | Fix getdoctarget to ignore comment lines | etataurov/pytest,gabrielcnr/pytest,mbirtwell/pytest,vodik/pytest,The-Compiler/pytest,omarkohl/pytest,Bjwebb/pytest,davidszotten/pytest,gabrielcnr/pytest,mdboom/pytest,ionelmc/pytest,malinoff/pytest,hpk42/pytest,tareqalayan/pytest,userzimmermann/pytest,rouge8/pytest,tgoodlet/pytest,abusalimov/pytest,bukzor/pytest,icemac... | doc/en/_getdoctarget.py | doc/en/_getdoctarget.py | #!/usr/bin/env python
import py
def get_version_string():
fn = py.path.local(__file__).join("..", "..", "..",
"_pytest", "__init__.py")
for line in fn.readlines():
if "version" in line and not line.strip().startswith('#'):
return eval(line.split("=")[-... | #!/usr/bin/env python
import py
def get_version_string():
fn = py.path.local(__file__).join("..", "..", "..",
"_pytest", "__init__.py")
for line in fn.readlines():
if "version" in line:
return eval(line.split("=")[-1])
def get_minor_version_string():
... | mit | Python |
845c399fe7ac478f4a007d6a4183c3d1cd00ef2f | Fix ASCII file storage for django 2 | Instanssi/Instanssi.org,Instanssi/Instanssi.org,Instanssi/Instanssi.org,Instanssi/Instanssi.org | Instanssi/common/storage.py | Instanssi/common/storage.py | # -*- coding: utf-8 -*-
import unicodedata
from django.core.files.storage import FileSystemStorage
class ASCIIFileSystemStorage(FileSystemStorage):
def get_valid_name(self, name):
name = unicodedata.normalize('NFKD', name).encode('ascii', 'ignore').decode()
return super(ASCIIFileSystemStorage, se... | # -*- coding: utf-8 -*-
import unicodedata
from django.core.files.storage import FileSystemStorage
class ASCIIFileSystemStorage(FileSystemStorage):
def get_valid_name(self, name):
name = unicodedata.normalize('NFKD', name).encode('ascii', 'ignore')
return super(ASCIIFileSystemStorage, self).get_v... | mit | Python |
dc311b139c49f709456b3f9e1aabb6e98a9b8dc7 | add Bioclim missing hdr files. fixes #380 | davharris/retriever,goelakash/retriever,davharris/retriever,henrykironde/deletedret,davharris/retriever,goelakash/retriever,henrykironde/deletedret | scripts/bioclim_2pt5.py | scripts/bioclim_2pt5.py | #retriever
"""Retriever script for direct download of Bioclim data"""
from retriever.lib.templates import Script
class main(Script):
def __init__(self, **kwargs):
Script.__init__(self, **kwargs)
self.name = "Bioclim 2.5 Minute Climate Data"
self.shortname = "Bioclim"
self.ref = "... | #retriever
"""Retriever script for direct download of Bioclim data"""
from retriever.lib.templates import Script
class main(Script):
def __init__(self, **kwargs):
Script.__init__(self, **kwargs)
self.name = "Bioclim 2.5 Minute Climate Data"
self.shortname = "Bioclim"
self.ref = "... | mit | Python |
24f00935e26c0a009ad0020bd8f0c8e4e0f95246 | fix auth log | kumar303/olympia,Joergen/olympia,psiinon/addons-server,Hitechverma/zamboni,mozilla/olympia,Revanth47/addons-server,eviljeff/zamboni,mstriemer/olympia,Hitechverma/zamboni,aviarypl/mozilla-l10n-addons-server,wagnerand/addons-server,mozilla/addons-server,Jobava/zamboni,yfdyh000/olympia,mstriemer/zamboni,eviljeff/olympia,e... | mkt/api/authorization.py | mkt/api/authorization.py | import commonware.log
from tastypie.authorization import Authorization, ReadOnlyAuthorization
from access import acl
log = commonware.log.getLogger('z.api')
class AnonymousReadOnlyAuthorization(ReadOnlyAuthorization):
"""
Allows read-only access for anonymous users and optional auth for
authenticated us... | import commonware.log
from tastypie.authorization import Authorization, ReadOnlyAuthorization
from access import acl
log = commonware.log.getLogger('z.api')
class AnonymousReadOnlyAuthorization(ReadOnlyAuthorization):
"""
Allows read-only access for anonymous users and optional auth for
authenticated us... | bsd-3-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.