commit
stringlengths
40
40
old_file
stringlengths
4
236
new_file
stringlengths
4
236
old_contents
stringlengths
1
3.26k
new_contents
stringlengths
16
4.43k
subject
stringlengths
16
624
message
stringlengths
17
3.29k
lang
stringclasses
5 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
88921deb630bef702a08f5b3a07279ccd223902b
test/lifecycle_test.py
test/lifecycle_test.py
from threading import Thread from Queue import Queue from doubles import lifecycle class TestLifecycle(object): def test_stores_a_space_per_thread(self): queue = Queue() queue.put(lifecycle.current_space()) def push_thread_space_to_queue(queue): queue.put(lifecycle.current_s...
from threading import Thread from Queue import Queue from doubles import lifecycle class TestLifecycle(object): def test_stores_a_space_per_thread(self): queue = Queue() def push_thread_space_to_queue(queue): queue.put(lifecycle.current_space()) push_thread_space_to_queue(qu...
Reduce minor duplication in lifecycle test.
Reduce minor duplication in lifecycle test.
Python
mit
uber/doubles
0335f32fa7035d394a6434b924a8ebb17332fd45
mist/__init__.py
mist/__init__.py
import requests class Bit: def __init__(self, auth_token, device_id): self.token = auth_token self.id = device_id self.version = '0.1.0' self.headers = {"Authorization": "Bearer " + self.token, "Accept": "application/vnd.littlebits.v2+json"} def output(self, pct, dur): ...
import requests print """ mist - a python wrapper for the cloudBit API. If you use this, please let me know on github! http://github.com/technoboy10/mist """ class Bit: def __init__(self, auth_token, device_id): self.token = auth_token self.id = device_id self.version = '0.1.0' self...
Print stuff when module is imported.
Print stuff when module is imported.
Python
mit
technoboy10/partly-cloudy
1843e34bba0343cd3600f3c8934ae29b4b365554
chstrings/chstrings_test.py
chstrings/chstrings_test.py
import chstrings import config import unittest class CHStringsTest(unittest.TestCase): @classmethod def add_smoke_test(cls, cfg): def test(self): # We just want to see if this will blow up chstrings.get_localized_strings(cfg, cfg.lang_code) name = 'test_' + cfg.lang_cod...
import chstrings import config import unittest class CHStringsTest(unittest.TestCase): @classmethod def add_smoke_test(cls, cfg): def test(self): # We just want to see if this will blow up. Use the fallback # lang_tag across all tests. lang_tag = cfg.lang_code ...
Extend chstrings smoke test a little more.
Extend chstrings smoke test a little more.
Python
mit
eggpi/citationhunt,guilherme-pg/citationhunt,eggpi/citationhunt,eggpi/citationhunt,guilherme-pg/citationhunt,guilherme-pg/citationhunt,eggpi/citationhunt,guilherme-pg/citationhunt
8bd562b3ae6a2e5ae4fd1ad88da5d46408415365
cliche/services/__init__.py
cliche/services/__init__.py
""":mod:`cliche.services` --- Interfacing external services ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ How to add a new external service --------------------------------- In order to add a new service to cliche, you must create a subpackage under :data:`cliche.services` and expose some methods referr...
""":mod:`cliche.services` --- Interfacing external services ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ How to add a new external service --------------------------------- In order to add a new service to cliche, you must create a subpackage under :data:`cliche.services` and expose some methods referr...
Add some details to docs
Add some details to docs
Python
mit
clicheio/cliche,item4/cliche,clicheio/cliche,item4/cliche,clicheio/cliche
bcd9799b790aef9571491c0537e5aeb12bc9a564
make_a_plea/management/commands/check_urns_in_db.py
make_a_plea/management/commands/check_urns_in_db.py
import csv from django.core.management.base import BaseCommand from apps.plea.models import DataValidation, Case from apps.plea.standardisers import standardise_urn, format_for_region class Command(BaseCommand): help = "Build weekly aggregate stats" def add_arguments(self, parser): parser.add_argum...
from django.core.management.base import BaseCommand from apps.plea.models import Case from apps.plea.standardisers import standardise_urn class Command(BaseCommand): help = "Build weekly aggregate stats" def add_arguments(self, parser): parser.add_argument('csv_file', nargs='+') def handle(self...
Update management command to check if a list of URNs is present in the database
Update management command to check if a list of URNs is present in the database
Python
mit
ministryofjustice/manchester_traffic_offences_pleas,ministryofjustice/manchester_traffic_offences_pleas,ministryofjustice/manchester_traffic_offences_pleas,ministryofjustice/manchester_traffic_offences_pleas
9eea896352e62850494dbb3f894eef0b82afab89
needy/projects/boostbuild.py
needy/projects/boostbuild.py
import os import subprocess from .. import project class BoostBuildProject(project.Project): @staticmethod def identifier(): return 'boostbuild' @staticmethod def is_valid_project(definition, needy): if not definition.target.platform.is_host(): return False if n...
import os import subprocess from .. import project class BoostBuildProject(project.Project): @staticmethod def identifier(): return 'boostbuild' @staticmethod def is_valid_project(definition, needy): if not definition.target.platform.is_host(): return False if n...
Add support for linkage in b2 projects
Add support for linkage in b2 projects
Python
mit
vmrob/needy,ccbrown/needy,vmrob/needy,bittorrent/needy,bittorrent/needy,ccbrown/needy
4fdf3af6414ae6fdc20882309bcaf36ffbe5c7a7
scripts/prereg/approve_draft_registrations.py
scripts/prereg/approve_draft_registrations.py
""" A script for testing DraftRegistrationApprovals. Automatically approves all pending DraftRegistrationApprovals. """ import sys import logging from website.app import init_app from website.models import DraftRegistration, Sanction, User logger = logging.getLogger(__name__) logging.basicConfig(level=logging.WARN) l...
""" A script for testing DraftRegistrationApprovals. Automatically approves all pending DraftRegistrationApprovals. """ import sys import logging from framework.tasks.handlers import celery_teardown_request from website.app import init_app from website.project.model import DraftRegistration, Sanction logger = loggin...
Make sure celery_teardown_request gets called in DraftReg auto-approve script
Make sure celery_teardown_request gets called in DraftReg auto-approve script [skip ci]
Python
apache-2.0
crcresearch/osf.io,Johnetordoff/osf.io,TomHeatwole/osf.io,Nesiehr/osf.io,Nesiehr/osf.io,mattclark/osf.io,caneruguz/osf.io,zachjanicki/osf.io,caneruguz/osf.io,SSJohns/osf.io,adlius/osf.io,monikagrabowska/osf.io,abought/osf.io,crcresearch/osf.io,HalcyonChimera/osf.io,KAsante95/osf.io,aaxelb/osf.io,acshi/osf.io,KAsante95/...
e9031ab6091e3b9d7866c300c8e21b9e81e7e935
api/collections/urls.py
api/collections/urls.py
from django.conf.urls import url from api.collections import views from website import settings urlpatterns = [] # Routes only active in local/staging environments if settings.DEV_MODE: urlpatterns.extend([ url(r'^$', views.CollectionList.as_view(), name='collection-list'), url(r'^(?P<collection_...
from django.conf.urls import url from api.collections import views urlpatterns = [ url(r'^$', views.CollectionList.as_view(), name='collection-list'), url(r'^(?P<collection_id>\w+)/$', views.CollectionDetail.as_view(), name='collection-detail'), url(r'^(?P<collection_id>\w+)/linked_nodes/$', views.LinkedN...
Remove DEV ONLY on the sub view since the super already has it
Remove DEV ONLY on the sub view since the super already has it
Python
apache-2.0
cslzchen/osf.io,leb2dg/osf.io,kch8qx/osf.io,TomBaxter/osf.io,wearpants/osf.io,laurenrevere/osf.io,chrisseto/osf.io,cslzchen/osf.io,mluo613/osf.io,rdhyee/osf.io,mluke93/osf.io,adlius/osf.io,CenterForOpenScience/osf.io,pattisdr/osf.io,billyhunt/osf.io,mluo613/osf.io,caseyrollins/osf.io,zachjanicki/osf.io,jnayak1/osf.io,a...
610c27c15c09777a84143f551bb2cd3c2a5e3584
nltk/align/util.py
nltk/align/util.py
# Natural Language Toolkit: Aligner Utilities # # Copyright (C) 2001-2013 NLTK Project # Author: # URL: <http://www.nltk.org/> # For license information, see LICENSE.TXT
# Natural Language Toolkit: Aligner Utilities # # Copyright (C) 2001-2013 NLTK Project # Author: # URL: <http://www.nltk.org/> # For license information, see LICENSE.TXT from nltk.align.api import Alignment def pharaohtext2tuples(pharaoh_text): """ Converts pharaoh text format into an Alignment object (a list of t...
Convert pharaoh output format to Alignment object and vice versa:wq
Convert pharaoh output format to Alignment object and vice versa:wq
Python
apache-2.0
nltk/nltk,nltk/nltk,nltk/nltk
59eb6eaf18c67c424dad35f82f6baac6c93de380
elasticmock/__init__.py
elasticmock/__init__.py
# -*- coding: utf-8 -*- from functools import wraps from mock import patch from elasticmock.fake_elasticsearch import FakeElasticsearch ELASTIC_INSTANCES = {} def _get_elasticmock(hosts=None, *args, **kwargs): elastic_key = 'localhost:9200' if hosts is None else '{0}:{1}'.format(hosts[0].get('host'), hosts[0]...
# -*- coding: utf-8 -*- from functools import wraps from elasticsearch.client import _normalize_hosts from mock import patch from elasticmock.fake_elasticsearch import FakeElasticsearch ELASTIC_INSTANCES = {} def _get_elasticmock(hosts=None, *args, **kwargs): host = _normalize_hosts(hosts)[0] elastic_key ...
Allow the same 'hosts' settings that Elasticsearch does
Allow the same 'hosts' settings that Elasticsearch does
Python
mit
vrcmarcos/elasticmock
7d10b9d803089d1cf8a0c06219608d31bf5fb84f
src/collectors/MongoDBCollector/MongoDBCollector.py
src/collectors/MongoDBCollector/MongoDBCollector.py
try: from numbers import Number import pymongo except ImportError: Number = None import diamond class MongoDBCollector(diamond.collector.Collector): """Collects data from MongoDB's db.serverStatus() command Collects all number values from the db.serverStatus() command, other values are ignor...
try: from numbers import Number import pymongo from pymongo import ReadPreference except ImportError: Number = None import diamond class MongoDBCollector(diamond.collector.Collector): """Collects data from MongoDB's db.serverStatus() command Collects all number values from the db.serverStatu...
Replace deprecated slave_ok for read_preference in pymongo.Connection
Replace deprecated slave_ok for read_preference in pymongo.Connection See: http://api.mongodb.org/python/current/api/pymongo/connection.html
Python
mit
jriguera/Diamond,MichaelDoyle/Diamond,Netuitive/netuitive-diamond,hamelg/Diamond,dcsquared13/Diamond,sebbrandt87/Diamond,python-diamond/Diamond,gg7/diamond,sebbrandt87/Diamond,actmd/Diamond,signalfx/Diamond,Basis/Diamond,bmhatfield/Diamond,python-diamond/Diamond,krbaker/Diamond,jumping/Diamond,signalfx/Diamond,rtoma/Di...
ab5ebb50019add34333edb04cc96f7f55fce8d1c
src/toil/utils/__init__.py
src/toil/utils/__init__.py
from __future__ import absolute_import from toil import version import logging logger = logging.getLogger(__name__) def addBasicProvisionerOptions(parser): parser.add_argument("--version", action='version', version=version) parser.add_argument('-p', "--provisioner", dest='provisioner', choices=['aws', 'azur...
from __future__ import absolute_import from toil import version import logging import os logger = logging.getLogger(__name__) def addBasicProvisionerOptions(parser): parser.add_argument("--version", action='version', version=version) parser.add_argument('-p', "--provisioner", dest='provisioner', choices=['aw...
Remove default for zone, add method for searching for specified zone in environ vars.
Remove default for zone, add method for searching for specified zone in environ vars.
Python
apache-2.0
BD2KGenomics/slugflow,BD2KGenomics/slugflow
7755ab25249c39350004447daa614bc35e4517e7
src/malibu/__init__.py
src/malibu/__init__.py
# -*- coding: utf-8 -*- from malibu import command # noqa from malibu import config # noqa from malibu import database # noqa from malibu import design # noqa from malibu import text # noqa from malibu import util # noqa import subprocess __git_label__ = '' try: __git_label__ = subprocess.check_output( ...
# -*- coding: utf-8 -*- from malibu import command # noqa from malibu import config # noqa from malibu import database # noqa from malibu import design # noqa from malibu import text # noqa from malibu import util # noqa import subprocess __git_label__ = '' try: __git_label__ = subprocess.check_output( ...
Remove unnecessary strip, add finally for release tagger
0.1.8: Remove unnecessary strip, add finally for release tagger
Python
unlicense
maiome-development/malibu
44e5d35b6d43a22a480000b39a4e85335a27904b
corehq/apps/es/management/commands/wipe_es.py
corehq/apps/es/management/commands/wipe_es.py
from django.core.management import BaseCommand from corehq.apps.cleanup.utils import confirm_destructive_operation from corehq.elastic import get_es_new class Command(BaseCommand): """ Wipe all data from BlobDB. """ def add_arguments(self, parser): parser.add_argument( '--commit',...
from django.core.management import BaseCommand from corehq.apps.cleanup.utils import confirm_destructive_operation from corehq.elastic import get_es_new from corehq.util.es.elasticsearch import IndicesClient class Command(BaseCommand): """ Wipe all data from BlobDB. """ def add_arguments(self, parser...
Use IndicesClient to get full URL
Use IndicesClient to get full URL
Python
bsd-3-clause
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
a8b1b4ca3fd4964b2349ed085e8d2350072e67b9
d1_libclient_python/src/d1_client/__init__.py
d1_libclient_python/src/d1_client/__init__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # This work was created by participants in the DataONE project, and is # jointly copyrighted by participating institutions in DataONE. For # more information on DataONE, see our web site at http://dataone.org. # # Copyright 2009-2012 DataONE # # Licensed under the Apache...
#!/usr/bin/env python # -*- coding: utf-8 -*- # This work was created by participants in the DataONE project, and is # jointly copyrighted by participating institutions in DataONE. For # more information on DataONE, see our web site at http://dataone.org. # # Copyright 2009-2012 DataONE # # Licensed under the Apache...
Remove implicit import of symbols
Remove implicit import of symbols Currently, using libclient for python requires selecting the target node type (MN or CN) and the target DataONE API version, by specifying the appropriate client, so it better to use the library by explicitly importing only the needed clients instead of all of of them.
Python
apache-2.0
DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python
1ebf1cfb0ca67d7bb10fa776b5944d8755292999
shellstreaming/test/inputstream/test_textfile.py
shellstreaming/test/inputstream/test_textfile.py
# -*- coding: utf-8 -*- from nose.tools import * import os import time from shellstreaming.inputstream.textfile import TextFile TEST_FILE = os.path.abspath(os.path.dirname(__file__)) + '/test_textfile_input01.txt' def test_textfile_usage(): n_batches = n_records = 0 stream = TextFile(TEST_FILE, batch_span_m...
# -*- coding: utf-8 -*- from nose.tools import * import time from os.path import abspath, dirname, join from shellstreaming.inputstream.textfile import TextFile TEST_FILE = join(abspath(dirname(__file__)), 'test_textfile_input01.txt') def test_textfile_usage(): n_batches = n_records = 0 stream = TextFile(TE...
Use os.path.join instead of string concatenation.
Use os.path.join instead of string concatenation. Use `join` in order to create path intelligently on all operating systems. See: http://docs.python.org/2/library/os.path.html#os.path.join
Python
apache-2.0
laysakura/shellstreaming,laysakura/shellstreaming
244e760f27303fcfad220d364cd2d40f3de1cc99
src/pose.py
src/pose.py
#!/usr/bin/env python import rospy from nav_msgs.msg import Odometry publisher = None def send_computed_control_actions(msg): publisher.publish(msg) if __name__ == '__main__': rospy.init_node('pose') subscriber = rospy.Subscriber('computed_pose', Odometry, send_computed_control_actions) publishe...
#!/usr/bin/env python import rospy from geometry_msgs.msg import Twist publisher = None def send_computed_control_actions(msg): publisher.publish(msg) if __name__ == '__main__': rospy.init_node('twist') subscriber = rospy.Subscriber('computed_control_actions', Twist, send_computed_control_actions) ...
Change publisher and subscriber message type from Odometry to Twist
Change publisher and subscriber message type from Odometry to Twist
Python
mit
bit0001/trajectory_tracking,bit0001/trajectory_tracking
574a2d98733cbab814050d29d1a24cd5c6563c4f
Tools/scripts/fixps.py
Tools/scripts/fixps.py
#! /usr/bin/env python # Fix Python script(s) to reference the interpreter via /usr/bin/env python. import sys import regex import regsub def main(): for file in sys.argv[1:]: try: f = open(file, 'r+') except IOError: print file, ': can\'t open for update' continue line = f.readline() if regex.mat...
#!/usr/bin/env python # Fix Python script(s) to reference the interpreter via /usr/bin/env python. # Warning: this overwrites the file without making a backup. import sys import re def main(): for file in sys.argv[1:]: try: f = open(file, 'r') except IOError, msg: print file, ': can\'t open :', msg co...
Use re instead of regex. Don't rewrite the file in place. (Reported by Andy Dustman.)
Use re instead of regex. Don't rewrite the file in place. (Reported by Andy Dustman.)
Python
mit
sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator
1bac187d32473e338e34bea5525e3384103113df
fireplace/cards/wog/warlock.py
fireplace/cards/wog/warlock.py
from ..utils import * ## # Minions class OG_121: "Cho'gall" play = Buff(CONTROLLER, "OG_121e") class OG_121e: events = OWN_SPELL_PLAY.on(Destroy(SELF)) update = Refresh(CONTROLLER, {GameTag.SPELLS_COST_HEALTH: True}) ## # Spells class OG_116: "Spreading Madness" play = Hit(RANDOM_CHARACTER, 1) * 9
from ..utils import * ## # Minions class OG_109: "Darkshire Librarian" play = Discard(RANDOM(FRIENDLY_HAND)) deathrattle = Draw(CONTROLLER) class OG_113: "Darkshire Councilman" events = Summon(MINION, CONTROLLER).on(Buff(SELF, "OG_113e")) OG_113e = buff(atk=1) class OG_121: "Cho'gall" play = Buff(CONTROL...
Implement Darkshire Librarian, Darkshire Councilman, Possessed Villager
Implement Darkshire Librarian, Darkshire Councilman, Possessed Villager
Python
agpl-3.0
NightKev/fireplace,jleclanche/fireplace,beheh/fireplace
1f124ca4c13a0e5ceb9796bb1df95e5f31c5bd04
slot/users/models.py
slot/users/models.py
from flask_login import UserMixin class User(UserMixin): # proxy for a database of users user_database = {"test": ("slot", "test"), "live": ("slot", "live")} def __init__(self, username, password): self.id = username self.password = password @classmethod def get(cls, id): ...
from flask_login import UserMixin class User(UserMixin): def __init__(self, username, password): self.id = username self.password = password
Remove redundant parts of User class.
Remove redundant parts of User class.
Python
mit
nhshd-slot/SLOT,nhshd-slot/SLOT,nhshd-slot/SLOT
716282a16cefe1c34ae1bb1f8ffc6bb70879b5c2
wrappers/python/setup.py
wrappers/python/setup.py
from distutils.core import setup setup( name='python3-indy', version='0.0.1', packages=['indy'], url='https://github.com/hyperledger/indy-sdk', license='MIT/Apache-2.0', author='Vyacheslav Gudkov', author_email='vyacheslav.gudkov@dsr-company.com', description='This is the official SDK f...
from distutils.core import setup setup( name='python3-indy', version='0.0.1', packages=['indy'], url='https://github.com/hyperledger/indy-sdk', license='MIT/Apache-2.0', author='Vyacheslav Gudkov', author_email='vyacheslav.gudkov@dsr-company.com', description='This is the official SDK f...
Revert install requre optimization in python wrapper.
Revert install requre optimization in python wrapper.
Python
apache-2.0
Artemkaaas/indy-sdk,anastasia-tarasova/indy-sdk,korsimoro/indy-sdk,srottem/indy-sdk,Artemkaaas/indy-sdk,srottem/indy-sdk,srottem/indy-sdk,Artemkaaas/indy-sdk,Artemkaaas/indy-sdk,korsimoro/indy-sdk,srottem/indy-sdk,peacekeeper/indy-sdk,srottem/indy-sdk,peacekeeper/indy-sdk,peacekeeper/indy-sdk,peacekeeper/indy-sdk,peace...
736150f90d82a4583630b9999db94fa6afb47e10
test_samples/test_simple.py
test_samples/test_simple.py
# -*- encoding: utf-8 -*- """ """ import unittest import time class Case1(unittest.TestCase): def test_success(self): time.sleep(0.5) self.assertEqual(1, 1) def test_failure(self): time.sleep(0.5) self.assertEqual(1, 2) @unittest.skip("because") def test_skip(self):...
# -*- encoding: utf-8 -*- """ """ import unittest import time class Case1(unittest.TestCase): def test_success(self): time.sleep(0.5) self.assertEqual(1, 1) def test_failure(self): time.sleep(0.5) self.assertEqual(1, 2) @unittest.skip("because") def test_skip(self):...
Add a sample of erroneous test.
Add a sample of erroneous test.
Python
bsd-2-clause
nicolasdespres/hunittest
5dec9add35697dc77e2351bb076da90c6b56ea8d
oauth2_provider/utils.py
oauth2_provider/utils.py
import uuid import hashlib def short_hash(): """ Generate a unique short hash (40 bytes) which is suitable as a token, secret or id """ return hashlib.sha1(uuid.uuid1().get_bytes()).hexdigest() def long_hash(): """ Generate a unique long hash (128 bytes) which is suitable as a token, secret ...
import uuid import hashlib def short_hash(): """ Generate a unique short hash (40 bytes) which is suitable as a token, secret or id """ return hashlib.sha1(uuid.uuid1().bytes).hexdigest() def long_hash(): """ Generate a unique long hash (128 bytes) which is suitable as a token, secret or id ...
Use bytes property with UUID objects
Use bytes property with UUID objects
Python
bsd-2-clause
JensTimmerman/django-oauth-toolkit,trbs/django-oauth-toolkit,vmalavolta/django-oauth-toolkit,Gr1N/django-oauth-toolkit,cheif/django-oauth-toolkit,drgarcia1986/django-oauth-toolkit,Natgeoed/django-oauth-toolkit,JensTimmerman/django-oauth-toolkit,jensadne/django-oauth-toolkit,mjrulesamrat/django-oauth-toolkit,StepicOrg/d...
f8292dced6aef64950280a33e9980a7998f07104
tests/services/shop/base.py
tests/services/shop/base.py
""" :Copyright: 2006-2020 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from testfixtures.shop_article import create_article from testfixtures.shop_shop import create_shop from tests.base import AbstractAppTestCase from tests.helpers import DEFAULT_EMAIL_CONFIG_ID class ShopTestBase(Abst...
""" :Copyright: 2006-2020 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from byceps.services.shop.article import service as article_service from testfixtures.shop_article import create_article from testfixtures.shop_shop import create_shop from tests.base import AbstractAppTestCase from t...
Create test articles via service
Create test articles via service
Python
bsd-3-clause
homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps
a7fdc9f834dec480236c397c03e7b929e74ccd80
shuup/default_reports/mixins.py
shuup/default_reports/mixins.py
# -*- coding: utf-8 -*- # This file is part of Shuup. # # Copyright (c) 2012-2017, Shoop Commerce Ltd. All rights reserved. # # This source code is licensed under the OSL-3.0 license found in the # LICENSE file in the root directory of this source tree. from django.db.models import Q from shuup.core.models import Ord...
# -*- coding: utf-8 -*- # This file is part of Shuup. # # Copyright (c) 2012-2017, Shoop Commerce Ltd. All rights reserved. # # This source code is licensed under the OSL-3.0 license found in the # LICENSE file in the root directory of this source tree. from datetime import timedelta from django.db.models import Q fr...
Include orders which are made during selected end date in reports
Include orders which are made during selected end date in reports Comparing DateTimeField with date causes lack of precision which can occur with range. This causes orders which order_date is the same date than end_date will be not included in the queryset. Fix this problem with adding one extra day to the end_date va...
Python
agpl-3.0
shoopio/shoop,shoopio/shoop,shoopio/shoop
1c9ce82c954ab206ec1b5387ef5cb49ab9c96208
additional_scripts/image-get-datastore-list.py
additional_scripts/image-get-datastore-list.py
#!/bin/python3 import os import xml.etree.ElementTree as ET oneimage = os.popen("oneimage list --xml") tree = ET.fromstring(oneimage.read()) #print(tree.tag) for image in tree.findall('./IMAGE'): imageid = image.find('./ID') print(imageid.text) for vmid in image.findall('./VMS/ID'): print(image...
#!/bin/python3 import os import xml.etree.ElementTree as ET oneimage = os.popen("oneimage list --xml") tree = ET.fromstring(oneimage.read()) #print(tree.tag) for image in tree.findall('./IMAGE'): imageid = image.find('./ID') print(imageid.text) is_persistent = image.find('./PERSISTENT') if is_persi...
Exclude persistent images in list
Exclude persistent images in list
Python
apache-2.0
zhtlancer/addon-iscsi,zhtlancer/addon-iscsi
66503b8d59a8bb5128bd05966c81fa949b4e5097
__init__.py
__init__.py
######################################################################## # # # This script was written by Thomas Heavey in 2017. # # theavey@bu.edu thomasjheavey@gmail.com # # ...
######################################################################## # # # This script was written by Thomas Heavey in 2017. # # theavey@bu.edu thomasjheavey@gmail.com # # ...
Check python version and possibly only import some things
Check python version and possibly only import some things
Python
apache-2.0
theavey/ParaTemp,theavey/ParaTemp
09dc09d88d04d2926e3ffc116cf5606aaf3dc681
salt/modules/win_wusa.py
salt/modules/win_wusa.py
# -*- coding: utf-8 -*- ''' Microsoft Update files management via wusa.exe :maintainer: Thomas Lemarchand :platform: Windows :depends: PowerShell ''' # Import python libs from __future__ import absolute_import import logging # Import salt libs import salt.utils.platform log = logging.getLogger(__name...
# -*- coding: utf-8 -*- ''' Microsoft Update files management via wusa.exe :maintainer: Thomas Lemarchand :platform: Windows :depends: PowerShell ''' # Import python libs from __future__ import absolute_import import logging # Import salt libs import salt.utils.platform log = logging.getLogger(__name...
Disable powershell modules list Add list_kbs function
Disable powershell modules list Add list_kbs function
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
4f67141cfabe99af99434364e13fec91bef291a7
grip/constants.py
grip/constants.py
# The supported extensions, as defined by https://github.com/github/markup supported_extensions = ['.md', '.markdown'] # The default filenames when no file is provided default_filenames = map(lambda ext: 'README' + ext, supported_extensions)
# The supported extensions, as defined by https://github.com/github/markup supported_extensions = [ '.markdown', '.mdown', '.mkdn', '.md', '.textile', '.rdoc', '.org', '.creole', '.mediawiki', '.wiki', '.rst', '.asciidoc', '.adoc', '.asc', '.pod', ] # The default filenames when no ...
Add the GitHub-supported format extensions.
Add the GitHub-supported format extensions.
Python
mit
ssundarraj/grip,joeyespo/grip,ssundarraj/grip,jbarreras/grip,jbarreras/grip,joeyespo/grip,mgoddard-pivotal/grip,mgoddard-pivotal/grip
0174384553e22046438305d9accb735cc4a8f273
src/Flask/venv/demo/app/main.py
src/Flask/venv/demo/app/main.py
from flask import Flask, render_template from flask_socketio import SocketIO, send, emit app = Flask(__name__, template_folder='./templates') # Websocket setting app.config['SECRET_KEY'] = '12qwaszx' socketio = SocketIO(app) @app.route('/') def index(): return render_template('index.html') # @app.route('/<s...
from flask import Flask, render_template, request, jsonify from flask_socketio import SocketIO, send, emit import json app = Flask(__name__, template_folder='./templates') # Websocket setting app.config['SECRET_KEY'] = '12qwaszx' socketio = SocketIO(app) @app.route('/') def index(): return render_template('inde...
Create a broadcast api: send
Create a broadcast api: send
Python
mit
KarateJB/Python.Practice,KarateJB/Python.Practice,KarateJB/Python.Practice,KarateJB/Python.Practice
a40415604a9a8bbdc7833d850c4f74d66236d334
systemvm/patches/debian/config/opt/cloud/bin/cs_staticroutes.py
systemvm/patches/debian/config/opt/cloud/bin/cs_staticroutes.py
# -- coding: utf-8 -- # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "Li...
# -- coding: utf-8 -- # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "Li...
Make deleting static routes in private gw work
CLOUDSTACK-9266: Make deleting static routes in private gw work
Python
apache-2.0
jcshen007/cloudstack,DaanHoogland/cloudstack,wido/cloudstack,GabrielBrascher/cloudstack,wido/cloudstack,wido/cloudstack,DaanHoogland/cloudstack,GabrielBrascher/cloudstack,DaanHoogland/cloudstack,GabrielBrascher/cloudstack,GabrielBrascher/cloudstack,GabrielBrascher/cloudstack,DaanHoogland/cloudstack,jcshen007/cloudstack...
de3218c662f5fa98dac57e7f875cbe49efbc1b78
time_lapse.py
time_lapse.py
#!/usr/bin/env python import time import picamera from settings import Job, IMAGES_DIRECTORY def main(): job = Job() if job.exists(): resolution_x = job.image_settings.resolution_x resolution_y = job.image_settings.resolution_y image_quality = job.image_settings.quality snap_i...
#!/usr/bin/env python import time import picamera from settings import Job, IMAGES_DIRECTORY def main(): job = Job() if job.exists(): resolution_x = job.image_settings.resolution_x resolution_y = job.image_settings.resolution_y image_quality = job.image_settings.quality snap_i...
Add image prefix for job settings
Add image prefix for job settings
Python
mit
projectweekend/Pi-Camera-Time-Lapse,projectweekend/Pi-Camera-Time-Lapse
ce4ee9558ed0c53e03cb31627c597d5388b56ffa
docs/examples/compute/cloudstack/start_interactive_shell_ikoula.py
docs/examples/compute/cloudstack/start_interactive_shell_ikoula.py
import os from IPython.terminal.embed import InteractiveShellEmbed from libcloud.compute.types import Provider from libcloud.compute.providers import get_driver import libcloud.security as sec sec.VERIFY_SSL_CERT = False apikey = os.getenv('IKOULA_API_KEY') secretkey = os.getenv('IKOULA_SECRET_KEY') Driver = get_d...
import os from IPython.terminal.embed import InteractiveShellEmbed from libcloud.compute.types import Provider from libcloud.compute.providers import get_driver apikey = os.getenv('IKOULA_API_KEY') secretkey = os.getenv('IKOULA_SECRET_KEY') Driver = get_driver(Provider.IKOULA) conn = Driver(key=apikey, secret=secr...
Update example, no need to disable cert validation.
docs: Update example, no need to disable cert validation.
Python
apache-2.0
briancurtin/libcloud,Cloud-Elasticity-Services/as-libcloud,niteoweb/libcloud,lochiiconnectivity/libcloud,wrigri/libcloud,apache/libcloud,JamesGuthrie/libcloud,atsaki/libcloud,andrewsomething/libcloud,wido/libcloud,cryptickp/libcloud,Itxaka/libcloud,iPlantCollaborativeOpenSource/libcloud,mistio/libcloud,sahildua2305/lib...
a0f9275912d3dfd9edd4e8d0377f04972c919338
lino_book/projects/team/try_people_api.py
lino_book/projects/team/try_people_api.py
import requests from apiclient.discovery import build from lino.api import rt user = rt.models.users.User.objects.get(username='luc') social = user.social_auth.get(provider='google-plus') print(social.provider) response = requests.get( 'https://www.googleapis.com/plus/v1/people/me/people/collection', # 'http...
from apiclient.discovery import build from oauth2client.client import OAuth2Credentials from django.conf import settings from datetime import datetime import httplib2 from lino.api import rt user = rt.models.users.User.objects.get(username='8618a3571d8b4237a3e60d25671d8f') social = user.social_auth.get(provider='goog...
Make the sample work by retrieving all contacts.
Make the sample work by retrieving all contacts.
Python
unknown
lsaffre/lino_book,khchine5/book,lino-framework/book,lsaffre/lino_book,lino-framework/book,lino-framework/book,lino-framework/book,khchine5/book,khchine5/book,lsaffre/lino_book
be2d33152c07594465c9b838c060edeaa8bc6ddc
tests/main.py
tests/main.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest from ParseArticleReferenceTest import ParseArticleReferenceTest from SortReferencesVisitorTest import SortReferencesVisitorTest from ParseEditTest import ParseEditTest from ParseAlineaReferenceTest import ParseAlineaReferenceTest from ParseAlineaDefinition...
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest from ParseArticleReferenceTest import ParseArticleReferenceTest from SortReferencesVisitorTest import SortReferencesVisitorTest from ParseEditTest import ParseEditTest from ParseAlineaReferenceTest import ParseAlineaReferenceTest from ParseAlineaDefinition...
Fix broken reference to ParseSentenceDefinitionTest.
Fix broken reference to ParseSentenceDefinitionTest.
Python
mit
Legilibre/duralex
e73409c17c89ef54f5c7e807059b229517e77617
mailchute/smtpd/mailchute.py
mailchute/smtpd/mailchute.py
import datetime import smtpd from email.parser import Parser from mailchute import db from mailchute import settings from mailchute.model import RawMessage, IncomingEmail from logbook import Logger logger = Logger(__name__) class MessageProcessor(object): def _should_persist(self, recipient): allowed_re...
import datetime import smtpd from email.parser import Parser from mailchute import db from mailchute import settings from mailchute.model import RawMessage, IncomingEmail from logbook import Logger logger = Logger(__name__) class MessageProcessor(object): def _should_persist(self, recipient): recipient_...
Handle multiple receiver domain properly
Handle multiple receiver domain properly
Python
bsd-3-clause
kevinjqiu/mailchute,kevinjqiu/mailchute
cfc9c21121f06007dd582fe6cd0162e4df2a21d5
tests/test_cle_gdb.py
tests/test_cle_gdb.py
import angr import os import nose test_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../binaries/tests')) binpath = os.path.join(test_location, "x86_64/test_gdb_plugin") def check_addrs(p): libc = p.loader.shared_objects['libc.so.6'] ld = p.loade...
import angr import os import nose test_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../binaries/tests')) binpath = os.path.join(test_location, "x86_64/test_gdb_plugin") def check_addrs(p): libc = p.loader.shared_objects['libc.so.6'] ld = p.loade...
Test fix. rebase_addr to mapped_base
fix: Test fix. rebase_addr to mapped_base
Python
bsd-2-clause
schieb/angr,iamahuman/angr,iamahuman/angr,f-prettyland/angr,axt/angr,f-prettyland/angr,angr/angr,tyb0807/angr,chubbymaggie/angr,axt/angr,tyb0807/angr,schieb/angr,schieb/angr,angr/angr,tyb0807/angr,chubbymaggie/angr,chubbymaggie/angr,iamahuman/angr,angr/angr,f-prettyland/angr,axt/angr
a3674958a046de711e37445d39afd4e529d8dd09
bin/run_t2r_trainer.py
bin/run_t2r_trainer.py
# coding=utf-8 # Copyright 2020 The Tensor2Robot 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 ...
# coding=utf-8 # Copyright 2020 The Tensor2Robot 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 ...
Print gin config includes and imports when starting training.
Print gin config includes and imports when starting training. PiperOrigin-RevId: 342367820
Python
apache-2.0
google-research/tensor2robot
0068c9da4b8af1d51928ce3d2f326130dbf342f2
_scripts/cfdoc_bootstrap.py
_scripts/cfdoc_bootstrap.py
#!/usr/bin/python # The MIT License (MIT) # # Copyright (c) 2013 CFEngine AS # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # ...
#!/usr/bin/python # The MIT License (MIT) # # Copyright (c) 2013 CFEngine AS # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # ...
Fix environment.validate() being called without branch name.
Fix environment.validate() being called without branch name.
Python
mit
michaelclelland/documentation-generator,stweil/documentation-generator,stweil/documentation-generator,nickanderson/documentation-generator,cfengine/documentation-generator,michaelclelland/documentation-generator,cfengine/documentation-generator,nickanderson/documentation-generator,michaelclelland/documentation-generato...
3364747195f0f3d2711169fb92c250fc10823d82
default_settings.py
default_settings.py
# Copyright 2014 0xc0170 # # 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, soft...
# Copyright 2014 0xc0170 # # 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, soft...
Add message if you're using default settings
Add message if you're using default settings
Python
apache-2.0
0xc0170/valinor,sarahmarshy/project_generator,autopulated/valinor,ARMmbed/valinor,sg-/project_generator,ohagendorf/project_generator,molejar/project_generator,aethaniel/project_generator,0xc0170/project_generator,sg-/project_generator,project-generator/project_generator,hwfwgrp/project_generator
7f1ae8ac882dff05332e9f98f5b6396224392723
api/libs/spec_validation.py
api/libs/spec_validation.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function from django.core.exceptions import ValidationError from polyaxon_schemas.exceptions import PolyaxonfileError, PolyaxonConfigurationError from polyaxon_schemas.polyaxonfile.specification import GroupSpecification def validate_spe...
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function from django.core.exceptions import ValidationError from polyaxon_schemas.exceptions import PolyaxonfileError, PolyaxonConfigurationError from polyaxon_schemas.polyaxonfile.specification import GroupSpecification def validate_spe...
Raise validation error if spec is in local run mode
Raise validation error if spec is in local run mode
Python
apache-2.0
polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon
dc251707fdcd9fe021b6f8627ffbb139d42423b3
cairis/test/CairisDaemonTestCase.py
cairis/test/CairisDaemonTestCase.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may...
Change database init script for daemon tests
Change database init script for daemon tests
Python
apache-2.0
nathanbjenx/cairis,nathanbjenx/cairis,nathanbjenx/cairis,failys/CAIRIS,failys/CAIRIS,failys/CAIRIS,nathanbjenx/cairis
d705c4ffbe60a11a0cde55f5caa2324349366bab
irctest/optional_extensions.py
irctest/optional_extensions.py
import unittest import operator import itertools class NotImplementedByController(unittest.SkipTest, NotImplementedError): def __str__(self): return 'Not implemented by controller: {}'.format(self.args[0]) class OptionalExtensionNotSupported(unittest.SkipTest): def __str__(self): return 'Unsup...
import unittest import operator import collections class NotImplementedByController(unittest.SkipTest, NotImplementedError): def __str__(self): return 'Not implemented by controller: {}'.format(self.args[0]) class OptionalExtensionNotSupported(unittest.SkipTest): def __str__(self): return 'Uns...
Fix output of skipped tests.
Fix output of skipped tests.
Python
mit
ProgVal/irctest
69f0b89c306b6a616e3db2716669a2aa04453222
cogs/default.py
cogs/default.py
import time from discord.ext import commands class Default: @commands.command(aliases=['p']) async def ping(self, ctx): """Get the ping to the websocket.""" msg = await ctx.send("Pong! :ping_pong:") before = time.monotonic() await (await ctx.bot.ws.ping()) after = tim...
from discord.ext import commands class Default: @commands.command(aliases=['p']) async def ping(self, ctx): """Get the ping to the websocket.""" await ctx.send(f'Pong! :ping_pong: **{ctx.bot.latency*1000:.0f}ms**') @commands.command() async def source(self, ctx): """Get the so...
Use bot.latency for ping time
Use bot.latency for ping time
Python
mit
BeatButton/beattie,BeatButton/beattie-bot
e40e30170b76ce7761a398d6c9ee7bac1f18a621
organizer/forms.py
organizer/forms.py
from django import forms from django.core.exceptions import ValidationError from .models import Tag class TagForm(forms.ModelForm): class Meta: model = Tag exclude = tuple() def clean_name(self): return self.cleaned_data['name'].lower() def clean_slug(self): new_slug = (...
from django import forms from django.core.exceptions import ValidationError from .models import Tag class TagForm(forms.ModelForm): class Meta: model = Tag fields = '__all__' def clean_name(self): return self.cleaned_data['name'].lower() def clean_slug(self): new_slug = ...
Revert TagForm Meta fields option.
Ch07: Revert TagForm Meta fields option.
Python
bsd-2-clause
jambonrose/DjangoUnleashed-1.8,jambonrose/DjangoUnleashed-1.8
ad7d39c472130e7f06c30d06a5aed465d2e5ab2c
linter.py
linter.py
from SublimeLinter.lint import Linter, util class Cppcheck(Linter): cmd = ('cppcheck', '--template={file}:{line}: {severity}: {message}', '--inline-suppr', '--quiet', '${args}', '${file}') regex = ( r'^(?P<file>(:\\|[^:])+):(?P<line>\d+):((?P<col>\d+):)?\s+' r'((?P<error>error)|(?P<warning>war...
from SublimeLinter.lint import Linter, util class Cppcheck(Linter): cmd = ( 'cppcheck', '--template={file}:{line}: {severity}: {message}', '--inline-suppr', '--quiet', '${args}', '${file}' ) regex = ( r'^(?P<file>(:\\|[^:])+):(?P<line>\d+):((?P<col>\...
Reformat cmd to go under 120 character limit
Reformat cmd to go under 120 character limit
Python
mit
SublimeLinter/SublimeLinter-cppcheck
cf948bd38a57b459db9f37ac584207f36cb3610e
linter.py
linter.py
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Aparajita Fishman # Contributors: Francis Gulotta, Josh Hagins # Copyright (c) 2013 Aparajita Fishman # # License: MIT # """This module exports the Rubocop plugin class.""" from SublimeLinter.lint import RubyLinter ...
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Aparajita Fishman # Contributors: Francis Gulotta, Josh Hagins # Copyright (c) 2013 Aparajita Fishman # # License: MIT # """This module exports the Rubocop plugin class.""" from SublimeLinter.lint import RubyLinter ...
Add support for RubyNext and RubyExperimental
Add support for RubyNext and RubyExperimental
Python
mit
SublimeLinter/SublimeLinter-rubocop
2e9527d00358027a3f85d3087734ab4e87441fc4
reporting_scripts/user_info.py
reporting_scripts/user_info.py
''' This module will retrieve info about students registered in the course Usage: python user_info.py ''' from collections import defaultdict from base_edx import EdXConnection from generate_csv_report import CSV connection = EdXConnection('certificates_generatedcertificate', 'auth_userprofile') collection = con...
''' This module will retrieve info about students registered in the course Usage: python user_info.py ''' from collections import defaultdict from base_edx import EdXConnection from generate_csv_report import CSV connection = EdXConnection('certificates_generatedcertificate', 'auth_userprofile') collection = con...
Update to handle users with no final grade
Update to handle users with no final grade
Python
mit
andyzsf/edx_data_research,andyzsf/edx_data_research,McGillX/edx_data_research,McGillX/edx_data_research,McGillX/edx_data_research
aada9a317eb8aed5dcd8ff6731692ef25ff52a67
packtets/graph/generator.py
packtets/graph/generator.py
import igraph def packing_graph(tets, vx, vy, vz, independent = 0): N = len(tets) g = igraph.Graph() g.add_vertices(N) for i in range(N): for j in range(max(i, independent),N): for s in tets[j].get_symetry(vx, vy, vz, include_self=(i != j)): if tets[i].collision(s): ...
import igraph def packing_graph(tets, vx, vy, vz, independent = 0): N = len(tets) for i in range(N-1, independent-1, -1): for s in tets[i].get_symetry(vx, vy, vz, include_self=False): if tets[i].collision(s): del tets[i] break N = len(tets) g = igraph.Graph...
Remove self-touching tets first to reduce collision load.
Remove self-touching tets first to reduce collision load.
Python
mit
maxhutch/packtets,maxhutch/packtets
a72cf5997439533d7ce74d6c4fc50d1189466c1b
peloid/app/shell/service.py
peloid/app/shell/service.py
from twisted.cred import portal from twisted.conch.checkers import SSHPublicKeyDatabase from carapace.util import ssh as util from peloid.app import mud from peloid.app.shell import gameshell, setupshell def getGameShellFactory(**namespace): """ The "namespace" kwargs here contains the passed objects that w...
from twisted.cred import portal from twisted.conch.checkers import SSHPublicKeyDatabase from carapace.util import ssh as util from peloid import const from peloid.app import mud from peloid.app.shell import gameshell, setupshell def getGameShellFactory(**namespace): """ The "namespace" kwargs here contains ...
Set initial mode to lobby.
Set initial mode to lobby.
Python
mit
oubiwann/peloid
4c2cc3c8a37082fe4d87f0a522e440cead8d2b4f
geotrek/common/migrations/0011_attachment_add_is_image.py
geotrek/common/migrations/0011_attachment_add_is_image.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.14 on 2020-02-28 17:30 from __future__ import unicode_literals from django.db import migrations import mimetypes def forward(apps, schema_editor): AttachmentModel = apps.get_model('common', 'Attachment') for attachment in AttachmentModel.objects.all(): ...
# -*- coding: utf-8 -*- # Generated by Django 1.11.14 on 2020-02-28 17:30 from __future__ import unicode_literals from django.db import migrations import mimetypes def forward(apps, schema_editor): AttachmentModel = apps.get_model('common', 'Attachment') for attachment in AttachmentModel.objects.all(): ...
Check if mt is None before spliting it
Check if mt is None before spliting it
Python
bsd-2-clause
makinacorpus/Geotrek,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin
8c19549071782f3a07f1a6f1656817bb36b00dbe
manage.py
manage.py
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "feed_to_kippt.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
#!/usr/bin/env python import os import sys import re def read_env(): """Pulled from Honcho code with minor updates, reads local default environment variables from a .env file located in the project root directory. """ try: with open('.env') as f: content = f.read() except ...
Read from local environment file if available
Read from local environment file if available
Python
mit
jpadilla/feedleap,jpadilla/feedleap
64c31f5630975a30a8187ad51566b4ff723b4d28
nengo_spinnaker/simulator.py
nengo_spinnaker/simulator.py
import sys from pacman103.core import control from pacman103 import conf from . import builder class Simulator(object): def __init__(self, model, dt=0.001, seed=None, use_serial=False): # Build the model self.builder = builder.Builder(use_serial=use_serial) self.dao = self.builder(model,...
import sys from pacman103.core import control from pacman103 import conf from . import builder class Simulator(object): def __init__(self, model, dt=0.001, seed=None, use_serial=False): # Build the model self.builder = builder.Builder() self.dao = self.builder(model, dt, seed, use_serial...
Correct `Builder.__call__` parameters when called by the `Simulator`
Correct `Builder.__call__` parameters when called by the `Simulator`
Python
mit
ctn-archive/nengo_spinnaker_2014,ctn-archive/nengo_spinnaker_2014,ctn-archive/nengo_spinnaker_2014,ctn-archive/nengo_spinnaker_2014
71d227e96eeeac09dc7fc25298600f159cf338a0
categories/serializers.py
categories/serializers.py
from .models import Category, Keyword, Subcategory from rest_framework import serializers class KeywordSerializer(serializers.ModelSerializer): class Meta: model = Keyword fields = ('pk', 'name') class KeywordListSerializer(serializers.ModelSerializer): class Meta: model ...
from .models import Category, Keyword, Subcategory from rest_framework import serializers class KeywordSerializer(serializers.ModelSerializer): class Meta: model = Keyword fields = ('pk', 'name') class KeywordListSerializer(serializers.ModelSerializer): class Meta: model ...
Add comment_required to category simple serializer
Add comment_required to category simple serializer
Python
apache-2.0
belatrix/BackendAllStars
8fce8e72f5ff40e51605f3b14bcde5006f4eaa71
molly/utils/i18n.py
molly/utils/i18n.py
from django.utils.translation import get_language from django.db.models import Model from django.conf import settings try: from django.utils.translation import override except ImportError: from django.utils.translation import activate, deactivate class override(object): def __init__(self, language,...
from django.utils.translation import get_language from django.db.models import Model from django.conf import settings from django.core.exceptions import ObjectDoesNotExist try: from django.utils.translation import override except ImportError: from django.utils.translation import activate, deactivate class ...
Fix bug in exception handling
Fix bug in exception handling
Python
apache-2.0
mollyproject/mollyproject,mollyproject/mollyproject,mollyproject/mollyproject
4148feec637dbc1b6619cd45ed14b4d4fb6f4148
sequencefinding.py
sequencefinding.py
"""Finding a sequence. Usage: sequencefinding.py NUMBERS... Arguments: NUMBERS your sequence of numbers """ import docopt def differences(a): return [t - s for s, t in zip(a, a[1:])] def constant_difference(a): if len(a) <= 1: return None if all(a[1] - a[0] == x for x in differences(a))...
"""Finding a sequence. Usage: sequencefinding.py NUMBERS... Arguments: NUMBERS your sequence of numbers """ import docopt def differences(a): return [t - s for s, t in zip(a, a[1:])] def constant_difference(a): if len(a) <= 1: return None if all(a[1] - a[0] == x for x in differences(a))...
Add fallback message when no sequence was found
Add fallback message when no sequence was found
Python
mit
joostrijneveld/sequencefinder
0e8bd8248cc649637b7c392616887c50986427a0
telethon/__init__.py
telethon/__init__.py
from .client.telegramclient import TelegramClient from .network import connection from .tl import types, functions, custom from .tl.custom import Button from . import version, events, utils, errors __version__ = version.__version__ __all__ = [ 'TelegramClient', 'Button', 'types', 'functions', 'custom', 'error...
from .client.telegramclient import TelegramClient from .network import connection from .tl import types, functions, custom from .tl.custom import Button from .tl import patched as _ # import for its side-effects from . import version, events, utils, errors __version__ = version.__version__ __all__ = [ 'TelegramC...
Fix patched module was never automatically imported
Fix patched module was never automatically imported Closes #1701. It has to be imported late in the process of `import telethon` for its side-effects.
Python
mit
LonamiWebs/Telethon,LonamiWebs/Telethon,LonamiWebs/Telethon,LonamiWebs/Telethon
2992bb8abc6844c2086ceee59a9b586b5e9a3aff
tests/integration/wheel/key.py
tests/integration/wheel/key.py
# coding: utf-8 # Import Salt Testing libs from __future__ import absolute_import import integration # Import Salt libs import salt.wheel class KeyWheelModuleTest(integration.TestCase, integration.AdaptedConfigurationTestCaseMixIn): def setUp(self): self.wheel = salt.wheel.Wheel(dict(self.get_config('cl...
# coding: utf-8 # Import Salt Testing libs from __future__ import absolute_import import integration # Import Salt libs import salt.wheel class KeyWheelModuleTest(integration.TestCase, integration.AdaptedConfigurationTestCaseMixIn): def setUp(self): self.wheel = salt.wheel.Wheel(dict(self.get_config('cl...
Fix args err in wheel test
Fix args err in wheel test
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
aec36263dac9037afa0343dcef87ae97530e1ad3
semanticizest/_semanticizer.py
semanticizest/_semanticizer.py
from collections import defaultdict import operator import six from semanticizest._util import ngrams_with_pos, tosequence class Semanticizer(object): def __init__(self, link_count, N=7): commonness = defaultdict(list) for (target, anchor), count in six.iteritems(link_count): common...
from collections import defaultdict import operator import six from semanticizest._util import ngrams_with_pos, tosequence class Semanticizer(object): def __init__(self, link_count, N=7): commonness = defaultdict(list) for (target, anchor), count in six.iteritems(link_count): common...
Return commonness instead of raw counts
Return commonness instead of raw counts
Python
apache-2.0
semanticize/semanticizest
6ba3ae92d1bf72f5076ebf35b2b370cfebb8f390
tkp/utility/redirect_stream.py
tkp/utility/redirect_stream.py
import os from tempfile import SpooledTemporaryFile from contextlib import contextmanager @contextmanager def redirect_stream(output_stream, destination): """ Redirect anything written to ``output_stream`` (typically ``sys.stdin`` or ``sys.stdout``) to ``destination`` for the duration of this context. ...
import os from tempfile import SpooledTemporaryFile from contextlib import contextmanager @contextmanager def redirect_stream(output_stream, destination): """ Redirect anything written to ``output_stream`` (typically ``sys.stdin`` or ``sys.stdout``) to ``destination`` for the duration of this context. ...
Work around XUnit assumptions about streams.
Work around XUnit assumptions about streams. Fixes #4735.
Python
bsd-2-clause
bartscheers/tkp,transientskp/tkp,mkuiack/tkp,transientskp/tkp,bartscheers/tkp,mkuiack/tkp
5e6fc0017d6e4c35338455496924616b12d4b9e1
tests/test_simple.py
tests/test_simple.py
#!/usr/bin/env python3 from nose.tools import eq_ from resumable import rebuild, split def test_simple(): @rebuild def function(original): return split(str.upper)(original) original = 'hello' original = function['function'](original) eq_(original, 'HELLO') def test_value(): @rebu...
#!/usr/bin/env python3 from nose.tools import eq_ from resumable import rebuild, value def test_simple(): @rebuild def function(original): return value(original.upper()) original = 'hello' original = function['function'](original) eq_(original, 'HELLO') def test_value(): @rebuild...
Revise tests to reflect removed split
Revise tests to reflect removed split
Python
mit
Mause/resumable
d0d823e8639c8c8c69960a2dc64ce3edfb1a7dcf
halaqat/settings/shaha.py
halaqat/settings/shaha.py
from .base_settings import * import dj_database_url import os ALLOWED_HOSTS = ['shaha-halaqat.herokuapp.com', '0.0.0.0'] db_from_env = dj_database_url.config(conn_max_age=500) DATABASES['default'].update(db_from_env) # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.9/howto/static-files/...
from .base_settings import * import dj_database_url import os ALLOWED_HOSTS = ['shaha-halaqat.herokuapp.com', '0.0.0.0'] db_from_env = dj_database_url.config(conn_max_age=500) DATABASES['default'].update(db_from_env) # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.9/howto/static-files/...
Add cached tempaltes and standard language is Ar
Add cached tempaltes and standard language is Ar
Python
mit
EmadMokhtar/halaqat,EmadMokhtar/halaqat,EmadMokhtar/halaqat
22c56941d054e083b1d406b1440efd8c0ecc5f11
tests/test_oai_harvester.py
tests/test_oai_harvester.py
from __future__ import unicode_literals import httpretty from scrapi.base import OAIHarvester from scrapi.linter import RawDocument from .utils import TEST_OAI_DOC class TestHarvester(OAIHarvester): base_url = '' long_name = 'Test' short_name = 'test' url = 'test' property_list = ['type', 'sour...
from __future__ import unicode_literals import httpretty from scrapi.base import OAIHarvester from scrapi.linter import RawDocument from .utils import TEST_OAI_DOC class TestHarvester(OAIHarvester): base_url = '' long_name = 'Test' short_name = 'test' url = 'test' property_list = ['type', 'sour...
Add dates to test OAI harvester
Add dates to test OAI harvester
Python
apache-2.0
erinspace/scrapi,felliott/scrapi,CenterForOpenScience/scrapi,icereval/scrapi,fabianvf/scrapi,mehanig/scrapi,alexgarciac/scrapi,CenterForOpenScience/scrapi,mehanig/scrapi,felliott/scrapi,jeffreyliu3230/scrapi,ostwald/scrapi,erinspace/scrapi,fabianvf/scrapi
56879634bda7c6c7024d0b9b4bf77c99e703f4f3
server.py
server.py
"""This module runs the api server.""" import os from app import flask_app, db from app.models import User, BucketList, BucketListItem from flask.ext.script import Manager, Shell from flask.ext.migrate import Migrate, MigrateCommand from flask.ext.restful import Resource, Api from app.api_v1.resources import TestResour...
"""This module runs the api server.""" import os from app import flask_app, db from app.models import User, BucketList, BucketListItem from flask.ext.script import Manager, Shell from flask.ext.migrate import Migrate, MigrateCommand from flask.ext.restful import Resource, Api from app.api_v1.resources import TestResour...
Create BucketList & BucketLists endpoints.
[Feature] Create BucketList & BucketLists endpoints.
Python
mit
andela-akiura/bucketlist
cbe07cd63d07f021ccd404cba2bcfe2a6933457b
tests/test_misc.py
tests/test_misc.py
# -*- coding: utf-8 -*- import billboard import unittest from nose.tools import raises from requests.exceptions import ConnectionError import six class MiscTest(unittest.TestCase): @raises(ConnectionError) def test_timeout(self): """Checks that using a very small timeout prevents connection.""" ...
# -*- coding: utf-8 -*- import billboard import unittest from nose.tools import raises from requests.exceptions import ConnectionError import six class MiscTest(unittest.TestCase): @raises(ConnectionError) def test_timeout(self): """Checks that using a very small timeout prevents connection.""" ...
Add test for tests function
Add test for tests function
Python
mit
guoguo12/billboard-charts,guoguo12/billboard-charts
476d8663b8b85ca902703eeee697ae5be0eefabb
lc0118_pascal_triangle.py
lc0118_pascal_triangle.py
"""Leetcode 118. Pascal's Triangle Easy URL: https://leetcode.com/problems/pascals-triangle/ Given a non-negative integer numRows, generate the first numRows of Pascal's triangle. In Pascal's triangle, each number is the sum of the two numbers directly above it. Example: Input: 5 Output: [ [1], [1,1], ...
"""Leetcode 118. Pascal's Triangle Easy URL: https://leetcode.com/problems/pascals-triangle/ Given a non-negative integer numRows, generate the first numRows of Pascal's triangle. In Pascal's triangle, each number is the sum of the two numbers directly above it. Example: Input: 5 Output: [ [1], [1,1], ...
Refactor by using array T
Refactor by using array T
Python
bsd-2-clause
bowen0701/algorithms_data_structures
c7372b1fa7f631fbad6381b8ceeadafa0ec02f36
kpi/migrations/0020_add_validate_submissions_permission_to_asset.py
kpi/migrations/0020_add_validate_submissions_permission_to_asset.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import jsonfield.fields class Migration(migrations.Migration): dependencies = [ ('kpi', '0017_assetversion_uid_aliases_20170608'), ] operations = [ migrations.AlterModelOptions( ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import jsonfield.fields class Migration(migrations.Migration): dependencies = [ ('kpi', '0019_add_report_custom_field'), ] operations = [ migrations.AlterModelOptions( na...
Rename conflicting migration and remove extra
Rename conflicting migration and remove extra changes autogenerated by `./manage.py makemigrations`
Python
agpl-3.0
kobotoolbox/kpi,kobotoolbox/kpi,onaio/kpi,onaio/kpi,onaio/kpi,kobotoolbox/kpi,kobotoolbox/kpi,onaio/kpi,kobotoolbox/kpi
f813f72ad02bbf4b8e4ad0b190064879f6c3df3e
toolbox/metrics.py
toolbox/metrics.py
import keras.backend as K import numpy as np def psnr(y_true, y_pred): """Peak signal-to-noise ratio averaged over samples and channels.""" mse = K.mean(K.square(y_true - y_pred), axis=(1, 2)) return K.mean(20 * K.log(255 / K.sqrt(mse)) / np.log(10)) def ssim(y_true, y_pred): """structural similarit...
import keras.backend as K import numpy as np def psnr(y_true, y_pred): """Peak signal-to-noise ratio averaged over samples.""" mse = K.mean(K.square(y_true - y_pred), axis=(-3, -2, -1)) return K.mean(20 * K.log(255 / K.sqrt(mse)) / np.log(10)) def ssim(y_true, y_pred): """structural similarity measu...
Change how PSNR is computed
Change how PSNR is computed
Python
mit
qobilidop/srcnn,qobilidop/srcnn
a14a911ae49d8354f61426cee2925b2a24a9b521
Alerters/nc.py
Alerters/nc.py
try: import pync pync_available = True except ImportError: pync_available = False from .alerter import Alerter class NotificationCenterAlerter(Alerter): """Send alerts to the Mac OS X Notification Center.""" def __init__(self, config_options): Alerter.__init__(self, config_options) ...
try: import pync pync_available = True except ImportError: pync_available = False import platform from .alerter import Alerter class NotificationCenterAlerter(Alerter): """Send alerts to the Mac OS X Notification Center.""" def __init__(self, config_options): Alerter.__init__(self, confi...
Add check for running on Mac OS X
Add check for running on Mac OS X
Python
bsd-3-clause
jamesoff/simplemonitor,jamesoff/simplemonitor,jamesoff/simplemonitor,jamesoff/simplemonitor,jamesoff/simplemonitor
e3c1819b6b5ddec1ff326c3693d48ec8a8b3a834
fantail/tests/__init__.py
fantail/tests/__init__.py
# This is imported from setup.py and the test script tests_require = [ 'pytest', 'pytest-capturelog', 'pytest-cov', ]
# This is imported from setup.py and the test script tests_require = [ 'coveralls', 'pytest', 'pytest-capturelog', 'pytest-cov', ]
Add coveralls to test requirements
Add coveralls to test requirements
Python
bsd-2-clause
sjkingo/fantail,sjkingo/fantail,sjkingo/fantail
319d6cb62c55d4eec124d9872d491aebaaad468a
froide/publicbody/search_indexes.py
froide/publicbody/search_indexes.py
from haystack import indexes from haystack import site from publicbody.models import PublicBody class PublicBodyIndex(indexes.SearchIndex): text = indexes.CharField(document=True, use_template=True) name = indexes.CharField(model_attr='name') geography = indexes.CharField(model_attr='geography') topi...
from haystack import indexes from haystack import site from publicbody.models import PublicBody class PublicBodyIndex(indexes.SearchIndex): text = indexes.EdgeNgramField(document=True, use_template=True) name = indexes.CharField(model_attr='name') geography = indexes.CharField(model_attr='geography') ...
Make Public Body document search an EdgeNgram Field to improve search
Make Public Body document search an EdgeNgram Field to improve search
Python
mit
ryankanno/froide,stefanw/froide,fin/froide,okfse/froide,LilithWittmann/froide,CodeforHawaii/froide,catcosmo/froide,catcosmo/froide,CodeforHawaii/froide,LilithWittmann/froide,ryankanno/froide,okfse/froide,LilithWittmann/froide,catcosmo/froide,CodeforHawaii/froide,ryankanno/froide,catcosmo/froide,okfse/froide,LilithWittm...
5556c3c0b4fc55f17de1f3d8d96288746a36775a
src/server/main.py
src/server/main.py
from twisted.internet.task import LoopingCall from twisted.python import log as twistedLog from src.shared import config from src.server.game_state_manager import GameStateManager from src.server.networking import runServer, ConnectionManager from src.server.stdio import setupStdio def main(args): connections = C...
from twisted.internet import reactor from twisted.internet.task import LoopingCall from twisted.python import log as twistedLog from src.shared import config from src.server.game_state_manager import GameStateManager from src.server.networking import runServer, ConnectionManager from src.server.stdio import setupStdio...
Bring down the server on (some?) uncaught errors.
Bring down the server on (some?) uncaught errors. I added an errback to the LoopingCall for gameStateManager.tick, so it'll be called if any exception gets raised out of one of those calls. The errback just prints a traceback and then brings down the server, ensuring that other clients get disconnected as well. This ...
Python
mit
CheeseLord/warts,CheeseLord/warts
a25e6fb5f9e63ffa30a6c655a6775eead4206bcb
setup.py
setup.py
from distutils.core import setup import os, glob, string, shutil # Packages packages = ['neuroimaging', 'neuroimaging.statistics', 'neuroimaging.image', 'neuroimaging.reference', 'neuroimaging.data', 'neuroimaging.image.formats', 'neuroimaging.image.formats.analyze', 'neuroimaging.fmri', 'neuroimaging.fmri.fmristat',...
import os, glob, string, shutil from distutils.core import setup # Packages packages = ['neuroimaging', 'neuroimaging.statistics', 'neuroimaging.image', 'neuroimaging.reference', 'neuroimaging.data', 'neuroimaging.image.formats', 'neuroimaging.image.formats.analyze', 'neuroimaging.fmri', 'neuroimaging.fmri.fmristat',...
Test edit - to check svn email hook
Test edit - to check svn email hook
Python
bsd-3-clause
gef756/statsmodels,kiyoto/statsmodels,hainm/statsmodels,wdurhamh/statsmodels,detrout/debian-statsmodels,kiyoto/statsmodels,cbmoore/statsmodels,edhuckle/statsmodels,alekz112/statsmodels,hainm/statsmodels,bsipocz/statsmodels,phobson/statsmodels,huongttlan/statsmodels,ChadFulton/statsmodels,wkfwkf/statsmodels,josef-pkt/st...
2251ef09b75b60268b6d28ff4ec5a04e8eef209f
setup.py
setup.py
#!/usr/bin/env python from distutils.core import setup import os from deflect import __version__ as version def read_file(filename): """ Utility function to read a provided filename. """ return open(os.path.join(os.path.dirname(__file__), filename)).read() packages = [ 'deflect', 'deflect....
#!/usr/bin/env python from distutils.core import setup import os from deflect import __version__ as version def read_file(filename): """ Utility function to read a provided filename. """ return open(os.path.join(os.path.dirname(__file__), filename)).read() packages = [ 'deflect', 'deflect....
Expand trove classifiers and keywords
Expand trove classifiers and keywords
Python
bsd-3-clause
jbittel/django-deflect
b8688879de84b405d8c54add3ca793df54e2f39a
bin/finnpos-restore-lemma.py
bin/finnpos-restore-lemma.py
#! /usr/bin/env python3 from sys import stdin for line in stdin: line = line.strip() if line == '': print('') else: wf, feats, lemma, label, ann = line.split('\t') lemmas = ann if ann.find(' ') != -1: lemmas = ann[:ann.find(' ')] ann = [ann.find(' ...
#! /usr/bin/env python3 from sys import stdin def part_count(lemma): return lemma.count('#') def compile_dict(label_lemma_pairs): res = {} for label, lemma in label_lemma_pairs: if label in res: old_lemma = res[label] if part_count(old_lemma) > part_count(lemma): ...
Choose lemma with fewest parts.
Choose lemma with fewest parts.
Python
apache-2.0
mpsilfve/FinnPos,mpsilfve/FinnPos,mpsilfve/FinnPos,mpsilfve/FinnPos
f40fca40d5e09d7ae64acab1258f58cea6810662
setup.py
setup.py
from numpy.distutils.core import setup from numpy.distutils.misc_util import Configuration from numpy.distutils.system_info import get_info from os.path import join flags = ['-W', '-Wall', '-march=opteron', '-O3'] def configuration(parent_package='', top_path=None): config = Configuration('scattering', parent_pac...
from numpy.distutils.core import setup from numpy.distutils.misc_util import Configuration from numpy.distutils.system_info import get_info from os.path import join flags = ['-W', '-Wall', '-march=opteron', '-O3'] def configuration(parent_package='', top_path=None): config = Configuration('scattering', parent_pac...
Add a version number for scattering.
Add a version number for scattering.
Python
bsd-2-clause
dopplershift/Scattering
6fd8bf7a3113c82c88325dd04fe610ba10049855
setup.py
setup.py
#!/usr/bin/env python from distutils.core import setup long_description = ''' This module allows you to perform IP subnet calculations, there is support for both IPv4 and IPv6 CIDR notation. ''' setup(name='ipcalc', version='0.4', description='IP subnet calculator', long_description=long_descriptio...
#!/usr/bin/env python from distutils.core import setup setup(name='ipcalc', version='0.4', description='IP subnet calculator', long_description=file('README.rst').read(), author='Wijnand Modderman', author_email='python@tehmaze.com', url='http://dev.tehmaze.com/projects/ipcalc', ...
Read README.rst for the long description
Read README.rst for the long description
Python
bsd-2-clause
panaceya/ipcalc,tehmaze/ipcalc
8651c367d05798323e33066c520cf8e988937a78
setup.py
setup.py
#!/usr/bin/env python import sys, os sys.path.insert(0, os.path.join(os.getcwd(),'lib')) from distutils.core import setup import simpletal setup(name="SimpleTAL", version= simpletal.__version__, description="SimpleTAL is a stand alone Python implementation of the TAL, TALES and METAL specifications used in Zope ...
#!/usr/bin/env python import sys, os sys.path.insert(0, os.path.join(os.getcwd(),'lib')) from distutils.core import setup import simpletal setup(name="SimpleTAL", version= simpletal.__version__, description="SimpleTAL is a stand alone Python implementation of the TAL, TALES and METAL specifications used in Zope ...
Add download_url so the package can be located from PyPI.
Add download_url so the package can be located from PyPI.
Python
bsd-3-clause
g2p/SimpleTAL
33f28ad9ba7c6eeec1f85be43863ea4c7b04128f
setup.py
setup.py
from distutils.core import setup, Extension setup ( name='PPeg', version='0.9', description="A Python port of Lua's LPeg pattern matching library", url='https://bitbucket.org/pmoore/ppeg', author='Paul Moore', license='MIT', classifiers=[ 'Development Status :: 3 - A...
from distutils.core import setup, Extension setup ( name='PPeg', version='0.9', description="A Python port of Lua's LPeg pattern matching library", url='https://bitbucket.org/pmoore/ppeg', author='Paul Moore', license='MIT', classifiers=[ 'Development Status :: 3 - A...
Add lpeg.c to _ppeg.c dependencies
Add lpeg.c to _ppeg.c dependencies
Python
mit
moreati/ppeg,moreati/ppeg
2e56f7674191aca7a03ede8586f2e18abb617a0b
polling_stations/apps/addressbase/management/commands/import_cleaned_addresses.py
polling_stations/apps/addressbase/management/commands/import_cleaned_addresses.py
import os import glob from django.apps import apps from django.db import connection from django.core.management.base import BaseCommand class Command(BaseCommand): """ Turn off auto system check for all apps We will maunally run system checks only for the 'addressbase' and 'pollingstations' apps ...
import os import glob from django.apps import apps from django.db import connection from django.core.management.base import BaseCommand class Command(BaseCommand): """ Turn off auto system check for all apps We will maunally run system checks only for the 'addressbase' and 'pollingstations' apps ...
Truncate address table before import, only import from one file
Truncate address table before import, only import from one file
Python
bsd-3-clause
chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations
642f3109cb9fb6179d51de7a7d5781044ff6be3b
satori.core/satori/core/__init__.py
satori.core/satori/core/__init__.py
# vim:ts=4:sts=4:sw=4:expandtab """The core of the system. Manages the database and operational logic. Functionality is exposed over Thrift. """ import os def manage(): from django.core.management import execute_manager import satori.core.settings # HACK import django.core.management old_fmm = ...
# vim:ts=4:sts=4:sw=4:expandtab """The core of the system. Manages the database and operational logic. Functionality is exposed over Thrift. """ import sys import os def manage(): from django.core.management import execute_manager settings_module_name = os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sator...
Allow specification of custom settings module using DJANGO_SETTINGS_MODULE environment variable.
Allow specification of custom settings module using DJANGO_SETTINGS_MODULE environment variable.
Python
mit
zielmicha/satori,zielmicha/satori,zielmicha/satori,zielmicha/satori,zielmicha/satori,zielmicha/satori,zielmicha/satori
6054f2a103639dc1da51ddd4d63777a9d728a9ba
hr/admin.py
hr/admin.py
from django.contrib import admin from django.contrib.auth.models import User from django.contrib.auth.admin import UserAdmin from hr.models import Application, Recommendation, Audit, Blacklist, BlacklistSource class ApplicationAdmin(admin.ModelAdmin): list_display = ('user', 'character', 'corporation', 'status', '...
from django.contrib import admin from django.contrib.auth.models import User from django.contrib.auth.admin import UserAdmin from hr.models import Application, Recommendation, Audit, Blacklist, BlacklistSource class ApplicationAdmin(admin.ModelAdmin): list_display = ('user', 'character', 'corporation', 'status', '...
Add searchfield Blacklists, and use count() for recommendation count
Add searchfield Blacklists, and use count() for recommendation count
Python
bsd-3-clause
nikdoof/test-auth
79f1f198820f74a62501fc572b2f1162eafede2e
tests.py
tests.py
#!/usr/bin/env python """Test UW Menu Flask application.""" import unittest from uwmenu import app, attach_filters class UWMenuTestCase(unittest.TestCase): def setUp(self): attach_filters() app.config['TESTING'] = True self.app = app.test_client() def tearDown(self): pass ...
#!/usr/bin/env python """Test UW Menu Flask application.""" import json import unittest from uwmenu import app, attach_filters class UWMenuTestCase(unittest.TestCase): def setUp(self): attach_filters() app.config['TESTING'] = True self.app = app.test_client() def tearDown(self): ...
Add test for API endpoint
Add test for API endpoint
Python
mit
alykhank/FoodMenu,alykhank/FoodMenu,alykhank/FoodMenu
e7f923488ebf589aa78f7dc37792ffba3fffd2a3
pyinfra_kubernetes/defaults.py
pyinfra_kubernetes/defaults.py
DEFAULTS = { # Install 'kubernetes_version': None, # must be provided 'kubernetes_download_base_url': 'https://dl.k8s.io', 'kubernetes_install_dir': '/usr/local/kubernetes', 'kubernetes_bin_dir': '/usr/local/bin', 'kubernetes_conf_dir': '/etc/kubernetes', # Config 'kubernetes_service_c...
DEFAULTS = { # Install 'kubernetes_version': None, # must be provided 'kubernetes_download_base_url': 'https://dl.k8s.io', 'kubernetes_install_dir': '/usr/local/kubernetes', 'kubernetes_bin_dir': '/usr/local/bin', 'kubernetes_conf_dir': '/etc/kubernetes', # Config 'kubernetes_service_c...
Update comment about default data.
Update comment about default data.
Python
mit
EDITD/pyinfra-kubernetes,EDITD/pyinfra-kubernetes
3f7ccf17528b91b0b1145ad81c3f5aad68085aa5
varify/variants/translators.py
varify/variants/translators.py
from avocado.query.translators import Translator, registry from modeltree.tree import trees class AllowNullsTranslator(Translator): """For data sources that only apply to SNPs, this translator ensures only SNPs are filtered down and not other types of variants. """ def translate(self, field, roperator...
from avocado.query.translators import Translator, registry from modeltree.tree import trees class AllowNullsTranslator(Translator): """For data sources that only apply to SNPs, this translator ensures only SNPs are filtered down and not other types of variants. """ def translate(self, field, roperator...
Exclude nulls in translator when operator is range, gt, gte
Exclude nulls in translator when operator is range, gt, gte Previously, nulls were included in all cases making it appear that null was but 0 and infinity. Now, null is effectively treated as 0. Signed-off-by: Don Naegely <e690a32c1e2176a2bfface09e204830e1b5491e3@gmail.com>
Python
bsd-2-clause
chop-dbhi/varify,chop-dbhi/varify,chop-dbhi/varify,chop-dbhi/varify
02548b44a3b5de203e4a82693288ebae4037d90e
jug/__init__.py
jug/__init__.py
# -*- coding: utf-8 -*- # vim: set ts=4 sts=4 sw=4 expandtab smartindent: # Copyright (C) 2008-2010, Luis Pedro Coelho <lpc@cmu.edu> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software withou...
# -*- coding: utf-8 -*- # vim: set ts=4 sts=4 sw=4 expandtab smartindent: # Copyright (C) 2008-2010, Luis Pedro Coelho <lpc@cmu.edu> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software withou...
Add value() to jug namespace
Add value() to jug namespace The jug namespace might need some attention.
Python
mit
unode/jug,luispedro/jug,luispedro/jug,unode/jug
ee4faf2e1a81fe400d818a5a7337cf562c968d2e
quantecon/common_messages.py
quantecon/common_messages.py
""" Warnings Module =============== Contains a collection of warning messages for consistent package wide notifications """ #-Numba-# numba_import_fail_message = "Numba import failed. Falling back to non-optimized routine."
""" Warnings Module =============== Contains a collection of warning messages for consistent package wide notifications """ #-Numba-# numba_import_fail_message = ("Numba import failed. Falling back to non-optimized routines.\n" "This will reduce the overall performance of this package.\n...
Update warning message if numba import fails
Update warning message if numba import fails
Python
bsd-3-clause
gxxjjj/QuantEcon.py,agutieda/QuantEcon.py,andybrnr/QuantEcon.py,oyamad/QuantEcon.py,QuantEcon/QuantEcon.py,andybrnr/QuantEcon.py,gxxjjj/QuantEcon.py,QuantEcon/QuantEcon.py,dingliumath/quant-econ,mgahsan/QuantEcon.py,jviada/QuantEcon.py,dingliumath/quant-econ,agutieda/QuantEcon.py,jviada/QuantEcon.py,mgahsan/QuantEcon.p...
156d6f7dd56a5f2554a425fb5a001c99656e320b
semanticize/_semanticizer.py
semanticize/_semanticizer.py
import json import subprocess class Semanticizer: ''' Wrapper for semanticizest go implementation. ''' def __init__(self, model='nl.go.model', stPath='./bin/semanticizest'): ''' Create an instance of Semanticizer. Arguments: model -- Language model created by semanticizest-dumpparse...
import json import subprocess class Semanticizer: ''' Wrapper for semanticizest go implementation. ''' def __init__(self, model='nl.go.model', stPath='./bin/semanticizest'): ''' Create an instance of Semanticizer. Arguments: model -- Language model created by semanticizest-dumpparse...
Send json to semanticizer stdin
Send json to semanticizer stdin
Python
apache-2.0
semanticize/st,semanticize/st
b0237011251815e883b4fa60839dafd513907227
forum/templatetags/forum_extras.py
forum/templatetags/forum_extras.py
from django import template from django.utils.safestring import mark_safe register = template.Library() @register.simple_tag def make_tree(posts): levels = [] depth = 0 html = '<ul>' for post in posts: try: while levels[-1] < post.left: html += '</ul></li>' ...
from django import template from django.urls import reverse from django.utils.safestring import mark_safe register = template.Library() @register.simple_tag def make_tree(posts): levels = [] depth = 0 html = '<ul>' for post in posts: try: while levels[-1] < post.left: ...
Add formatting to post tree
Add formatting to post tree
Python
mit
Kromey/akwriters,Kromey/akwriters,Kromey/akwriters,Kromey/fbxnano,Kromey/fbxnano,Kromey/fbxnano,Kromey/akwriters,Kromey/fbxnano
375513808e3fa83ff23de942aeedbd0d9cc4d1c2
tests/test_h5py.py
tests/test_h5py.py
import h5py import bitshuffle.h5 import numpy import tempfile def test_is_h5py_correctly_installed(): """ If this test fails you probably need to install h5py from source manually: $ pip install --no-binary=h5py h5py """ f = h5py.File(tempfile.gettempdir() + '/h5testfile', "w") block_size = 0...
import h5py import hdf5plugin import numpy import tempfile def test_is_h5py_correctly_installed(): """ If this test fails you probably need to install h5py from source manually: $ pip install --no-binary=h5py h5py """ f = h5py.File(tempfile.gettempdir() + '/h5testfile', "w") block_size = 0 ...
Change bitshuffle call to hdf5plugin
Change bitshuffle call to hdf5plugin
Python
bsd-3-clause
UCBerkeleySETI/blimpy,UCBerkeleySETI/blimpy
39e00164541535db2de8c8143d8728e5624f98f9
configuration/development.py
configuration/development.py
import os _basedir = os.path.abspath(os.path.dirname(__file__)) SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(_basedir, 'app.db') SECRET_KEY = 'INSECURE' MAIL_SERVER = 'localhost' MAIL_PORT = '25' MAIL_DEFAULT_SENDER = 'no-reply@localhost.localdomain' del os
import pathlib _basedir = pathlib.Path(__file__).parents[1] SQLALCHEMY_DATABASE_URI = ( 'sqlite:///' + str(_basedir.joinpath(pathlib.PurePath('app.db')).resolve()) ) SECRET_KEY = 'INSECURE' MAIL_SERVER = 'localhost' MAIL_PORT = '25' MAIL_DEFAULT_SENDER = 'no-reply@localhost.localdomain' del pathlib
Move the db back to the correct location
Move the db back to the correct location
Python
agpl-3.0
interactomix/iis,interactomix/iis
2726404284fbae6388dbf40e01b6ad5ccf1c56a2
knights/compiler.py
knights/compiler.py
import ast from .context import ContextScope from .parser import Parser from .utils import Helpers def kompile(src, raw=False, filename='<compiler>'): ''' Creates a new class based on the supplied template, and returnsit. class Template(object): def __call__(self, context): return ''...
import ast from .context import ContextScope from .parser import Parser from .utils import Helpers def kompile(src, raw=False, filename='<compiler>', **kwargs): ''' Creates a new class based on the supplied template, and returnsit. class Template(object): def __call__(self, context): ...
Add option to print astor reconstructed source of template
Add option to print astor reconstructed source of template
Python
mit
funkybob/knights-templater,funkybob/knights-templater
70e1e6cde0c31d34cbd2a0118b3215618b84a5d9
adhocracy4/projects/views.py
adhocracy4/projects/views.py
from django.shortcuts import redirect from django.views import generic from rules.contrib import views as rules_views from . import mixins, models class ProjectDetailView(rules_views.PermissionRequiredMixin, mixins.PhaseDispatchMixin, generic.DetailView): model = ...
from django.shortcuts import redirect from django.views import generic from rules.contrib import views as rules_views from . import mixins, models class ProjectDetailView(rules_views.PermissionRequiredMixin, mixins.PhaseDispatchMixin, generic.DetailView): model = ...
Remove last memberships related hooks from project
Remove last memberships related hooks from project
Python
agpl-3.0
liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4
f20dd39fd3ae739bf6460f452a5d67bc42785adf
src/ansible/urls.py
src/ansible/urls.py
from django.conf.urls import url from ansible.forms import AnsibleForm1, AnsibleForm2 from ansible.views import ( PlaybookWizard, PlaybookListView, PlaybookDetailView, ) from . import views urlpatterns = [ url(r'^create/$', PlaybookWizard.as_view([AnsibleForm1, AnsibleForm2])), url(r'^$', PlaybookListView...
from django.conf.urls import url from ansible.forms import AnsibleForm1, AnsibleForm2 from ansible.views import ( PlaybookWizard, PlaybookListView, PlaybookDetailView, PlaybookFileView ) from . import views urlpatterns = [ url(r'^create/$', PlaybookWizard.as_view([AnsibleForm1, AnsibleForm2])), url(r'...
Add playbook file detail view
Add playbook file detail view
Python
bsd-3-clause
lozadaOmr/ansible-admin,lozadaOmr/ansible-admin,lozadaOmr/ansible-admin
4ecd19f7a1a36a424021e42c64fb273d7591ef1f
haas/plugin_manager.py
haas/plugin_manager.py
# -*- coding: utf-8 -*- # Copyright (c) 2013-2014 Simon Jagoe # All rights reserved. # # This software may be modified and distributed under the terms # of the 3-clause BSD license. See the LICENSE.txt file for details. from __future__ import absolute_import, unicode_literals from .utils import find_module_by_name ...
# -*- coding: utf-8 -*- # Copyright (c) 2013-2014 Simon Jagoe # All rights reserved. # # This software may be modified and distributed under the terms # of the 3-clause BSD license. See the LICENSE.txt file for details. from __future__ import absolute_import, unicode_literals import logging from .utils import get_mo...
Add logging and raise exceptions when loading plugin factories
Add logging and raise exceptions when loading plugin factories
Python
bsd-3-clause
sjagoe/haas,itziakos/haas,sjagoe/haas,scalative/haas,itziakos/haas,scalative/haas
83c682264582a345d4c5ada0a8fd2fd540595d1e
trex/management/commands/zeiterfassung.py
trex/management/commands/zeiterfassung.py
# -*- coding: utf-8 -*- # # (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com> # # See LICENSE comming with the source of 'trex' for details. # from django.core.management.base import BaseCommand, CommandError from trex.models.project import Project from trex.utils import Zeiterfassung class Command(BaseCommand): ...
# -*- coding: utf-8 -*- # # (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com> # # See LICENSE comming with the source of 'trex' for details. # from optparse import make_option from django.core.management.base import BaseCommand, CommandError from trex.models.project import Project from trex.utils import Zeiterfassung ...
Allow to pass the encoding via a command option
Allow to pass the encoding via a command option
Python
mit
bjoernricks/trex,bjoernricks/trex
da39921f94a90e330c796e0ad9ff861e9fc5a8af
examples/tutorial_pandas.py
examples/tutorial_pandas.py
import argparse import pandas as pd from influxdb import DataFrameClient def main(host='localhost', port=8086): user = 'root' password = 'root' dbname = 'example' client = DataFrameClient(host, port, user, password, dbname) print("Create pandas DataFrame") df = pd.DataFrame(data=list(range(...
import argparse import pandas as pd from influxdb import DataFrameClient def main(host='localhost', port=8086): user = 'root' password = 'root' dbname = 'example' protocol = 'json' client = DataFrameClient(host, port, user, password, dbname) print("Create pandas DataFrame") df = pd.Data...
Add correct protocol to the Pandas client
Add correct protocol to the Pandas client @nicolajkirchhof Is this what you were talking about?
Python
mit
BenHewins/influxdb-python,BenHewins/influxdb-python,influxdb/influxdb-python,tzonghao/influxdb-python,tzonghao/influxdb-python,influxdata/influxdb-python,omki2005/influxdb-python,influxdb/influxdb-python,influxdata/influxdb-python,omki2005/influxdb-python
aaaa857642fa4ce2631fb47f3c929d3197037231
falcom/generate_pageview.py
falcom/generate_pageview.py
# Copyright (c) 2017 The Regents of the University of Michigan. # All Rights Reserved. Licensed according to the terms of the Revised # BSD License. See LICENSE.txt for details. class Pagetags: default_confidence = 100 def generate_pageview (self): return "" def add_raw_tags (self, tag_data): ...
# Copyright (c) 2017 The Regents of the University of Michigan. # All Rights Reserved. Licensed according to the terms of the Revised # BSD License. See LICENSE.txt for details. class Pagetags: def __init__ (self): self.default_confidence = 100 @property def default_confidence (self): ret...
Make default_confidence into a @property
:muscle: Make default_confidence into a @property
Python
bsd-3-clause
mlibrary/image-conversion-and-validation,mlibrary/image-conversion-and-validation
86678fce3817388641db3d0f4002b3f8d409377d
pdcupdater/tests/handler_tests/test_kerberos_auth.py
pdcupdater/tests/handler_tests/test_kerberos_auth.py
import pytest import requests_kerberos from mock import patch, Mock import pdcupdater.utils from test.test_support import EnvironmentVarGuard import os class TestKerberosAuthentication(object): @patch('os.path.exists', return_value=True) @patch('requests_kerberos.HTTPKerberosAuth') @patch('requests.get') def test...
import os from mock import patch, Mock import pdcupdater.utils class TestKerberosAuthentication(object): @patch('os.path.exists', return_value=True) @patch('requests_kerberos.HTTPKerberosAuth') @patch('requests.get') def test_get_token(self, requests_get, kerb_auth, os_path): self.url = 'htt...
Remove invalid imports for TestKerberosAuthentication and fix its styling
Remove invalid imports for TestKerberosAuthentication and fix its styling
Python
lgpl-2.1
fedora-infra/pdc-updater
3d29cad334446613180e0279cb1197fab1f77764
lib/python/setup.py
lib/python/setup.py
from sys import version from distutils.core import setup setup(name='mosquitto', version='1.0.1', description='MQTT version 3.1 client class', author='Roger Light', author_email='roger@atchoo.org', url='http://mosquitto.org/', download_url='http://mosquitto.org/files/', license='BSD License', py_modules=['mosq...
from sys import version from distutils.core import setup setup(name='mosquitto', version='1.0.1', description='MQTT version 3.1 client class', author='Roger Light', author_email='roger@atchoo.org', url='http://mosquitto.org/', download_url='http://mosquitto.org/files/', license='BSD License', py_modules=['mosq...
Add Python classifiers for PyPi.
Add Python classifiers for PyPi.
Python
bsd-3-clause
zlargon/mosquitto,zlargon/mosquitto,zlargon/mosquitto,zlargon/mosquitto,zlargon/mosquitto