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 |
|---|---|---|---|---|---|---|---|---|
d0120b5825a594262a0a84ecb75517e891c4c8e7 | remove unused methods from Gate | QISKit/qiskit-sdk-py,QISKit/qiskit-sdk-py,QISKit/qiskit-sdk-py | qiskit/_gate.py | qiskit/_gate.py | # -*- coding: utf-8 -*-
# Copyright 2017, IBM.
#
# This source code is licensed under the Apache License, Version 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
"""
Unitary gate.
"""
from ._instruction import Instruction
from ._quantumregister import QuantumRegister
from ._qiskiterror ... | # -*- coding: utf-8 -*-
# Copyright 2017, IBM.
#
# This source code is licensed under the Apache License, Version 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
"""
Unitary gate.
"""
from ._instruction import Instruction
from ._quantumregister import QuantumRegister
from ._qiskiterror ... | apache-2.0 | Python |
97a7ad3671be9fbaa39a00c5e10cce31fe34f22b | adjust order of extractions | kasperschmidt/TDOSE | tdose_examples/examples_scripts/tdose_perform_spectral_extraction.py | tdose_examples/examples_scripts/tdose_perform_spectral_extraction.py | #
# Performing gauss, aperture and modelimg extractions with TDOSE
#
# -------------------------------------------------------------------------------
# Importing
import glob
import tdose
import tdose_utilities as tu
# -------------------------------------------------------------------------------
# Defining working d... | #
# Performing gauss, aperture and modelimg extractions with TDOSE
#
# -------------------------------------------------------------------------------
# Importing
import glob
import tdose
import tdose_utilities as tu
# -------------------------------------------------------------------------------
# Defining working d... | mit | Python |
a17044bdfee94a249c1a252b1dfa2e90128f0301 | Convert expectedFlakeyDarwin to expectedFlakeyDsym for TestCallUserDefinedFunction.py | apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb | test/expression_command/call-function/TestCallUserDefinedFunction.py | test/expression_command/call-function/TestCallUserDefinedFunction.py | """
Test calling user defined functions using expression evaluation.
Note:
LLDBs current first choice of evaluating functions is using the IR interpreter,
which is only supported on Hexagon. Otherwise JIT is used for the evaluation.
"""
import unittest2
import lldb
import lldbutil
from lldbtest import *
class E... | """
Test calling user defined functions using expression evaluation.
Note:
LLDBs current first choice of evaluating functions is using the IR interpreter,
which is only supported on Hexagon. Otherwise JIT is used for the evaluation.
"""
import unittest2
import lldb
import lldbutil
from lldbtest import *
class E... | apache-2.0 | Python |
f3bdd3afcf2dcc4d5f0ec09f4c04e8097b338790 | Allow handling of str subclasses as well | chiangf/Flask-Elasticsearch | flask_elasticsearch.py | flask_elasticsearch.py | from elasticsearch import Elasticsearch
# Find the stack on which we want to store the database connection.
# Starting with Flask 0.9, the _app_ctx_stack is the correct one,
# before that we need to use the _request_ctx_stack.
try:
from flask import _app_ctx_stack as stack
except ImportError:
from flask impor... | from elasticsearch import Elasticsearch
# Find the stack on which we want to store the database connection.
# Starting with Flask 0.9, the _app_ctx_stack is the correct one,
# before that we need to use the _request_ctx_stack.
try:
from flask import _app_ctx_stack as stack
except ImportError:
from flask impor... | mit | Python |
087101ef698582935dda343272fcfef3f01a5652 | Update cms.py | dhorelik/django-cms,timgraham/django-cms,timgraham/django-cms,netzkolchose/django-cms,jsma/django-cms,Vegasvikk/django-cms,saintbird/django-cms,jproffitt/django-cms,yakky/django-cms,dhorelik/django-cms,philippze/django-cms,iddqd1/django-cms,jsma/django-cms,mkoistinen/django-cms,dhorelik/django-cms,vxsx/django-cms,mkois... | cms/management/commands/cms.py | cms/management/commands/cms.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from cms.management.commands.subcommands.base import SubcommandsCommand
from cms.management.commands.subcommands.check import CheckInstallation
from cms.management.commands.subcommands.list import ListCommand
from cms.management.commands.subcommands.moderat... | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from cms.management.commands.subcommands.base import SubcommandsCommand
from cms.management.commands.subcommands.check import CheckInstallation
from cms.management.commands.subcommands.list import ListCommand
from cms.management.commands.subcommands.moderat... | bsd-3-clause | Python |
ac4dff11e127c4fdaf4a5b5e39f5cb8d15352064 | Change (temporarily?) the unitarity to rounding due to errors appearing at small unitaries | sirmarcel/floq | floq/helpers/matrix.py | floq/helpers/matrix.py | import numpy as np
def is_unitary(u, tolerance=1e-10):
dim = u.shape[0]
unitary = np.eye(dim, dtype=np.complex128)
umat = np.mat(u)
product = umat.H * umat
# bla = np.abs(np.trace(product))/dim
# print('%.10f' % bla)
product = np.round(product, 10)
return np.allclose(product, unitary... | import numpy as np
def is_unitary(u, tolerance=1e-10):
unitary = np.eye(u.shape[0])
umat = np.mat(u)
product = umat.H * umat
return np.allclose(product, unitary, atol=tolerance)
def adjoint(m):
return np.transpose(np.conj(m))
def gram_schmidt(vecs):
"""Computes an orthonormal basis for the... | mit | Python |
a2d6a2b69ebadf24ef8b372930fb4039a74a0325 | Rename variable | jcollado/pic2map,jcollado/pic2map,jcollado/pic2map | pic2map/fs.py | pic2map/fs.py | # -*- coding: utf-8 -*-
"""Filesystem functionality."""
import logging
import os
import magic
logger = logging.getLogger(__name__)
class TreeExplorer(object):
"""Look for image files in a tree and return them.
:param directory: Base directory for the tree to be explored.
:type directory: str
"""... | # -*- coding: utf-8 -*-
"""Filesystem functionality."""
import logging
import os
import magic
logger = logging.getLogger(__name__)
class TreeExplorer(object):
"""Look for image files in a tree and return them.
:param directory: Base directory for the tree to be explored.
:type directory: str
"""... | mit | Python |
6a4ef9d49b87dbd91f370145e9de2bee8895cf90 | Repair dot parser | bartvanherck/python-graphwalker,spotify/python-graphwalker | graphwalker/dot.py | graphwalker/dot.py | # -*- coding: utf-8 -*-
# Copyright (c) 2013 Spotify AB
import dot_parser
def unquote(s):
return s[1:-1] if s and s[0] == s[-1] and s[0] in "\"\'" else s
def deserialize(d, **kw):
seqno = (lambda q=iter(xrange(0, 2 ** 31)).next: 'e%d' % q())
dot = dot_parser.parse_dot_data(d)
verts = dict((unquot... | # -*- coding: utf-8 -*-
# Copyright (c) 2013 Spotify AB
import dot_parser
def unquote(s):
return s[1:-1] if s and s[0] == s[-1] and s[0] in "\"\'" else s
def deserialize(d, **kw):
seqno = (lambda q=iter(xrange(0, 2 ** 31)).next: 'e%d' % q())
dot = dot_parser.parse_dot_data(d)
verts = [(unquote(no... | apache-2.0 | Python |
fd61905e02388aab2ccbf985b4d008e84ece93c0 | fix test | jerkos/mzOS | mzos/tests/test_integration.py | mzos/tests/test_integration.py | __author__ = 'Marc'
import unittest
import os.path as op
import os
import zipfile
import shutil
from mzos.exp_design import ExperimentalSettings
from mzos.peaklist_reader import PeakListReader
from mzos.annotator import PeakelsAnnotator
from mzos.stats import StatsModel
from mzos.bayesian_inference import BayesianInf... | __author__ = 'Marc'
import unittest
import os.path as op
import os
import zipfile
import shutil
from mzos.exp_design import ExperimentalSettings
from mzos.peaklist_reader import PeakListReader
from mzos.annotator import PeakelsAnnotator
from mzos.stats import StatsModel
from mzos.bayesian_inference import BayesianInf... | mit | Python |
384e1c3873d373aa9314225b139bbc0156644c1f | add encoded parameter when submit code | atupal/oj,atupal/oj,atupal/oj,atupal/oj,atupal/oj,atupal/oj | poj/submit.py | poj/submit.py | #!/usr/bin/env python2
"""
submit.py
~~~~~~~~~
submit code to poj
usage:
./submit.py file_name
file_name format: probmenId_xxx.c/cpp
"""
import requests
import sys
import os
import time
from bs4 import BeautifulSoup
s = requests.Session()
try:
with open('./user') as fi:
user = fi.rea... | #!/usr/bin/env python2
"""
submit.py
~~~~~~~~~
submit code to poj
usage:
./submit.py file_name
file_name format: probmenId_xxx.c/cpp
"""
import requests
import sys
import os
import time
from bs4 import BeautifulSoup
s = requests.Session()
try:
with open('./user') as fi:
user = fi.rea... | mit | Python |
0f25667571d28bab95e0eb581f9c8f5169838e54 | Fix grover_example not working with Python < 2.6. | Titan-C/sympy,kumarkrishna/sympy,Curious72/sympy,ChristinaZografou/sympy,MechCoder/sympy,Davidjohnwilson/sympy,hrashk/sympy,drufat/sympy,beni55/sympy,MechCoder/sympy,liangjiaxing/sympy,jbbskinny/sympy,MridulS/sympy,wanglongqi/sympy,madan96/sympy,mcdaniel67/sympy,kevalds51/sympy,VaibhavAgarwalVA/sympy,mafiya69/sympy,rah... | examples/advanced/grover_example.py | examples/advanced/grover_example.py | #!/usr/bin/env python
"""Grover's quantum search algorithm example."""
from sympy import pprint
from sympy.physics.quantum import qapply
from sympy.physics.quantum.qubit import IntQubit
from sympy.physics.quantum.grover import (OracleGate, superposition_basis,
WGate, grover_iteration)
def demo_vgate_app(v):
... | #!/usr/bin/env python
"""Grover's quantum search algorithm example."""
from sympy import pprint
from sympy.physics.quantum import qapply
from sympy.physics.quantum.qubit import IntQubit
from sympy.physics.quantum.grover import (OracleGate, superposition_basis,
WGate, grover_iteration)
def demo_vgate_app(v):
... | bsd-3-clause | Python |
2bbff5cccf0fcee99cca0f24add1cf0cb8a6d8dc | Define properties correctly in surface3d example (#11612) | bokeh/bokeh,bokeh/bokeh,bokeh/bokeh,bokeh/bokeh,bokeh/bokeh | examples/app/surface3d/surface3d.py | examples/app/surface3d/surface3d.py | from bokeh.core.properties import Any, Dict, Instance, String
from bokeh.models import ColumnDataSource, LayoutDOM
# This defines some default options for the Graph3d feature of vis.js
# See: http://visjs.org/graph3d_examples.html for more details. Note
# that we are fixing the size of this component, in ``options``, ... | from bokeh.core.properties import Any, Dict, Instance, String
from bokeh.models import ColumnDataSource, LayoutDOM
# This defines some default options for the Graph3d feature of vis.js
# See: http://visjs.org/graph3d_examples.html for more details. Note
# that we are fixing the size of this component, in ``options``, ... | bsd-3-clause | Python |
02a189afc5fff327e7d5f91b1efdbcab6aa99d1f | Use the object name that matches its imported name | zepheira/amara,zepheira/amara,zepheira/amara,zepheira/amara,zepheira/amara,zepheira/amara | amara/xslt/tree/for_each_element.py | amara/xslt/tree/for_each_element.py | ########################################################################
# amara/xslt/tree/for_each_element.py
"""
Implementation of `xsl:for-each` element.
"""
from amara.namespaces import XSL_NAMESPACE
from amara.xslt import XsltError
from amara.xslt.tree import xslt_element, content_model, attribute_types
from amar... | ########################################################################
# amara/xslt/tree/for_each_element.py
"""
Implementation of `xsl:for-each` element.
"""
from amara.namespaces import XSL_NAMESPACE
from amara.xslt import XsltError
from amara.xslt.tree import xslt_element, content_model, attribute_types
from amar... | apache-2.0 | Python |
774b338b93582bece201ea92282686cf3f059cfa | kill off the 'paused' temporarily | BetterWorks/healthchecks,BetterWorks/healthchecks,BetterWorks/healthchecks,BetterWorks/healthchecks | hc/api/management/commands/sendalerts.py | hc/api/management/commands/sendalerts.py | import logging
import sys
import time
from concurrent.futures import ThreadPoolExecutor
from django.core.management.base import BaseCommand
from django.db import connection
from django.utils import timezone
from newrelic import agent
from hc.api.models import Check
executor = ThreadPoolExecutor(max_workers=10)
logge... | import logging
import sys
import time
from concurrent.futures import ThreadPoolExecutor
from django.core.management.base import BaseCommand
from django.db import connection
from django.utils import timezone
from newrelic import agent
from hc.api.models import Check
executor = ThreadPoolExecutor(max_workers=10)
logge... | bsd-3-clause | Python |
e1667795e705e284a3d3d483902faca96d20f8d4 | Bump version to 43.8.0 | alphagov/notifications-utils | notifications_utils/version.py | notifications_utils/version.py | __version__ = '43.8.0'
| __version__ = '43.7.1'
| mit | Python |
8791ddc33037f4ab3d93ae834fbbb9d551ab0837 | Add global level vars for other packages | hatchery/Genepool2,hatchery/genepool | genes/debian/traits.py | genes/debian/traits.py | from functools import wraps
import platform
# FIXME: had to duplicate this for package level imports. this is a bad design
operating_system = platform.system()
distribution, version, codename = platform.linux_distribution()
def is_debian(versions=None, distro_name='Debian'):
# FIXME: this is duplicated above. F... | from functools import wraps
import platform
def is_debian(versions=None, distro_name='Debian'):
operating_system = platform.system()
distribution, version, codename = platform.linux_distribution()
is_version = True
if versions:
is_version = version in versions or codename in versions
retu... | mit | Python |
fb30f5593a36a03cd454aaddd826e0e22f95e738 | check quants in same company as user | xpansa/stock-logistics-workflow,xpansa/stock-logistics-workflow | stock_picking_show_product_locations/models/stock_move.py | stock_picking_show_product_locations/models/stock_move.py | # -*- coding: utf-8 -*-
# © 2015 Xpansa Group
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import api, fields, models
class StockMove(models.Model):
_inherit = 'stock.move'
@api.one
@api.depends('product_id')
def _compute_locations_with_product(self):
if ... | # -*- coding: utf-8 -*-
# © 2015 Xpansa Group
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import api, fields, models
class StockMove(models.Model):
_inherit = 'stock.move'
@api.one
@api.depends('product_id')
def _compute_locations_with_product(self):
if ... | agpl-3.0 | Python |
45b12d1f2aacd2be9ed059f9f2212ce288161c65 | Add a filter for order-maintaining merging lists of dictable items | galaxyproject/ansible-common-roles,galaxyproject/ansible-common-roles | filter_plugins/inheritance_utils.py | filter_plugins/inheritance_utils.py | from collections import OrderedDict
from functools import partial
from itertools import chain
from ansible.errors import AnsibleError
def subelement_union(chain, key, subkey):
# this will not merge any keys other than subkey, and subkey must be a list
r = OrderedDict()
# if a lookup plugin is called in t... | from collections import OrderedDict
def subelement_union(chain, key, subkey):
# this will not merge any keys other than subkey, and subkey must be a list
r = OrderedDict()
# if a lookup plugin is called in the variable context and returns a
# one-element list, the return value is replaced with the ele... | mit | Python |
9c657fff7dd7f901e57fb5269588f27afa45bece | make usage() more accurate | rep/pymtbl | examples/pymtbl_make_random_table.py | examples/pymtbl_make_random_table.py | #!/usr/bin/env python
import locale
import random
import string
import sys
import time
import mtbl
report_interval = 10000000
megabyte = 1048576.0
def main(fname, num_keys):
writer = mtbl.writer(fname, compression=mtbl.COMPRESSION_SNAPPY)
a = time.time()
last = a
total_bytes = 0
count = 0
w... | #!/usr/bin/env python
import locale
import random
import string
import sys
import time
import mtbl
report_interval = 10000000
megabyte = 1048576.0
def main(fname, num_keys):
writer = mtbl.writer(fname, compression=mtbl.COMPRESSION_SNAPPY)
a = time.time()
last = a
total_bytes = 0
count = 0
w... | apache-2.0 | Python |
a8f9f1dffc9dd345504005427f9f02ae8e1e07a4 | Fix mistake in search index update check | ryankanno/froide,CodeforHawaii/froide,fin/froide,LilithWittmann/froide,ryankanno/froide,stefanw/froide,ryankanno/froide,okfse/froide,CodeforHawaii/froide,okfse/froide,okfse/froide,catcosmo/froide,stefanw/froide,LilithWittmann/froide,ryankanno/froide,fin/froide,ryankanno/froide,catcosmo/froide,catcosmo/froide,LilithWitt... | froide/foirequest/search_indexes.py | froide/foirequest/search_indexes.py | from haystack import indexes
from celery_haystack.indexes import CelerySearchIndex
from .models import FoiRequest
class FoiRequestIndex(CelerySearchIndex, indexes.Indexable):
text = indexes.EdgeNgramField(document=True, use_template=True)
title = indexes.CharField(model_attr='title')
description = index... | from haystack import indexes
from celery_haystack.indexes import CelerySearchIndex
from .models import FoiRequest
class FoiRequestIndex(CelerySearchIndex, indexes.Indexable):
text = indexes.EdgeNgramField(document=True, use_template=True)
title = indexes.CharField(model_attr='title')
description = index... | mit | Python |
32d1997fbe0b666b8b62ed08d6cb186996ee7cf1 | Fix breaking comparisons on UPPER and lower case consonants | introprogramming/exercises,introprogramming/exercises,introprogramming/exercises | exercises/robbers_language/robber.py | exercises/robbers_language/robber.py | #
# Robber's Language translator for Swedish words
#
# Usage:
#
# python robber.py [word|path to text file]
#
# Run without arguments to start an interactive CLI.
#
# Intentionally long source for educational purposes.
#
import sys
import os
import mimetypes
# Helpers
CONSONANTS = "qwrtpsdfghjklzxcvbnm"
SUFFIX = 'o'... | #
# Robber's Language translator for Swedish words
#
# Usage:
#
# python robber.py [word|path to text file]
#
# Run without arguments to start an interactive CLI.
#
# Intentionally long source for educational purposes.
#
import sys
import os
import mimetypes
# Helpers
CONSONANTS = "qwrtpsdfghjklzxcvbnm"
SUFFIX = 'o'... | mit | Python |
1b41cacac717ca2cb5027626b1521777e0bdcf83 | Improve ujson coverage. | torwag/micropython,pozetroninc/micropython,toolmacher/micropython,alex-robbins/micropython,swegener/micropython,alex-robbins/micropython,pfalcon/micropython,puuu/micropython,PappaPeppar/micropython,HenrikSolver/micropython,tobbad/micropython,torwag/micropython,swegener/micropython,adafruit/circuitpython,pfalcon/micropy... | tests/extmod/ujson_loads.py | tests/extmod/ujson_loads.py | try:
import ujson as json
except:
import json
def my_print(o):
if isinstance(o, dict):
print('sorted dict', sorted(o.items()))
else:
print(o)
my_print(json.loads('null'))
my_print(json.loads('false'))
my_print(json.loads('true'))
my_print(json.loads('1'))
my_print(json.loads('-2'))
my_... | try:
import ujson as json
except:
import json
def my_print(o):
if isinstance(o, dict):
print('sorted dict', sorted(o.items()))
else:
print(o)
my_print(json.loads('null'))
my_print(json.loads('false'))
my_print(json.loads('true'))
my_print(json.loads('1'))
my_print(json.loads('-2'))
my_... | mit | Python |
dbe66d9853fa369346ee236b0920bebd0b5f9b4f | Remove unnecessary import | stepanov-valentin/lpschedule,stepanov-valentin/lpschedule,stenvix/lpschedule,stenvix/lpschedule,stenvix/lpschedule,stepanov-valentin/lpschedule,stenvix/lpschedule,stepanov-valentin/lpschedule | tests/server/test_simple.py | tests/server/test_simple.py | def simple_test():
return 1
def test_simple_test():
assert simple_test() == 1
#def test_scraper():
# bot = ScheduleParser(thread_number=2)
# bot.run()
| from schedule.scraper import *
def simple_test():
return 1
def test_simple_test():
assert simple_test() == 1
#def test_scraper():
# bot = ScheduleParser(thread_number=2)
# bot.run()
| mit | Python |
2afb11f26565f02fd8b67b530ad617f277f6599b | fix tests | aumayr/beancount-web,beancount/fava,beancount/fava,aumayr/beancount-web,yagebu/fava,aumayr/beancount-web,beancount/fava,beancount/fava,beancount/fava,yagebu/fava,yagebu/fava,yagebu/fava,yagebu/fava,aumayr/beancount-web | tests/test_core_holdings.py | tests/test_core_holdings.py | import datetime
from beancount.core.data import Transaction
from fava.core.holdings import inventory_at_dates
def test_inventory_at_dates(load_doc):
"""
plugin "auto_accounts"
2016-01-01 *
Equity:Unknown
Assets:Cash 5000 USD
2016-01-02 *
Assets:Account1 15 HOOL {123... | import datetime
from beancount.core.data import Transaction
from fava.core.holdings import inventory_at_dates
def test_inventory_at_dates(load_doc):
"""
plugin "auto_accounts"
2016-01-01 *
Equity:Unknown
Assets:Cash 5000 USD
2016-01-02 *
Assets:Account1 15 HOOL {123... | mit | Python |
4858a17940ec4b4425f743813c0c1ecef391d967 | Add test for file iteration | paetzke/format-sql | tests/test_file_handling.py | tests/test_file_handling.py | # -*- coding: utf-8 -*-
"""
format-sql
Copyright (c) 2014, Friedrich Paetzke (paetzke@fastmail.fm)
All rights reserved.
"""
import os
import sys
from format_sql.file_handling import format_file, load_from_file, main
try:
from unittest.mock import patch
except ImportError:
from mock import patch
def get_te... | # -*- coding: utf-8 -*-
"""
format-sql
Copyright (c) 2014, Friedrich Paetzke (paetzke@fastmail.fm)
All rights reserved.
"""
import os
from format_sql.file_handling import format_file, load_from_file, main
def get_test_file(filename):
test_data = os.path.dirname(os.path.abspath(os.path.dirname(__file__)))
f... | bsd-2-clause | Python |
c57f6ba833c1c634c0952be500863932c83d12f5 | Update test_other_devices.py | RPi-Distro/python-gpiozero,waveform80/gpio-zero | tests/test_other_devices.py | tests/test_other_devices.py | from __future__ import (
unicode_literals,
absolute_import,
print_function,
division,
)
str = type('')
import warnings
import pytest
from gpiozero import *
from datetime import time
def test_PingServer_init():
with PingServer('localhost') as server:
assert server.host == 'localhost'
... | from __future__ import (
unicode_literals,
absolute_import,
print_function,
division,
)
str = type('')
import warnings
import pytest
from gpiozero import *
def test_PingServer_init():
with PingServer('localhost') as server:
assert server.host == 'localhost'
def test_PingServer_repr(... | bsd-3-clause | Python |
b6c8b74b8604376f41ec6e5466a44e5cc90f1212 | bump version | hhatto/poyonga | poyonga/__init__.py | poyonga/__init__.py | from poyonga.client import Groonga
from poyonga.result import GroongaResult
__version__ = '0.2.4'
__all__ = ['Groonga', 'GroongaResult']
| from poyonga.client import Groonga
from poyonga.result import GroongaResult
__version__ = '0.2.3'
__all__ = ['Groonga', 'GroongaResult']
| mit | Python |
b23bfc088d82f66bc6111269db267e53f1d4acd1 | Add Comments | JonShepChen/Puddit | puddit/app.py | puddit/app.py | '''
Python script to monitor a subreddit for new posts.
User will be notified via pushbullet when a new post is detected.
'''
import os
import requests
import json
import time
already_pushed = []
loop_count = 0
pb_request_url = 'https://api.pushbullet.com/v2/pushes'
pb_request_body = {"type":"link"}
content_type = 'ap... | import os
import requests
import json
import time
already_pushed = []
loop_count = 0
pb_request_url = 'https://api.pushbullet.com/v2/pushes'
pb_request_body = {"type":"link"}
content_type = 'application/json'
target_subreddit = input("Which subreddit would you like to monitor?: ")
reddit_request_url = 'http://www.red... | mit | Python |
e8294fcaad64a50c55b20bc8613c7933622e358c | Fix argument parsing | vasi/pystickies | pystickies.py | pystickies.py | #!/usr/bin/python
import os
import argparse
import struct
from cStringIO import StringIO
def rtfDoc(r):
from pyth.plugins.rtf15.reader import Rtf15Reader
return Rtf15Reader.read(StringIO(r))
def rtfTextTerm(text, props):
from termcolor import colored
attrs = None
if 'bold' in props:
attrs = ['bold']
elif 'un... | #!/usr/bin/python
import os
import argparse
import struct
from cStringIO import StringIO
def rtfDoc(r):
from pyth.plugins.rtf15.reader import Rtf15Reader
return Rtf15Reader.read(StringIO(r))
def rtfTextTerm(text, props):
from termcolor import colored
attrs = None
if 'bold' in props:
attrs = ['bold']
elif 'un... | bsd-2-clause | Python |
77f4215d07bb84f3c0bde4b611c8017b5ca560b1 | fix home | qiniu/python-sdk,jemygraw/python-sdk,forrest-mao/python-sdk | qiniu/main.py | qiniu/main.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
from qiniu import etag
def main():
parser = argparse.ArgumentParser(prog='qiniu')
sub_parsers = parser.add_subparsers()
parser_etag = sub_parsers.add_parser(
'etag', description='calculate the etag of the file', help='etag [file...]... | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
from qiniu import etag
def main():
parser = argparse.ArgumentParser(prog='qiniu')
sub_parsers = parser.add_subparsers()
parser_etag = sub_parsers.add_parser(
'etag', description='calculate the etag of the file', help='etag [file...]... | mit | Python |
a3ee8bbd93f26efb0994706eec82fae0d80c90dd | refactor convertor unittests | sulami/feed2maildir | feed2maildir/tests/convertertests.py | feed2maildir/tests/convertertests.py | #!/usr/bin/env python
# coding: utf-8
import json
import unittest
import feed2maildir.converter
class ConverterTestCase(unittest.TestCase):
def setUp(self):
# Construct something the reader is expected to spit out
self.test = {
'test': {
'feed': {
'... | #!/usr/bin/env python
# coding: utf-8
import json
import unittest
import feed2maildir.converter
class ConverterTestCase(unittest.TestCase):
def test_db_does_not_exist(self):
converter = feed2maildir.converter.Converter('fds', db='/nothing')
self.assertIsNone(converter.db)
def test_db_is_gibb... | isc | Python |
1adeaff5e7d3c84ed4b0cba4207658fd1401ee41 | fix ModuleBackwardsCompatibility test | xpybuild/xpybuild,xpybuild/xpybuild,xpybuild/xpybuild,xpybuild/xpybuild | tests/correctness/framework/ModuleBackwardsCompatibility/Input/test.xpybuild.py | tests/correctness/framework/ModuleBackwardsCompatibility/Input/test.xpybuild.py | from xpybuild.buildcommon import enableLegacyXpybuildModuleNames
enableLegacyXpybuildModuleNames()
import os, logging
from propertysupport import *
from buildcommon import *
import pathsets as oldpathsets
import xpybuild.pathsets as newpathsets
# deliberately use old names
from targets.writefile import WriteFile
fr... | from xpybuild.buildcommon import enableLegacyXpybuildModuleNames
enableLegacyXpybuildModuleNames()
import os, logging
from propertysupport import *
from buildcommon import *
import pathsets as oldpathsets
import xpybuild.pathsets as newpathsets
# deliberately use old names
from targets.writefile import WriteFile
fr... | apache-2.0 | Python |
27d7b60a4e0bef0a3087ddbac09912c274bdb23b | Remove completed TODO notes. | praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go | go/vumitools/credit.py | go/vumitools/credit.py | # -*- test-case-name: go.vumitools.tests.test_credit -*-
# TODO: create worker that updates Riak
class CreditManager(object):
def __init__(self, r_server, r_prefix):
self.r_server = r_server
self.r_prefix = r_prefix
def get_credit(self, user_account_key):
"""Return the amount of cred... | # -*- test-case-name: go.vumitools.tests.test_credit -*-
# TODO: create management command
# TODO: update django settings
# TODO: create worker that updates Riak
class CreditManager(object):
def __init__(self, r_server, r_prefix):
self.r_server = r_server
self.r_prefix = r_prefix
def get_cre... | bsd-3-clause | Python |
57711989e1f56b2396daefac85a2a6219f62f1a9 | fix path serializer with all available columns | GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,makinacorpus/Geotrek | geotrek/core/serializers.py | geotrek/core/serializers.py | from mapentity.serializers.fields import MapentityBooleanField, MapentityDateTimeField
from rest_framework import serializers
from rest_framework_gis.fields import GeometryField
from rest_framework_gis.serializers import GeoFeatureModelSerializer
from geotrek.core.models import Path, Trail
class PathSerializer(seria... | from rest_framework.serializers import ModelSerializer
from rest_framework_gis.fields import GeometryField
from rest_framework_gis.serializers import GeoFeatureModelSerializer
from geotrek.core.models import Path, Trail
class PathSerializer(ModelSerializer):
class Meta:
model = Path
id_field = 'i... | bsd-2-clause | Python |
af209630b324f8923be519b13785a5d4c29b0921 | Update error message | WT-Swish/swish | client.py | client.py | import requests
import config
from swish.recognize import listen, speech_to_text
from swish.speak import speak
try:
while True:
print("Begin speaking.")
speech = listen()
print("Stopped listening.")
text = speech_to_text(speech)
print("YOU SAID:", text)
response ... | import requests
import config
from swish.recognize import listen, speech_to_text
from swish.speak import speak
try:
while True:
print("Begin speaking.")
speech = listen()
print("Stopped listening.")
text = speech_to_text(speech)
print("YOU SAID:", text)
response ... | mit | Python |
889a4e9898e99dd6165c90fb53b796f2741f53d0 | Handle PodNotFoundError for build. | grow/grow,denmojo/pygrow,grow/pygrow,denmojo/pygrow,vitorio/pygrow,grow/grow,denmojo/pygrow,vitorio/pygrow,grow/pygrow,codedcolors/pygrow,grow/pygrow,grow/grow,vitorio/pygrow,denmojo/pygrow,codedcolors/pygrow,codedcolors/pygrow,grow/grow | grow/commands/build.py | grow/commands/build.py | from grow.common import utils
from grow.deployments.destinations import local as local_destination
from grow.deployments.stats import stats
from grow.pods import pods
from grow.pods import storage
import click
import os
@click.command()
@click.argument('pod_path', default='.')
@click.option('--out_dir', help='Where t... | from grow.common import utils
from grow.deployments.destinations import local as local_destination
from grow.deployments.stats import stats
from grow.pods import pods
from grow.pods import storage
import click
import os
@click.command()
@click.argument('pod_path', default='.')
@click.option('--out_dir', help='Where t... | mit | Python |
28a5706e2be64a6db1f4b24ce309b9ad1c418d92 | Add half() and hair() methods | zacbir/geometer | colors.py | colors.py | import random
from math import sqrt
class Color(object):
@classmethod
def from_full_value(cls, r, g, b, a=255):
return cls(r/255.0, g/255.0, b/255.0, a/255.0)
def __init__(self, r, g, b, a=1.0):
self.r = r
self.g = g
self.b = b
self.a = a
def rgba(self, a=Non... | import random
from math import sqrt
class Color(object):
@classmethod
def from_full_value(cls, r, g, b, a=255):
return cls(r/255.0, g/255.0, b/255.0, a/255.0)
def __init__(self, r, g, b, a=1.0):
self.r = r
self.g = g
self.b = b
self.a = a
def rgba(self, a=Non... | mit | Python |
d0af439b02195e6880b04207438c99cfcd3bf06e | Add log.error | femtotrader/ig-markets-stream-api-python-library,ig-python/ig-markets-api-python-library | trading_ig_stream/ig_stream.py | trading_ig_stream/ig_stream.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import sys
import traceback
import logging
from .lightstreamer import LSClient
log = logging.getLogger('ig_stream')
class IGStreamService(object):
def __init__(self, ig_service):
self.ig_servi... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import sys
import traceback
import logging
from .lightstreamer import LSClient
log = logging.getLogger('ig_stream')
class IGStreamService(object):
def __init__(self, ig_service):
self.ig_servi... | bsd-3-clause | Python |
ef035e91b695d1e079b8a3f43ea5c7e32f5217b2 | Bump expected release version to v4.3.0 | willthames/ansible-lint | lib/ansiblelint/rules/NestedJinjaRule.py | lib/ansiblelint/rules/NestedJinjaRule.py | # Copyright (c) 2020, Red Hat, Inc.
#
# 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, dist... | # Copyright (c) 2020, Red Hat, Inc.
#
# 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, dist... | mit | Python |
17f3d95e93a5e07b58d3d0476a9a3412b8f3f98d | remove unit test check from PRESUBMIT.py | luci/luci-py,luci/luci-py,luci/luci-py,luci/luci-py | appengine/auth_service/PRESUBMIT.py | appengine/auth_service/PRESUBMIT.py | # Copyright 2014 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
"""Top-level presubmit script for auth server.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for
details on the pre... | # Copyright 2014 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
"""Top-level presubmit script for auth server.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for
details on the pre... | apache-2.0 | Python |
81e2b4c4e4846aeedcb493ea655887bf76b864f7 | Update User.py | hoehnp/sirius,hoehnp/sirius,claritylab/sirius,claritylab/sirius,claritylab/sirius,claritylab/sirius,hoehnp/sirius,hoehnp/sirius,claritylab/sirius,claritylab/sirius,claritylab/sirius,hoehnp/sirius,hoehnp/sirius,hoehnp/sirius | lucida/commandcenter/controllers/User.py | lucida/commandcenter/controllers/User.py | from flask import *
from Database import database
from RegistrationForm import RegistrationForm
from LoginForm import LoginForm
from AccessManagement import login_required
user = Blueprint('user', __name__, template_folder='templates')
@user.route('/signup', methods=['GET', 'POST'])
def signup_route():
# Check if t... | from flask import *
from Database import database
from RegistrationForm import RegistrationForm
from LoginForm import LoginForm
from AccessManagement import login_required
user = Blueprint('user', __name__, template_folder='templates')
@user.route('/signup', methods=['GET', 'POST'])
def signup_route():
# Check if t... | bsd-3-clause | Python |
0c10d98f8ad88340958cf7dc77960886b69a62e4 | Improve typing information. | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | packages/syft/src/syft/core/tensor/autograd/backward_ops/transpose.py | packages/syft/src/syft/core/tensor/autograd/backward_ops/transpose.py | # stdlib
from uuid import UUID
# third party
from numpy import ndarray
# relative
from syft.lib.python import Tuple
from ..tensor import AutogradTensor
from .op import Op
class TransposeOp(Op):
"""Repeat operation across a dimension"""
def forward(self, x: AutogradTensor, *dims: Tuple[int]) -> AutogradTen... | # stdlib
from uuid import UUID
# third party
from numpy import ndarray
# relative
from ..tensor import AutogradTensor
from .op import Op
class TransposeOp(Op):
"""Repeat operation across a dimension"""
def forward(self, x: AutogradTensor, *dims: tuple) -> AutogradTensor: # type: ignore
self.x = x
... | apache-2.0 | Python |
16214545b301aaba4847ffae5efe67782abe993d | Add tests for curried merge | machinelearningdeveloper/toolz,llllllllll/toolz,jdmcbr/toolz,llllllllll/toolz,pombredanne/toolz,machinelearningdeveloper/toolz,simudream/toolz,jcrist/toolz,cpcloud/toolz,quantopian/toolz,jcrist/toolz,jdmcbr/toolz,pombredanne/toolz,cpcloud/toolz,simudream/toolz,quantopian/toolz | toolz/tests/test_curried.py | toolz/tests/test_curried.py | import toolz
import toolz.curried
from toolz.curried import (take, first, second, sorted, merge_with, reduce,
merge)
from collections import defaultdict
from operator import add
def test_take():
assert list(take(2)([1, 2, 3])) == [1, 2]
def test_first():
assert first is toolz.iter... | import toolz
import toolz.curried
from toolz.curried import take, first, second, sorted, merge_with, reduce
from operator import add
def test_take():
assert list(take(2)([1, 2, 3])) == [1, 2]
def test_first():
assert first is toolz.itertoolz.first
def test_merge_with():
assert merge_with(sum)({1: 1}, ... | bsd-3-clause | Python |
53d928a118c8ff7804ee0e9f1de51786e9c8374f | Disable installation due to known issues | laslabs/vertical-medical,ShaheenHossain/eagle-medical,ShaheenHossain/eagle-medical,laslabs/vertical-medical | medical_prescription_sale/__openerp__.py | medical_prescription_sale/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) LasLabs, Inc [https://laslabs.com]. All Rights Reserved
#
##############################################################################
#
# Collaborators of this module:
# Written By: Da... | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) LasLabs, Inc [https://laslabs.com]. All Rights Reserved
#
##############################################################################
#
# Collaborators of this module:
# Written By: Da... | agpl-3.0 | Python |
46210dec89549f52409c4c1530a76ecbfa189be7 | fix SQLALCHEMY_DATABASE_URI | asm-products/saulify-web,asm-products/saulify-web,asm-products/saulify-web | config.py | config.py | import os
CSRF_ENABLED = True
SECRET_KEY = 'you-will-never-guess'
# heroku addons:add heroku-postgresql:dev
# heroku pg:promote HEROKU_POSTGRESQL_{COLOR}_URL
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL')
| import os
CSRF_ENABLED = True
SECRET_KEY = 'you-will-never-guess'
# heroku addons:add heroku-postgresql:dev
# heroku pg:promote HEROKU_POSTGRESQL_{COLOR}_URL
SQLALCHEMY_DATABASE_URI = 'postgresql://saul:saul@localhost/test'
# os.environ.get('DATABASE_URL')
| agpl-3.0 | Python |
9797f6c5aee7fee0479f7c3f82a10e8376b040d9 | Advance version number 0.6.0 | TRUFA-rnaseq/trufa-web,TRUFA-rnaseq/trufa-web,TRUFA-rnaseq/trufa-web,TRUFA-rnaseq/trufa-web | config.py | config.py | VERSION = "0.6.0"
REMOTEHOST = "genorama@altamira1.ifca.es"
# for testing
REMOTEHOME = "testing"
DATADIR = "/gpfs/res_projects/cvcv/webserver/testing/"
# for stable
#REMOTEHOME = "users"
#DATADIR = "/gpfs/res_projects/cvcv/webserver/users/"
# for testing
PIPE_LAUNCH = "../server_side/pipe_launcher.py"
# for stable... | VERSION = "0.5.2"
REMOTEHOST = "genorama@altamira1.ifca.es"
# for testing
REMOTEHOME = "testing"
DATADIR = "/gpfs/res_projects/cvcv/webserver/testing/"
# for stable
#REMOTEHOME = "users"
#DATADIR = "/gpfs/res_projects/cvcv/webserver/users/"
# for testing
PIPE_LAUNCH = "../server_side/pipe_launcher.py"
# for stable... | bsd-3-clause | Python |
9e6f412cd8c63e457cb62f6e5b8675af930ef0f7 | Change match display limits | wizzomafizzo/hearthpy,wizzomafizzo/hearthpy | config.py | config.py | # hearthpy global config
db_filename = "hearthpy.db"
auth_filename = "hearthpy.auth"
port = 5000
match_limit = 21
front_match_limit = 21
card_limit = 22
winrate_tiers = [50, 60] # %
deck_template = "^(Dd|Hr|Me|Pn|Pt|Re|Sn|Wk|Wr) .+ \d+\.\d+$"
card_image_url = "http://wow.zamimg.com/images/hearthstone/cards/enus/origin... | # hearthpy global config
db_filename = "hearthpy.db"
auth_filename = "hearthpy.auth"
port = 5000
match_limit = 15
front_match_limit = 17
card_limit = 22
winrate_tiers = [50, 60] # %
deck_template = "^(Dd|Hr|Me|Pn|Pt|Re|Sn|Wk|Wr) .+ \d+\.\d+$"
card_image_url = "http://wow.zamimg.com/images/hearthstone/cards/enus/origin... | mit | Python |
5d19d340495e3c3dd113de027b39de8f24b5ec41 | update config | ojengwa/gfe | config.py | config.py | import os
from dateutil.tz import gettz
from celery.schedules import crontab
basedir = os.path.abspath(os.path.dirname(__file__))
class Config(object):
DEBUG = False
TESTING = False
CSRF_ENABLED = True
SQLALCHEMY_TRACK_MODIFICATIONS = False
SECRET_KEY = 'this-really-needs-to-be-changed'
SQLA... | import os
from dateutil.tz import gettz
from celery.schedules import crontab
basedir = os.path.abspath(os.path.dirname(__file__))
class Config(object):
DEBUG = False
TESTING = False
CSRF_ENABLED = True
SQLALCHEMY_TRACK_MODIFICATIONS = False
SECRET_KEY = 'this-really-needs-to-be-changed'
SQLA... | mit | Python |
0ee1e4d9a25c919f046bff3b689495349f44ad4d | change server url to https | arsh-co/pesteh-django | consts.py | consts.py | # -*- coding: utf-8 -*-
PESTEH_URL = u"https://cloud.arsh.co/pesteh/"
REGISTER_DEVICE_URL = u"{}devices/register".format(PESTEH_URL)
SEND_MESSAGE_URL = u"{}send".format(PESTEH_URL)
| # -*- coding: utf-8 -*-
PESTEH_URL = u"http://cloud.arsh.co/pesteh/"
REGISTER_DEVICE_URL = u"{}devices/register".format(PESTEH_URL)
SEND_MESSAGE_URL = u"{}send".format(PESTEH_URL)
| mit | Python |
172a120794496125975bbf2af6f3ce9e77cb446f | Fix filter_data for data with units | astropy/photutils,larrybradley/photutils | photutils/utils/convolution.py | photutils/utils/convolution.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import warnings
import numpy as np
from astropy.convolution import Kernel2D
from astropy.units import Quantity
from astropy.utils.exceptions import AstropyUserWarning
__all__ = ['filter_data']
def filter_data(data, kernel, mode='constant', fill_value... | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import warnings
import numpy as np
from astropy.convolution import Kernel2D
from astropy.utils.exceptions import AstropyUserWarning
__all__ = ['filter_data']
def filter_data(data, kernel, mode='constant', fill_value=0.0,
check_normali... | bsd-3-clause | Python |
e4244fd2dcd462e5f99bfb434f561d2b36cf75f6 | read from stdin per default | fuzzy-id/midas,fuzzy-id/midas,fuzzy-id/midas | midas/scripts/verify_indicator_stream.py | midas/scripts/verify_indicator_stream.py | # -*- coding: utf-8 -*-
import struct
import sys
import bitarray
from midas.scripts import MDCommand
FMT_u32="I"
def interpret_next_bits(fp, fmt=FMT_u32):
buf = fp.read(struct.calcsize(fmt))
if not buf:
return None
return struct.unpack(fmt, buf)[0]
def iter_features(fp, num_features):
bita... | # -*- coding: utf-8 -*-
import struct
import bitarray
from midas.scripts import MDCommand
FMT_u32="I"
def interpret_next_bits(fp, fmt=FMT_u32):
buf = fp.read(struct.calcsize(fmt))
if not buf:
return None
return struct.unpack(fmt, buf)[0]
def iter_features(fp, num_features):
bitarraysize = ... | bsd-3-clause | Python |
b712ec38108cb8ee39e30c6cb95644d8fbe96668 | fix : remove iso weeknum conversion and use relative weeknum to define next/previous week number | modoboa/modoboa-dmarc,modoboa/modoboa-dmarc | modoboa_dmarc/templatetags/dmarc_tags.py | modoboa_dmarc/templatetags/dmarc_tags.py | """Custom template tags."""
import datetime
from collections import OrderedDict
from django import template
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
register = template.Library()
@register.simple_tag
def next_period(period):
"""Return next period.""... | """Custom template tags."""
import datetime
from dateutil import relativedelta
from collections import OrderedDict
from django import template
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
register = template.Library()
@register.simple_tag
def next_period(pe... | mit | Python |
e9198b8dab185f1ca347c00b2e8741c19470e13b | Set AGG backend by default | ginkgobioworks/pychemy | pychemy/__init__.py | pychemy/__init__.py | import matplotlib as mpl
__version__ = '0.4.4'
mpl.use('AGG')
| __version__ = '0.4.4'
| mit | Python |
de7e9240a4c96a22a2826deae1f826f910fe9b90 | Format print | Samuel-Ferreira/django-pizza,Samuel-Ferreira/django-pizza | pyexamples/loops.py | pyexamples/loops.py | pedidos = [
{
'nome': 'Mario',
'sabor': 'portuguesa'
},
{
'nome': 'Marco',
'sabor': 'presunto'
}
]
for pedido in pedidos:
print('Nome: {0}\nSabor: {1}'.format(pedido['nome'], pedido['sabor']))
| pedidos = [
{
'nome': 'Mario',
'sabor': 'portuguesa'
},
{
'nome': 'Marco',
'sabor': 'presunto'
}
]
for pedido in pedidos:
print(pedido['nome'], pedido['sabor']);
| cc0-1.0 | Python |
9705d7285e3b587c7c8028ee57b8febbb0b7a0b8 | Update version to 1.2.2 | Synss/pyhard2 | pyhard2/__init__.py | pyhard2/__init__.py | __version__ = u"1.2.2 beta"
| __version__ = u"1.2.1 beta"
| mit | Python |
1a8095e71e81eff716524fa75eb9f07615ee61d2 | Return the actual return code | chriskuehl/pre-commit,philipgian/pre-commit,chriskuehl/pre-commit,Teino1978-Corp/pre-commit,pre-commit/pre-commit,dnephin/pre-commit,beni55/pre-commit,beni55/pre-commit,philipgian/pre-commit,pre-commit/pre-commit,Lucas-C/pre-commit,barrysteyn/pre-commit,pre-commit/pre-commit,chriskuehl/pre-commit-1,barrysteyn/pre-commi... | pre_commit/languages/python.py | pre_commit/languages/python.py |
from plumbum import local
import subprocess
PY_ENV = 'py_env'
def install_environment():
assert local.path('setup.py').exists()
# Return immediately if we already have a virtualenv
if local.path(PY_ENV).exists():
return
# Install a virtualenv
local['virtualenv'][PY_ENV]()
local['bas... |
from plumbum import local
import subprocess
PY_ENV = 'py_env'
def install_environment():
assert local.path('setup.py').exists()
# Return immediately if we already have a virtualenv
if local.path(PY_ENV).exists():
return
# Install a virtualenv
local['virtualenv'][PY_ENV]()
local['bas... | mit | Python |
a48bbfee9dfdff41e87548e0e8e3d97014c5e925 | return the created pipe | lifenoodles/pypline,lifenoodles/pypline | pypline/managers.py | pypline/managers.py | import pipeline
class NoRegisteredBuilderException(Exception): pass
class PipelineDefinition(object):
def __init__(self, name, tasks):
self.name = name
self.task_builders = tasks[:]
class RepeatingPipelineDefinition(object):
def __init__(self, name, controller, initialisers, tasks, finalis... | class NoRegisteredBuilderException(Exception): pass
class PipelineDefinition(object):
def __init__(self, name, tasks):
self.name = name
self.task_builders = tasks[:]
class RepeatingPipelineDefinition(object):
def __init__(self, name, controller, initialisers, tasks, finalisers):
self... | mit | Python |
2d695db2156a5cfcec91dacfb610d5e06a807efa | refactor setup_egg.py for Python 3 | nipy/nireg,alexis-roche/nipy,alexis-roche/nireg,alexis-roche/nipy,alexis-roche/nipy,nipy/nireg,alexis-roche/nipy,alexis-roche/nireg | setup_egg.py | setup_egg.py | #!/usr/bin/env python
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Wrapper to run setup.py using setuptools."""
from setuptools import setup
################################################################################
# Call the setup.py scri... | #!/usr/bin/env python
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Wrapper to run setup.py using setuptools."""
from setuptools import setup
################################################################################
# Call the setup.py scr... | bsd-3-clause | Python |
8f007c90fbdbbf5e67ceec26d4782ffa866eae13 | use simplejson >= 3.6.5 to be in line with GoogleAppEngineMapReduce dependencies | billy1380/appengine-pipelines,VirusTotal/appengine-pipelines,vendasta/appengine-pipelines,GoogleCloudPlatform/appengine-pipelines,googlecloudplatform/appengine-pipelines,ocadotechnology/appengine-pipelines,Loudr/appengine-pipelines,VirusTotal/appengine-pipelines,VirusTotal/appengine-pipelines,googlecloudplatform/appeng... | python/src/setup.py | python/src/setup.py | #!/usr/bin/python2.5
"""Setup specs for packaging, distributing, and installing Pipeline lib."""
import setuptools
# To debug, set DISTUTILS_DEBUG env var to anything.
setuptools.setup(
name="GoogleAppEnginePipeline",
version="1.9.15.1",
packages=setuptools.find_packages(),
author="Google App Engine",... | #!/usr/bin/python2.5
"""Setup specs for packaging, distributing, and installing Pipeline lib."""
import setuptools
# To debug, set DISTUTILS_DEBUG env var to anything.
setuptools.setup(
name="GoogleAppEnginePipeline",
version="1.9.15.1",
packages=setuptools.find_packages(),
author="Google App Engine",... | apache-2.0 | Python |
bf9c54af4025056f30b71db6e333d31ac3679a8c | Update stream-01.py | Einext/spark-projects,Einext/spark-projects | python/stream-01.py | python/stream-01.py | # Tested for Spark 2.0.2
from pyspark import SparkContext
from pyspark.streaming import StreamingContext
# Create a local StreamingContext with two working thread and batch interval of 1 second
sc = SparkContext("local[*]", "NetworkWordCount")
ssc = StreamingContext(sc, 1)
# lines is a DStream
lines = ssc.socketTextS... | # Tested for Spark 2.0.2
from pyspark import SparkContext
from pyspark.streaming import StreamingContext
# Create a local StreamingContext with two working thread and batch interval of 1 second
sc = SparkContext("local[*]", "NetworkWordCount")
ssc = StreamingContext(sc, 1)
lines = ssc.socketTextStream("localhost", 99... | apache-2.0 | Python |
925ba4ccc462a3513999f21ab1bda08e08778593 | bump version | AccentDesign/wagtailstreamforms,AccentDesign/wagtailstreamforms,AccentDesign/wagtailstreamforms,AccentDesign/wagtailstreamforms | wagtailstreamforms/__init__.py | wagtailstreamforms/__init__.py | from wagtailstreamforms.utils.version import get_version
# major.minor.patch.release.number
# release must be one of alpha, beta, rc, or final
VERSION = (3, 5, 0, 'final', 1)
__version__ = get_version(VERSION)
| from wagtailstreamforms.utils.version import get_version
# major.minor.patch.release.number
# release must be one of alpha, beta, rc, or final
VERSION = (3, 4, 0, 'final', 1)
__version__ = get_version(VERSION)
| mit | Python |
9e0bdf390b17b066c1333c360cce2c5cdfdfadd3 | add description; use different methods for different scopes. | wistful/grbackup | grbackup/grb_plugins/json_output.py | grbackup/grb_plugins/json_output.py | #!/usr/bin/env python
# coding=utf-8
import json
import os
plugin_type = "json"
description = """save items into file
output scheme: json:/path/to/file.json
output examples: json:/home/grbackup/grbackup.json
json:/tmp/grbackup/grbackup.json
"""
def add_option_group(parser):
return None
clas... | #!/usr/bin/env python
# coding=utf-8
import json
import os
plugin_type = "json"
def add_option_group(parser):
return None
class WriteJSON(object):
def __init__(self, fd):
self.fd = fd
def put_subscription(self, subscription):
self.write({"type": "subscription", "value": subscription}... | mit | Python |
0deff462c1407ce0e28b1a80c80b7e287393e2bc | include message in email-error | arve0/yun-fire-alert,arve0/yun-fire-alert | sms_alert.py | sms_alert.py | #!/usr/bin/env python
# encoding: utf-8
'''
Send an SMS alert through Twilio.
'''
from twilio.rest.exceptions import TwilioRestException
from twilio.rest import TwilioRestClient
import smtplib
from email.mime.text import MIMEText
# put your own credentials here
ACCOUNT_SID = ''
AUTH_TOKEN = ''
FROM_NUMBER = ''
# ema... | #!/usr/bin/env python
# encoding: utf-8
'''
Send an SMS alert through Twilio.
'''
from twilio.rest.exceptions import TwilioRestException
from twilio.rest import TwilioRestClient
import smtplib
from email.mime.text import MIMEText
# put your own credentials here
ACCOUNT_SID = ''
AUTH_TOKEN = ''
FROM_NUMBER = ''
# ema... | mit | Python |
7a47d71a22a2a21fc11e0e5818edbc14dabd9d05 | set default for permit_all_slices to true | xmaruto/mcord,xmaruto/mcord,jermowery/xos,cboling/xos,jermowery/xos,xmaruto/mcord,jermowery/xos,jermowery/xos,cboling/xos,xmaruto/mcord,cboling/xos,cboling/xos,cboling/xos | xos/tosca/resources/network.py | xos/tosca/resources/network.py | import os
import pdb
import sys
import tempfile
sys.path.append("/opt/tosca")
from translator.toscalib.tosca_template import ToscaTemplate
from core.models import Slice,User,Network,NetworkTemplate
from xosresource import XOSResource
class XOSNetwork(XOSResource):
provides = ["tosca.nodes.network.Network", "tosc... | import os
import pdb
import sys
import tempfile
sys.path.append("/opt/tosca")
from translator.toscalib.tosca_template import ToscaTemplate
from core.models import Slice,User,Network,NetworkTemplate
from xosresource import XOSResource
class XOSNetwork(XOSResource):
provides = ["tosca.nodes.network.Network", "tosc... | apache-2.0 | Python |
7bb043de1458479f1e56bd6063be7e327e8ba49b | Improve translation fix | rdmorganiser/rdmo,rdmorganiser/rdmo,DMPwerkzeug/DMPwerkzeug,rdmorganiser/rdmo,DMPwerkzeug/DMPwerkzeug,DMPwerkzeug/DMPwerkzeug | rdmo/core/models.py | rdmo/core/models.py | from django.db import models
from django.utils.timezone import now
from django.utils.translation import get_language
from django.utils.translation import ugettext_lazy as _
from rdmo.core.utils import get_languages
import logging
log = logging.getLogger(__name__)
class Model(models.Model):
created = models.DateT... | from django.db import models
from django.utils.timezone import now
from django.utils.translation import get_language
from django.utils.translation import ugettext_lazy as _
from rdmo.core.utils import get_languages
class Model(models.Model):
created = models.DateTimeField(editable=False, verbose_name=_('created'... | apache-2.0 | Python |
49f859c00519de458ae4c0f72ffdc2b9a1b02ec0 | Change chromium fetch spec to use master as the git-svn ref. | Midrya/chromium,kaiix/depot_tools,michalliu/chromium-depot_tools,liaorubei/depot_tools,eatbyte/depot_tools,michalliu/chromium-depot_tools,gcodetogit/depot_tools,azureplus/chromium_depot_tools,fanjunwei/depot_tools,HackFisher/depot_tools,SuYiling/chrome_depot_tools,G-P-S/depot_tools,sarvex/depot-tools,Neozaru/depot_tool... | recipes/chromium.py | recipes/chromium.py | # Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import sys
import recipe_util # pylint: disable=F0401
# This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232... | # Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import sys
import recipe_util # pylint: disable=F0401
# This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232... | bsd-3-clause | Python |
e7f0139f69017eed2767192a2378a7c1e25fe5b2 | Use Python 3 type syntax in `zerver/webhooks/travis/view.py`. | timabbott/zulip,synicalsyntax/zulip,hackerkid/zulip,brainwane/zulip,rishig/zulip,hackerkid/zulip,jackrzhang/zulip,rht/zulip,jackrzhang/zulip,timabbott/zulip,rishig/zulip,punchagan/zulip,punchagan/zulip,kou/zulip,eeshangarg/zulip,dhcrzf/zulip,shubhamdhama/zulip,tommyip/zulip,synicalsyntax/zulip,punchagan/zulip,jackrzhan... | zerver/webhooks/travis/view.py | zerver/webhooks/travis/view.py | # Webhooks for external integrations.
from typing import Dict
import ujson
from django.http import HttpRequest, HttpResponse
from zerver.decorator import api_key_only_webhook_view
from zerver.lib.actions import check_send_stream_message
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.respon... | # Webhooks for external integrations.
from typing import Dict
import ujson
from django.http import HttpRequest, HttpResponse
from zerver.decorator import api_key_only_webhook_view
from zerver.lib.actions import check_send_stream_message
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.respon... | apache-2.0 | Python |
117f162e548189f2c26eb62e7654b3e1373af3c7 | Fix type error in default site pages config container | bow/volt | volt/config/default_conf.py | volt/config/default_conf.py | # -*- coding: utf-8 -*-
"""
------------------------
volt.config.default_conf
------------------------
Volt default configurations.
:copyright: (c) 2012 Wibowo Arindrarto <bow@bow.web.id>
:license: BSD
"""
from volt.config import Config
# Changing values in this Config is allowed but not recommended
VOLT = Config... | # -*- coding: utf-8 -*-
"""
------------------------
volt.config.default_conf
------------------------
Volt default configurations.
:copyright: (c) 2012 Wibowo Arindrarto <bow@bow.web.id>
:license: BSD
"""
from volt.config import Config
# Changing values in this Config is allowed but not recommended
VOLT = Config... | bsd-3-clause | Python |
3ea2099dfbe4c9dbc5fd5a509ada5f01fae98d1c | Set site on scan preferences by default | takeflight/wagtail-linkchecker,takeflight/wagtail-linkchecker | wagtaillinkchecker/views.py | wagtaillinkchecker/views.py | from __future__ import print_function
from django.shortcuts import redirect, render
from django.utils.lru_cache import lru_cache
from wagtail.wagtailadmin import messages
from wagtail.wagtailadmin.edit_handlers import (ObjectList,
extract_panel_definitions_from_model_cla... | from __future__ import print_function
from django.shortcuts import redirect, render
from django.utils.lru_cache import lru_cache
from wagtail.wagtailadmin import messages
from wagtail.wagtailadmin.edit_handlers import (ObjectList,
extract_panel_definitions_from_model_cla... | bsd-3-clause | Python |
16ebd969fd18f5578780432e9d23532283e93ebd | Update Menu | ZEUSOFCS/Python | PracticePrograms/TipCalculator.py | PracticePrograms/TipCalculator.py | '''
Author : DORIAN JAVA BROWN
Version : N/A
Copyright : All Rights Reserve; You may use, distribute and modify this code.
Description : This program provides the user with options on how much tip the customer should leave the waiter/waitress
'''
import os
total = 21.49
def cls():
os.system('cls' i... | '''
Author : DORIAN JAVA BROWN
Version : N/A
Copyright : All Rights Reserve; You may use, distribute and modify this code.
Description : This program provides the user with options on how much tip the customer should leave the waiter/waitress
'''
import os
total = 21.49
def cls():
os.system('cls' i... | mit | Python |
0607283cab8006ead4100c9ed30f6cd73e2f3b1b | Fix test team | MaximeGLegault/StrategyIA,RoboCupULaval/StrategyIA,RoboCupULaval/StrategyIA,MaximeGLegault/StrategyIA | RULEngine/tests/Game/test_team.py | RULEngine/tests/Game/test_team.py | import unittest
from config.config_service import ConfigService
from RULEngine.Game.Player import Player
from RULEngine.Game.Team import Team
from RULEngine.Util.constant import PLAYER_PER_TEAM
from RULEngine.Util.Position import Position
from RULEngine.Util.Pose import Pose
from RULEngine.Util.team_color_service impo... | import unittest
from config.config_service import ConfigService
from RULEngine.Game.Player import Player
from RULEngine.Game.Team import Team
from RULEngine.Util.constant import PLAYER_PER_TEAM
from RULEngine.Util.Position import Position
from RULEngine.Util.Pose import Pose
from RULEngine.Util.team_color_service impo... | mit | Python |
bc6725d5393355a44c0732f6069fce40709a1886 | Remove redundant upload endpoints. | btimby/cloudstrype,btimby/cloudstrype,btimby/cloudstrype,btimby/cloudstrype | web/cloudstrype/api/urls.py | web/cloudstrype/api/urls.py | from django.conf.urls import (
url, include
)
from rest_framework.urlpatterns import format_suffix_patterns
from api.views import (
MeView, PublicCloudListView, CloudListView, DirectoryUidView,
DirectoryPathView, FileUidView, FilePathView, DataUidView, DataPathView,
)
urlpatterns = [
# Public access
... | from django.conf.urls import (
url, include
)
from rest_framework.urlpatterns import format_suffix_patterns
from api.views import (
MeView, PublicCloudListView, CloudListView, DirectoryUidView,
DirectoryPathView, FileUidView, FilePathView, DataUidView, DataPathView,
)
urlpatterns = [
# Public access
... | mit | Python |
09d0ed85fd6b9f6f4e265a90b4fcb26563cc3f82 | Initialize user data with telegram user data | cmende/pytelefoob0t | foob0t.py | foob0t.py | # Copyright 2017 Christoph Mende
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | # Copyright 2017 Christoph Mende
#
# 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 |
6874e5ec89b9bf5ab52ae9c897ddf9626cb36848 | check session before updating txt csv | ResearchSoftwareInstitute/MyHPOM,RENCI/xDCIShare,hydroshare/hydroshare,FescueFungiShare/hydroshare,FescueFungiShare/hydroshare,RENCI/xDCIShare,FescueFungiShare/hydroshare,hydroshare/hydroshare,RENCI/xDCIShare,FescueFungiShare/hydroshare,hydroshare/hydroshare,ResearchSoftwareInstitute/MyHPOM,hydroshare/hydroshare,Resear... | hs_collection_resource/receivers.py | hs_collection_resource/receivers.py | from django.dispatch import receiver
from hs_core.signals import pre_add_files_to_resource, pre_check_bag_flag
from hs_core.hydroshare.utils import set_dirty_bag_flag
from hs_collection_resource.models import CollectionResource
from hs_collection_resource.utils import update_collection_list_csv
@receiver(pre_add_fi... | from django.dispatch import receiver
from hs_core.signals import pre_add_files_to_resource, pre_check_bag_flag
from hs_core.hydroshare.utils import set_dirty_bag_flag
from hs_collection_resource.models import CollectionResource
from hs_collection_resource.utils import update_collection_list_csv
@receiver(pre_add_fi... | bsd-3-clause | Python |
e98b9a4f62e56398e536bb240366904a62f458bf | add a note on Qt's --disable-web-security | kklmn/xrt,kklmn/xrt,kklmn/xrt,kklmn/xrt | xrt/gui/xrtQook/tutorial.py | xrt/gui/xrtQook/tutorial.py | # -*- coding: utf-8 -*-
u"""
.. _qook_tutorial:
Using xrtQook for script generation
-----------------------------------
- Start xrtQook: type ``python xrtQookStart.pyw`` from xrt/gui or, if you have
installed xrt by running setup.py, type ``xrtQookStart.pyw`` from any
location.
.. note::
On some Qt syste... | # -*- coding: utf-8 -*-
u"""
.. _qook_tutorial:
Using xrtQook for script generation
-----------------------------------
- Start xrtQook: type ``python xrtQookStart.pyw`` from xrt/gui or, if you have
installed xrt by running setup.py, type ``xrtQookStart.pyw`` from any
location.
.. note::
If you want to s... | mit | Python |
7498889780c80422c12fa5d55288e0b782d83b4a | FIX delivery return compute | ingadhoc/sale,ingadhoc/sale,ingadhoc/sale,ingadhoc/sale | sale_usability/models/sale_order_line.py | sale_usability/models/sale_order_line.py | # -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import models, api, fields
from opene... | # -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import models, api, fields
from opene... | agpl-3.0 | Python |
69602c50225fa6ee1cb4fcaca740ed3e94ddd5e7 | Comment out failing elsevier test temporarily | bgyori/indra,sorgerlab/belpy,sorgerlab/belpy,johnbachman/indra,bgyori/indra,sorgerlab/indra,pvtodorov/indra,pvtodorov/indra,bgyori/indra,johnbachman/belpy,johnbachman/belpy,sorgerlab/belpy,pvtodorov/indra,johnbachman/belpy,johnbachman/indra,sorgerlab/indra,sorgerlab/indra,pvtodorov/indra,johnbachman/indra | indra/tests/test_elsevier_client.py | indra/tests/test_elsevier_client.py | from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
from indra.literature import elsevier_client as ec
def test_get_fulltext_article():
# This article is not open access so in order to get a full text response
# with a body element requires full text access k... | from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
from indra.literature import elsevier_client as ec
def test_get_fulltext_article():
# This article is not open access so in order to get a full text response
# with a body element requires full text access k... | bsd-2-clause | Python |
4b7a50945132daaf7259cd3f76f52a1fc80ad622 | Fix haproxy agent unit test to be runnable alone by tox | gkotton/vmware-nsx,gkotton/vmware-nsx | neutron/tests/unit/services/loadbalancer/drivers/haproxy/test_agent.py | neutron/tests/unit/services/loadbalancer/drivers/haproxy/test_agent.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2013 New Dream Network, LLC (DreamHost)
#
# 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/li... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2013 New Dream Network, LLC (DreamHost)
#
# 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/li... | apache-2.0 | Python |
5d1a3ffedcb451a6a52b5e3492a56ef7663438d3 | Mark this test as a known failure to return the bots to blue | apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb | packages/Python/lldbsuite/test/repl/po_repl_type/TestREPLPOReplType.py | packages/Python/lldbsuite/test/repl/po_repl_type/TestREPLPOReplType.py | # TestREPLPOReplType.py
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See http://swift.org/LICENSE.txt for license information
# See http://swift.org/CONTRIB... | # TestREPLPOReplType.py
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See http://swift.org/LICENSE.txt for license information
# See http://swift.org/CONTRIB... | apache-2.0 | Python |
8a03fc874566ce03b0e9a73397541ff7ed151964 | Bump up version | chrisjones-brack3t/django-rest-framework-jwt,KetsuN/django-rest-framework-jwt,ajostergaard/django-rest-framework-jwt,plentific/django-rest-framework-jwt,coUrbanize/django-rest-framework-jwt,abdulhaq-e/django-rest-framework-jwt,GetBlimp/django-rest-framework-jwt,oasiswork/django-rest-framework-jwt,1vank1n/django-rest-fr... | rest_framework_jwt/__init__.py | rest_framework_jwt/__init__.py | # -*- coding: utf-8 -*-
__title__ = 'djangorestframework-jwt'
__version__ = '1.7.1'
__author__ = 'José Padilla'
__license__ = 'MIT'
__copyright__ = 'Copyright 2014-2015 Blimp LLC'
# Version synonym
VERSION = __version__
| # -*- coding: utf-8 -*-
__title__ = 'djangorestframework-jwt'
__version__ = '1.7.0'
__author__ = 'José Padilla'
__license__ = 'MIT'
__copyright__ = 'Copyright 2014-2015 Blimp LLC'
# Version synonym
VERSION = __version__
| mit | Python |
43d4b6a3ccf49b3a0307da98344b0fe8f61acaf1 | Save malts for future reference | brewpeople/brewmeister,brewpeople/brewmeister,brewpeople/brewmeister | brew/rest.py | brew/rest.py | import json
import time
import jsonschema
from pkg_resources import resource_string
from flask import request, jsonify
from brew import app, controller, machine, mongo
@app.route('/api/recipe', methods=['POST'])
def create_recipe():
schema = resource_string(__name__, 'data/recipe.schema.json').decode('utf-8')
... | import json
import time
import jsonschema
from pkg_resources import resource_string
from flask import request, jsonify
from brew import app, controller, machine, mongo
@app.route('/api/recipe', methods=['POST'])
def create_recipe():
schema = resource_string(__name__, 'data/recipe.schema.json').decode('utf-8')
... | mit | Python |
d98700279a138efb3db9c74d6d6f057e9cd4532d | add a few more use flags | fedora-conary/conary,fedora-conary/conary,fedora-conary/conary,fedora-conary/conary,fedora-conary/conary | build/use.py | build/use.py | #
# Copyright (c) 2004 Specifix, Inc.
# All rights reserved
#
"""
Provides the build configuration as special dictionaries that directly
export their namespaces.
Should read, or be provided, some sort of configuration information
relative to the build being done. For now, we'll intialize a static
configuration suffi... | #
# Copyright (c) 2004 Specifix, Inc.
# All rights reserved
#
"""
Provides the build configuration as special dictionaries that directly
export their namespaces.
Should read, or be provided, some sort of configuration information
relative to the build being done. For now, we'll intialize a static
configuration suffi... | apache-2.0 | Python |
58420560a752ce732ed66c918afe61e5a4850d03 | set correctly the version number 6.1.X (../e-commerce-addons/ rev 269.1.54) | ddico/sale-workflow,BT-fgarbely/sale-workflow,credativUK/sale-workflow,anybox/sale-workflow,Endika/sale-workflow,fevxie/sale-workflow,jabibi/sale-workflow,xpansa/sale-workflow,guewen/sale-workflow,numerigraphe/sale-workflow,BT-jmichaud/sale-workflow,kittiu/sale-workflow,gurneyalex/sale-workflow,anas-taji/sale-workflow,... | sale_exceptions/__openerp__.py | sale_exceptions/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 Akretion LTDA.
# authors: Raphaël Valyi, Renato Lima
# Copyright (C) 2010-2012 Akretion Sébastien BEAU <sebastien.beau@akretion.com>
# ... | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 Akretion LTDA.
# authors: Raphaël Valyi, Renato Lima
# Copyright (C) 2010-2012 Akretion Sébastien BEAU <sebastien.beau@akretion.com>
# ... | agpl-3.0 | Python |
34520fc1a2dfcef11b5e5a6471e2173cd6ac1ffa | Reduce noise in thumbnail lambda tests (#2898) | quiltdata/quilt,quiltdata/quilt,quiltdata/quilt,quiltdata/quilt,quiltdata/quilt | lambdas/thumbnail/tests/conftest.py | lambdas/thumbnail/tests/conftest.py | def pytest_addoption(parser):
parser.addoption(
'--poppler',
action='store_true',
dest='poppler',
default=False,
help="Indicates poppler tools (incl. pdftoppm) installed"
)
parser.addoption(
'--loffice',
action='store_true',
dest='loffice',
... | def pytest_addoption(parser):
parser.addoption(
'--poppler',
action='store_true',
dest='poppler',
default=False,
help="Indicates poppler tools (incl. pdftoppm) installed"
)
parser.addoption(
'--loffice',
action='store_true',
dest='loffice',
... | apache-2.0 | Python |
10a2cc3eb48fb91e3d16edb2a505201e58b75e17 | order genes on symbol | Clinical-Genomics/scout,Clinical-Genomics/scout,Clinical-Genomics/scout | scout/models/case/gene_list.py | scout/models/case/gene_list.py | # -*- coding: utf-8 -*-
from mongoengine import (Document, ListField, StringField, FloatField,
DateTimeField, BooleanField, EmbeddedDocument,
EmbeddedDocumentField, MapField, ReferenceField,
IntField, SortedListField)
from scout.models.hgnc_map... | # -*- coding: utf-8 -*-
from mongoengine import (Document, ListField, StringField, FloatField,
DateTimeField, BooleanField, EmbeddedDocument,
EmbeddedDocumentField, MapField, ReferenceField,
IntField)
from scout.models.hgnc_map import HgncGene
... | bsd-3-clause | Python |
1f534bcdc28cd66f83dd9748d297d2c830ab4827 | handle zeroes as floats when consuming spreadsheet data, closes #122 | nprapps/graeae,nprapps/graeae,nprapps/graeae,nprapps/graeae | scrapers/spreadsheet/models.py | scrapers/spreadsheet/models.py | import datetime
from collections import OrderedDict
class Story:
"""
Represent a story we worked on
"""
def __init__(self, story):
self.story = story
def serialize(self):
return OrderedDict([
('seamus_id', self.seamus_id),
('timestamp', self.timestamp),
... | import datetime
from collections import OrderedDict
class Story:
"""
Represent a story we worked on
"""
def __init__(self, story):
self.story = story
def serialize(self):
return OrderedDict([
('seamus_id', self.seamus_id),
('timestamp', self.timestamp),
... | mit | Python |
eb14629df68b2f3061ae6ebb1e6959ef4966f85a | Stop printing unused debug. | Artanis/pygrapher | callbacks.py | callbacks.py | import gtk
__all__ = ["signals"]
# Tree View Row Callbacks
def on_col_draw_cell_toggled(toggle, path, model):
""" Toggles the draw field of the row in the store_plot
"""
model[path][1] = not model[path][1]
def police_graphs(model, path, row_iter):
""" TreeStore Foreach callback
Removes ... | import gtk
__all__ = ["signals"]
# Tree View Row Callbacks
def on_col_draw_cell_toggled(toggle, path, model):
""" Toggles the draw field of the row in the store_plot
"""
model[path][1] = not model[path][1]
def police_graphs(model, path, row_iter):
""" TreeStore Foreach callback
Removes ... | bsd-3-clause | Python |
344457b498f12dfceb8e687b326ba68064d6bda6 | Test runner uses current python | divtxt/binder | run-tests.py | run-tests.py |
import os, sys
PROJECT_DIR = os.path.abspath(os.path.dirname( __file__ ))
SRC_DIR = os.path.join(PROJECT_DIR, "src")
TEST_DIR = os.path.join(PROJECT_DIR, "test")
def runtestdir(subdir):
entries = os.listdir(subdir)
total = 0
errs = 0
for f in entries:
if not f.endswith(".py"):
... |
import os
PROJECT_DIR = os.path.abspath(os.path.dirname( __file__ ))
SRC_DIR = os.path.join(PROJECT_DIR, "src")
TEST_DIR = os.path.join(PROJECT_DIR, "test")
def runtestdir(subdir):
#cwd = os.getcwd()
#subdir = os.path.join(cwd, subdir)
entries = os.listdir(subdir)
total = 0
errs = 0
... | mit | Python |
471bba941994f1195a805229bb721d70b94b4cb8 | Fix NameError in run-tests.py | zestedesavoir/Python-ZMarkdown,joachimneu/Python-Markdown,cyisfor/Python-Markdown,evertqin/Python-Markdown,zestedesavoir/Python-ZMarkdown,me-and/Python-Markdown,me-and/Python-Markdown,dataquestio/Python-Markdown,joachimneu/Python-Markdown,fernandezcuesta/Python-Markdown,me-and/Python-Markdown,waylan/Python-Markdown,eve... | run-tests.py | run-tests.py | #!/usr/bin/env python
import tests
import os, sys
if len(sys.argv) > 1 and sys.argv[1] == "update":
if len(sys.argv) > 2:
config = tests.get_config(os.path.dirname(sys.argv[2]))
root, ext = os.path.splitext(sys.argv[2])
if ext == config.get(tests.get_section(os.path.basename(root), config)... | #!/usr/bin/env python
import tests
import os, sys
if len(sys.argv) > 1 and sys.argv[1] == "update":
if len(sys.argv) > 2:
config = tests.get_config(os.path.dirname(sys.argv[2]))
root, ext = os.path.splitext(sys.argv[2])
if ext == config.get(tests.get_section(os.path.basename(root), config)... | bsd-3-clause | Python |
a511292fafadb707f6b7a282cdf5828a559bc4ad | Refactor urls module for django 1.8+ | DOOMer/clean-image-crop-uploader-v3,DOOMer/clean-image-crop-uploader-v3,DOOMer/clean-image-crop-uploader-v3 | cicu/urls.py | cicu/urls.py |
from django.conf.urls import url
from.views import *
urlpatterns = [
url(r'^$', upload, name='ajax-upload'),
url(r'^crop/$', crop, name='cicu-crop'),
]
| from django.conf.urls import patterns, url
urlpatterns = patterns('cicu.views',
url(r'^$', 'upload', name='ajax-upload'),
url(r'^crop/$', 'crop', name='cicu-crop'),
)
| bsd-3-clause | Python |
d0232b8eb83b357c8ddda2179d43eb706021281f | fix bad bug in setup_cli.py | djtotten/workbench,djtotten/workbench,SuperCowPowers/workbench,SuperCowPowers/workbench,SuperCowPowers/workbench,djtotten/workbench | setup_cli.py | setup_cli.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, sys
from setuptools import setup
if sys.argv[-1] == 'publish':
os.system('python setup_cli.py sdist upload')
sys.exit()
readme = open('README.rst').read()
long_description = readme
doclink = '''
Documentation
-------------
The full documentation is a... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, sys
from setuptools import setup
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()
readme = open('README.rst').read()
long_description = readme
doclink = '''
Documentation
-------------
The full documentation is at ht... | mit | Python |
30cc7bfd073a3938e8318f3c6e1f08f2865cc8c2 | Add in label info so available to front-end if needed | mitmedialab/MediaCloud-Web-Tools,mitmedialab/MediaCloud-Web-Tools,mitmedialab/MediaCloud-Web-Tools,mitmedialab/MediaCloud-Web-Tools | server/views/sources/search.py | server/views/sources/search.py | import logging
from flask import jsonify, request
import flask_login
from server.views.media_search import media_search, _matching_collections_by_set
from server import app
from server.util.request import api_error_handler
from server.auth import user_has_auth_role, ROLE_MEDIA_EDIT
from server.views.sources.favorites ... | import logging
from flask import jsonify, request
import flask_login
from server.views.media_search import media_search, _matching_collections_by_set
from server import app
from server.util.request import api_error_handler
from server.auth import user_has_auth_role, ROLE_MEDIA_EDIT
from server.views.sources.favorites ... | apache-2.0 | Python |
340d3fd1b218b398bbd1dcef21cc03cb5f1ee342 | Document signature.py | jake-billings/research-blockchain | signature.py | signature.py | import os
from encode import encode
from Crypto.PublicKey import RSA
import hashlib
# Select the hashing algorithm to be passed to hashlib.new()
# SHA224 was selected due to its shorter length and therefore higher convenience. It also maintains a very low
# probability of of collision.
# Suggested Value: 'sha224'
HASH... | import os
from encode import encode, decode
from Crypto.PublicKey import RSA
import hashlib
HASHER = hashlib.new('sha224')
KEY_SIZE = 1024
ENTROPY = os.urandom
def key_to_string(key):
return encode(key.exportKey(format="DER"))
def generate_key():
return RSA.generate(1024, os.urandom)
def sign(key, data)... | mit | Python |
27c5b3ccc7f2a110c5b6ceaceee77c380056a336 | Read heroku port | alphagov/notifications-functional-tests,alphagov/notifications-functional-tests | sms_inbox.py | sms_inbox.py | import os
from flask import Flask, request, jsonify
from flask.ext.cache import Cache
app = Flask(__name__)
cache = Cache(app, config={'CACHE_TYPE': 'simple'})
@app.route('/', methods=['GET'])
def get_nessage():
result = cache.get('sms')
if result:
cache.clear()
return jsonify({
'... | import os
from flask import Flask, request, jsonify
from flask.ext.cache import Cache
app = Flask(__name__)
cache = Cache(app, config={'CACHE_TYPE': 'simple'})
@app.route('/', methods=['GET'])
def get_nessage():
result = cache.get('sms')
if result:
cache.clear()
return jsonify({
'... | mit | Python |
2e9d4d4b43a59b65dde1bb9196786f88eeb6edf0 | Add space between import and class declaration | MarquisLP/Sidewalk-Champion | lib/game_states/select_state_sfx.py | lib/game_states/select_state_sfx.py | from pygame.mixer import Sound
class SelectStateSFX(object):
"""Plays sound effects that are used by both the Character Select
State and the Stage Select State.
Class Constants:
SCROLL_PATH: A String for the file path to the scroll items
sound effect.
CONFIRM_PATH: A String fo... | from pygame.mixer import Sound
class SelectStateSFX(object):
"""Plays sound effects that are used by both the Character Select
State and the Stage Select State.
Class Constants:
SCROLL_PATH: A String for the file path to the scroll items
sound effect.
CONFIRM_PATH: A String for... | unlicense | Python |
7dfaa51d56a84b727896d571ef16908534f69bb1 | Use a large page size when requesting revision ranges from gitiles. | eunchong/build,eunchong/build,eunchong/build,eunchong/build | scripts/slave/recipe_modules/auto_bisect/resources/fetch_intervening_revisions.py | scripts/slave/recipe_modules/auto_bisect/resources/fetch_intervening_revisions.py | #!/usr/bin/python
#
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Gets list of revisions between two commits and their commit positions.
Example usage:
./fetch_intervening_revisions.py 343b531d31 7... | #!/usr/bin/python
#
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Gets list of revisions between two commits and their commit positions.
Example usage:
./fetch_intervening_revisions.py 343b531d31 7... | bsd-3-clause | Python |
52467e154dd4718f57bac5d8f81f7949b8402f8d | Add EmptySingleSecuritySecondEquityBenchmark algorithm | JKarathiya/Lean,jameschch/Lean,jameschch/Lean,JKarathiya/Lean,AnshulYADAV007/Lean,kaffeebrauer/Lean,AlexCatarino/Lean,JKarathiya/Lean,AlexCatarino/Lean,AnshulYADAV007/Lean,kaffeebrauer/Lean,AlexCatarino/Lean,AnshulYADAV007/Lean,StefanoRaggi/Lean,StefanoRaggi/Lean,Jay-Jay-D/LeanSTP,StefanoRaggi/Lean,kaffeebrauer/Lean,St... | Algorithm.Python/Benchmarks/EmptySingleSecuritySecondEquityBenchmark.py | Algorithm.Python/Benchmarks/EmptySingleSecuritySecondEquityBenchmark.py | # QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
#
# 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 Lice... | using System;
namespace QuantConnect.Algorithm.Python.Benchmarks
{
public class EmptySingleSecuritySecondEquityBenchmark
{
public EmptySingleSecuritySecondEquityBenchmark()
{
}
}
}
| apache-2.0 | Python |
1a0ce883959c9857b4120434ec44fe48b85abed0 | update theano TUT | wangwei7175878/tutorials | theanoTUT/theano7_activation_function.py | theanoTUT/theano7_activation_function.py | # View more python tutorials on my Youtube and Youku channel!!!
# Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg
# Youku video tutorial: http://i.youku.com/pythontutorial
# 7 - Activation function
"""
The available activation functions in theano can be found in this link:
http://dee... | # View more python tutorials on my Youtube and Youku channel!!!
# Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg
# Youku video tutorial: http://i.youku.com/pythontutorial
# 7 - Activation function
"""
The available activation functions in theano can be found in this link:
http://dee... | mit | Python |
e5f00a6a5e71d8f5fe98547732f4c9e15a3efc1e | Add registration to cost tracking | opennode/nodeconductor-paas-oracle | src/nodeconductor_paas_oracle/apps.py | src/nodeconductor_paas_oracle/apps.py | from django.apps import AppConfig
class OracleConfig(AppConfig):
name = 'nodeconductor_paas_oracle'
verbose_name = 'Oracle'
service_name = 'Oracle'
def ready(self):
from nodeconductor.structure import SupportedServices
from nodeconductor.cost_tracking import CostTrackingRegister
... | from django.apps import AppConfig
class OracleConfig(AppConfig):
name = 'nodeconductor_paas_oracle'
verbose_name = 'Oracle'
service_name = 'Oracle'
def ready(self):
from nodeconductor.structure import SupportedServices
from .backend import OracleBackend
SupportedServices.regis... | mit | Python |
486a170082c2bb13c20392f7a1f5887395be4e27 | bump version | renalreg/radar,renalreg/radar,renalreg/radar,renalreg/radar | radar/__init__.py | radar/__init__.py | __version__ = '2.47.30'
| __version__ = '2.47.29'
| agpl-3.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.