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 |
|---|---|---|---|---|---|---|---|---|
1932f69012c6247d89b55bbcd7fbd4f1c668a81d | Implement validate() for Greek numbers | t0mk/python-stdnum,arthurdejong/python-stdnum,arthurdejong/python-stdnum,arthurdejong/python-stdnum,holvi/python-stdnum,tonyseek/python-stdnum,holvi/python-stdnum,dchoruzy/python-stdnum,holvi/python-stdnum | stdnum/gr/vat.py | stdnum/gr/vat.py | # vat.py - functions for handling Greek VAT numbers
# coding: utf-8
#
# Copyright (C) 2012, 2013 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of t... | # vat.py - functions for handling Greek VAT numbers
# coding: utf-8
#
# Copyright (C) 2012 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the Lic... | lgpl-2.1 | Python |
04c34f3cdef190d0700ecb63e4d33693ccdd68eb | add missing imports | carolFrohlich/nipype,sgiavasis/nipype,sgiavasis/nipype,carolFrohlich/nipype,carolFrohlich/nipype,FCP-INDI/nipype,sgiavasis/nipype,FCP-INDI/nipype,FCP-INDI/nipype,mick-d/nipype,sgiavasis/nipype,mick-d/nipype,FCP-INDI/nipype,mick-d/nipype,carolFrohlich/nipype,mick-d/nipype | nipype/interfaces/dipy/base.py | nipype/interfaces/dipy/base.py | # -*- coding: utf-8 -*-
import numpy as np
import os.path as op
from nipype.interfaces.base import (traits, File, isdefined,
BaseInterface, BaseInterfaceInputSpec)
class DipyBaseInterfaceInputSpec(BaseInterfaceInputSpec):
in_file = File(exists=True, mandatory=True, desc=('input... | # -*- coding: utf-8 -*-
from nipype.interfaces.base import (traits, File, isdefined,
BaseInterface, BaseInterfaceInputSpec)
class DipyBaseInterfaceInputSpec(BaseInterfaceInputSpec):
in_file = File(exists=True, mandatory=True, desc=('input diffusion data'))
in_bval = File(ex... | bsd-3-clause | Python |
b09e32f56ad2c8c26ddc1fb7af5a2dbd376cfb66 | copy the transaction_ref to the move lines from the invoice | BT-jmichaud/bank-statement-reconcile,damdam-s/bank-statement-reconcile,jakar/odoo-bank-statement-reconcile,raycarnes/bank-statement-reconcile,StefanRijnhart/bank-statement-reconcile,brain-tec/bank-statement-reconcile,brain-tec/bank-statement-reconcile,damdam-s/bank-statement-reconcile,StefanRijnhart/bank-statement-reco... | base_transaction_id/invoice.py | base_transaction_id/invoice.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Nicolas Bessi
# Copyright 2011-2012 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# ... | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Nicolas Bessi
# Copyright 2011-2012 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# ... | agpl-3.0 | Python |
2389c241de57b5fb9e96b9be6c442e98e76d4cbc | fix for tests | boazmohar/pySparkUtils | test/test_change.py | test/test_change.py | from builtins import str
from pySparkUtils.utils import change
import pytest
pytestmark = pytest.mark.usefixtures("eng")
def test_ip_wait(eng):
with pytest.raises(RuntimeError) as ex:
_ = change(sc=eng, master='local[2]', fail_on_timeout=True, wait='ips', min_ips=10, timeout=4)
assert 'Time out' in st... | from builtins import str
from pySparkUtils.utils import change
import pytest
pytestmark = pytest.mark.usefixtures("eng")
def test_ip_wait(eng):
with pytest.raises(RuntimeError) as ex:
_ = change(sc=eng, master='local[2]', fail_on_timeout=True, wait='ips', min_ips=10, timeout=4)
assert 'Time out' in st... | mit | Python |
46a279dcc5cd8501564cb9eac351e25182037c89 | Remove unnecessary imports | thombashi/SimpleSQLite,thombashi/SimpleSQLite | test/test_pandas.py | test/test_pandas.py | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>
"""
from __future__ import unicode_literals
import pytest
from simplesqlite import connect_sqlite_db_mem
from simplesqlite.sqlquery import SqlQuery
try:
import pandas
PANDAS_IMPORT = True
except ImportError:
PANDAS_IMPORT = F... | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>
"""
from __future__ import unicode_literals
from decimal import Decimal
from pytablereader import (
TableData,
InvalidDataError,
)
import pytest
from simplesqlite import connect_sqlite_db_mem
from simplesqlite.sqlquery import SqlQ... | mit | Python |
e6705dea451b0e94763b89f2d4d2ee7201e6a858 | fix test_travis.py | intracom-telecom-sdn/multinet,intracom-telecom-sdn/multinet,intracom-telecom-sdn/multinet | test/test_travis.py | test/test_travis.py | #!/usr/bin/env python
import json
import util.multinet_requests as m_util
import os
import pytest
@pytest.fixture
def config():
data = {}
with open('config/test-config.json') as test_config:
data = json.load(test_config)
return data
def test_init(config):
res = m_util.master_cmd(config['mast... | #!/usr/bin/env python
import json
import util.multinet_requests as m_util
import os
import pytest
@pytest.fixture
def config():
data = {}
with open('config/test-config.json') as test_config:
data = json.load(test_config)
return data
def test_init(config):
res = m_util.master_cmd(config['mast... | epl-1.0 | Python |
89407fb5cd387ca07eec827da93442f9fa21d899 | test args | mwhooker/jsonselect | test_conformance.py | test_conformance.py | #!/usr/bin/python
import argparse
import glob
import os
import os.path
from jsonselect import select
def get_ctests(test_path):
inputs = {}
for selector_path in glob.iglob(os.path.join(test_path, '*.selector')):
selector_file = os.path.basename(selector_path)
root, ext = os.path.splitext(sele... | #!/usr/bin/python
import functools
import os
import os.path
import logging
from jsonselect import select
from collections import defaultdict, namedtuple
log = logging.getLogger(__name__)
TestInputs = namedtuple('TestInputs', ['selector', 'input', 'output'])
def find_files(files):
"""
Group directory listin... | isc | Python |
8dfb56057a8e3288cce535f9d5a60d400ab0502f | allow to run from anywhere | vimeo/graph-explorer,vimeo/graph-explorer,vimeo/graph-explorer,dbirchak/graph-explorer,dbirchak/graph-explorer,dbirchak/graph-explorer,vimeo/graph-explorer,dbirchak/graph-explorer | process_alerting.py | process_alerting.py | #!/usr/bin/python2
import alerting
from backend import make_config
import os
app_dir = os.path.dirname(__file__)
if app_dir:
os.chdir(app_dir)
import config
config = make_config(config)
db = alerting.Db(config.alerting_db)
rules = db.get_rules()
for rule in rules:
print "rule", rule
try:
value = ... | #!/usr/bin/python2
import alerting
import config
from backend import make_config
config = make_config(config)
db = alerting.Db(config.alerting_db)
rules = db.get_rules()
for rule in rules:
print "rule", rule
try:
value = rule.get_value(config)
except Exception, e:
print "could not process:... | apache-2.0 | Python |
0321d00276d803d5abee63f2a899681bd569235a | Return if keyword is already being tracked. | musalbas/listentotwitter,musalbas/listentotwitter,musalbas/listentotwitter | noisytweets/keywordsmanager.py | noisytweets/keywordsmanager.py | import time
from noisytweets.tweetstreamer import TweetStreamer
class KeywordsManager:
max_keywords = 100
ping_timeout = 30
def __init__(self):
self._keywords_tracking = []
self._keywords_info = {}
self._tweetstreamer = TweetStreamer()
def _get_dead_keywords():
dead... | import time
from noisytweets.tweetstreamer import TweetStreamer
class KeywordsManager:
max_keywords = 100
ping_timeout = 30
def __init__(self):
self._keywords_tracking = []
self._keywords_info = {}
self._tweetstreamer = TweetStreamer()
def _get_dead_keywords():
dead... | agpl-3.0 | Python |
f58da8baebebbabd51bfd9addef706c1e7699c4b | Update codes | tody411/NPR-SFS | npr_sfs/io/image.py | npr_sfs/io/image.py |
# -*- coding: utf-8 -*-
## @package npr_sfs.io.image
#
# Image io functions.
# @author tody
# @date 2015/07/29
import cv2
from npr_sfs.cv.image import *
from npr_sfs.cv.normal import colorToNormal, normalToColor
def loadGray(file_path):
bgr = cv2.imread(file_path)
gray = cv2.cvtColor(bgr, cv... |
# -*- coding: utf-8 -*-
## @package npr_sfs.io.image
#
# Image io functions.
# @author tody
# @date 2015/07/29
import cv2
from npr_sfs.cv.image import *
from npr_sfs.cv.normal import colorToNormal, normalToColor
def loadGray(file_path):
bgr = cv2.imread(file_path)
gray = cv2.cvtColor(bgr, cv... | mit | Python |
fea6695a9fd361408cdbdfd84f400091238ef33e | Update BVT-LAST-CONSOLE-CHECK.py | konkasoftci/azure-linux-automation,Nidylei/azure-linux-automation,Nidylei/azure-linux-automation,v-sirebb/azure-linux-automation,FreeBSDonHyper-V/azure-freebsd-automation,hglkrijger/azure-linux-automation,hglkrijger/azure-linux-automation,v-sirebb/azure-linux-automation,FreeBSDonHyper-V/azure-freebsd-automation,FreeBSD... | remote-scripts/BVT-LAST-CONSOLE-CHECK.py | remote-scripts/BVT-LAST-CONSOLE-CHECK.py | #!/usr/bin/python
from azuremodules import *
def RunTest(command):
UpdateState("TestRunning")
RunLog.info("Checking for last console as console=ttys0 in kernel boot line.")
output = Run(command)
if (output and output.rfind(" console=") == output.rfind(" console=ttyS0")) :
RunLog.info('console... | #!/usr/bin/python
from azuremodules import *
def RunTest(command):
UpdateState("TestRunning")
RunLog.info("Checking for last console as console=ttys0 in kernel boot line.")
output = Run(command)
if (output and output.rfind("console=") == output.rfind("console=ttyS0")) :
RunLog.info('console=t... | apache-2.0 | Python |
998ab6f457a04ab24bbe062d9704242a207356fb | Handle inplace generation of __config__. | efiring/numpy-work,Ademan/NumPy-GSoC,jasonmccampbell/numpy-refactor-sprint,efiring/numpy-work,illume/numpy3k,Ademan/NumPy-GSoC,illume/numpy3k,teoliphant/numpy-refactor,jasonmccampbell/numpy-refactor-sprint,chadnetzer/numpy-gaurdro,chadnetzer/numpy-gaurdro,efiring/numpy-work,jasonmccampbell/numpy-refactor-sprint,teoliph... | numpy/setupscons.py | numpy/setupscons.py | #!/usr/bin/env python
from os.path import join as pjoin
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
from numpy.distutils.misc_util import scons_generate_config_py
pkgname = 'numpy'
config = Configuration(pkgname,parent_package,top_path, setup... | #!/usr/bin/env python
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('numpy',parent_package,top_path, setup_name = 'setupscons.py')
config.add_subpackage('distutils')
config.add_subpackage('testing')
config.add_subpacka... | bsd-3-clause | Python |
ac82b38ff235ab7d0af18111b29d028d1fdf62c6 | Bump utils to 40.3.0 | alphagov/notifications-utils | notifications_utils/version.py | notifications_utils/version.py | __version__ = '40.3.0'
| __version__ = '40.2.1'
| mit | Python |
e75d9d5625c0810696f7c028bb78a56a0ffb07d1 | fix split test | hall-lab/svtools,hall-lab/svtools,abelhj/svtools,abelhj/svtools,ernfrid/svtools,abelhj/svtools,hall-lab/svtools,ernfrid/svtools,abelhj/svtools | tests/l_bp_tests.py | tests/l_bp_tests.py | from unittest import TestCase, main
from l_bp import *
class Test_l_bp(TestCase):
def test_find_all(self):
test_string = 'ABBA'
sub_string = 'A'
result = [ x for x in find_all(test_string, sub_string) ]
self.assertEqual(result, [0,3])
def test_to_map(self):
string = 'N... | from unittest import TestCase, main
from l_bp import *
class Test_l_bp(TestCase):
def test_find_all(self):
test_string = 'ABBA'
sub_string = 'A'
result = [ x for x in find_all(test_string, sub_string) ]
self.assertEqual(result, [0,3])
def test_to_map(self):
string = 'N... | mit | Python |
88f1c18b6c4eaf1c728d66bbbdc71f11a21c13be | Upgrade to v1.5.0 | biolink/ontobio,biolink/ontobio | ontobio/__init__.py | ontobio/__init__.py | from __future__ import absolute_import
__version__ = '1.5.0'
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.4.7'
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 |
98f3b101f8717c02586095fde932843d85d31cd1 | Generalize exec to work for nnlg and min | acjones617/scipy-node,acjones617/scipy-node | optimize/py/exec.py | optimize/py/exec.py | import main as m
from sympy.utilities.lambdify import lambdify
import json
import argparse
import ast
parser = argparse.ArgumentParser()
parser.add_argument('operation')
parser.add_argument('a')
parser.add_argument('b')
args = parser.parse_args()
operation = args.operation
if operation == 'minimize':
func ... | import main as m
from sympy.utilities.lambdify import lambdify
import json
import argparse
import ast
parser = argparse.ArgumentParser()
parser.add_argument('operation')
parser.add_argument('func')
parser.add_argument('options')
args = parser.parse_args()
operation = args.operation
func = args.func
options ... | mit | Python |
eddfb3163595daf31ddb999519146b0e3fb3b60a | Remove LED side effect from greatfet_info | greatscottgadgets/greatfet,greatscottgadgets/greatfet,dominicgs/GreatFET-experimental,greatscottgadgets/greatfet,dominicgs/GreatFET-experimental,dominicgs/GreatFET-experimental,greatscottgadgets/greatfet | host/greatfet/commands/greatfet_info.py | host/greatfet/commands/greatfet_info.py | #!/usr/bin/env python
#
# Copyright 2015 Dominic Spill <dominicgs@gmail.com)
# 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 n... | #!/usr/bin/env python
#
# Copyright 2015 Dominic Spill <dominicgs@gmail.com)
# 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 n... | bsd-3-clause | Python |
d7b776c521fa13d74ee455c6ea56fc431f5dc321 | Update test model | Hironsan/anago | tests/test_model.py | tests/test_model.py | import os
import unittest
from anago.models import BiLSTMCRF
SAVE_ROOT = os.path.join(os.path.dirname(__file__), 'models')
class TrainerTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
if not os.path.exists(SAVE_ROOT):
os.mkdir(SAVE_ROOT)
cls.weights_file = os.path.joi... | import os
import unittest
from anago.utils import load_data_and_labels
from anago.models import BiLSTMCRF
get_path = lambda path: os.path.join(os.path.dirname(__file__), path)
DATA_ROOT = get_path('../data/conll2003/en/ner')
SAVE_ROOT = get_path('models') # trained model
class TrainerTest(unittest.TestCase):
... | mit | Python |
ca4cdc154216d5e20575c1f7ce7942b65a0bacc5 | fix bug which arises because of matplotlib version difference? | bueler/p4pdes,bueler/p4pdes,bueler/p4pdes,bueler/p4pdes | tex/figs/absstab.py | tex/figs/absstab.py | #!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
def feuler(z):
return 1.0 + z
def frk2a(z):
return 1.0 + z + z*z/2.0
def fbeuler(z):
return 1.0 / (1.0 - z)
def ftrap(z):
return (1.0 + z/2.0) / (1.0 - z/2.0)
x, y = np.linspace(-3.0,2.5,250), np.linspace(-2.2,2.2,200)
xx, yy... | #!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
def feuler(z):
return 1.0 + z
def frk2a(z):
return 1.0 + z + z*z/2.0
def fbeuler(z):
return 1.0 / (1.0 - z)
def ftrap(z):
return (1.0 + z/2.0) / (1.0 - z/2.0)
x, y = np.linspace(-3.0,2.5,250), np.linspace(-2.2,2.2,200)
xx, yy... | mit | Python |
8111119d231f89ac4a4bcaf39f7077773a91b463 | allow build on Python 2.1 | visionegg/visionegg,visionegg/visionegg,visionegg/visionegg,visionegg/visionegg,visionegg/visionegg | swig_src/make.py | swig_src/make.py | #!/usr/bin/env python
import os, shutil, sys
# This works on swig == 1.3.17 (And not on swig == 1.3.13).
# Check for swig version if possible
try:
import commands
except:
print "Unable to check for proper SWIG version because the commands module did not load."
swig_command = "swig"
if len(sys.argv) > 1:
... | #!/usr/bin/env python
import os, shutil, sys
# This works on swig == 1.3.17 (And not on swig == 1.3.13).
# Check for swig version if possible
try:
import commands
except:
print "Unable to check for proper SWIG version because the commands module did not load."
swig_command = "swig"
if len(sys.argv) > 1:
... | lgpl-2.1 | Python |
7644ed0e5f0fb3f57798ae65ecd87488d6a7cee1 | Remove locking logic from sync watchdog | abs0/tapiriik,marxin/tapiriik,cgourlay/tapiriik,cheatos101/tapiriik,brunoflores/tapiriik,olamy/tapiriik,abs0/tapiriik,abs0/tapiriik,cmgrote/tapiriik,marxin/tapiriik,cheatos101/tapiriik,mjnbike/tapiriik,cheatos101/tapiriik,campbellr/tapiriik,gavioto/tapiriik,abhijit86k/tapiriik,cpfair/tapiriik,dmschreiber/tapiriik,niosu... | sync_watchdog.py | sync_watchdog.py | from tapiriik.database import db, close_connections
from tapiriik.sync import SyncStep
import os
import signal
import socket
from datetime import timedelta, datetime
print("Sync watchdog run at %s" % datetime.now())
host = socket.gethostname()
for worker in db.sync_workers.find({"Host": host}):
# Does the proces... | from tapiriik.database import db, close_connections
from tapiriik.sync import SyncStep
import os
import signal
import socket
from datetime import timedelta, datetime
print("Sync watchdog run at %s" % datetime.now())
host = socket.gethostname()
for worker in db.sync_workers.find({"Host": host}):
# Does the proces... | apache-2.0 | Python |
099c5ab2e958f20cb3c17b6aff4e8059f3ab63c8 | split api/adapter logic for availableproperties | 596acres/django-external-data-sync | synchronizers.py | synchronizers.py | """
Infrastructure for periodically synchronizing data sources. Users of this
framework should define a Synchronizer sublcass for every DataSource subclass.
"""
import logging
from django.utils.timezone import now
logger = logging.getLogger(__name__)
def find_synchronizer(source_name):
target_synchronizer = s... | """
Infrastructure for periodically synchronizing data sources. Users of this
framework should define a Synchronizer sublcass for every DataSource subclass.
"""
from django.utils.timezone import now
def find_synchronizer(source_name):
target_synchronizer = source_name + 'synchronizer'
for synchronizer in Syn... | agpl-3.0 | Python |
69e93d872e454a5fee72e19c88e1630f84159e89 | Remove unused import | pudo/spendb,CivicVision/datahub,openspending/spendb,nathanhilbert/FPA_Core,spendb/spendb,pudo/spendb,johnjohndoe/spendb,johnjohndoe/spendb,USStateDept/FPA_Core,nathanhilbert/FPA_Core,openspending/spendb,USStateDept/FPA_Core,CivicVision/datahub,johnjohndoe/spendb,pudo/spendb,spendb/spendb,spendb/spendb,USStateDept/FPA_C... | openspending/tasks/__init__.py | openspending/tasks/__init__.py | import logging
from celery.task import task
log = logging.getLogger(__name__)
@task(ignore_result=True)
def ping():
log.info("Pong.")
@task(ignore_result=True)
def analyze_all_sources():
from openspending.model import Source, meta as db
for source in db.session.query(Source):
analyze_source.del... | import logging
from celery.task import task
import openspending.command.celery
log = logging.getLogger(__name__)
@task(ignore_result=True)
def ping():
log.info("Pong.")
@task(ignore_result=True)
def analyze_all_sources():
from openspending.model import Source, meta as db
for source in db.session.query... | agpl-3.0 | Python |
951f8b2d049a8d5b2e8ec8285c2f62a54286ca29 | Bump version | vmalloc/pact | pact/__version__.py | pact/__version__.py | __version__ = "1.8.0"
| __version__ = "1.7.0"
| bsd-3-clause | Python |
8806f3d507cae20935da0eda237847e58febf55a | add optional arg to remove incompatible glyph hinting | googlefonts/gftools,googlefonts/gftools | bin/gftools-check-vtt-compile.py | bin/gftools-check-vtt-compile.py | #!/usr/bin/env python3
"""Check if a font's VTT hinting can be compiled with vttLib"""
from vttLib import *
from fontTools.ttLib import TTFont
import argparse
def main():
parser = argparse.ArgumentParser()
parser.add_argument("font_path")
parser.add_argument("-f", "--remove-incompatible-hinting", action="s... | #!/usr/bin/env python3
"""Check if a font's VTT hinting can be compiled with vttLib"""
from vttLib import *
from fontTools.ttLib import TTFont
import argparse
def main():
parser = argparse.ArgumentParser()
parser.add_argument("font_path")
args = parser.parse_args()
font = TTFont(args.font_path)
if... | apache-2.0 | Python |
3ddaf62f073939cc1a55ebd3c30a64b2ba273ce4 | Bump to 4.11.1 | MaTriXy/thumbor,thumbor/thumbor,abaldwin1/thumbor,scorphus/thumbor,grevutiu-gabriel/thumbor,camargoanderso/thumbor,2947721120/thumbor,thumbor/thumbor,adeboisanger/thumbor,gselva/thumbor,jdunaravich/thumbor,jiangzhonghui/thumbor,scorphus/thumbor,aaxx/thumbor,gi11es/thumbor,raphaelfruneaux/thumbor,gselva/thumbor,Bladrak/... | thumbor/__init__.py | thumbor/__init__.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/globocom/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com timehome@corp.globo.com
'''This is the main module in thumbor'''
__version__ = "4.11.1"
| #!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/globocom/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com timehome@corp.globo.com
'''This is the main module in thumbor'''
__version__ = "4.11.0"
| mit | Python |
9cca8fac839cc4cdf649a26c89c7383e643395b7 | Convert stderr to string. | ChinaNetCloud/nc-backup-py,ChinaNetCloud/nc-backup-py | nc-backup-py/execution/subprocess_execution.py | nc-backup-py/execution/subprocess_execution.py | from Queue import Queue, Empty
try:
from subprocess import check_output, CalledProcessError
except ImportError:
print "Unable to import subprocess.check_output, are you using python 2.6?"
print "Using self defined check_output."
from subprocess_patch import check_output, CalledProcessError
class Subp... | from Queue import Queue, Empty
try:
from subprocess import check_output, CalledProcessError
except ImportError:
print "Unable to import subprocess.check_output, are you using python 2.6?"
print "Using self defined check_output."
from subprocess_patch import check_output, CalledProcessError
class Subp... | apache-2.0 | Python |
a807394118f0aef8422d0529a5297fef24b043bc | Enhance wait_for_bm_node_status waiter | openstack/ironic,SauloAislan/ironic,pshchelo/ironic,NaohiroTamura/ironic,pshchelo/ironic,openstack/ironic,SauloAislan/ironic,NaohiroTamura/ironic | ironic_tempest_plugin/common/waiters.py | ironic_tempest_plugin/common/waiters.py | # 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 to in... | # 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 to in... | apache-2.0 | Python |
a3b369a46a5dd3017e286e66689d7cdcc8913a9a | Make str/bytes/dict/int Python 2/3 consistent in pattern/__init__.py | clips/pattern,clips/pattern,clips/pattern | pattern/__init__.py | pattern/__init__.py | #### PATTERN #######################################################################################
# Authors: Tom De Smedt <tom@organisms.be>, Walter Daelemans <walter.daelemans@ua.ac.be>
# License: BSD License, see LICENSE.txt
#### BSD LICENSE #######################################################################... | #### PATTERN #######################################################################################
# Authors: Tom De Smedt <tom@organisms.be>, Walter Daelemans <walter.daelemans@ua.ac.be>
# License: BSD License, see LICENSE.txt
#### BSD LICENSE #######################################################################... | bsd-3-clause | Python |
67b83335956adc0892f32a21099e199dd2753a5d | Make mypy ignore auto-generated file | pimutils/todoman | todoman/__init__.py | todoman/__init__.py | from todoman import version # type: ignore
__version__ = version.version
__documentation__ = "https://todoman.rtfd.org/en/latest/"
| from todoman import version
__version__ = version.version
__documentation__ = "https://todoman.rtfd.org/en/latest/"
| isc | Python |
a9437a92858f3cde74db1fb92d99292e8135c21c | fix name | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/userreports/tests/test_static_reports.py | corehq/apps/userreports/tests/test_static_reports.py | from __future__ import absolute_import
from __future__ import unicode_literals
import os
from collections import Counter
from django.test import SimpleTestCase
from django.test.utils import override_settings
from corehq.util.test_utils import TestFileMixin
from corehq.apps.userreports.models import StaticReportConfigur... | from __future__ import absolute_import
from __future__ import unicode_literals
import os
from collections import Counter
from django.test import SimpleTestCase
from django.test.utils import override_settings
from corehq.util.test_utils import TestFileMixin
from corehq.apps.userreports.models import StaticReportConfigur... | bsd-3-clause | Python |
d62b41f2a78d3ae2c1e8ff8ebd50c718a0ea2374 | Remove unused import. | PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge | spec/data/crossword_spec.py | spec/data/crossword_spec.py | from expects import *
from src.data import crossword
with description('clue_keywords'):
with it('removes garbage characters'):
expect(crossword.clue_keywords('-_-;;!')).to(be_empty)
with it('removes common words'):
expect(crossword.clue_keywords('for eg that abbr for the org')).to(be_empty)
with it('r... | import sqlite3
from expects import *
from src.data import crossword
with description('clue_keywords'):
with it('removes garbage characters'):
expect(crossword.clue_keywords('-_-;;!')).to(be_empty)
with it('removes common words'):
expect(crossword.clue_keywords('for eg that abbr for the org')).to(be_empt... | mit | Python |
598177bd9e07f42d8a5b5d80e4c0d3974e00a911 | add abspath debug output | christopherjwang/rackspace-monitoring-agent,kaustavha/rackspace-monitoring-agent,christopherjwang/rackspace-monitoring-agent,AlphaStaxLLC/rackspace-monitoring-agent,AlphaStaxLLC/rackspace-monitoring-agent,virgo-agent-toolkit/rackspace-monitoring-agent,kaustavha/rackspace-monitoring-agent,virgo-agent-toolkit/rackspace-m... | tools/get_binary.py | tools/get_binary.py | #!/usr/bin/env python
import os
import sys
import shutil
from version import full_version
from optparse import OptionParser
import pkgutils
def main():
usage = "usage: %prog [destination path]"
parser = OptionParser(usage=usage)
(options, args) = parser.parse_args()
if len(args) != 1:
pars... | #!/usr/bin/env python
import os
import sys
import shutil
from version import full_version
from optparse import OptionParser
import pkgutils
def main():
usage = "usage: %prog [destination path]"
parser = OptionParser(usage=usage)
(options, args) = parser.parse_args()
if len(args) != 1:
pars... | apache-2.0 | Python |
4e35cf80546f95dbb7d4d41daadfcc575c5ddfdf | disable find_unmerged_branches_in_cwd on travis | StoDevX/cs251-toolkit,StoDevX/cs251-toolkit,StoDevX/cs251-toolkit,StoDevX/cs251-toolkit | cs251tk/common/test_find_unmerged_branches_in_cwd.py | cs251tk/common/test_find_unmerged_branches_in_cwd.py | import pytest
from .find_unmerged_branches_in_cwd import find_unmerged_branches_in_cwd
from .run import run
def git(cmd, *args):
return run(['git', cmd, *args])
def touch(file):
return run(['touch', file])
@pytest.mark.skip(reason="this fails on travis-ci")
def test_find_unmerged_branches_in_cwd_1(tmpdir)... | from .find_unmerged_branches_in_cwd import find_unmerged_branches_in_cwd
from .run import run
def git(cmd, *args):
return run(['git', cmd, *args])
def touch(file):
return run(['touch', file])
def test_find_unmerged_branches_in_cwd_1(tmpdir):
with tmpdir.as_cwd():
git('init')
touch('fi... | mit | Python |
66866e45f2f229092f15d4d4f5c97774d425a91f | add v7.3.0 (#26389) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-pyface/package.py | var/spack/repos/builtin/packages/py-pyface/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)
class PyPyface(PythonPackage):
"""The pyface project contains a toolkit-independent GUI abstraction layer,
which ... | # 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)
class PyPyface(PythonPackage):
"""The pyface project contains a toolkit-independent GUI abstraction layer,
which ... | lgpl-2.1 | Python |
fa69cd88afd43333316f141818711d49fba7ceba | move couch setup into main body | nikken1/patentprocessor,yngcan/patentprocessor,funginstitute/patentprocessor,funginstitute/patentprocessor,nikken1/patentprocessor,yngcan/patentprocessor,funginstitute/patentprocessor,nikken1/patentprocessor,yngcan/patentprocessor | couch_patent/couch_patent.py | couch_patent/couch_patent.py | #!/usr/bin/env python
import sys
import couchdb
import unittest
sys.path.append('../lib')
from patXML import *
sys.path.append('..')
import parse
basedir = os.path.join(os.curdir, '../test')
testdir = os.path.join(basedir, 'fixtures/xml/')
testfile = XMLPatentBase(open(testdir+'ipg120327.one.xml').read())
attrs = [... | #!/usr/bin/env python
import sys
import couchdb
import unittest
sys.path.append('../lib')
from patXML import *
sys.path.append('..')
import parse
basedir = os.path.join(os.curdir, '../test')
testdir = os.path.join(basedir, 'fixtures/xml/')
attrs = ['country', 'patent', 'kind', 'date_grant', 'pat_type', \
'... | bsd-2-clause | Python |
57aa8d273f58c94f2b8cb557405ce2f56878549c | update to 0.6-dev | plepe/pgmapcss,plepe/pgmapcss | pgmapcss/version.py | pgmapcss/version.py | __all__ = 'VERSION', 'VERSION_INFO'
#: (:class:`tuple`) The version tuple e.g. ``(0, 9, 2)``.
VERSION_INFO = (0, 6, 'dev')
#: (:class:`basestring`) The version string e.g. ``'0.9.2'``.
if len(VERSION_INFO) == 4:
VERSION = '%d.%d.%d-%s' % VERSION_INFO
elif type(VERSION_INFO[2]) == str:
VERSION = '%d.%d-%s' % V... | __all__ = 'VERSION', 'VERSION_INFO'
#: (:class:`tuple`) The version tuple e.g. ``(0, 9, 2)``.
VERSION_INFO = (0, 5, 0)
#: (:class:`basestring`) The version string e.g. ``'0.9.2'``.
if len(VERSION_INFO) == 4:
VERSION = '%d.%d.%d-%s' % VERSION_INFO
else:
VERSION = '%d.%d.%d' % VERSION_INFO
| agpl-3.0 | Python |
c162458a2cd89f1bb265e1f267806ae728c7553c | Set version v1.18.2 | atztogo/phono3py,atztogo/phono3py,atztogo/phono3py,atztogo/phono3py | phono3py/version.py | phono3py/version.py | # Copyright (C) 2013 Atsushi Togo
# All rights reserved.
#
# This file is part of phonopy.
#
# 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
# notic... | # Copyright (C) 2013 Atsushi Togo
# All rights reserved.
#
# This file is part of phonopy.
#
# 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
# notic... | bsd-3-clause | Python |
4ad6f599cdcebc34e9f32a5ab8eaf44a3845ed21 | Move ValidationError messages to a dictionary that can be accessed from PinForm.clean | supervacuo/pinry,Stackato-Apps/pinry,wangjun/pinry,dotcom900825/xishi,QLGu/pinry,pinry/pinry,lapo-luchini/pinry,dotcom900825/xishi,supervacuo/pinry,MSylvia/pinry,Stackato-Apps/pinry,lapo-luchini/pinry,wangjun/pinry,QLGu/pinry,pinry/pinry,MSylvia/pinry,MSylvia/pinry,pinry/pinry,Stackato-Apps/pinry,pinry/pinry,supervacuo... | pinry/pins/forms.py | pinry/pins/forms.py | from django import forms
from .models import Pin
class PinForm(forms.ModelForm):
url = forms.CharField(required=False)
image = forms.ImageField(label='or Upload', required=False)
_errors = {
'not_image': 'Requested URL is not an image file. Only images are currently supported.',
'pinned'... | from django import forms
from .models import Pin
class PinForm(forms.ModelForm):
url = forms.CharField(required=False)
image = forms.ImageField(label='or Upload', required=False)
class Meta:
model = Pin
fields = ['url', 'image', 'description', 'tags']
def clean(self):
cleane... | bsd-2-clause | Python |
f638851872a1cbc84f4e75fff47dfb544b6e17d8 | disable cache during tests | praekelt/mc2,praekelt/mc2,universalcore/unicore-mc,praekelt/mc2,universalcore/unicore-mc,universalcore/unicore-mc,praekelt/mc2,praekelt/mc2,universalcore/unicore-mc | test_settings.py | test_settings.py | from project.settings import *
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'unicore_mc.db',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
}
}
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.dummy.Du... | from project.settings import *
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'unicore_mc.db',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
}
}
DEBUG = True
CELERY_ALWAYS_EAGER = True
UNICORE_CMS_INSTALL_DIR = abspath('.test_c... | bsd-2-clause | Python |
9073c3afb90f5c4ba7e2cdfdc1714b25e1fa218a | Make sure tests are run in debug mode. | dokterbob/django-docdata | test_settings.py | test_settings.py | DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
}
}
# HACK: this fixes our threaded runserver remote tests
# DATABASE_NAME='test_docdata.sqlite',
# TEST_DATABASE_NAME='test_docdata.sqlite',
INSTALLED_APPS = (
'docdata',
)
ROOT_URLCONF = 'docdata.urls'
try:
# If available, ... | DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
}
}
# HACK: this fixes our threaded runserver remote tests
# DATABASE_NAME='test_docdata.sqlite',
# TEST_DATABASE_NAME='test_docdata.sqlite',
INSTALLED_APPS = (
'docdata',
)
ROOT_URLCONF = 'docdata.urls'
try:
# If available, ... | agpl-3.0 | Python |
d2bc3f1a392c037764d10895cf70fb87524e2dbc | Add required INSTALLED_APPS to test_settings.py | hastexo/edx-shopify,fghaas/edx-shopify | test_settings.py | test_settings.py | """
Django test settings for edx_shopify project.
Generated by 'django-admin startproject' using Django 1.8.8.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Q... | """
Django test settings for edx_shopify project.
Generated by 'django-admin startproject' using Django 1.8.8.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Q... | agpl-3.0 | Python |
54e960934f1c648d2d04db6f9d3a7752850d5f97 | support running raw section instead of asm in VM tests | rlane/ubpf,iovisor/ubpf,iovisor/ubpf,rlane/ubpf,iovisor/ubpf,iovisor/ubpf | tests/test_vm.py | tests/test_vm.py | import os
import tempfile
import struct
from subprocess import Popen, PIPE
from nose.plugins.skip import Skip, SkipTest
import ubpf.assembler
import testdata
VM = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "vm", "test")
def check_datafile(filename):
"""
Given assembly source code and an ex... | import os
import tempfile
from subprocess import Popen, PIPE
from nose.plugins.skip import Skip, SkipTest
import ubpf.assembler
import testdata
VM = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "vm", "test")
def check_datafile(filename):
"""
Given assembly source code and an expected result,... | apache-2.0 | Python |
f5ed38b4874d6f561457efac18e13ac0d8169e9a | include example folder in yapf testing. | zsdonghao/tensorlayer,zsdonghao/tensorlayer | tests/testing.py | tests/testing.py | import os
def _list_py_files(root):
for root, dirs, files in os.walk(root):
if root.find('third_party') != -1:
continue
for file in files:
if file.endswith('.py'):
yield os.path.join(root, file)
_excludes = [
'tensorlayer/db.py',
]
def list_all_py_fi... | import os
def _list_py_files(root):
for root, dirs, files in os.walk(root):
if root.find('third_party') != -1:
continue
for file in files:
if file.endswith('.py'):
yield os.path.join(root, file)
_excludes = [
'tensorlayer/db.py',
]
def list_all_py_fi... | apache-2.0 | Python |
9996cb91e67824dc8e8410545607d561bed2c0a1 | add required=False to parent__url field to prevent validation error | sixpearls/django-textify,sixpearls/django-textify,sixpearls/django-textify | textify/forms.py | textify/forms.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django import forms
from django.conf import settings as site_settings
from textify.models import TextifyPage
from django.contrib.flatpages.forms import FlatpageForm
class TextifyPageForm(FlatpageForm):
if 'mptt' in site_settings.INSTALLED_APPS:
pa... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django import forms
from django.conf import settings as site_settings
from textify.models import TextifyPage
from django.contrib.flatpages.forms import FlatpageForm
class TextifyPageForm(FlatpageForm):
if 'mptt' in site_settings.INSTALLED_APPS:
pa... | bsd-2-clause | Python |
d3fcd82fc1640dec6af1e45c5c791aa9900e67f7 | Fix bug in insert.py print | aherlihy/Monary,aherlihy/Monary | timing/insert.py | timing/insert.py | # Monary - Copyright 2011-2014 David J. C. Beach
# Please see the included LICENSE.TXT and NOTICE.TXT for licensing information.
import random
import pymongo
from profile import profile
def do_insert():
NUM_BATCHES = 4500
BATCH_SIZE = 1000
# 4500 batches * 1000 per batch = 4.5 million records
c = p... | # Monary - Copyright 2011-2014 David J. C. Beach
# Please see the included LICENSE.TXT and NOTICE.TXT for licensing information.
import random
import pymongo
from profile import profile
def do_insert():
NUM_BATCHES = 4500
BATCH_SIZE = 1000
# 4500 batches * 1000 per batch = 4.5 million records
c = p... | apache-2.0 | Python |
10fec9406516c43223739c4613ca792dfe55b6a1 | use decorator instead of two with statements | FundedByMe/django-uc | uc/tests/test_uc.py | uc/tests/test_uc.py | import logging
import unittest
from mock import patch
from uc.uc import get_company_risk_report
logging.basicConfig(level=logging.INFO)
logging.getLogger('suds.transport').setLevel(logging.INFO)
logging.getLogger('suds.resolver').setLevel(logging.INFO)
request_body = """<ns0:Body>
<ns1:companyReport ns1:product... | import logging
import unittest
from mock import patch
from uc.uc import get_company_risk_report
logging.basicConfig(level=logging.INFO)
logging.getLogger('suds.transport').setLevel(logging.INFO)
logging.getLogger('suds.resolver').setLevel(logging.INFO)
request_body = """<ns0:Body>
<ns1:companyReport ns1:product... | mit | Python |
d8464ab0c007c8d5d9dbf2b86b9cf5e61975077b | Implement extra_data previewer options | jessamynsmith/boards-backend,jessamynsmith/boards-backend,GetBlimp/boards-backend | blimp_boards/files/previews.py | blimp_boards/files/previews.py | import jwt
import requests
from django.conf import settings
from django.utils.log import getLogger
logger = getLogger(__name__)
def queue_previews(url, sizes, metadata):
payload = {
'account_key': settings.BLIMP_PREVIEWS_ACCOUNT_ID,
'url': url,
'sizes': sizes,
'metadata': metada... | import jwt
import requests
from django.conf import settings
from django.utils.log import getLogger
logger = getLogger(__name__)
def queue_previews(url, sizes, metadata):
payload = {
'account_key': settings.BLIMP_PREVIEWS_ACCOUNT_ID,
'url': url,
'sizes': sizes,
'metadata': metada... | agpl-3.0 | Python |
953a05ac0f98cbdf10ed72a50dd9db32c413a7f1 | change Order of processes | bird-house/flyingpigeon | flyingpigeon/processes/__init__.py | flyingpigeon/processes/__init__.py | from .wps_subset_countries import ClippingProcess
from .wps_subset_continents import ClipcontinentProcess
from .wps_subset_regionseurope import ClipregionseuropeProcess
from .wps_pointinspection import PointinspectionProcess
from .wps_landseamask import LandseamaskProcess
# from .wps_climatefactsheet import FactsheetPr... | from .wps_subset_countries import ClippingProcess
from .wps_subset_continents import ClipcontinentProcess
from .wps_subset_regionseurope import ClipregionseuropeProcess
from .wps_pointinspection import PointinspectionProcess
from .wps_landseamask import LandseamaskProcess
# from .wps_climatefactsheet import FactsheetPr... | apache-2.0 | Python |
ed7c063c5f642676d792db460f95d2b4a53a5c1f | Remove _as_numpy_dtype because numpy.dtype and chainerx.dtype is equivalent currently | hvy/chainer,ktnyt/chainer,okuta/chainer,niboshi/chainer,chainer/chainer,keisuke-umezawa/chainer,jnishi/chainer,wkentaro/chainer,wkentaro/chainer,niboshi/chainer,keisuke-umezawa/chainer,jnishi/chainer,wkentaro/chainer,wkentaro/chainer,pfnet/chainer,ktnyt/chainer,hvy/chainer,chainer/chainer,okuta/chainer,ktnyt/chainer,hv... | chainerx/creation/from_data.py | chainerx/creation/from_data.py | import numpy
import chainerx
# TODO(sonots): Support subclassing
asanyarray = chainerx.asarray
def loadtxt(
fname, dtype=float, comments='#', delimiter=None, converters=None,
skiprows=0, usecols=None, unpack=False, ndmin=0, encoding='bytes',
device=None):
return chainerx.array(
... | import numpy
import chainerx
# TODO(hvy): Define this function with other similar chainerx-numpy
# compatibility functions.
def _as_numpy_dtype(dtype):
if isinstance(dtype, chainerx.dtype):
return dtype.name
return dtype
# TODO(sonots): Support subclassing
asanyarray = chainerx.asarray
def loadtx... | mit | Python |
d41807ee27557ac6bc25f891f86ac97e61a5a780 | Update exercise 2.1 (python) | perryleo/sicp,perryleo/sicp,perryleo/sicp | chapter_02/python/sicpc2e01.py | chapter_02/python/sicpc2e01.py | ## The solution of exercise 2.1
## Define a better version of make-rat that handles both positive and
## negative arguments. Make-rat should normalize the sign so that if the
## rational number is positive, both the numerator and denominator are
## positive, and if the rational number is negative, only the numerator is... | ## The solution of exercise 2.1
## Define a better version of make-rat that handles both positive and
## negative arguments. Make-rat should normalize the sign so that if the
## rational number is positive, both the numerator and denominator are
## positive, and if the rational number is negative, only the numerator is... | mit | Python |
0394f02f62c6d23d78cec07ac9130968eb79a552 | Add colors | ziggi0703/EKPyTools | ekpytools/colors/kit.py | ekpytools/colors/kit.py | __author__ = 'Markus Prim'
from color_converters import rgb_to_hex_rep
green = rgb_to_hex_rep(0, 150, 130)
blue = rgb_to_hex_rep(70, 100, 170)
pea_green = rgb_to_hex_rep(140, 182, 60)
yellow = rgb_to_hex_rep(252, 229, 0)
orange = rgb_to_hex_rep(223, 155, 27)
brown = rgb_to_hex_rep(167, 130, 46)
red = rgb_to_hex_rep(1... | __author__ = 'Markus Prim'
from color_converters import rgb_to_hex_rep
green = rgb_to_hex_rep(0, 150, 130)
blue = rgb_to_hex_rep(70, 100, 170)
pea_green = rgb_to_hex_rep(140, 182, 60)
yellow = rgb_to_hex_rep(252, 229, 0)
orange = rgb_to_hex_rep(223, 155, 27)
brown = rgb_to_hex_rep(167, 130, 46)
red = rgb_to_hex_rep(1... | mit | Python |
af367ae9380dfdca78dbfd9e30bb82a346c95313 | allow direct connections to flask | foxbow/mixplay,foxbow/mixplay,foxbow/mixplay,foxbow/mixplay | pmixplay/mixplay.py | pmixplay/mixplay.py | from flask import Flask
from flask import request
import sys
import socket
import threading
import time
# the socket to mixplayd
s = None
app = Flask(__name__, static_folder='./' )
@app.route('/')
@app.route('/index.html')
def staticFiles():
return app.send_static_file('mixplay.html')
@app.route('/mixpla... | from flask import Flask
from flask import request
import sys
import socket
import threading
import time
# the socket to mixplayd
s = None
app = Flask(__name__, static_folder='./' )
@app.route('/')
@app.route('/index.html')
def staticFiles():
return app.send_static_file('mixplay.html')
@app.route('/mixpla... | mit | Python |
af33093fe8c734288dcdc7820ffac35892c1b1df | Add additional sys.platform string | thorrak/fermentrack,thorrak/fermentrack,thorrak/fermentrack,thorrak/fermentrack,thorrak/fermentrack | app/udev_integration.py | app/udev_integration.py | from __future__ import print_function
try:
import pyudev
pyudev_available = True
except:
pyudev_available = False
import sys
def get_platform():
platforms = {
'linux': 'Linux',
'linux1': 'Linux',
'linux2': 'Linux',
'darwin': 'OS X',
'win32': 'Windows'
}
... | from __future__ import print_function
try:
import pyudev
pyudev_available = True
except:
pyudev_available = False
import sys
def get_platform():
platforms = {
'linux1': 'Linux',
'linux2': 'Linux',
'darwin': 'OS X',
'win32': 'Windows'
}
if sys.platform not in ... | mit | Python |
70d095b0d0e4e877be478d5aec9d477fe87dfb43 | Fix html generation. | vladfolts/oberonjs,vladfolts/oberonjs,vladfolts/oberonjs | browser/linkjs.py | browser/linkjs.py | #!/usr/bin/python
from optparse import OptionParser
import os
import re
import sys
def extract_require(s):
m = re.search('(//)?(.*)require\\("(.*)"\\)', s)
if not m or m.group(1):
return None
prefix = m.group(2)
if prefix and len(prefix):
prefix = prefix[-1]
if prefix.isalpha() or prefix.isdigit() or prefix... | #!/usr/bin/python
from optparse import OptionParser
import os
import re
import sys
def extract_require(s):
m = re.search('(//)?(.*)require\\("(.*)"\\)', s)
if not m or m.group(1):
return None
prefix = m.group(2)
if prefix and len(prefix):
prefix = prefix[-1]
if prefix.isalpha() or prefix.isdigit() or prefix... | mit | Python |
6438c84f4cb68054fa202b87a36a379d86bf6630 | make tests pass even when settings.CONTACT_EMAIL is not None | ResearchSoftwareInstitute/MyHPOM,ResearchSoftwareInstitute/MyHPOM,ResearchSoftwareInstitute/MyHPOM,ResearchSoftwareInstitute/MyHPOM,ResearchSoftwareInstitute/MyHPOM | myhpom/tests/test_context_processors.py | myhpom/tests/test_context_processors.py | from django.core.urlresolvers import reverse
from django.test import TestCase
from django.conf import settings
from myhpom.tests.factories import UserFactory
from myhpom.urls import static_views
class ContactEmailProcessorTestCase(TestCase):
def test_email_is_available_on_home(self):
for example_email in ... | from django.core.urlresolvers import reverse
from django.test import TestCase
from myhpom.tests.factories import UserFactory
from myhpom.urls import static_views
class ContactEmailProcessorTestCase(TestCase):
def test_email_is_available_on_home(self):
for example_email in ('foo@example.com', 'bar@example.... | bsd-3-clause | Python |
c40af128814f5554516512c5c268499361a3a305 | bump to 0.0.21 | hobson/pug,hobson/pug,hobson/pug,hobson/pug | pug/package_info.py | pug/package_info.py | import os
# Explicitly declare some header/meta information (about `pug`)
# rather than allowing python to populate them automatically.
# This allows simple parsers (in setup.py) to extract them
# without importing this file or __init__.py
__package__ = 'pug'
__package_path__ = os.path.abspath('.')
def try_read(fi... | import os
# Explicitly declare some header/meta information (about `pug`)
# rather than allowing python to populate them automatically.
# This allows simple parsers (in setup.py) to extract them
# without importing this file or __init__.py
__package__ = 'pug'
__package_path__ = os.path.abspath('.')
def try_read(fil... | mit | Python |
6c32e3e417ac5c680df03a1d3f194dec445349d2 | Fix index. | geektoni/Influenza-Like-Illness-Predictor,geektoni/Influenza-Like-Illness-Predictor | data_analysis/filter_news.py | data_analysis/filter_news.py | """Generate year files with news counts
Usage:
filter_news.py <directory> <output>
Options:
-h, --help
"""
from docopt import docopt
from os import listdir
from os.path import isfile, join, getsize
import datetime
from tqdm import *
import pandas as pd
def find_index(id, lis):
for i in range(0, len(lis)):
... | """Generate year files with news counts
Usage:
filter_news.py <directory> <output>
Options:
-h, --help
"""
from docopt import docopt
from os import listdir
from os.path import isfile, join, getsize
import datetime
from tqdm import *
import pandas as pd
def find_index(id, lis):
for i in range(0, len(lis)):
... | mit | Python |
a5e752abf34ceb7cb7ff29cf90435fe545df4b22 | fix database uri | delete/spymanager | example.py | example.py | from src.database import MongoSetup
from src.spy import SpyManager
from src.imagesite import ImageSite
# Database settings
MONGO_URI = 'mongodb://localhost:27017/data'
DATABASE_NAME = 'spies_database'
COLLECTION_NAME = 'spies'
# User to test
USERNAME = 'pinheirofellipe'
mongo = MongoSetup(MONGO_URI, DATABASE_NAME, ... | from src.database import MongoSetup
from src.spy import SpyManager
from src.imagesite import ImageSite
# Database settings
MONGO_URI = 'mongodb://database:27017/data'
DATABASE_NAME = 'spies_database'
COLLECTION_NAME = 'spies'
# User to test
USERNAME = 'pinheirofellipe'
mongo = MongoSetup(MONGO_URI, DATABASE_NAME, C... | mit | Python |
6f2e074b30c10e39b0ce7e4e8acb8d8f09bc3b70 | Add CPI example. | wireservice/agate-lookup,onyxfish/agate-lookup | example.py | example.py | #!/usr/bin/env python
import agate
import agatelookup
agatelookup.patch()
source = agatelookup.Source()
# Simple
table = agate.Table([
('WA',),
('VA',),
('NE',)
], ['usps'])
joined = table.lookup(source, 'usps', 'state')
joined.print_table()
# Versioned
table = agate.Table([
('1111',),
('3133... | #!/usr/bin/env python
import agate
import agatelookup
agatelookup.patch()
source = agatelookup.Source()
# Simple
table = agate.Table([
('WA',),
('VA',),
('NE',)
], ['usps'])
joined = table.lookup(source, 'usps', 'state')
joined.print_table()
# Versioned
table = agate.Table([
('1111',),
('3133... | mit | Python |
3e7f93e6c671bb033e8cf28f82dcc09a92234e22 | use request.form instead of request.values | amitsaha/learning,amitsaha/learning,amitsaha/learning,amitsaha/learning,amitsaha/learning,amitsaha/learning,amitsaha/learning,amitsaha/learning,amitsaha/learning,amitsaha/learning,amitsaha/learning | Python/flask-webapp/file_upload/app_form.py | Python/flask-webapp/file_upload/app_form.py | from flask import Flask, request
app = Flask(__name__, static_url_path='')
app.debug = True
# Python client: client_form.py
@app.route('/', methods=['POST'])
def index():
# the files uploaded
# request.files is a MultiDict:
# http://werkzeug.pocoo.org/docs/0.10/datastructures/#werkzeug.datastructures.Multi... | from flask import Flask, request
app = Flask(__name__, static_url_path='')
app.debug = True
# Python client: client_form.py
@app.route('/', methods=['POST'])
def index():
# the files uploaded
# request.files is a MultiDict:
# http://werkzeug.pocoo.org/docs/0.10/datastructures/#werkzeug.datastructures.Multi... | unlicense | Python |
6c09555e383f7aff44f868f1b0ad2a0a72bcbb97 | update fabfile | alexpap/tpch-kit,alexpap/tpch-kit,alexpap/tpch-kit,alexpap/tpch-kit | fabfile.py | fabfile.py | from fabric.api import env, run, cd
tables_options = {
'lineitem' : 'L',
'customers' : 'c',
'nation' : 'n',
'orders' : 'O',
'parts' : 'P',
'region' : 'r',
'suppliers' : 's',
'partsupp' : 'S'
}
def dbgen(sf=1, table=" "):
if not table:
table = "-T {tbl_opt}".format(tbl_opt=ta... | from fabric.api import env, run, cd
tables_options = {
'lineitem' : 'L',
'customers' : 'c',
'nation' : 'n',
'orders' : 'O',
'parts' : 'P',
'region' : 'r',
'suppliers' : 's',
'partsupp' : 'S'
}
def dbgen(sf=1, table=" "):
if not table:
table = "-T {tbl_opt}".format(tbl_opt=ta... | mit | Python |
aef53b0d4f4c6b2eefcdf7915805002ef889cac2 | Check for SMTP user before login | ViderumGlobal/ckanext-requestdata,ViderumGlobal/ckanext-requestdata,ViderumGlobal/ckanext-requestdata,ViderumGlobal/ckanext-requestdata | ckanext/requestdata/emailer.py | ckanext/requestdata/emailer.py | import logging
import smtplib
import cgi
import ckanext.hdx_users.controllers.mailer as hdx_mailer
from paste.deploy.converters import asbool
from socket import error as socket_error
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email import... | import logging
import smtplib
import cgi
import ckanext.hdx_users.controllers.mailer as hdx_mailer
import paste.deploy.converters
from socket import error as socket_error
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email import Encoders
f... | agpl-3.0 | Python |
9c9b87824eeeaf326ded6a0d7f30f234f1bb3ffb | Add fab upgrade command | pavlovicnemanja92/superdesk,vied12/superdesk,hlmnrmr/superdesk,superdesk/superdesk-aap,plamut/superdesk,mdhaman/superdesk-aap,plamut/superdesk,plamut/superdesk,darconny/superdesk,akintolga/superdesk,ioanpocol/superdesk,sivakuna-aap/superdesk,verifiedpixel/superdesk,petrjasek/superdesk,ioanpocol/superdesk,marwoodandrew/... | fabfile.py | fabfile.py | from fabric.api import local
from fabric.context_managers import shell_env, prefix
TEST_DB = '_superdesk_test'
def test():
with shell_env(MONGOHQ_URL=TEST_DB):
local('lettuce')
def upgrade():
local('pip install -r requirements.txt --upgrade')
def manage():
local('python manage.py')
def server()... | from fabric.api import local
from fabric.context_managers import shell_env, prefix
TEST_DB = '_superdesk_test'
def test():
with shell_env(MONGOHQ_URL=TEST_DB):
local('lettuce')
def manage():
local('python manage.py')
def server():
local('python app.py')
def run():
server()
| agpl-3.0 | Python |
1e1d5d31b46cd2410ea5d6a3291407e3957460f2 | update to include jenkins deploy targets. | mozilla/geodude,mozilla/geodude | fabfile.py | fabfile.py | import os
from fabric.api import (env, execute, lcd, local, parallel,
run, roles, task)
from fabdeploytools import helpers
import fabdeploytools.envs
import deploysettings as settings
env.key_filename = settings.SSH_KEY
fabdeploytools.envs.loadenv(settings.CLUSTER)
ROOT, GEODUDE = helpers.g... | import os
from fabric.api import (env, execute, lcd, local, parallel,
run, roles, task)
from fabdeploytools import helpers
import fabdeploytools.envs
import deploysettings as settings
env.key_filename = settings.SSH_KEY
fabdeploytools.envs.loadenv(settings.CLUSTER)
ROOT, GEODUDE = helpers.g... | apache-2.0 | Python |
26a4504cd38536b533e0a6224f5fce23f70dd53e | Install cookbooks before bringing vagrant up | pyudev/pyudev | fabfile.py | fabfile.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2010, 2011, 2012 Sebastian Wiesner <lunaryorn@gmail.com>
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation; either version 2.1 of t... | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2010, 2011, 2012 Sebastian Wiesner <lunaryorn@gmail.com>
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation; either version 2.1 of t... | lgpl-2.1 | Python |
c69b0836a0f8a10f9bc56517ffb0d8abe1918b10 | Fix fabfile | explosion/spaCy,recognai/spaCy,recognai/spaCy,recognai/spaCy,recognai/spaCy,aikramer2/spaCy,honnibal/spaCy,explosion/spaCy,explosion/spaCy,spacy-io/spaCy,explosion/spaCy,spacy-io/spaCy,honnibal/spaCy,recognai/spaCy,aikramer2/spaCy,explosion/spaCy,aikramer2/spaCy,spacy-io/spaCy,aikramer2/spaCy,spacy-io/spaCy,spacy-io/sp... | fabfile.py | fabfile.py | # coding: utf-8
from __future__ import unicode_literals, print_function
from fabric.api import local, lcd, env, settings, prefix
from fabtools.python import virtualenv
from os import path, environ
PWD = path.dirname(__file__)
ENV = environ['VENV_DIR'] if 'VENV_DIR' in environ else '.env'
VENV_DIR = path.join(PWD, EN... | # coding: utf-8
from __future__ import unicode_literals, print_function
from fabric.api import local, lcd, env, settings, prefix
from fabtools.python import virtualenv
from os import path, environ
PWD = path.dirname(__file__)
ENV = environ['VENV_DIR'] if 'VENV_DIR' in environ else '.env'
VENV_DIR = path.join(PWD, EN... | mit | Python |
b16569dca28a2eaea99dfbaf28b0392adc4e9e07 | Write exec like a function, because in Python 3 it _is_ a function. | chemoelectric/sortsmill,chemoelectric/sortsmill | python/loadbuild.py | python/loadbuild.py | """
Copyright (c) 2009 Barry Schwartz
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, distribute,... | """
Copyright (c) 2009 Barry Schwartz
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, distribute,... | mit | Python |
b8bad6cda4bdc78d15303002db6687fbae447e51 | Modify copy method into inherit | felipejta/openacademy-project_072015 | openacademy/model/openacademy_course.py | openacademy/model/openacademy_course.py | from openerp import models, fields, api
class Course(models.Model):
_name = 'openacademy.course' # Model odoo name
name = fields.Char(string='Title', required=True) # Field reserved to identified name record
description = fields.Text(string='Description')
responsible_id = fields.Many2one('res.use... | from openerp import models, fields, api
class Course(models.Model):
_name = 'openacademy.course' # Model odoo name
name = fields.Char(string='Title', required=True) # Field reserved to identified name record
description = fields.Text(string='Description')
responsible_id = fields.Many2one('res.use... | apache-2.0 | Python |
51614490d5f738e7d0325bd3783e00fda5a6b76b | update version number | bigdig/vnpy,msincenselee/vnpy,andrewchenshx/vnpy,bigdig/vnpy,andrewchenshx/vnpy,bigdig/vnpy,msincenselee/vnpy,msincenselee/vnpy,andrewchenshx/vnpy,msincenselee/vnpy,andrewchenshx/vnpy,andrewchenshx/vnpy,vnpy/vnpy,vnpy/vnpy,bigdig/vnpy | vnpy/__init__.py | vnpy/__init__.py | __version__ = "2.0.3"
| __version__ = "2.0.1"
| mit | Python |
bd5244716f7152d5a95986ee99cca1cd643a6f83 | fix globals / exec issue | malariagen/agam-report-base | src/python/ag1k/phase1_selection.py | src/python/ag1k/phase1_selection.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, division
import os
import re
import zarr
import petl as etl
import pandas
import h5py
title = 'Phase 1 selection data release'
# noinspection PyGlobalUndefined
def init(release_dir):
"""Initialise data resources.
Parameters
... | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, division
import os
import re
import zarr
import petl as etl
import pandas
import h5py
title = 'Phase 1 selection data release'
# noinspection PyGlobalUndefined
def init(release_dir):
"""Initialise data resources.
Parameters
... | mit | Python |
f80bd7dbb1b66f3fec52200ecfbc50d779caca05 | Fix bug in function that lists existing jterator projects | TissueMAPS/TmLibrary,TissueMAPS/TmLibrary,TissueMAPS/TmLibrary,TissueMAPS/TmLibrary,TissueMAPS/TmLibrary | src/tmlib/workflow/jterator/args.py | src/tmlib/workflow/jterator/args.py | from tmlib.workflow.args import Argument
from tmlib.workflow.args import BatchArguments
from tmlib.workflow.args import SubmissionArguments
from tmlib.workflow.args import ExtraArguments
from tmlib.workflow.registry import batch_args
from tmlib.workflow.registry import submission_args
from tmlib.workflow.registry impor... | from tmlib.workflow.args import Argument
from tmlib.workflow.args import BatchArguments
from tmlib.workflow.args import SubmissionArguments
from tmlib.workflow.args import ExtraArguments
from tmlib.workflow.registry import batch_args
from tmlib.workflow.registry import submission_args
from tmlib.workflow.registry impor... | agpl-3.0 | Python |
acf0eba14ca10c72e9775b772cf240c2251d652f | Rename blinkybot to commit-bot | primiano/blink-gitcs,primiano/blink-gitcs,primiano/blink-gitcs,primiano/blink-gitcs,primiano/blink-gitcs,primiano/blink-gitcs,primiano/blink-gitcs,primiano/blink-gitcs,primiano/blink-gitcs | Tools/Scripts/webkitpy/common/config/irc.py | Tools/Scripts/webkitpy/common/config/irc.py | # Copyright (c) 2013 Google 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 and the ... | # Copyright (c) 2013 Google 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 and the ... | bsd-3-clause | Python |
0d5ae99a3ed0e570c67d72ae03ca84f76b9a051f | hide os from modules | aureooms/sak,aureooms/sak | project/__init__.py | project/__init__.py | import os
root = os.path.dirname(os.path.abspath(__file__))
for f in os.listdir(root):
path = root + '/' + f
if os.path.isfile(path) and f != '__init__.py':
name, ext = os.path.splitext(f)
if ext == '.py' : __import__('project.' + name)
os = None | import os
root = os.path.dirname(os.path.abspath(__file__))
for f in os.listdir(root):
path = root + '/' + f
if os.path.isfile(path) and f != '__init__.py':
name, ext = os.path.splitext(f)
if ext == '.py' : __import__('project.' + name) | agpl-3.0 | Python |
190fdc1949b212712cf620093758e942f7543013 | save raw data in def fyn | Harlekuin/fyn | fyn/fyn.py | fyn/fyn.py | import pandas as pd
import numpy as np
from .loader import load_price_data, load_income_data
from .cleaner import clean_price_data, clean_income_data
from .transformer import transform_price_data, transform_income_data
from .analyse import Analysis
def fyn(price_df, income_df=None):
"""
full process for the ... | import pandas as pd
import numpy as np
from .loader import load_price_data, load_income_data
from .cleaner import clean_price_data, clean_income_data
from .transformer import transform_price_data, transform_income_data
from .analyse import Analysis
def fyn(price_df, income_df=None):
"""
full process for the ... | mit | Python |
3bc9db0972ec775a666db87cf71a470c146b3cd6 | bump version | Bogdanp/cedar | cedar/__init__.py | cedar/__init__.py | # flake8: noqa
from .errors import CedarError, ParseError
from .parser import parse
__version__ = "0.2.7"
| # flake8: noqa
from .errors import CedarError, ParseError
from .parser import parse
__version__ = "0.2.6"
| bsd-3-clause | Python |
f21d56857685fda0b54be579ce5a0b2ba1b7d98c | Use virtualenv when available | pwndbg/pwndbg,pwndbg/pwndbg,pwndbg/pwndbg,pwndbg/pwndbg | gdbinit.py | gdbinit.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import glob
import locale
import sys
from os import path, environ
virtual_env = environ.get('VIRTUAL_ENV')
if virtual_env:
print("Found that you're using VIRTUAL_ENV '%s'" % virtual_env)
possible_site_packages = glob.glob(path.join(virtual_env, 'lib', 'python*', ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import locale
import sys
from os import path
directory, file = path.split(__file__)
directory = path.expanduser(directory)
directory = path.abspath(directory)
sys.path.append(directory)
# warn if the user has different encoding than utf-8
encoding = locale.ge... | mit | Python |
4ba5259e812fe576c7e880d2f175995538617bc8 | Add contents of index.html for c11 | GunshipPenguin/billionaire_challenge,GunshipPenguin/billionaire_challenge | challenges/c11.py | challenges/c11.py | from challenge import Challenge
import flask
class c11(Challenge):
'''
Challenge 11
Win screen
'''
def __init__(self):
super()
self._id = '0aaeb7a4cf49f562b6c806f70f3aff98ecf6353c'
self._hints = {}
def get_response(self, app):
return app.send_static_file('c11/in... | mit | Python | |
1a55a1400fbbf488d4a0e10e6ee536b9d53b5fa7 | add set_acceleration to SimulatingDriver (#5879) | OpenTrons/opentrons-api,OpenTrons/opentrons-api,OpenTrons/opentrons_sdk,OpenTrons/opentrons-api,OpenTrons/opentrons-api,Opentrons/labware,OpenTrons/opentrons-api | api/src/opentrons/drivers/smoothie_drivers/__init__.py | api/src/opentrons/drivers/smoothie_drivers/__init__.py | class SmoothieDriver(object):
def __init__(self):
pass
class VirtualSmoothie(object):
def __init__(self):
pass
class SimulatingDriver:
def __init__(self):
self._steps_per_mm = {}
self.homed_position = {}
def home(self, axis):
pass
def _smoothie_reset(s... | class SmoothieDriver(object):
def __init__(self):
pass
class VirtualSmoothie(object):
def __init__(self):
pass
class SimulatingDriver:
def __init__(self):
self._steps_per_mm = {}
self.homed_position = {}
def home(self, axis):
pass
def _smoothie_reset(s... | apache-2.0 | Python |
5c29d75c4b15c2f5cace7e750be9e37b864fda90 | Add conversion. | cihai/cihai-python,cihai/cihai,cihai/cihai | cihai/__init__.py | cihai/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""China fit in to a python package.
cihai
~~~~~
:copyright: Copyright 2013 Tony Narlock.
:license: BSD, see LICENSE for details
"""
from __future__ import absolute_import, division, print_function, \
with_statement, unicode_literals
__version__ = '0.0.1'
from . i... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""China fit in to a python package.
cihai
~~~~~
:copyright: Copyright 2013 Tony Narlock.
:license: BSD, see LICENSE for details
"""
from __future__ import absolute_import, division, print_function, \
with_statement, unicode_literals
__version__ = '0.0.1'
from . i... | mit | Python |
cb5cfc736f5e900f4844ea78e7cad1df4cdf3106 | Fix phploc command | mi-schi/php-code-checker | app/metric/phploc.py | app/metric/phploc.py | from app.configuration import get_value
from app.helper import php
def execute():
print '--- phploc ---'
metric_dir = get_value('metric-dir')
scan_dir = get_value('project-dir')+get_value('scan-dir')
exclude_dirs = get_value('exclude-dirs')
excludes = ''
for exclude in exclude_dirs:
e... | from app.configuration import get_value
from app.helper import php
def execute():
print '--- phploc ---'
metric_dir = get_value('metric-dir')
scan_dir = get_value('project-dir')+get_value('scan-dir')
excludes = ' '.join(get_value('exclude-dirs'))
print '>>> Metric dir: '+metric_dir
print '>>>... | mit | Python |
86df5fe205e3a913f5048bef3aa29804dd731d4b | Fix (another) syntax error. Thanks, bumpversion | livio/DocDown-Python,livio/DocDown-Python,livio/DocDown-Python,livio/DocDown-Python,livio/DocDown-Python,livio/DocDown-Python | docdown/__init__.py | docdown/__init__.py | # -*- coding: utf-8 -*-
__author__ = """Jason Emerick"""
__email__ = 'jason@mobelux.com'
__version__ = '0.2.7'
| # -*- coding: utf-8 -*-
__author__ = """Jason Emerick"""
__email__ = 'jason@mobelux.com'
__version__ = '__version__ = '__version__ = '__version__ = '0.2.7''''
| bsd-3-clause | Python |
7e1d42e6730336296ef3b702eb4cde64ce8410c5 | Define default values for host and port | glowdigitalmedia/docker-puller,nicocoffo/docker-puller,nicocoffo/docker-puller,glowdigitalmedia/docker-puller | dockerpuller/app.py | dockerpuller/app.py | from flask import Flask
from flask import request
from flask import jsonify
import json
import subprocess
app = Flask(__name__)
config = None
@app.route('/', methods=['POST'])
def hook_listen():
if request.method == 'POST':
token = request.args.get('token')
if token == config['token']:
... | from flask import Flask
from flask import request
from flask import jsonify
import json
import subprocess
app = Flask(__name__)
config = None
@app.route('/', methods=['POST'])
def hook_listen():
if request.method == 'POST':
token = request.args.get('token')
if token == config['token']:
... | mit | Python |
9808e97747785c27387ad1ce9ffc3e9a05c80f08 | Create class for the reflectors | ranisalt/enigma | enigma.py | enigma.py | import string
class Steckerbrett:
def __init__(self):
pass
class Umkehrwalze:
def __init__(self, wiring):
self.wiring = wiring
def encode(self, letter):
return self.wiring[string.ascii_uppercase.index(letter)]
class Walzen:
def __init__(self):
pass
class Enigma:
... | import string
class Steckerbrett:
def __init__(self):
pass
class Walzen:
def __init__(self):
pass
class Enigma:
def __init__(self):
pass
def cipher(self, message):
pass | mit | Python |
896bae4c92cc952f8675e2048fe3f6bd84c811aa | define '_stash' in wget.py | ywangd/stash,ywangd/stash | bin/wget.py | bin/wget.py | """ Download a file from a url.
"""
from __future__ import print_function
import sys
import argparse
try:
import urllib2
except ImportError:
# py3
import urllib.request as urllib2
try:
import clipboard
import console
except:
import dummyconsole as console
_stash = globals()["_stash"]
def main(args):... | """ Download a file from a url.
"""
from __future__ import print_function
import sys
import argparse
try:
import urllib2
except ImportError:
# py3
import urllib.request as urllib2
try:
import clipboard
import console
except:
import dummyconsole as console
def main(args):
ap = argparse.ArgumentPa... | mit | Python |
6cf9d5af57ad4027b3148aecd9e41da503535ab4 | remove unneeded import | AlucardZero/python-rift-event-tracker | events.py | events.py | #!/usr/bin/env python
import requests
import json
import json
import time
import math
import os
import tempfile
from yattag import Doc
url = "https://web-api-us.riftgame.com/chatservice/zoneevent/list?shardId="
outputdir = "./"
allshards = {
'us': {
1701: 'Seastone',
1702: 'Greybriar',
1704: 'Deepwood',... | #!/usr/bin/env python
import requests
import json
import sys
import json
import time
import math
import os
import tempfile
from yattag import Doc
url = "https://web-api-us.riftgame.com/chatservice/zoneevent/list?shardId="
outputdir = "./"
allshards = {
'us': {
1701: 'Seastone',
1702: 'Greybriar',
1704: ... | mit | Python |
923ab1adf05f0bcea16fcd68d405cf7a4831c378 | exit gracefully on KeyboardInterrupt this happens when pyvcp is called from a halrun script and the user types 'exit' at the halcmd prompt | cdsteinkuehler/MachineKit,strahlex/machinekit,unseenlaser/linuxcnc,bmwiedemann/linuxcnc-mirror,kinsamanka/machinekit,RunningLight/machinekit,bobvanderlinden/machinekit,ikcalB/linuxcnc-mirror,ianmcmahon/linuxcnc-mirror,narogon/linuxcnc,cdsteinkuehler/MachineKit,unseenlaser/machinekit,bmwiedemann/linuxcnc-mirror,jaguarca... | src/hal/user_comps/pyvcp.py | src/hal/user_comps/pyvcp.py | #!/usr/bin/env python
# This is a component of emc
# Copyright 2007 Anders Wallin <anders.wallin@helsinki.fi>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of... | #!/usr/bin/env python
# This is a component of emc
# Copyright 2007 Anders Wallin <anders.wallin@helsinki.fi>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of... | lgpl-2.1 | Python |
435a30bf3a7fa41ed918cf132d65177d5431b7a2 | add globals for direction | mdprewitt/sigmund_droid,mdprewitt/sigmund_droid,mdprewitt/sigmund_droid | globals.py | globals.py | X_POSITION = 0
Y_POSITION = 0
RED_DESK = tuple(30, 20)
BLUE_DESK = tuple(30, -20)
ROTATIONS_PER_CM = .7
ROTATIONS_PER_DEGREE = .5 # how many rotations to turn specified degrees
"""
0
|
-90/270 ---|--- 90/-270
|
180/-180
"""
DIRECTION = 0
LEFT_MOTOR = LargeMotor(OUTPUT_A)
RIG... | X_POSITION = 0
Y_POSITION = 0
RED_DESK = tuple(30, 20)
BLUE_DESK = tuple(30, -20)
| mit | Python |
b4434725a5b546e11153afdb7b3c70b24cd4cc61 | Make check-whitespace.py exit 1 on whitespace errors | planetlabs/ol3,bill-chadwick/ol3,kkuunnddaannkk/ol3,llambanna/ol3,geonux/ol3,aisaacs/ol3,bill-chadwick/ol3,epointal/ol3,wlerner/ol3,das-peter/ol3,bill-chadwick/ol3,ahocevar/ol3,Antreasgr/ol3,Morgul/ol3,adube/ol3,fperucic/ol3,bogdanvaduva/ol3,bjornharrtell/ol3,CandoImage/ol3,oterral/ol3,Antreasgr/ol3,stweil/ol3,alvinlin... | bin/check-whitespace.py | bin/check-whitespace.py | import logging
import re
import sys
logging.basicConfig(format='%(asctime)s %(name)s: %(message)s',
level=logging.INFO)
logger = logging.getLogger('check-whitespace')
CR_RE = re.compile(r'\r')
LEADING_WHITESPACE_RE = re.compile(r'\s+')
TRAILING_WHITESPACE_RE = re.compile(r'\s+\n\Z')
NO_NEWLINE_RE... | import logging
import re
import sys
logging.basicConfig(format='%(asctime)s %(name)s: %(message)s',
level=logging.INFO)
logger = logging.getLogger('check-whitespace')
CR_RE = re.compile(r'\r')
LEADING_WHITESPACE_RE = re.compile(r'\s+')
TRAILING_WHITESPACE_RE = re.compile(r'\s+\n\Z')
NO_NEWLINE_RE... | bsd-2-clause | Python |
dc0368507737c9569225a886979a8a38d2ef85b0 | Change move to middle code V1.1.2 | lcarlossandberg/Bad_Boids | Boids/Bad_Boids.py | Boids/Bad_Boids.py | from matplotlib import pyplot as plt
from matplotlib import animation
import random
import numpy as np
Birds = 50 #number of birds in the simulation
def new_flock(count, lower_limits, upper_limits):
#returns two colums of random numbers between the limits
#for ll=[a,b] & ul=[c,d], colum1 is between a-c and 2... | from matplotlib import pyplot as plt
from matplotlib import animation
import random
import numpy as np
Birds = 50 #number of birds in the simulation
def new_flock(count, lower_limits, upper_limits):
#returns two colums of random numbers between the limits
#for ll=[a,b] & ul=[c,d], colum1 is between a-c and 2... | mit | Python |
d06390859c0c74f26fd4f1a5ed3876be61eb3272 | Fix storage.py | itsmikej/Cobweb | cobweb/storage.py | cobweb/storage.py | # 存储器
import types
import os
class Storage:
def __init__(self, func=None):
self.base_dir = ''
if func is not None:
self.save = types.MethodType(func, self)
# 默认使用file储存
def save(self, filename, data):
if not self.base_dir or not os.path.exists(self.base_dir):
... | # 存储器
import types
import os
class Storage:
def __init__(self, func=None):
self.base_dir = 'E:\Cobweb\cobweb\\'
if func is not None:
self.save = types.MethodType(func, self)
# 默认使用file储存
def save(self, filename, data):
path = self.base_dir + filename
# 如果文件存在则... | mit | Python |
19d5acdf57d63998b642802eafa5cfed01aecea3 | create new get interface using v3 | globocom/GloboNetworkAPI-client-python | networkapiclient/ApiInterface.py | networkapiclient/ApiInterface.py | # -*- coding:utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "Lice... | # -*- coding:utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "Lice... | apache-2.0 | Python |
61cf4a8fb89347399d4e31983b569dadd5a07b48 | order vote by choices to avoid mixup in proposal_detail template | yohanboniface/memopol-core,yohanboniface/memopol-core,yohanboniface/memopol-core | apps/votes/models.py | apps/votes/models.py | from django.db import models
from reps.models import Representative
class Proposal(models.Model):
id = models.CharField(max_length=63, primary_key=True)
title = models.CharField(max_length=255, unique=True)
@property
def date(self):
return self.recommendation_set.all()[0].datetime.date()
clas... | from django.db import models
from reps.models import Representative
class Proposal(models.Model):
id = models.CharField(max_length=63, primary_key=True)
title = models.CharField(max_length=255, unique=True)
@property
def date(self):
return self.recommendation_set.all()[0].datetime.date()
clas... | agpl-3.0 | Python |
d4e506d1244ed28be572cdee02b979c9a4f44f7e | Refactor ButtonGenerator | BogyMitutoyoCTL/CalculatorCV | ButtonGenerator.py | ButtonGenerator.py | import cv2
from PictureStorage import PictureStorage
from Button import Button
class ButtonGenerator:
def __init__(self, picture_storage: PictureStorage):
self.picture = picture_storage.get_picture(0)
self.width = len(self.picture[0])
self.hight = len(self.picture)
self.section_cou... | import cv2
from PictureStorage import PictureStorage
from Button import Button
class ButtonGenerator:
def __init__(self, picture_storage: PictureStorage):
self.picture = picture_storage.get_picture(0)
self.width = len(self.picture[0])
self.hight = len(self.picture)
self.section_cou... | mit | Python |
d711d245bc8bdcb502da18304d5dc6e35f515675 | Update Security.py | MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab | service/Security.py | service/Security.py | #########################################
# Security.py
# description: used as a general template
# categories: simulator
# more info @: http://myrobotlab.org/service/Security
#########################################
# start the service
security = Runtime.start("security","Security")
# store & crypt secret infomati... | #########################################
# Security.py
# description: used as a general template
# categories: simulator
# more info @: http://myrobotlab.org/service/Security
#########################################
# start the service
security = Runtime.start("security","Security")
# store & crypt secret infomati... | apache-2.0 | Python |
6652e97570e5dbc39621a4f0dae99db65e84d577 | Update openblas.py | vadimkantorov/wigwam | wigs/openblas.py | wigs/openblas.py | class openblas(Wig):
tarball_uri = 'https://github.com/xianyi/OpenBLAS/archive/v$RELEASE_VERSION$.tar.gz'
last_release_version = 'v0.2.18'
supported_features = ['debug']
def setup(self):
self.skip('configure')
self.make_flags += ['FC=gfortran', 'NO_AFFINITY=1', 'USE_OPENMP=1']
self.make_install_flags += [S.P... | class openblas(Wig):
tarball_uri = 'https://github.com/xianyi/OpenBLAS/archive/v$RELEASE_VERSION$.tar.gz'
last_release_version = 'v0.2.18'
def setup(self):
self.skip('configure')
self.make_flags += ['FC=gfortran', 'NO_AFFINITY=1', 'USE_OPENMP=1']
self.make_install_flags += [S.PREFIX_MAKE_INSTALL_FLAG]
| mit | Python |
7e2df49c5bdb63f58f07074fadd5907858979819 | Update Audio FFT example. | iabdalkader/openmv,openmv/openmv,openmv/openmv,kwagyeman/openmv,kwagyeman/openmv,openmv/openmv,kwagyeman/openmv,openmv/openmv,iabdalkader/openmv,iabdalkader/openmv,kwagyeman/openmv,iabdalkader/openmv | scripts/examples/Arduino/37-Audio/audio_fft.py | scripts/examples/Arduino/37-Audio/audio_fft.py | import image, audio, time
from ulab import numpy as np
from ulab import scipy as sp
SIZE = 512//4
raw_buf = None
fb = image.Image(SIZE+50, SIZE, image.RGB565, copy_to_fb=True)
audio.init(channels=2, frequency=16000, gain=24, highpass=0.9883)
def audio_callback(buf):
# NOTE: do Not call any function that allocates... | import image, audio, time, array, math, ulab as np
from ulab import extras, numerical
SIZE = 512//4
pcm_buf = None
fb = image.Image(SIZE+50, SIZE, image.RGB565, copy_to_fb=True)
audio.init(channels=2, frequency=16000, gain=24, highpass=0.9883)
def audio_callback(buf):
global pcm_buf
if (pcm_buf == None):
... | mit | Python |
780f9de1f08f39c7f0cc03e1eb5fff580910b8dd | refactor code to better idea | jameshicks/pydigree,jameshicks/pydigree | pydigree/sgs/sgs.py | pydigree/sgs/sgs.py | from itertools import izip
from pydigree.common import runs
from pydigree import Population, PedigreeCollection
def sgs_pedigrees(pc, phaseknown=False):
shared = {}
for pedigree in pedigrees:
shared[pedigree] = sgs_population(pedigree)
return shared
def sgs_population(pop, phaseknown=False):
s... | from itertools import izip
from pydigree.common import runs
from pydigree import Population, PedigreeCollection
def sgs_pedigrees(pc, phaseknown=False):
shared = {}
for pedigree in pedigrees:
shared[pedigree] = sgs_population(pedigree)
return shared
def sgs_population(pop, phaseknown=False):
s... | apache-2.0 | Python |
3949754c4333ce2759a4eb286c4411f440bbde7b | Add the sphinx.ext.intersphinx plugin | willmcgugan/rich | docs/source/conf.py | docs/source/conf.py | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | mit | Python |
a652f302528dac1d6926da0cce1873d6f14129e2 | Add a missing conf | alorence/django-modern-rpc,alorence/django-modern-rpc | docs/source/conf.py | docs/source/conf.py | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.