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
334a55bf7fd31ed5937744a437e42eee597bd7e1
Bump version 0.17.0rc14 --> 0.17.0rc15
lbryio/lbry,lbryio/lbry,lbryio/lbry
lbrynet/__init__.py
lbrynet/__init__.py
import logging __version__ = "0.17.0rc15" version = tuple(__version__.split('.')) logging.getLogger(__name__).addHandler(logging.NullHandler())
import logging __version__ = "0.17.0rc14" version = tuple(__version__.split('.')) logging.getLogger(__name__).addHandler(logging.NullHandler())
mit
Python
f37ca31fd2a0c14b01d4329cbcaa4dae954e3965
Simplify test case
mwilliamson/funk
test/funk/test_tools.py
test/funk/test_tools.py
from nose.tools import assert_raises from funk.tools import assert_raises_str from funk.tools import assert_that from funk.matchers import Matcher def test_assert_raises_str_passes_if_test_raises_specified_exception_with_correct_message(): def func(): raise AssertionError("Oh noes!") assert_raises_str...
from nose.tools import assert_raises from funk.tools import assert_raises_str from funk.tools import assert_that from funk.matchers import Matcher def test_assert_raises_str_passes_if_test_raises_specified_exception_with_correct_message(): def func(): raise AssertionError("Oh noes!") assert_raises_str...
bsd-2-clause
Python
986398ee03d77b81129cfcdef475a53680812207
Add boolean operators and boolean expr testing
admk/soap
soap/expr/common.py
soap/expr/common.py
""" .. module:: soap.expr.common :synopsis: Common definitions for expressions. """ ADD_OP = '+' SUBTRACT_OP = '-' UNARY_SUBTRACT_OP = '-' MULTIPLY_OP = '*' DIVIDE_OP = '/' EQUAL_OP = '==' GREATER_OP = '>' LESS_OP = '<' UNARY_NEGATION_OP = '!' AND_OP = '&' OR_OP = '|' BARRIER_OP = '#' OPERATORS = [ADD_OP, MULTIP...
""" .. module:: soap.expr.common :synopsis: Common definitions for expressions. """ ADD_OP = '+' SUBTRACT_OP = '-' UNARY_SUBTRACT_OP = '-' MULTIPLY_OP = '*' DIVIDE_OP = '/' BARRIER_OP = '|' OPERATORS = [ADD_OP, MULTIPLY_OP] UNARY_OPERATORS = [UNARY_SUBTRACT_OP] ASSOCIATIVITY_OPERATORS = [ADD_OP, MULTIPLY_OP] COM...
mit
Python
d03b385b5d23c321ee1d4bd2020be1452e8c1cab
Remove Python 2.4 support monkey patch and bump rev
reddec/pika,skftn/pika,Tarsbot/pika,shinji-s/pika,jstnlef/pika,zixiliuyue/pika,fkarb/pika-python3,renshawbay/pika-python3,vrtsystems/pika,Zephor5/pika,pika/pika,vitaly-krugl/pika,knowsis/pika,hugoxia/pika,benjamin9999/pika
pika/__init__.py
pika/__init__.py
# ***** BEGIN LICENSE BLOCK ***** # # For copyright and licensing please refer to COPYING. # # ***** END LICENSE BLOCK ***** __version__ = '0.9.13p2' from pika.connection import ConnectionParameters from pika.connection import URLParameters from pika.credentials import PlainCredentials from pika.spec import BasicPrope...
# ***** BEGIN LICENSE BLOCK ***** # # For copyright and licensing please refer to COPYING. # # ***** END LICENSE BLOCK ***** __version__ = '0.9.13p1' from pika.connection import ConnectionParameters from pika.connection import URLParameters from pika.credentials import PlainCredentials from pika.spec import BasicPrope...
bsd-3-clause
Python
b2f0670e1859368f0efb7b3cc485a41b1e9cb14a
Update tarot.py
rmmh/skybot,parkrrr/skybot,jmgao/skybot
plugins/tarot.py
plugins/tarot.py
""" 🔮 Spooky fortunes and assistance for witches """ from util import hook, http @hook.command def tarot(inp): ".tarot <cardname> -- finds a card by name" try: card = http.get_json( "https://tarot-api.com/find/" + inp ) except http.HTTPError: return "the spirits are di...
""" 🔮 Spooky fortunes and assistance for witches """ from util import hook, http @hook.command def tarot(inp): ".tarot <cardname> -- finds a card by name" try: card = http.get_json( "https://tarot-api.com/find/{search}".format( search=inp ) ) except...
unlicense
Python
ff4239ecd4c46a59c819a15c11d87f5deca71ad6
use python_2_unicode_compatible for model str
appsembler/django-souvenirs
souvenirs/models.py
souvenirs/models.py
from __future__ import absolute_import, unicode_literals from django.conf import settings from django.db import models from django.utils import timezone from django.utils.encoding import python_2_unicode_compatible @python_2_unicode_compatible class Souvenir(models.Model): """ One instance of seeing an activ...
from __future__ import absolute_import, unicode_literals from django.conf import settings from django.db import models from django.utils import timezone class Souvenir(models.Model): """ One instance of seeing an active user """ user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASC...
mit
Python
70fd93901be2a7d6662525fcd5b3914c2ffbc7d4
add open_file into tests run through old runner
ocefpaf/OWSLib,jachym/OWSLib,menegon/OWSLib,mbertrand/OWSLib,bird-house/OWSLib,daf/OWSLib,datagovuk/OWSLib,datagovuk/OWSLib,Jenselme/OWSLib,jaygoldfinch/OWSLib,kalxas/OWSLib,kwilcox/OWSLib,JuergenWeichand/OWSLib,geographika/OWSLib,tomkralidis/OWSLib,geopython/OWSLib,robmcmullen/OWSLib,daf/OWSLib,gfusca/OWSLib,dblodgett...
tests/runalldoctests.py
tests/runalldoctests.py
import doctest import getopt import glob import sys try: import pkg_resources pkg_resources.require('OWSLib') except (ImportError, pkg_resources.DistributionNotFound): pass def open_file(filename, mode='r'): """Helper function to open files from within the tests package.""" import os return op...
import doctest import getopt import glob import sys try: import pkg_resources pkg_resources.require('OWSLib') except (ImportError, pkg_resources.DistributionNotFound): pass def run(pattern): if pattern is None: testfiles = glob.glob('*.txt') else: testfiles = glob.glob(pattern) ...
bsd-3-clause
Python
c3f7ae17289c38fcdfad45c0b71f553f8004c0fd
Update list test.
m110/grafcli,m110/grafcli
tests/test_resources.py
tests/test_resources.py
#!/usr/bin/python3 import os import sys import unittest from unittest.mock import patch LIB_PATH = os.path.dirname(os.path.realpath(__file__)) + '/../' CONFIG_PATH = os.path.join(LIB_PATH, 'grafcli.conf.example') sys.path.append(LIB_PATH) from climb.config import load_config_file load_config_file(CONFIG_PATH) from ...
#!/usr/bin/python3 import os import sys import unittest from unittest.mock import patch LIB_PATH = os.path.dirname(os.path.realpath(__file__)) + '/../' CONFIG_PATH = os.path.join(LIB_PATH, 'grafcli.conf.example') sys.path.append(LIB_PATH) from climb.config import load_config_file load_config_file(CONFIG_PATH) from ...
mit
Python
3b36ae57d7521fa6d19174d75fbea5567955f253
Bump version
toxinu/pyhn,socketubs/pyhn
pyhn/__init__.py
pyhn/__init__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- __title__ = 'pyhn' __version__ = '0.2.1' __author__ = 'Geoffrey Lehée' __license__ = 'AGPL3' __copyright__ = 'Copyright 2013 Geoffrey Lehée'
#!/usr/bin/env python # -*- coding: utf-8 -*- __title__ = 'pyhn' __version__ = '0.2.0' __author__ = 'Geoffrey Lehée' __license__ = 'AGPL3' __copyright__ = 'Copyright 2013 Geoffrey Lehée'
mit
Python
c22638085d2b4ad0efc6c1bf03b1732604b2b039
Fix rank2.
drtconway/pykmer
pykmer/sparse.py
pykmer/sparse.py
import array class sparse: def __init__(self, B, xs): self.B = B self.S = B - 10 self.xs = xs self.toc = array.array('I', [0 for i in xrange(1024+1)]) for x in xs: v = x >> self.S self.toc[v+1] += 1 t = 0 for i in xrange(1024+1): ...
import array class sparse: def __init__(self, B, xs): self.B = B self.S = B - 10 self.xs = xs self.toc = array.array('I', [0 for i in xrange(1024+1)]) for x in xs: v = x >> self.S self.toc[v+1] += 1 t = 0 for i in xrange(1024+1): ...
apache-2.0
Python
cd6eaa0ee2f04c8d83a2c004f9f414288723bf20
Disable useless-object-inheritance error
googleapis/google-auth-library-python-oauthlib,googleapis/google-auth-library-python-oauthlib
pylint.config.py
pylint.config.py
# Copyright 2016 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
# Copyright 2016 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
apache-2.0
Python
336ab517038c680a19bdef697d4be77530f75432
Update Transfer per 2020-04-30 changes
cloudtools/troposphere,cloudtools/troposphere
troposphere/transfer.py
troposphere/transfer.py
# Copyright (c) 2012-2019, Mark Peek <mark@peek.org> # All rights reserved. # # See LICENSE file for full license. # # *** Do not modify - this file is autogenerated *** # Resource specification version: 3.3.0 from . import AWSObject from . import AWSProperty from troposphere import Tags VALID_HOMEDIRECTORY_TYPE = ...
# Copyright (c) 2012-2019, Mark Peek <mark@peek.org> # All rights reserved. # # See LICENSE file for full license. # # *** Do not modify - this file is autogenerated *** # Resource specification version: 3.3.0 from . import AWSObject from . import AWSProperty from troposphere import Tags VALID_HOMEDIRECTORY_TYPE = ...
bsd-2-clause
Python
92158d172f634437a91d26c9cfe2bc4986cc85cf
exclude node
manojklm/pytest-filter
pytest_filter.py
pytest_filter.py
# -*- coding: utf-8 -*- """ pytest-filter ************* """ from __future__ import print_function import os import sys import time from path import Path import pytest import configparser def pytest_addoption(parser): parser.addini('filter_file', 'Location of filter file') @pytest.mark.trylast def pytest_conf...
# -*- coding: utf-8 -*- """ pytest-filter ************* """ from __future__ import print_function import os import sys import time from path import Path import pytest import configparser def pytest_addoption(parser): parser.addini('filter_file', 'Location of filter file') @pytest.mark.trylast def pytest_conf...
mit
Python
e0836e052aad7f58d958459cfbcbff87826f0e45
add xml_reflection to the install rule
keulYSMB/urdfdom,shadow-robot/urdfdom,robotology-dependencies/urdfdom,keulYSMB/urdfdom,keulYSMB/urdfdom,robotology-dependencies/urdfdom,robotology-dependencies/urdfdom,shadow-robot/urdfdom,robotology-dependencies/urdfdom,shadow-robot/urdfdom,keulYSMB/urdfdom,shadow-robot/urdfdom
urdf_parser_py/setup.py
urdf_parser_py/setup.py
#!/usr/bin/env python from distutils.core import setup d = {'author': u'Thomas Moulard <thomas.moulard@gmail.com>, David Lu <davidlu@wustl.edu>, Kelsey Hawkins <kphawkins@gmail.com>, Antonio El Khoury <aelkhour@laas.fr>, Eric Cousineau <eacousineau@gmail.com>', 'description': 'The urdf_parser_py package contains a P...
#!/usr/bin/env python from distutils.core import setup d = {'author': u'Thomas Moulard <thomas.moulard@gmail.com>, David Lu <davidlu@wustl.edu>, Kelsey Hawkins <kphawkins@gmail.com>, Antonio El Khoury <aelkhour@laas.fr>, Eric Cousineau <eacousineau@gmail.com>', 'description': 'The urdf_parser_py package contains a P...
bsd-3-clause
Python
b34991a2713ea321cbb9ab97aaa482c8002d1549
change from string module to string methods
scipy/scipy-svn,scipy/scipy-svn,lesserwhirls/scipy-cwt,lesserwhirls/scipy-cwt,jasonmccampbell/scipy-refactor,scipy/scipy-svn,jasonmccampbell/scipy-refactor,lesserwhirls/scipy-cwt,jasonmccampbell/scipy-refactor,jasonmccampbell/scipy-refactor,scipy/scipy-svn,lesserwhirls/scipy-cwt
Lib/io/data_store.py
Lib/io/data_store.py
""" Load or save values to a file. Shelves work well for storing data, but they are slow to access repeatedly - especially for large data sets. This module allows you to store data to a file and then load it back into the workspace. When the data is stored, a python module is also created as the ...
""" Load or save values to a file. Shelves work well for storing data, but they are slow to access repeatedly - especially for large data sets. This module allows you to store data to a file and then load it back into the workspace. When the data is stored, a python module is also created as the ...
bsd-3-clause
Python
c0f7dd3445455e9cb51b84944c54ad6f4d45a5dc
Update filtereval_caner.py
sbg/Mitty,sbg/Mitty
mitty/benchmarking/filtereval_caner.py
mitty/benchmarking/filtereval_caner.py
"""Needed a way to go through the evaluation VCF from VCF benchmarking and spit out the FP and FN calls into separate VCFs and then extract reads from those regions into a BAM. vcffilter can mark the FP and FNs but leaves all the other records in. Would need to chain with vcftools and at this point things are complica...
"""Needed a way to go through the evaluation VCF from VCF benchmarking and spit out the FP and FN calls into separate VCFs and then extract reads from those regions into a BAM. vcffilter can mark the FP and FNs but leaves all the other records in. Would need to chain with vcftools and at this point things are complica...
apache-2.0
Python
1382fd8afecdeca9bb1b6961a636b6502c16ad6e
Enumerate much more elegant to loop through list elements and regex each.
smehan/App-data-reqs,smehan/App-data-reqs
log-preprocessor.py
log-preprocessor.py
__author__ = 'shawnmehan' import csv, os, re # # first lets open the file, which is tab delimited because of , in description field and others with open('./data/AppDataRequest2010-2015.tsv', 'rb') as csvfile: testfile = open("./data/test.tsv", "wb") #TODO get proper line endings, not ^M records = csv.reader(...
__author__ = 'shawnmehan' import csv, os, re # # first lets open the file, which is tab delimited because of , in description field and others with open('./data/AppDataRequest2010-2015.tsv', 'rb') as csvfile: testfile = open("./data/test.tsv", "wb") #TODO get proper line endings, not ^M records = csv.reader(...
apache-2.0
Python
af1fb4138c548f56cf27d734d106b889236c08e6
Fix follow/unfollow signal weakref
grouan/udata,davidbgk/udata,opendatateam/udata,etalab/udata,etalab/udata,davidbgk/udata,jphnoel/udata,etalab/udata,davidbgk/udata,grouan/udata,grouan/udata,jphnoel/udata,opendatateam/udata,opendatateam/udata,jphnoel/udata
udata/core/followers/metrics.py
udata/core/followers/metrics.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from udata.core.metrics import Metric, MetricMetaClass from udata.i18n import lazy_gettext as _ from udata.models import Follow from .signals import on_follow, on_unfollow __all__ = ('FollowersMetric', ) class FollowersMetricMetaclass(MetricMetaClass)...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from udata.core.metrics import Metric, MetricMetaClass from udata.i18n import lazy_gettext as _ from udata.models import Follow from .signals import on_follow, on_unfollow __all__ = ('FollowersMetric', ) class FollowersMetricMetaclass(MetricMetaClass)...
agpl-3.0
Python
fcbb0a4e6e1edba568783fade40061b5682affbd
Add test permissions bypass and change structure
makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin
geotrek/common/tests/__init__.py
geotrek/common/tests/__init__.py
# -*- encoding: utf-8 -*- from django.contrib.auth.models import Permission from django.utils import translation from django.utils.translation import ugettext as _ # Workaround https://code.djangoproject.com/ticket/22865 from geotrek.common.models import FileType # NOQA from mapentity.tests import MapEntityTest fr...
# -*- encoding: utf-8 -*- from django.utils import translation from django.utils.translation import ugettext as _ # Workaround https://code.djangoproject.com/ticket/22865 from geotrek.common.models import FileType # NOQA from mapentity.tests import MapEntityTest from geotrek.authent.factories import StructureFacto...
bsd-2-clause
Python
5fef2befafa70e4a8a393f0479cbdf8648f5db78
Convert Breadcrumbs to Titlecase, closes #48
kaozente/MusicMashup,kaozente/MusicMashup,kaozente/MusicMashup
MusicMashupServer.py
MusicMashupServer.py
# server shizzle import cherrypy import os # eigentliche arbeit macht die artist klasse from MusicMashupArtist import MusicMashupArtist # template gedoens from mako.template import Template from mako.lookup import TemplateLookup from titlecase import titlecase # fuer history generation from urllib import quote_plus ...
# server shizzle import cherrypy import os # eigentliche arbeit macht die artist klasse from MusicMashupArtist import MusicMashupArtist # template gedoens from mako.template import Template from mako.lookup import TemplateLookup # fuer history generation from urllib import quote_plus class MusicMashupServer(object)...
mit
Python
d6c5b9a19921ce2c1e3f2e30d6ce0468a5305e80
Test with Flask-Testing to test POST request
terryjbates/test-driven-development-with-python,terryjbates/test-driven-development-with-python,terryjbates/test-driven-development-with-python,terryjbates/test-driven-development-with-python,terryjbates/test-driven-development-with-python
myflaskapp/tests/test_flask_testing.py
myflaskapp/tests/test_flask_testing.py
from flask import Flask from flask_testing import LiveServerTestCase from myflaskapp.app import create_app from myflaskapp.settings import DevConfig, ProdConfig import requests import datetime as dt import pytest from myflaskapp.user.models import Role, User from myflaskapp.item.models import Item from .factories impor...
from flask import Flask from flask_testing import LiveServerTestCase from myflaskapp.app import create_app from myflaskapp.settings import DevConfig, ProdConfig import requests class MyTest(LiveServerTestCase): def create_app(self): app = create_app(DevConfig) app.config['TESTING'] = True ...
mit
Python
bf2b6036a93db9314a1b0facf1865d74204a7c85
add klarinetta/chaunter/suzu to character list
incnone/necrobot
necrobot/util/necrodancer/character.py
necrobot/util/necrodancer/character.py
from enum import Enum class NDChar(Enum): Cadence = 0 Melody = 1 Aria = 2 Dorian = 3 Eli = 4 Monk = 5 Dove = 6 Coda = 7 Bolt = 8 Bard = 9 Story = 10 All = 11 Nocturna = 12 Diamond = 13 Multichar = 14 Tempo = 15 Mary = 16 Reaper = 17 Klarine...
from enum import Enum class NDChar(Enum): Cadence = 0 Melody = 1 Aria = 2 Dorian = 3 Eli = 4 Monk = 5 Dove = 6 Coda = 7 Bolt = 8 Bard = 9 Story = 10 All = 11 Nocturna = 12 Diamond = 13 Multichar = 14 Tempo = 15 Mary = 16 Reaper = 17 Coh = 101...
mit
Python
cd931bccbcad189b01673e4aed8b5cf26d9e5324
Update the version number
copasi/condor-copasi,Nucleoos/condor-copasi,Nucleoos/condor-copasi,copasi/condor-copasi
web_frontend/version.py
web_frontend/version.py
version = '0.3.0 beta'
version = '0.2.1 beta'
artistic-2.0
Python
3d805e8aac81df0c0c35cfc4ddc37489225b6464
add conn close to example file
openego/dingo,openego/dingo
examples/example_single_grid_district.py
examples/example_single_grid_district.py
#!/usr/bin/env python3 """This is a simple example file for DINGO. __copyright__ = "Reiner Lemoine Institut, openego development group" __license__ = "GNU GPLv3" __author__ = "Jonathan Amme, Guido Pleßmann" """ # ===== IMPORTS AND CONFIGURATION ===== # import DB interface from oemof import oemof.db as db # import ...
#!/usr/bin/env python3 """This is a simple example file for DINGO. __copyright__ = "Reiner Lemoine Institut, openego development group" __license__ = "GNU GPLv3" __author__ = "Jonathan Amme, Guido Pleßmann" """ # ===== IMPORTS AND CONFIGURATION ===== # import DB interface from oemof import oemof.db as db # import ...
agpl-3.0
Python
da8618b931ef3a845b77610ab84144687f0d1076
Update name of filepath
dave-lab41/pelops,Lab41/pelops,Lab41/pelops,d-grossman/pelops,dave-lab41/pelops,d-grossman/pelops
pelops/etl/extract_feats_from_chips.py
pelops/etl/extract_feats_from_chips.py
import numpy as np from keras.applications.resnet50 import ResNet50 from keras.preprocessing import image from keras.applications.resnet50 import preprocess_input from keras.models import Model def load_image(img_path, resizex=224, resizey=224): data = image.load_img(img_path, target_size=(resizex, resizey)) ...
import numpy as np from keras.applications.resnet50 import ResNet50 from keras.preprocessing import image from keras.applications.resnet50 import preprocess_input from keras.models import Model def load_image(img_path, resizex=224, resizey=224): data = image.load_img(img_path, target_size=(resizex, resizey)) ...
apache-2.0
Python
3e4edb97ac94b75c7e3a52a6e055b76ad1fbf894
Make template tag tests use mock model classes
wylee/django-perms,PSU-OIT-ARC/django-perms
permissions/tests/test_templatetags.py
permissions/tests/test_templatetags.py
from django.test import TestCase from django.template import Context, Template from permissions import PermissionsRegistry from .base import Model, User def can_do(user): return 'can_do' in user.permissions def can_do_with_model(user, instance): return 'can_do_with_model' in user.permissions class Test...
from django.test import TestCase from django.template import Context, Template from permissions import PermissionsRegistry class Model: pass def can_do(user): return user is not None def can_do_with_model(user, instance): return None not in (user, instance) class TestTemplateTags(TestCase): ...
mit
Python
cd34f60c6018241770b5d5dc1ae6833a28b0db36
Make VersionUpgrade a class
onitake/Uranium,onitake/Uranium
UM/VersionUpgrade.py
UM/VersionUpgrade.py
# Copyright (c) 2015 Ultimaker B.V. # Cura is released under the terms of the AGPLv3 or higher. from UM.Logger import Logger from UM.PluginObject import PluginObject ## A type of plug-in that upgrades the configuration from an old file format to # a newer one. # # Each version upgrade plug-in can convert machine...
# Copyright (c) 2015 Ultimaker B.V. # Cura is released under the terms of the AGPLv3 or higher. from UM.Logger import Logger from UM.PluginObject import PluginObject ## A type of plug-in that upgrades the configuration from an old file format to # a newer one. # # Each version upgrade plug-in can convert machine...
agpl-3.0
Python
d4e4fbe945339f650294fa986834c023265164df
add views config to default config in proto
aacanakin/glim
glim/proto/project/app/config/default.py
glim/proto/project/app/config/default.py
facades = [ # bunch of services to be loaded up when web server starts ] extensions = [ # bunch of extensions to be loaded up when web server starts # 'gredis' ] config = { 'extensions' : { # 'gredis' : { # 'default' : { # 'host' : 'localhost', # 'port' : '1234', # 'db' : 0 # } # } }, ...
facades = [ # bunch of services to be loaded up when web server starts ] extensions = [ # bunch of extensions to be loaded up when web server starts # 'gredis' ] config = { 'extensions' : { # 'gredis' : { # 'default' : { # 'host' : 'localhost', # 'port' : '1234', # 'db' : 0 # } # } }, ...
mit
Python
94189ae76707942cb73be6517466768847e22a3c
solve string2
haozai309/hello_python
google-python-exercises/basic/string2.py
google-python-exercises/basic/string2.py
#!/usr/bin/python2.4 -tt # Copyright 2010 Google Inc. # Licensed under the Apache License, Version 2.0 # http://www.apache.org/licenses/LICENSE-2.0 # Google's Python Class # http://code.google.com/edu/languages/google-python-class/ # Additional basic string exercises # D. verbing # Given a string, if its length is a...
#!/usr/bin/python2.4 -tt # Copyright 2010 Google Inc. # Licensed under the Apache License, Version 2.0 # http://www.apache.org/licenses/LICENSE-2.0 # Google's Python Class # http://code.google.com/edu/languages/google-python-class/ # Additional basic string exercises # D. verbing # Given a string, if its length is a...
apache-2.0
Python
f28c46cdab80ff72859007939874bae90b56f03c
Remove unused
svenvandescheur/svenv.nl-app,svenvandescheur/svenv.nl-app,svenvandescheur/svenv.nl-app,svenvandescheur/svenv.nl-app
svenv/blog/views.py
svenv/blog/views.py
from django.views import generic from blog.models import Blog class IndexView(generic.ListView): template_name = 'blog/index.html' context_object_name = 'blog_list' def get_queryset(self): return Blog.objects.order_by('date').reverse()
from django.shortcuts import render from django.views import generic from blog.models import Blog class IndexView(generic.ListView): template_name = 'blog/index.html' context_object_name = 'blog_list' def get_queryset(self): return Blog.objects.order_by('date').reverse()
mit
Python
0546126cc5fb1a138c96481061084e9e5fc86e34
Bump version
matrix-org/synapse,illicitonion/synapse,howethomas/synapse,matrix-org/synapse,howethomas/synapse,matrix-org/synapse,iot-factory/synapse,TribeMedia/synapse,rzr/synapse,matrix-org/synapse,illicitonion/synapse,howethomas/synapse,rzr/synapse,illicitonion/synapse,howethomas/synapse,iot-factory/synapse,iot-factory/synapse,rz...
synapse/__init__.py
synapse/__init__.py
# -*- coding: utf-8 -*- # Copyright 2014, 2015 OpenMarket Ltd # # 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...
# -*- coding: utf-8 -*- # Copyright 2014, 2015 OpenMarket Ltd # # 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
6edec8cba26259d0e05bfceb34329e28d9960b03
bump version
billyshambrook/taskman
taskman/__init__.py
taskman/__init__.py
__version__ = '0.0.3'
__version__ = '0.0.2'
bsd-2-clause
Python
8a7e81bd4725282a907532dd7419a44a0614c08b
Use referrers not path's on the top referrers list
gnublade/django-request,kylef/django-request,gnublade/django-request,kylef/django-request,kylef/django-request,gnublade/django-request
request/views.py
request/views.py
from datetime import datetime, timedelta, date from django.shortcuts import render_to_response from django.template import RequestContext from django.db.models import Count from django.utils.translation import ugettext_lazy as _ from django.utils import simplejson, importlib from request.models import Request from re...
from datetime import datetime, timedelta, date from django.shortcuts import render_to_response from django.template import RequestContext from django.db.models import Count from django.utils.translation import ugettext_lazy as _ from django.utils import simplejson, importlib from request.models import Request from re...
bsd-2-clause
Python
7e25fea1c00c298355fbc58528d307816d01c261
Update example2.py
progress/WhyABL,progress/WhyABL,progress/WhyABL
TempTables/example2.py
TempTables/example2.py
# Why ABL Example # Authors: Bill Wood, Alan Estrada # File Name: BasicQuery/example2.py import MySQLdb as mdb class TempTable: customerNumber = 0 email = 0 with open('input.txt', 'r') as f: lines = f.readlines() temptable = [] for line in lines: words = line.split() tt = TempTable() ...
import MySQLdb as mdb class TempTable: customerNumber = 0 salesRep = 0 with open('input.txt', 'r') as f: lines = f.readlines() temptable = [] for line in lines: words = line.split() tt = TempTable() tt.customerNumber = int(words[0]) tt.salesRep = int(words[1]) temptable.append...
apache-2.0
Python
a1ec0d3eb543ab704a4a4db237571ae849548a05
add model: PartnerReview
unicef/un-partner-portal,unicef/un-partner-portal,unicef/un-partner-portal,unicef/un-partner-portal
backend/unpp_api/apps/partner/models.py
backend/unpp_api/apps/partner/models.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models from model_utils.models import TimeStampedModel class Partner(TimeStampedModel): """ """ legal_name = models.CharField(max_length=255) # display_type = International, national hq = models.ForeignKey('sel...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models from model_utils.models import TimeStampedModel class Partner(TimeStampedModel): """ """ legal_name = models.CharField(max_length=255) # display_type = International, national hq = models.ForeignKey('sel...
apache-2.0
Python
0299ca81aa017b97301b7050fa9acf78ef1f11cb
Use refabric's format_socket, fix socket mkdir
Sportamore/blues,5monkeys/blues,5monkeys/blues,5monkeys/blues,Sportamore/blues,Sportamore/blues
blues/application/providers/gunicorn.py
blues/application/providers/gunicorn.py
import os from refabric.context_managers import sudo from refabric.utils import info from refabric.utils.socket import format_socket from ..project import sudo_project, virtualenv_path from ... import debian, python, virtualenv from ...app import blueprint from .base import ManagedProvider class GunicornProvider(...
import os from urlparse import urlparse from blues import python, virtualenv from blues.application.project import sudo_project, project_home, \ virtualenv_path from refabric.context_managers import sudo from ... import debian from ...app import blueprint from .base import ManagedProvider from refabric.utils impo...
mit
Python
426b2cb5487e4dfcd3d92d4f520ac6db51e82dbf
Allow to render a snippet from a non-site scope as partial
homeworkprod/byceps,m-ober/byceps,homeworkprod/byceps,m-ober/byceps,homeworkprod/byceps,m-ober/byceps
byceps/blueprints/snippet/templating.py
byceps/blueprints/snippet/templating.py
""" byceps.blueprints.snippet.templating ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :Copyright: 2006-2019 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ import sys import traceback from flask import abort, g, render_template, url_for from jinja2 import TemplateNotFound from ...services.snippet ...
""" byceps.blueprints.snippet.templating ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :Copyright: 2006-2019 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ import sys import traceback from flask import abort, g, render_template, url_for from jinja2 import TemplateNotFound from ...services.snippet ...
bsd-3-clause
Python
661c59cf46281540c4aac9616267a350401fae81
Use subprocess.SubprocessError
yashtrivedi96/coala,Nosferatul/coala,ManjiriBirajdar/coala,Nosferatul/coala,netman92/coala,impmihai/coala,nemaniarjun/coala,yland/coala,Shade5/coala,NalinG/coala,NalinG/coala,tltuan/coala,NiklasMM/coala,jayvdb/coala,netman92/coala,vinc456/coala,Asalle/coala,arjunsinghy96/coala,JohnS-01/coala,RJ722/coala,coala-analyzer/...
coalib/output/printers/EspeakPrinter.py
coalib/output/printers/EspeakPrinter.py
import subprocess from pyprint.ClosableObject import ClosableObject from pyprint.Printer import Printer from coalib.misc import Constants class EspeakPrinter(Printer, ClosableObject): def __init__(self): """ Raises EnvironmentError if VoiceOutput is impossible. """ Printer.__ini...
import subprocess from pyprint.ClosableObject import ClosableObject from pyprint.Printer import Printer from coalib.misc import Constants class EspeakPrinter(Printer, ClosableObject): def __init__(self): """ Raises EnvironmentError if VoiceOutput is impossible. """ Printer.__ini...
agpl-3.0
Python
9b894c2ea76c1a73eb5b313eed6b90aa192c23a1
add explicit force endpoint for item refresh
pannal/Subliminal.bundle,pannal/Subliminal.bundle,pannal/Subliminal.bundle
Contents/Code/interface/refresh_item.py
Contents/Code/interface/refresh_item.py
# coding=utf-8 from subzero.constants import PREFIX from menu_helpers import debounce, set_refresh_menu_state, route from support.items import refresh_item from support.helpers import timestamp @route(PREFIX + '/item/refresh/{rating_key}/force', force=True) @route(PREFIX + '/item/refresh/{rating_key}') @debounce def...
# coding=utf-8 from subzero.constants import PREFIX from menu_helpers import debounce, set_refresh_menu_state, route from support.items import refresh_item from support.helpers import timestamp @route(PREFIX + '/item/refresh/{rating_key}') @debounce def RefreshItem(rating_key=None, came_from="/recent", item_title=No...
mit
Python
40e56acb10da06aa83a6f9f5eee7dcd314a2102c
update pacbio tests
sequana/sequana,sequana/sequana,sequana/sequana,sequana/sequana,sequana/sequana
test/test_pacbio.py
test/test_pacbio.py
from sequana.pacbio import BAMPacbio from sequana import sequana_data from easydev import TempFile def test_pacbio(): b = BAMPacbio(sequana_data("test_pacbio_subreads.bam")) assert len(b) == 130 b.df assert b.nb_pass[1] == 130 with TempFile() as fh: b.filter_length(fh.name, threshold_min=...
from sequana.pacbio import BAMPacbio from sequana import sequana_data from easydev import TempFile def test_pacbio(): b = BAMPacbio(sequana_data("test_pacbio_subreads.bam")) assert len(b) == 130 b.df assert b.nb_pass[1] == 130 with TempFile() as fh: b.filter_length(fh.name, threshold_min=...
bsd-3-clause
Python
0842789d7d0aeff396f98e83967c9aaabf2f6a4e
Fix fixture in test_margin()
ramnes/qtile,ramnes/qtile,qtile/qtile,qtile/qtile
test/test_window.py
test/test_window.py
import pytest from test.conftest import BareConfig bare_config = pytest.mark.parametrize("manager", [BareConfig], indirect=True) @bare_config def test_margin(manager): manager.test_window('one') # No margin manager.c.window.place(10, 20, 50, 60, 0, '000000') assert manager.c.window.info()['x'] == 1...
import pytest from test.conftest import BareConfig bare_config = pytest.mark.parametrize("qtile", [BareConfig], indirect=True) @bare_config def test_margin(qtile): qtile.test_window('one') # No margin qtile.c.window.place(10, 20, 50, 60, 0, '000000') assert qtile.c.window.info()['x'] == 10 asse...
mit
Python
cea891a2de493ce211ccf13f4bf0c487f945985d
Print out the new track id.
Rosuav/appension,MikeiLL/appension,MikeiLL/appension,MikeiLL/appension,Rosuav/appension,MikeiLL/appension,Rosuav/appension,Rosuav/appension
test_audio_files.py
test_audio_files.py
import fore.apikeys import fore.mixer import fore.database import pyechonest.track for file in fore.database.get_many_mp3(status='all'): print("Name: {} Length: {}".format(file.filename, file.track_details['length'])) track = track.track_from_filename('audio/'+file.filename, force_upload=True) print(track.id)
import fore.apikeys import fore.mixer import fore.database import pyechonest.track for file in fore.database.get_many_mp3(status='all'): print("Name: {} Length: {}".format(file.filename, file.track_details['length'])) track.track_from_filename('audio/'+file.filename, force_upload=True)
artistic-2.0
Python
e01a4a7ca346401a66e802eb9b2d8190e65fd606
Update test_get_image6d.py
sebi06/BioFormatsRead
test_get_image6d.py
test_get_image6d.py
# -*- coding: utf-8 -*- """ @author: Sebi File: test_get_image6d.py Date: 02.05.2017 Version. 1.7 """ from __future__ import print_function import numpy as np import bftools as bf #filename = r'testdata/Beads_63X_NA1.35_xy=0.042_z=0.1.czi' #filename = r'testdata/T=5_Z=3_CH=2_CZT_All_CH_per_Slice.czi' #filename = r't...
# -*- coding: utf-8 -*- """ @author: Sebi File: test_get_image6d.py Date: 02.05.2017 Version. 1.7 """ from __future__ import print_function import numpy as np import bftools as bf #filename = r'testdata/Beads_63X_NA1.35_xy=0.042_z=0.1.czi' #filename = r'testdata/T=5_Z=3_CH=2_CZT_All_CH_per_Slice.czi' #filename = r't...
bsd-2-clause
Python
47279e417720b94efa35601561822ecab44fb7b6
Update to the unit-test for slicing dataframes and expressions
maartenbreddels/vaex,maartenbreddels/vaex,maartenbreddels/vaex,maartenbreddels/vaex,maartenbreddels/vaex,maartenbreddels/vaex
tests/slice_test.py
tests/slice_test.py
from common import * def test_slice_expression(df): assert df.x[:2].tolist() == df[:2].x.tolist() assert df.x[2:6].tolist() == df[2:6].x.tolist() assert df.x[-3:].tolist() == df[-3:].x.tolist() assert df.x[::-3].tolist() == df[::-3].x.tolist() def test_slice_against_numpy(df): assert df.x[:2...
from common import * def test_slice_expression(df): assert df.x[:2].tolist() == df[:2].x.tolist() assert df.x[2:6].tolist() == df[2:6].x.tolist() def test_slice(ds_local): ds = ds_local ds_sliced = ds[:] assert ds_sliced.length_original() == ds_sliced.length_unfiltered() >= 10 assert ds_slic...
mit
Python
1a261b80dd42b04885b07c40e96dea045fe09e58
Add tests for the b and c operators.
nitbix/PyAsync
tests/test_async.py
tests/test_async.py
import wasync from wasync import * import datetime as dt import time import sys import unittest sys.path.append(".") def longfunc(x): time.sleep(x) return x class TestBasicFunctionality(unittest.TestCase): def setUp(self): self.scheduler = wasync.go() def testDeferredAwait(self): ...
import wasync from wasync import * import datetime as dt import time import sys import unittest sys.path.append(".") def longfunc(x): time.sleep(x) return x class TestBasicFunctionality(unittest.TestCase): def setUp(self): self.scheduler = wasync.go() def testDeferredAwait(self): ...
apache-2.0
Python
cad0e8b11f10a847a94e7cc767ea31d80183c574
Fix up tests
takluyver/nbparameterise
tests/test_basic.py
tests/test_basic.py
import os.path import unittest import nbformat from nbparameterise import code samplenb = os.path.join(os.path.dirname(__file__), 'sample.ipynb') class BasicTestCase(unittest.TestCase): def setUp(self): with open(samplenb) as f: self.nb = nbformat.read(f, as_version=4) self.params = ...
import os.path import unittest from IPython.nbformat import current as nbformat from nbparameterise import code samplenb = os.path.join(os.path.dirname(__file__), 'sample.ipynb') class BasicTestCase(unittest.TestCase): def setUp(self): with open(samplenb) as f: self.nb = nbformat.read(f, 'ipy...
mit
Python
550b48c0d1b464a782d875e30da140c742cd4b3e
Replace assertGreaterEqual with assertTrue(a >= b)
mozilla/spicedham,mozilla/spicedham
tests/test_bayes.py
tests/test_bayes.py
from unittest import TestCase from itertools import repeat, imap, izip, cycle from spicedham.bayes import Bayes from spicedham import Spicedham class TestBayes(TestCase): def test_classify(self): sh = Spicedham() b = Bayes(sh.config, sh.backend) b.backend.reset() self._traini...
from unittest import TestCase from itertools import repeat, imap, izip, cycle from spicedham.bayes import Bayes from spicedham import Spicedham class TestBayes(TestCase): def test_classify(self): sh = Spicedham() b = Bayes(sh.config, sh.backend) b.backend.reset() self._traini...
mpl-2.0
Python
c7002a39c232cde3088570ff82b436d4ead8130c
put coding line in test_bytes
rspeer/python-ftfy
tests/test_bytes.py
tests/test_bytes.py
# coding: utf-8 from ftfy.guess_bytes import guess_bytes from nose.tools import eq_ TEST_ENCODINGS = [ 'utf-16', 'utf-8', 'sloppy-windows-1252' ] TEST_STRINGS = [ u'Renée\nFleming', u'Noël\nCoward', u'Señor\nCardgage', u'€ • £ • ¥', u'¿Qué?' ] def check_bytes_decoding(string): for encoding in TEST_EN...
from ftfy.guess_bytes import guess_bytes from nose.tools import eq_ TEST_ENCODINGS = [ 'utf-16', 'utf-8', 'sloppy-windows-1252' ] TEST_STRINGS = [ u'Renée\nFleming', u'Noël\nCoward', u'Señor\nCardgage', u'€ • £ • ¥', u'¿Qué?' ] def check_bytes_decoding(string): for encoding in TEST_ENCODINGS: ...
mit
Python
8a46ef083380f481f15f46f7b53f6af95f4a9025
Test that date attributes are parsed, not computed
guoguo12/billboard-charts,guoguo12/billboard-charts,jameswenzel/billboard-charts,jameswenzel/billboard-charts
tests/test_dates.py
tests/test_dates.py
import datetime import billboard from nose.tools import raises def test_date_rounding(): """Checks that the Billboard website is rounding dates correctly: it should round up to the nearest date on which a chart was published. """ chart = billboard.ChartData('hot-100', date='1000-10-10') assert ch...
import datetime import billboard from nose.tools import raises def test_date_rounding(): """Checks that the Billboard website is rounding dates correctly: it should round up to the nearest date on which a chart was published. """ chart = billboard.ChartData('hot-100', date='1000-10-10') assert ch...
mit
Python
d26e1b0d82f8b00023c2ad0365b83c25e08678fa
Expand entry equality tests
MisanthropicBit/bibpy,MisanthropicBit/bibpy
tests/test_entry.py
tests/test_entry.py
# -*- coding: utf-8 -*- """Test the entry class.""" import bibpy import bibpy.entry import pytest @pytest.fixture def test_entry(): return bibpy.entry.Entry('article', 'key') def test_formatting(test_entry): assert test_entry.format() == '@article{key,\n}' def test_properties(test_entry): assert tes...
# -*- coding: utf-8 -*- """Test the entry class.""" import bibpy import bibpy.entry import pytest @pytest.fixture def test_entry(): return bibpy.entry.Entry('article', 'key') def test_formatting(test_entry): assert test_entry.format() == '@article{key,\n}' def test_properties(test_entry): assert tes...
mit
Python
2b0b574bc6503a7318c9ae24530f641b59aaa8e0
Test separate user and password
TwoBitAlchemist/NeoAlchemy
tests/test_graph.py
tests/test_graph.py
"""Graph (Connection Class) Tests""" import pytest from neoalchemy import Graph def test_default_connection(): graph = Graph() assert graph.driver.url == 'bolt://localhost' assert graph.driver.host == 'localhost' assert graph.driver.port is None assert graph.driver.config['auth'].scheme == 'basic...
"""Graph (Connection Class) Tests""" import pytest from neoalchemy import Graph def test_default_connection(): graph = Graph() assert graph.driver.url == 'bolt://localhost' assert graph.driver.host == 'localhost' assert graph.driver.port is None assert graph.driver.config['auth'].scheme == 'basic...
mit
Python
c3a26ff2801e6f5233432a1869d98e5369a4db11
add tests for truncate_table
knowledge-point/dj_anonymizer
tests/test_utils.py
tests/test_utils.py
import mock import pytest from django.contrib.auth.models import User from django.db import DEFAULT_DB_ALIAS from django.test.utils import override_settings from dj_anonymizer.utils import import_if_exist, truncate_table @pytest.mark.parametrize('path, expected', [ ('hello', False), ('base', True), ]) def t...
import mock import pytest from django.test.utils import override_settings from dj_anonymizer.utils import import_if_exist @pytest.mark.parametrize('path, expected', [ ('hello', False), ('base', True), ]) def test_import_if_exist(mocker, path, expected): with override_settings( ANONYMIZER_MODEL_DE...
mit
Python
aec4647e7599979de06952739459376c87fdb7ee
switch mime-type from text/plain to kml
google-code-export/marinemap,google-code-export/marinemap,Alwnikrotikz/marinemap,Alwnikrotikz/marinemap,google-code-export/marinemap,Alwnikrotikz/marinemap,google-code-export/marinemap,Alwnikrotikz/marinemap
lingcod/studyregion/views.py
lingcod/studyregion/views.py
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseBadRequest, HttpResponseServerError, HttpResponseForbidden from django.template import RequestContext from django.shortcuts import get_object_or_404, render_to_response from lingcod.common import mimetypes from lingcod.common.utils import KmlWr...
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseBadRequest, HttpResponseServerError, HttpResponseForbidden from django.template import RequestContext from django.shortcuts import get_object_or_404, render_to_response from lingcod.common import mimetypes from lingcod.common.utils import KmlWr...
bsd-3-clause
Python
0c413737488895dcd7bcc55014e6d51fb3b29c7b
Update MWAA per 2021-06-21 changes
cloudtools/troposphere,cloudtools/troposphere
troposphere/mwaa.py
troposphere/mwaa.py
# Copyright (c) 2012-2018, Mark Peek <mark@peek.org> # All rights reserved. # # See LICENSE file for full license. from . import AWSObject, AWSProperty, Tags from .validators import boolean, integer class UpdateError(AWSProperty): props = { "ErrorCode": (str, False), "ErrorMessage": (str, False),...
# Copyright (c) 2012-2018, Mark Peek <mark@peek.org> # All rights reserved. # # See LICENSE file for full license. from . import AWSObject, AWSProperty, Tags from .validators import boolean, integer class UpdateError(AWSProperty): props = { "ErrorCode": (str, False), "ErrorMessage": (str, False),...
bsd-2-clause
Python
ecc8c7c0bc869e9afa82a941586c840e80d91ba8
Improve docstring
lvh/txscrypt
txscrypt/wrapper.py
txscrypt/wrapper.py
""" Wrapper around scrypt. """ import os import scrypt from twisted.cred import error from twisted.internet import threads NONCE_LENGTH = 64 MAX_TIME = .1 def verifyPassword(stored, provided): """ Verifies that the stored derived key was computed from the provided password. Returns a deferred that...
""" Wrapper around scrypt. """ import os import scrypt from twisted.cred import error from twisted.internet import threads NONCE_LENGTH = 64 MAX_TIME = .1 def verifyPassword(stored, provided): """ Verifies that the stored derived key was computed from the provided password. Returns a deferred that...
isc
Python
c0933cd553043858f0a996edca2f4dc1b1da78c9
clarify comment
CaptainDesAstres/Simple-Blender-Render-Manager
usefullFunctions.py
usefullFunctions.py
#!/usr/bin/python3.4 # -*-coding:Utf-8 -* import time def now(short = True): '''return current date in short or long form (HH:MM:SS or DD.MM.AAAA-HH:MM:SS)''' if short == True: return time.strftime('%H:%M:%S') else: return time.strftime('%d.%m.%Y-%H:%M:%S') def columnLimit(value, limit, begin = True, sep =...
#!/usr/bin/python3.4 # -*-coding:Utf-8 -* import time def now(short = True): '''return short (HH:MM:SS) or long (DD.MM.AAAA-HH:MM:SS) formated current date strings''' if short == True: return time.strftime('%H:%M:%S') else: return time.strftime('%d.%m.%Y-%H:%M:%S') def columnLimit(value, limit, begin = Tru...
mit
Python
7b47a35ef77a71bc20570453d242f755e575d35a
Refactor index().
s3rvac/git-branch-viewer,s3rvac/git-branch-viewer
viewer/web/views.py
viewer/web/views.py
""" viewer.web.views ~~~~~~~~~~~~~~~~ Views for the web. :copyright: © 2014 by Petr Zemek <s3rvac@gmail.com> and contributors :license: BSD, see LICENSE for more details """ from flask import render_template from flask import g from viewer import git from . import app @app.before_request def b...
""" viewer.web.views ~~~~~~~~~~~~~~~~ Views for the web. :copyright: © 2014 by Petr Zemek <s3rvac@gmail.com> and contributors :license: BSD, see LICENSE for more details """ from flask import render_template from flask import g from viewer import git from . import app @app.before_request def b...
bsd-3-clause
Python
ce18939a9ee952906677b7a6be8a42e06dc21fb0
Update Matrices
Echelon9/vulk,Echelon9/vulk,realitix/vulk,realitix/vulk
vulk/math/matrix.py
vulk/math/matrix.py
'''Matrix module This module contains all class relative to Matrix ''' import numpy as np class Matrix(): '''Base class for Matrix''' def __init__(self, values): self._values = np.matrix(values, dtype=np.float32) @property def values(self): return self._values def set(self, valu...
'''Matrix module This module contains all class relative to Matrix ''' import numpy as np class Matrix(): '''Base class for Matrix''' def __init__(self, values): self._values = np.array(values, dtype=np.float32) @property def values(self): return self._values class Matrix3(Matrix):...
apache-2.0
Python
0c4d2e99d5b2ffef043ec8b35d47ee49f0d382f7
Clean processors
tartopum/MPF,Vayel/MPF
src/processors.py
src/processors.py
import numpy as np class FourierTransform: def __init__(self, real=True, timestep=1): # Define helpers self.fft = np.fft.rfft if real else np.fft.fft self.freq = np.fft.fftfreq self.shift = np.fft.fftshift self.real = real self.timestep = timestep d...
import numpy as np class FourierTransform: def __init__(self, real=True, timestep=1): # Define helpers self.fft = np.fft.rfft if real else np.fft.fft self.freq = np.fft.fftfreq self.shift = np.fft.fftshift self.real = real self.timestep = timestep d...
mit
Python
2fdf35f8a9bf7a6249bc92236952655314a47080
Add author and lincense variables
elbaschid/swapify
swapify/__init__.py
swapify/__init__.py
# -*- encoding: utf-8 -*- __author__ = 'Sebastian Vetter' __version__ = VERSION = '0.0.0' __license__ = 'MIT'
# -*- encoding: utf-8 -*- __version__ = VERSION = '0.0.0'
mit
Python
f90588ea092e57ad26535163f42647d9f532eeeb
update import statement
texastribune/armstrong.core.tt_sections,texastribune/armstrong.core.tt_sections,texastribune/armstrong.core.tt_sections
armstrong/core/tt_sections/utils.py
armstrong/core/tt_sections/utils.py
from django.conf import settings from django.utils.module_loading import import_module def get_module_and_model_names(): s = (getattr(settings, "ARMSTRONG_SECTION_ITEM_MODEL", False) or "armstrong.apps.content.models.Content") return s.rsplit(".", 1) def get_item_model_class(): module_name, ...
from django.conf import settings from django.utils.importlib import import_module def get_module_and_model_names(): s = (getattr(settings, "ARMSTRONG_SECTION_ITEM_MODEL", False) or "armstrong.apps.content.models.Content") return s.rsplit(".", 1) def get_item_model_class(): module_name, class...
apache-2.0
Python
bb05f21ca47f636197764fb9518282318270d663
Add tests around hatband.autodiscover functionality
texastribune/armstrong.hatband,texastribune/armstrong.hatband,armstrong/armstrong.hatband,armstrong/armstrong.hatband,armstrong/armstrong.hatband,texastribune/armstrong.hatband
armstrong/hatband/tests/__init__.py
armstrong/hatband/tests/__init__.py
from pkgutil import extend_path __path__ = extend_path(__path__, __name__) from contextlib import contextmanager import fudge from .widgets import * from ... import hatband def generate_random_registry(): from ._utils import random_range return dict([("key%d" % i, i) for i in random_range()]) @contextman...
from pkgutil import extend_path __path__ = extend_path(__path__, __name__) from .widgets import *
apache-2.0
Python
4d1b3b2ae58f214d8d78e8b853c7cf5570c097ff
Update to guestagent #169
kostaslamda/win-installer,xenserver/win-installer,kostaslamda/win-installer,OwenSmith/win-installer,xenserver/win-installer,kostaslamda/win-installer,OwenSmith/win-installer,xenserver/win-installer,OwenSmith/win-installer,xenserver/win-installer,kostaslamda/win-installer,kostaslamda/win-installer,OwenSmith/win-installe...
manifestspecific.py
manifestspecific.py
# Copyright (c) Citrix Systems Inc. # All rights reserved. # # Redistribution and use in source and binary forms, # with or without modification, are permitted provided # that the following conditions are met: # # * Redistributions of source code must retain the above # copyright notice, this list of conditions a...
# Copyright (c) Citrix Systems Inc. # All rights reserved. # # Redistribution and use in source and binary forms, # with or without modification, are permitted provided # that the following conditions are met: # # * Redistributions of source code must retain the above # copyright notice, this list of conditions a...
bsd-2-clause
Python
40897be402bd05ed5fb53e116f03d2d954720245
Fix plate-solving on local development mode
astrobin/astrobin,astrobin/astrobin,astrobin/astrobin,astrobin/astrobin
astrobin_apps_platesolving/utils.py
astrobin_apps_platesolving/utils.py
# Python import urllib2 # Django from django.conf import settings from django.core.files import File from django.core.files.temp import NamedTemporaryFile def getFromStorage(image, alias): def encoded(path): return urllib2.quote(path.encode('utf-8')) url = image.thumbnail(alias) if "://" in url...
# Python import urllib2 # Django from django.conf import settings from django.core.files import File from django.core.files.temp import NamedTemporaryFile def getFromStorage(image, alias): url = image.thumbnail(alias) if "://" in url: url = url.split('://')[1] else: url = settings.BASE_UR...
agpl-3.0
Python
1165cb98c364d2eca9d313b02c710bc9a26ca3f0
Fix borg test.
Dioptas/pymatgen,migueldiascosta/pymatgen,rousseab/pymatgen,Bismarrck/pymatgen,migueldiascosta/pymatgen,sonium0/pymatgen,Bismarrck/pymatgen,yanikou19/pymatgen,Bismarrck/pymatgen,Bismarrck/pymatgen,yanikou19/pymatgen,Dioptas/pymatgen,ctoher/pymatgen,migueldiascosta/pymatgen,rousseab/pymatgen,Bismarrck/pymatgen,rousseab/...
pymatgen/apps/borg/tests/test_queen.py
pymatgen/apps/borg/tests/test_queen.py
""" Created on Mar 18, 2012 """ from __future__ import division __author__ = "Shyue Ping Ong" __copyright__ = "Copyright 2012, The Materials Project" __version__ = "0.1" __maintainer__ = "Shyue Ping Ong" __email__ = "shyue@mit.edu" __date__ = "Mar 18, 2012" import unittest import os from pymatgen.apps.borg.hive imp...
""" Created on Mar 18, 2012 """ from __future__ import division __author__ = "Shyue Ping Ong" __copyright__ = "Copyright 2012, The Materials Project" __version__ = "0.1" __maintainer__ = "Shyue Ping Ong" __email__ = "shyue@mit.edu" __date__ = "Mar 18, 2012" import unittest import os from pymatgen.apps.borg.hive imp...
mit
Python
64888afcd8696a8159aa2eda2bb78681ac22d668
Prepare v0.9.3
jml/pyrsistent,jkbjh/pyrsistent,Futrell/pyrsistent,Futrell/pyrsistent,jkbjh/pyrsistent,jml/pyrsistent,jkbjh/pyrsistent,tobgu/pyrsistent,tobgu/pyrsistent,Futrell/pyrsistent,tobgu/pyrsistent,jml/pyrsistent
_pyrsistent_version.py
_pyrsistent_version.py
__version__ = '0.9.3'
__version__ = '0.9.2'
mit
Python
625279d8b76e4187ee90e9c2fd4a84553d980e02
Use 10 second buckets instead of 1 second bucket
simonw/django-redis-monitor
django_redis_monitor/redis_monitor.py
django_redis_monitor/redis_monitor.py
import datetime # we use utcnow to insulate against daylight savings errors import redis class RedisMonitor(object): def __init__(self, prefix=''): assert prefix and ' ' not in prefix, \ 'prefix (e.g. "rps") is required and must not contain spaces' self.prefix = prefix self.r = ...
import datetime # we use utcnow to insulate against daylight savings errors import redis class RedisMonitor(object): def __init__(self, prefix=''): assert prefix and ' ' not in prefix, \ 'prefix (e.g. "rps") is required and must not contain spaces' self.prefix = prefix self.r = ...
bsd-2-clause
Python
6aba9d1f6de927b2a78530ff36edf0603e4c4e43
Fix bugs in demo_threadcrawler.py
tosh1ki/pyogi,tosh1ki/pyogi
doc/sample_code/demo_threadcrawler.py
doc/sample_code/demo_threadcrawler.py
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' 2chの「将棋の棋譜貼り専門スレッド」から棋譜を収集するデモ ''' import re import sys sys.path.append('./../../') from pyogi.kifu import Kifu from pyogi.threadcrawler import ThreadCrawler from pyogi.ki2converter import Ki2converter if __name__ == '__main__': # Crawl html that contains kifu...
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' 2chの「将棋の棋譜貼り専門スレッド」から棋譜を収集するデモ ''' import sys sys.path.append('./../../') from pyogi.kifu import Kifu from pyogi.threadcrawler import ThreadCrawler from pyogi.ki2converter import Ki2converter if __name__ == '__main__': # Crawl html that contains kifu of KI2 fo...
mit
Python
81364d11dd935409fddfdeca865e30220960f4ba
Bump version
j4mie/django-activelink
activelink/__init__.py
activelink/__init__.py
__version__ = '0.2' __author__ = 'Jamie Matthews (http://j4mie.org) <jamie.matthews@gmail.com>'
__version__ = '0.1' __author__ = 'Jamie Matthews (http://j4mie.org) <jamie.matthews@gmail.com>'
unlicense
Python
8a0ec58b2a01ee179fcbc4c3c722df37f42b7687
Add more test cases
nltk/nltk,nltk/nltk,nltk/nltk
nltk/test/unit/test_aline.py
nltk/test/unit/test_aline.py
# -*- coding: utf-8 -*- """ Unit tests for nltk.metrics.aline """ from __future__ import unicode_literals import unittest from nltk.metrics import aline class TestAline(unittest.TestCase): """ Test Aline algorithm for aligning phonetic sequences """ def test_aline(self): result = aline.alig...
# -*- coding: utf-8 -*- """ Unit tests for nltk.metrics.aline """ from __future__ import unicode_literals import unittest from nltk.metrics import aline class TestAline(unittest.TestCase): """ Test Aline algorithm for aligning phonetic sequences """ def test_aline(self): result = aline.alig...
apache-2.0
Python
3ef08477fa6131d67020cb000657cb9c2b78b06a
Bump graql and client-java versions
lolski/grakn,graknlabs/grakn,lolski/grakn,lolski/grakn,graknlabs/grakn,graknlabs/grakn,graknlabs/grakn,lolski/grakn
dependencies/graknlabs/dependencies.bzl
dependencies/graknlabs/dependencies.bzl
# # GRAKN.AI - THE KNOWLEDGE GRAPH # Copyright (C) 2018 Grakn Labs Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later v...
# # GRAKN.AI - THE KNOWLEDGE GRAPH # Copyright (C) 2018 Grakn Labs Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later v...
agpl-3.0
Python
c8e2eb7e56e6ebc014983d856007cdad324e2242
Fix Python3.x error related to unicode.
jojanper/draalcore,jojanper/draalcore,jojanper/draalcore
draalcore/auth/registration/models.py
draalcore/auth/registration/models.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Registration model(s)""" # System imports import hashlib import random from django.db import models from django.contrib.auth.models import User try: bool(type(unicode)) except NameError: unicode = str # Project imports from draalcore.models.base_model import Mo...
#!/usr/bin/env python # -*- coding: utf-8 -*- """Registration model(s)""" # System imports import hashlib import random from django.db import models from django.contrib.auth.models import User # Project imports from draalcore.models.base_model import ModelLogger, ModelBaseManager class UserAccountManager(ModelBaseM...
mit
Python
ffbc1655b330df6716c737c36f7d05e2e91f133e
Revise functions/vars/comments/main() for clarification
bowen0701/algorithms_data_structures
alg_decimal_to_base.py
alg_decimal_to_base.py
from __future__ import absolute_import from __future__ import print_function from __future__ import division DIGITS = '0123456789ABCDEF' def decimal_to_base2(decimal): """Convert decimal number to binary number by iteration. Time complexity: O(d/2). Space complexity: O(d/2). """ # Push remainder...
from __future__ import absolute_import from __future__ import print_function from __future__ import division digits = '0123456789ABCDEF' def decimal_to_base2(decimal): """Convert decimal number to binary number.""" rem_stack = [] while decimal > 0: decimal, rem = divmod(decimal, 2) rem_st...
bsd-2-clause
Python
7c43327af91dc672c02099c788221e6b3073612a
Complete traverse_dfs()
bowen0701/algorithms_data_structures
alg_knight_tour_dfs.py
alg_knight_tour_dfs.py
from __future__ import absolute_import from __future__ import print_function from __future__ import division from collections import defaultdict from itertools import product MOVE_OFFSETS = ( (-1, -2), (1, -2), (-2, -1), (2, -1), (-2, 1), (2, 1), ...
from __future__ import absolute_import from __future__ import print_function from __future__ import division from collections import defaultdict from itertools import product MOVE_OFFSETS = ( (-1, -2), (1, -2), (-2, -1), (2, -1), (-2, 1), (2, 1), ...
bsd-2-clause
Python
f462be35ca867fd2b487ac151f1c3be26eda6cbb
FIX report verson
sysadminmatmoz/ingadhoc,ingadhoc/odoo-addons,bmya/odoo-addons,adhoc-dev/odoo-addons,ingadhoc/product,adhoc-dev/odoo-addons,sysadminmatmoz/ingadhoc,ingadhoc/odoo-addons,ingadhoc/stock,ingadhoc/sale,adhoc-dev/account-financial-tools,dvitme/odoo-addons,bmya/odoo-addons,ingadhoc/sale,ingadhoc/account-financial-tools,ClearC...
report_extended_voucher/__openerp__.py
report_extended_voucher/__openerp__.py
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar) # All Rights Reserved. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Pu...
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar) # All Rights Reserved. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Pu...
agpl-3.0
Python
4789e8e8024fd25e1d0191ee8de91ef8a97c9943
Fix case study redirect
uktrade/navigator,uktrade/navigator,uktrade/navigator,uktrade/navigator
app/casestudy/views.py
app/casestudy/views.py
from django.views.generic import TemplateView from django.shortcuts import redirect from thumber.decorators import thumber_feedback from casestudy.casestudies import CASE_STUDIES @thumber_feedback class CaseStudyView(TemplateView): """ The simple view for a case story page """ comment_placeholder = ...
from django.views.generic import TemplateView from django.shortcuts import redirect from thumber.decorators import thumber_feedback from casestudy.casestudies import CASE_STUDIES @thumber_feedback class CaseStudyView(TemplateView): """ The simple view for a case story page """ comment_placeholder = ...
mit
Python
70d9f68f78d8b4ba8e08b445a1b508806c0463f7
Fix home url
Ircam-Web/mezzanine-organization,Ircam-Web/mezzanine-organization
organization/pages/models.py
organization/pages/models.py
from django.db import models from django.utils.translation import ugettext_lazy as _ from django.core.urlresolvers import reverse, reverse_lazy from mezzanine.core.models import Displayable, Slugged, Orderable from organization.core.models import * class CustomPage(Page, SubTitled, RichText): class Meta: ...
from django.db import models from django.utils.translation import ugettext_lazy as _ from django.core.urlresolvers import reverse, reverse_lazy from mezzanine.core.models import Displayable, Slugged, Orderable from organization.core.models import * class CustomPage(Page, SubTitled, RichText): class Meta: ...
agpl-3.0
Python
8255eb399559f786eeec245c44877066ed878883
change MAX_NUM_QUESTIONS_PER_ELECTION on eorchestra settings
agoravoting/agora-dev-box,agoravoting/agora-dev-box,agoravoting/agora-dev-box,agoravoting/agora-dev-box,agoravoting/agora-dev-box
eorchestra/templates/base_settings.py
eorchestra/templates/base_settings.py
# This file is part of agora-dev-box. # Copyright (C) 2014-2016 Agora Voting SL <agora@agoravoting.com> # agora-dev-box is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of the License....
# This file is part of agora-dev-box. # Copyright (C) 2014-2016 Agora Voting SL <agora@agoravoting.com> # agora-dev-box is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of the License....
agpl-3.0
Python
0dbbde4eebf4af51d03d1739e9d370885cec37dd
fix bad escaping
djrobstep/migra,djrobstep/migra
migra/statements.py
migra/statements.py
from __future__ import unicode_literals import re def check_for_drop(s): return not not re.search(r"(drop\s+)", s, re.IGNORECASE) class Statements(list): def __init__(self, *args, **kwargs): self.safe = True super(Statements, self).__init__(*args, **kwargs) @property def sql(self):...
from __future__ import unicode_literals import re def check_for_drop(s): return not not re.search("(drop\s+)", s, re.IGNORECASE) class Statements(list): def __init__(self, *args, **kwargs): self.safe = True super(Statements, self).__init__(*args, **kwargs) @property def sql(self): ...
unlicense
Python
2b7d50f9ac6d0f4f6a032e60053b5923c292a0a1
Remove unused assert
zsloan/genenetwork2,genenetwork/genenetwork2,zsloan/genenetwork2,pjotrp/genenetwork2,genenetwork/genenetwork2,genenetwork/genenetwork2,zsloan/genenetwork2,pjotrp/genenetwork2,genenetwork/genenetwork2,pjotrp/genenetwork2,pjotrp/genenetwork2,zsloan/genenetwork2,pjotrp/genenetwork2
wqflask/utility/corr_result_helpers.py
wqflask/utility/corr_result_helpers.py
def normalize_values(a_values, b_values): """ Trim two lists of values to contain only the values they both share Given two lists of sample values, trim each list so that it contains only the samples that contain a value in both lists. Also returns the number of such samples. >>> normalize_val...
def normalize_values(a_values, b_values): """ Trim two lists of values to contain only the values they both share Given two lists of sample values, trim each list so that it contains only the samples that contain a value in both lists. Also returns the number of such samples. >>> normalize_val...
agpl-3.0
Python
6d2b0a7f34978fd77b906bb24f4056eeea779c9e
update release to 2.1.29-dev
kvick/aminator,coryb/aminator,bmoyles/aminator,Netflix/aminator
aminator/__init__.py
aminator/__init__.py
# -*- coding: utf-8 -*- # # # Copyright 2013 Netflix, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
# -*- coding: utf-8 -*- # # # Copyright 2013 Netflix, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
apache-2.0
Python
4955c9c797300ea3db5ef4c2083d2cb4379fc926
allow specifying splitter for `camelcaseify`
tek/amino
amino/util/string.py
amino/util/string.py
import re from functools import singledispatch # type: ignore def snake_case(name): s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower() @singledispatch def decode(value): return value @decode.register(bytes) def decode_bytes(value): return valu...
import re from functools import singledispatch # type: ignore def snake_case(name): s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower() @singledispatch def decode(value): return value @decode.register(bytes) def decode_bytes(value): return valu...
mit
Python
10822c71c04a8a2368b59012b88cbbccf9c65d7c
revert version bump up to 0.0.3.10: I merged many updates since then, so have to check carefully more before the next release
pmquang/python-anyconfig,ssato/python-anyconfig,ssato/python-anyconfig,pmquang/python-anyconfig
anyconfig/globals.py
anyconfig/globals.py
# # Copyright (C) 2013 Satoru SATOH <ssato @ redhat.com> # License: MIT # import logging AUTHOR = 'Satoru SATOH <ssat@redhat.com>' VERSION = "0.0.3.9" _LOGGING_FORMAT = "%(asctime)s %(name)s: [%(levelname)s] %(message)s" def getLogger(name="anyconfig", format=_LOGGING_FORMAT, level=logging.WARNING, *...
# # Copyright (C) 2013 Satoru SATOH <ssato @ redhat.com> # License: MIT # import logging AUTHOR = 'Satoru SATOH <ssat@redhat.com>' VERSION = "0.0.3.10" _LOGGING_FORMAT = "%(asctime)s %(name)s: [%(levelname)s] %(message)s" def getLogger(name="anyconfig", format=_LOGGING_FORMAT, level=logging.WARNING, ...
mit
Python
069b60e5860b6af81c136f55c84b6d1930442285
Fix plugin_test for workflow object
gareth8118/spreads,miloh/spreads,miloh/spreads,nafraf/spreads,jbaiter/spreads,gareth8118/spreads,gareth8118/spreads,nafraf/spreads,adongy/spreads,miloh/spreads,adongy/spreads,jbaiter/spreads,DIYBookScanner/spreads,DIYBookScanner/spreads,DIYBookScanner/spreads,nafraf/spreads,adongy/spreads,jbaiter/spreads
test/plugin_test.py
test/plugin_test.py
from mock import call, MagicMock as Mock, patch from nose.tools import raises import spreads.confit as confit import spreads.plugin as plugin from spreads.util import DeviceException class TestPlugin(object): def setUp(self): pass def test_get_driver(self): cfg = confit.Configuration('test_p...
from mock import call, MagicMock as Mock, patch from nose.tools import raises import spreads import spreads.plugin as plugin from spreads.util import DeviceException class TestPlugin(object): def setUp(self): reload(plugin) spreads.config.clear() spreads.config.read(user=False) sp...
agpl-3.0
Python
48f44fb2c499ac1ee6fed160d9d2e06a549fbcea
add __all__ string to scene/cameras/__init__.py
Eric89GXL/vispy,Eric89GXL/vispy,Eric89GXL/vispy
vispy/scene/cameras/__init__.py
vispy/scene/cameras/__init__.py
# -*- coding: utf-8 -*- # Copyright (c) 2015, Vispy Development Team. # Distributed under the (new) BSD License. See LICENSE.txt for more info. """ Cameras are responsible for determining which part of a scene is displayed in a viewbox and for handling user input to change the view. Several Camera subclasses are avail...
# -*- coding: utf-8 -*- # Copyright (c) 2015, Vispy Development Team. # Distributed under the (new) BSD License. See LICENSE.txt for more info. """ Cameras are responsible for determining which part of a scene is displayed in a viewbox and for handling user input to change the view. Several Camera subclasses are avail...
bsd-3-clause
Python
b9fccc33f3fb1c6408701f11c6a894c9001f843a
Fix YoutubeScrape error handling
willkg/steve,pyvideo/steve,willkg/steve,pyvideo/steve,willkg/steve,pyvideo/steve,CarlFK/steve,CarlFK/steve,CarlFK/steve
steve/scrapers.py
steve/scrapers.py
####################################################################### # This file is part of steve. # # Copyright (C) 2012-2015 Will Kahn-Greene # Licensed under the Simplified BSD License. See LICENSE for full # license. ####################################################################### from datetime import da...
####################################################################### # This file is part of steve. # # Copyright (C) 2012-2015 Will Kahn-Greene # Licensed under the Simplified BSD License. See LICENSE for full # license. ####################################################################### from datetime import da...
bsd-2-clause
Python
11b35c79ff8d2108d572929334e4e3f30c70eea5
Allow debug and verbose modes to be set directly from config.
Agent-Isai/lykos,billion57/lykos,Diitto/lykos,Cr0wb4r/lykos
modules/__init__.py
modules/__init__.py
import argparse import botconfig from settings import wolfgame as var # Todo: Allow game modes to be set via config # Handle launch parameters # Argument --debug means start in debug mode # --verbose means to print a lot of stuff (when not in debug mode) parser = argparse.ArgumentParser() parser.add_argume...
import argparse import botconfig from settings import wolfgame as var # Todo: Allow game modes to be set via config # Carry over settings from botconfig into settings/wolfgame.py for setting, value in botconfig.__dict__.items(): if not setting.isupper(): continue # Not a setting if not setting in var...
bsd-2-clause
Python
af410659c8c9664c6e2e86d0c88fe9f1cfd2cceb
Fix karmamod for mongodb
billyvg/piebot
modules/karmamod.py
modules/karmamod.py
"""Keeps track of karma counts. @package ppbot @syntax .karma <item> """ import re from modules import * from models import Model class Karmamod(Module): def __init__(self, *args, **kwargs): """Constructor""" Module.__init__(self, kwargs=kwargs) def _register_events(self): self.add...
"""Keeps track of karma counts. @package ppbot @syntax .karma <item> """ import re from modules import * from models import Model class Karmamod(Module): def __init__(self, *args, **kwargs): """Constructor""" Module.__init__(self, kwargs=kwargs) def _register_events(self): self.add...
mit
Python
bfb909281d567334e614452656bb4085f071262d
Use argument parser for hades-su
agdsn/hades,agdsn/hades,agdsn/hades,agdsn/hades,agdsn/hades
src/hades/bin/su.py
src/hades/bin/su.py
import grp import logging import os import pwd import sys from hades.common.cli import ArgumentParser, parser as common_parser logger = logging.getLogger(__name__) def drop_privileges(passwd, group): if os.geteuid() != 0: logger.error("Can't drop privileges (EUID != 0)") return os.setgid(gro...
import grp import logging import os import pwd import sys logger = logging.getLogger(__name__) def drop_privileges(passwd, group): if os.geteuid() != 0: logger.error("Can't drop privileges (EUID != 0)") return os.setgid(group.gr_gid) os.initgroups(passwd.pw_name, group.gr_gid) os.setu...
mit
Python
8fe8717b4e2afe6329d2dd25210371df3eab2b4f
Test that we reject bad TLS versions
python-hyper/pep543
test/test_stdlib.py
test/test_stdlib.py
# -*- coding: utf-8 -*- """ Tests for the standard library PEP 543 shim. """ import pep543 import pep543.stdlib import pytest from .backend_tests import SimpleNegotiation CONTEXTS = ( pep543.stdlib.STDLIB_BACKEND.client_context, pep543.stdlib.STDLIB_BACKEND.server_context ) def assert_wrap_fails(context,...
# -*- coding: utf-8 -*- """ Tests for the standard library PEP 543 shim. """ import pep543.stdlib from .backend_tests import SimpleNegotiation class TestSimpleNegotiationStdlib(SimpleNegotiation): BACKEND = pep543.stdlib.STDLIB_BACKEND
mit
Python
d415eb84b699a8f31451734599e14c44d97d0c74
fix for imgur album downloads
regosen/gallery_get
gallery_plugins/plugin_imgur_album.py
gallery_plugins/plugin_imgur_album.py
# Plugin for gallery_get. # Each definition can be one of the following: # - a string to match # - a regex string to match # - a function that takes source as a parameter and returns an array or a single match. (You may assume that re and urllib are already imported.) # If you comment out a parameter, it will use the...
# Plugin for gallery_get. # Each definition can be one of the following: # - a string to match # - a regex string to match # - a function that takes source as a parameter and returns an array or a single match. (You may assume that re and urllib are already imported.) # If you comment out a parameter, it will use the...
mit
Python
b8cf132bc4cbf4b7c17812c3429cc96a0a07a18e
update accounts admin
tarvitz/djtp,tarvitz/djtp,tarvitz/djtp,tarvitz/djtp
apps/accounts/admin.py
apps/accounts/admin.py
from django.db import models from django.utils.translation import ugettext_lazy as _ from django.core.urlresolvers import reverse_lazy as reverse from django import forms from django.forms.util import ErrorList from django.contrib.auth.admin import UserAdmin from django.contrib import admin from apps.accounts.models i...
from django.db import models from django.utils.translation import ugettext_lazy as _ from django.core.urlresolvers import reverse_lazy as reverse from django import forms from django.forms.util import ErrorList from django.contrib.auth.admin import UserAdmin from django.contrib import admin from apps.accounts.models i...
bsd-3-clause
Python
774443b9d00f311bb656dec8fbc66378cfe876a9
Make launch_testing.markers.retry_on_failure decorator more robust. (#352)
ros2/launch,ros2/launch,ros2/launch
launch_testing/launch_testing/markers.py
launch_testing/launch_testing/markers.py
# Copyright 2019 Open Source Robotics Foundation, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
# Copyright 2019 Open Source Robotics Foundation, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
apache-2.0
Python
574912ab8b95a4e469a1b22ea0153e3755fcd505
Rework admin of licenses app
TamiaLab/carnetdumaker,TamiaLab/carnetdumaker,TamiaLab/carnetdumaker,TamiaLab/carnetdumaker
apps/licenses/admin.py
apps/licenses/admin.py
""" Admin views for the licenses app. """ from django.contrib import admin from django.utils.html import format_html from django.utils.translation import ugettext_lazy as _ from .models import License class LicenseAdmin(admin.ModelAdmin): """ Admin form for the ``License`` data model. """ list_disp...
""" Admin views for the licenses app. """ from django.contrib import admin from django.utils.html import format_html from django.utils.translation import ugettext_lazy as _ from .models import License def view_issue_on_site(obj): """ Simple "view on site" inline callback. :param obj: Current database ob...
agpl-3.0
Python
a2a8f9a2bf9352a99b8ee3750851845f754f6c04
Use raw_id_field for voucher sender in admin.
onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site
apps/vouchers/admin.py
apps/vouchers/admin.py
from babel.numbers import format_currency from django.contrib import admin from django.core.urlresolvers import reverse from django.utils import translation from .models import CustomVoucherRequest, Voucher class VoucherAdmin(admin.ModelAdmin): list_filter = ('status',) list_display = ('created', 'amount_over...
from babel.numbers import format_currency from django.contrib import admin from django.core.urlresolvers import reverse from django.utils import translation from .models import CustomVoucherRequest, Voucher class VoucherAdmin(admin.ModelAdmin): list_filter = ('status',) list_display = ('created', 'amount_over...
bsd-3-clause
Python
04608636f6e4fc004458560499338af4b871cddb
Make Message a subclass of bytes
meshy/framewirc
asyncio_irc/message.py
asyncio_irc/message.py
from .utils import to_bytes class Message(bytes): """A message recieved from the IRC network.""" def __init__(self, raw_message_bytes_ignored): super().__init__() self.prefix, self.command, self.params, self.suffix = self._elements() def _elements(self): """ Split the raw...
from .utils import to_bytes class Message: """A message recieved from the IRC network.""" def __init__(self, raw_message): self.raw = raw_message self.prefix, self.command, self.params, self.suffix = self._elements() def _elements(self): """ Split the raw message into it'...
bsd-2-clause
Python
8778a7b28030a0b185f006b62fe1305982cf8af0
Handle unknown fields
cdumay/kser
src/kser/schemas.py
src/kser/schemas.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ .. codeauthor:: Cédric Dumay <cedric.dumay@gmail.com> """ from cdumay_error import ValidationError import marshmallow.exceptions from marshmallow import Schema, fields, EXCLUDE from cdumay_result import ResultSchema, Result class BaseSchema(Schema): class Meta:...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ .. codeauthor:: Cédric Dumay <cedric.dumay@gmail.com> """ from cdumay_error import ValidationError import marshmallow.exceptions from marshmallow import Schema, fields from cdumay_result import ResultSchema, Result class BaseSchema(Schema): uuid = fields.String...
mit
Python
73371de1d1d25c46063b8d3ffb708b98344abdd7
fix accidental removal
erinspace/scrapi,fabianvf/scrapi,fabianvf/scrapi,CenterForOpenScience/scrapi,CenterForOpenScience/scrapi,erinspace/scrapi
api/webview/views.py
api/webview/views.py
import json from django.http import HttpResponse from rest_framework import generics from rest_framework import permissions from rest_framework.response import Response from rest_framework.decorators import api_view from django.views.decorators.clickjacking import xframe_options_exempt from elasticsearch import Elasti...
import json from django.http import HttpResponse from rest_framework import generics from rest_framework import permissions from rest_framework.response import Response from rest_framework.decorators import api_view from django.views.decorators.clickjacking import xframe_options_exempt from elasticsearch import Elasti...
apache-2.0
Python
622495f16bd6fab3a5c76d18aaa4a3ec4ff6d590
remove unused import.
constanthatz/data-structures
test_linked_list.py
test_linked_list.py
from linked_list import Node from linked_list import LinkedList def test_node_init(): n = Node(3) assert n.val == 3 assert n.next is None def test_linkedlist_init(): l = LinkedList() assert l.head is None def test_linkedlist_repr(): l = LinkedList() assert repr(l) == '()' l.insert...
import pytest from linked_list import Node from linked_list import LinkedList def test_node_init(): n = Node(3) assert n.val == 3 assert n.next is None def test_linkedlist_init(): l = LinkedList() assert l.head is None def test_linkedlist_repr(): l = LinkedList() assert repr(l) == '()...
mit
Python
b97d65a61ed3c0443ee857ef3d6308e18f962a7a
Fix addparam templatetag to resolve request variable correctly
akvo/akvo-rsr,akvo/akvo-rsr,akvo/akvo-rsr,akvo/akvo-rsr
akvo/rsr/templatetags/addparam.py
akvo/rsr/templatetags/addparam.py
# Akvo RSR is covered by the GNU Affero General Public License. # See more details in the license.txt file located at the root folder of the Akvo RSR module. # For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >. # django snippet 840, see http://www.djangosnippets.org/snippet...
# Akvo RSR is covered by the GNU Affero General Public License. # See more details in the license.txt file located at the root folder of the Akvo RSR module. # For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >. # django snippet 840, see http://www.djangosnippets.org/snippet...
agpl-3.0
Python