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 |
|---|---|---|---|---|---|---|---|---|
04c3cac3054626773bc0434453378cb295f7e38c | Add handling of invalid values | timtroendle/pytus2000 | pytus2000/read.py | pytus2000/read.py | import pandas as pd
from .datadicts import diary
def read_diary_file(path_to_file):
return pd.read_csv(
path_to_file,
delimiter='\t',
converters=_column_name_to_type_mapping(diary),
low_memory=False # some columns seem to have mixed types
)
def _column_name_to_type_mapping(m... | import pandas as pd
from .datadicts import diary
def read_diary_file(path_to_file):
return pd.read_csv(
path_to_file,
delimiter='\t',
nrows=50,
converters=_column_name_to_type_mapping(diary),
low_memory=False # some columns seem to have mixed types
)
def _column_name... | mit | Python |
fd421a4c5f7cdacdc98aa049b4650c9d1d62267a | Fix some issues with open. | rec/grit,rec/grit | grit/command/Open.py | grit/command/Open.py | from __future__ import absolute_import, division, print_function, unicode_literals
import os
import platform
import random
from grit import Call
from grit import Git
from grit import GitRoot
from grit import Settings
from grit.String import startswith
HELP = """
grit open [filename]
Open the filename as a Github... | from __future__ import absolute_import, division, print_function, unicode_literals
import os
import platform
import random
from grit import Call
from grit import Git
from grit import GitRoot
from grit import Settings
from grit.String import startswith
HELP = """
grit open [filename]
Open the filename as a Github... | artistic-2.0 | Python |
dbde102d14632bbaef7d6319d0742ac2819d6e38 | Implement the given spec. | m-lab/ooni-support,m-lab/ooni-support,hellais/ooni-support,hellais/ooni-support | mlab-ns-simulator/mlabsim/update.py | mlab-ns-simulator/mlabsim/update.py | """
This approximates the mlab-ns slice information gathering. The actual
system uses nagios and we're not certain about the details. This much
simplified version is just a web URL anyone may PUT data into.
Warning: This doesn't have any security properties! We need a way to
prevent the addition of malicious entrie... | """
This approximates the mlab-ns slice information gathering. The actual
system uses nagios and we're not certain about the details. This much
simplified version is just a web URL anyone may PUT data into.
Warning: This doesn't have any security properties! We need a way to
prevent the addition of malicious entrie... | apache-2.0 | Python |
3ab50fb563a89449af94af0d870c6a6153afdb98 | reformat as pep8 | CodeforChemnitz/BaustellenChemnitz | helper/listConcat.py | helper/listConcat.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
class listConcat:
lists = None
def add(self, listToAdd):
if self.lists == None:
self.lists = [listToAdd]
return
for i, l in enumerate(self.lists):
if l[0] == listToAdd[-1]:
self.lists[i] = listToA... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
class listConcat:
lists = None
def add(self, listToAdd):
if self.lists == None:
self.lists = [listToAdd]
return
for i, l in enumerate(self.lists):
if l[0] == listToAdd[-1]:
self.lists[i] = listToAdd[:-1] + l
return
elif l[-1] == listToAdd[0]:
... | mit | Python |
e4be9429e050dae6b1c9e988fa3da3c3e9d1d417 | Add bots root directory to parent.py | mvollmer/cockpit,mvollmer/cockpit,cockpit-project/cockpit,martinpitt/cockpit,martinpitt/cockpit,garrett/cockpit,garrett/cockpit,cockpit-project/cockpit,cockpit-project/cockpit,martinpitt/cockpit,mvollmer/cockpit,martinpitt/cockpit,garrett/cockpit,garrett/cockpit,mvollmer/cockpit,cockpit-project/cockpit,mvollmer/cockpit... | test/common/parent.py | test/common/parent.py | import os
import sys
TEST_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
BOTS_DIR = os.path.join(os.path.dirname(TEST_DIR), "bots")
sys.path.append(os.path.join(BOTS_DIR)) # for lib
sys.path.append(os.path.join(BOTS_DIR, "machine"))
sys.path.append(os.path.join(TEST_DIR, "common"))
| import os
import sys
TEST_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
BOTS_DIR = os.path.join(os.path.dirname(TEST_DIR), "bots")
sys.path.append(os.path.join(BOTS_DIR, "machine"))
sys.path.append(os.path.join(TEST_DIR, "common"))
| lgpl-2.1 | Python |
826f23f0fc7eea4c72dcc26f637f3752bee51b47 | Allow tests to be called from parent directory of "test" | kanzure/ctypesgen,kanzure/ctypesgen,novas0x2a/ctypesgen,davidjamesca/ctypesgen,kanzure/ctypesgen | test/ctypesgentest.py | test/ctypesgentest.py | import optparse, sys, StringIO
sys.path.append(".") # Allow tests to be called from parent directory with Python 2.6
sys.path.append("..")
import ctypesgencore
"""ctypesgentest is a simple module for testing ctypesgen on various C constructs. It consists of a
single function, test(). test() takes a string that repres... | import optparse, sys, StringIO
sys.path.append("..")
import ctypesgencore
"""ctypesgentest is a simple module for testing ctypesgen on various C constructs. It consists of a
single function, test(). test() takes a string that represents a C header file, along with some
keyword arguments representing options. It proces... | bsd-3-clause | Python |
bd7a1f8fe5237efc0de9fd60ddc035cc4be620ca | Update path_helper.py | conversationai/unintended-ml-bias-analysis,conversationai/unintended-ml-bias-analysis | unintended_ml_bias/new_madlibber/path_helper.py | unintended_ml_bias/new_madlibber/path_helper.py | import os
class PathHelper(object):
def __init__(self, word_file, sentence_template_file, output_file):
if not os.path.exists(word_file):
raise IOError("Input word file '{}' does not exist!".format(word_file))
if not os.path.isfile(word_file):
raise IOError("Input word file '{}' is not a file!"... | import os
class PathHelper(object):
def __init__(self, word_file, sentence_template_file, output_file):
if not os.path.exists(word_file):
raise IOError("Input word file '{}' does not exist!".format(word_file))
if not os.path.isfile(word_file):
raise IOError("Input word file '{}' is not a file!".f... | apache-2.0 | Python |
3d4afd579bdd690c9fba94ee96e52257bf4d79d2 | copy production procfile | battlemidget/juju-charm-huginn | reactive/huginn.py | reactive/huginn.py | from charms.reactive import (
hook,
when,
only_once,
is_state
)
import os.path as path
from charmhelpers.core import hookenv, host
from charmhelpers.core.templating import render
from charmhelpers.fetch import apt_install
from shell import shell
# ./lib/nginxlib
import nginxlib
# ./lib/rubylib
from r... | from charms.reactive import (
hook,
when,
only_once,
is_state
)
import os.path as path
from charmhelpers.core import hookenv, host
from charmhelpers.core.templating import render
from charmhelpers.fetch import apt_install
from shell import shell
# ./lib/nginxlib
import nginxlib
# ./lib/rubylib
from r... | mit | Python |
86216b39365a7877103dfe075bf8e08a8ce696d0 | bump version | renalreg/radar,renalreg/radar,renalreg/radar,renalreg/radar | radar/__init__.py | radar/__init__.py | __version__ = '2.47.23'
| __version__ = '2.47.22'
| agpl-3.0 | Python |
3bfcc096acd5f3ed0cda2427bdc5177bd3e55dd7 | bump version | renalreg/radar,renalreg/radar,renalreg/radar,renalreg/radar | radar/__init__.py | radar/__init__.py | __version__ = '2.46.26'
| __version__ = '2.46.25'
| agpl-3.0 | Python |
d94e862d5775ecedf49fb0e15820b4744573c24c | bump to 1.1.1 | rubik/radon | radon/__init__.py | radon/__init__.py | '''This module contains the main() function, which is the entry point for the
command line interface.'''
__version__ = '1.1.1'
def main():
'''The entry point for Setuptools.'''
import sys
from radon.cli import program, log_error
if not sys.argv[1:]:
sys.argv.append('-h')
try:
pro... | '''This module contains the main() function, which is the entry point for the
command line interface.'''
__version__ = '1.1'
def main():
'''The entry point for Setuptools.'''
import sys
from radon.cli import program, log_error
if not sys.argv[1:]:
sys.argv.append('-h')
try:
progr... | mit | Python |
370d58420c48ed5291fb3291a3f89449b2fb5230 | Add description to update-production script | muzhack/musitechhub,muzhack/muzhack,muzhack/musitechhub,muzhack/muzhack,muzhack/muzhack,muzhack/musitechhub,muzhack/musitechhub,muzhack/muzhack | docker/update-production.py | docker/update-production.py | #!/usr/bin/env python3
import argparse
import subprocess
import json
import sys
parser = argparse.ArgumentParser(description='Update production server to latest Docker image.')
args = parser.parse_args()
def _info(msg):
sys.stdout.write('* {}\n'.format(msg))
sys.stdout.flush()
def _run_tutum(args):
tr... | #!/usr/bin/env python3
import argparse
import subprocess
import json
import sys
parser = argparse.ArgumentParser()
args = parser.parse_args()
def _info(msg):
sys.stdout.write('* {}\n'.format(msg))
sys.stdout.flush()
def _run_tutum(args):
try:
subprocess.check_call(['tutum',] + args, stdout=sub... | mit | Python |
f4a8121bf38cdd8dea4a828316dc1c117c5ea0f3 | update West Devon import script for parl.2017-06-08 (closes #902) | chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_west_devon.py | polling_stations/apps/data_collection/management/commands/import_west_devon.py | from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = 'E07000047'
addresses_name = 'parl.2017-06-08/Version 2/merged.tsv'
stations_name = 'parl.2017-06-08/Version 2/merged.tsv'
elections = ['parl.2017-06-08']
... | from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = 'E07000047'
addresses_name = 'Democracy_Club__04May2017 - west devon.TSV'
stations_name = 'Democracy_Club__04May2017 - west devon.TSV'
elections = [
... | bsd-3-clause | Python |
7b1871b311aae41d699a41da7c6553b45a588313 | purge wip about cassandra metrics (not-the-right-place) | SergioChan/Stream-Framework,turbolabtech/Stream-Framework,Anislav/Stream-Framework,izhan/Stream-Framework,turbolabtech/Stream-Framework,nikolay-saskovets/Feedly,smuser90/Stream-Framework,Anislav/Stream-Framework,nikolay-saskovets/Feedly,smuser90/Stream-Framework,turbolabtech/Stream-Framework,SergioChan/Stream-Framework... | feedly/storage/cassandra/models.py | feedly/storage/cassandra/models.py | from cqlengine import columns
from cqlengine.models import Model
from cqlengine.exceptions import ValidationError
class VarInt(columns.Column):
db_type = 'varint'
def validate(self, value):
val = super(VarInt, self).validate(value)
if val is None:
return
try:
r... | from cqlengine import columns
from cqlengine.models import Model
from cqlengine.exceptions import ValidationError
class VarInt(columns.Column):
db_type = 'varint'
def validate(self, value):
val = super(VarInt, self).validate(value)
if val is None:
return
try:
r... | bsd-3-clause | Python |
f7fc6556e3ef552ed570ad56db7dc3a19b3e75fd | Load config from site | Xi-Plus/Xiplus-Wikipedia-Bot,Xi-Plus/Xiplus-Wikipedia-Bot | fix-broken-double-redirect/edit.py | fix-broken-double-redirect/edit.py | # -*- coding: utf-8 -*-
import argparse
import json
import os
import re
os.environ['PYWIKIBOT_DIR'] = os.path.dirname(os.path.realpath(__file__))
import pywikibot
from config import config_page_name # pylint: disable=E0611,W0614
parser = argparse.ArgumentParser()
parser.add_argument('-c', '--check', action='store_t... | # -*- coding: utf-8 -*-
import argparse
import os
import re
os.environ['PYWIKIBOT_DIR'] = os.path.dirname(os.path.realpath(__file__))
import pywikibot
parser = argparse.ArgumentParser()
parser.add_argument('-c', '--check', action='store_true', dest='check')
parser.set_defaults(check=False)
args = parser.parse_args()... | mit | Python |
5ec45f9d8a7b4c54ecca0ad48f244c2ab0b8d532 | remove no longer necessary package declaration | ZeitOnline/zeit.content.cp,ZeitOnline/zeit.content.cp | src/zeit/content/cp/blocks/tests.py | src/zeit/content/cp/blocks/tests.py | # -*- coding: utf-8 -*-
# Copyright (c) 2009 gocept gmbh & co. kg
# See also LICENSE.txt
import zeit.content.cp.blocks
import zeit.content.cp.testing
def test_suite():
return zeit.content.cp.testing.FunctionalDocFileSuite(
'teaser.txt',
'xml.txt')
| # -*- coding: utf-8 -*-
# Copyright (c) 2009 gocept gmbh & co. kg
# See also LICENSE.txt
import zeit.content.cp.blocks
import zeit.content.cp.testing
def test_suite():
return zeit.content.cp.testing.FunctionalDocFileSuite(
'teaser.txt',
'xml.txt',
package=zeit.content.cp.blocks)
| bsd-3-clause | Python |
69eafa95df4bdeb143d40c321f0a312d06efff1f | Add __all__ to segmentation package | Midafi/scikit-image,pratapvardhan/scikit-image,michaelaye/scikit-image,bsipocz/scikit-image,blink1073/scikit-image,robintw/scikit-image,oew1v07/scikit-image,Britefury/scikit-image,chriscrosscutler/scikit-image,Hiyorimi/scikit-image,vighneshbirodkar/scikit-image,paalge/scikit-image,newville/scikit-image,ajaybhat/scikit-... | skimage/segmentation/__init__.py | skimage/segmentation/__init__.py | from .random_walker_segmentation import random_walker
from ._felzenszwalb import felzenszwalb
from ._slic import slic
from ._quickshift import quickshift
from .boundaries import find_boundaries, visualize_boundaries, mark_boundaries
from ._clear_border import clear_border
from ._join import join_segmentations, relabel_... | from .random_walker_segmentation import random_walker
from ._felzenszwalb import felzenszwalb
from ._slic import slic
from ._quickshift import quickshift
from .boundaries import find_boundaries, visualize_boundaries, mark_boundaries
from ._clear_border import clear_border
from ._join import join_segmentations, relabel_... | bsd-3-clause | Python |
d59f3259875ffac49668ffb3ce34ca511385ebb7 | Fix USE_X_FORWARDED_FOR for proxied environments | funkybob/django-rated | rated/settings.py | rated/settings.py |
from django.conf import settings
DEFAULT_REALM = getattr(settings, 'RATED_DEFAULT_REALM', 'default')
DEFAULT_LIMIT = getattr(settings, 'RATED_DEFAULT_LIMIT', 100)
DEFAULT_DURATION = getattr(settings, 'RATED_DEFAULT_DURATION', 60 * 60)
RESPONSE_CODE = getattr(settings, 'RATED_RESPONSE_CODE', 429)
RESPONSE_MESSAGE = g... |
from django.conf import settings
DEFAULT_REALM = getattr(settings, 'RATED_DEFAULT_REALM', 'default')
DEFAULT_LIMIT = getattr(settings, 'RATED_DEFAULT_LIMIT', 100)
DEFAULT_DURATION = getattr(settings, 'RATED_DEFAULT_DURATION', 60 * 60)
RESPONSE_CODE = getattr(settings, 'RATED_RESPONSE_CODE', 429)
RESPONSE_MESSAGE = g... | bsd-3-clause | Python |
b613ecdb3e543a4c39c5bd80359c81e504c1da33 | add -mlong-calls to gcc compile parameter | gbcwbz/rt-thread,FlyLu/rt-thread,geniusgogo/rt-thread,AubrCool/rt-thread,wolfgangz2013/rt-thread,wolfgangz2013/rt-thread,RT-Thread/rt-thread,geniusgogo/rt-thread,nongxiaoming/rt-thread,AubrCool/rt-thread,zhaojuntao/rt-thread,geniusgogo/rt-thread,ArdaFu/rt-thread,wolfgangz2013/rt-thread,hezlog/rt-thread,zhaojuntao/rt-th... | examples/module/rtconfig_lm3s.py | examples/module/rtconfig_lm3s.py | # bsp name
BSP = 'lm3s8962'
# toolchains
EXEC_PATH = 'C:/Program Files/CodeSourcery/Sourcery G++ Lite/bin'
PREFIX = 'arm-none-eabi-'
CC = PREFIX + 'gcc'
CXX = PREFIX + 'g++'
AS = PREFIX + 'gcc'
AR = PREFIX + 'ar'
LINK = PREFIX + 'gcc'
TARGET_EXT = 'so'
SIZE = PREFIX + 'size'
OBJDUMP = PREFIX + 'objdump'
... | # bsp name
BSP = 'lm3s8962'
# toolchains
EXEC_PATH = 'C:/Program Files/CodeSourcery/Sourcery G++ Lite/bin'
PREFIX = 'arm-none-eabi-'
CC = PREFIX + 'gcc'
CXX = PREFIX + 'g++'
AS = PREFIX + 'gcc'
AR = PREFIX + 'ar'
LINK = PREFIX + 'gcc'
TARGET_EXT = 'so'
SIZE = PREFIX + 'size'
OBJDUMP = PREFIX + 'objdump'
... | apache-2.0 | Python |
ce869c128d728af4c296eb96ecae0db6f30996a7 | Make brnn_ptb_test write checkpoints to temp directory | deepmind/sonnet,deepmind/sonnet | sonnet/examples/brnn_ptb_test.py | sonnet/examples/brnn_ptb_test.py | # Copyright 2017 The Sonnet Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | # Copyright 2017 The Sonnet Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | apache-2.0 | Python |
c2a3443bd129b51df82826806829d50d6c01ee69 | remove password | iamalbert/chinese-segmenter,iamalbert/chinese-segmenter,iamalbert/chinese-segmenter | demo.py | demo.py | import chineseseg
string = "蘇迪勒颱風造成土石崩塌,供應台北市用水的南勢溪挾帶大量泥沙,原水濁度一度飆高。"
ckip = chineseseg.Ckip("myaccount", "mypassword")
stanford = chineseseg.stanford("/home/wlzhuang/stanford-segmenter-2015-04-20/stanford-segmenter-3.5.2.jar", debug=True)
print( "stanford:", stanford.segment(string) )
print( "ckip:", ckip.segm... | import chineseseg
string = "蘇迪勒颱風造成土石崩塌,供應台北市用水的南勢溪挾帶大量泥沙,原水濁度一度飆高。"
ckip = chineseseg.Ckip("wlzhuang", "xxxxaaaackip")
stanford = chineseseg.stanford("/home/wlzhuang/stanford-segmenter-2015-04-20/stanford-segmenter-3.5.2.jar", debug=True)
print( "stanford:", stanford.segment(string) )
print( "ckip:", ckip.seg... | mit | Python |
c1ae43fd33cd0f8eb3e270907a8ed7e728d1e268 | Add captured_at timestamp to POST payload | nicolas-fricke/keypost | server.py | server.py | import evdev
import requests
import json
import datetime
import yaml
def main():
config = load_config()
dev = evdev.InputDevice(config['device_path'])
output_line('Initialized - Capturing device: ' + str(dev))
for event in dev.read_loop():
if event.type == evdev.ecodes.EV_KEY:
output_line(event)
... | import evdev
import requests
import json
import datetime
import yaml
def main():
config = load_config()
dev = evdev.InputDevice(config['device_path'])
output_line('Initialized - Capturing device: ' + str(dev))
for event in dev.read_loop():
if event.type == evdev.ecodes.EV_KEY:
event = evdev.categor... | mit | Python |
13b6e289f3ced59068d91dff2b2ef12a7805fabe | Create test definitions. | pyohei/cronquot,pyohei/cronquot | test/test_cronquot.py | test/test_cronquot.py | import unittest
import os
from cronquot.cronquot import has_directory
class CronquotTest(unittest.TestCase):
def test_has_directory(self):
sample_dir = os.path.join(
os.path.dirname(__file__), 'crontab')
self.assertTrue(has_directory(sample_dir))
def test_parse_command(self):... | import unittest
import os
from cronquot.cronquot import has_directory
class CronquotTest(unittest.TestCase):
def test_has_directory(self):
sample_dir = os.path.join(
os.path.dirname(__file__), 'crontab')
self.assertTrue(has_directory(sample_dir))
if __name__ == '__main__':
un... | mit | Python |
5e4d3c0b28104c1e98ed3e426dab9fc5d4d5a960 | Add more comments to loadfail test | 3ptscience/git-project,aranzgeo/git-project | test/test_loadfail.py | test/test_loadfail.py | #!bin/env python
import subprocess
import os.path
import unittest, re
class TestSaveLoad(unittest.TestCase):
@classmethod
def setUpClass(self):
# ensure we start with a clean slate, just in case
subprocess.call('rm -rf remote local 2>> /dev/null', shell=True)
# Initialize "remote" ... | #!bin/env python
import subprocess
import os.path
import unittest, re
class TestSaveLoad(unittest.TestCase):
@classmethod
def setUpClass(self):
subprocess.call('rm -rf remote local 2>> /dev/null', shell=True)
subprocess.call('mkdir remote; mkdir local', shell=True)
subprocess.call(... | mit | Python |
38b078eb13a42bf65d1f55141a69fcd8819a1f00 | add models | covrom/django_sample,covrom/django_sample | mysite/polls/models.py | mysite/polls/models.py | from django.db import models
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
class Choice(models.Model):
question = models.ForeignKey(Question, on_delete=models.CASCADE)
choice_text = models.CharField(max_length=200)
... | from django.db import models
# Create your models here.
| mit | Python |
29835c78d1ddfd934aa552f4c68117a32379c5ea | add lmsd.sqlite | jerkos/mzOS | mzos/tests/__init__.py | mzos/tests/__init__.py | from __future__ import absolute_import
import zipfile
import os.path as op
import os
import shutil
import logging
class WithHMDBMixin(object):
@staticmethod
def unzip_hmdb():
"""
Utility to unzip hmdb for test purposes
:param self:
:return:
"""
z = zipfile.ZipF... | from __future__ import absolute_import
import zipfile
import os.path as op
import os
import shutil
import logging
class WithHMDBMixin(object):
@staticmethod
def unzip_hmdb():
"""
Utility to unzip hmdb for test purposes
:param self:
:return:
"""
abspath = op.abs... | mit | Python |
3ffd045be41d226bcf1b533c3f5abf95a932eac0 | Remove duplicate test | J-CPelletier/webcomix,J-CPelletier/webcomix,J-CPelletier/WebComicToCBZ | webcomix/scrapy/tests/test_crawler_worker.py | webcomix/scrapy/tests/test_crawler_worker.py | import pytest
from webcomix.exceptions import NextLinkNotFound
from webcomix.scrapy.crawler_worker import CrawlerWorker
from webcomix.scrapy.verification.verification_spider import VerificationSpider
from webcomix.tests.fake_websites.fixture import one_webpage_uri
def test_spider_raising_error_gets_raised_by_crawler... | import pytest
from webcomix.exceptions import NextLinkNotFound
from webcomix.scrapy.crawler_worker import CrawlerWorker
from webcomix.scrapy.verification.verification_spider import VerificationSpider
from webcomix.tests.fake_websites.fixture import one_webpage_uri
def test_spider_raising_error_gets_raised_by_crawler... | mit | Python |
ceb7b806c838a12d3447d0fd9bccc5aae49832d5 | Use a new session so that server will not receive signals | clchiou/garage,clchiou/garage,clchiou/garage,clchiou/garage | garage/multiprocessing/__init__.py | garage/multiprocessing/__init__.py | __all__ = [
'RpcConnectionError',
'RpcError',
'python',
]
import contextlib
import logging
import os
import os.path
import random
import shutil
import subprocess
import tempfile
import time
import garage.multiprocessing.server
from garage.multiprocessing.client import Connector
from garage.multiprocessin... | __all__ = [
'RpcConnectionError',
'RpcError',
'python',
]
import contextlib
import logging
import os
import os.path
import random
import shutil
import subprocess
import tempfile
import time
import garage.multiprocessing.server
from garage.multiprocessing.client import Connector
from garage.multiprocessin... | mit | Python |
05d2421668e663bf9e98ec51ec1d8977ffe8c1b3 | Add static folder | pac-club-2017/instant-grade-checker,pac-club-2017/instant-grade-checker,pac-club-2017/instant-grade-checker,pac-club-2017/instant-grade-checker | server.py | server.py | import os
from flask import Flask
from flask import send_from_directory
from flask_cors import CORS
from igc.controller.controller_register import register_controllers
from igc.util import cache
app = Flask(__name__, static_url_path='html')
CORS(app)
app.config['SQLALCHEMY_DATABASE_URI'] = os.getenv('database_uri', ... | import os
from flask import Flask
from flask import send_from_directory
from flask_cors import CORS
from igc.controller.controller_register import register_controllers
from igc.util import cache
app = Flask(__name__)
CORS(app)
app.config['SQLALCHEMY_DATABASE_URI'] = os.getenv('database_uri', 'sqlite:///./sqllite.db'... | agpl-3.0 | Python |
d3f8922394ca2e18d624f1d542f2fc13a18475d3 | Make sorting links reset pagination | hartwork/wnpp.debian.net,hartwork/wnpp.debian.net,hartwork/wnpp.debian.net | wnpp_debian_net/templatetags/sorting_urls.py | wnpp_debian_net/templatetags/sorting_urls.py | # Copyright (C) 2021 Sebastian Pipping <sebastian@pipping.org>
# Licensed under GNU Affero GPL v3 or later
from django import template
from ..url_tools import url_with_query
register = template.Library()
INTERNAL_DIRECTION_PREFIX_ASCENDING = ''
INTERNAL_DIRECTION_PREFIX_DESCENDING = '-'
EXTERNAL_DIRECTION_SUFFIX_A... | # Copyright (C) 2021 Sebastian Pipping <sebastian@pipping.org>
# Licensed under GNU Affero GPL v3 or later
from django import template
from ..url_tools import url_with_query
register = template.Library()
INTERNAL_DIRECTION_PREFIX_ASCENDING = ''
INTERNAL_DIRECTION_PREFIX_DESCENDING = '-'
EXTERNAL_DIRECTION_SUFFIX_A... | agpl-3.0 | Python |
300e1461174107f1c2f8523ce105739d42d71803 | Write EMAIL_HOST to settings only if specified | brutasse-archive/fab-bundle,linovia/fab-bundle,linovia/fab-bundle | fab_bundle/templates/settings.py | fab_bundle/templates/settings.py | from {{ base_settings }} import *
DEBUG = False
TEMPLATE_DEBUG = DEBUG
ADMINS = ({% for admin in admins %}
('{{ admin.name }}', '{{ admin.email }}'),{% endfor %}
)
MANAGERS = ADMINS
SEND_BROKEN_LINK_EMAILS = True
SECRET_KEY = '{{ secret_key }}'
BASE_URL = 'http{% if ssl_cert %}s{% endif %}://{{ http_host }}'
ME... | from {{ base_settings }} import *
DEBUG = False
TEMPLATE_DEBUG = DEBUG
ADMINS = ({% for admin in admins %}
('{{ admin.name }}', '{{ admin.email }}'),{% endfor %}
)
MANAGERS = ADMINS
SEND_BROKEN_LINK_EMAILS = True
SECRET_KEY = '{{ secret_key }}'
BASE_URL = 'http{% if ssl_cert %}s{% endif %}://{{ http_host }}'
ME... | bsd-3-clause | Python |
9694d5d0cbdcca874b791e6616dda831f8961373 | Add a little debugging to the Papilio target | scanlime/flipsyfat,scanlime/flipsyfat | flipsyfat/targets/papilio_pro.py | flipsyfat/targets/papilio_pro.py | #!/usr/bin/env python3
import argparse
from migen import *
from flipsyfat.cores.sd_emulator import SDEmulator
from flipsyfat.cores.sd_trigger import SDTrigger
from misoc.targets.papilio_pro import BaseSoC
from migen.build.generic_platform import *
from misoc.integration.soc_sdram import *
from misoc.integration.build... | #!/usr/bin/env python3
import argparse
from migen import *
from flipsyfat.cores.sd_emulator import SDEmulator
from flipsyfat.cores.sd_trigger import SDTrigger
from misoc.targets.papilio_pro import BaseSoC
from migen.build.generic_platform import *
from misoc.integration.soc_sdram import *
from misoc.integration.build... | mit | Python |
177bd7546faea56750a182c46a8fd6a892ff5d6a | Update State turns, those aren't game attributes | supermitch/mech-ai,supermitch/mech-ai,supermitch/mech-ai | game.py | game.py | import datetime
import json
import map_loader
import queue
import state
import utils
class GAME_STATUS(object):
""" Game status constants. """
lobby = 'lobby' # In matchmaking lobby, waiting for all players
playing = 'playing' # In game mode, waiting for turns
complete = 'complete' # Game finished... | import datetime
import json
import map_loader
import queue
import state
import utils
class GAME_STATUS(object):
""" Game status constants. """
lobby = 'lobby' # In matchmaking lobby, waiting for all players
playing = 'playing' # In game mode, waiting for turns
complete = 'complete' # Game finished... | mit | Python |
2a696cd458ab2f67df5a6cfce0fe2016a8106eb4 | add default channels | shortdudey123/gbot | gbot.py | gbot.py | #!/usr/bin/env python
# =============================================================================
# file = gbot.py
# description = IRC bot
# author = GR <https://github.com/shortdudey123>
# create_date = 2014-07-09
# mod_date = 2014-07-09
# version = 0.1
# usage = called as a class
# notes =
# python_ver = 2.7.6
# ... | #!/usr/bin/env python
# =============================================================================
# file = gbot.py
# description = IRC bot
# author = GR <https://github.com/shortdudey123>
# create_date = 2014-07-09
# mod_date = 2014-07-09
# version = 0.1
# usage = called as a class
# notes =
# python_ver = 2.7.6
# ... | apache-2.0 | Python |
40ae754565f52c7631798823d13332b37f52e0c5 | fix misuse of msg_split | ryansb/netHUD | nethud/proto/telnet.py | nethud/proto/telnet.py | from __future__ import print_function
from twisted.internet import reactor, protocol, threads, defer
from twisted.protocols.basic import LineReceiver
from nethud.proto.client import NethackFactory
class TelnetConnection(LineReceiver):
def __init__(self, users):
self.users = users
self.uname = ''... | from __future__ import print_function
from twisted.internet import reactor, protocol, threads, defer
from twisted.protocols.basic import LineReceiver
from nethud.proto.client import NethackFactory
class TelnetConnection(LineReceiver):
def __init__(self, users):
self.users = users
self.uname = ''... | mit | Python |
4d810f6f447cdab43187e6da1cca2830766731f1 | add config check test | akfullfo/taskforce | tests/test_05_task.py | tests/test_05_task.py |
# ________________________________________________________________________
#
# Copyright (C) 2014 Andrew Fullford
#
# 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.ap... |
# ________________________________________________________________________
#
# Copyright (C) 2014 Andrew Fullford
#
# 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.ap... | apache-2.0 | Python |
ddfc569ba310ce2de3b4a4ae63111556646496f8 | remove more f-strings | lilydjwg/nvchecker | tests/test_keyfile.py | tests/test_keyfile.py | # MIT licensed
# Copyright (c) 2018 lilydjwg <lilydjwg@gmail.com>, et al.
import os
import tempfile
import contextlib
from nvchecker.source import HTTPError
import pytest
pytestmark = [pytest.mark.asyncio]
@contextlib.contextmanager
def unset_github_token_env():
token = os.environ.get('NVCHECKER_GITHUB_TOKEN')
... | # MIT licensed
# Copyright (c) 2018 lilydjwg <lilydjwg@gmail.com>, et al.
import os
import tempfile
import contextlib
from nvchecker.source import HTTPError
import pytest
pytestmark = [pytest.mark.asyncio]
@contextlib.contextmanager
def unset_github_token_env():
token = os.environ.get('NVCHECKER_GITHUB_TOKEN')
... | mit | Python |
9e62b41dc762b1088bd5c1474678d7e7ed120add | test case with stage parameter | ownport/pkgstack | tests/test_profile.py | tests/test_profile.py |
import os
import sys
import pytest
from pkgstack.profile import Profile
TESTS_PATH=os.path.realpath(os.path.dirname(__file__))
def test_profile_create(tmpdir):
config = Profile(os.path.join(TESTS_PATH, 'resources/sample.yml')).config
assert config == [
{'install': 'pytest', 'stage': 'test'},
... |
import os
import sys
import pytest
from pkgstack.profile import Profile
TESTS_PATH=os.path.realpath(os.path.dirname(__file__))
def test_profile_create(tmpdir):
config = Profile(os.path.join(TESTS_PATH, 'resources/sample.yml')).config
assert config == [
{'install': 'pytest', 'stage': 'test'},
... | mit | Python |
244fc6b436398055f650ea3a64e9388586604cd9 | Add test for group collection access. | hoover/search,hoover/search,hoover/search | testsuite/test_acl.py | testsuite/test_acl.py | import pytest
pytestmark = pytest.mark.django_db
def test_collections_acl_users(client):
from django.contrib.auth.models import User, AnonymousUser
from hoover.search.models import Collection
from hoover.search.views import collections_acl
anonymous = AnonymousUser()
alice = User.objects.create_us... | import pytest
pytestmark = pytest.mark.django_db
def test_collections_acl(client):
from django.contrib.auth.models import User, AnonymousUser
from hoover.search.models import Collection
from hoover.search.views import collections_acl
anonymous = AnonymousUser()
alice = User.objects.create_user('al... | mit | Python |
fa7b2a707be689c57d744d0ada5049dfb6b15789 | Set leave=False on pbar | spacy-io/thinc,spacy-io/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc,explosion/thinc,explosion/thinc | thinc/neural/train.py | thinc/neural/train.py | from __future__ import unicode_literals, print_function
from .optimizers import Eve, Adam, SGD, linear_decay
from .util import minibatch
import numpy.random
from tqdm import tqdm
class Trainer(object):
def __init__(self, model, **cfg):
self.ops = model.ops
self.model = model
self.L2 = cf... | from __future__ import unicode_literals, print_function
from .optimizers import Eve, Adam, SGD, linear_decay
from .util import minibatch
import numpy.random
from tqdm import tqdm
class Trainer(object):
def __init__(self, model, **cfg):
self.ops = model.ops
self.model = model
self.L2 = cf... | mit | Python |
603bfdc9cb0f9bf8e29306e161728423f1f57f86 | Update dependency bazelbuild/bazel to latest version | google/copybara,google/copybara,google/copybara | third_party/bazel.bzl | third_party/bazel.bzl | # Copyright 2019 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | # Copyright 2019 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | apache-2.0 | Python |
34721c0078d564538a4cf20ac15560a1bf119bac | Update dependency bazelbuild/bazel to latest version | google/copybara,google/copybara,google/copybara | third_party/bazel.bzl | third_party/bazel.bzl | # Copyright 2019 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | # Copyright 2019 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | apache-2.0 | Python |
fd641ebb631d4b7d03bf978de2dc22f4c2966dd5 | Update Bazel to latest version | google/copybara,google/copybara,google/copybara | third_party/bazel.bzl | third_party/bazel.bzl | # Copyright 2019 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | # Copyright 2019 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | apache-2.0 | Python |
b3abe856ff2e430f64c60d28b77e95c73b842b47 | fix wrong table header | marcorosa/wos-cli | src/search.py | src/search.py | import xml.etree.ElementTree as ET
import texttable as tt
import re
from config import user_id, password
from datetime import date
from wos import WosClient
def _draw_table(data):
# Generate table
tab = tt.Texttable()
tab.add_rows(data)
tab.set_cols_align(['l', 'l', 'l'])
tab.header(['Year', 'Tit... | import xml.etree.ElementTree as ET
import texttable as tt
import re
from config import user_id, password
from datetime import date
from wos import WosClient
def _draw_table(data):
# Generate table
tab = tt.Texttable()
tab.add_rows(data)
tab.set_cols_align(['l', 'l', 'l'])
tab.header(['year', 'id'... | mit | Python |
f09c65f980fd9a7364d038ca8eb0b007f74677f5 | Increase version | ITCase-django/django-tinymce-4,ITCase-django/django-tinymce-4,ITCase-django/django-tinymce-4 | tinymce_4/__init__.py | tinymce_4/__init__.py | # -*- coding: utf-8 -*-
__version__ = '0.0.25-dev'
| # -*- coding: utf-8 -*-
__version__ = '0.0.24'
| mit | Python |
cca2ef0f3700c4eafe66c8f751ecb2fc03318e2b | Disable boto3 deprecation warning logs | chaordic/ignition-core,chaordic/ignition-core,chaordic/ignition-core | tools/delete_fleet.py | tools/delete_fleet.py | import sys
from time import sleep
import boto3
from botocore.exceptions import ClientError
boto3.compat.filter_python_deprecation_warnings()
def describe_fleets(region, fleet_id):
ec2 = boto3.client('ec2', region_name=region)
response = ec2.describe_fleets(
FleetIds=[
fleet_id
],
... | import sys
from time import sleep
import boto3
from botocore.exceptions import ClientError
def describe_fleets(region, fleet_id):
ec2 = boto3.client('ec2', region_name=region)
response = ec2.describe_fleets(
FleetIds=[
fleet_id
],
)
errors = response['Fleets'][0]['Errors']
... | mit | Python |
8a6370f7c91fec6c220bc2e438a236816c636341 | Revert throttle Arlo api calls (#13174) | sander76/home-assistant,home-assistant/home-assistant,turbokongen/home-assistant,tboyce1/home-assistant,kennedyshead/home-assistant,Cinntax/home-assistant,aronsky/home-assistant,tboyce021/home-assistant,jabesq/home-assistant,mezz64/home-assistant,robbiet480/home-assistant,soldag/home-assistant,mKeRix/home-assistant,nug... | homeassistant/components/arlo.py | homeassistant/components/arlo.py | """
This component provides support for Netgear Arlo IP cameras.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/arlo/
"""
import logging
import voluptuous as vol
from requests.exceptions import HTTPError, ConnectTimeout
from homeassistant.helpers impo... | """
This component provides support for Netgear Arlo IP cameras.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/arlo/
"""
import logging
from datetime import timedelta
import voluptuous as vol
from requests.exceptions import HTTPError, ConnectTimeout
... | apache-2.0 | Python |
b221ed2e83cd352b1eec0ad74a3e02946db39197 | Add an example of yielding a dict in plpy | HazyResearch/deepdive,HazyResearch/deepdive,AlexisBRENON/deepdive,shahin/deepdive,zifeishan/deepdive,Atlas7/deepdive,topojoy/deepdive,AlexisBRENON/deepdive,sky-xu/deepdive,gaapt/deepdive,zifeishan/deepdive,kod3r/deepdive,sai16vicky/deepdive,Atlas7/deepdive,vasyvas/deepdive,zifeishan/deepdive,AlexisBRENON/deepdive,RTsWo... | examples/spouse_example/plpy_extractor/udf/ext_people.py | examples/spouse_example/plpy_extractor/udf/ext_people.py | #! /usr/bin/env python
import ddext
import itertools
# Format of plpy_extractor:
# Anything Write functions "init", "run" will not be accepted.
# In "init", import libraries, specify input variables and return types
# In "run", write your extractor. Return a list containing your results, each item in the list should ... | #! /usr/bin/env python
import ddext
import itertools
# Format of plpy_extractor:
# Anything Write functions "init", "run" will not be accepted.
# In "init", import libraries, specify input variables and return types
# In "run", write your extractor. Return a list containing your results, each item in the list should ... | apache-2.0 | Python |
3010b38a15ca90f51a72e0cf3698ca218aaa144f | Remove an execution warning. | ProjetPP/Scripts,ProjetPP/Scripts | requests_graph.py | requests_graph.py | #!/usr/bin/env python3
import sys
import time
import array
import datetime
import requests
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
NB_HOURS = 24
GRANULOMETRY = 15 # must be a divisor of 60
if len(sys.argv) != 2:
print('Syntax: %s file.png' % sys.argv[0])
exit(1)
# Get data
da... | #!/usr/bin/env python3
import sys
import time
import array
import datetime
import requests
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
NB_HOURS = 24
GRANULOMETRY = 15 # must be a divisor of 60
if len(sys.argv) != 2:
print('Syntax: %s file.png' % sys.argv[0])
exit(1)
# Get data
da... | cc0-1.0 | Python |
a240cbaa13be8682e5611241634a761df581efff | fix format | kurtwood/sw_assignment3,kurtwood/sw_assignment3,kurtwood/sw_assignment3 | sw-project.py | sw-project.py | # Import the SDK
import facebook
# import the secret token
import secret
# For date and time operations
from datetime import datetime, date, time
# open connection
g = facebook.GraphAPI(secret.ACCESS_TOKEN)
# retrieve friends
friends = g.get_connections("me", "friends")['data']
# retrieve their likes
likes = {friend... | # Import the SDK
import facebook
# import the secret token
import secret
# For date and time operations
from datetime import datetime, date, time
# open connection
g = facebook.GraphAPI(secret.ACCESS_TOKEN)
# retrieve friends
friends = g.get_connections("me", "friends")['data']
# retrieve their likes
likes = { frien... | bsd-3-clause | Python |
e99239184cffbdc1ca08ba0050f6e4f23e1155fd | Allow import error to propagate up | girder/girder_worker,girder/girder_worker,Kitware/romanesco,girder/girder_worker,Kitware/romanesco,Kitware/romanesco,Kitware/romanesco | romanesco/spark.py | romanesco/spark.py | import six
import romanesco
import os
import sys
from ConfigParser import ConfigParser, NoOptionError
def setup_spark_env():
# Setup pyspark
try:
spark_home = romanesco.config.get('spark', 'spark_home')
# If not configured try the environment
if not spark_home:
spark_home... | import six
import romanesco
import os
import sys
from ConfigParser import ConfigParser, NoOptionError
def setup_spark_env():
# Setup pyspark
try:
spark_home = romanesco.config.get('spark', 'spark_home')
# If not configured try the environment
if not spark_home:
spark_home... | apache-2.0 | Python |
7a81c289d944bad4505a51c80b701f5f11159787 | stop bandwagon leaving temp files around | mstriemer/addons-server,mstriemer/addons-server,wagnerand/zamboni,clouserw/zamboni,Witia1/olympia,SuriyaaKudoIsc/olympia,diox/olympia,diox/olympia,mozilla/addons-server,jpetto/olympia,mudithkr/zamboni,beni55/olympia,spasovski/zamboni,anaran/olympia,kumar303/zamboni,psiinon/addons-server,Hitechverma/zamboni,mozilla/addo... | apps/bandwagon/tests/test_tasks.py | apps/bandwagon/tests/test_tasks.py | import os
import shutil
import tempfile
from django.conf import settings
from nose.tools import eq_
from PIL import Image
from amo.tests.test_helpers import get_image_path
from bandwagon.tasks import resize_icon
def test_resize_icon():
somepic = get_image_path('mozilla.png')
src = tempfile.NamedTemporaryF... | import os
import shutil
import tempfile
from django.conf import settings
from nose.tools import eq_
from PIL import Image
from amo.tests.test_helpers import get_image_path
from bandwagon.tasks import resize_icon
def test_resize_icon():
somepic = get_image_path('mozilla.png')
src = tempfile.NamedTemporaryF... | bsd-3-clause | Python |
4e7bc1dc4cc571f09667a9b29ceff8b5acdfbb13 | Drop supplementary variables from formula | almey/policycompass-services,mmilaprat/policycompass-services,policycompass/policycompass-services,policycompass/policycompass-services,almey/policycompass-services,mmilaprat/policycompass-services,mmilaprat/policycompass-services,almey/policycompass-services,policycompass/policycompass-services | apps/metricsmanager/serializers.py | apps/metricsmanager/serializers.py | from rest_framework import serializers
from .models import *
from .formula import validate_formula
from .formula import ComputeSemantics
from drf_compound_fields import fields as compound_fields
class MetricSerializer(serializers.ModelSerializer):
formula = serializers.CharField()
creator_path = serializers.F... | from rest_framework import serializers
from .models import *
from .formula import validate_formula
from .formula import ComputeSemantics
from drf_compound_fields import fields as compound_fields
class MetricSerializer(serializers.ModelSerializer):
formula = serializers.CharField()
creator_path = serializers.F... | agpl-3.0 | Python |
2209d03532d6c0ed7d55cf4cf759fd82585b5ad3 | Update item.py | Lincoln-Cybernetics/Explore- | item.py | item.py | import pygame
class Item(pygame.sprite.Sprite):
def __init__(self, level, *groups):
super(Item, self).__init__(*groups)
#the game level
self.level = level
#base image
self.level.animator.set_Img(6,0)
self.image = self.level.animator.get_Img().convert()
self.image.set_colorkey((255,0,0))
#type
sel... | import pygame
class Item(pygame.sprite.Sprite):
def __init__(self, level, *groups):
super(Item, self).__init__(*groups)
#the game level
self.level = level
#base image
#self.level.animator.set_Img(0,5)
#self.image = self.level.animator.get_Img().convert()
#self.image.set_colorkey((255,0,0))
self.level.... | unlicense | Python |
f408b1368b641be2349266a59b32f7fd1fa53265 | Fix a couple of minor bugs | klmitch/dtest,klmitch/dtest | stream.py | stream.py | from StringIO import StringIO
import sys
from eventlet.corolocal import local
_installed = False
_save_out = None
_save_err = None
class _StreamLocal(local):
def __init__(self):
# Initialize the output and error streams
self.out = StringIO()
self.err = StringIO()
_stlocal = _StreamLoc... | from StringIO import StringIO
import sys
from eventlet.corolocal import local
_installed = False
_save_out = None
_save_err = None
class _StreamLocal(local):
def __init__(self):
# Initialize the output and error streams
self.out = StringIO()
self.err = StringIO()
_stlocal = _StreamLoc... | apache-2.0 | Python |
cbcb89a7a3ee4884768e272bbe3435bb6e08d224 | Add constraints for the same column and the same row | asmeurer/sudoku | sudoku.py | sudoku.py | import datetime
def generate_info(name, version, depends):
return {
"{name}-{version}-0.tar.bz2".format(name=name, version=version): {
"build": "0",
"build_number": 0,
"date": datetime.date.today().strftime("%Y-%m-%d"),
"depends": depends,
"name":... | import datetime
def generate_info(name, version, depends):
return {
"{name}-{version}-0.tar.bz2".format(name=name, version=version): {
"build": "0",
"build_number": 0,
"date": datetime.date.today().strftime("%Y-%m-%d"),
"depends": depends,
"name":... | mit | Python |
2fb9e916155fce16a807c1c7eebf4a607c22ef94 | Correct Celery support to be backwards compatible (fixes GH-124) | someonehan/raven-python,johansteffner/raven-python,ronaldevers/raven-python,akalipetis/raven-python,dbravender/raven-python,akheron/raven-python,jmp0xf/raven-python,jbarbuto/raven-python,recht/raven-python,lepture/raven-python,arthurlogilab/raven-python,arthurlogilab/raven-python,smarkets/raven-python,nikolas/raven-pyt... | raven/contrib/celery/__init__.py | raven/contrib/celery/__init__.py | """
raven.contrib.celery
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
try:
from celery.task import task
except ImportError:
from celery.decorators import task
from celery.signals import after_setup_logger, ... | """
raven.contrib.celery
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
try:
from celery.task import task
except ImportError:
from celery.decorators import task
from celery.signals import after_setup_logger, ... | bsd-3-clause | Python |
8fb149400a115fd0abf595c6716aed22c396eb86 | remove call to curCycle in panic() The panic() function already prints the current tick value. This call to curCycle() is as such redundant. Since we are trying to move towards multiple clock domains, this call will print misleading time. | LingxiaoJIA/gem5,haowu4682/gem5,LingxiaoJIA/gem5,haowu4682/gem5,haowu4682/gem5,haowu4682/gem5,haowu4682/gem5,LingxiaoJIA/gem5,LingxiaoJIA/gem5,haowu4682/gem5,haowu4682/gem5,haowu4682/gem5,LingxiaoJIA/gem5,haowu4682/gem5,LingxiaoJIA/gem5,LingxiaoJIA/gem5 | src/mem/slicc/ast/AST.py | src/mem/slicc/ast/AST.py | # Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
# Copyright (c) 2009 The Hewlett-Packard Development Company
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source co... | # Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
# Copyright (c) 2009 The Hewlett-Packard Development Company
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source co... | bsd-3-clause | Python |
723abaf9bb1ad6d0b8c67e06522bb1d87f3ab82d | Fix broken test, handle terminate on the REQUEST | richo/groundstation,richo/groundstation,richo/groundstation,richo/groundstation,richo/groundstation | test/test_listallobjects_handler.py | test/test_listallobjects_handler.py | from handler_fixture import StationHandlerTestCase
from groundstation.transfer.request_handlers import handle_listallobjects
from groundstation.transfer.response_handlers import handle_terminate
import groundstation.transfer.response as response
from groundstation.proto.object_list_pb2 import ObjectList
class TestH... | from handler_fixture import StationHandlerTestCase
from groundstation.transfer.request_handlers import handle_listallobjects
from groundstation.transfer.response_handlers import handle_terminate
import groundstation.transfer.response as response
from groundstation.proto.object_list_pb2 import ObjectList
class TestH... | mit | Python |
4c5550420b8a9f1bf88f4329952f6e2a161cd20f | Fix test on kaos with latest qt5 | pyQode/pyqode.json,pyQode/pyqode.json | test/test_panels/test_navigation.py | test/test_panels/test_navigation.py | from pyqode.core.api import TextHelper
from pyqode.qt.QtTest import QTest
def test_toggle_button(editor):
editor.file.open('test/files/example.json')
editor.show()
TextHelper(editor).goto_line(6)
QTest.qWait(500)
panel = editor.panels.get('NavigationPanel')
assert len(panel._widgets) == 4
... | from pyqode.core.api import TextHelper
from pyqode.qt.QtTest import QTest
def test_toggle_button(editor):
editor.file.open('test/files/example.json')
editor.show()
TextHelper(editor).goto_line(6)
QTest.qWait(500)
panel = editor.panels.get('NavigationPanel')
assert len(panel._widgets) == 4
... | mit | Python |
6878860d8b8d3377960a8310b6b733a4cbc30959 | use environment variable | nzinov/phystech-seabattle,nzinov/phystech-seabattle,nzinov/phystech-seabattle | main.py | main.py | import os
import tornado.ioloop
import tornado.web
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello, world")
if __name__ == "__main__":
application = tornado.web.Application([
(r"/", MainHandler),
])
application.listen(os.environ['PORT'])
tornado.... | import tornado.ioloop
import tornado.web
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello, world")
if __name__ == "__main__":
application = tornado.web.Application([
(r"/", MainHandler),
])
application.listen(80)
tornado.ioloop.IOLoop.current().st... | agpl-3.0 | Python |
944515624ec57f94b6bdb4e9a46988b9604f4c3b | add basic command line parser. | yumaokao/gdrv,yumaokao/gdrv | main.py | main.py | #!/usr/bin/python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
import sys
import argparse
import re
import logging
lg = logging.getLogger("DRIVE_MAIN")
lg.setLevel(logging.DEBUG)
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
formatter = logging.Formatter('[%(name)s] %(levelname)s - %(message)s')
ch.s... | #!/usr/bin/python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
import sys
import argparse
import re
def main():
print("YMK Goodbye World!!!")
if __name__ == '__main__':
main()
| mit | Python |
4bcf8ea9572b90782e2f1d6150ec96e28002378f | set loglevel to warning | kordless/wisdom,kordless/wisdom,kordless/wisdom,kordless/wisdom | main.py | main.py | """
The MIT License (MIT)
Copyright (c) 2014 Kord Campbell, StackGeek
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, mo... | """
The MIT License (MIT)
Copyright (c) 2014 Kord Campbell, StackGeek
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, mo... | mit | Python |
c126348a70f316c9ef25d70dc87d6b25f69f83af | remove routes | Radcliffe/ParkLife | main.py | main.py | from flask import Flask
app = Flask(__name__)
app.config['DEBUG'] = True
from util import today
from models import Event
from google.appengine.ext import ndb
import twilio.twiml
@app.route('/message', methods=['GET', 'POST'])
def reply():
query = Event.query(Event.date == today())
messages = []
for event ... | from flask import Flask
app = Flask(__name__)
app.config['DEBUG'] = True
from util import today
from models import Event
from google.appengine.ext import ndb
import twilio.twiml
@app.route('/')
def hello():
"""Return a friendly HTTP greeting."""
return 'Hello World!'
@app.route('/message', methods=['GET', 'P... | apache-2.0 | Python |
60ae3ae54ccc573983cb9c283844eab1b62ba7a7 | Use multiprocessing instead of threading | repos-bitcoin/bitcoind-ncurses,azeteki/bitcoind-ncurses,esotericnonsense/bitcoind-ncurses | main.py | main.py | #!/usr/bin/env python
###############################################################################
# bitcoind-ncurses by Amphibian
# thanks to jgarzik for bitcoinrpc
# wumpus and kylemanna for configuration file parsing
# all the users for their suggestions and testing
# and of course the bitcoin dev team for that ... | #!/usr/bin/env python
###############################################################################
# bitcoind-ncurses by Amphibian
# thanks to jgarzik for bitcoinrpc
# wumpus and kylemanna for configuration file parsing
# all the users for their suggestions and testing
# and of course the bitcoin dev team for that ... | mit | Python |
34a3b5c626e077907c46835b1759a818b3fc332a | Make 2-legged calls with the help of tweepy, Twitter API lib. | uservoice/uservoice-python | uservoice/__init__.py | uservoice/__init__.py | from Crypto.Cipher import AES
import base64
import hashlib
import urllib
import operator
import array
import simplejson as json
import urllib
import urllib2
import datetime
import pytz
from tweepy import oauth
def generate_sso_token(subdomain_name, sso_key, user_attributes):
current_time = (datetime.datetime.now(p... | from Crypto.Cipher import AES
import base64
import hashlib
import urllib
import operator
import array
import simplejson as json
import urllib
import urllib2
import datetime
import pytz
from tweepy import oauth
def generate_sso_token(subdomain_name, sso_key, user_attributes):
current_time = (datetime.datetime.n... | mit | Python |
3be6ed2f32492d79b639e657cbf5782451b527e7 | Disable broken upload test | skylines-project/skylines,kerel-fs/skylines,kerel-fs/skylines,Turbo87/skylines,Harry-R/skylines,skylines-project/skylines,skylines-project/skylines,shadowoneau/skylines,Turbo87/skylines,shadowoneau/skylines,Turbo87/skylines,RBE-Avionik/skylines,shadowoneau/skylines,kerel-fs/skylines,RBE-Avionik/skylines,skylines-projec... | tests/frontend/views/upload_test.py | tests/frontend/views/upload_test.py | import os
from io import BytesIO
import pytest
from skylines.database import db
from skylines.model import User
pytestmark = pytest.mark.usefixtures('db_session', 'files_folder')
HERE = os.path.dirname(__file__)
DATADIR = os.path.join(HERE, '..', '..', 'data')
@pytest.fixture(scope='function')
def bill(app):
... | import os
from io import BytesIO
import pytest
from skylines.database import db
from skylines.model import User
pytestmark = pytest.mark.usefixtures('db_session', 'files_folder')
HERE = os.path.dirname(__file__)
DATADIR = os.path.join(HERE, '..', '..', 'data')
@pytest.fixture(scope='function')
def bill(app):
... | agpl-3.0 | Python |
71a1d2b40a03bde4969f0eea5f2c48d4ba7ace1b | Fix batch tests on Python 3 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | tests/integration/cli/test_batch.py | tests/integration/cli/test_batch.py | # -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Nicole Thomas <nicole@saltstack.com>`
'''
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
# Import Salt Testing Libs
from tests.support.case import ShellCase
class BatchTest(ShellCase):
'''
Integration tests fo... | # -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Nicole Thomas <nicole@saltstack.com>`
'''
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
# Import Salt Testing Libs
from tests.support.case import ShellCase
class BatchTest(ShellCase):
'''
Integration tests fo... | apache-2.0 | Python |
6f391d4113b55f538cfeed26c36b17846c7b758f | fix alt-svc test | hansroh/skitai,hansroh/skitai,hansroh/skitai | tests/level4/test_http3_response.py | tests/level4/test_http3_response.py | import pytest
import os
import socket
import time
import sys
#@pytest.mark.skip
def test_http2 (launch):
serve = './examples/http3.py'
with launch (serve, port = 30371, quic = 30371, ssl = True) as engine:
resp = engine.http2.get ('/hello?num=1')
assert resp.text == 'hello'
if sys.versi... | import pytest
import os
import socket
import time
import sys
#@pytest.mark.skip
def test_http2 (launch):
serve = './examples/http3.py'
with launch (serve, port = 30371, quic = 30371, ssl = True) as engine:
resp = engine.http2.get ('/hello?num=1')
assert resp.text == 'hello'
assert 'alt-... | mit | Python |
1e9ebf139ae76eddfe8dd01290e41735e7d1011b | Rewrite syntax to be Python 3.5+ | ipython/ipython,ipython/ipython | IPython/utils/tests/test_openpy.py | IPython/utils/tests/test_openpy.py | import io
import os.path
import nose.tools as nt
from IPython.utils import openpy
mydir = os.path.dirname(__file__)
nonascii_path = os.path.join(mydir, '../../core/tests/nonascii.py')
def test_detect_encoding():
with open(nonascii_path, 'rb') as f:
enc, lines = openpy.detect_encoding(f.readline)
nt.a... | import io
import os.path
import nose.tools as nt
from IPython.utils import openpy
mydir = os.path.dirname(__file__)
nonascii_path = os.path.join(mydir, '../../core/tests/nonascii.py')
def test_detect_encoding():
with open(nonascii_path, 'rb') as f:
enc, lines = openpy.detect_encoding(f.readline)
nt.a... | bsd-3-clause | Python |
64ed1185fca6ba60e06d508ac401f68d5be1ce56 | bring tests up to #442 change | craigds/mapnik2,makinacorpus/mapnik2,makinacorpus/mapnik2,craigds/mapnik2,makinacorpus/mapnik2,craigds/mapnik2,makinacorpus/mapnik2,craigds/mapnik2 | tests/python_tests/load_map_test.py | tests/python_tests/load_map_test.py | #!/usr/bin/env python
from nose.tools import *
from utilities import execution_path
import os, sys, glob, mapnik
def setup():
# All of the paths used are relative, if we run the tests
# from another directory we need to chdir()
os.chdir(execution_path('.'))
# We expect these files to not raise any
# exc... | #!/usr/bin/env python
from nose.tools import *
from utilities import execution_path
import os, sys, glob, mapnik
def setup():
# All of the paths used are relative, if we run the tests
# from another directory we need to chdir()
os.chdir(execution_path('.'))
# We expect these files to not raise any
# exc... | lgpl-2.1 | Python |
ad14d77a137c924357bca51d39b91b4d502d2ce6 | Improve pylint score | IndyActuaries/epic-fhir,IndyActuaries/epic-fhir | scripts/extract.py | scripts/extract.py | """
## CODE OWNERS: Kyle Baird, Shea Parkes
### OWNERS ATTEST TO THE FOLLOWING:
* The `master` branch will meet Milliman QRM standards at all times.
* Deliveries will only be made from code in the `master` branch.
* Review/Collaboration notes will be captured in Pull Requests.
### OBJECTIVE:
Extract data from ... | """
## CODE OWNERS: Kyle Baird, Shea Parkes
### OWNERS ATTEST TO THE FOLLOWING:
* The `master` branch will meet Milliman QRM standards at all times.
* Deliveries will only be made from code in the `master` branch.
* Review/Collaboration notes will be captured in Pull Requests.
### OBJECTIVE:
Extract data from ... | mit | Python |
f276d6fdb412b8ad93de8ba6d921d29a57710077 | Update usage message | SB-Technology-Holdings-International/WateringWebClient,SB-Technology-Holdings-International/WateringWebClient,SB-Technology-Holdings-International/Water,SB-Technology-Holdings-International/Water,SB-Technology-Holdings-International/WateringWebClient,SB-Technology-Holdings-International/Water,SB-Technology-Holdings-Int... | server/messages.py | server/messages.py | '''Endpoints messages.'''
from protorpc import messages
class Status(messages.Enum):
OK = 1
MISSING_DATA = 2
EXISTS = 3
BAD_DATA = 4
ERROR = 5
NO_DEVICE = 6
class DataMessage(messages.Message):
device_id = messages.StringField(1)
status = messages.EnumField(Status, 2)
class Status... | '''Endpoints messages.'''
from protorpc import messages
class Status(messages.Enum):
OK = 1
MISSING_DATA = 2
EXISTS = 3
BAD_DATA = 4
ERROR = 5
NO_DEVICE = 6
class DataMessage(messages.Message):
device_id = messages.StringField(1)
status = messages.EnumField(Status, 2)
class Status... | bsd-3-clause | Python |
917dde63ece9e552427487c7639be64e1b113d3d | Update zibra download fields. | blab/nextstrain-db,nextstrain/fauna,blab/nextstrain-db,nextstrain/fauna | vdb/zibra_download.py | vdb/zibra_download.py | import os, re, time, datetime, csv, sys
import rethinkdb as r
from Bio import SeqIO
from download import download
from download import parser
class zibra_download(download):
def __init__(self, **kwargs):
download.__init__(self, **kwargs)
self.virus_specific_fasta_fields = []
if __name__=="__main__... | import os, re, time, datetime, csv, sys
import rethinkdb as r
from Bio import SeqIO
from download import download
from download import parser
class zibra_download(download):
def __init__(self, **kwargs):
download.__init__(self, **kwargs)
self.virus_specific_fasta_fields = []
if __name__=="__main__... | agpl-3.0 | Python |
749441ed678f69ba813b3af74454af5b1e855482 | Refactor and cleanup model mixins. | openbudgets/openbudgets,moshe742/openbudgets,pwalsh/openbudgets,openbudgets/openbudgets,pwalsh/openbudgets,openbudgets/openbudgets,moshe742/openbudgets,shaib/openbudgets,pwalsh/openbudgets,shaib/openbudgets | openbudget/commons/mixins/models.py | openbudget/commons/mixins/models.py | from django.db import models
from django.utils.translation import ugettext_lazy as _
from uuidfield import UUIDField
from openbudget.settings import base as settings
class ClassMethodMixin(object):
"""A mixin for commonly used classmethods on models."""
@classmethod
def get_class_name(cls):
value... | from django.db import models
from django.utils.translation import ugettext_lazy as _
from uuidfield import UUIDField
class ClassMethodMixin(object):
"""Mixin for commonly used class methods on models"""
@classmethod
def get_class_name(cls):
value = cls.__name__.lower()
return value
clas... | bsd-3-clause | Python |
bf90f726da9954edb69f4c0cb29206ff82444d63 | Add custom admin classes | recipi/recipi,recipi/recipi,recipi/recipi | src/recipi/food/admin.py | src/recipi/food/admin.py | # -*- coding: utf-8 -*-
from django.contrib import admin
from recipi.food.models import (
FoodGroup, Food, Language, LanguageDescription, Nutrient,
Weight, Footnote)
class FoodGroupAdmin(admin.ModelAdmin):
pass
class FoodAdmin(admin.ModelAdmin):
pass
class LanguageAdmin(admin.ModelAdmin):
pas... | # -*- coding: utf-8 -*-
from django.contrib import admin
from recipi.food.models import (
FoodGroup, Food, Language, LanguageDescription, Nutrient,
Weight, Footnote)
admin.site.register(FoodGroup)
admin.site.register(Food)
admin.site.register(Language)
admin.site.register(LanguageDescription)
admin.site.regi... | isc | Python |
cf7f5dc359bb49743750c9ace6c317092b275653 | remove the use of refine_results because it is changed to private method | tumluliu/mmrp-jsonrpc,tumluliu/mmrp-jsonrpc | mmrp.py | mmrp.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import logging.config
import json
LOGGING_CONF_FILE = 'logging.json'
DEFAULT_LOGGING_LVL = logging.INFO
path = LOGGING_CONF_FILE
value = os.getenv('LOG_CFG', None)
if value:
path = value
if os.path.exists(path):
with open(path, 'rt') as f:
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import logging.config
import json
LOGGING_CONF_FILE = 'logging.json'
DEFAULT_LOGGING_LVL = logging.INFO
path = LOGGING_CONF_FILE
value = os.getenv('LOG_CFG', None)
if value:
path = value
if os.path.exists(path):
with open(path, 'rt') as f:
... | mit | Python |
8e6662a4aaf654ddf18c1c4e733c58db5b9b5579 | Add cache in opps menu list via context processors | YACOWS/opps,opps/opps,jeanmask/opps,jeanmask/opps,YACOWS/opps,opps/opps,williamroot/opps,jeanmask/opps,williamroot/opps,YACOWS/opps,williamroot/opps,YACOWS/opps,opps/opps,jeanmask/opps,opps/opps,williamroot/opps | opps/channels/context_processors.py | opps/channels/context_processors.py | # -*- coding: utf-8 -*-
from django.utils import timezone
from django.conf import settings
from django.contrib.sites.models import get_current_site
from django.core.cache import cache
from .models import Channel
def channel_context(request):
""" Channel context processors
"""
site = get_current_site(requ... | # -*- coding: utf-8 -*-
from django.utils import timezone
from django.conf import settings
from django.contrib.sites.models import get_current_site
from .models import Channel
def channel_context(request):
""" Channel context processors
"""
site = get_current_site(request)
opps_menu = Channel.objects... | mit | Python |
621565e0daa4e06ff6a67f985af124fa7f101d77 | Refactor dbaas test helpers | globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service | dbaas/dbaas/tests/helpers.py | dbaas/dbaas/tests/helpers.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from physical.tests.factory import InstanceFactory
class UsedAndTotalValidator(object):
@staticmethod
def assertEqual(a, b):
assert a == b, "{} NOT EQUAL {}".format(a, b)
@classmethod
def instances_sizes(cls, i... | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from physical.tests import factory as factory_physical
class InstanceHelper(object):
@staticmethod
def check_instance_is_master(instance):
"""
Method for mock the real check_instance_is_master.
T... | bsd-3-clause | Python |
56aa00210b5adb663abea62ecd297f094dcbfeb0 | remove prodigal from the subcommand module | widdowquinn/find_differential_primers,widdowquinn/find_differential_primers | diagnostic_primers/scripts/subcommands/__init__.py | diagnostic_primers/scripts/subcommands/__init__.py | # -*- coding: utf-8 -*-
"""Module providing subcommands for pdp."""
from .subcmd_config import subcmd_config
from .subcmd_filter import subcmd_filter
from .subcmd_eprimer3 import subcmd_eprimer3
from .subcmd_primersearch import subcmd_primersearch
from .subcmd_dedupe import subcmd_dedupe
from .subcmd_blastscreen impor... | # -*- coding: utf-8 -*-
"""Module providing subcommands for pdp."""
from .subcmd_config import subcmd_config
from .subcmd_prodigal import subcmd_prodigal
from .subcmd_filter import subcmd_filter
from .subcmd_eprimer3 import subcmd_eprimer3
from .subcmd_primersearch import subcmd_primersearch
from .subcmd_dedupe import... | mit | Python |
f95cc3e8657ec3c03dd828bf0462df10b2897a5b | adjust host | geomin/djangovpshosting,geomin/djangovpshosting,geomin/djangovpshosting | djangovpshosting/djangovpshosting/settings_prod.py | djangovpshosting/djangovpshosting/settings_prod.py | from settings import *
DEBUG = False
ALLOWED_HOSTS = ['djangovpshosting.com']
| from settings import *
DEBUG = False
ALLOWED_HOSTS = ['162.249.2.222']
| mit | Python |
ebb7f4ca18e099fb2902fa66cbb68c29baa98917 | fix download_chromedriver.py to return fast when file exists | kboard/kboard,kboard/kboard,cjh5414/kboard,guswnsxodlf/k-board,guswnsxodlf/k-board,guswnsxodlf/k-board,cjh5414/kboard,hyesun03/k-board,cjh5414/kboard,darjeeling/k-board,kboard/kboard,hyesun03/k-board,hyesun03/k-board | dev/download_chromedriver.py | dev/download_chromedriver.py | #!/usr/bin/env python
import os, stat
import requests
import zipfile
DESTINATION_DIR = os.path.join(
os.path.dirname(os.path.realpath(__file__)), 'files')
DOWNLOAD_URL = "http://chromedriver.storage.googleapis.com"
MAC_DRIVER_NAME = 'chromedriver_mac64.zip'
if not os.path.exists(DESTINATION_DIR):
os.mkdir(DE... | #!/usr/bin/env python
import os, stat
import requests
import zipfile
DESTINATION_DIR = os.path.join(
os.path.dirname(os.path.realpath(__file__)), 'files')
DOWNLOAD_URL = "http://chromedriver.storage.googleapis.com"
MAC_DRIVER_NAME = 'chromedriver_mac64.zip'
if not os.path.exists(DESTINATION_DIR):
os.mkdir(DE... | mit | Python |
f9b38aa0f38e86a718d851057c26f945e6b872a9 | Update BatteryAlarm.py | jaimeandrescatano/ekorre,jaimeandrescatano/ekorre,jaimeandrescatano/ekorre,jaimeandrescatano/ekorre | 20140707-ProgramaDeAlertaBateria/BatteryAlarm.py | 20140707-ProgramaDeAlertaBateria/BatteryAlarm.py | #!usr/bin/env python
#coding=utf-8
# Es necesario editar
# sudo vim /etc/crontab
# Edicionar: */15 * * * * root python /JAIMEANDRES/ArchivosSistema/BatteryAlarm.py
#
# Reiniciar servicio de cron: sudo service cron stop / start
#
# Este archivo requiere tener en su misma carpeta el archivo
# ReproductorDeSonidos.py... | #!usr/bin/env python
#coding=utf-8
# Es necesario editar
# sudo vim /etc/crontab
# Edicionar: */15 * * * * root python /JAIMEANDRES/ArchivosSistema/BatteryAlarm.py
#
# Reiniciar servicio de cron: sudo service cron stop / start
#
# Este archivo requiere tener en su misma carpeta el archivo
# ReproductorDeSonidos.py... | mit | Python |
1256f695a441049438565285f48c9119e5211cf5 | Enable follow redirection. | wildone/pyaem,Sensis/pyaem | pyaem/bagofrequests.py | pyaem/bagofrequests.py | import cStringIO
from handlers import unexpected as handle_unexpected
import pycurl
import requests
import urllib
def request(method, url, params, handlers, **kwargs):
curl = pycurl.Curl()
body_io = cStringIO.StringIO()
if method == 'post':
curl.setopt(pycurl.POST, 1)
curl.setopt(pycurl.POSTFIELDS, urllib.... | import cStringIO
from handlers import unexpected as handle_unexpected
import pycurl
import requests
import urllib
def request(method, url, params, handlers, **kwargs):
curl = pycurl.Curl()
body_io = cStringIO.StringIO()
if method == 'post':
curl.setopt(pycurl.POST, 1)
curl.setopt(pycurl.POSTFIELDS, urllib.... | mit | Python |
7f7f32d032c68197b2152eeb8d9189f3d1493b57 | Bump version number for development | MAndelkovic/pybinding,MAndelkovic/pybinding,dean0x7d/pybinding,MAndelkovic/pybinding,dean0x7d/pybinding,dean0x7d/pybinding | pybinding/__about__.py | pybinding/__about__.py | """Package for numerical tight-binding calculations in solid state physics"""
__title__ = "pybinding"
__version__ = "0.9.0.dev"
__summary__ = "Package for tight-binding calculations"
__url__ = "https://github.com/dean0x7d/pybinding"
__author__ = "Dean Moldovan"
__copyright__ = "2015-2016, " + __author__
__email__ = "d... | """Package for numerical tight-binding calculations in solid state physics"""
__title__ = "pybinding"
__version__ = "0.8.1"
__summary__ = "Package for tight-binding calculations"
__url__ = "https://github.com/dean0x7d/pybinding"
__author__ = "Dean Moldovan"
__copyright__ = "2015-2016, " + __author__
__email__ = "dean0... | bsd-2-clause | Python |
771daafda877050c8fe23b034a0c51ec97502715 | update code which generates list of possible article names | ClintonMorrison/personal-website,ClintonMorrison/personal-website,ClintonMorrison/personal-website,ClintonMorrison/personal-website,ClintonMorrison/personal-website,ClintonMorrison/personal-website | pages/controllers/blog_article.py | pages/controllers/blog_article.py | from core import database as database
from core.exceptions import NotFoundError, ServerError
from core.markdown import MarkdownParser
from core.article_helpers import get_article, get_all_articles
import core.functions
import yaml
def get_page_data(path, get, post, variables):
article = get_article(get.get('name', '... | from core import database as database
from core.exceptions import NotFoundError, ServerError
from core.markdown import MarkdownParser
from core.article_helpers import get_article
import core.functions
import yaml
def get_page_data(path, get, post, variables):
article = get_article(get.get('name', ''))
if not arti... | apache-2.0 | Python |
7060f48df582dcfae1768cc37d00a25e0e2e1f6f | Comment post endpoint return a ksopn, fix issue saving comments add post id and convert it to int | oldani/nanodegree-blog,oldani/nanodegree-blog,oldani/nanodegree-blog | app/views/comment_view.py | app/views/comment_view.py | from flask import jsonify
from flask_classy import FlaskView
from flask_user import current_user, login_required
from ..models import CommentModel, PostModel
from ..forms import CommentForm
class Comment(FlaskView):
def get(self):
pass
def all(self, post_id):
comment = CommentModel()
... | from flask import jsonify
from flask_classy import FlaskView
from flask_user import current_user, login_required
from ..models import CommentModel, PostModel
from ..forms import CommentForm
class Comment(FlaskView):
def get(self):
pass
def all(self, post_id):
comment = CommentModel()
... | mit | Python |
c1044e25e18afd78b3fda8fd9b00a4f67cfbbc65 | allow markdownlint to be disabled for specific lines (#4) | jorisroovers/pymarkdownlint,jorisroovers/pymarkdownlint | pymarkdownlint/lint.py | pymarkdownlint/lint.py | from __future__ import print_function
from pymarkdownlint import rules
class MarkdownLinter(object):
def __init__(self, config):
self.config = config
@property
def line_rules(self):
return [rule for rule in self.config.rules if isinstance(rule, rules.LineRule)]
def _apply_line_rules(... | from __future__ import print_function
from pymarkdownlint import rules
class MarkdownLinter(object):
def __init__(self, config):
self.config = config
@property
def line_rules(self):
return [rule for rule in self.config.rules if isinstance(rule, rules.LineRule)]
def _apply_line_rules(... | mit | Python |
e4ecc0f8049f1388188f0a64b373a7e90b2dc1e9 | Update at 2017-07-22 15-01-48 | amoshyc/tthl-code | plot.py | plot.py | from sys import argv
from pathlib import Path
import matplotlib as mpl
mpl.use('Agg')
import seaborn as sns
sns.set_style("darkgrid")
import matplotlib.pyplot as plt
import pandas as pd
# from keras.utils import plot_model
# plot_model(model, to_file='model.png', show_shapes=True, show_layer_names=False)
def plot_s... | from sys import argv
import matplotlib as mpl
mpl.use('Agg')
import seaborn as sns
sns.set_style("darkgrid")
import matplotlib.pyplot as plt
import pandas as pd
# from keras.utils import plot_model
# plot_model(model, to_file='model.png', show_shapes=True, show_layer_names=False)
def plot_svg(log, name):
df = p... | apache-2.0 | Python |
dc4bc70ad3f13b8ff400f6c8f999b555096a75cb | Update test cases for conf module | chenjiandongx/pyecharts,chenjiandongx/pyecharts,chenjiandongx/pyecharts | test/test_conf.py | test/test_conf.py | # coding=utf8
"""
Test Cases for jshost.
Input:a PyEchartsConfg object with cusom jshost and force_embed flag by user.
Test Target: js_embed (should render <script> in embed mode)
"""
from __future__ import unicode_literals
from nose.tools import eq_
from pyecharts.conf import PyEchartsConfig
from pyecharts.constants... | # coding=utf8
from __future__ import unicode_literals
from pyecharts.conf import PyEchartsConfig
def test_config():
pec = PyEchartsConfig(jshost='https://demo')
assert pec.jshost == 'https://demo'
pec.jshost = 'https://demo/'
assert pec.jshost == 'https://demo'
pec.force_js_embed = True
ass... | mit | Python |
6e7dfe97cdce58f892f88560e4b4709e6625e6bd | Clean up package level imports | aitatanit/metatlas,aitatanit/metatlas,aitatanit/metatlas,metabolite-atlas/metatlas,biorack/metatlas,biorack/metatlas,metabolite-atlas/metatlas,metabolite-atlas/metatlas | metatlas/__init__.py | metatlas/__init__.py | __version__ = '0.2'
from .mzml_loader import mzml_to_hdf
from .h5_query import plot_heatmap, plot_spectrogram, plot_XIC
from .h5_query import get_data, get_XIC, get_heatmap, get_spectrogram
| __version__ = '0.2'
from .mzml_loader import mzml_to_hdf
from .h5_query import plot_heatmap, plot_spectrogram, plot_xic
from .h5_query import get_data, get_XIC, get_HeatMapRTMZ, get_spectrogram
| bsd-3-clause | Python |
db6a6da8fe1bdd73fbd971153a4fda6975fc7b4e | update version | yupenghe/methylpy,yupenghe/methylpy | methylpy/__init__.py | methylpy/__init__.py | __version__ = '1.2.9'
| __version__ = '1.2.8'
| apache-2.0 | Python |
8234a22ca090c38b80ffd650b490d1dd8cbe766d | test for fix/18 | csirtgadgets/csirtg-indicator-py,csirtgadgets/csirtg-indicator-py | test/test_ipv4.py | test/test_ipv4.py | from csirtg_indicator import Indicator
from csirtg_indicator.exceptions import InvalidIndicator
def _not(data):
for d in data:
d = Indicator(d)
assert d.itype is not 'ipv4'
def test_ipv4_ipv6():
data = ['2001:1608:10:147::21', '2001:4860:4860::8888']
_not(data)
def test_ipv4_fqdn():
... | from csirtg_indicator import Indicator
from csirtg_indicator.exceptions import InvalidIndicator
def _not(data):
for d in data:
d = Indicator(d)
assert d.itype is not 'ipv4'
def test_ipv4_ipv6():
data = ['2001:1608:10:147::21', '2001:4860:4860::8888']
_not(data)
def test_ipv4_fqdn():
... | mpl-2.0 | Python |
a8090276b86e12a798be56000dc9831b07544ead | disable review test for now | sat-utils/sat-search | test/test_main.py | test/test_main.py | import os
import sys
import unittest
from mock import patch
import json
import shutil
import satsearch.main as main
import satsearch.config as config
from nose.tools import raises
testpath = os.path.dirname(__file__)
config.DATADIR = testpath
class Test(unittest.TestCase):
""" Test main module """
args = '... | import os
import sys
import unittest
from mock import patch
import json
import shutil
import satsearch.main as main
import satsearch.config as config
from nose.tools import raises
testpath = os.path.dirname(__file__)
config.DATADIR = testpath
class Test(unittest.TestCase):
""" Test main module """
args = '... | mit | Python |
aa3e36cc37b2ddcc5d166965f8abeff560e6b0f1 | Use test database on alembic when necessary | frictionlessdata/goodtables.io,frictionlessdata/goodtables.io,frictionlessdata/goodtables.io,frictionlessdata/goodtables.io | migrations/config.py | migrations/config.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import logging
from logging.handlers import SysLogHandler
from dotenv import load_dotenv
load_dotenv('.env')
# Storage
if not os.envi... | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import logging
from logging.handlers import SysLogHandler
from dotenv import load_dotenv
load_dotenv('.env')
# Storage
DATABASE_URL =... | agpl-3.0 | Python |
0d8766849bedea43cf2eab006327cb942f61c3af | add testing function | sampsyo/confit | test/test_yaml.py | test/test_yaml.py | from __future__ import division, absolute_import, print_function
import confuse
import yaml
import unittest
from . import TempDir
def load(s):
return yaml.load(s, Loader=confuse.Loader)
class ParseTest(unittest.TestCase):
def test_dict_parsed_as_ordereddict(self):
v = load("a: b\nc: d")
sel... | from __future__ import division, absolute_import, print_function
import confuse
import yaml
import unittest
from . import TempDir
def load(s):
return yaml.load(s, Loader=confuse.Loader)
class ParseTest(unittest.TestCase):
def test_dict_parsed_as_ordereddict(self):
v = load("a: b\nc: d")
sel... | mit | Python |
c08e25172d362176c8abed3d2bf54c2cf13da303 | Fix test for settings_helpers | stscieisenhamer/glue,stscieisenhamer/glue,saimn/glue,saimn/glue | glue/tests/test_settings_helpers.py | glue/tests/test_settings_helpers.py | from mock import patch
import os
from glue.config import SettingRegistry
from glue._settings_helpers import load_settings, save_settings
def test_roundtrip(tmpdir):
settings = SettingRegistry()
settings.add('STRING', 'green', str)
settings.add('INT', 3, int)
settings.add('FLOAT', 5.5, float)
se... | from mock import patch
import os
from glue.config import SettingRegistry
from glue._settings_helpers import load_settings, save_settings
def test_roundtrip(tmpdir):
settings = SettingRegistry()
settings.add('STRING', 'green', str)
settings.add('INT', 3, int)
settings.add('FLOAT', 5.5, float)
se... | bsd-3-clause | Python |
01917a077681949d29eb48173e031b5dfd441e0d | update angle.py | UMOL/MolecularGeometry.jl | test/function/angle/angle.py | test/function/angle/angle.py | import numpy as np
def angle2D(vec1,vec2):
length1 = np.linalg.norm(vec1)
length2 = np.linalg.norm(vec2)
print("length ", length1, length2)
if length1 < 1e-16:
return 0.
if length2 < 1e-16:
return 0.
return np.arccos(np.dot(vec1,vec2)/(length1*length2))
def angle3D(vec1, vec2):... | import numpy as np
def angle2D(vec1,vec2):
length1 = np.linalg.norm(vec1)
length2 = np.linalg.norm(vec2)
print("length ", length1, length2)
return np.arccos(np.dot(vec1,vec2)/(length1*length2))
def angle3D(vec1, vec2):
# return the angle
v1 = vec1[[0,1]]
v2 = vec2[[0,1]]
a3 = angle2D(v... | mit | Python |
2b3281863f11fa577dd6504e58f6faec8ada2259 | Change order of API call | jakereps/qiime-studio-frontend,jakereps/qiime-studio,qiime2/qiime-studio,qiime2/qiime-studio,jakereps/qiime-studio,qiime2/qiime-studio-frontend,qiime2/qiime-studio-frontend,qiime2/qiime-studio,jakereps/qiime-studio,jakereps/qiime-studio-frontend | qiime_studio/api/v1.py | qiime_studio/api/v1.py | from flask import Blueprint, jsonify
from .security import validate_request_authentication
from qiime.sdk import PluginManager
PLUGIN_MANAGER = PluginManager()
v1 = Blueprint('v1', __name__)
v1.before_request(validate_request_authentication)
@v1.route('/', methods=['GET', 'POST'])
def root():
return jsonify(con... | from flask import Blueprint, jsonify
from .security import validate_request_authentication
from qiime.sdk import PluginManager
PLUGIN_MANAGER = PluginManager()
v1 = Blueprint('v1', __name__)
v1.before_request(validate_request_authentication)
@v1.route('/', methods=['GET', 'POST'])
def root():
return jsonify(con... | bsd-3-clause | Python |
896482b83ad75c445e72dbb0eb6bc7246662f699 | access token is adjusted | ComputerProject2Team/SkyBot | skybotapp/views.py | skybotapp/views.py | import json
import requests
from pprint import pprint
from django.shortcuts import render
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt
# yomamabot/fb_yomamabot/views.py
from django.views import generic
from django.http.response import HttpResponse
from djang... | import json
import requests
from pprint import pprint
from django.shortcuts import render
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt
# yomamabot/fb_yomamabot/views.py
from django.views import generic
from django.http.response import HttpResponse
from djang... | unlicense | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.