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 |
|---|---|---|---|---|---|---|---|---|
b64b4205ea124999c37624bad43a94de21457e4f | Remove unused import | Alignak-monitoring-contrib/alignak-app,Alignak-monitoring-contrib/alignak-app | test/test_app.py | test/test_app.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2017:
# Matthieu Estrada, ttamalfor@gmail.com
#
# This file is part of (AlignakApp).
#
# (AlignakApp) is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Sof... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2017:
# Matthieu Estrada, ttamalfor@gmail.com
#
# This file is part of (AlignakApp).
#
# (AlignakApp) is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Sof... | agpl-3.0 | Python |
8cc63207681d5973abc108911803af2647d38b55 | Correct specification of "#channel,op" capability. | raboof/supybot,buildbot/supybot,ProgVal/Limnoria-test,Ban3/Limnoria,Ban3/Limnoria,haxwithaxe/supybot,jeffmahoney/supybot,frumiousbandersnatch/supybot-code,ProgVal/Limnoria-test | plugins/Channel/__init__.py | plugins/Channel/__init__.py | ###
# Copyright (c) 2004-2005, Jeremiah Fincher
# 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 co... | ###
# Copyright (c) 2004-2005, Jeremiah Fincher
# 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 co... | bsd-3-clause | Python |
242e60305dbcbaafee787cf7124f7ce638f1fa9c | Update factories | barberscore/barberscore-api,barberscore/barberscore-api,dbinetti/barberscore,barberscore/barberscore-api,dbinetti/barberscore-django,dbinetti/barberscore,dbinetti/barberscore-django,barberscore/barberscore-api | project/apps/api/factories.py | project/apps/api/factories.py | from factory.django import (
DjangoModelFactory,
)
from .models import (
Group,
)
class QuartetFactory(DjangoModelFactory):
name = "The Buffalo Bills"
kind = Group.KIND.quartet
class Meta:
model = Group
| from factory.django import (
DjangoModelFactory,
)
from .models import (
Group,
)
class QuartetFactory(DjangoModelFactory):
name = "The Buffalo Bills"
kind = Group.QUARTET
class Meta:
model = Group
| bsd-2-clause | Python |
82a1ca9db2344619e3a2af39950796f8563c2114 | fix bert | undertherain/benchmarker,undertherain/benchmarker,undertherain/benchmarker,undertherain/benchmarker | scripts/bert.py | scripts/bert.py | #!/usr/bin/env python3
from run import run
def main():
params = {}
params["framework"] = "pytorch"
params["problem"] = "bert_custom"
params["mode"] = "training"
for batch_size in range(1, 256):
params["gpus"] = "0"
params["backend"] = "native"
params["batch_size"] = batch_s... | #!/usr/bin/env python3
from run import run
def main():
params = {}
params["framework"] = "pytorch"
params["problem"] = "bert_custom"
params["mode"] = "training"
params["gpus"] = "0"
for batch_size in range(1, 256):
params["batch_size"] = batch_size
prob_size = params["batch_siz... | mpl-2.0 | Python |
b12261027151d1e96025d326b3baf8c6025c97c3 | Fix sys.path | fjalir/odie-server,fsmi/odie-server,fsmi/odie-server,Kha/odie-server,fsmi/odie-server,fjalir/odie-server,Kha/odie-server,Kha/odie-server,fjalir/odie-server | scripts/hack.py | scripts/hack.py | # fix up python path to enable all these scripts to live in a subdirectory
# I just wish python's relative "from .. import" did what it says on the tin
import sys
import os
sys.path = [os.path.join(os.path.dirname(__file__), os.path.pardir), os.path.dirname(__file__)] + sys.path
| # fix up python path to enable all these scripts to live in a subdirectory
# I just wish python's relative "from .. import" did what it says on the tin
import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), os.path.pardir))
sys.path.append(os.path.dirname(__file__))
| mit | Python |
c11a47625783b2760148865b34e6a110f2b9004c | Revert "selectdriver: actually, force a disconnect when _run_irc() fails" | GLolol/PyLink | selectdriver.py | selectdriver.py | """
Socket handling driver using the selectors module. epoll, kqueue, and devpoll
are used internally when available.
"""
import selectors
import threading
from pylinkirc import world
from pylinkirc.log import log
SELECT_TIMEOUT = 0.5
selector = selectors.DefaultSelector()
def _process_conns():
"""Main loop wh... | """
Socket handling driver using the selectors module. epoll, kqueue, and devpoll
are used internally when available.
"""
import selectors
import threading
from pylinkirc import world
from pylinkirc.log import log
SELECT_TIMEOUT = 0.5
selector = selectors.DefaultSelector()
def _process_conns():
"""Main loop wh... | mpl-2.0 | Python |
70e627d01ae9692f1103ed162183ae7496a61eb3 | Bump version number. | larsmans/cython,fabianrost84/cython,dahebolangkuan/cython,madjar/cython,fperez/cython,da-woods/cython,slonik-az/cython,fabianrost84/cython,achernet/cython,encukou/cython,mrGeen/cython,hpfem/cython,c-blake/cython,rguillebert/CythonCTypesBackend,slonik-az/cython,encukou/cython,fabianrost84/cython,madjar/cython,marscher/c... | Cython/__init__.py | Cython/__init__.py | __version__ = "0.15rc1"
# Void cython.* directives (for case insensitive operating systems).
from Cython.Shadow import *
| __version__ = "0.15rc0"
# Void cython.* directives (for case insensitive operating systems).
from Cython.Shadow import *
| apache-2.0 | Python |
ec61bf919c949bc957179f2fd3ee653d37477264 | Remove unneeded "L" suffixes. | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | Demo/scripts/pi.py | Demo/scripts/pi.py | #! /usr/bin/env python
# Print digits of pi forever.
#
# The algorithm, using Python's 'long' integers ("bignums"), works
# with continued fractions, and was conceived by Lambert Meertens.
#
# See also the ABC Programmer's Handbook, by Geurts, Meertens & Pemberton,
# published by Prentice-Hall (UK) Ltd., 1990.
import... | #! /usr/bin/env python
# Print digits of pi forever.
#
# The algorithm, using Python's 'long' integers ("bignums"), works
# with continued fractions, and was conceived by Lambert Meertens.
#
# See also the ABC Programmer's Handbook, by Geurts, Meertens & Pemberton,
# published by Prentice-Hall (UK) Ltd., 1990.
import... | mit | Python |
27e7d90b6057c4ec28fd1b1193d67adea95ffede | add drecaptcha envvar | dubirajara/django_my_ideas_wall,dubirajara/django_my_ideas_wall,dubirajara/django_my_ideas_wall,dubirajara/django_my_ideas_wall | contrib/secret_gen.py | contrib/secret_gen.py | #!/usr/bin/env python
"""
Django SECRET_KEY generator.
"""
from django.utils.crypto import get_random_string
chars = 'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'
CONFIG_STRING = """
SECRET_KEY={}
DEBUG=True
ALLOWED_HOSTS=*
#DATABASE_URL=postgres://postgresuser:postgrespass@db:5432/ideasdb
#EMAIL_BACKEND=dj... | #!/usr/bin/env python
"""
Django SECRET_KEY generator.
"""
from django.utils.crypto import get_random_string
chars = 'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'
CONFIG_STRING = """
SECRET_KEY={}
DEBUG=True
ALLOWED_HOSTS=*
#DATABASE_URL=postgres://postgresuser:postgrespass@db:5432/ideasdb
#EMAIL_BACKEND=dj... | agpl-3.0 | Python |
1bb57307e8290d16087a4f6a2cd93c80d6d9dfd3 | Update utils.py | dhilipsiva/moback,dhilipsiva/moback | server/utils.py | server/utils.py | import hmac
import hashlib
import string
import urllib
BASE62_ALPHABET = string.digits + string.ascii_letters
BASE92_ALPHABET = \
BASE62_ALPHABET + '~!@#$%^&*()_-+=[];"\'<>,.?/|\\'
def base92_encode(num):
base92 = []
alpha_len = len(BASE92_ALPHABET)
while num != 0:
num, i = divmod(num, alpha_... | import hmac
import hashlib
import string
import urllib
BASE62_ALPHABET = string.digits + string.ascii_letters
BASE92_ALPHABET = \
BASE62_ALPHABET + '~!@#$%^&*()_-+={}[];"\'<>,.?/|\\'
def base92_encode(num):
base92 = []
alpha_len = len(BASE92_ALPHABET)
while num != 0:
num, i = divmod(num, alph... | mit | Python |
c9bdf68dd540b86706cf9f3476c177cfbaf22330 | Remove incorrect test | MAECProject/python-maec | maec/test/bundle/av_classification_test.py | maec/test/bundle/av_classification_test.py | # Copyright (c) 2014, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
import unittest
from cybox.test import EntityTestCase, round_trip
from maec.bundle.av_classification import AVClassification
class TestAVClassification(EntityTestCase, unittest.TestCase):
klass = AVCl... | # Copyright (c) 2014, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
import unittest
from cybox.test import EntityTestCase, round_trip
from maec.bundle.av_classification import AVClassification
class TestAVClassification(EntityTestCase, unittest.TestCase):
klass = AVCl... | bsd-3-clause | Python |
761f895ce5d6e508917cc134ae1db46c6d659180 | Make flake8 happy | ZettaIO/pswingw2py | pswingw2/config_defaults.py | pswingw2/config_defaults.py | """
Example config module.
You can use this module for your own config object, but remember
that this is a singleton. There can only be one single config.
Simply mock the values and import them.
Make your own config definition for each account used. This can be
any structure that can support a get(NAME) function. A m... | """
Example config module.
You can use this module for your own config object, but remember
that this is a singleton. There can only be one single config.
Simply mock the values and import them.
Make your own config definition for each account used. This can be
any structure that can support a get(NAME) function. A m... | mit | Python |
a793c953bfc58a683a89727d730fd59e5ccb6c1b | Update argument parsing in main() | tkw1536/GitManager | GitManager/main.py | GitManager/main.py | #!/usr/bin/env python3
import argparse
from GitManager.utils import format
from GitManager.config import file
from GitManager.commands import status, lister, fetch, setup, pull, state
def main(args):
""" The main entry point for git-manager"""
try:
real_main(args)
except BrokenPipeError:
... | #!/usr/bin/env python3
from GitManager.utils import format
from GitManager.config import file
from GitManager.commands import status, lister, fetch, setup, pull, state
#
# MAIN ENTRY POINT
#
def main(args):
""" The main entry point for git-manager"""
try:
real_main(args)
except BrokenPipeError... | mit | Python |
2d881a86680059e799ac586861a1f7c7e341e843 | Remove an unused import | thombashi/pytablewriter | test/test_tsv_writer.py | test/test_tsv_writer.py | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import collections
import itertools
import pytablewriter as ptw
import pytest
from .data import (
header_list,
... | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import io
import collections
import itertools
import pytablewriter as ptw
import pytest
from .data import (
head... | mit | Python |
2a16d4a8c13f9703235e965706322434b74d42bf | switch form pkg_resources to pkg_util | rjeschmi/vsc-base,rjeschmi/vsc-base | test/__init__.py | test/__init__.py | ##
#
# Copyright 2012-2013 Ghent University
#
# This file is part of vsc-base,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# the Hercules foundation (ht... | ##
#
# Copyright 2012-2013 Ghent University
#
# This file is part of vsc-base,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# the Hercules foundation (ht... | lgpl-2.1 | Python |
e2770beec841123c37fa6663b1fe9f3a43c98ee5 | Use chirptext setup_logging | neocl/jamdict,neocl/jamdict | test/__init__.py | test/__init__.py | # -*- coding: utf-8 -*-
''' Jamdict Test Scripts
Latest version can be found at https://github.com/neocl/jamdict/
:copyright: (c) 2016 Le Tuan Anh <tuananh.ke@gmail.com>
:license: MIT, see LICENSE for more details.
'''
# This source code is a part of jamdict library
# Copyright (c) 2016, Le Tuan Anh <tuananh.ke@gmai... | mit | Python | |
4e65117524022121fd4fb8011a99dfd876b376a7 | Add admin app | tBaxter/tango-photos,tBaxter/tango-photos | test_settings.py | test_settings.py | SECRET_KEY = "lorem ipsum"
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.humanize',
'django.contrib.sites',
'django.contrib.sessions',
'tango_shared',
# from tango_shared reqs
'voting',
'easy_thumbnails',
'p... | SECRET_KEY = "lorem ipsum"
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.humanize',
'django.contrib.sites',
'django.contrib.sessions',
'tango_shared',
# from tango_shared reqs
'voting',
'easy_thumbnails',
'photos',
'articles'
)
DA... | mit | Python |
b9ad2e35cc9ab3f5e8fe8513f15c7838dc1ad017 | Use native KeyError | rudigiesler/mathml-to-image-service,rudigiesler/mathml-to-image-service | mathml_to_image_service/service.py | mathml_to_image_service/service.py | from flask import Flask, jsonify, request, url_for
from mathoid_client import get_svg
import svg_to_image
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def convert():
if request.method == 'GET':
return jsonify(error='Try sending MathML in a POST request. :)')
try:
mathml = ... | from flask import Flask, jsonify, request, url_for
from mathoid_client import get_svg
import svg_to_image
app = Flask(__name__)
def safe_get_field(field):
if field in request.form:
return request.form[field]
raise KeyError(field)
@app.route('/', methods=['GET', 'POST'])
def convert():
if requ... | mit | Python |
c16778aed897e5a3da8e5b2695e31afa43f2c12f | Update StreamClassConfiguration unit test | JCH222/matriochkas | matriochkas/tests/Configuration.py | matriochkas/tests/Configuration.py | # coding: utf8
from matriochkas.core import Configuration
def test_stream_class_configuration():
assert len(Configuration.StreamClassConfiguration) == 3
assert Configuration.StreamClassConfiguration.StringIO.name == 'StringIO'
assert Configuration.StreamClassConfiguration.StringIO.value == {'read_metho... | # coding: utf8
from matriochkas.core import Configuration
def test_stream_class_configuration():
assert len(Configuration.StreamClassConfiguration) == 2
assert Configuration.StreamClassConfiguration.StringIO.name == 'StringIO'
assert Configuration.StreamClassConfiguration.StringIO.value == {'read_metho... | mit | Python |
5e1bf2fb15cbcf886755303c9cc854ddd9646107 | correct app name | tBaxter/tango-shared-core,tBaxter/tango-shared-core,tBaxter/tango-shared-core | test_settings.py | test_settings.py | SECRET_KEY = "lorem ipsum"
INSTALLED_APPS = (
'easy_thumbnails',
'django.contrib.contenttypes',
'voting',
'tango_shared',
)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
SITE_ID = 1
#stripped down middleware
MIDDLEWARE_CLASSES = (
... | SECRET_KEY = "lorem ipsum"
INSTALLED_APPS = (
'easy_thumbnails',
'django.contrib.contenttypes',
'tango_voting',
'tango_shared',
)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
SITE_ID = 1
#stripped down middleware
MIDDLEWARE_CLASSE... | mit | Python |
484149a9ad3a9314f37d549aadde8d542b7ea670 | test database corrected | IMIO/django-fixmystreet,IMIO/django-fixmystreet,IMIO/django-fixmystreet,IMIO/django-fixmystreet | test_settings.py | test_settings.py | import os
import settings
DATABASES = {
'default': {
'ENGINE': 'postgresql_psycopg2',
'NAME': 'fixmystreet-test',
'USER': os.environ.get('POSTGISUSER'),
'PASSWORD': os.environ.get('POSTGISPWD'),
'HOST': os.environ.get('POSTGISDB'),
'PORT': 5432,
'OPTIONS': {... | import os
import settings
DATABASES = {
'default': {
'ENGINE': 'postgresql_psycopg2',
'NAME': 'fixmystreet',
'USER': os.environ.get('POSTGISUSER'),
'PASSWORD': os.environ.get('POSTGISPWD'),
'HOST': os.environ.get('POSTGISDB'),
'PORT': 5432,
'OPTIONS': {
... | agpl-3.0 | Python |
98a54d8a50b2cfc88678c03b463aeb0d51778b43 | index changed to provide a 1-n index instead of 0-(n-1) | rrpg/engine,rrpg/engine | core/commands/open.py | core/commands/open.py | # -*- coding: utf-8 -*-
from models import item_container, item
import core.command
from core.localisation import _
class open(core.command.command):
def run(self):
"""
c.run()
Open an item container in the area where the player is.
The result of the command is a list of the items of the container
"""
i... | # -*- coding: utf-8 -*-
from models import item_container, item
import core.command
from core.localisation import _
class open(core.command.command):
def run(self):
"""
c.run()
Open an item container in the area where the player is.
The result of the command is a list of the items of the container
"""
i... | mit | Python |
f88b4ebd1e1d65543020fd4172806c6148f820fe | add number of workers threads as command line argument | pycurl/pycurl,p/pycurl-archived,pycurl/pycurl,pycurl/pycurl,p/pycurl-archived,p/pycurl-archived | tests/crawler.py | tests/crawler.py | # $Id$
## System modules
import sys
import threading
import Queue
## PycURL module
import pycurl
class WorkerThread(threading.Thread):
def __init__(self, iq):
threading.Thread.__init__(self)
self.iq = iq
self.curl = pycurl.init()
self.curl.setopt(pycurl.FOLLOWLOCATION, 1)
... | # $Id$
## System modules
import sys
import threading
import Queue
## PycURL module
import pycurl
class WorkerThread(threading.Thread):
def __init__(self, iq):
threading.Thread.__init__(self)
self.iq = iq
self.curl = pycurl.init()
self.curl.setopt(pycurl.FOLLOWLOCATION, 1)
... | lgpl-2.1 | Python |
bbf305f04a26fc2022a3549e6066130c9b395b8c | Rework on tensorflow_io/kinesis/__init__.py | tensorflow/io,tensorflow/io,tensorflow/io,tensorflow/io,tensorflow/io,tensorflow/io,tensorflow/io | tensorflow_io/kinesis/__init__.py | tensorflow_io/kinesis/__init__.py | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 | Python |
6dfd59b0e873173c455b1085e091495cf775f852 | Prepare for new release | scholi/pySPM | pySPM/__init__.py | pySPM/__init__.py | # -- coding: utf-8 --
# Copyright 2018 Olivier Scholder <o.scholder@gmail.com>
from __future__ import absolute_import
#from . import ToF
from .SPM import *
from . import align, utils
from .nanoscan import Nanoscan
from .Bruker import Bruker
from .collection import Collection
from .ITM import ITM
from .ITS import ITS... | # -- coding: utf-8 --
# Copyright 2018 Olivier Scholder <o.scholder@gmail.com>
from __future__ import absolute_import
#from . import ToF
from .SPM import *
from . import align, utils
from .nanoscan import Nanoscan
from .Bruker import Bruker
from .collection import Collection
from .ITM import ITM
from .ITS import ITS... | apache-2.0 | Python |
7c13e77bfde6f9eea16ff522bf7db093173ec040 | Update __init__.py. | emtpb/pyfds | pyfds/__init__.py | pyfds/__init__.py | from .fields import *
| bsd-3-clause | Python | |
5b7f81e31f91a5838b11c3f7c67bdd1cd59a8ee0 | print name of the spider which failed parsing, in case of a invalid json file | Youwotma/portia,pombredanne/portia,nju520/portia,Youwotma/portia,livepy/portia,PrasannaVenkadesh/portia,sntran/portia,NicoloPernigo/portia,CENDARI/portia,Suninus/portia,flip111/portia,PrasannaVenkadesh/portia,hmilywb/portia,sntran/portia,Youwotma/portia,NoisyText/portia,nju520/portia,livepy/portia,anjuncc/portia,Prasan... | slybot/utils.py | slybot/utils.py | from urlparse import urlparse
import os
import json
def iter_unique_scheme_hostname(urls):
"""Return an iterator of tuples (scheme, hostname) over the given urls,
filtering dupes
"""
scheme_hostname = set()
for x in urls:
p = urlparse(x)
scheme_hostname.add((p.scheme, p.hostname))
... | from urlparse import urlparse
import os
import json
def iter_unique_scheme_hostname(urls):
"""Return an iterator of tuples (scheme, hostname) over the given urls,
filtering dupes
"""
scheme_hostname = set()
for x in urls:
p = urlparse(x)
scheme_hostname.add((p.scheme, p.hostname))
... | bsd-3-clause | Python |
503924f054f6f81eb08eda9884e5e4adc4df1609 | Add x, y and n_components to docstring | olgabot/cupcake | cupcake/smush/plot.py | cupcake/smush/plot.py | """
User-facing interface for plotting all dimensionality reduction algorithms
"""
def smushplot(data, smusher='PCA', x=1, y=2, n_components=2, marker='o',
marker_order=None, text=False, text_order=None, linewidth=1,
linewidth_order=None, edgecolor='k', edgecolor_order=None,
s... | """
User-facing interface for plotting all dimensionality reduction algorithms
"""
def smushplot(data, smusher='PCA', x=1, y=2, n_components=2, marker='o',
marker_order=None, text=False, text_order=None, linewidth=1,
linewidth_order=None, edgecolor='k', edgecolor_order=None,
s... | bsd-3-clause | Python |
a81c5bf24ab0271c60ed1db97d93c7d2e5ec6234 | Make largest stock a property | alanc10n/py-cutplanner | cutplanner/planner.py | cutplanner/planner.py | import collections
# simple structure to keep track of a specific piece
Piece = collections.namedtuple('Piece', 'id, length')
class Planner(object):
def __init__(self, sizes, needed, loss=0.25):
self.stock = []
self.stock_sizes = sorted(sizes)
self.pieces_needed = needed
self.cut_... | import collections
# simple structure to keep track of a specific piece
Piece = collections.namedtuple('Piece', 'id, length')
class Planner(object):
def __init__(self, sizes, needed, loss=0.25):
self.stock = []
self.stock_sizes = sorted(sizes)
self.pieces_needed = needed
self.cut_... | mit | Python |
0ce003bbac98c0796ce97edb67c0b8033b6ab5f2 | Fix deprecated raise syntax. | theatlantic/django-south,theatlantic/django-south | south/logger.py | south/logger.py | import sys
import logging
from django.conf import settings
# Create a dummy handler to use for now.
class NullHandler(logging.Handler):
def emit(self, record):
pass
def get_logger():
"Attach a file handler to the logger if there isn't one already."
debug_on = getattr(settings, "SOUTH_LOGGING_ON", ... | import sys
import logging
from django.conf import settings
# Create a dummy handler to use for now.
class NullHandler(logging.Handler):
def emit(self, record):
pass
def get_logger():
"Attach a file handler to the logger if there isn't one already."
debug_on = getattr(settings, "SOUTH_LOGGING_ON", ... | apache-2.0 | Python |
0f1861ea6d136a7e1442aa3cd1831c755c967002 | Fix API url | SchoolIdolTomodachi/SchoolIdolAPIOAuthExample,SchoolIdolTomodachi/SchoolIdolAPIOAuthExample,SchoolIdolTomodachi/SchoolIdolAPIOAuthExample | Python/settings.py | Python/settings.py | import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
DEBUG = True
ROOT_URLCONF = 'urls'
SECRET_KEY = '6o^up^px47mgp2dzoh&*_unzx2d9*gdpyn+ix4mt94y55mj!(y'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
BASE_DIR + '/templates/',
... | import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
DEBUG = True
ROOT_URLCONF = 'urls'
SECRET_KEY = '6o^up^px47mgp2dzoh&*_unzx2d9*gdpyn+ix4mt94y55mj!(y'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
BASE_DIR + '/templates/',
... | apache-2.0 | Python |
7ecbf036bbdf0dd2a858a398617e8227fd3e137e | use TabularInline | Christophe31/django-tickets,byteweaver/django-tickets,byteweaver/django-tickets,Christophe31/django-tickets | tickets/admin.py | tickets/admin.py | from django.contrib import admin
from django.template.defaultfilters import date as _date, time as _time
from django.utils.translation import ugettext_lazy as _
from models import Ticket, TicketComment
class TicketCommentInline(admin.TabularInline):
model = TicketComment
extra = 1
raw_id_fields = ['autho... | from django.contrib import admin
from django.template.defaultfilters import date as _date, time as _time
from django.utils.translation import ugettext_lazy as _
from models import Ticket, TicketComment
class TicketCommentInline(admin.StackedInline):
model = TicketComment
extra = 1
raw_id_fields = ['autho... | bsd-3-clause | Python |
981e31caa7bdddc35f8edf0b98924e830f053f30 | add last modified to toggle | qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq | toggle/models.py | toggle/models.py | from __future__ import absolute_import
from datetime import datetime
from dimagi.ext.couchdbkit import *
TOGGLE_ID_PREFIX = 'hqFeatureToggle'
class Toggle(Document):
"""
A very simple implementation of a feature toggle. Just a list of items
attached to a slug.
"""
slug = StringProperty()
ena... | from __future__ import absolute_import
from dimagi.ext.couchdbkit import *
TOGGLE_ID_PREFIX = 'hqFeatureToggle'
class Toggle(Document):
"""
A very simple implementation of a feature toggle. Just a list of items
attached to a slug.
"""
slug = StringProperty()
enabled_users = ListProperty()
... | bsd-3-clause | Python |
75d7441f90e077eeeb955e4eb0c514a1736a88fb | Add helper function to produce some dummy tuples (for testing and debugging) | maxalbert/tohu | tohu/v3/utils.py | tohu/v3/utils.py | from collections import namedtuple
__all__ = ['identity', 'print_generated_sequence']
def identity(x):
"""
Helper function which returns its argument unchanged.
That is, `identity(x)` returns `x` for any input `x`.
"""
return x
def print_generated_sequence(gen, num, *, sep=", ", seed=None):
... | __all__ = ['identity', 'print_generated_sequence']
def identity(x):
"""
Helper function which returns its argument unchanged.
That is, `identity(x)` returns `x` for any input `x`.
"""
return x
def print_generated_sequence(gen, num, *, sep=", ", seed=None):
"""
Helper function which print... | mit | Python |
1f7698033f0bd1123e7035bb9b47965961d6595d | remove empty line | kcompher/topik,lewismc/topik,lewismc/topik,ContinuumIO/topik,kcompher/topik,lewismc/topik,kcompher/topik,ContinuumIO/topik | topik/readers.py | topik/readers.py | from __future__ import absolute_import
import json
import os
import logging
import codecs
from topik.utils import head
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
def iter_document_json_stream(filename, field):
"""
Iterate over a json stream of items and get ... | from __future__ import absolute_import
import json
import os
import logging
import codecs
from topik.utils import head
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
def iter_document_json_stream(filename, field):
"""
Iterate over a json stream of items and get... | bsd-3-clause | Python |
55050b7a6d5ed168bf7e2d22dd0d93b13613414e | Fix settings module broken by [1328]. | pkdevbox/trac,pkdevbox/trac,pkdevbox/trac,pkdevbox/trac | trac/Settings.py | trac/Settings.py | # -*- coding: iso8859-1 -*-
#
# Copyright (C) 2004, 2005 Edgewall Software
# Copyright (C) 2004, 2005 Daniel Lundin <daniel@edgewall.com>
#
# Trac 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... | # -*- coding: iso8859-1 -*-
#
# Copyright (C) 2004, 2005 Edgewall Software
# Copyright (C) 2004, 2005 Daniel Lundin <daniel@edgewall.com>
#
# Trac 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... | bsd-3-clause | Python |
1b252224b67ea7e9a9f9ac3e1a66b4170bdedef4 | Load middleware before we fork. | lamby/django-lightweight-queue,thread/django-lightweight-queue,thread/django-lightweight-queue,prophile/django-lightweight-queue,prophile/django-lightweight-queue | django_lightweight_queue/management/commands/queue_runner.py | django_lightweight_queue/management/commands/queue_runner.py | import logging
from optparse import make_option
from django.core.management.base import NoArgsCommand
from ...utils import get_backend, get_middleware
class Command(NoArgsCommand):
option_list = NoArgsCommand.option_list + (
make_option('--pidfile', action='store', dest='pidfile', default=None,
... | import logging
from optparse import make_option
from django.core.management.base import NoArgsCommand
from ...utils import get_backend
class Command(NoArgsCommand):
option_list = NoArgsCommand.option_list + (
make_option('--pidfile', action='store', dest='pidfile', default=None,
help="Fork a... | bsd-3-clause | Python |
e14f619af8a94926bba06938bb25547f6ffc9087 | fix .cfg to .conf file extension | koteq/hlstats_inviter | inviter.py | inviter.py | #!/usr/bin/env python2
import ConfigParser
import logging.config
from includes.HlstatsInvitationSource import HlstatsInvitationSource
from includes.SteamGroupInviter import SteamGroupInviter
def main():
logging.config.fileConfig('logging.conf')
logger = logging.getLogger()
config = ConfigParser.RawConfi... | #!/usr/bin/env python2
import ConfigParser
import logging.config
from includes.HlstatsInvitationSource import HlstatsInvitationSource
from includes.SteamGroupInviter import SteamGroupInviter
def main():
logging.config.fileConfig('logging.conf')
logger = logging.getLogger()
config = ConfigParser.RawConfi... | unlicense | Python |
3fa11d594636ecf1188b4b82983ffaa09b221c7f | Test freq of predicted dates | kiyoto/statsmodels,edhuckle/statsmodels,ChadFulton/statsmodels,jstoxrocky/statsmodels,saketkc/statsmodels,nvoron23/statsmodels,edhuckle/statsmodels,kiyoto/statsmodels,cbmoore/statsmodels,gef756/statsmodels,astocko/statsmodels,bzero/statsmodels,nguyentu1602/statsmodels,jseabold/statsmodels,yl565/statsmodels,bashtage/sta... | statsmodels/tsa/base/tests/test_base.py | statsmodels/tsa/base/tests/test_base.py | import numpy as np
from pandas import Series
from pandas.util import testing as ptesting
from statsmodels.tsa.base.tsa_model import TimeSeriesModel
from statsmodels.tsa.base.datetools import dates_from_range
import numpy.testing as npt
try:
from pandas import DatetimeIndex
_pandas_08x = True
except ImportError... | from pandas import Series
from statsmodels.tsa.base.tsa_model import TimeSeriesModel
import numpy.testing as npt
def test_pandas_nodates_index():
from statsmodels.datasets import sunspots
y = sunspots.load_pandas().data.SUNACTIVITY
npt.assert_raises(ValueError, TimeSeriesModel, y)
| bsd-3-clause | Python |
4ac1fa3deaf56a5b6dee485b1401dcd004104038 | use MPTT choicefield in admin for MPTT FKs | revolunet/django-picocms,revolunet/django-picocms | picocms/admin.py | picocms/admin.py | from django.contrib import admin
from django.forms.models import ModelMultipleChoiceField
from mptt.admin import MPTTModelAdmin
from mptt.forms import TreeNodeChoiceField
import models
#
# Custom CMS admin
#
class CMSModelAdmin(admin.ModelAdmin):
""" This ModelAdmin adds tinyMce for HTMLField and HTMLBigField.
... | from django.contrib import admin
from django.forms.models import ModelMultipleChoiceField
from mptt.admin import MPTTModelAdmin
import models
#
# Custom CMS admin
#
class CMSModelAdmin(admin.ModelAdmin):
""" This ModelAdmin adds tinyMce for HTMLField and HTMLBigField.
We also remove any reference to self... | bsd-3-clause | Python |
9e0ab4bfcd9e22447e66bb87f2ed849ffcd0c57a | Remove additional nesting from Shutter.snapshots results | mulander/shutter | shutter/service.py | shutter/service.py | class Shutter(object):
def setup_database(self, pool):
self.__dbpool = pool
def snapshots(self, url):
def _get_snapshot_urls(txn, url):
txn.execute("""SELECT s.file_path
FROM shutter.urls u
,shutter.snapshots s
... | class Shutter(object):
def setup_database(self, pool):
self.__dbpool = pool
def snapshots(self, url):
def _get_snapshot_urls(txn, url):
txn.execute("""SELECT s.file_path
FROM shutter.urls u
,shutter.snapshots s
... | bsd-3-clause | Python |
0ec05d4bf05fa0916b510b1d23bcc57bc25f707c | Fix bug | tietokilta-saato/tikplay,tietokilta-saato/tikplay,tietokilta-saato/tikplay,tietokilta-saato/tikplay | tikplay/audio.py | tikplay/audio.py | import logging
class API():
""" Implements the audio parsing interface for tikplay.
Parses song metadata, handles database updating, and pushes the audio to soundcard
Also implements basic song metadata fetching from the database
"""
def __init__(self, media_cls, mpd_addr):
self.logger =... | import logging
class API():
""" Implements the audio parsing interface for tikplay.
Parses song metadata, handles database updating, and pushes the audio to soundcard
Also implements basic song metadata fetching from the database
"""
def __init__(self, media_cls, mpd_addr):
self.logger =... | mit | Python |
2a8a39ef8ca1e8bca7c1e36783d1e0bc0a43df26 | Fix version number to upload to PyPI | carlosedb/django-todo,shacker/django-todo,jwiltshire/django-todo,carlosedb/django-todo,shacker/django-todo,carlosedb/django-todo,jwiltshire/django-todo,jwiltshire/django-todo,shacker/django-todo | todo/__init__.py | todo/__init__.py | """django todo"""
__version__ = '1.4'
__author__ = 'Scot Hacker'
__email__ = 'shacker@birdhouse.org'
__url__ = 'https://github.com/shacker/django-todo'
__license__ = 'BSD License'
| """django todo"""
__version__ = '1.4.dev'
__author__ = 'Scot Hacker'
__email__ = 'shacker@birdhouse.org'
__url__ = 'https://github.com/shacker/django-todo'
__license__ = 'BSD License'
| bsd-3-clause | Python |
14c3e36530ec464d96a53eefe2806940b00cb9c9 | Fix typo in docstring | pressel/mpi4py,mpi4py/mpi4py,mpi4py/mpi4py,mpi4py/mpi4py,pressel/mpi4py,pressel/mpi4py,pressel/mpi4py | src/__init__.py | src/__init__.py | # Author: Lisandro Dalcin
# Contact: dalcinl@gmail.com
# Id: $Id$
"""
This is the **MPI for Python** package.
What is MPI?
============
MPI, the *Message Passing Interface*, is a standardized and portable
message-passing system designed to function on a wide variety of
parallel computers. The standard defines ... | # Author: Lisandro Dalcin
# Contact: dalcinl@gmail.com
# Id: $Id$
"""
This is the **MPI for Python** package.
What is MPI?
============
MPI, the *Message Passing Interface*, is a standardized and portable
message-passing system designed to function on a wide variety of
parallel computers. The standard defines ... | bsd-2-clause | Python |
12c0f669a5874ad020108c3e75c958a6ee586065 | Use a numpy rather than pandas object for internal reweighting data. | hande-qmc/hande,hande-qmc/hande,hande-qmc/hande,hande-qmc/hande,ruthfranklin/hande,hande-qmc/hande | tools/pyhande/weight.py | tools/pyhande/weight.py | '''Attempt to remove population control bias by reweighting averages.'''
import pandas as pd
import numpy as np
from math import exp
def reweight(data, mc_cycles, tstep, weight_itts, mean_shift,
weight_key='Shift'):
'''Reweight using population control to reduce population control bias.
See C. J. Umirigar et. al.... | '''Attempt to remove population control bias by reweighting averages.'''
import pandas as pd
import numpy as np
from math import exp
def reweight(data, mc_cycles, tstep, weight_itts, mean_shift,
weight_key='Shift'):
'''Reweight using population control to reduce population control bias.
See C. J. Umirigar et. al.... | lgpl-2.1 | Python |
551d854fbd565377a22adcda230f9ac91e2a1aef | fix stock formatting | rmmh/skybot,crisisking/skybot,parkrrr/skybot,olslash/skybot,TeamPeggle/ppp-helpdesk,ddwo/nhl-bot,jmgao/skybot | plugins/stock.py | plugins/stock.py | from util import hook, http
@hook.command
def stock(inp):
'''.stock <symbol> -- gets stock information'''
url = ('http://query.yahooapis.com/v1/public/yql?format=json&'
'env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys')
parsed = http.get_json(url, q='select * from yahoo.finance.quotes '
... | from util import hook, http
@hook.command
def stock(inp):
'''.stock <symbol> -- gets stock information'''
url = ('http://query.yahooapis.com/v1/public/yql?format=json&'
'env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys')
parsed = http.get_json(url, q='select * from yahoo.finance.quotes '
... | unlicense | Python |
d1f9225844b708f8bde65baa6f80ed92b34ca10b | refactor test | rafaqz/citation.vim | python/citation_vim/test.py | python/citation_vim/test.py | # -*- coding: utf-8 -*-
"""
Tests your citation database in the console
Example *nix style commands:
python test.py /your/bibtext/file bibtex key
python test.py /your/zotero/path zotero key "searchstring" 4
"""
import sys
import os.path
module_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir... | # -*- coding: utf-8 -*-
"""
Tests your citation database in the console
Example *nix style commands:
python test.py /your/bibtext/file bibtex key
python test.py /your/zotero/path zotero key "searchstring" 4
"""
import sys
import os.path
module_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir... | mit | Python |
e73aca80df1492192b5b8ff88e193052940dce55 | Update main.py | clccmh/pomodoro | pomodoro/main.py | pomodoro/main.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import click
import progressbar
import time
@click.command()
@click.option('--minutes', '-m', default=25, help='Number of minutes, default 25.')
@click.option('--seconds', '-s', help='Number of seconds.')
def main(minutes, seconds):
bar = progressbar.ProgressBar(widg... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import click
import progressbar
import time
@click.command()
@click.option('--minutes', default=25, help='Number of minutes, default 25.')
def main(minutes):
bar = progressbar.ProgressBar(widgets=[
progressbar.Bar(),
])
for i in bar(range(minutes*60)):... | mit | Python |
a1cd2c326f9dba608ee3c6ce82dd425e93e8265d | Set the default device to native in Python binding | ktnyt/chainer,hvy/chainer,hvy/chainer,pfnet/chainer,chainer/chainer,ktnyt/chainer,jnishi/chainer,okuta/chainer,hvy/chainer,ktnyt/chainer,keisuke-umezawa/chainer,keisuke-umezawa/chainer,wkentaro/chainer,ktnyt/chainer,niboshi/chainer,keisuke-umezawa/chainer,okuta/chainer,okuta/chainer,hvy/chainer,tkerola/chainer,chainer/... | python/xchainer/__init__.py | python/xchainer/__init__.py | from xchainer._core import * # NOQA
_global_context = Context()
set_global_default_context(_global_context)
set_default_device('native')
| from xchainer._core import * # NOQA
_global_context = Context()
_global_context.get_backend('native')
set_global_default_context(_global_context)
| mit | Python |
d467dd78b2718a9bd4dfe03b74cfc97b8598b31a | fix while loop condition to properly escape based on index value and output value. fixed typos. add final broken check. | constanthatz/data-structures | proper_parens.py | proper_parens.py | #!/usr/bin/env python
from __future__ import unicode_literals
def check_statement(value):
''' Return 1, 0, or -1 if input is open, balanced, or broken. '''
output = 0
index = 0
while index < len(value) and output >= 0:
# If the count is ever < 0, statement must be -1 (broken), end loop
... | #!/usr/bin/env python
from __future__ import unicode_literals
def check_statement(value):
''' Return 1, 0, or -1 if input is open, balanced, or broken. '''
output = 0
index = 0
while index < len(value) or output < 0:
# If the count is ever < 0, statement must be -1 (broken), end loop
#... | mit | Python |
5e6f91c5336807c183d29e2de2ae3c50edfc9ddd | Update stock_location.py | Vauxoo/stock-logistics-warehouse,Vauxoo/stock-logistics-warehouse,Vauxoo/stock-logistics-warehouse | stock_account_internal_move/models/stock_location.py | stock_account_internal_move/models/stock_location.py | # Copyright (C) 2018 by Camptocamp
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
class StockLocation(models.Model):
_inherit = 'stock.location'
force_accounting_entries = fields.Boolean(
string='Forc... | # Copyright (C) 2018 by Camptocamp
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
class StockLocation(models.Model):
_inherit = 'stock.location'
force_accounting_entries = fields.Boolean(
string='Forc... | agpl-3.0 | Python |
cd9d2a525bccc3d937f2c213f6aeeb846ebb1c3d | include include | sunlightlabs/tcamp,sunlightlabs/tcamp,sunlightlabs/tcamp,sunlightlabs/tcamp | tcamp/api/urls.py | tcamp/api/urls.py | from django.conf.urls.defaults import patterns, url, include
from tastypie.api import Api
from api.resources import *
v1 = Api(api_name='1.0')
v1.register(EventResource())
v1.register(SessionResource())
v1.register(LocationResource())
urlpatterns = patterns('',
url(r'^', include(v1.urls)),
)
| from django.conf.urls.defaults import patterns, url
from tastypie.api import Api
from api.resources import *
v1 = Api(api_name='1.0')
v1.register(EventResource())
v1.register(SessionResource())
v1.register(LocationResource())
urlpatterns = patterns('',
url(r'^', include(v1.urls)),
)
| bsd-3-clause | Python |
c17dd1eff29bcdfdb066b05cc05af354ad461a1f | add support for custom proxy url handler | datavisyn/tdp_core,datavisyn/tdp_core,datavisyn/tdp_core,datavisyn/tdp_core | tdp_core/proxy.py | tdp_core/proxy.py | from phovea_server.ns import Namespace, Response, request, abort
import requests
import logging
_log = logging.getLogger(__name__)
__author__ = 'Samuel Gratzl'
app = Namespace(__name__)
def _to_site_url(site):
import phovea_server.plugin
proxy_defs = phovea_server.plugin.list('tdp_proxy')
for p in proxy_def... | from phovea_server.ns import Namespace, Response, request, abort
import requests
__author__ = 'Samuel Gratzl'
app = Namespace(__name__)
def _to_site_url(site):
import phovea_server.plugin
proxy_defs = phovea_server.plugin.list('tdp_proxy')
for p in proxy_defs:
if p.id == site:
headers = getattr(p, ... | bsd-3-clause | Python |
0f214feb318e378c44d6c7dd80efb9898f0c8402 | Update version code. | TamiaLab/PySkCode | skcode/__init__.py | skcode/__init__.py | """
SkCode (Python implementation of BBcode syntax) parser library.
"""
# Package information
__author__ = "Fabien Batteix (@skywodd)"
__copyright__ = "Copyright 2015, TamiaLab"
__credits__ = ["Fabien Batteix", "TamiaLab"]
__license__ = "GPLv3"
__version__ = "1.0.2"
__maintainer__ = "Fabien Batteix"
__email__ = "fabie... | """
SkCode (Python implementation of BBcode syntax) parser library.
"""
# Package information
__author__ = "Fabien Batteix (@skywodd)"
__copyright__ = "Copyright 2015, TamiaLab"
__credits__ = ["Fabien Batteix", "TamiaLab"]
__license__ = "GPLv3"
__version__ = "1.0.1"
__maintainer__ = "Fabien Batteix"
__email__ = "fabie... | agpl-3.0 | Python |
849bc52bc3ab6548e12c72d2676caa6171a47f2c | Add type checks of args during instantiation | jrsmith3/datac,jrsmith3/datac | datac/datac.py | datac/datac.py | # -*- coding: utf-8 -*-
import copy
class Datac(object):
"""
Model of 2D data with static parameters
A `Datac` object is instantiated with the following parameters:
:param dict params: Static parameters required to initialize the object featuring the ordinate calculator method.
:param list absci... | # -*- coding: utf-8 -*-
import copy
class Datac(object):
"""
Model of 2D data with static parameters
A `Datac` object is instantiated with the following parameters:
:param dict params: Static parameters required to initialize the object featuring the ordinate calculator method.
:param list absci... | mit | Python |
2a512e35cb10cff00724717029b8f09f20fe41bf | Remove useless cancel button | bcroq/kansha,Net-ng/kansha,bcroq/kansha,Net-ng/kansha,Net-ng/kansha,bcroq/kansha,bcroq/kansha,Net-ng/kansha | kansha/title/view.py | kansha/title/view.py | # -*- coding:utf-8 -*-
#--
# Copyright (c) 2012-2014 Net-ng.
# All rights reserved.
#
# This software is licensed under the BSD License, as described in
# the file LICENSE.txt, which you should have received as part of
# this distribution.
#--
from nagare.i18n import _
from nagare import presentation, var
from .comp ... | # -*- coding:utf-8 -*-
#--
# Copyright (c) 2012-2014 Net-ng.
# All rights reserved.
#
# This software is licensed under the BSD License, as described in
# the file LICENSE.txt, which you should have received as part of
# this distribution.
#--
from nagare.i18n import _
from nagare import presentation, var
from .comp ... | bsd-3-clause | Python |
5d325477573fc2c87732e04663e05ef8dd172809 | Fix retry predicate condition (fix #11) | laughingman7743/PyAthena | pyathena/util.py | pyathena/util.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
import functools
import threading
import tenacity
from tenacity.after import after_log
from tenacity.retry import retry_if_exception
from tenacity.stop import stop_after_attempt
from tenacity.wait import wait_exponen... | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
import functools
import threading
import tenacity
from tenacity.after import after_log
from tenacity.retry import retry_if_exception
from tenacity.stop import stop_after_attempt
from tenacity.wait import wait_exponen... | mit | Python |
123b2b6599c8fc051b5e43806f95410500661114 | Fix hooks import. | sloede/pyglab,sloede/pyglab | pyglab/pyglab.py | pyglab/pyglab.py | _defaults = {
'api_url': 'api/v3',
}
from .apirequest import ApiRequest, RequestType
from .users import Users
from .user import User
from .projects import Projects
from .issues import Issues
from .groups import Groups
from .hooks import Hooks
class Pyglab(object):
def __init__(self, url, token, api_url=_defau... | _defaults = {
'api_url': 'api/v3',
}
from .apirequest import ApiRequest, RequestType
from .users import Users
from .user import User
from .projects import Projects
from .issues import Issues
from .groups import Groups
from .hooks import hooks
class Pyglab(object):
def __init__(self, url, token, api_url=_defau... | mit | Python |
48a80a4530661697ae2eecd065f5994920ce8859 | Bump version | timxx/gitc,timxx/gitc | qgitc/version.py | qgitc/version.py | # -*- coding: utf-8 -*-
VERSION_MAJOR = 2
VERSION_MINOR = 0
VERSION_PATCH = 2
VERSION = "{}.{}.{}".format(VERSION_MAJOR,
VERSION_MINOR,
VERSION_PATCH)
| # -*- coding: utf-8 -*-
VERSION_MAJOR = 2
VERSION_MINOR = 0
VERSION_PATCH = 1
VERSION = "{}.{}.{}".format(VERSION_MAJOR,
VERSION_MINOR,
VERSION_PATCH)
| apache-2.0 | Python |
83086966b5e084dbd4aba395c699a476882a3a10 | rename python class method | yangw1234/BigDL,intel-analytics/BigDL,yangw1234/BigDL,yangw1234/BigDL,yangw1234/BigDL,intel-analytics/BigDL,intel-analytics/BigDL,intel-analytics/BigDL | python/dllib/src/bigdl/dllib/feature/image/imagePreprocessing.py | python/dllib/src/bigdl/dllib/feature/image/imagePreprocessing.py | #
# Copyright 2016 The BigDL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | #
# Copyright 2016 The BigDL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | apache-2.0 | Python |
a9e5c88d5cb6df945be5e3efa8bea2696c039f78 | Update qutip/tests/test_simdiag.py | qutip/qutip,qutip/qutip,cgranade/qutip,cgranade/qutip | qutip/tests/test_simdiag.py | qutip/tests/test_simdiag.py | import pytest
import numpy as np
import qutip
@pytest.mark.parametrize('num_mat', [1, 2, 3, 5])
def test_simdiag(num_mat):
N = 10
U = qutip.rand_unitary(N)
commuting_matrices = [U * qutip.qdiags(np.random.rand(N), 0) * U.dag()
for _ in range(num_mat)]
all_evals, evecs = quti... | import pytest
import numpy as np
import qutip
@pytest.mark.parametrize('num_mat', [1, 2, 3, 5])
def test_simdiag(num_mat):
N = 10
U = qutip.rand_unitary(N)
commuting_matrices = [U * qutip.qdiags(np.random.rand(N), 0) * U.dag()
for _ in range(num_mat)]
all_evals, evecs = quti... | bsd-3-clause | Python |
99dd45582cba9f54a5cc9042812d255fe57b1222 | Support new location of ProxyFix helper | adamcik/oauthclientbridge | oauthclientbridge/__init__.py | oauthclientbridge/__init__.py | # flake8: noqa
from flask import Flask
try:
from werkzeug.middleware.proxy_fix import ProxyFix
except ImportError:
from werkzeug.contrib.fixers import ProxyFix
__version__ = '1.0.1'
app = Flask(__name__)
app.config.from_object('oauthclientbridge.default_settings')
app.config.from_envvar('OAUTH_SETTINGS', si... | # flake8: noqa
from flask import Flask
from werkzeug.contrib.fixers import ProxyFix
__version__ = '1.0.1'
app = Flask(__name__)
app.config.from_object('oauthclientbridge.default_settings')
app.config.from_envvar('OAUTH_SETTINGS', silent=True)
if app.config['OAUTH_NUM_PROXIES']:
wrapper = ProxyFix(app.wsgi_app,... | apache-2.0 | Python |
fa7444ec94a3db08fa11d418e1b257f3cf6e247d | fix shipping rule test cases (copy name with copy_doc) | rohitwaghchaure/GenieManager-erpnext,netfirms/erpnext,dieface/erpnext,Tejal011089/osmosis_erpnext,gangadharkadam/letzerp,netfirms/erpnext,indictranstech/Das_Erpnext,shft117/SteckerApp,gangadhar-kadam/verve_live_erp,sagar30051991/ozsmart-erp,Tejal011089/digitales_erpnext,gangadharkadam/vlinkerp,mbauskar/phrerp,gangadhar... | erpnext/accounts/doctype/shipping_rule/test_shipping_rule.py | erpnext/accounts/doctype/shipping_rule/test_shipping_rule.py | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import frappe
import unittest
from erpnext.accounts.doctype.shipping_rule.shipping_rule import FromGreaterThanToError, ManyBlankToValuesError, OverlappingConditionError
test_records = frap... | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import frappe
import unittest
from erpnext.accounts.doctype.shipping_rule.shipping_rule import FromGreaterThanToError, ManyBlankToValuesError, OverlappingConditionError
test_records = frap... | agpl-3.0 | Python |
bcd4632de347f0bcdb42c712fbcb294edafea71e | add direction column to message list admin | catalpainternational/rapidsms,lsgunth/rapidsms,peterayeni/rapidsms,peterayeni/rapidsms,ehealthafrica-ci/rapidsms,ehealthafrica-ci/rapidsms,lsgunth/rapidsms,catalpainternational/rapidsms,lsgunth/rapidsms,peterayeni/rapidsms,lsgunth/rapidsms,eHealthAfrica/rapidsms,caktus/rapidsms,peterayeni/rapidsms,ehealthafrica-ci/rapi... | rapidsms/router/db/admin.py | rapidsms/router/db/admin.py | from django.contrib import admin
from rapidsms.router.db.models import Message, Transmission
class MessageAdmin(admin.ModelAdmin):
search_fields = ('text',)
list_display = ('id', 'date', 'direction', 'text', 'status', 'updated',
'sent', 'delivered')
list_filter = ('direction', 'status'... | from django.contrib import admin
from rapidsms.router.db.models import Message, Transmission
class MessageAdmin(admin.ModelAdmin):
search_fields = ('text',)
list_display = ('id', 'date', 'direction', 'text', 'status', 'updated',
'sent', 'delivered')
list_filter = ('status',)
orderi... | bsd-3-clause | Python |
d48e59f4b1174529a4d2eca8731472a5bf371621 | Allow to set default value in template | Glamping-Hub/django-painless-seo,Glamping-Hub/django-painless-seo,AMongeMoreno/django-painless-seo,AMongeMoreno/django-painless-seo | simpleseo/templatetags/seo.py | simpleseo/templatetags/seo.py | from django.forms.models import model_to_dict
from django.template import Library
from django.utils.translation import get_language
from simpleseo import settings
from simpleseo.models import SeoMetadata
register = Library()
@register.filter
def single_quotes(description):
return description.replace('\"', '\'')... | from django.template import Library
from django.utils.translation import get_language
from simpleseo import settings
from simpleseo.models import SeoMetadata
register = Library()
@register.filter
def single_quotes(description):
return description.replace('\"', '\'')
@register.inclusion_tag('simpleseo/metadata... | bsd-3-clause | Python |
b8785d7e95082964caba37fa73436fa30660a2e8 | Update AmazonMQ::Broker properties to use [basestring] instead of list | cloudtools/troposphere,ikben/troposphere,johnctitus/troposphere,ikben/troposphere,pas256/troposphere,cloudtools/troposphere,pas256/troposphere,johnctitus/troposphere | troposphere/amazonmq.py | troposphere/amazonmq.py | # Copyright (c) 2012-2018, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSObject, AWSProperty
from .validators import boolean, integer
class ConfigurationId(AWSProperty):
props = {
'Id': (basestring, True),
'Revision': (integer, True),
... | # Copyright (c) 2012-2018, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSObject, AWSProperty
from .validators import boolean, integer
class ConfigurationId(AWSProperty):
props = {
'Id': (basestring, True),
'Revision': (integer, True),
... | bsd-2-clause | Python |
1d5fec4c22da9e9f9842b446ed9dc79f78c3449c | bump version for release | astraw/adskalman | adskalman/version.py | adskalman/version.py | __version__ = '0.3.3'
| __version__ = '0.3.2'
| bsd-3-clause | Python |
aacec93887e6418a843173132b644315bf29f8d4 | include blkdev.h instead of genhd.h | iovisor/bcc,iovisor/bcc,iovisor/bcc,iovisor/bcc,iovisor/bcc | tools/mdflush.py | tools/mdflush.py | #!/usr/bin/python
# @lint-avoid-python-3-compatibility-imports
#
# mdflush Trace md flush events.
# For Linux, uses BCC, eBPF.
#
# Todo: add more details of the flush (latency, I/O count).
#
# Copyright 2016 Netflix, Inc.
# Licensed under the Apache License, Version 2.0 (the "License")
#
# 13-Feb-2015 Brend... | #!/usr/bin/python
# @lint-avoid-python-3-compatibility-imports
#
# mdflush Trace md flush events.
# For Linux, uses BCC, eBPF.
#
# Todo: add more details of the flush (latency, I/O count).
#
# Copyright 2016 Netflix, Inc.
# Licensed under the Apache License, Version 2.0 (the "License")
#
# 13-Feb-2015 Brend... | apache-2.0 | Python |
c6c76067020e910b316457ed7605422d909e90ce | Correct path | DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations | polling_stations/apps/data_importers/management/commands/import_kingston-upon-thames.py | polling_stations/apps/data_importers/management/commands/import_kingston-upon-thames.py | from data_importers.management.commands import BaseDemocracyCountsCsvImporter
class Command(BaseDemocracyCountsCsvImporter):
council_id = "KTT"
addresses_name = "2022-11-10/2022-10-24T10:18:05.344501/RBK_Polling_Districts.csv"
stations_name = "2022-11-10/2022-10-24T10:18:05.344501/RBK_Polling_Stations.csv... | from data_importers.management.commands import BaseDemocracyCountsCsvImporter
class Command(BaseDemocracyCountsCsvImporter):
council_id = "KTT"
addresses_name = "2022-11-10/2022-10-24T10:18:05.344501/RBK_Polling Districts_GreenLane&StJames.csv"
stations_name = "2022-11-10/2022-10-24T10:18:05.344501/RBK_Po... | bsd-3-clause | Python |
05d74819141640369f1fd4f045f50084bd2f11f1 | Use the cassandra pytest marker | CenterForOpenScience/scrapi,felliott/scrapi,erinspace/scrapi,fabianvf/scrapi,jeffreyliu3230/scrapi,erinspace/scrapi,CenterForOpenScience/scrapi,alexgarciac/scrapi,fabianvf/scrapi,icereval/scrapi,mehanig/scrapi,mehanig/scrapi,ostwald/scrapi,felliott/scrapi | tests/test_cassandra_processor.py | tests/test_cassandra_processor.py | import pytest
from scrapi.linter.document import NormalizedDocument, RawDocument
# Need to force cassandra to ignore set keyspace
from scrapi.processing.cassandra import CassandraProcessor, DocumentModel, VersionModel
from . import utils
test_db = CassandraProcessor()
NORMALIZED = NormalizedDocument(utils.RECORD)... | import utils
from scrapi import settings
from scrapi.linter.document import NormalizedDocument, RawDocument
# Need to force cassandra to ignore set keyspace
from scrapi.processing.cassandra import CassandraProcessor, DocumentModel, VersionModel
test_db = CassandraProcessor()
NORMALIZED = NormalizedDocument(utils.R... | apache-2.0 | Python |
7bcbab70f0d04c0eb3e311e382c6821f3ea6219a | Clarify the comments for action_write_locks | thaim/ansible,thaim/ansible | lib/ansible/executor/action_write_locks.py | lib/ansible/executor/action_write_locks.py | # (c) 2016 - Red Hat, Inc. <info@ansible.com>
#
# This file is part of Ansible
#
# Ansible 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 3 of the License, or
# (at your option) any later versi... | # (c) 2016 - Red Hat, Inc. <info@ansible.com>
#
# This file is part of Ansible
#
# Ansible 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 3 of the License, or
# (at your option) any later versi... | mit | Python |
625a9a63845cb043e9be071ee4760a40c39c87b8 | solve 1 problem | Shuailong/Leetcode | solutions/zigzag-conversion.py | solutions/zigzag-conversion.py | #!/usr/bin/env python
# encoding: utf-8
"""
zigzag-conversion.py
Created by Shuailong on 2016-01-15.
https://leetcode.com/problems/zigzag-conversion/.
"""
'''
Key: understand the problem.
'''
class Solution(object):
def convert(self, s, numRows):
"""
:type s: str
:type numRows: int
... | #!/usr/bin/env python
# encoding: utf-8
"""
zigzag-conversion.py
Created by Shuailong on 2016-01-15.
https://leetcode.com/problems/zigzag-conversion/.
"""
def main():
pass
if __name__ == '__main__':
main()
| mit | Python |
684cff01a1f815d2e12c620124cf757a1db2ff41 | Update cpuinfo from 5916273f79a21551890fd3d56fc5375a78d1598d to b40bae27785787b6dd70788986fd96434cf90ae2. | Intel-tensorflow/tensorflow,tensorflow/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow-pywrap_tf_optimizer,yongtang/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow,gautam1858/tensorflow,yongtang/tensorflow,Intel-tensorflow/tensorflow,paolodedi... | third_party/cpuinfo/workspace.bzl | third_party/cpuinfo/workspace.bzl | """Loads the cpuinfo library, used by XNNPACK."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
tf_http_archive(
name = "cpuinfo",
strip_prefix = "cpuinfo-b40bae27785787b6dd70788986fd96434cf90ae2",
sha256 = "5794c7b37facc590018eddffec934c60aeb71165b59a375b... | """Loads the cpuinfo library, used by XNNPACK."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
tf_http_archive(
name = "cpuinfo",
strip_prefix = "cpuinfo-5916273f79a21551890fd3d56fc5375a78d1598d",
sha256 = "2a160c527d3c58085ce260f34f9e2b161adc009b34186a2b... | apache-2.0 | Python |
603004a20da12939f64a4f228e80f1cef11b2407 | add more cli to csv_inserter | Constructor-io/constructorio-python,Constructor-io/constructorio-python | examples/csv_inserter.py | examples/csv_inserter.py | import sys
import os
myPath = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, myPath + '/../')
# hack for easy import of the library
import csv
import webbrowser
from constructorio import ConstructorIO
if __name__ == "__main__":
api_token = raw_input("enter api token (enter q to quit) : ")
if ap... | import sys
import os
myPath = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, myPath + '/../')
# hack for easy import of the library
import csv
from constructorio import ConstructorIO
if __name__ == "__main__":
api_token = raw_input("enter api token (enter q to quit) : ")
if api_token == "q":
... | mit | Python |
a0be49155b98dfae4924748b3db9313fbf7ef5c1 | change vpls encoding | PowerDNS/exabgp,blablacar/exabgp,lochiiconnectivity/exabgp,benagricola/exabgp,dneiter/exabgp,earies/exabgp,fugitifduck/exabgp,dneiter/exabgp,PowerDNS/exabgp,benagricola/exabgp,fugitifduck/exabgp,fugitifduck/exabgp,benagricola/exabgp,earies/exabgp,blablacar/exabgp,PowerDNS/exabgp,dneiter/exabgp,lochiiconnectivity/exabgp... | lib/exabgp/bgp/message/update/nlri/vpls.py | lib/exabgp/bgp/message/update/nlri/vpls.py | # encoding: utf-8
"""
vpls.py
Created by Nikita Shirokov on 2014-06-16.
Copyright (c) 2014-2014 Nikita Shirokov. All rights reserved.
Copyright (c) 2014-2014 Exa Networks. All rights reserved.
"""
from struct import unpack, pack
from exabgp.bgp.message.update.nlri.bgp import RouteDistinguisher
from exabgp.bgp.message... | # encoding: utf-8
"""
vpls.py
Created by Nikita Shirokov on 2014-06-16.
Copyright (c) 2014-2014 Nikita Shirokov. All rights reserved.
Copyright (c) 2014-2014 Exa Networks. All rights reserved.
"""
from struct import unpack, pack
from exabgp.bgp.message.update.nlri.bgp import RouteDistinguisher
from exabgp.bgp.message... | bsd-3-clause | Python |
91122afafa9fb5872f905dde391ce5b587d5d70a | Update build system requirements patch | mhbu50/frappe,ESS-LLP/frappe,tmimori/frappe,frappe/frappe,mhbu50/frappe,ESS-LLP/frappe,mbauskar/frappe,bcornwellmott/frappe,bohlian/frappe,adityahase/frappe,tmimori/frappe,paurosello/frappe,almeidapaulopt/frappe,RicardoJohann/frappe,paurosello/frappe,ESS-LLP/frappe,mhbu50/frappe,bohlian/frappe,chdecultot/frappe,frappe/... | frappe/patches/v8_0/install_new_build_system_requirements.py | frappe/patches/v8_0/install_new_build_system_requirements.py | from subprocess import Popen, call, PIPE
def execute():
# update nodejs version if brew exists
p = Popen(['which', 'brew'], stdout=PIPE, stderr=PIPE)
output, err = p.communicate()
if output:
subprocess.call(['brew', 'upgrade', 'node'])
else:
print 'Please update your NodeJS version'... | import subprocess
def execute():
subprocess.call([
'npm', 'install',
'babel-core',
'chokidar',
'babel-preset-es2015',
'babel-preset-es2016',
'babel-preset-es2017',
'babel-preset-babili'
]) | mit | Python |
ba59cfa60d7a178ff9153cf05f2b8604f1864eb7 | Add provider config template output and a little organization | natea/django-deployer,mrdakoki/ballin-avenger,mrdakoki/ballin-avenger,natea/django-deployer | django_deployer/fabfile.py | django_deployer/fabfile.py | # -*- coding: utf-8 -*-
import yaml
import os
import pkg_resources
from jinja2 import Environment, PackageLoader
from fabric.api import *
from fabric.colors import green, red, yellow
DEPLOY_YAML = os.path.join(os.getcwd(), 'deploy.yml')
template_env = Environment(loader=PackageLoader('django_deployer', 'paas_templ... | import yaml
import os
import posixpath
import pkg_resources
from fabric.api import *
from fabric.colors import green, red, yellow
from fabric.contrib.files import exists, contains, upload_template
def init():
_green("We need to ask a few questions before we can deploy your Django app")
pyversion = prompt("Wha... | mit | Python |
bd540e3a0bcc13c6c50c1d72f1982084ab5cb87e | Allow string arguments (as slugs) when saving/updating EnumFields | playfire/django-enumfield | django_enumfield/fields.py | django_enumfield/fields.py | from django.db import models
class EnumField(models.Field):
__metaclass__ = models.SubfieldBase
def __init__(self, enumeration, *args, **kwargs):
self.enumeration = enumeration
kwargs.setdefault('choices', enumeration.get_choices())
super(EnumField, self).__init__(*args, **kwargs)
... | from django.db import models
class EnumField(models.Field):
__metaclass__ = models.SubfieldBase
def __init__(self, enumeration, *args, **kwargs):
self.enumeration = enumeration
kwargs.setdefault('choices', enumeration.get_choices())
super(EnumField, self).__init__(*args, **kwargs)
... | bsd-3-clause | Python |
cc7d804db12ffea4912a65880ffe25cdd7f0545b | Use re_path in urls.py | jmichalicek/django-mail-viewer,jmichalicek/django-mail-viewer | django_mail_viewer/urls.py | django_mail_viewer/urls.py | from django.urls import re_path
from . import views
urlpatterns = [
url(
r'message/(?P<message_id>.+)/attachment/(?P<attachment>.+)/$',
views.EmailAttachmentDownloadView.as_view(),
name="mail_viewer_attachment",
),
url(r'message/(?P<message_id>.+)/delete/$', views.EmailDeleteView.a... | from django.conf.urls import url
from . import views
urlpatterns = [
url(
r'message/(?P<message_id>.+)/attachment/(?P<attachment>.+)/$',
views.EmailAttachmentDownloadView.as_view(),
name="mail_viewer_attachment",
),
url(r'message/(?P<message_id>.+)/delete/$', views.EmailDeleteView.... | mit | Python |
b73ca8983466c9cdf18686a19a359ab6cc999187 | Add a project id to error messages if it is available. | pnomolos/greatbigcrane,pnomolos/greatbigcrane | greatbigcrane/job_queue/management/commands/job_processor.py | greatbigcrane/job_queue/management/commands/job_processor.py | """
Copyright 2010 Jason Chu, Dusty Phillips, and Phil Schalm
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 agre... | """
Copyright 2010 Jason Chu, Dusty Phillips, and Phil Schalm
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 agre... | apache-2.0 | Python |
6892709a9f63424d65de6a7f9d08ca4aa01b2d41 | Update the tests to match the changes in the plugin | ProgVal/Limnoria-test,Ban3/Limnoria,haxwithaxe/supybot,ProgVal/Limnoria-test,kblin/supybot-gsoc,buildbot/supybot,jeffmahoney/supybot,mazaclub/mazabot-core,raboof/supybot,frumiousbandersnatch/supybot-code,prashantpawar/supybot-rothbot,Ban3/Limnoria,mazaclub/mazabot-core | test/test_Dict.py | test/test_Dict.py | #!/usr/bin/env python
###
# Copyright (c) 2002, Jeremiah Fincher
# 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,
# ... | #!/usr/bin/env python
###
# Copyright (c) 2002, Jeremiah Fincher
# 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,
# ... | bsd-3-clause | Python |
1472b6c0304d2d232a91c12af40f313d1a39c055 | Reformat new test and add comment header | pombredanne/pyelftools,pombredanne/pyelftools | test/test_stab.py | test/test_stab.py | #-------------------------------------------------------------------------------
# elftools tests
#
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#-------------------------------------------------------------------------------
try:
import unittest2 as unittest
except ImportError:
import... | try:
import unittest2 as unittest
except ImportError:
import unittest
import os
from utils import setup_syspath; setup_syspath()
from elftools.elf.elffile import ELFFile
from elftools.elf.sections import StabSection
class TestStab(unittest.TestCase):
def test_stab(self):
expected = [
(... | unlicense | Python |
f88e01785e2a741ae54b96a3f9e4ddbb8dcfe503 | Update P2_rememberUmbrella added check for wake time | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | books/AutomateTheBoringStuffWithPython/Chapter16/PracticeProjects/P2_rememberUmbrella.py | books/AutomateTheBoringStuffWithPython/Chapter16/PracticeProjects/P2_rememberUmbrella.py | # Use the requests module to scrape data from http://weather.gov/.
# Write a program that runs just before you wake up in the morning and checks
# whether it’s raining that day. If so, have the program text you a reminder to pack
# an umbrella before leaving the house.
import requests, bs4, datetime
from books.Automat... | # Use the requests module to scrape data from http://weather.gov/.
# Write a program that runs just before you wake up in the morning and checks
# whether it’s raining that day. If so, have the program text you a reminder to pack
# an umbrella before leaving the house.
import requests, bs4
from books.AutomateTheBoring... | mit | Python |
19cd41f03a6c9fbf0cddcefc8d36b371463347c3 | fix tests. | constanthatz/data-structures | test_priorityq.py | test_priorityq.py | from priorityq import Element
from priorityq import Priorityq
def que(queue):
que = []
current = queue.back
while current:
que.append(current.val)
current = current.ahead
return que
def test_element_init():
m = Element(3, 3)
assert m.val == 3
assert m.behind is None
a... | from priorityq import Element
from priorityq import Priorityq
def test_element_init():
m = Element(3, 3)
assert m.val == 3
assert m.behind is None
assert m.ahead is None
assert m.prio == 3
def test_prioq_init():
l = Priorityq()
assert l.front is None
assert l.back is None
def test_... | mit | Python |
0ebf03d6ca4cf30d946b5ee83323eae4095727ea | Save coverage data files | SocialNPHS/SocialNPHS | tests/__main__.py | tests/__main__.py | """
Run all tests
"""
import glob
import json
import os
import sys
import unittest
import coverage
import xmlrunner
# GLOBALS ---------------------------------------------------------------------
localdir = os.path.dirname(os.path.abspath(__file__))
inside_circle = "CIRCLECI" in os.environ
# SETUP -----------------... | """
Run all tests
"""
import glob
import json
import os
import sys
import unittest
import coverage
import xmlrunner
# GLOBALS ---------------------------------------------------------------------
localdir = os.path.dirname(os.path.abspath(__file__))
inside_circle = "CIRCLECI" in os.environ
# SETUP -----------------... | mit | Python |
f27ea2c093306aa8224f297efd506d8802015aa3 | check if py2 works at least | pytransitions/transitions,tyarkoni/transitions,pytransitions/transitions | tests/conftest.py | tests/conftest.py | import sys
import os.path
collect_ignore = []
current_dir = os.path.dirname(os.path.abspath(__file__))
if sys.version_info.major < 3:
collect_ignore.append(os.path.join(current_dir, "test_async.py"))
| import sys
import os.path
collect_ignore = []
current_dir = os.path.dirname(os.path.abspath(__file__))
if sys.version_info.major < 3 or sys.version_info.major == 3 and sys.version_info.minor < 7:
collect_ignore.append(os.path.join(current_dir, "test_async.py"))
| mit | Python |
1f90629a0ccea80ef59ca865b80edd2486d31e68 | Use debug mode in tests | jmcarp/flask-apispec,jmcarp/flask-smore,jmcarp/flask-apispec,jmcarp/flask-smore | tests/conftest.py | tests/conftest.py | # -*- coding: utf-8 -*-
import flask
import pytest
import webtest
import marshmallow as ma
class Bunch(object):
def __init__(self, **kwargs):
self.__dict__.update(**kwargs)
def items(self):
return self.__dict__.items()
@pytest.fixture
def app():
app_ = flask.Flask(__name__)
app_.d... | # -*- coding: utf-8 -*-
import flask
import pytest
import webtest
import marshmallow as ma
class Bunch(object):
def __init__(self, **kwargs):
self.__dict__.update(**kwargs)
def items(self):
return self.__dict__.items()
@pytest.fixture
def app():
return flask.Flask(__name__)
@pytest.f... | mit | Python |
e4dfb192d9984973888354ae73f2edc8486a9843 | Add () to fixture definitions | njvack/masterfile | tests/conftest.py | tests/conftest.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Part of the masterfile package: https://github.com/njvack/masterfile
# Copyright (c) 2018 Board of Regents of the University of Wisconsin System
# Written by Nate Vack <njvack@wisc.edu> at the Center for Healthy Minds
# at the University of Wisconsin-Madison.
# Released ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Part of the masterfile package: https://github.com/njvack/masterfile
# Copyright (c) 2018 Board of Regents of the University of Wisconsin System
# Written by Nate Vack <njvack@wisc.edu> at the Center for Healthy Minds
# at the University of Wisconsin-Madison.
# Released ... | mit | Python |
9812a93ffafe0175cf1b6629e55c7248208d91c5 | add required for testing fixtures | aio-libs/aiohttp_debugtoolbar,aio-libs/aiohttp-debugtoolbar,realer01/aiohttp-debugtoolbar,stormandco/aiohttp_debugtoolbar,stormandco/aiohttp_debugtoolbar,realer01/aiohttp-debugtoolbar,aio-libs/aiohttp_debugtoolbar,aio-libs/aiohttp-debugtoolbar,stormandco/aiohttp_debugtoolbar,realer01/aiohttp-debugtoolbar,aio-libs/aioht... | tests/conftest.py | tests/conftest.py | import asyncio
import socket
import sys
import pytest
import jinja2
import aiohttp_jinja2
from aiohttp import web
from aiohttp_debugtoolbar import middleware, setup
def pytest_ignore_collect(path, config):
if 'pep492' in str(path):
if sys.version_info < (3, 5, 0):
return True
@pytest.fixtur... | import sys
def pytest_ignore_collect(path, config):
if 'pep492' in str(path):
if sys.version_info < (3, 5, 0):
return True
| apache-2.0 | Python |
f6e64bfe518c7aba872c7f594eeeaf0c250e01c9 | test for connotation function | SocialNPHS/SocialNPHS | tests/language.py | tests/language.py | """
Unit tests for the portion of this project which processes raw text using
natural language processing techniques.
"""
import unittest
# Magically manipulate sys.path
from testassets import pathmagic
from SocialNPHS.language import tweet
from SocialNPHS.sources.twitter import user
class testTweetLanguage(unitte... | """
Unit tests for the portion of this project which processes raw text using
natural language processing techniques.
"""
import unittest
# Magically manipulate sys.path
from testassets import pathmagic
from SocialNPHS.language import tweet
from SocialNPHS.sources.twitter import user
class testTweetLanguage(unitte... | mit | Python |
9f7def5114aa4c065b10c69b439b3a98eddd2609 | Clean up | generalov/django-moneyfield,carlospalol/django-moneyfield | tests/runtests.py | tests/runtests.py | #!/usr/bin/env python
import os
import sys
from django.conf import settings
from django.core import management
def main():
testing_dir = os.path.abspath(os.path.dirname(__file__))
package_dir = os.path.normpath(os.path.join(testing_dir, os.pardir))
sys.path.append(testing_dir)
sys.path.append(packag... | #!/usr/bin/env python
import os
import sys
from django.conf import settings
from django.core import management
# test_settings = {
# 'DATABASES': {
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# }
# },
# 'USE_L10N': True,
# 'SECRET_KEY': "justthetestapp",
# ... | mit | Python |
1a1db8f733f57819f3be42f5a480865c4dd83f08 | Fix all warnings in tests (#295) | ottoyiu/django-cors-headers,ottoyiu/django-cors-headers | tests/settings.py | tests/settings.py | from __future__ import absolute_import
import django
from django.conf import global_settings
SECRET_KEY = 'NOTASECRET'
ALLOWED_HOSTS = ['*']
INSTALLED_APPS = [
'corsheaders',
'tests.testapp',
]
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
},
}
TEMPLATES = [
{
... | from __future__ import absolute_import
import django
from django.conf import global_settings
SECRET_KEY = 'NOTASECRET'
ALLOWED_HOSTS = ['*']
INSTALLED_APPS = [
'corsheaders',
'tests.testapp',
]
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'TEST_NAME': ':memory:',
... | mit | Python |
d1f4fd4ebef8d97e888ba0ff3abf87d08f4c12a3 | refactor tests/test_api.py | kobe25/sbcatalog,befair/sbcatalog,michelesr/sbcatalog,befair/sbcatalog,matteo88/sbcatalog,matteo88/sbcatalog,kobe25/sbcatalog,michelesr/sbcatalog,kobe25/sbcatalog,matteo88/sbcatalog,michelesr/sbcatalog,befair/sbcatalog | tests/test_api.py | tests/test_api.py | from http import client
import xmltodict, json, codecs
conn = client.HTTPConnection('localhost', 5000)
supplier_file = 'test_data.gdxp'
def assertCode(response, expected_code=200):
""" Assert that response code is the expected """
assert response.code == expected_code, 'Good response code'
def test_post_gdxp... | from http import client
import xmltodict, json, codecs
conn = client.HTTPConnection('localhost', 5000)
def assertCode(response, expected_code=200):
""" Assert that response code is the expected """
assert response.code == expected_code, 'Good response code'
def test_post_gdxp():
""" POST test for importi... | agpl-3.0 | Python |
525754d47c3554a417d141f993506eccd9c04115 | Bump version to 0.1.24 | botify-labs/python-simple-workflow,botify-labs/python-simple-workflow | swf/__init__.py | swf/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
version = (0, 1, 24)
__title__ = "python-simple-workflow"
__author__ = "Oleiade"
__license__ = "MIT"
__version__ = '.'.join(map(str, version))
| #!/usr/bin/env python
# -*- coding: utf-8 -*-
version = (0, 1, 23)
__title__ = "python-simple-workflow"
__author__ = "Oleiade"
__license__ = "MIT"
__version__ = '.'.join(map(str, version))
| mit | Python |
475368bc69699a42f5049b463d4348bd689d36b3 | Remove unused fields from OpenFlowController | FrankDuan/df_code,openstack/dragonflow,neoareslinux/dragonflow,no2key/dragonflow,neoareslinux/dragonflow,FrankDuan/df_code,openstack/dragonflow,openstack/dragonflow,FrankDuan/df_code,no2key/dragonflow | dragonflow/controller/openflow_controller.py | dragonflow/controller/openflow_controller.py | # Copyright (c) 2015 OpenStack Foundation.
# 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... | # Copyright (c) 2015 OpenStack Foundation.
# 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... | apache-2.0 | Python |
914cf5ff87e7e7b3a668273c1d9d6c2eb05edfb5 | add 4.8.2 (#27690) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-importlib-metadata/package.py | var/spack/repos/builtin/packages/py-importlib-metadata/package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyImportlibMetadata(PythonPackage):
"""Read metadata from Python packages."""
homepag... | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyImportlibMetadata(PythonPackage):
"""Read metadata from Python packages."""
homepag... | lgpl-2.1 | Python |
f829ed54e4eddce15b9da01d0d669a4242c86360 | Fix tests for Python 2.7 | Suor/django-pickling | tests/test_db.py | tests/test_db.py | import pytest
try:
import cPickle as pickle
except ImportError:
import pickle
from .models import Post
pytestmark = pytest.mark.django_db
@pytest.mark.django_db
@pytest.fixture
def post():
return Post.objects.create(title='Pickling')
def test_equal(post):
restored = pickle.loads(pickle.dumps(post... | import pytest
try:
import cPickle as pickle
except ImportError:
import pickle
from .models import Post
pytestmark = pytest.mark.django_db
@pytest.mark.django_db
@pytest.fixture
def post():
return Post.objects.create(title='Pickling')
def test_equal(post):
restored = pickle.loads(pickle.dumps(post... | bsd-3-clause | Python |
25cf16fc1caaaddf53b017812dd255f64442f77d | Add keys to ModuleDict | eywalker/attorch,fabiansinz/attorch,atlab/attorch | attorch/module.py | attorch/module.py | from collections import OrderedDict
from torch import nn
class ModuleDict(nn.Module):
def __init__(self, modules=None):
super().__init__()
if modules is not None:
for k, v in modules.items():
if k not in self._modules:
self.add_module(str(k), v)
... | from collections import OrderedDict
from torch import nn
class ModuleDict(nn.Module):
def __init__(self, modules=None):
super().__init__()
if modules is not None:
for k, v in modules.items():
if k not in self._modules:
self.add_module(str(k), v)
... | mit | Python |
6aec0b8cff155e9822ce8c4ce062ef99c495e0be | change log format | chenfengyuan/mcurl,chenfengyuan/mcurl | python3/mcurl/utils/logger.py | python3/mcurl/utils/logger.py | # coding=utf-8
import logging
import logging.handlers
logger = logging.getLogger('mcurl')
handler = logging.StreamHandler()
handler.setLevel(logging.DEBUG)
fmt = logging.Formatter(fmt='%(asctime)s %(levelname)s[%(process)d][%(filename)s:%(lineno)d]%(message)s')
handler.setFormatter(fmt)
logger.addHandler(handler)
logge... | # coding=utf-8
import logging
import logging.handlers
logger = logging.getLogger('mcurl')
handler = logging.StreamHandler()
handler.setLevel(logging.DEBUG)
fmt = logging.Formatter(fmt='%(levelname)s[%(process)d][%(filename)s:%(lineno)d]%(message)s')
handler.setFormatter(fmt)
logger.addHandler(handler)
logger.propagate ... | mit | Python |
aba661dccae7ef43bdb43d9909b9e84b632bb7a4 | Rename paths variable to fnames. | ohsu-qin/qipipe | qipipe/helpers/file_helper.py | qipipe/helpers/file_helper.py | import os
class FileIterator(object):
"""
This FileIterator iterates over the paths contained in one or more directories.
"""
def __init__(self, *paths):
"""
@param paths: the file or directory paths.
"""
self._paths = paths
def __iter__(self):
return se... | import os
class FileIterator(object):
"""
This FileIterator iterates over the paths contained in one or more directories.
"""
def __init__(self, *paths):
"""
@param paths: the file or directory paths.
"""
self._paths = paths
def __iter__(self):
return se... | bsd-2-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.