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 |
|---|---|---|---|---|---|---|---|---|
4c43119cd5d231e7cfe120d3b1e0881dc1048c42 | edit library(miller-rabin) | knuu/competitive-programming,knuu/competitive-programming,knuu/competitive-programming,knuu/competitive-programming | python-library/math/prime.py | python-library/math/prime.py | class Prime:
""" make prime numbers lists
complexity: O(n^(1/2))
used in AOJ0202
"""
def __init__(self, n):
self.is_prime = [True for _ in range(n+1)]
self.primeList = []
self.is_prime[0] = self.is_prime[1] = False
for i in range(2, int(pow(n, 0.5))+1):
... | class Prime:
""" make prime numbers lists
complexity: O(n^(1/2))
used in AOJ0202
"""
def __init__(self, n):
self.is_prime = [True for _ in range(n+1)]
self.primeList = []
self.is_prime[0] = self.is_prime[1] = False
for i in range(2, int(pow(n, 0.5))+1):
... | mit | Python |
94f88b7b00ace47a19644fdc23108fdd950c1e97 | Add comment about source and license of _rewrite_shebangs.py | gem/oq-installers,gem/oq-nsis,gem/oq-installers | installers/windows/nsis/dist/_rewrite_shebangs.py | installers/windows/nsis/dist/_rewrite_shebangs.py | # Original source:
# https://github.com/takluyver/pynsist/blob/80392f24d664b08eb7f0b7e45a408575e55810fc/nsist/_rewrite_shebangs.py
# Copyright (c) 2014-2017 Thomas Kluyver under MIT license:
# https://github.com/takluyver/pynsist/blob/e01d6f08eb71bc5aa2d294f5369a736e59becd09/LICENSE
"""This is run during installat... | """This is run during installation to rewrite the shebang (#! headers) of script
files.
"""
import glob
import os.path
import sys
if sys.version_info[0] >= 3:
# What do we do if the path contains characters outside the system code page?!
b_python_exe = sys.executable.encode(sys.getfilesystemencoding())
else:
... | agpl-3.0 | Python |
9dd019c12899045faebd49bc06026c8512609c9e | Remove assert line from import | yakky/django-statictemplate,bdon/django-statictemplate,ojii/django-statictemplate | statictemplate/management/commands/statictemplate.py | statictemplate/management/commands/statictemplate.py | # -*- coding: utf-8 -*-
from contextlib import contextmanager
from django.conf import settings
try:
from django.conf.urls.defaults import patterns, url, include
except ImportError:
from django.conf.urls import patterns, url, include # pragma: no cover
from django.core.management.base import BaseCommand
from dj... | # -*- coding: utf-8 -*-
from contextlib import contextmanager
from django.conf import settings
try:
from django.conf.urls.defaults import patterns, url, include
assert all((patterns, url, include))
except ImportError:
from django.conf.urls import patterns, url, include # pragma: no cover
from django.core.m... | bsd-3-clause | Python |
a2f1bfc4a61b52042bf947ba75b444f6efa7a724 | Remove duplicate negative test of flavor_id | cisco-openstack/tempest,FujitsuEnablingSoftwareTechnologyGmbH/tempest,FujitsuEnablingSoftwareTechnologyGmbH/tempest,cisco-openstack/tempest,jaspreetw/tempest,flyingfish007/tempest,CiscoSystems/tempest,JioCloud/tempest,zsoltdudas/lis-tempest,yamt/tempest,cloudbase/lis-tempest,neerja28/Tempest,nunogt/tempest,bigswitch/te... | tempest/api/compute/flavors/test_flavors_negative.py | tempest/api/compute/flavors/test_flavors_negative.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apach... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apach... | apache-2.0 | Python |
d39776a8ace21cb1ab7985ccc7c571459b5e9af5 | use bulk create with transmissions | lsgunth/rapidsms,caktus/rapidsms,eHealthAfrica/rapidsms,peterayeni/rapidsms,caktus/rapidsms,peterayeni/rapidsms,catalpainternational/rapidsms,peterayeni/rapidsms,peterayeni/rapidsms,lsgunth/rapidsms,catalpainternational/rapidsms,caktus/rapidsms,catalpainternational/rapidsms,lsgunth/rapidsms,eHealthAfrica/rapidsms,lsgun... | rapidsms/router/db/router.py | rapidsms/router/db/router.py | from django.db.models import Q
from rapidsms.router.blocking import BlockingRouter
from rapidsms.router.db.tasks import receive, send_transmissions
class DatabaseRouter(BlockingRouter):
def queue_message(self, direction, connections, text, fields=None):
"""Create Message and Transmission objects for mes... | from django.db.models import Q
from rapidsms.router.blocking import BlockingRouter
from rapidsms.router.db.tasks import receive, send_transmissions
class DatabaseRouter(BlockingRouter):
def queue_message(self, direction, connections, text, fields=None):
"""Create Message and Transmission objects for mes... | bsd-3-clause | Python |
be02bae14a9fb217eb4ab61c4942d9bb5ccc5e01 | Clarify docstring | AustereCuriosity/astropy,mhvk/astropy,StuartLittlefair/astropy,lpsinger/astropy,AustereCuriosity/astropy,saimn/astropy,dhomeier/astropy,MSeifert04/astropy,DougBurke/astropy,funbaker/astropy,stargaser/astropy,lpsinger/astropy,funbaker/astropy,dhomeier/astropy,AustereCuriosity/astropy,MSeifert04/astropy,StuartLittlefair/... | astropy/units/format/__init__.py | astropy/units/format/__init__.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
A collection of different unit formats.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
from .base import Base
from .generic import Generic
from .console import Console
from .fits import Fits
from .latex import L... | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
A collection of different unit formats.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
from .base import Base
from .generic import Generic
from .console import Console
from .fits import Fits
from .latex import L... | bsd-3-clause | Python |
cbf0307dce466e719ab388dae50c29d5e72f60e2 | throw exception if docker_project_name not set | cboling/xos,cboling/xos,cboling/xos,cboling/xos,cboling/xos | xos/synchronizers/onboarding/steps/sync_xos.py | xos/synchronizers/onboarding/steps/sync_xos.py | import os
import sys
import base64
from django.db.models import F, Q
from xos.config import Config
from synchronizers.base.syncstep import SyncStep, DeferredException
from core.models import XOS
from xos.logger import Logger, logging
from synchronizers.base.ansible import run_template
# xosbuilder will be in steps/..
... | import os
import sys
import base64
from django.db.models import F, Q
from xos.config import Config
from synchronizers.base.syncstep import SyncStep, DeferredException
from core.models import XOS
from xos.logger import Logger, logging
from synchronizers.base.ansible import run_template
# xosbuilder will be in steps/..
... | apache-2.0 | Python |
fa7d4fadeabe28b6468833f1c01c21fde1bc2747 | Revert "adding unit test for get_force()" | joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue | hoomd/md/test-py/test_force_base.py | hoomd/md/test-py/test_force_base.py | # -*- coding: iso-8859-1 -*-
# Maintainer: jglaser
from hoomd import *
from hoomd import md;
context.initialize()
import unittest
import os
# md.pair.lj
class force_base_tests (unittest.TestCase):
def setUp(self):
print
self.s = init.create_lattice(lattice.sc(a=2.1878096788957757),n=[10,10,10]); #... | # -*- coding: iso-8859-1 -*-
# Maintainer: jglaser
from hoomd import *
from hoomd import md;
context.initialize()
import unittest
import os
# md.pair.lj
class force_base_tests (unittest.TestCase):
def setUp(self):
print
self.s = init.create_lattice(lattice.sc(a=2.1878096788957757),n=[10,10,10]); #... | bsd-3-clause | Python |
713b366b228983d9b6e33238da9d22c9aa51176a | Use the async dialogs.prompt_text api | SHA2017-badge/micropython-esp32,SHA2017-badge/micropython-esp32,SHA2017-badge/micropython-esp32,SHA2017-badge/micropython-esp32,SHA2017-badge/micropython-esp32 | esp32/modules/setup.py | esp32/modules/setup.py | # SETUP APPLICATION
# SHOWN ON FIRST BOOT
import ugfx, badge, appglue, dialogs, utime
def load_settings():
return badge.nvs_get_str("owner", "name", "")
def store_settings(nickname):
badge.nvs_set_str("owner", "name", nickname)
def is_developer(nickname):
if (nickname==""):
badge.nvs_set_str('ba... | # SETUP APPLICATION
# SHOWN ON FIRST BOOT
import ugfx, badge, appglue, dialogs, utime
# Globals
nickname = ""
def load_settings():
global nickname
nickname = badge.nvs_get_str("owner", "name", "")
def store_settings():
global nickname
nickname_new = badge.nvs_set_str("owner", "name", nickname)
... | mit | Python |
542265f78186ea2b7594afe6ca692e5fb826c367 | Bump version to 0.5.3 | Commonists/CommonsDownloader | commonsdownloader/__init__.py | commonsdownloader/__init__.py | """commonsdownloader package."""
__version__ = '0.5.3'
| """commonsdownloader package."""
__version__ = '0.5.2'
| mit | Python |
8cb34f4d88184d0c42e8c1fc41f451fa3cd5a6be | Fix undefined reference error in command line KeepKey plugin. | romanz/electrum,wakiyamap/electrum-mona,vialectrum/vialectrum,romanz/electrum,digitalbitbox/electrum,kyuupichan/electrum,asfin/electrum,pooler/electrum-ltc,vialectrum/vialectrum,kyuupichan/electrum,spesmilo/electrum,digitalbitbox/electrum,cryptapus/electrum,kyuupichan/electrum,digitalbitbox/electrum,wakiyamap/electrum-... | plugins/keepkey/cmdline.py | plugins/keepkey/cmdline.py | from electrum.plugins import hook
from electrum.util import print_msg, raw_input
from .keepkey import KeepKeyPlugin
from ..hw_wallet import CmdLineHandler
class Plugin(KeepKeyPlugin):
handler = CmdLineHandler()
@hook
def init_keystore(self, keystore):
if not isinstance(keystore, self.keystore_class... | from electrum.util import print_msg, raw_input
from .keepkey import KeepKeyPlugin
from ..hw_wallet import CmdLineHandler
class Plugin(KeepKeyPlugin):
handler = CmdLineHandler()
@hook
def init_keystore(self, keystore):
if not isinstance(keystore, self.keystore_class):
return
keys... | mit | Python |
e4b23cf4e33b1125c7d50e8675c2d7460f0ef468 | remove loopback address from allowed hosts | treehouse/livestream-django-feelings,treehouse/livestream-django-feelings,treehouse/livestream-django-feelings | feelings/feelings/deploy_settings/__init__.py | feelings/feelings/deploy_settings/__init__.py | import dj_database_url
from feelings.settings import *
def get_env_variable(var_name):
try:
return os.environ[var_name]
except KeyError:
error_msg = "Set the {} env variable".format(var_name)
if DEBUG:
warnings.war(error_msg)
else:
raise ImproperlyConfig... | import dj_database_url
from feelings.settings import *
def get_env_variable(var_name):
try:
return os.environ[var_name]
except KeyError:
error_msg = "Set the {} env variable".format(var_name)
if DEBUG:
warnings.war(error_msg)
else:
raise ImproperlyConfig... | mit | Python |
814c6f6a1e6365bb5e0d83b0d8147fc6ec7ed15e | Update resampling.py | cleverhans-lab/cleverhans,cleverhans-lab/cleverhans,cleverhans-lab/cleverhans | defenses/torch/audio/input_tranformation/resampling.py | defenses/torch/audio/input_tranformation/resampling.py | import torchaudio
import librosa
# resampling reference https://core.ac.uk/download/pdf/228298313.pdf
# resampling input transformation defense for audio
T = torchaudio.transforms
# Read audio file
audio_data = librosa.load(files, sr=16000)[0][-19456:]
audio_data = torch.tensor(audio_data).float().to(device)
# Di... | import torchaudio
import librosa
# resampling reference https://core.ac.uk/download/pdf/228298313.pdf
# resampling input transformation defense for audio
T = torchaudio.transforms
audio_data = librosa.load(files, sr=16000)[0][-19456:] # Read audio file
audio_data = torch.tensor(audio_data).float().to(device)
sample ... | mit | Python |
a1d71466d09e9e1ea2f75eae57e72e0000c65ffc | Add new-style TEMPLATES setting for tests | incuna/incuna-mail,incuna/incuna-mail | tests/run.py | tests/run.py | import sys
import django
from colour_runner.django_runner import ColourRunnerMixin
from django.conf import settings
settings.configure(
DATABASES={
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
},
MIDDLEWARE_CLASSES=(),
TEMPLATES=[
... | import sys
import django
from colour_runner.django_runner import ColourRunnerMixin
from django.conf import settings
settings.configure(
DATABASES={
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
},
MIDDLEWARE_CLASSES=(),
TEMPLATE_DIR... | bsd-2-clause | Python |
b8f4d448e126c08ae0f5d9ab178ff60a06fb02f3 | Improve readability of tex conversion | tanbur/diffalg,tanbur/desr | tex_tools.py | tex_tools.py | """
Created on Wed Aug 12 01:37:16 2015
@author: richard
"""
import re
VAR_RE = '[a-z][\d_]*'
def matrix_to_tex(matrix_):
lines = []
for line in matrix_:
lines.append(' & '.join(map(str, line)) + ' \\\\')
return '\n'.join(lines)
def _var_repler(var):
var = var.group()
if len(var) == 1:
... | """
Created on Wed Aug 12 01:37:16 2015
@author: richard
"""
import re
VAR_RE = '[a-z][\d_]*'
def matrix_to_tex(matrix_):
lines = []
for line in matrix_:
lines.append(' & '.join(map(str, line)) + ' \\\\')
return '\n'.join(lines)
def _var_repler(var):
var = var.group()
if len(var) == 1:
... | apache-2.0 | Python |
c43e8314511ae614c5d3efe8d00e9d18cd04b953 | fix bug in lookup: modified: textstore.py | li-xirong/tagrel | textstore.py | textstore.py | from util import printStatus
class RecordStore:
def __init__(self, tagfile):
printStatus('textstore.RecordStore', 'read from %s' % tagfile)
self.mapping = {}
self.tag2freq = {}
for line in open(tagfile): #.readlines():
print line.strip()
[photoid, ... | from util import printStatus
class RecordStore:
def __init__(self, tagfile):
printStatus('textstore.RecordStore', 'read from %s' % tagfile)
self.mapping = {}
self.tag2freq = {}
for line in open(tagfile): #.readlines():
[photoid, userid, tags] = line.strip().spl... | mit | Python |
20d6e123b8cc28f9600e8a20c64bfe8abbc6c3f4 | Remove comment | hfrequency/django-issue-tracker | issue_tracker/core/models.py | issue_tracker/core/models.py | from django.db import models
from django.contrib.auth.models import User
class Project(models.Model):
user = models.ForeignKey(User)
name = models.CharField(max_length=100)
version = models.CharField(max_length=15, null=True)
release_date = models.DateField(null=True)
class Issue(models.Model):
pr... | from django.db import models
from django.contrib.auth.models import User
class Project(models.Model):
user = models.ForeignKey(User)
# issue = models.ForeignKey(Issue, null=True)
name = models.CharField(max_length=100)
version = models.CharField(max_length=15, null=True)
release_date = models.DateF... | mit | Python |
434610aabb80868bf086daabaea419513a8f471d | test change | JSchatzman/django-imager,JSchatzman/django-imager,JSchatzman/django-imager | imagersite/imager_profile/models.py | imagersite/imager_profile/models.py | from django.db import models
from django.contrib.auth.models import User
import uuid
from django.db.models.signals import post_save
from django.dispatch import receiver
# Create your models here.
class ActiveUsersManager(models.Manager):
"""Active user manager."""
def get_querysets(self):
"""Get the... | from django.db import models
from django.contrib.auth.models import User
import uuid
from django.db.models.signals import post_save
from django.dispatch import receiver
# Create your models here.
class ActiveUsersManager(models.Manager):
"""Active user manager."""
def get_querysets(self):
"""Get the... | mit | Python |
6e1096efb884e813f1db3ea951d8eec551a06c6e | Add ArgsKwargs to thinc.api | spacy-io/thinc,spacy-io/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc,explosion/thinc,explosion/thinc | thinc/api.py | thinc/api.py | from .config import Config, registry
from .initializers import normal_init, uniform_init, xavier_uniform_init, zero_init
from .loss import categorical_crossentropy, L1_distance, cosine_distance
from .model import create_init, Model
from .optimizers import Adam, RAdam, SGD, Optimizer
from .schedules import cyclic_triang... | from .config import Config, registry
from .initializers import normal_init, uniform_init, xavier_uniform_init, zero_init
from .loss import categorical_crossentropy, L1_distance, cosine_distance
from .model import create_init, Model
from .optimizers import Adam, RAdam, SGD, Optimizer
from .schedules import cyclic_triang... | mit | Python |
f154aed297124b1eae6c80ae60bc2d44fd82405c | rename a variable in EventReaderBundle | alphatwirl/alphatwirl,TaiSakuma/AlphaTwirl,TaiSakuma/AlphaTwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl | AlphaTwirl/EventReader/EventReaderBundle.py | AlphaTwirl/EventReader/EventReaderBundle.py | # Tai Sakuma <tai.sakuma@cern.ch>
from EventLoop import EventLoop
##__________________________________________________________________||
class AllEvents(object):
def __call__(self, event): return True
##__________________________________________________________________||
class EventReaderBundle(object):
def ... | # Tai Sakuma <tai.sakuma@cern.ch>
from EventLoop import EventLoop
##__________________________________________________________________||
class AllEvents(object):
def __call__(self, event): return True
##__________________________________________________________________||
class EventReaderBundle(object):
def ... | bsd-3-clause | Python |
2f34e330d1d99594dab156e8d3816ba5fce8cd31 | fix test_unionfs.py | simbuerg/benchbuild,simbuerg/benchbuild | benchbuild/tests/test_unionfs.py | benchbuild/tests/test_unionfs.py | """ Testing suite for the mounting process. """
import unittest
import os
from benchbuild.project import Project
from benchbuild.utils.downloader import Wget
from benchbuild.settings import CFG
from benchbuild.utils.cmd import ls
class ProjectMock(Project):
"""
Class to get a self pointer for the project tha... | """ Testing suite for the mounting process. """
import unittest
import os
from benchbuild.project import Project
from benchbuild.utils.container import get_base_dir
from benchbuild.utils.downloader import Wget
from benchbuild.settings import CFG
from benchbuild.utils.cmd import ls
class ProjectMock(Project):
"""... | mit | Python |
c1ff243cb0eeca41f793ecf365e2fcfd053b396d | revert to template format | JNeiger/robocup-software,RoboJackets/robocup-software,RoboJackets/robocup-software,JNeiger/robocup-software,RoboJackets/robocup-software,RoboJackets/robocup-software,JNeiger/robocup-software,JNeiger/robocup-software,JNeiger/robocup-software | soccer/gameplay/plays/training/skills_practice.py | soccer/gameplay/plays/training/skills_practice.py | import robocup
import constants
import play
import skills
import tactics
# This is a file where you can learn how skills work!
class SkillsPractice(play.Play):
def __init__(self):
super().__init__(continuous=True)
# To make a robot move, use skills.move.Move(<point to move to>)
# To creat... | import robocup
import constants
import play
import skills
# This is a file where you can learn how skills work!
class SkillsPractice(play.Play):
def __init__(self):
super().__init__(continuous=True)
# To make a robot move, use skills.move.Move(<point to move to>)
# To create a point, we i... | apache-2.0 | Python |
85ef4988e1f25b586d8dff63b4ade83a2222849f | Add api_key to filtered variables. | akuseru/zulip,wdaher/zulip,jimmy54/zulip,KJin99/zulip,joshisa/zulip,sup95/zulip,Vallher/zulip,jimmy54/zulip,yocome/zulip,LeeRisk/zulip,Batterfii/zulip,kaiyuanheshang/zulip,PaulPetring/zulip,guiquanz/zulip,dxq-git/zulip,littledogboy/zulip,KJin99/zulip,aps-sids/zulip,eeshangarg/zulip,LeeRisk/zulip,xuanhan863/zulip,gigawh... | zerver/filters.py | zerver/filters.py | from __future__ import absolute_import
from django.views.debug import SafeExceptionReporterFilter
from django.http import build_request_repr
class ZulipExceptionReporterFilter(SafeExceptionReporterFilter):
def get_post_parameters(self, request):
filtered_post = SafeExceptionReporterFilter.get_post_paramet... | from __future__ import absolute_import
from django.views.debug import SafeExceptionReporterFilter
from django.http import build_request_repr
class ZulipExceptionReporterFilter(SafeExceptionReporterFilter):
def get_post_parameters(self, request):
filtered_post = SafeExceptionReporterFilter.get_post_paramet... | apache-2.0 | Python |
9d442b1b45245e5c6d43ea8ea0bed98dc055e04e | Update version | architecture-building-systems/CityEnergyAnalyst,architecture-building-systems/CityEnergyAnalyst,architecture-building-systems/CityEnergyAnalyst | cea/__init__.py | cea/__init__.py | __version__ = "2.30.0"
class ConfigError(Exception):
"""Raised when the configuration of a tool contains some invalid values."""
rc = 100 # sys.exit(rc)
class CustomDatabaseNotFound(Exception):
"""Raised when the InputLocator can't find a user-provided database (region=='custom')"""
rc = 101 # sys... | __version__ = "2.29.0"
class ConfigError(Exception):
"""Raised when the configuration of a tool contains some invalid values."""
rc = 100 # sys.exit(rc)
class CustomDatabaseNotFound(Exception):
"""Raised when the InputLocator can't find a user-provided database (region=='custom')"""
rc = 101 # sys... | mit | Python |
3090d65dd66acc0acdb5cccee82d2c6abc81eac4 | Remove config option ckan.ab_scheming.deployment | abgov/ckanext-workflow,abgov/ckanext-workflow,abgov/ckanext-workflow,abgov/ckanext-workflow | ckanext/workflow/logic/validation.py | ckanext/workflow/logic/validation.py | from ckan.plugins.toolkit import Invalid, _
from ckan.lib.navl.dictization_functions import unflatten
from ckan.plugins import toolkit
import ckan.logic as logic
import ckan.lib.base as base
import re
import ckanext.workflow.helpers as helpers
import pylons.config as config
NotFound = logic.NotFound
abort =... | from ckan.plugins.toolkit import Invalid, _
from ckan.lib.navl.dictization_functions import unflatten
from ckan.plugins import toolkit
import ckan.logic as logic
import ckan.lib.base as base
import re
import ckanext.workflow.helpers as helpers
import pylons.config as config
NotFound = logic.NotFound
abort =... | agpl-3.0 | Python |
2466a5b0c7f278c9c11669aa686ca7e3ec4e774a | Fix emails | ocwc/ocwc-members,ocwc/ocwc-members,ocwc/ocwc-members,ocwc/ocwc-members | members/crm/management/commands/mailing-emails.py | members/crm/management/commands/mailing-emails.py | # -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand
from crm.models import Contact
class Command(BaseCommand):
help = "generates a list of emails with Lead Contact, Certifier and Voting representatives"
def handle(self, *args, **options):
address_list = []
for contact... | # -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand
from crm.models import Contact
class Command(BaseCommand):
help = "generates a list of emails with Lead Contact, Certifier and Voting representatives"
def handle(self, *args, **options):
address_list = []
for contact... | mit | Python |
14f3f3659bc727ef1ac46e4ec4dcaba58e5922c4 | Fix for Python 3 in conll dataset loading | keras-team/keras-contrib,farizrahman4u/keras-contrib,keras-team/keras-contrib,keras-team/keras-contrib | keras_contrib/datasets/conll2000.py | keras_contrib/datasets/conll2000.py | from __future__ import print_function
import numpy
from keras.utils.data_utils import get_file
from zipfile import ZipFile
from collections import Counter
from keras.preprocessing.sequence import pad_sequences
from keras.datasets import cifar10
def load_data(path='conll2000.zip', min_freq=2):
path = get_file(path... | from __future__ import print_function
import numpy
from keras.utils.data_utils import get_file
from zipfile import ZipFile
from collections import Counter
from keras.preprocessing.sequence import pad_sequences
from keras.datasets import cifar10
def load_data(path='conll2000.zip', min_freq=2):
path = get_file(path... | mit | Python |
88d3600064fa5461ea1aeb818349e8b7ab910283 | Fix a varname typo | gfxprim/gfxprim,gfxprim/gfxprim,gfxprim/gfxprim,gfxprim/gfxprim,gfxprim/gfxprim | pylib/gfxprim/render_utils.py | pylib/gfxprim/render_utils.py | #
# gfxprim.render_utils
#
import jinja2
import logging as log
import os
import time
import re
def template_error(s, *args):
raise Exception(s, *args)
def create_environment(config, template_dir):
env = jinja2.Environment(
line_statement_prefix = "%%",
line_comment_prefix = "##",
undefined = ji... | #
# gfxprim.render_utils
#
import jinja2
import logging as log
import os
import time
import re
def template_error(s, *args):
raise Exception(s, *args)
def create_environment(config, template_dir):
env = jinja2.Environment(
line_statement_prefix = "%%",
line_comment_prefix = "##",
undefined = ji... | lgpl-2.1 | Python |
bf79a85242686db6b832d767897a39c74bf480f8 | Add test for #229 | lzedl/PyMySQL,nju520/PyMySQL,xjzhou/PyMySQL,boneyao/PyMySQL,xjzhou/PyMySQL,modulexcite/PyMySQL,pulsar314/Tornado-MySQL,jheld/PyMySQL,anson-tang/PyMySQL,jwjohns/PyMySQL,Ting-y/PyMySQL,PyMySQL/Tornado-MySQL,lzedl/PyMySQL,yeyinzhu3211/PyMySQL,aio-libs/aiomysql,NunoEdgarGub1/PyMySQL,pymysql/pymysql,methane/PyMySQL,mosquito... | pymysql/tests/test_nextset.py | pymysql/tests/test_nextset.py | from pymysql.tests import base
from pymysql import util
try:
import unittest2 as unittest
except ImportError:
import unittest
class TestNextset(base.PyMySQLTestCase):
def setUp(self):
super(TestNextset, self).setUp()
self.con = self.connections[0]
def test_nextset(self):
cur... | from pymysql.tests import base
from pymysql import util
try:
import unittest2 as unittest
except ImportError:
import unittest
class TestNextset(base.PyMySQLTestCase):
def setUp(self):
super(TestNextset, self).setUp()
self.con = self.connections[0]
def test_nextset(self):
cur... | mit | Python |
e07eff5c6dfd11517bc6d62157fd9b4ddb527a72 | Add logo to shell startup | oliverhuangchao/thunder,poolio/thunder,j-friedrich/thunder,kcompher/thunder,broxtronix/thunder,zhwa/thunder,poolio/thunder,kcompher/thunder,j-friedrich/thunder,jwittenbach/thunder,oliverhuangchao/thunder,thunder-project/thunder,kunallillaney/thunder,broxtronix/thunder,kunallillaney/thunder,mikarubi/thunder,zhwa/thunder... | python/thunder/utils/shell.py | python/thunder/utils/shell.py | import thunder
from thunder.utils.context import ThunderContext
from termcolor import colored
tsc = ThunderContext(sc)
print('')
print(colored(' IIIII ', 'yellow'))
print(colored(' IIIII ', 'yellow'))
print(colored(' IIIIIIIIIIIIIIIIII ', 'yellow'))
print(colored(' IIIIIIIIIII... | import thunder
from thunder.utils.context import ThunderContext
tsc = ThunderContext(sc)
print('\n')
print('Running thunder version ' + thunder.__version__)
print('A thunder context is available as tsc') | apache-2.0 | Python |
a76ecb81853dcd277999e810a51f3a04a7d75b3a | Print kernelspec | stuertz/staged-recipes,igortg/staged-recipes,hadim/staged-recipes,stuertz/staged-recipes,asmeurer/staged-recipes,kwilcox/staged-recipes,Juanlu001/staged-recipes,isuruf/staged-recipes,igortg/staged-recipes,petrushy/staged-recipes,Juanlu001/staged-recipes,isuruf/staged-recipes,scopatz/staged-recipes,ocefpaf/staged-recipe... | recipes/sos-julia/run_test.py | recipes/sos-julia/run_test.py | import unittest
import sys
from sos_notebook.test_utils import sos_kernel
from ipykernel.tests.utils import execute, wait_for_idle, assemble_output
import jupyter_client
try:
print(jupyter_client.kernelspec.get_kernel_spec('julia-1.0').to_dict())
except jupyter_client.kernelspec.NoSuchKernel:
print('julia-1.... | import unittest
import sys
from sos_notebook.test_utils import sos_kernel
from ipykernel.tests.utils import execute, wait_for_idle, assemble_output
@unittest.skipIf(sys.platform == 'win32', 'julia does not exist on win32')
class TestSoSKernel(unittest.TestCase):
def testKernel(self):
with sos_kernel() as ... | bsd-3-clause | Python |
b4ff065c8a58506de1b46cc5b58a19779c942f34 | Replace widget with panel | BrickText/BrickText | redactor/coloring/Coloring.py | redactor/coloring/Coloring.py | import re
from coloring.config_tags import config_tags
class Coloring:
def __init__(self, text_editor, language):
self.root = text_editor.get_root()
self.text_widget = text_editor.get_text_panel()
self.keywords = config_tags(self.text_widget, language)
self.pattern = r"\w+"
... | import re
from coloring.config_tags import config_tags
class Coloring:
def __init__(self, text_editor, language):
self.root = text_editor.get_root()
self.text_widget = text_editor.get_text_widget()
self.keywords = config_tags(self.text_widget, language)
self.pattern = r"\w+"
... | mit | Python |
baf76ad484cc4386a9919e2f7322c541ef2d46d9 | 更新 modules Groups API 中的 serializers.py, 新增函式功能宣告註解 | yrchen/CommonRepo,yrchen/CommonRepo,yrchen/CommonRepo,yrchen/CommonRepo | commonrepo/groups_api/serializers.py | commonrepo/groups_api/serializers.py | # -*- coding: utf-8 -*-
#
# Copyright 2016 edX PDR Lab, National Central University, Taiwan.
#
# http://edxpdrlab.ncu.cc/
#
# 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://w... | # -*- coding: utf-8 -*-
#
# Copyright 2016 edX PDR Lab, National Central University, Taiwan.
#
# http://edxpdrlab.ncu.cc/
#
# 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://w... | apache-2.0 | Python |
4544557cbd3f1099121744d1e030912a67f69e5c | Work on the hsb example | BrianGasberg/phue,BrianGasberg/phue,Jaiz909/phue | examples/tk_gui_hsb.py | examples/tk_gui_hsb.py | #!/usr/bin/python
from Tkinter import *
from phue import Bridge
'''
This example creates 3 sliders for the first 3 lights
and shows the name of the light under each slider.
There is also a checkbox to toggle the light.
'''
b = Bridge() # Enter bridge IP here.
#If running for the first time, press button on bridge an... | #!/usr/bin/python
from Tkinter import *
from phue import Bridge
'''
This example creates 3 sliders for the first 3 lights
and shows the name of the light under each slider.
There is also a checkbox to toggle the light.
'''
b = Bridge() # Enter bridge IP here.
#If running for the first time, press button on bridge an... | mit | Python |
ca6f55628c131360aadb9e33732af93306671718 | Test commit part 2. | naokiur/circle-ci-demo,naokiur/circle-ci-demo,naokiur/circle-ci-demo | test.py | test.py | print("Test", "added", "second")
class Test():
pass | print("Test", "added")
class Test():
pass | apache-2.0 | Python |
20556010d1ec4c5f6c3f412f7f64d9965586d75a | add args parser | evuez/mutations | test.py | test.py | import logging
from argparse import ArgumentParser
from random import random
from pyglet import app
from pyglet.window import Window
from pyglet.clock import schedule_interval
from pyglet.gl import glClearColor
from render import MapView
from mutations import Map
from mutations import Body
from mutations import Energ... | import logging
from random import random
from pyglet import app
from pyglet.window import Window
from pyglet.clock import schedule_interval
from pyglet.gl import glClearColor
from render import MapView
from mutations import Map
from mutations import Body
from mutations import EnergyBank
logging.basicConfig(level=lo... | mit | Python |
eb1bf148ea5990522d746a2acdb3e2d8347cc249 | Update tests to match new way of creating objects | UngaForskareStockholm/medlem2 | test.py | test.py | import lib.database
lib.database.db.connect(host="10.11.11.24", database="dev_medlem2", username="postgres")
import model.bylaw
import model.user
import model.address
#__builtins__.db=db
params=dict()
params['bylaw']='asd'
params['created_by']=0
m=model.bylaw.Bylaw.create(params)
print "asd", m['bylaw']
m['bylaw'] ... | import lib.database
lib.database.db.connect(host="10.11.11.24", database="dev_medlem2", username="postgres")
import model.bylaw
import model.user
import model.address
#__builtins__.db=db
params=dict()
params['bylaw']='asd'
m=model.bylaw.Bylaw.create(params, 0)
print m['bylaw']
m['bylaw'] = "aoieusth8isuey4zhj8rifu4... | bsd-3-clause | Python |
f2a5cc71a144d96fc09ac4ffb65bdad40137fd3b | Update at 2017-07-23 21-07-25 | amoshyc/tthl-code | test.py | test.py | import json
from pathlib import Path
import numpy as np
import pandas as pd
import tensorflow as tf
from keras.backend.tensorflow_backend import set_session
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
set_session(tf.Session(config=config))
from keras.models import Sequential, Model
from keras.pr... | import json
from pathlib import Path
import numpy as np
import pandas as pd
import tensorflow as tf
from keras.backend.tensorflow_backend import set_session
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
set_session(tf.Session(config=config))
from keras.models import Sequential, Model
from keras.pr... | apache-2.0 | Python |
c7cf1dd458d2d11ef76a94742b9fcbc10c489820 | Fix tmap bug | jasontbradshaw/multivid,jasontbradshaw/multivid | tmap.py | tmap.py | import threading
import Queue as queue
def worker(function, work_queue, result_queue):
"""
Worker thread that consumes from and produces to two Queues. Each item
in the work queue is assumed to be a tuple of (index, item). When the
work is processed, it is put into the result queue with the same index
... | import threading
import Queue as queue
def worker(function, work_queue, result_queue):
"""
Worker thread that consumes from and produces to two Queues. Each item
in the work queue is assumed to be a tuple of (index, item). When the
work is processed, it is put into the result queue with the same index
... | mit | Python |
8be7205128eb96fd52dc922ff45aa5356a59d318 | Change paths in PML-XML tool | CS4098/GroupProject,CS4098/GroupProject,CS4098/GroupProject | src/main/translator-xml/PMLToXML.py | src/main/translator-xml/PMLToXML.py | #!/usr/bin/env/python
import sys
import os.path
import subprocess
# Read in a pml file and save to an xml file
def translate_pml_file(xml_file, pml_file):
pml_path = os.path.abspath(pml_file.name)
xml_path = os.path.abspath(xml_file.name)
# Call XML generator
# TODO: Remove abs-path
return_code... | #!/usr/bin/env/python
import sys
import os.path
import subprocess
# Read in a pml file and save to an xml file
def translate_pml_file(xml_file, pml_file):
pml_path = os.path.abspath(pml_file.name)
xml_path = os.path.abspath(xml_file.name)
# Call XML generator
return_code = subprocess.call("Pmlxml %... | mit | Python |
30b794254f9573e4d960e0211370b06e83a10f25 | add version 0.13 (#6382) | mfherbst/spack,EmreAtes/spack,iulian787/spack,mfherbst/spack,iulian787/spack,mfherbst/spack,mfherbst/spack,EmreAtes/spack,krafczyk/spack,LLNL/spack,matthiasdiener/spack,matthiasdiener/spack,mfherbst/spack,LLNL/spack,matthiasdiener/spack,tmerrick1/spack,matthiasdiener/spack,krafczyk/spack,EmreAtes/spack,LLNL/spack,krafc... | var/spack/repos/builtin/packages/py-pysam/package.py | var/spack/repos/builtin/packages/py-pysam/package.py | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python |
cce0263fc320e82fcb9acce5115f251e0007a0bb | Update corescanner.py | galkan/flashlight | lib/active/corescanner.py | lib/active/corescanner.py |
try:
import os
import time
import datetime
import subprocess
from lib.core.core import Core,InitDirFile
except ImportError, err:
from lib.core.core import Core
Core.print_error(err)
class CoreScanner(object):
__scan_type_options = { "PingScan":"-n -sn -T5", "PortScan":"-n -Pn -T5 --open", "OsScan"... |
try:
import os
import time
import datetime
import subprocess
from lib.core.core import Core,InitDirFile
except ImportError, err:
from lib.core.core import Core
Core.print_error(err)
class CoreScanner(object):
__scan_type_options = { "PingScan":"-n -sn -T5", "PortScan":"-n -Pn -T5 --open", "OsScan"... | mit | Python |
5113b090105f64de47af950923ad2d1e11bf02f9 | Change to use unittest runner | sjones4/eutester,shaon/eutester,nephomaniac/nephoria,shaon/eutester,nagyistoce/eutester,sjones4/eutester,tbeckham/eutester,nagyistoce/eutester,sjones4/eutester,nephomaniac/eutester,sjones4/eutester,shaon/eutester,nagyistoce/eutester,nagyistoce/eutester,nephomaniac/eutester,shaon/eutester,tbeckham/eutester,nephomaniac/e... | testcases/unstable/load_generation.py | testcases/unstable/load_generation.py | #!/usr/bin/python
import unittest
import time
from eucaops import Eucaops
from eutester import xmlrunner
import os
import re
import random
class InstanceBasics(unittest.TestCase):
def setUp(self):
# Setup basic eutester object
self.tester = Eucaops( config_file="../input/2b_tested.lst", password="f... | #!/usr/bin/python
import unittest
import time
from eucaops import Eucaops
from eutester import xmlrunner
import os
import re
import random
class InstanceBasics(unittest.TestCase):
def setUp(self):
# Setup basic eutester object
self.tester = Eucaops( config_file="../input/2b_tested.lst", password="f... | bsd-2-clause | Python |
63c2e6ab0160387a73e77562fd6c9c5b38ddebd6 | reorganize class | RaymondKlass/entity-extract | entity_extract/extractor/parsers/rel_grammer_parser.py | entity_extract/extractor/parsers/rel_grammer_parser.py | import nltk
class RelationGrammerParser(object):
RelPhraseGrammer = r"""
V: {<RB>?<MD|VB|VBD|VBP|VBG|VBN><RP|RB>?}
P: {<RB>?<IN|TO|RP><RB>?}
W: {<PRP$|CD|DT|JJ|JJS|JJR|NN|NNS|NNP|NNPS|POS|RB|RBR|RBS|VBN|VBG>*}
RelP1: {(<V><P>?)*}
RelP2: {(<V>(<W>*<P>... | import nltk
class RelationGrammerParser(object):
def __init__(self):
grammer = r"""
V: {<RB>?<MD|VB|VBD|VBP|VBG|VBN><RP|RB>?}
P: {<RB>?<IN|TO|RP><RB>?}
W: {<PRP$|CD|DT|JJ|JJS|JJR|NN|NNS|NNP|NNPS|POS|RB|RBR|RBS|VBN|VBG>*}
RelP1: {(<V><P>?)*}
R... | mit | Python |
e79c22c7d76fe7107492dc22df082b6db573e6ff | Update at 2017-07-22 17-00-22 | amoshyc/tthl-code | train_vgg.py | train_vgg.py | import json
from pathlib import Path
import numpy as np
import pandas as pd
import tensorflow as tf
from keras.backend.tensorflow_backend import set_session
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
set_session(tf.Session(config=config))
from keras.models import Sequential, Model
from keras.pr... | import json
from pathlib import Path
import numpy as np
import pandas as pd
import tensorflow as tf
from keras.backend.tensorflow_backend import set_session
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
set_session(tf.Session(config=config))
from keras.models import Sequential, Model
from keras.pr... | apache-2.0 | Python |
913c794b459f845d3e6d8e7c3410112a45339d51 | Fix thinglang VM executable path | ytanay/thinglang,ytanay/thinglang,ytanay/thinglang,ytanay/thinglang | tests/integration/test_integration.py | tests/integration/test_integration.py | import collections
import io
import json
import os
import pytest
import glob
import subprocess
import thinglang
from thinglang import run, utils
BASE_PATH = os.path.dirname(os.path.abspath(__file__))
SEARCH_PATTERN = os.path.join(BASE_PATH, '**/*.thing')
TestCase = collections.namedtuple('TestCase', ['code', 'meta... | import collections
import io
import json
import os
import pytest
import glob
import subprocess
import thinglang
from thinglang import run, utils
SEARCH_PATTERN = os.path.join(os.path.dirname(os.path.abspath(__file__)), '**/*.thing')
TestCase = collections.namedtuple('TestCase', ['code', 'metadata', 'name', 'byteco... | mit | Python |
c8d691d88642c750dffce47a56d3f69fb7c1fac9 | Add create many machines | Financial-Times/paasport,Financial-Times/paasport,Financial-Times/paasport | provisioner/models/machine.py | provisioner/models/machine.py | import boto.ec2
import muliprocessing
# EU-WEST-1: RHEL7 HVM
AMI_ID = 'ami-25158352'
pool = muliprocessing.Pool()
class Machine:
@staticmethod
def create_many(definitions):
return pool.map(Machine.create_new, definitions)
@staticmethod
def create_new(data):
# boto create instance
name = data['name']
c... | import boto.ec2
# EU-WEST-1: RHEL7 HVM
AMI_ID = 'ami-25158352'
class Machine:
@staticmethod
def create_new(data):
# boto create instance
name = data['name']
cpu = int(0 if not 'cpu' in data else data['cpu'])
memory = int(0 if not 'memory' in data else data['memory'])
disk = int( 0)
region = str('eu-wes... | mit | Python |
3f6989e03b9024f61d64b9919f1a5bfed19f1761 | Update problem1.py | rav84/DXCLondonCodingClub | 09-05-2017/python/problem1.py | 09-05-2017/python/problem1.py | f1 = 1
f2 = 1
f3 = f1 + f2
for count in range(4,39):
f1 = f2
f2 = f3
f3 = f1 + f2
print("38th Fibnocci number is:")
print(f3)
| f1 = 1
f2 = 1
f3 = f1 + f2
for count in range(4,39):
f1 = f2
f2 = f3
f3 = f1 + f2
print("39th Fibnocci number is:")
print(f3) | mit | Python |
ce77fecc5e2a63a1720dea622fbce233cdb9f0b1 | Fix & in markup text | akshayaurora/kivy,inclement/kivy,kivy/kivy,inclement/kivy,kivy/kivy,kivy/kivy,akshayaurora/kivy,rnixx/kivy,akshayaurora/kivy,rnixx/kivy,rnixx/kivy,matham/kivy,matham/kivy,matham/kivy,matham/kivy,inclement/kivy | kivy/core/text/text_pango.py | kivy/core/text/text_pango.py | '''
Pango text provider
===================
'''
__all__ = ('LabelPango', )
from kivy.compat import PY2
from kivy.core.text import LabelBase
from kivy.core.text._text_pango import (KivyPangoRenderer, kpango_get_extents,
kpango_get_ascent, kpango_get_descent)
class LabelPango(... | '''
Pango text provider
===================
'''
__all__ = ('LabelPango', )
from kivy.compat import PY2
from kivy.core.text import LabelBase
from kivy.core.text._text_pango import (KivyPangoRenderer, kpango_get_extents,
kpango_get_ascent, kpango_get_descent)
class LabelPango(... | mit | Python |
9b3a7ed889722b50f5339ccf47de4ebe4c9af587 | use moto manually in setUp rather than decorator | longaccess/longaccess-client,longaccess/longaccess-client,longaccess/longaccess-client | lacli/t/test_mpconnection.py | lacli/t/test_mpconnection.py | from testtools import TestCase
from moto import mock_s3
class MPConnectionTest(TestCase):
@classmethod
def setup_class(cls):
cls._token = {
'token_access_key': '',
'token_secret_key': '',
'token_session': '',
'token_expiration': '',
'token_ui... | from testtools import TestCase
from moto import mock_s3
class MPConnectionTest(TestCase):
@classmethod
def setup_class(cls):
cls._token = {
'token_access_key': '',
'token_secret_key': '',
'token_session': '',
'token_expiration': '',
'token_ui... | apache-2.0 | Python |
4a0abc12203113819119a6d86d88a94998f6a6c9 | Fix typo | yunify/qingcloud-cli | qingcloud_cli/iaas_client/actions/image/delete_images.py | qingcloud_cli/iaas_client/actions/image/delete_images.py | # coding: utf-8
from qingcloud_cli.misc.utils import explode_array
from qingcloud_cli.iaas_client.actions.base import BaseAction
class DeleteImagesAction(BaseAction):
action = 'DeleteImages'
command = 'delete-images'
usage = '%(prog)s -i image_id, ... [-f <conf_file>]'
@classmethod
def add_ext_a... | # coding: utf-8
from qingcloud_cli.misc.utils import explode_array
from qingcloud_cli.iaas_client.actions.base import BaseAction
class DeleteImagesAction(BaseAction):
action = 'DeleteImages'
command = 'delete-images'
MSG_USAGE = '%(prog)s -i image_id, ... [-f <conf_file>]'
@classmethod
def add_e... | apache-2.0 | Python |
d1a5399f37c8f446ea362b72604332f6405fe70d | Bump version to 0.3 for PyPi release | dcramer/feedreader | feedreader/__init__.py | feedreader/__init__.py | import os.path
__all__ = ('__version__', '__build__')
__version__ = (0, 3)
def _get_git_revision(path):
revision_file = os.path.join(path, 'refs', 'heads', 'master')
if not os.path.exists(revision_file):
return None
fh = open(revision_file, 'r')
try:
return fh.read()
finally:
... | import os.path
__all__ = ('__version__', '__build__')
__version__ = (0, 2)
def _get_git_revision(path):
revision_file = os.path.join(path, 'refs', 'heads', 'master')
if not os.path.exists(revision_file):
return None
fh = open(revision_file, 'r')
try:
return fh.read()
finally:
... | bsd-2-clause | Python |
af446590c73c22d1738ba7d8331dd410dfed2d79 | allow calling script to use argparse | USC-ACTLab/crazyswarm,USC-ACTLab/crazyswarm,USC-ACTLab/crazyswarm,USC-ACTLab/crazyswarm | ros_ws/src/crazyswarm/scripts/pycrazyswarm/crazyswarm.py | ros_ws/src/crazyswarm/scripts/pycrazyswarm/crazyswarm.py | import argparse
from . import genericJoystick
class Crazyswarm:
def __init__(self):
parser = argparse.ArgumentParser()
parser.add_argument("--sim", help="Run using simulation", action="store_true")
parser.add_argument("--vis", help="(sim only) Visualization backend [mpl]", choices=['mpl', ... | import argparse
from . import genericJoystick
class Crazyswarm:
def __init__(self):
parser = argparse.ArgumentParser()
parser.add_argument("--sim", help="Run using simulation", action="store_true")
parser.add_argument("--vis", help="(sim only) Visualization backend [mpl]", choices=['mpl', ... | mit | Python |
6aaa973595c66005d9fb471da618fa8071d456e5 | support playlist | linhua55/you-get,cnbeining/you-get,lilydjwg/you-get,zmwangx/you-get,smart-techs/you-get,linhua55/you-get,cnbeining/you-get,qzane/you-get,zmwangx/you-get,jindaxia/you-get,qzane/you-get,xyuanmu/you-get,smart-techs/you-get,xyuanmu/you-get,lilydjwg/you-get | src/you_get/extractors/yinyuetai.py | src/you_get/extractors/yinyuetai.py | #!/usr/bin/env python
__all__ = ['yinyuetai_download', 'yinyuetai_download_by_id']
from ..common import *
def yinyuetai_download_by_id(vid, title=None, output_dir='.', merge=True, info_only=False):
video_info = json.loads(get_html('http://www.yinyuetai.com/insite/get-video-info?json=true&videoId=%s' % vid))
... | #!/usr/bin/env python
__all__ = ['yinyuetai_download', 'yinyuetai_download_by_id']
from ..common import *
def yinyuetai_download_by_id(vid, title=None, output_dir='.', merge=True, info_only=False):
video_info = json.loads(get_html('http://www.yinyuetai.com/insite/get-video-info?json=true&videoId=%s' % vid))
... | mit | Python |
93593a321fa941c2284a9c5520d06d47d380088c | Fix invalid updating of evecentral caching | kriberg/stationspinner,kriberg/stationspinner | stationspinner/evecentral/models.py | stationspinner/evecentral/models.py | from django.db import models
from stationspinner.libs.pragma import get_location_name
from stationspinner.sde.models import InvType
from datetime import datetime, timedelta
from pytz import UTC
class Market(models.Model):
locationID = models.IntegerField()
cached_until = models.DateTimeField(null=True)
de... | from django.db import models
from stationspinner.libs.pragma import get_location_name
from stationspinner.sde.models import InvType
from datetime import datetime, timedelta
from pytz import UTC
class Market(models.Model):
locationID = models.IntegerField()
cached_until = models.DateTimeField(null=True)
de... | agpl-3.0 | Python |
d8e0fb484693a9ae48568ff653509da734240b3f | Set working directory in python_version_compat_test.py | Khan/khan-linter,Khan/khan-linter,Khan/khan-linter,Khan/khan-linter | python_version_compat_test.py | python_version_compat_test.py | #!/usr/bin/env python
import os
import subprocess
import unittest
class TestPy2Py3Compat(unittest.TestCase):
"""We need to be compatible with both python2 and 3.
Test that we can at least import runlint.py under both.
"""
def test_python2_compat(self):
# If we're running this test from an ex... | #!/usr/bin/env python
import subprocess
import unittest
class TestPy2Py3Compat(unittest.TestCase):
"""We need to be compatible with both python2 and 3.
Test that we can at least import runlint.py under both.
"""
def test_python2_compat(self):
subprocess.check_call(['python2', '-c', 'import ... | apache-2.0 | Python |
664258c825a68ac46c8305cb09350a7be0ae8d1c | Update __init__.py | williamFalcon/pytorch-lightning,williamFalcon/pytorch-lightning | pytorch_lightning/__init__.py | pytorch_lightning/__init__.py | """Root package info."""
__version__ = '0.9.0rc11'
__author__ = 'William Falcon et al.'
__author_email__ = 'waf2107@columbia.edu'
__license__ = 'Apache-2.0'
__copyright__ = 'Copyright (c) 2018-2020, %s.' % __author__
__homepage__ = 'https://github.com/PyTorchLightning/pytorch-lightning'
# this has to be simple string,... | """Root package info."""
__version__ = '0.9.0rc10'
__author__ = 'William Falcon et al.'
__author_email__ = 'waf2107@columbia.edu'
__license__ = 'Apache-2.0'
__copyright__ = 'Copyright (c) 2018-2020, %s.' % __author__
__homepage__ = 'https://github.com/PyTorchLightning/pytorch-lightning'
# this has to be simple string,... | apache-2.0 | Python |
1e87d8714414209d6527458ca79a69292a4c68e8 | Update compare.py | dilipbobby/DataScience | Numpy/compare.py | Numpy/compare.py | import time
import numpy as np
size_of_vec = 10000
def pure_python_version():
t1 = time.time()
X = range(size_of_vec)
Y = range(size_of_vec)
Z = []
for i in range(len(X)):
Z.append(X[i] + Y[i])
return time.time() - t1
def numpy_version():
t1 = time.time()
X = np.arange(size_of... | import time
size_of_vec = 1000
def pure_python_version():
t1 = time.time()
X = range(size_of_vec)
Y = range(size_of_vec)
Z = []
for i in range(len(X)):
Z.append(X[i] + Y[i])
return time.time() - t1
def numpy_version():
t1 = time.time()
X = np.arange(size_of_vec)
Y = np.aran... | apache-2.0 | Python |
61966ebfdb45c5a4de67270cec7d04bdc26ce3b4 | add load command | dariusbakunas/rawdisk | rawdisk/modes/cli/cli_mode.py | rawdisk/modes/cli/cli_mode.py | import logging
import os
from rawdisk.session import Session
from rawdisk.modes.mode import Mode
from tabulate import tabulate
from cmd import Cmd
class CliMode(Mode):
@staticmethod
def entry(args=None):
cli = CliShell()
cli.initialize()
cli.cmdloop()
class CliShell(Cmd):
def __i... | import logging
import os
from rawdisk.session import Session
from rawdisk.modes.mode import Mode
from tabulate import tabulate
from cmd import Cmd
class CliMode(Mode):
@staticmethod
def entry(args=None):
cli = CliShell()
cli.initialize()
cli.cmdloop()
class CliShell(Cmd):
def __i... | bsd-3-clause | Python |
fa56c04858dd1744e196aca6f4bf82a53b8f681e | Fix post NoneType error. | fi-ksi/web-backend,fi-ksi/web-backend | util/post.py | util/post.py | from db import session
import model
def to_json(post, user_id, last_visit=None, last_visit_filled=False):
if user_id:
if not last_visit_filled:
last_visit = session.query(model.ThreadVisit).\
filter(model.ThreadVisit.user == user_id, model.ThreadVisit.thread == post.thread, model.ThreadVisit.last_last_visit.... | from db import session
import model
def to_json(post, user_id, last_visit=None, last_visit_filled=False):
if user_id:
if not last_visit_filled:
last_visit = session.query(model.ThreadVisit).\
filter(model.ThreadVisit.user == user_id, model.ThreadVisit.thread == post.thread, model.ThreadVisit.last_last_visit.... | mit | Python |
93be56b1e462a990f668369d4fa887d783a7bae4 | Remove unused imports | tochev/obshtestvo.bg,tochev/obshtestvo.bg,tochev/obshtestvo.bg | urls.py | urls.py | from django.conf.urls import patterns, include, url
from django.contrib import admin
from web.views import home, wip, about, project, support, members, contact, faq, report
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', home.HomeView.as_view(), name='home'),
ur... | from django.conf.urls import patterns, include, url
from django.contrib import admin
import autocomplete_light
from web.views import home, wip, about, project, support, members, contact, faq, report
autocomplete_light.autodiscover()
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', home... | unlicense | Python |
3a840ceafddc480e58693dcfe552db0be7b6104c | fix url rewriting | thoas/i386,thoas/i386,thoas/i386,thoas/i386 | urls.py | urls.py | from django.conf.urls.defaults import *
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
from django.conf import settings
admin.autodiscover()
urlpatterns = patterns('',
# Example:
# (r'^gobelins_project/', include('gobelins_project.foo.urls')),
# Uncommen... | from django.conf.urls.defaults import *
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
from django.conf import settings
admin.autodiscover()
urlpatterns = patterns('',
# Example:
# (r'^gobelins_project/', include('gobelins_project.foo.urls')),
# Uncommen... | mit | Python |
3eb969baa756d930b2f3bba4914714751e189c86 | rename single-document search url to be more resource-oriented | mprefer/findingaids,emory-libraries/findingaids,emory-libraries/findingaids,mprefer/findingaids | findingaids/fa/urls.py | findingaids/fa/urls.py | from django.conf.urls.defaults import *
TITLE_LETTERS = '[a-zA-Z]'
title_urlpatterns = patterns('findingaids.fa.views',
url('^$', 'browse_titles', name='browse-titles'),
url(r'^(?P<letter>%s)$' % TITLE_LETTERS, 'titles_by_letter', name='titles-by-letter')
)
# patterns for ead document id and series id
# defi... | from django.conf.urls.defaults import *
TITLE_LETTERS = '[a-zA-Z]'
title_urlpatterns = patterns('findingaids.fa.views',
url('^$', 'browse_titles', name='browse-titles'),
url(r'^(?P<letter>%s)$' % TITLE_LETTERS, 'titles_by_letter', name='titles-by-letter')
)
# patterns for ead document id and series id
# defi... | apache-2.0 | Python |
0efeaa258b19d5b1ba204cc55fbdb6969e0f3e64 | Adjust for pep8 package rename. | spookylukey/flake8-respect-noqa | flake8_respect_noqa.py | flake8_respect_noqa.py | # -*- coding: utf-8 -*-
"""
Always ignore lines with '# noqa'
"""
__version__ = 0.2
try:
from pep8 import StandardReport, noqa
except ImportError:
# Try the new (as of 2016-June) pycodestyle package.
from pycodestyle import StandardReport, noqa
class RespectNoqaReport(StandardReport):
def error(self... | # -*- coding: utf-8 -*-
"""
Always ignore lines with '# noqa'
"""
__version__ = 0.2
import pep8
class RespectNoqaReport(pep8.StandardReport):
def error(self, line_number, offset, text, check):
if len(self.lines) > line_number - 1 and pep8.noqa(self.lines[line_number - 1]):
return
els... | mit | Python |
eff06862c52af4ae03cf51373469e7eaa6c7a168 | Verify params is not None | kshvmdn/cobalt-uoft-python | cobaltuoft/endpoints/__init__.py | cobaltuoft/endpoints/__init__.py | from collections import OrderedDict
class Endpoints:
host = 'http://cobalt.qas.im/api/1.0'
@staticmethod
def run(api, get, endpoint=None, params=None, map=None):
endpoint = Endpoints._parse_endpoint(endpoint)
url, params = Endpoints._parse_url(api, endpoint, params), \
Endpoi... | from collections import OrderedDict
class Endpoints:
host = 'http://cobalt.qas.im/api/1.0'
@staticmethod
def run(api, get, endpoint=None, params=None, map=None):
endpoint = Endpoints._parse_endpoint(endpoint)
url, params = Endpoints._parse_url(api, endpoint, params), \
Endpoi... | mit | Python |
1271ea5365d9693722066f05f2fea226a3de6ed5 | Use isinstance so that all subclasses of list and str are supported | chiangf/Flask-Elasticsearch | flask_elasticsearch.py | flask_elasticsearch.py | from elasticsearch import Elasticsearch
# Find the stack on which we want to store the database connection.
# Starting with Flask 0.9, the _app_ctx_stack is the correct one,
# before that we need to use the _request_ctx_stack.
try:
from flask import _app_ctx_stack as stack
except ImportError:
from flask impor... | from elasticsearch import Elasticsearch
# Find the stack on which we want to store the database connection.
# Starting with Flask 0.9, the _app_ctx_stack is the correct one,
# before that we need to use the _request_ctx_stack.
try:
from flask import _app_ctx_stack as stack
except ImportError:
from flask impor... | mit | Python |
7686ce67ae643ca4e556c2238c91580555917d3f | add doctests | poldracklab/fmriprep,poldracklab/preprocessing-workflow,oesteban/preprocessing-workflow,oesteban/fmriprep,oesteban/fmriprep,poldracklab/fmriprep,oesteban/preprocessing-workflow,oesteban/fmriprep,poldracklab/preprocessing-workflow,poldracklab/fmriprep | fmriprep/utils/misc.py | fmriprep/utils/misc.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
Miscelaneous utilities
"""
def fix_multi_T1w_source_name(in_files):
"""
Make up a generic source name when there are multiple T1s
>>> fix_mul... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
Miscelaneous utilities
"""
def fix_multi_T1w_source_name(in_files):
"""
Make up a generic source name when there are multiple T1s
"""
impo... | bsd-3-clause | Python |
a2863cdb3770a91620868810292d5706b77a178f | Update models.py | 02agarwalt/FNGS_website,02agarwalt/FNGS_website,ebridge2/FNGS_website,ebridge2/FNGS_website,ebridge2/FNGS_website,ebridge2/FNGS_website,02agarwalt/FNGS_website | fngs/explore/models.py | fngs/explore/models.py | from __future__ import unicode_literals
from django.core.urlresolvers import reverse
from django.db import models
from django.core.urlresolvers import reverse_lazy
from django.conf import settings
import os.path as op
import os
import uuid
def get_creds_file_path(instance, filename):
return os.path.join("/".join(["cr... | from __future__ import unicode_literals
from django.core.urlresolvers import reverse
from django.db import models
from django.core.urlresolvers import reverse_lazy
from django.conf import settings
import os.path as op
import os
import uuid
def get_creds_file_path(instance, filename):
return os.path.join("/".join(["cr... | apache-2.0 | Python |
4ca4c8805fa823b7eb686cd5134fcf836e672350 | Fix typo | APerson241/APersonBot,APerson241/APersonBot,APerson241/EnterpriseyBot,APerson241/APersonBot,APerson241/EnterpriseyBot,APerson241/APersonBot,APerson241/EnterpriseyBot,APerson241/EnterpriseyBot | defcon/defcon.py | defcon/defcon.py | import datetime
import re
import pywikibot
TEMPLATE_NAME = "Template:Vandalism information"
COMMENT = "[[Wikipedia:Bots/Requests for approval/APersonBot 5|Bot]] updating vandalism level to %d RPM"
TEMPLATE_PATH = "/data/project/apersonbot/bot/defcon/template.txt"
site = pywikibot.Site("en", "wikipedia")
site.login()
... | import datetime
import re
import pywikibot
TEMPLATE_NAME = "Template:Vandalism information"
COMMENT = "[[Wikipedia:Bots/Requests for approval/APersonBot 5|Bot]] updating vandalism level to %d RPM"
TEMPLATE_PATH = "/data/project/apersonbot/bot/defcon/template.txt"
site = pywikibot.Site("en", "wikipedia")
site.login()
... | mit | Python |
8c8705db387f3f74874a9e18ed00a3256c54f2eb | Update mkwrapper_mm.py | araisrobo/machinekit,araisrobo/machinekit,araisrobo/machinekit,araisrobo/machinekit,araisrobo/machinekit,araisrobo/machinekit,araisrobo/machinekit,araisrobo/machinekit,araisrobo/machinekit | configs/sim/axis/mkwrapper_mm.py | configs/sim/axis/mkwrapper_mm.py | #!/usr/bin/python
import sys
import os
import subprocess
import importlib
from machinekit import launcher
from time import *
launcher.register_exit_handler()
launcher.set_debug_level(5)
os.chdir(os.path.dirname(os.path.realpath(__file__)))
try:
launcher.check_installation() # ... | #!/usr/bin/python
import sys
import os
import subprocess
import importlib
from machinekit import launcher
from time import *
launcher.register_exit_handler()
launcher.set_debug_level(5)
os.chdir(os.path.dirname(os.path.realpath(__file__)))
try:
launcher.check_installation() # ... | lgpl-2.1 | Python |
71a1c09010a22a6b8b15390dd6e5cc43c18e6721 | Update zoom.py | mcamelo/zoom | zoom.py | zoom.py | ################
# RUNTIME
################
def init(w,h):
'''Initializes zoom, resizing the backbuffer to the given width and height.
'''
def run():
'''Returns true if game is running, false if game has ended.
'''
def time():
'''Returns the number of seconds between the beginning of the last frame and t... | ################
# RUNTIME
################
def init(w,h):
'''Initializes zoom, resizing the backbuffer to the given width and height.
'''
def run():
'''Returns the number of seconds since the last frame or false if game has ended.
'''
################
# Resources
################
def loadresources(filenam... | apache-2.0 | Python |
e37eba5f9430cfa3c3cf081066e7079e5c564e95 | Improve templatetag to use either prefix or ... | spapas/django-generic-scaffold,spapas/django-generic-scaffold | generic_scaffold/templatetags/generic_scaffold_tags.py | generic_scaffold/templatetags/generic_scaffold_tags.py | from django import template
from django.conf import settings
from generic_scaffold import get_url_names
register = template.Library()
@register.assignment_tag
def set_urls_for_scaffold(app=None, model=None, prefix=None):
url_name = get_url_names(app, model, prefix)
return url_name
| from django import template
from django.conf import settings
from generic_scaffold import get_url_names
register = template.Library()
@register.simple_tag
def get_url_for_action(prefix, action):
url = get_url_names(prefix)[action]
return url
@register.assignment_tag
def set_url_for_action(prefix, action):
... | mit | Python |
7a170e2a1c31834608aa9401f9605d274396d92c | Fix Python 3.4.x bytes string formatting | ethereum/pydevp2p | devp2p/utils.py | devp2p/utils.py | import struct
import rlp
from rlp.utils import encode_hex, decode_hex, str_to_bytes
import collections
ienc = int_to_big_endian = rlp.sedes.big_endian_int.serialize
def big_endian_to_int(s):
return rlp.sedes.big_endian_int.deserialize(s.lstrip(b'\x00'))
idec = big_endian_to_int
def int_to_big_endian4(integer)... | import struct
import rlp
from rlp.utils import encode_hex, decode_hex, str_to_bytes
import collections
ienc = int_to_big_endian = rlp.sedes.big_endian_int.serialize
def big_endian_to_int(s):
return rlp.sedes.big_endian_int.deserialize(s.lstrip(b'\x00'))
idec = big_endian_to_int
def int_to_big_endian4(integer)... | mit | Python |
5410c5cc15d94001715ee48745c76caf35db55dc | Upgrade to TBB/2019_U1@conan/stable | acgetchell/CDT-plusplus,acgetchell/CDT-plusplus,acgetchell/CDT-plusplus | conanfile.py | conanfile.py | from conans import ConanFile, CMake
class CausalDynamicalTriangulations(ConanFile):
settings = "os", "compiler", "build_type", "arch"
requires = "boost/1.68.0@conan/stable", "catch2/2.4.1@bincrafters/stable", "TBB/2019_U1@conan/stable",\
"eigen/3.3.5@conan/stable", "docopt/0.6.2@conan/stable",\
... | from conans import ConanFile, CMake
class CausalDynamicalTriangulations(ConanFile):
settings = "os", "compiler", "build_type", "arch"
requires = "boost/1.68.0@conan/stable", "catch2/2.4.1@bincrafters/stable", "TBB/2018_U6@conan/stable",\
"eigen/3.3.5@conan/stable", "docopt/0.6.2@conan/stable",\
... | bsd-3-clause | Python |
0fcb955f02f2e59367612c56641a3588c20e628f | Update Catch 2.13.9 | offa/scope-guard,offa/scope-guard,offa/scope-guard,offa/scope-guard | conanfile.py | conanfile.py | import re
import os
from conans import ConanFile, CMake, tools
class ScopeguardConan(ConanFile):
name = "scope-guard"
license = "MIT"
author = "offa <offa@github>"
url = "https://github.com.offa/scope-guard"
description = "Implementation of Scoped Guards and Unique Resource as proposed in P0052."
... | import re
import os
from conans import ConanFile, CMake, tools
class ScopeguardConan(ConanFile):
name = "scope-guard"
license = "MIT"
author = "offa <offa@github>"
url = "https://github.com.offa/scope-guard"
description = "Implementation of Scoped Guards and Unique Resource as proposed in P0052."
... | mit | Python |
cf766372264996cba55cd79986d5e411480b771f | add a note about argument promotion in variadic calls | topazproject/topaz,topazproject/topaz,topazproject/topaz,babelsberg/babelsberg-r,babelsberg/babelsberg-r,babelsberg/babelsberg-r,babelsberg/babelsberg-r,topazproject/topaz,babelsberg/babelsberg-r | topaz/modules/ffi/variadic_invoker.py | topaz/modules/ffi/variadic_invoker.py | from topaz.module import ClassDef
from topaz.objects.objectobject import W_Object
from topaz.modules.ffi.type import type_object, ffi_types, W_TypeObject, VOID
from topaz.modules.ffi.dynamic_library import coerce_dl_symbol
from topaz.modules.ffi.function import W_FunctionObject
from rpython.rlib import clibffi
from rp... | from topaz.module import ClassDef
from topaz.objects.objectobject import W_Object
from topaz.modules.ffi.type import type_object, ffi_types, W_TypeObject, VOID
from topaz.modules.ffi.dynamic_library import coerce_dl_symbol
from topaz.modules.ffi.function import W_FunctionObject
from rpython.rlib import clibffi
from rp... | bsd-3-clause | Python |
82f95d7f14d4af5d3827af980028c16ffa7a608d | Update job lifecycle add scheduled | polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon | polyaxon/constants/jobs.py | polyaxon/constants/jobs.py | from constants.statuses import BaseStatuses
from constants.unknown import UNKNOWN
class JobLifeCycle(BaseStatuses):
"""Experiment lifecycle
Props:
* CREATED: created.
* BUILDING: This includes time before being bound to a node,
as well as time spent pulling images onto the... | from constants.statuses import BaseStatuses
from constants.unknown import UNKNOWN
class JobLifeCycle(BaseStatuses):
"""Experiment lifecycle
Props:
* CREATED: created.
* BUILDING: This includes time before being bound to a node,
as well as time spent pulling images onto the... | apache-2.0 | Python |
9ea68b38ddc417b62ad2a5d83b80b3c1d3185f7d | bump version | czpython/aldryn-faq,czpython/aldryn-faq,czpython/aldryn-faq,czpython/aldryn-faq,mkoistinen/aldryn-faq | aldryn_faq/__init__.py | aldryn_faq/__init__.py | __version__ = '0.2.0'
request_faq_category_identifier = 'aldryn_faq_current_category'
request_faq_question_identifier = 'aldryn_faq_current_question' | __version__ = '0.1.11'
request_faq_category_identifier = 'aldryn_faq_current_category'
request_faq_question_identifier = 'aldryn_faq_current_question' | bsd-3-clause | Python |
c2e18d42358754a11ccb56a58473c78b85c7aaa5 | set up django log rotation | sergeii/swat4stats.com,sergeii/swat4stats.com,sergeii/swat4stats.com | swat4tracker/settings/production.py | swat4tracker/settings/production.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
from .common import *
ALLOWED_HOSTS = ['swat4tracker.com', 'swat4stats.com']
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'HOST': '127.0.0.1',
'PORT': '5432',
'NAME':... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
from .common import *
ALLOWED_HOSTS = ['swat4tracker.com', 'swat4stats.com']
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'HOST': '127.0.0.1',
'PORT': '5432',
'NAME':... | mit | Python |
7b2e30e610bd8ad951c0dbd0ce3c55753a5ed36f | Remove obsolete code. | kxepal/phoxpy | phoxpy/messages/directory.py | phoxpy/messages/directory.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2011 Alexander Shorin
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
from phoxpy.messages import PhoxRequest
from phoxpy.mapping import Mapping, ObjectField, ListField, \
... | # -*- coding: utf-8 -*-
#
# Copyright (C) 2011 Alexander Shorin
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
from phoxpy import xml
from phoxpy.messages import PhoxRequest
from phoxpy.mapping import Mapping, Obje... | bsd-3-clause | Python |
605fab847797679fa961bde98be893d09fd4f89b | Add the remaining tests to testall. | python-postgres/fe,python-postgres/fe | postgresql/test/testall.py | postgresql/test/testall.py | ##
# copyright 2009, James William Pye
# http://python.projects.postgresql.org
##
import sys
import os
import unittest
import warnings
from ..installation import Installation
from .test_exceptions import *
from .test_bytea_codec import *
from .test_iri import *
from .test_protocol import *
from .test_configfile impor... | ##
# copyright 2009, James William Pye
# http://python.projects.postgresql.org
##
import sys
import os
import unittest
from postgresql.test.test_iri import *
from postgresql.test.test_protocol import *
from postgresql.test.test_exceptions import *
if __name__ == '__main__':
from types import ModuleType
this = Modul... | bsd-3-clause | Python |
dd41eacf8e1517c90664c956de93bf7d63c47caf | Add users set() to base channel objects | UltrosBot/Ultros,UltrosBot/Ultros | system/protocols/generic/channel.py | system/protocols/generic/channel.py | from system.translations import Translations
__author__ = 'Sean'
_ = Translations().get()
class Channel(object):
name = ""
users = set()
def __init__(self, name, protocol=None):
self.name = name
self.protocol = protocol
self.users = set()
def respond(self, message):
... | __author__ = 'Sean'
from system.translations import Translations
_ = Translations().get()
class Channel(object):
name = ""
def __init__(self, name, protocol=None):
self.name = name
self.protocol = protocol
def respond(self, message):
raise NotImplementedError(_("This method mus... | artistic-2.0 | Python |
eec37fb717ed913533f377a4c1f5780efd8b4721 | add pages option | visio2img/visio2img | visio2img.py | visio2img.py | import win32com.client
from win32com.client import constants
from os import path, chdir, getcwd
from sys import exit
from optparse import OptionParser
def get_dispatch_format(extension):
if extension == 'vsd':
return 'Visio.Application'
if extension == 'vsdx':
pass # What?
def get_pages(ap... | import win32com.client
from win32com.client import constants
from os import path, chdir, getcwd
from sys import argv, exit
def get_dispatch_format(extension):
if extension == 'vsd':
return 'Visio.Application'
if extension == 'vsdx':
pass # What?
if __name__ == '__main__':
# if len... | apache-2.0 | Python |
1076e1e3dc7788429333578f9cf57be1a9d6c70d | Clean up. | ariutta/target-interaction-finder | targetinteractionfinder/__init__.py | targetinteractionfinder/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
from target_interaction_finder import TargetInteractionFinder
def main():
parser = argparse.ArgumentParser(description='Extract subgraph(s) from XGMML network(s).')
parser.add_argument('ids',
type=str,
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
from target_interaction_finder import TargetInteractionFinder
def main():
parser = argparse.ArgumentParser(description='Extract subgraph(s) from XGMML network(s).')
parser.add_argument('ids',
type=str,
... | apache-2.0 | Python |
9f63bdee0502f29c4a97a24a984e99f4dbc00a37 | Remove comment | prattl/teamfinder,prattl/teamfinder,prattl/teamfinder,prattl/teamfinder | api/teamfinder/urls.py | api/teamfinder/urls.py | from django.conf import settings
from django.urls import include, path
from django.conf.urls.static import static
from django.contrib import admin
from rest_framework import routers
from common.api import views as common_views
from feedback.api import views as feedback_views
from players.api import views as player_vie... | from django.conf import settings
from django.urls import include, path
from django.conf.urls.static import static
from django.contrib import admin
from rest_framework import routers
from common.api import views as common_views
from feedback.api import views as feedback_views
from players.api import views as player_vie... | apache-2.0 | Python |
bd7a721cbd16b926cfdc97790fe0d1ae6ede3ce2 | Bump version 33 | hugovk/terroroftinytown,ArchiveTeam/terroroftinytown,hugovk/terroroftinytown,ArchiveTeam/terroroftinytown,ArchiveTeam/terroroftinytown,hugovk/terroroftinytown | terroroftinytown/client/__init__.py | terroroftinytown/client/__init__.py | VERSION = 33 # Please update this whenever .client or .services changes
# Please update MIN_VERSION_OVERRIDE and MIN_CLIENT_VERSION_OVERRIDE as needed
| VERSION = 32 # Please update this whenever .client or .services changes
# Please update MIN_VERSION_OVERRIDE and MIN_CLIENT_VERSION_OVERRIDE as needed
| mit | Python |
c69f8d9ed42da8eef1730ee59e838f905a5e6ef3 | Bump version 16. | hugovk/terroroftinytown,hugovk/terroroftinytown,hugovk/terroroftinytown,ArchiveTeam/terroroftinytown,ArchiveTeam/terroroftinytown,ArchiveTeam/terroroftinytown | terroroftinytown/client/__init__.py | terroroftinytown/client/__init__.py | VERSION = 16 # Please update this whenever .client or .services changes
# Please update MIN_VERSION_OVERRIDE and MIN_CLIENT_VERSION_OVERRIDE as needed
| VERSION = 15 # Please update this whenever .client or .services changes
# Please update MIN_VERSION_OVERRIDE and MIN_CLIENT_VERSION_OVERRIDE as needed
| mit | Python |
8f42a1f5e0225e7e457bcaec01969ec0716d7c7e | use 'is' to compare to None | akaihola/PyChecker,akaihola/PyChecker,thomasvs/pychecker,thomasvs/pychecker | pychecker2/ReturnChecks.py | pychecker2/ReturnChecks.py | from pychecker2.Check import Check
from pychecker2.Check import Warning
from pychecker2.util import BaseVisitor, type_filter
from pychecker2 import symbols
from compiler import ast, walk
class Returns(BaseVisitor):
def __init__(self):
self.result = []
def visitReturn(self, node):
self.result... | from pychecker2.Check import Check
from pychecker2.Check import Warning
from pychecker2.util import BaseVisitor, type_filter
from pychecker2 import symbols
from compiler import ast, walk
class Returns(BaseVisitor):
def __init__(self):
self.result = []
def visitReturn(self, node):
self.result... | bsd-3-clause | Python |
f8d980de69607e73f207fea808c3b0558a4159c0 | Add date and social media fields to proposal | pyvec/cz.pycon.org-2017,pyvec/cz.pycon.org-2017,benabraham/cz.pycon.org-2017,pyvec/cz.pycon.org-2016,pyvec/cz.pycon.org-2016,benabraham/cz.pycon.org-2017,benabraham/cz.pycon.org-2017,pyvec/cz.pycon.org-2017,pyvec/cz.pycon.org-2016 | pyconcz_2016/cfp/models.py | pyconcz_2016/cfp/models.py | from django.db import models
from django.utils.timezone import now
from pyconcz_2016.conferences.models import Conference
class Cfp(models.Model):
conference = models.ForeignKey(Conference, related_name="cfps")
title = models.CharField(max_length=200)
date_start = models.DateTimeField()
date_end = m... | from django.db import models
from pyconcz_2016.conferences.models import Conference
class Cfp(models.Model):
conference = models.ForeignKey(Conference, related_name="cfps")
title = models.CharField(max_length=200)
date_start = models.DateTimeField()
date_end = models.DateTimeField()
class Meta:... | mit | Python |
f91a77351443aeb1990b188b77f96a0128f7cddb | Use sys.platform rather than platform.platform(), as joerick RTFM for me :) | joerick/pyinstrument,joerick/pyinstrument,joerick/pyinstrument,joerick/pyinstrument,joerick/pyinstrument,joerick/pyinstrument | pyinstrument/middleware.py | pyinstrument/middleware.py | from django.http import HttpResponse
from django.conf import settings
from pyinstrument import Profiler
import sys
import time
import os
try:
from django.utils.deprecation import MiddlewareMixin
except ImportError:
MiddlewareMixin = object
class ProfilerMiddleware(MiddlewareMixin):
def process_request(sel... | from django.http import HttpResponse
from django.conf import settings
from pyinstrument import Profiler
import platform
import time
import os
try:
from django.utils.deprecation import MiddlewareMixin
except ImportError:
MiddlewareMixin = object
class ProfilerMiddleware(MiddlewareMixin):
def process_reques... | bsd-3-clause | Python |
715b999a0527a717da3032f7ce8ae5d3115174bb | Update version.py | dpressel/baseline,dpressel/baseline,dpressel/baseline,dpressel/baseline | python/baseline/version.py | python/baseline/version.py | __version__ = "1.4.4"
| __version__ = "1.4.3"
| apache-2.0 | Python |
01c54e91f40c02346e74f1d0d6aecbfbd0bed1b4 | bump version to 1.3.1 | hobu/laz-perf,hobu/laz-perf,hobu/laz-perf,hobu/laz-perf,hobu/laz-perf | python/lazperf/__init__.py | python/lazperf/__init__.py | __version__='1.3.1'
from .pylazperfapi import PyDecompressor as Decompressor
from .pylazperfapi import PyCompressor as Compressor
from .pylazperfapi import PyVLRDecompressor as VLRDecompressor
from .pylazperfapi import PyVLRCompressor as VLRCompressor
from .pylazperfapi import PyRecordSchema as RecordSchema
from .pylaz... | __version__='1.3.0'
from .pylazperfapi import PyDecompressor as Decompressor
from .pylazperfapi import PyCompressor as Compressor
from .pylazperfapi import PyVLRDecompressor as VLRDecompressor
from .pylazperfapi import PyVLRCompressor as VLRCompressor
from .pylazperfapi import PyRecordSchema as RecordSchema
from .pylaz... | apache-2.0 | Python |
2ff480b8d38e74224ff70f2633dbc519753e967a | Remove redundant import. | TheLunchtimeAttack/matasano-challenges,TheLunchtimeAttack/matasano-challenges | python/matasano/set1/c8.py | python/matasano/set1/c8.py | if __name__ == "__main__":
chal_file = open("matasano/data/c8.txt", 'r')
coll_count = {}
for idx, line in enumerate(chal_file):
count = 0
ct = line[:-1]
for i in range(0, len(ct), 32):
for j in range(i+32, len(ct), 32):
if ct[i:i+32] == ct[j:j+32]:
... | from matasano.util.converters import hex_to_bytestr
if __name__ == "__main__":
chal_file = open("matasano/data/c8.txt", 'r')
coll_count = {}
for idx, line in enumerate(chal_file):
count = 0
ct = line[:-1]
for i in range(0, len(ct), 32):
for j in range(i+32, len(ct), 32... | mit | Python |
41eeea9a854747aa7e9715aa8186218d7d66fb46 | rename unused var to _ | opalmer/pywincffi,opalmer/pywincffi,opalmer/pywincffi,opalmer/pywincffi | pywincffi/ws2_32/events.py | pywincffi/ws2_32/events.py | """
Events
------
A module containing Windows functions for working with events.
"""
from six import integer_types
from pywincffi.core import dist
from pywincffi.core.checks import input_check, error_check
from pywincffi.exceptions import WindowsAPIError
from pywincffi.wintypes import HANDLE, SOCKET, wintype_to_cdat... | """
Events
------
A module containing Windows functions for working with events.
"""
from six import integer_types
from pywincffi.core import dist
from pywincffi.core.checks import input_check, error_check
from pywincffi.exceptions import WindowsAPIError
from pywincffi.wintypes import HANDLE, SOCKET, wintype_to_cdat... | mit | Python |
72bd9c2d6d7050b8a35e3c0203558d01cc832e79 | Fix in sparql output | cedar101/quepy-ko,pombredanne/quepy,cedar101/quepy,DrDub/quepy,iScienceLuvr/quepy,emoron/quepy | quepy/sparql_generation.py | quepy/sparql_generation.py | # -*- coding: utf-8 -*-
"""
Sparql generation code.
"""
from quepy import settings
from quepy.expression import isnode
from quepy.encodingpolicy import assert_valid_encoding
from quepy.intermediate_representation import IsRelatedTo
_indent = u" "
def adapt(x):
if isnode(x):
x = u"?x{}".format(x)
... | # -*- coding: utf-8 -*-
"""
Sparql generation code.
"""
from quepy import settings
from quepy.expression import isnode
from quepy.encodingpolicy import assert_valid_encoding
from quepy.intermediate_representation import IsRelatedTo
_indent = u" "
def adapt(x):
if isnode(x):
x = u"?x{}".format(x)
... | bsd-3-clause | Python |
60a95fee791a991930e97af12f6ef14e7d96244b | fix tests | fejta/test-infra,BenTheElder/test-infra,monopole/test-infra,fejta/test-infra,cblecker/test-infra,BenTheElder/test-infra,fejta/test-infra,michelle192837/test-infra,michelle192837/test-infra,jessfraz/test-infra,dims/test-infra,kubernetes/test-infra,dims/test-infra,BenTheElder/test-infra,dims/test-infra,jessfraz/test-infr... | releng/generate_tests_test.py | releng/generate_tests_test.py | #!/usr/bin/env python3
# Copyright 2019 The Kubernetes 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 appl... | #!/usr/bin/env python3
# Copyright 2019 The Kubernetes 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 appl... | apache-2.0 | Python |
c48706db3a1d5a68e173ed8212dde1c7269740c2 | use local aiohttpsession | mralext20/alex-bot | alexBot/cogs/phoneMonitor.py | alexBot/cogs/phoneMonitor.py | import logging
from collections import defaultdict
from typing import TYPE_CHECKING
import aiohttp
from discord.ext import tasks
from ..tools import Cog, get_json
if TYPE_CHECKING:
from bot import Bot
log = logging.getLogger(__name__)
TABLE = defaultdict(lambda: "Alex is Away")
TABLE['home'] = "Alex is At Hom... | import logging
from collections import defaultdict
from typing import TYPE_CHECKING
from discord.ext import tasks
from ..tools import Cog, get_json
if TYPE_CHECKING:
from bot import Bot
log = logging.getLogger(__name__)
TABLE = defaultdict(lambda: "Alex is Away")
TABLE['home'] = "Alex is At Home"
TABLE['walma... | mit | Python |
bee9373dcf852e7af9f0f1a78dcc17a0922f96fe | Modify main.py tests to use get_anchorhub_path() | samjabrahams/anchorhub | anchorhub/tests/test_main.py | anchorhub/tests/test_main.py | """
test_main.py - Tests for main.py
main.py:
http://www.github.com/samjabrahams/anchorhub/main.py
"""
from nose.tools import *
import anchorhub.main as main
from anchorhub.util.getanchorhubpath import get_anchorhub_path
from anchorhub.compatibility import get_path_separator
def test_one():
"""
main.py: Tes... | """
test_main.py - Tests for main.py
main.py:
http://www.github.com/samjabrahams/anchorhub/main.py
"""
from nose.tools import *
import anchorhub.main as main
def test_one():
"""
main.py: Test defaults with local directory as input.
"""
main.main(['.'])
| apache-2.0 | Python |
d7e79e32240b73c8565c7e526e679b3c9bb84bae | Fix the bug in the blob admin async uploader when no local file is present | GISAElkartea/amv2,GISAElkartea/amv2,GISAElkartea/amv2 | antxetamedia/blobs/fields.py | antxetamedia/blobs/fields.py | # -*- coding: utf-8 -*-
from django.forms import fields, widgets
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import reverse
from django.core.files.storage import default_storage
class UploadWidget(widgets.TextInput):
link = '... | # -*- coding: utf-8 -*-
from django.forms import fields, widgets
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import reverse
from django.core.files.storage import default_storage
class UploadWidget(widgets.TextInput):
widget =... | agpl-3.0 | Python |
fbc9e950c42829c366d28da978adbaa42a7f9a10 | Update berepi_logger.py | jeonghoonkang/BerePi,jeonghoonkang/BerePi,jeonghoonkang/BerePi,jeonghoonkang/BerePi,jeonghoonkang/BerePi,jeonghoonkang/BerePi,jeonghoonkang/BerePi | apps/logger/berepi_logger.py | apps/logger/berepi_logger.py | # -*- coding: utf-8 -*-
# author : http://github.com/jeonghoonkang
import logging
#import logging.config
from logging.handlers import RotatingFileHandler
#logging.config.fileConfig('logging.conf')
LOG_FILENAME = "./log/berelogger.log"
logger = logging.getLogger('BereLogger')
logger.setLevel(logging.DEBUG)
handler =... | # -*- coding: utf-8 -*-
# author : http://github.com/jeonghoonkang
import logging
#import logging.config
from logging.handlers import RotatingFileHandler
#logging.config.fileConfig('logging.conf')
LOG_FILENAME = "./log/berelogger.log"
logger = logging.getLogger('BereLogger')
logger.setLevel(logging.DEBUG)
handler =... | bsd-2-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.