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 |
|---|---|---|---|---|---|---|---|---|
da1a0f5e7ffcbe37cdee484b452b5376049dd1e5 | Work with Django 1.10 as well. | datawire/mdk,datawire/mdk,datawire/mdk,datawire/mdk | python/django.py | python/django.py | """
Django middleware that enables the MDK.
"""
import atexit
from traceback import format_exception_only
from mdk import start
# Django 1.10 new-style middleware compatibility:
try:
from django.utils.deprecation import MiddlewareMixin
except ImportError:
MiddlewareMixin = object
class MDKSessionMiddleware... | """
Django middleware that enables the MDK.
This is old-style (Django <1.10) middleware. Please see
https://docs.djangoproject.com/en/1.10/topics/http/middleware/#upgrading-middleware
if you're using Django 1.10.
"""
import atexit
from traceback import format_exception_only
from mdk import start
class MDKSessionMi... | apache-2.0 | Python |
742a800d784a7f24cee1a1cdd522e2259a183f6d | make weeds, flowers and bushes instad of cars | tartley/chronotank | pyweek12/main.py | pyweek12/main.py |
import sys
from os.path import join
from random import uniform
import pyglet
from rabbyt.sprites import Sprite
from .camera import Camera
from .color import Color
from .eventloop import Eventloop
from .options import Options
from .path import DATA
from .render import Render
from .world import World
def main():
... |
import sys
from os.path import join
from random import uniform
import pyglet
from rabbyt.sprites import Sprite
from .camera import Camera
from .eventloop import Eventloop
from .options import Options
from .path import DATA
from .render import Render
from .world import World
def main():
options = Options(sys.ar... | bsd-3-clause | Python |
b413f018dca708588170fe93532ab8cc19dc55b7 | Add filename creation output to templater | gdestuynder/MozDef,gdestuynder/MozDef,mpurzynski/MozDef,jeffbryner/MozDef,gdestuynder/MozDef,jeffbryner/MozDef,Phrozyn/MozDef,mozilla/MozDef,mpurzynski/MozDef,gdestuynder/MozDef,mozilla/MozDef,Phrozyn/MozDef,mozilla/MozDef,mozilla/MozDef,mpurzynski/MozDef,Phrozyn/MozDef,mpurzynski/MozDef,Phrozyn/MozDef,jeffbryner/MozDe... | tests/alert_templater.py | tests/alert_templater.py | import os
import sys
# Handle python2
try:
input = raw_input
except NameError:
pass
alert_name = input('Enter your alert name (Example: proxy drop executable): ')
classname = ""
for token in alert_name.split(" "):
classname += token.title()
alert_classname = "Alert{0}".format(classname)
test_alert_clas... | import os
import sys
# Handle python2
try:
input = raw_input
except NameError:
pass
alert_name = input('Enter your alert name (Example: proxy drop executable): ')
classname = ""
for token in alert_name.split(" "):
classname += token.title()
alert_classname = "Alert{0}".format(classname)
test_alert_clas... | mpl-2.0 | Python |
087786e67f7c57ad43e39b97838569e60f774954 | fix FrameDebugger parent calls for Python 2 | nodepy/nodepy | nodepy/utils/__init__.py | nodepy/utils/__init__.py |
import pdb
import six
import sys
from .path import pathlib
from . import context, iter, machinery, path
def as_text(x, encoding=None):
"""
Accepts a binary or unicode string and returns a unicode string. If *x* is
not a string type, a #TypeError is raised.
"""
if not isinstance(x, six.string_types):
... |
import pdb
import six
import sys
from .path import pathlib
from . import context, iter, machinery, path
def as_text(x, encoding=None):
"""
Accepts a binary or unicode string and returns a unicode string. If *x* is
not a string type, a #TypeError is raised.
"""
if not isinstance(x, six.string_types):
... | mit | Python |
f6cf1827eb05d85453f80fef98a14b1a0730e6cb | Remove useless assert. | isislovecruft/scramblesuit,isislovecruft/scramblesuit | packetmorpher.py | packetmorpher.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Provides code to morph a chunk of data to a given probability distribution.
The class provides an interface to morph network packet lengths to a previously
generated probability distribution. The packet lengths of the morphed network
data should then match the probabilit... | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Provides code to morph a chunk of data to a given probability distribution.
The class provides an interface to morph network packet lengths to a previously
generated probability distribution. The packet lengths of the morphed network
data should then match the probabilit... | bsd-3-clause | Python |
084ff6d007017ab13fc3d8be056995fc3d2f9d29 | Bump version. | ryankask/django-discoverage,ryankask/django-discoverage | discoverage/__init__.py | discoverage/__init__.py | from discoverage.runner import DiscoverageRunner
__version__ = '0.3.0'
| from discoverage.runner import DiscoverageRunner
__version__ = '0.2.1'
| bsd-2-clause | Python |
1cef1da1e1da1b6592e1a656f8266325d10b0161 | Add missing whitespace to error message | projectatomic/atomic-reactor,DBuildService/atomic-reactor,projectatomic/atomic-reactor,fr34k8/atomic-reactor,DBuildService/atomic-reactor,fr34k8/atomic-reactor | atomic_reactor/plugins/pre_check_user_settings.py | atomic_reactor/plugins/pre_check_user_settings.py | """
Copyright (c) 2020 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import unicode_literals, absolute_import
from atomic_reactor.constants import PLUGIN_CHECK_USER_SETTINGS
from atomic_reactor... | """
Copyright (c) 2020 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import unicode_literals, absolute_import
from atomic_reactor.constants import PLUGIN_CHECK_USER_SETTINGS
from atomic_reactor... | bsd-3-clause | Python |
fa5b8686afc1949c1a0e391a38d425c745357d5d | remove superfluous logging | XertroV/nodeup-xk-io,XertroV/nodeup-xk-io,XertroV/nodeup-xk-io,XertroV/nodeup-xk-io | nodeup-server/tweeter.py | nodeup-server/tweeter.py | #!/usr/bin/env python3
import time
import logging
import tweepy
from models import twitter_access_token, twitter_access_secret, twitter_consumer_secret, twitter_consumer_key, tweet_queue
logging.basicConfig(level=logging.INFO)
def get_api():
auth = tweepy.OAuthHandler(twitter_consumer_key.get(), twitter_consum... | #!/usr/bin/env python3
import time
import logging
import tweepy
from models import twitter_access_token, twitter_access_secret, twitter_consumer_secret, twitter_consumer_key, tweet_queue
logging.basicConfig(level=logging.INFO)
def get_api():
auth = tweepy.OAuthHandler(twitter_consumer_key.get(), twitter_consum... | mit | Python |
f3c88a8dfe1b70796594f34ce1dcb81d60b424bc | Fix bitrot in ipmi deployment tests. | henn/hil,meng-sun/hil,SahilTikale/haas,henn/hil_sahil,henn/hil,kylehogan/hil,henn/haas,kylehogan/haas,meng-sun/hil,CCI-MOC/haas,kylehogan/hil,henn/hil_sahil | tests/deployment/ipmi.py | tests/deployment/ipmi.py | # Copyright 2013-2015 Massachusetts Open Cloud Contributors
#
# 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 applicab... | # Copyright 2013-2015 Massachusetts Open Cloud Contributors
#
# 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 applicab... | apache-2.0 | Python |
de99a7e665bcba140865ae8f7cfbb3264541f748 | Return a PartialOrderTuple from dimension_sort() | opesci/devito,opesci/devito | devito/ir/equations/algorithms.py | devito/ir/equations/algorithms.py | from operator import attrgetter
from devito.dimension import Dimension
from devito.symbolics import retrieve_indexed, split_affine
from devito.tools import PartialOrderTuple, filter_sorted, flatten
__all__ = ['dimension_sort']
def dimension_sort(expr):
"""
Topologically sort the :class:`Dimension`s in ``exp... | from operator import attrgetter
from devito.dimension import Dimension
from devito.symbolics import retrieve_indexed, split_affine
from devito.tools import filter_sorted, flatten, toposort
__all__ = ['dimension_sort']
def dimension_sort(expr, key=None):
"""
Topologically sort the :class:`Dimension`s in ``ex... | mit | Python |
5292a379a7ebe316f92cae55d5af82b5323b9c1b | raise an exception if site_user_id is not passed to the interface server | hiidef/hiispider,hiidef/hiispider | hiispider/metacomponents/interface.py | hiispider/metacomponents/interface.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Executes new jobs on behalf of the Django application."""
from uuid import uuid4
from twisted.internet.defer import inlineCallbacks, returnValue
from hiispider.components import *
from hiispider.metacomponents import *
import logging
LOGGER = logging.getLogger(__name... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Executes new jobs on behalf of the Django application."""
from uuid import uuid4
from twisted.internet.defer import inlineCallbacks, returnValue
from hiispider.components import *
from hiispider.metacomponents import *
import logging
LOGGER = logging.getLogger(__name... | mit | Python |
87d15e732c0465ae2e243bff5d4f58cd620444b5 | Use NVE method in test instead of Brownian | joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue | hoomd/md/pytest/test_zero_momentum.py | hoomd/md/pytest/test_zero_momentum.py | import hoomd
import numpy as np
import pytest
def test_before_attaching():
trigger = hoomd.trigger.Periodic(100)
zm = hoomd.md.update.ZeroMomentum(trigger)
assert zm.trigger is trigger
trigger = hoomd.trigger.Periodic(10, 30)
zm.trigger = trigger
assert zm.trigger is trigger
def test_after_a... | import hoomd
import numpy as np
import pytest
def test_before_attaching():
trigger = hoomd.trigger.Periodic(100)
zm = hoomd.md.update.ZeroMomentum(trigger)
assert zm.trigger is trigger
trigger = hoomd.trigger.Periodic(10, 30)
zm.trigger = trigger
assert zm.trigger is trigger
def test_after_a... | bsd-3-clause | Python |
2382c2df2da5a2642c67933ecc89995ea6e35bb1 | Fix Jasmine unit tests failing | Dark-Hacker/horizon,Metaswitch/horizon,endorphinl/horizon,davidcusatis/horizon,idjaw/horizon,doug-fish/horizon,django-leonardo/horizon,bigswitch/horizon,wangxiangyu/horizon,mdavid/horizon,NCI-Cloud/horizon,wolverineav/horizon,xinwu/horizon,philoniare/horizon,tellesnobrega/horizon,j4/horizon,kfox1111/horizon,j4/horizon,... | horizon/test/jasmine/jasmine_tests.py | horizon/test/jasmine/jasmine_tests.py | # 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, software
# distributed under t... | # 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, software
# distributed under t... | apache-2.0 | Python |
972bf4cbabf517e17a717ca02faa279f8bb67fea | set method instead of a set literal for py2 compatibility. | researchstudio-sat/wonpreprocessing,researchstudio-sat/wonpreprocessing,researchstudio-sat/wonpreprocessing,researchstudio-sat/wonpreprocessing | python-processing/src/main/python/add_keyword_slice.py | python-processing/src/main/python/add_keyword_slice.py | import codecs
import sys
from os import listdir
from os.path import isfile, join
import numpy as np
from scipy.sparse.coo import coo_matrix
from scipy.io import mmwrite
import six
from feature_extraction import vectorize_and_transform, apply_threshold, \
lemma_tokenizer, PosTagLemmaTokenizer
from evaluate_link_pr... | import codecs
import sys
from os import listdir
from os.path import isfile, join
import numpy as np
from scipy.sparse.coo import coo_matrix
from scipy.io import mmwrite
import six
from feature_extraction import vectorize_and_transform, apply_threshold, \
lemma_tokenizer, PosTagLemmaTokenizer
from evaluate_link_pr... | apache-2.0 | Python |
f5ede7288175d4751edbbec4c5e04c9cef29d910 | fix log.py | alaudet/raspi-sump,alaudet/raspi-sump,jreuter/raspi-sump,jreuter/raspi-sump | raspisump/log.py | raspisump/log.py | import time
def log_reading(water_depth):
"""Log time and water depth reading."""
time_of_reading = time.strftime("%H:%M:%S,")
filename = "/home/pi/raspi-sump/csv/waterlevel-{}.csv".format(
time.strftime("%Y%m%d")
)
csv_file = open(filename, 'a')
csv_file.write(time_of_reading),
cs... | import time
def log_reading(water_depth):
"""Log time and water depth reading."""
time_of_reading = time.strftime("%H:%M:%S,")
filename = "/home/pi/raspi-sump/csv/waterlevel-{}.csv".format(
time.strftime("%Y%m%d")
)
csv_file = open(filename, 'a')
csv_file.write(time_of_reading),
cs... | mit | Python |
a00bd97721c4385885fd42f49506972781fb3b8b | Decrease sleep time | dashford/sentinel | src/Notification/Subscriber/LED/RGB.py | src/Notification/Subscriber/LED/RGB.py | import time
import RPi.GPIO as GPIO
class RGB:
def __init__(self, configuration):
self._id = configuration['id']
self._R = configuration['channels']['r']
self._G = configuration['channels']['g']
self._B = configuration['channels']['b']
pins = [
self._R,
... | import time
import RPi.GPIO as GPIO
class RGB:
def __init__(self, configuration):
self._id = configuration['id']
self._R = configuration['channels']['r']
self._G = configuration['channels']['g']
self._B = configuration['channels']['b']
pins = [
self._R,
... | mit | Python |
a3357cd4bb0859f480fa91f50604a2f129431096 | Exclude upper case letters from generated passwords. | SUNET/eduid-signup,SUNET/eduid-signup,SUNET/eduid-signup | eduid_signup/vccs.py | eduid_signup/vccs.py | from pwgen import pwgen
from re import findall
import vccs_client
def generate_password(settings, credential_id, email):
"""
Generate a new password credential and add it to the VCCS authentication backend.
The salt returned needs to be saved for use in subsequent authentications using
this password... | from pwgen import pwgen
from re import findall
import vccs_client
def generate_password(settings, credential_id, email):
"""
Generate a new password credential and add it to the VCCS authentication backend.
The salt returned needs to be saved for use in subsequent authentications using
this password... | bsd-3-clause | Python |
cd198b51d2c9271255b5e79a2216964c6d1ccd46 | Bump version to 0.0.12 | base4sistemas/pyescpos | escpos/__init__.py | escpos/__init__.py | # -*- coding: utf-8 -*-
#
# escpos/__init__.py
#
# Copyright 2015 Base4 Sistemas Ltda ME
#
# 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
#
#... | # -*- coding: utf-8 -*-
#
# escpos/__init__.py
#
# Copyright 2015 Base4 Sistemas Ltda ME
#
# 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
#
#... | apache-2.0 | Python |
45f890b81d500f0d35c848fa1c5f926f145d9c1c | fix version so setuptools quits complaining | trozamon/hadmin | hadmin/__init__.py | hadmin/__init__.py | __version__ = '0.3.dev0'
| __version__ = '0.3.dev'
| mit | Python |
5af2ddef6c02d2650028e3b059a2f350599cb8e9 | Set module installable | open-synergy/opnsynid-hr | hr_attendance_analysis/__openerp__.py | hr_attendance_analysis/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2011 Domsense srl (<http://www.domsense.com>)
# Copyright (C) 2011-15 Agile Business Group sagl (<http://www.agilebg.com>)
#
# This program is free software: you can redistribute it and/or m... | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2011 Domsense srl (<http://www.domsense.com>)
# Copyright (C) 2011-15 Agile Business Group sagl (<http://www.agilebg.com>)
#
# This program is free software: you can redistribute it and/or m... | agpl-3.0 | Python |
0796791ad94f31a1e97dac42c29210af6fb0ea69 | Make backends/template a valid Python file | severin-lemaignan/minimalkb,chili-epfl/minimalkb | src/minimalkb/backends/template.py | src/minimalkb/backends/template.py | import logging; logger = logging.getLogger("minimalKB."+__name__);
DEBUG_LEVEL=logging.DEBUG
class TemplateBackend:
def __init__(self):
pass
def clear(self):
""" Empties all knowledge models.
"""
raise NotImplementedError()
def add(self, stmts, model = "default"):
... | import logging; logger = logging.getLogger("minimalKB."+__name__);
DEBUG_LEVEL=logging.DEBUG
class TemplateBackend:
def __init__(self):
def clear(self):
""" Empties all knowledge models.
"""
raise NotImplementedError()
def add(self, stmts, model = "default"):
""" Add the ... | bsd-3-clause | Python |
2ed4867602bf02640ff86160a994c567c974e70d | Add 'set active account' logic to CLI | vegarwe/sqrl,vegarwe/sqrl,bushxnyc/sqrl,vegarwe/sqrl,vegarwe/sqrl | sqrl/sqrl.py | sqrl/sqrl.py | #!/usr/bin/env python
# TODO Catch connection errors
# TODO Catch sqrlurl format errors
# TODO Add logging option
"""
Usage: sqrl [-d] [-n] [-l] [--id <AccountID>] [--create="<Name>"] [--path=<Dir>] [<SQRLURL>]
Options:
-d Debugging output
-id Set an account as Default
-l ... | #!/usr/bin/env python
# TODO Catch connection errors
# TODO Catch sqrlurl format errors
# TODO Add logging option
"""
Usage: sqrl [-d] [-n] [-l] [--create="<Users Name>"] [--path=<Dir>] [<SQRLURL>]
Options:
-d Debugging output
-l List Accounts
-c <Your Name> Create Account
-n ... | mit | Python |
3a7ac1e8be7fa4b8ff34108d2aea235873056815 | fix unit test bug intro'ed by change dccc5a57797e | simonsdave/cloudfeaster,simonsdave/cloudfeaster,simonsdave/cloudfeaster | bin/tests/spiders_dot_py_tests.py | bin/tests/spiders_dot_py_tests.py | """This module contains "unit" tests for ```spiders.py```."""
import json
import subprocess
import unittest
from nose.plugins.attrib import attr
@attr('integration')
class TestSpidersDotPy(unittest.TestCase):
def test_all_good(self):
p = subprocess.Popen(
['spiders.py'],
stdout=... | """This module contains "unit" tests for ```spiders.py```."""
import subprocess
import unittest
from nose.plugins.attrib import attr
@attr('integration')
class TestSpidersDotPy(unittest.TestCase):
def test_all_good(self):
p = subprocess.Popen(
['spiders.py'],
stdout=subprocess.P... | mit | Python |
b03ed6307bd1354b931cdd993361d0a40a1d6850 | Reorder imports in alphabetical order | alexisrolland/data-quality,alexisrolland/data-quality,alexisrolland/data-quality,alexisrolland/data-quality | api/init/graphqlapi/proxy.py | api/init/graphqlapi/proxy.py | import graphqlapi.utils as utils
from graphqlapi.exceptions import RequestException
from graphqlapi.interceptor import ExecuteBatch, TestDataSource
from graphql.parser import GraphQLParser
interceptors = [
ExecuteBatch(),
TestDataSource()
]
def proxy_request(payload: dict):
graphql_ast = parse_query(pay... | import graphqlapi.utils as utils
from graphql.parser import GraphQLParser
from graphqlapi.interceptor import ExecuteBatch, TestDataSource
from graphqlapi.exceptions import RequestException
interceptors = [
ExecuteBatch(),
TestDataSource()
]
def proxy_request(payload: dict):
graphql_ast = parse_query(pay... | apache-2.0 | Python |
a5d9a1806225a5bbc50f57d3f190de3dee34ee59 | Support no_match_error in selects.with_or(). | bazelbuild/bazel-skylib,bazelbuild/bazel-skylib,bazelbuild/bazel-skylib | lib/selects.bzl | lib/selects.bzl | # Copyright 2017 The Bazel 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 la... | # Copyright 2017 The Bazel 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 la... | apache-2.0 | Python |
05fc13ef7b0c48a8411252a9c05d518eac842071 | load calibration file properly; typo on variable name | sbma44/stephmeter,sbma44/yellowlight,sbma44/yellowlight | stephmeter.py | stephmeter.py | #!/home/pi/.virtualenvs/stephmeter/bin/python
import nextbus
import pwm_calibrate
import led
import time
from settings import *
def main():
l = led.LED(SERIAL_DEVICE, SERIAL_SPEED)
p = pwm_calibrate.PWMCalibrator()
p.load()
p_range = p.get_range()
nb = nextbus.NextbusPredictor(NEXTBUS_ROUTES)
while True:
nb.... | #!/home/pi/.virtualenvs/stephmeter/bin/python
import nextbus
import pwm_calibrate
import led
import time
from settings import *
def main():
l = led.LED(SERIAL_DEVICE, SERIAL_SPEED)
p = pwm_calibrate.PWMCalibrator()
p_range = p.get_range()
nb = nextbus.NextbusPredictor(NEXTBUS_ROUTES)
while True:
nb.refresh_if... | mit | Python |
9e5583ab08bb40d0cedd4931a2fde59b2040d554 | fix error when no ssid is found in db | amfoss/fosswebsite,akshaya9/fosswebsite,akshaya9/fosswebsite,akshaya9/fosswebsite,amfoss/fosswebsite,amfoss/fosswebsite | attendance/management/commands/update_ssid.py | attendance/management/commands/update_ssid.py | from django.core.management import BaseCommand
from attendance.models import SSIDName
class Command(BaseCommand):
help = 'Generates a new ssid(need to run as a cron job everyday)'
def handle(self, *args, **options):
ssid_name, created = SSIDName.objects.get_or_create(id=1)
ssid_name.generate... | from django.core.management import BaseCommand
from attendance.models import SSIDName
class Command(BaseCommand):
help = 'Generates a new ssid(need to run as a cron job everyday)'
def handle(self, *args, **options):
ssid_name = SSIDName.objects.first()
ssid_name.generate_random_name()
... | mit | Python |
230802ee222a6850618517674b991e93a9ed9e6b | Add multiple columns simultaneously | firstblade/zulip,jessedhillon/zulip,joshisa/zulip,tiansiyuan/zulip,dotcool/zulip,noroot/zulip,xuxiao/zulip,amanharitsh123/zulip,cosmicAsymmetry/zulip,mansilladev/zulip,Gabriel0402/zulip,brainwane/zulip,jainayush975/zulip,peguin40/zulip,wangdeshui/zulip,shaunstanislaus/zulip,stamhe/zulip,jackrzhang/zulip,ericzhou2008/zu... | zerver/lib/migrate.py | zerver/lib/migrate.py | import re
import time
def timed_ddl(db, stmt):
print
print time.asctime()
print stmt
t = time.time()
db.execute(stmt)
delay = time.time() - t
print 'Took %.2fs' % (delay,)
def validate(sql_thingy):
# Do basic validation that table/col name is safe.
if not re.match('^[a-z][a-z\d_]+$... | import re
import time
def timed_ddl(db, stmt):
print
print time.asctime()
print stmt
t = time.time()
db.execute(stmt)
delay = time.time() - t
print 'Took %.2fs' % (delay,)
def validate(sql_thingy):
# Do basic validation that table/col name is safe.
if not re.match('^[a-z][a-z\d_]+$... | apache-2.0 | Python |
07d01e16bec95941ac5a85116821190c86658458 | add request data to app class | salamer/jolla,salamer/jolla,NKUCodingCat/jolla,NKUCodingCat/jolla | server/server.py | server/server.py | import gevent.monkey
gevent.monkey.patch_all()
from gevent.pywsgi import WSGIServer
import re
from HTTPerror import HTTP404Error
def render(filename):
with open(filename, "r") as f:
res = f.read()
return res
def index():
return render("../templates/index.html")
def name():
return render... | import gevent.monkey
gevent.monkey.patch_all()
from gevent.pywsgi import WSGIServer
import re
from HTTPerror import HTTP404Error
def render(filename):
with open(filename, "r") as f:
res = f.read()
return res
def index():
return render("../templates/index.html")
def name():
return render... | apache-2.0 | Python |
10f307b7f0c4e0467a053ed59235fa2ba4bc6968 | Fix a test. | ecolell/pfamserver,ecolell/pfamserver,ecolell/pfamserver | backend/tests/api/v0/test_protein_sequence.py | backend/tests/api/v0/test_protein_sequence.py | import json
def test_get_protein_sequence(
db,
client,
egfr_human_partial_sequence,
mock_pfam_scan_egfr_human,
uniprot_reg_full_egfr_human,
):
sequence = egfr_human_partial_sequence
headers = [("Accept", "application/json"), ("Content-Type", "application/json")]
res = client.get("/api... | from __future__ import unicode_literals
import json
import pytest
def test_get_protein_sequence(db, client, egfr_human_partial_sequence):
sequence = egfr_human_partial_sequence
headers = [('Accept', 'application/json'),
('Content-Type', 'application/json')]
res = client.get('/api/v0/protei... | agpl-3.0 | Python |
d20aef9623d0f82637220d4a8927c7b0549711c3 | Fix test_fauxware_oppologist. (#2365) | angr/angr,angr/angr,angr/angr | tests/test_oppologist.py | tests/test_oppologist.py | import os
import angr
test_location = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..')
def _ultra_oppologist(p, s):
old_ops = dict(angr.engines.vex.claripy.irop.operations)
try:
angr.engines.vex.claripy.irop.operations.clear()
angr.engines.vex.claripy.irop.operations['Iop... | import os
import angr
test_location = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..')
def _ultra_oppologist(p, s):
old_ops = dict(angr.engines.vex.claripy.irop.operations)
try:
angr.engines.vex.claripy.irop.operations.clear()
angr.engines.vex.claripy.irop.operations['Iop... | bsd-2-clause | Python |
45596b2e603e1ccb7cb271cc9834ede6293dd700 | create a local ghostpad before linking | h01ger/voctomix,voc/voctomix,h01ger/voctomix,voc/voctomix | voctocore/experiments/binlinktest.py | voctocore/experiments/binlinktest.py | #!/usr/bin/python3
import gi, time
gi.require_version('Gst', '1.0')
from gi.repository import GLib, Gst, GObject
GObject.threads_init()
Gst.init(None)
class SrcBin(Gst.Bin):
def __init__(self):
super().__init__()
self.src = Gst.ElementFactory.make('videotestsrc', 'src')
self.add(self.src)
self.add_pad(
... | #!/usr/bin/python3
import gi, time
gi.require_version('Gst', '1.0')
from gi.repository import GLib, Gst, GObject
GObject.threads_init()
Gst.init(None)
class SrcBin(Gst.Bin):
def __init__(self):
super().__init__()
self.src = Gst.ElementFactory.make('videotestsrc', 'src')
self.add(self.src)
self.add_pad(
... | mit | Python |
b8e24b78feae538806c7de0f138623cbe179646c | Fix submit guard. | veroc/Bika-LIMS,rockfruit/bika.lims,anneline/Bika-LIMS,anneline/Bika-LIMS,veroc/Bika-LIMS,DeBortoliWines/Bika-LIMS,DeBortoliWines/Bika-LIMS,DeBortoliWines/Bika-LIMS,labsanmartin/Bika-LIMS,veroc/Bika-LIMS,anneline/Bika-LIMS,labsanmartin/Bika-LIMS,labsanmartin/Bika-LIMS,rockfruit/bika.lims | bika/lims/skins/bika/guard_submit_analysis.py | bika/lims/skins/bika/guard_submit_analysis.py | ## Script (Python) "guard_submit_analysis"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=
##
wf_tool = context.portal_workflow
analyses = ['Analysis', 'DuplicateAnalysis', 'ReferenceAnalysis', ]
if context.portal_type in... | ## Script (Python) "guard_submit_analysis"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=
##
wf_tool = context.portal_workflow
analyses = ['Analysis', 'DuplicateAnalysis', 'ReferenceAnalysis', ]
if context.portal_type in... | agpl-3.0 | Python |
6a8a6ba6a926eab3bf51dc9d4080d11b274799aa | Update copyright | ichenq/WinsockTut,ichenq/WinsockTut,ichenq/WinsockTut | tests/test_tcp_client.py | tests/test_tcp_client.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2015 ichenq@outlook.com. All rights reserved.
# Distributed under the terms and conditions of the Apache License.
# See accompanying files LICENSE.
#
import socket
import asyncore
import random
import pdb
class tcp_client(asyncore.dispatcher):
... | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import socket
import asyncore
import random
import pdb
class tcp_client(asyncore.dispatcher):
def __init__(self, host, port, msg):
asyncore.dispatcher.__init__(self)
self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
self.connect((host, p... | apache-2.0 | Python |
c57d0faf5828f750fe68446d927eb7271be25979 | add code for compiling notes/ section. also add code for creating a directory in the output folder if it doesnt already exist | nham/driveler | compile.py | compile.py | import sys
import os, shutil, subprocess
from glob import glob
site_title = 'wabbo'
include_dir = 'includes/'
exclude_files = ['readme.md']
out_folder = '_out/'
fname_no_ext = lambda fn: fn[:fn.index('.')]
def pandocConvert(pathto, fname):
dothtml = fname[:fname.index('.')] + '.html'
in_file = pathto + fnam... | import sys
import os, shutil, subprocess
from glob import glob
site_title = 'wabbo'
include_dir = 'includes/'
exclude_files = ['readme.md']
out_folder = '_out/'
def pandocConvert(pathto, fname):
dothtml = fname[:fname.index('.')] + '.html'
in_file = pathto + fname
out_file = out_folder + pathto + dothtml... | cc0-1.0 | Python |
9caf509d2884d91453441140d855693666ce183d | update the script. | smileboywtu/MusicRecommend,smileboywtu/LTCodeSerialDecoder | music_recommend.py | music_recommend.py | #!/usr/bin/env python2
"""
this script use python3 and work period to get the
recommend music from netease.
"""
import sqlite3
from netease import NetEase
from apscheduler.schedulers.blocking import BlockingScheduler
# config
USERNAME = '15897970114'
PASSWORD = 'c651bf7febcc1f324a984529959a0950'
DATABASE_URL = ... | #!/usr/bin/env python2
"""
this script use python3 and work period to get the
recommend music from netease.
"""
import time
import sqlite3
from netease import NetEase
# config
USERNAME = 'your username'
PASSWORD = 'your password'
DATABASE_URL = 'recommend.db'
UPDATE_PERIOD = 6 * 60 * 60
def period(seconds):... | apache-2.0 | Python |
e57d946543af9fca5c10efd43f4b313719ef8a75 | Update tests | ktok07b6/polyphony,ktok07b6/polyphony,ktok07b6/polyphony | tests/unroll/unroll01.py | tests/unroll/unroll01.py | from polyphony import testbench
from polyphony import unroll
def unroll01(xs, ys):
s = 0
for i in unroll(range(8)):
x = xs[i] + 1
if x < 0:
s = s + x
else:
s = s - x
ys[i] = x
#print(x)
return s
@testbench
def test():
data = [1, 2, 3, 4... | from polyphony import testbench
from polyphony import unroll
def unroll01(xs, ys):
s = 0
for i in range(8): # synth: unroll
x = xs[i] + 1
if x < 0:
s = s + x
else:
s = s - x
ys[i] = x
#print(x)
return s
@testbench
def test():
data = [1... | mit | Python |
8ad3d29336e74b39d2daac5a6c8f6b50b1efa9b7 | Refactor into main function | robjwells/adventofcode-solutions,robjwells/adventofcode-solutions,robjwells/adventofcode-solutions,robjwells/adventofcode-solutions,robjwells/adventofcode-solutions,robjwells/adventofcode-solutions | 2015/python/2015-03.py | 2015/python/2015-03.py | #!/usr/local/bin/python3
from collections import namedtuple
import pathlib
def main(puzzle_input):
Point = namedtuple('Point', ['x', 'y'])
location = Point(0, 0)
visited = {location}
def new_loc(current_loc, instruction):
new_loc_table = {
'^': (current_loc.x, current_loc.y + 1),... | #!/usr/local/bin/python3
from collections import namedtuple
with open('../input/2015-03.txt') as f:
instructions = f.read().rstrip()
Point = namedtuple('Point', ['x', 'y'])
location = Point(0, 0)
visited = {location}
def new_loc(current_loc, instruction):
new_loc_table = {
'^': (current_loc.x, curr... | mit | Python |
cb2547ecf40aa18e9bdf4688fe0f552e2f02a738 | update example | thefab/tornadis,thefab/tornadis | examples/pubsub.py | examples/pubsub.py | import tornado
import tornadis
@tornado.gen.coroutine
def pubsub_coroutine():
# Let's get a connected client
client = tornadis.PubSubClient()
yield client.connect()
# Let's "psubscribe" to a pattern
yield client.pubsub_psubscribe("foo*")
# Let's "subscribe" to a channel
yield client.pubs... | import tornado
import tornadis
@tornado.gen.coroutine
def pubsub():
client = tornadis.Client()
yield client.connect()
yield client.pubsub_psubscribe("foo*")
yield client.pubsub_subscribe("bar")
while True:
reply = yield client.pubsub_pop_message()
print(reply)
if reply[3] =... | mit | Python |
2ce16a9903ab07c98d805988e82d88c7c8c64e47 | simplify definition of sqrtm grad, move to top of file | barak/autograd,HIPS/autograd,kcarnold/autograd,hips/autograd,HIPS/autograd,hips/autograd | autograd/scipy/linalg.py | autograd/scipy/linalg.py | from __future__ import division
import scipy.linalg
import autograd.numpy as anp
from autograd.numpy.numpy_wrapper import wrap_namespace
from autograd.numpy.linalg import atleast_2d_col as al2d
wrap_namespace(scipy.linalg.__dict__, globals()) # populates module namespace
sqrtm.defgrad(lambda ans, A, **kwargs: lambd... | from __future__ import division
import scipy.linalg
import autograd.numpy as anp
from autograd.numpy.numpy_wrapper import wrap_namespace
from autograd.numpy.linalg import atleast_2d_col as al2d
wrap_namespace(scipy.linalg.__dict__, globals()) # populates module namespace
def _flip(a, trans):
if anp.iscomplexob... | mit | Python |
3f6bfdb407085ddac560e48d43277a897df48c8d | Update version.py | tenable/pyTenable | tenable/version.py | tenable/version.py | version = '1.3.0'
version_info = tuple(int(d) for d in version.split("-")[0].split("."))
| version = '1.2.8'
version_info = tuple(int(d) for d in version.split("-")[0].split("."))
| mit | Python |
db846990e010014f023324d5b687caeb13bc9725 | fix script so that it actually works! | akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem | scripts/climodat/dump.py | scripts/climodat/dump.py | import constants
from pyIEM import iemdb
import network
nt = network.Table("IACLIMATE")
i = iemdb.iemdb()
coop = i['coop']
for id in nt.sts.keys():
fn = "coop_data/%s.csv" % (nt.sts[id]['name'].replace(" ", "_"), )
out = open(fn, 'w')
out.write("station,station_name,lat,lon,day,high,low,precip,snow,\n")
sql = ... | import constants
from pyIEM import iemdb
import network
nt = network.Table("IACLIMATE")
i = iemdb.iemdb()
coop = i['coop']
for id in nt.sts.keys():
fn = "coop_data/%s.csv" % (st.sts[id]['name'].replace(" ", "_"), )
out = open(fn, 'w')
out.write("station,station_name,lat,lon,day,high,low,precip,snow,\n")
sql = ... | mit | Python |
a999e37136ff17739bbd2e782fc4c47767489908 | add moonscript and lua | yjpark/silp | silp/language.py | silp/language.py | import silp
class Language:
def __init__(self, name, extension, macro_prefix,
generated_suffix, columns):
self.name = name
self.extension = extension
self.macro_prefix = macro_prefix
self.generated_suffix = generated_suffix
self.columns = columns
languages... | import silp
class Language:
def __init__(self, name, extension, macro_prefix,
generated_suffix, columns):
self.name = name
self.extension = extension
self.macro_prefix = macro_prefix
self.generated_suffix = generated_suffix
self.columns = columns
languages... | mit | Python |
422b559b07f179e93423530155a86bc7765142c8 | Update XSS-injection.py | nwiizo/workspace_2017,nwiizo/workspace_2017,nwiizo/workspace_2017,nwiizo/workspace_2017,nwiizo/workspace_2017,nwiizo/workspace_2017,nwiizo/workspace_2017,nwiizo/workspace_2017,nwiizo/workspace_2017,nwiizo/workspace_2017 | pen_test_code/XSS-injection.py | pen_test_code/XSS-injection.py | import mechanize
url = "http://www.webscantest.com/crosstraining/aboutyou.php"
browser = mechanize.Browser()
attackNumber = 1
with open('XSS-vectors.txt') as f:
for line in f:
browser.open(url)
browser.select_form(nr=0)
browser["fname"] = line
res = browser.submit()
content = res.read()
# check ... | import mechanize
url = "http://www.webscantest.com/crosstraining/aboutyou.php"
browser = mechanize.Browser()
attackNumber = 1
with open('XSS-vectors.txt') as f:
for line in f:
browser.open(url)
browser.select_form(nr=0)
browser["fname"] = line
res = browser.submit()
content = res.read()
# check ... | mit | Python |
767131c3addcc182b8b0c73a977df3540b282500 | Remove problematic imports in __init__ -- causing cycles and weirdness. | spacy-io/thinc,explosion/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc,explosion/thinc,spacy-io/thinc | thinc/neural/__init__.py | thinc/neural/__init__.py | from ._classes.model import Model
from ._classes.affine import Affine
from ._classes.relu import ReLu
from ._classes.softmax import Softmax
from ._classes.elu import ELU
from ._classes.maxout import Maxout
from .pooling import Pooling, mean_pool, max_pool
from ._classes.convolution import ExtractWindow
from ._classes... | from ._classes.model import Model
from ._classes.affine import Affine
from ._classes.relu import ReLu
from ._classes.softmax import Softmax
from ._classes.elu import ELU
from ._classes.maxout import Maxout
from ._classes.embed import Embed
from ._classes.static_vectors import StaticVectors
#from ._classes.embed impor... | mit | Python |
89ffd5dbaed09b99247fe9a93cbea8aea7acac1f | Change PROXY_HOST_HTTPS in settings | heynemann/thumborizeme,heynemann/thumborizeme,heynemann/thumborizeme | thumborizeme/settings.py | thumborizeme/settings.py | import os
# REDIS
REDIS_HOST = os.environ.get('REDIS_HOST', '127.0.0.1')
REDIS_PORT = os.environ.get('REDIS_PORT', 6379)
REDIS_PASSWORD = os.environ.get('REDIS_PASSWORD', '')
HOST = os.environ.get('HOST', 'http://localhost:9000')
THUMBOR_HOST = os.environ.get('THUMBOR_HOST', 'http://localhost:8001')
# PROXY
PROXY_HO... | import os
# REDIS
REDIS_HOST = os.environ.get('REDIS_HOST', '127.0.0.1')
REDIS_PORT = os.environ.get('REDIS_PORT', 6379)
REDIS_PASSWORD = os.environ.get('REDIS_PASSWORD', '')
HOST = os.environ.get('HOST', 'http://localhost:9000')
THUMBOR_HOST = os.environ.get('THUMBOR_HOST', 'http://localhost:8001')
# PROXY
PROXY_HO... | mit | Python |
06f2b79ceba640b57ec3323a37f0204df5f26bb3 | Fix the test settings. | hello-base/web,hello-base/web,hello-base/web,hello-base/web | base/settings/testing.py | base/settings/testing.py | # -*- coding: utf-8 -*-
from configurations import values
from .base import Base as Settings
class Testing(Settings):
# Debug Settings.
# --------------------------------------------------------------------------
DEBUG = values.BooleanValue(False)
TEMPLATE_DEBUG = values.BooleanValue(False)
# Da... | # -*- coding: utf-8 -*-
from configurations import values
from .base import Base as Settings
class Testing(Settings):
# Debug Settings.
# --------------------------------------------------------------------------
DEBUG = values.BooleanValue(False)
TEMPLATE_DEBUG = values.BooleanValue(False)
# Da... | apache-2.0 | Python |
f95aa5b36a354fe3cfd94b43d8f0f6346ec400de | Disable setting thread_name_prefix in ThreadPoolExecutor (only supported in Python >= 3.6) | xmikos/soapy_power,xmikos/soapy_power | soapypower/threadpool.py | soapypower/threadpool.py | import os, queue, concurrent.futures
class ThreadPoolExecutor(concurrent.futures.ThreadPoolExecutor):
"""ThreadPoolExecutor which allows setting max. work queue size"""
def __init__(self, max_workers=0, thread_name_prefix='', max_queue_size=0):
#super().__init__(max_workers or os.cpu_count() or 1, thr... | import os, queue, concurrent.futures
class ThreadPoolExecutor(concurrent.futures.ThreadPoolExecutor):
"""ThreadPoolExecutor which allows setting max. work queue size"""
def __init__(self, max_workers=0, thread_name_prefix='', max_queue_size=0):
super().__init__(max_workers or os.cpu_count() or 1, thre... | mit | Python |
edbe6f7707afac9afa5e201c9e1fc17fad05e548 | Reorder imports | oldarmyc/pitchfork,oldarmyc/pitchfork,rackerlabs/pitchfork,rackerlabs/pitchfork,oldarmyc/pitchfork,rackerlabs/pitchfork | pitchfork/setup_application.py | pitchfork/setup_application.py | # Copyright 2014 Dave Kludt
#
# 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, s... | # Copyright 2014 Dave Kludt
#
# 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, s... | apache-2.0 | Python |
549fd2c0b7a60d55953f15223fac9e59fd780089 | make odoo2odoo installable | jobiols/odoo-addons,jobiols/odoo-addons,jobiols/odoo-addons,jobiols/odoo-addons | odoo2odoo/__openerp__.py | odoo2odoo/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 JEOSOFT (http://www.jeosoft.com.ar)
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General P... | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 JEOSOFT (http://www.jeosoft.com.ar)
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General P... | agpl-3.0 | Python |
c30010e5a97cc7926d8c78cecbc01dfe2cb8550a | Use Vertex in STLWriter | onitake/Uranium,onitake/Uranium | plugins/STLWriter/STLWriter.py | plugins/STLWriter/STLWriter.py | from Cura.MeshHandling.MeshWriter import MeshWriter
import time
import struct
class STLWriter(MeshWriter):
def __init__(self):
super(STLWriter, self).__init__()
self._supported_extension = ".stl"
#TODO: Only a single mesh can be saved to a single file, we might want to save multiple me... | from Cura.MeshHandling.MeshWriter import MeshWriter
import time
import struct
class STLWriter(MeshWriter):
def __init__(self):
super(STLWriter, self).__init__()
self._supported_extension = ".stl"
#TODO: Only a single mesh can be saved to a single file, we might want to save multiple me... | agpl-3.0 | Python |
752c926a8ebd194b5bb24606e6382e84c9274120 | adjust comment | 4dn-dcic/fourfront,hms-dbmi/fourfront,4dn-dcic/fourfront,4dn-dcic/fourfront,hms-dbmi/fourfront,hms-dbmi/fourfront,4dn-dcic/fourfront,hms-dbmi/fourfront,hms-dbmi/fourfront | src/encoded/types/antibody.py | src/encoded/types/antibody.py | """The type file for the collection Antibody.
logic for autopopulating 'antibody_id' unique key upon update or create
"""
from snovault import (
calculated_property,
collection,
load_schema,
)
from .base import (
Item,
lab_award_attribution_embed_list
)
from .dependencies import DependencyEmbedd... | """The type file for the collection Antibody.
logic for autopopulating 'antibody_id' unique key upon update or create
"""
from snovault import (
calculated_property,
collection,
load_schema,
)
from .base import (
Item,
lab_award_attribution_embed_list
)
from .dependencies import DependencyEmbedd... | mit | Python |
0425a3ce6ab44c7abae4d791d17db0305b436764 | bump to 0.9.11 | martin-hunt/hublib | hublib/__init__.py | hublib/__init__.py | from pint import UnitRegistry
ureg = UnitRegistry()
ureg.autoconvert_offset_to_baseunit = True
Q_ = ureg.Quantity
__version__ = "0.9.11"
| from pint import UnitRegistry
ureg = UnitRegistry()
ureg.autoconvert_offset_to_baseunit = True
Q_ = ureg.Quantity
__version__ = "0.9.10"
| mit | Python |
67eb081fa8fec0849646bbbcf6305279357f556d | Refactor the fetch command line dispatcher | cgeoffroy/son-analyze,cgeoffroy/son-analyze | src/son_analyze/cli/fetch_cmd.py | src/son_analyze/cli/fetch_cmd.py | # Copyright (c) 2015 SONATA-NFV, Thales Communications & Security
# 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
#
#... | # Copyright (c) 2015 SONATA-NFV, Thales Communications & Security
# 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
#
#... | apache-2.0 | Python |
5b6545f385b031fb2629370ec15dd2770bc27533 | revert test to command_order | wooey/Wooey,wooey/Wooey,wooey/Wooey,wooey/Wooey | wooey/tests/scripts/command_order.py | wooey/tests/scripts/command_order.py | import argparse
import sys
parser = argparse.ArgumentParser(description="Something")
parser.add_argument('link', help='the url containing the metadata')
parser.add_argument('name', help='the name of the file')
if __name__ == '__main__':
args = parser.parse_args()
sys.stderr.write('{} {}'.format(args.link, arg... | import argparse
import sys
parser = argparse.ArgumentParser(description="Something")
parser.add_argument('linknew', help='the url containing the metadata')
parser.add_argument('name', help='the name of the file')
if __name__ == '__main__':
args = parser.parse_args()
sys.stderr.write('{} {}'.format(args.link, ... | bsd-3-clause | Python |
d817078bcb73c2d65677ef660ba43c9859230ee9 | Change get_terminal_size from os to shutil | Kynarth/pokediadb | pokediadb/log.py | pokediadb/log.py | """Module to display different kind of messages in the terminal."""
import shutil
import textwrap
import click
from pokediadb.enums import Log
def format_message(msg, msg_type):
"""Format a message in function of message type and terminal's size.
Args:
msg (str): Message to format.
msg_typ... | """Module to display different kind of messages in the terminal."""
import os
import textwrap
import click
from pokediadb.enums import Log
def format_message(msg, msg_type):
"""Format a message in function of message type and terminal's size.
Args:
msg (str): Message to format.
msg_type (L... | mit | Python |
d3ac89dacfd2991965c9638a8678cbf26aab4793 | Fix header mapping | nikdoof/django-eveigb | eveigb/middleware.py | eveigb/middleware.py | class IGBMiddleware(object):
"""
Middleware to detect the EVE IGB
"""
def process_request(self, request):
request.is_igb = False
request.is_igb_trusted = False
header_map = [
('HTTP_EVE_SERVERIP', 'eve_server_ip'),
('HTTP_EVE_CHARNAME', 'eve_charname'),... | class IGBMiddleware(object):
"""
Middleware to detect the EVE IGB
"""
def process_request(self, request):
request.is_igb = False
request.is_igb_trusted = False
header_map = [
('HTTP_EVE_SERVERIP', 'eve_server_ip'),
('HTTP_EVE_CHARNAME', 'eve_charname'),... | bsd-3-clause | Python |
fd7c2beb8d0d400d0ba91b725ff2bb30d7f43e3b | remove debugging print | DuCorey/bokeh,quasiben/bokeh,percyfal/bokeh,DuCorey/bokeh,dennisobrien/bokeh,msarahan/bokeh,stonebig/bokeh,rs2/bokeh,DuCorey/bokeh,bokeh/bokeh,Karel-van-de-Plassche/bokeh,ptitjano/bokeh,azjps/bokeh,jakirkham/bokeh,DuCorey/bokeh,bokeh/bokeh,phobson/bokeh,KasperPRasmussen/bokeh,ptitjano/bokeh,clairetang6/bokeh,bokeh/boke... | examples/app/timeout.py | examples/app/timeout.py | ''' Present a plot updating according to a set of fixed timeout
intervals.
Use the ``bokeh serve`` command to run the example by executing:
bokeh serve timeout.py
at your command prompt. Then navigate to the URL
http://localhost:5006/timeout
in your browser.
'''
import sys
import numpy as np
from boke... | ''' Present a plot updating according to a set of fixed timeout
intervals.
Use the ``bokeh serve`` command to run the example by executing:
bokeh serve timeout.py
at your command prompt. Then navigate to the URL
http://localhost:5006/timeout
in your browser.
'''
import sys
import numpy as np
from boke... | bsd-3-clause | Python |
3b35713626b1861d6dc022fa2a40f979cb415860 | remove debugging code | melmorabity/streamlink,javiercantero/streamlink,chhe/streamlink,beardypig/streamlink,back-to/streamlink,streamlink/streamlink,bastimeyer/streamlink,beardypig/streamlink,wlerin/streamlink,back-to/streamlink,bastimeyer/streamlink,melmorabity/streamlink,gravyboat/streamlink,streamlink/streamlink,chhe/streamlink,wlerin/str... | src/streamlink/plugins/facebook.py | src/streamlink/plugins/facebook.py | import re
from streamlink.plugin import Plugin
from streamlink.plugin.api import http, useragents
from streamlink.stream import DASHStream, HTTPStream
from streamlink.utils import parse_json
class Facebook(Plugin):
_url_re = re.compile(r"https?://(?:www\.)?facebook\.com/[^/]+/videos")
_mpd_re = re.compile(r'... | import re
from streamlink.plugin import Plugin
from streamlink.plugin.api import http, useragents
from streamlink.stream import DASHStream, HTTPStream
from streamlink.utils import parse_json
class Facebook(Plugin):
_url_re = re.compile(r"https?://(?:www\.)?facebook\.com/[^/]+/videos")
_mpd_re = re.compile(r'... | bsd-2-clause | Python |
7077716c25849d3c365081c3a531c3e5020b3f4d | remove superfluous box_select tool | percyfal/bokeh,msarahan/bokeh,stonebig/bokeh,KasperPRasmussen/bokeh,KasperPRasmussen/bokeh,aiguofer/bokeh,quasiben/bokeh,ericmjl/bokeh,rs2/bokeh,KasperPRasmussen/bokeh,aavanian/bokeh,clairetang6/bokeh,azjps/bokeh,clairetang6/bokeh,aavanian/bokeh,Karel-van-de-Plassche/bokeh,philippjfr/bokeh,dennisobrien/bokeh,justacec/b... | examples/glyphs/maps.py | examples/glyphs/maps.py | from __future__ import print_function
from bokeh.util.browser import view
from bokeh.document import Document
from bokeh.embed import file_html
from bokeh.models.glyphs import Circle
from bokeh.models import (
GMapPlot, Range1d, ColumnDataSource,
PanTool, WheelZoomTool, BoxSelectTool,
BoxSelection, GMapOpt... | from __future__ import print_function
from bokeh.util.browser import view
from bokeh.document import Document
from bokeh.embed import file_html
from bokeh.models.glyphs import Circle
from bokeh.models import (
GMapPlot, Range1d, ColumnDataSource,
PanTool, WheelZoomTool, BoxSelectTool,
BoxSelectionOverlay, ... | bsd-3-clause | Python |
aed8a831bca72268ad9fbcd2f777d91af29d61b6 | Define const `OUTPUT_PANEL` for the panel name | SublimeLinter/SublimeLinter3,SublimeLinter/SublimeLinter3 | message_view.py | message_view.py | import sublime
import sublime_plugin
PANEL_NAME = "SublimeLinter Messages"
OUTPUT_PANEL = "output." + PANEL_NAME
def plugin_unloaded():
for window in sublime.windows():
window.destroy_output_panel(PANEL_NAME)
class SublimeLinterDisplayPanelCommand(sublime_plugin.WindowCommand):
def run(self, msg=""... | import sublime
import sublime_plugin
PANEL_NAME = "SublimeLinter Messages"
def plugin_unloaded():
for window in sublime.windows():
window.destroy_output_panel(PANEL_NAME)
class SublimeLinterDisplayPanelCommand(sublime_plugin.WindowCommand):
def run(self, msg=""):
panel_view = self.window.cr... | mit | Python |
1874bd2172d4c96b9188cf2b157412d2522331ef | make it slightly larger | stoq/kiwi | examples/list/simple.py | examples/list/simple.py | import gtk
from kiwi.ui.objectlist import Column, ObjectList
class Fruit:
def __init__(self, name, price):
self.name = name
self.price = price
fruits = ObjectList([Column('name', data_type=str),
Column('price', data_type=int)])
for name, price in [('Apple', 4),
... | import gtk
from kiwi.ui.objectlist import Column, ObjectList
class Fruit:
def __init__(self, name, price):
self.name = name
self.price = price
fruits = ObjectList([Column('name', data_type=str),
Column('price', data_type=int)])
for name, price in [('Apple', 4),
... | lgpl-2.1 | Python |
abc135f36bbacd8783eb1855298565caa681d15d | bump minor release | izhan/Stream-Framework,izhan/Stream-Framework,smuser90/Stream-Framework,Anislav/Stream-Framework,SergioChan/Stream-Framework,SergioChan/Stream-Framework,smuser90/Stream-Framework,SergioChan/Stream-Framework,nikolay-saskovets/Feedly,smuser90/Stream-Framework,turbolabtech/Stream-Framework,Anislav/Stream-Framework,Architi... | feedly/__init__.py | feedly/__init__.py | __author__ = 'Thierry Schellenbach'
__copyright__ = 'Copyright 2012, Thierry Schellenbach'
__credits__ = ['Thierry Schellenbach, mellowmorning.com, @tschellenbach']
__license__ = 'BSD'
__version__ = '0.8.117'
__maintainer__ = 'Thierry Schellenbach'
__email__ = 'thierryschellenbach@gmail.com'
__status__ = 'Production'... | __author__ = 'Thierry Schellenbach'
__copyright__ = 'Copyright 2012, Thierry Schellenbach'
__credits__ = ['Thierry Schellenbach, mellowmorning.com, @tschellenbach']
__license__ = 'BSD'
__version__ = '0.8.116'
__maintainer__ = 'Thierry Schellenbach'
__email__ = 'thierryschellenbach@gmail.com'
__status__ = 'Production'... | bsd-3-clause | Python |
22cb2159d730fc2fd6c71a95eea20c7272e0d175 | bump a version | SergioChan/Stream-Framework,turbolabtech/Stream-Framework,Architizer/Feedly,turbolabtech/Stream-Framework,nikolay-saskovets/Feedly,Anislav/Stream-Framework,nikolay-saskovets/Feedly,turbolabtech/Stream-Framework,Architizer/Feedly,izhan/Stream-Framework,smuser90/Stream-Framework,nikolay-saskovets/Feedly,Anislav/Stream-Fr... | feedly/__init__.py | feedly/__init__.py | __author__ = 'Thierry Schellenbach'
__copyright__ = 'Copyright 2012, Thierry Schellenbach'
__credits__ = ['Thierry Schellenbach, mellowmorning.com, @tschellenbach']
__license__ = 'BSD'
__version__ = '0.3.11'
__maintainer__ = 'Thierry Schellenbach'
__email__ = 'thierryschellenbach@gmail.com'
__status__ = 'Production'
... | __author__ = 'Thierry Schellenbach'
__copyright__ = 'Copyright 2012, Thierry Schellenbach'
__credits__ = ['Thierry Schellenbach, mellowmorning.com, @tschellenbach']
__license__ = 'BSD'
__version__ = '0.3.10'
__maintainer__ = 'Thierry Schellenbach'
__email__ = 'thierryschellenbach@gmail.com'
__status__ = 'Production'
... | bsd-3-clause | Python |
73ef474ddc74478f2ae2d3d1e07993b99ed733e5 | fix coding bug | likelyzhao/mxnet,likelyzhao/mxnet,likelyzhao/mxnet,likelyzhao/mxnet,likelyzhao/mxnet,likelyzhao/mxnet,likelyzhao/mxnet,likelyzhao/mxnet,likelyzhao/mxnet | example/rcnn/eval.py | example/rcnn/eval.py | from __future__ import print_function
import argparse
import mxnet as mx
from rcnn.config import config, default, generate_config
from rcnn.tools.test_rcnn import test_rcnn
from pycrayon import CrayonClient
from datetime import datetime
import numpy as np
def parse_args():
parser = argparse.ArgumentParser(descript... | from __future__ import print_function
import argparse
import mxnet as mx
from rcnn.config import config, default, generate_config
from rcnn.tools.test_rcnn import test_rcnn
from pycrayon import CrayonClient
from datetime import datetime
import numpy as np
def parse_args():
parser = argparse.ArgumentParser(descript... | apache-2.0 | Python |
5b864c5fa5a27bbaddf7e7deafeedb19f0e0e51d | Update Watchers.py | possoumous/Watchers,possoumous/Watchers,possoumous/Watchers,possoumous/Watchers | examples/Watchers.py | examples/Watchers.py | from seleniumbase import BaseCase
class MyTestClass(BaseCase):
def test_basic(self):
self.open('https://stocktwits.com/symbol/CYTR?q=cytr') # Navigate to the web page
self.assert_element('sentiment-tab') # Assert element on page
self.click('sentiment-tab') ... | from seleniumbase import BaseCase
class MyTestClass(BaseCase):
def test_basic(self):
self.open('https://stocktwits.com/') # Navigate to the web page
self.assert_element('sentiment-tab') # Assert element on page
self.click('sentiment-tab') # Click element ... | mit | Python |
66ce9215ead86fa736bef13b065a281efb722a12 | remove deprecated TEMPLATE_DEBUG setting | fnp/wolnelektury,fnp/wolnelektury,fnp/wolnelektury,fnp/wolnelektury | src/wolnelektury/settings/basic.py | src/wolnelektury/settings/basic.py | # -*- coding: utf-8 -*-
# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from os import path
from .paths import PROJECT_DIR
DEBUG = False
MAINTENANCE_MODE = False
ADMINS = [
# ('Your Name', 'your_email@domai... | # -*- coding: utf-8 -*-
# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from os import path
from .paths import PROJECT_DIR
DEBUG = False
TEMPLATE_DEBUG = DEBUG
MAINTENANCE_MODE = False
ADMINS = [
# ('Your N... | agpl-3.0 | Python |
2a53a16a3683fc8aba4982ae010580365b813b8e | fix syntax | shortdudey123/SysInfoAPI | src/filesystem.py | src/filesystem.py | #!/usr/bin/env python
# =============================================================================
# file = filesystem.py
# description = Gets file system data
# author = GR <https://github.com/shortdudey123>
# create_date = 2014-07-29
# mod_date = 2014-07-29
# version = 0.1
# usage =
# notes =
# python_ver = 2.7.6... | #!/usr/bin/env python
# =============================================================================
# file = filesystem.py
# description = Gets file system data
# author = GR <https://github.com/shortdudey123>
# create_date = 2014-07-29
# mod_date = 2014-07-29
# version = 0.1
# usage =
# notes =
# python_ver = 2.7.6... | apache-2.0 | Python |
7715cd597dc5fad449ae2eca80f6bc4ad8bc64e9 | Add Slugged mixin to assessment template | VinnieJohns/ggrc-core,AleksNeStu/ggrc-core,kr41/ggrc-core,NejcZupec/ggrc-core,j0gurt/ggrc-core,edofic/ggrc-core,j0gurt/ggrc-core,j0gurt/ggrc-core,andrei-karalionak/ggrc-core,kr41/ggrc-core,plamut/ggrc-core,AleksNeStu/ggrc-core,NejcZupec/ggrc-core,andrei-karalionak/ggrc-core,VinnieJohns/ggrc-core,edofic/ggrc-core,AleksN... | src/ggrc/models/assessment_template.py | src/ggrc/models/assessment_template.py | # Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: peter@reciprocitylabs.com
# Maintained By: peter@reciprocitylabs.com
"""A module containing the implementation of the assessment template entity.""... | # Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: peter@reciprocitylabs.com
# Maintained By: peter@reciprocitylabs.com
"""A module containing the implementation of the assessment template entity.""... | apache-2.0 | Python |
d623bec8d83f47e86228cc686470f6be84aa324d | Update to run shell | Genora51/Bitwise | bitwise.py | bitwise.py | from lib.bitparser import Parse
from lib.lexer import lex
from lib.basefuncs import Token, tokens
import os
from lib.evaluator import runStates as evaluate
import hashlib
def h11(w):
return hashlib.md5(w.encode()).hexdigest()[:9]
def interpret(text, vals = None):
lexed = lex(text, tokens)
parsed = Parse(lexed)
... | from lib.bitparser import Parse
from lib.lexer import lex
from lib.basefuncs import Token, tokens
import os
from lib.evaluator import runStates as evaluate
import hashlib
def h11(w):
return hashlib.md5(w.encode()).hexdigest()[:9]
def interpret(text, vals = None):
lexed = lex(text, tokens)
parsed = Parse(lexed)
... | mit | Python |
12ac6964737b08c592fcdba02cfba66ab64bad28 | remove deprecated constant | yero13/agilego.py | extract/jira/backlog.py | extract/jira/backlog.py | import json
from .cfg import jira_cfg
from .request import Request, Field
class SprintBacklogRequest(Request):
def __init__(self, login, pswd):
with open(jira_cfg[__class__.__name__]) as cfg_file:
Request.__init__(self, json.load(cfg_file, strict=False), login, pswd, is_multipage=True)
de... | import json
from .cfg import jira_cfg
from .request import Request, Field
class SprintBacklogRequest(Request):
# ToDo: move to json cfg file as response key item to parse
__KEY_BACKLOG_ITEMS = 'issues'
def __init__(self, login, pswd):
with open(jira_cfg[__class__.__name__]) as cfg_file:
... | mit | Python |
8922a35a5c0976b9930e269b86361fc2235a6d08 | Bump version to 0.5.1. | XiaonuoGantan/pywebsocket,XiaonuoGantan/pywebsocket | src/setup.py | src/setup.py | #!/usr/bin/env python
#
# Copyright 2009, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... | #!/usr/bin/env python
#
# Copyright 2009, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... | bsd-3-clause | Python |
0b89abf9cc0e0bbeb50dce7df6d680360e3152c3 | disable account and password in default config | eads/tarbell,eads/tarbell,tarbell-project/tarbell,NUKnightLab/tarbell,NUKnightLab/tarbell,eyeseast/tarbell,tarbell-project/tarbell,eyeseast/tarbell,NUKnightLab/tarbell | tarbell/project_template/config.py | tarbell/project_template/config.py | """
Google doc configuration. If not provided, no Google doc will be used.
"""
{% if spreadsheet_key %}
GOOGLE_DOC = {
'key': '{{ spreadsheet_key }}',
#'account': '<gmail address>',
#'password': '<password>',
}
{% else %}
# GOOGLE_DOC = {
# 'key': '<spreadsheet key>',
# 'account': '<gmail address>',... | """
Google doc configuration. If not provided, no Google doc will be used.
"""
{% if spreadsheet_key %}
GOOGLE_DOC = {
'key': '{{ spreadsheet_key }}',
'account': '<gmail address>',
'password': '<password>',
}
{% else %}
# GOOGLE_DOC = {
# 'key': '<spreadsheet key>',
# 'account': '<gmail address>',
#... | bsd-3-clause | Python |
5396109075f0b0c56dc02968256457eed9236722 | Fix MemMatrix script's output. | HimariO/VideoSum,HimariO/VideoSum | tasks/video/Visualize/MemMatrix.py | tasks/video/Visualize/MemMatrix.py | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import matplotlib.animation as animation
import getopt
import sys
options, _ = getopt.getopt(sys.argv[1:], '', ['file='])
filename = 'Ugb_uH72d0I_8_17_memMatrix_step-81382.npy'
dpi = 150
fig_size = (2560 / dpi, 1440 / dpi)
for opt in ... | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import matplotlib.animation as animation
import getopt
import sys
options, _ = getopt.getopt(sys.argv[1:], '', ['file='])
filename = 'Ugb_uH72d0I_8_17_memMatrix_step-81382.npy'
dpi = 150
fig_size = (2560 / dpi, 1440 / dpi)
for opt in ... | mit | Python |
745b98aa465bc05500ffd893c15844cb454011f9 | Improve tests | okuta/chainer,ktnyt/chainer,anaruse/chainer,kikusu/chainer,keisuke-umezawa/chainer,keisuke-umezawa/chainer,aonotas/chainer,niboshi/chainer,benob/chainer,kikusu/chainer,tkerola/chainer,cupy/cupy,wkentaro/chainer,ronekko/chainer,okuta/chainer,benob/chainer,okuta/chainer,ktnyt/chainer,AlpacaDB/chainer,AlpacaDB/chainer,cha... | tests/cupy_tests/manipulation_tests/test_kind.py | tests/cupy_tests/manipulation_tests/test_kind.py | import unittest
from cupy import testing
@testing.gpu
class TestKind(unittest.TestCase):
_multiprocess_can_split_ = True
@testing.for_all_dtypes()
@testing.numpy_cupy_array_equal(type_check=False)
def test_asfortranarray1(self, xp, dtype):
x = xp.zeros((2, 3), dtype)
ret = xp.asfort... | import unittest
from cupy import testing
@testing.gpu
class TestKind(unittest.TestCase):
_multiprocess_can_split_ = True
@testing.for_all_dtypes()
@testing.numpy_cupy_array_equal(type_check=False)
def test_asfortranarray1(self, xp, dtype):
x = xp.zeros((2, 3))
return xp.asfortranarr... | mit | Python |
958bb725cce490ecf5d9f2052e739d2b1fe84b3d | Make centroid factory locations a little more plausible | vessemer/concept-to-clinic,vessemer/concept-to-clinic,vessemer/concept-to-clinic,vessemer/concept-to-clinic | interface/backend/images/factories.py | interface/backend/images/factories.py | import factory
import factory.fuzzy
from backend.images import models
class ImageSeriesFactory(factory.django.DjangoModelFactory):
class Meta:
model = models.ImageSeries
patient_id = factory.Sequence(lambda n: "TEST-SERIES-%04d" % n)
series_instance_uid = factory.Sequence(lambda n: "1.3.6.1.4.1.... | import factory
import factory.fuzzy
from backend.images import models
class ImageSeriesFactory(factory.django.DjangoModelFactory):
class Meta:
model = models.ImageSeries
patient_id = factory.Sequence(lambda n: "TEST-SERIES-%04d" % n)
series_instance_uid = factory.Sequence(lambda n: "1.3.6.1.4.1.... | mit | Python |
9195943db5efcf9c847422d521ef1b0ae4124526 | Update __init__.py | hammerlab/fancyimpute,iskandr/fancyimpute | fancyimpute/__init__.py | fancyimpute/__init__.py | from __future__ import absolute_import, print_function, division
from .solver import Solver
from .nuclear_norm_minimization import NuclearNormMinimization
from .matrix_factorization import MatrixFactorization
from .iterative_svd import IterativeSVD
from .simple_fill import SimpleFill
from .soft_impute import SoftImput... | from __future__ import absolute_import, print_function, division
from .solver import Solver
from .nuclear_norm_minimization import NuclearNormMinimization
from .matrix_factorization import MatrixFactorization
from .iterative_svd import IterativeSVD
from .simple_fill import SimpleFill
from .soft_impute import SoftImput... | apache-2.0 | Python |
b12e96f6365746b21b929bbd827c2070f183b01e | Fix lint issues | watchdogpolska/feder,watchdogpolska/feder,watchdogpolska/feder,watchdogpolska/feder | feder/domains/models.py | feder/domains/models.py | from feder.organisations.models import Organisation
from django.db import models
from model_utils.models import TimeStampedModel
from django.utils.translation import ugettext_lazy as _
class DomainQuerySet(models.QuerySet):
def for_user(self, user):
return self
class Domain(TimeStampedModel):
name ... | from feder.organisations.models import Organisation
from django.db import models
from model_utils.models import TimeStampedModel
from django.utils.translation import ugettext_lazy as _
class DomainQuerySet(models.QuerySet):
def for_user(self, user):
return self
class Domain(TimeStampedModel):
name = ... | mit | Python |
0e8ebdff245239de28f3d43897038a7bb37c0b1d | Change row offset | ebegoli/SynthNotes | loadNotes.py | loadNotes.py | from synthnotes.generators import NoteGenerator
import psycopg2 as psy
def main():
generator = NoteGenerator()
params = {'database': 'synthea', 'user': 'postgres', 'host': '172.22.10.147'}
conn = psy.connect(**params)
cur = conn.cursor()
cur.execute("""select id, person_id, start, stop from en... | from synthnotes.generators import NoteGenerator
import psycopg2 as psy
def main():
generator = NoteGenerator()
params = {'database': 'synthea', 'user': 'postgres', 'host': '172.22.10.147'}
conn = psy.connect(**params)
cur = conn.cursor()
cur.execute("""select id, person_id, start, stop from en... | mit | Python |
cd44f9b09f6a961b621091155f418a11adb55dd3 | Document components/ansible | xii/xii,xii/xii | src/xii/builtin/components/ansible/component.py | src/xii/builtin/components/ansible/component.py |
from xii.component import Component
from xii.need import NeedIO, NeedSSH
from xii import error
from ansible import NeedAnsible
class AnsibleComponent(Component, NeedAnsible, NeedIO, NeedSSH):
"""
Easily provision created images using standard ansible.
.. note::
Make sure the ansible commandline... |
from xii.component import Component
from xii.need import NeedIO, NeedSSH
from xii import error
from ansible import NeedAnsible
class AnsibleComponent(Component, NeedAnsible, NeedIO, NeedSSH):
ctype = "ansible"
required_attributes = ["hosts", "run"]
default_attributes = ["hosts", "env"]
requires = [... | apache-2.0 | Python |
65531eda0f1584cb3c8552cef8593cbf69536139 | Enable strict warnings in test runs. | hzruandd/tornado,hzruandd/tornado,insflow/tornado,0xkag/tornado,bdarnell/tornado,anandology/tornado,johan--/tornado,erichuang1994/tornado,jonashagstedt/tornado,BencoLee/tornado,ifduyue/tornado,ListFranz/tornado,mivade/tornado,kevinge314gh/tornado,0x73/tornado,dsseter/tornado,wechasing/tornado,frtmelody/tornado,bufferx/... | tornado/test/runtests.py | tornado/test/runtests.py | #!/usr/bin/env python
import unittest
TEST_MODULES = [
'tornado.httputil.doctests',
'tornado.iostream.doctests',
'tornado.util.doctests',
'tornado.test.auth_test',
'tornado.test.curl_httpclient_test',
'tornado.test.escape_test',
'tornado.test.gen_test',
'tornado.test.httpclient_test',
... | #!/usr/bin/env python
import unittest
TEST_MODULES = [
'tornado.httputil.doctests',
'tornado.iostream.doctests',
'tornado.util.doctests',
'tornado.test.auth_test',
'tornado.test.curl_httpclient_test',
'tornado.test.escape_test',
'tornado.test.gen_test',
'tornado.test.httpclient_test',
... | apache-2.0 | Python |
898ca320fe2c5d70e050d55866d8fcf6b2a8d532 | Add register_opts function to sslutils | openstack/oslo.service | oslo_service/sslutils.py | oslo_service/sslutils.py | # Copyright 2013 IBM Corp.
#
# 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 t... | # Copyright 2013 IBM Corp.
#
# 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 t... | apache-2.0 | Python |
ad89d2c87e8f835b2ae2cc204393143b783f3480 | Add time decorator | LIAMF-USP/word2vec-TF,LIAMF-USP/word2vec-TF,LIAMF-USP/word2vec-TF | src/utils.py | src/utils.py | import pickle
import time
import unittest
timing = {}
def get_time(f, args=[]):
"""
After using timeit we can get the duration of the function f
when it was applied in parameters args. Normally it is expected
that args is a list of parameters, but it can be also a single parameter.
:type f: func... | import pickle
import time
import unittest
def get_date_and_time():
"""
Function to create an unique label
using the date and time.
:rtype: str
"""
return time.strftime('%d-%m-%Y_%H-%M-%S')
def run_test(testClass, header):
"""
Function to run all the tests from a class of tests.
... | mit | Python |
a58408c28bffb29fea72d2ec045ffcf23ef3f29a | bump version number to 0.0.1 | ckcnik/django-forums,byteweaver/django-forums,ckcnik/django-forums,byteweaver/django-forums | forums/__init__.py | forums/__init__.py | __version__ = '0.0.1'
| __version__ = '0.0.0'
| bsd-3-clause | Python |
82bb0ba1f85f2277589eb8309903f38e22e342b7 | Fix bug where arrays are sent as strings. | AustinStoneProjects/Founderati-Server,AustinStoneProjects/Founderati-Server | project/utils.py | project/utils.py | from flask import jsonify
def mergeFrom(fromData, toData, keysToMerge, require=True):
for key in keysToMerge:
if key in fromData:
toData[key] = fromData[key]
elif require == True:
raise Exception('Missing required parameter %s' % key)
# gracefully handles errors with incomp... | from flask import jsonify
def mergeFrom(fromData, toData, keysToMerge, require=True):
for key in keysToMerge:
if key in fromData:
toData[key] = fromData[key]
elif require == True:
raise Exception('Missing required parameter %s' % key)
# gracefully handles errors with incomp... | apache-2.0 | Python |
3fe0f73d9c9ca177cefd61636f10be77aa1261d0 | Remove bank information from form. | fgaudin/aemanager,fgaudin/aemanager,fgaudin/aemanager | autoentrepreneur/forms.py | autoentrepreneur/forms.py | from django.forms import ModelForm
from django import forms
from django.utils.translation import ugettext_lazy as _
from autoentrepreneur.models import UserProfile, AUTOENTREPRENEUR_ACTIVITY, \
AUTOENTREPRENEUR_PAYMENT_OPTION
class UserProfileForm(ModelForm):
company_name = forms.CharField(required=False, max_... | from django.forms import ModelForm
from django import forms
from django.utils.translation import ugettext_lazy as _
from autoentrepreneur.models import UserProfile, AUTOENTREPRENEUR_ACTIVITY, \
AUTOENTREPRENEUR_PAYMENT_OPTION
class UserProfileForm(ModelForm):
company_name = forms.CharField(required=False, max_... | agpl-3.0 | Python |
0caf7c1ac8ea2a0fc9c2d7c46121fc48d830d855 | update pymhex for new pycaffe interface | ronghanghu/mhex_graph,ronghanghu/mhex_graph | pymhex/load_mhex_into_caffe.py | pymhex/load_mhex_into_caffe.py | #! /usr/bin/python
def load_mhex(caffe_prototxt, caffe_model, mhex_mat_file, save_file, load_mat1=True, load_mat2=True):
"""
load matrices dumped from matlab into Caffe network
MHEX implemenatation in Caffe consists of two InnerProductLayer at bottom and
top, and one SoftmaxLayer between them.
The inner produ... | #! /usr/bin/python
def load_mhex(caffe_prototxt, caffe_model, mhex_mat_file, save_file, load_mat1=True, load_mat2=True):
"""
load matrices dumped from matlab into Caffe network
MHEX implemenatation in Caffe consists of two InnerProductLayer at bottom and
top, and one SoftmaxLayer between them.
The inner produ... | bsd-2-clause | Python |
170ffc100f36f3676a32f4ea5a464dcb131b7f2f | Add docstrings for TestUtils class. | jaidevd/pysemantic,jaidevd/pysemantic,dataculture/pysemantic,dataculture/pysemantic | pysemantic/tests/test_utils.py | pysemantic/tests/test_utils.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2015 jaidev <jaidev@newton>
#
# Distributed under terms of the BSD 3-clause license.
"""
Tests for a the pysemantic.utils module.
"""
import unittest
import os.path as op
from pysemantic.utils import colnames, get_md5_checksum
class Tes... | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2015 jaidev <jaidev@newton>
#
# Distributed under terms of the BSD 3-clause license.
"""
Tests for a the pysemantic.utils module.
"""
import unittest
import os.path as op
from pysemantic.utils import colnames, get_md5_checksum
class Tes... | bsd-3-clause | Python |
535497f5374d68a148443ba54ee74f66c44a6947 | fix pep8 errors | kderynski/acos-client,dougwig/acos-client,mdurrant-b3/acos-client,dkiser/acos-client,a10networks/acos-client,sasukeh/acos-client | acos_client/v21/admin.py | acos_client/v21/admin.py | import base
class Admin(base.BaseV21):
@property
def administrator(self):
return self.Administrator(self.client)
class Administrator(base.BaseV21):
def all(self, **kwargs):
return self._get('system.admin.administrator.getAll', **kwargs)
def get(self, name, **kwargs)... | import base
class Admin(base.BaseV21):
@property
def administrator(self):
return self.Administrator(self.client)
class Administrator(base.BaseV21):
def all(self, **kwargs):
return self._get('system.admin.administrator.getAll', **kwargs)
def get(self, name, **kwargs):... | apache-2.0 | Python |
6d0a281c3056c03aa482aac5ec1dbc7c4a85fa23 | Update version number. | tensorflow/gan,tensorflow/gan | tensorflow_gan/python/version.py | tensorflow_gan/python/version.py | # coding=utf-8
# Copyright 2019 The TensorFlow GAN 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 applicabl... | # coding=utf-8
# Copyright 2019 The TensorFlow GAN 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 applicabl... | apache-2.0 | Python |
41d366140d07e6b7723bacb6e61469c111b6ca61 | Update inception model path Change: 171910161 | penguin138/serving,sreddybr3/serving,penguin138/serving,tensorflow/serving,tensorflow/serving,penguin138/serving,tensorflow/serving,sreddybr3/serving,sreddybr3/serving,penguin138/serving,sreddybr3/serving,tensorflow/serving | tensorflow_serving/workspace.bzl | tensorflow_serving/workspace.bzl | # TensorFlow Serving external dependencies that can be loaded in WORKSPACE
# files.
load('@org_tensorflow//tensorflow:workspace.bzl', 'tf_workspace')
# All TensorFlow Serving external dependencies.
# workspace_dir is the absolute path to the TensorFlow Serving repo. If linked
# as a submodule, it'll likely be '__work... | # TensorFlow Serving external dependencies that can be loaded in WORKSPACE
# files.
load('@org_tensorflow//tensorflow:workspace.bzl', 'tf_workspace')
# All TensorFlow Serving external dependencies.
# workspace_dir is the absolute path to the TensorFlow Serving repo. If linked
# as a submodule, it'll likely be '__work... | apache-2.0 | Python |
9120501aa20d2cb545e7ea3373a71d155a25d90a | 置換関数は配列を受け取り、splitは呼び出し側にさせる | Roadagain/EasiAAR | easiaar.py | easiaar.py | import sys
def translate_words(words, dictionary, after_sep = ' '):
translated = []
for word in words:
if word in dictionary:
translated.append(dictionary[word])
else:
translated.append(word)
return after_sep.join(translated)
dictionary = {}
for line in open(sys.ar... | import sys
def translate_words(sentence, dictionary, after_sep = ' '):
translated = []
for word in sentence.split():
if word in dictionary:
translated.append(dictionary[word])
else:
translated.append(word)
return after_sep.join(translated)
dictionary = {}
for line ... | mit | Python |
b72722c0873d7b0aaeee995ee62576af16c1cf40 | Update to reflect changes to ddesc | ChinaQuants/blaze,caseyclements/blaze,maxalbert/blaze,jcrist/blaze,aterrel/blaze,cowlicks/blaze,dwillmer/blaze,alexmojaki/blaze,cowlicks/blaze,maxalbert/blaze,LiaoPan/blaze,jdmcbr/blaze,aterrel/blaze,scls19fr/blaze,jcrist/blaze,jdmcbr/blaze,ChinaQuants/blaze,xlhtc007/blaze,ContinuumIO/blaze,alexmojaki/blaze,mrocklin/bl... | blaze/tests/test_datetime.py | blaze/tests/test_datetime.py | from __future__ import absolute_import, division, print_function
import unittest
from datetime import date, datetime
import blaze
from datashape import dshape
from blaze.datadescriptor import ddesc_as_py
class TestDate(unittest.TestCase):
def test_create(self):
a = blaze.array(date(2000, 1, 1))
... | from __future__ import absolute_import, division, print_function
import unittest
from datetime import date, datetime
import blaze
from datashape import dshape
from blaze.datadescriptor import dd_as_py
class TestDate(unittest.TestCase):
def test_create(self):
a = blaze.array(date(2000, 1, 1))
sel... | bsd-3-clause | Python |
eb33e6393cb85217aeea5c6c3cc0c24ddc8ad7f3 | Remove unnecessary lines | IshitaTakeshi/PCANet | example.py | example.py | from os.path import exists
import pickle
import gzip
from urllib.request import urlretrieve
from sklearn.datasets import load_digits
from sklearn.svm import LinearSVC
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
from... | from os.path import exists
import pickle
import gzip
from urllib.request import urlretrieve
from sklearn.datasets import load_digits
from sklearn.svm import LinearSVC
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
from... | mit | Python |
612f458a0873d669092df8bb259a3c5787470747 | Fix the example. | pfaion/MPLAnimator | example.py | example.py | import numpy as np
import matplotlib
matplotlib.use("Qt5Agg")
import matplotlib.pyplot as plt
from MPLAnimator import Animator
def naive_estimator(x, data, h):
n = sum(1 for d in data if x-h/2 < d <= x+h/2)
N = len(data)
return n/(N*h)
data = [0.5, 0.7, 0.8, 1.9, 2.4, 6.1, 6.2, 7.3]
xs = np.arange(0, 8, 0... | import numpy as np
import matplotlib
matplotlib.use("Qt5Agg")
import matplotlib.pyplot as plt
from MPLAnimator import Animator
def naive_estimator(x, data, h):
n = sum(1 for d in data if x-h/2 < d <= x+h/2)
N = len(data)
return n/(N*h)
data = [0.5, 0.7, 0.8, 1.9, 2.4, 6.1, 6.2, 7.3]
xs = np.arange(0, 8, 0... | mit | Python |
56e647a6e3bac7185b645f75ece4059b56a4ec15 | optimize code for import | ResolveWang/WeiboSpider,ResolveWang/WeiboSpider | config/conf.py | config/conf.py | import os
import random
from yaml import load
config_path = os.path.join(os.path.dirname(__file__), 'spider.yaml')
with open(config_path, encoding='utf-8') as f:
cont = f.read()
cf = load(cont)
def get_db_args():
return cf.get('db')
def get_redis_args():
return cf.get('redis')
def get_timeout():... | import os
import random
from yaml import load
config_path = os.path.join(os.path.dirname(__file__), 'spider.yaml')
with open(config_path, encoding='utf-8') as f:
cont = f.read()
cf = load(cont)
def get_db_args():
return cf.get('db')
def get_redis_args():
return cf.get('redis')
def get_timeout():
... | mit | Python |
5c7036d164e53ced72c85656ef56f89c6a4b4de5 | Fix fabfile paths | Code4SA/mma-dexter,Code4SA/mma-dexter,Code4SA/mma-dexter | fabfile.py | fabfile.py | import os
import pwd
from fabric.api import cd, env, task, require, run, sudo, prefix, shell_env
from fabric.contrib.files import exists, upload_template
VIRTUALENV_DIR = 'env'
CODE_DIR = 'mma-dexter'
PROD_HOSTS = ['wazimap.co.za']
@task
def prod():
env.deploy_type = 'prod'
env.deploy_dir = '/home/mma/'
... | import os
import pwd
from fabric.api import cd, env, task, require, run, sudo, prefix, shell_env
from fabric.contrib.files import exists, upload_template
VIRTUALENV_DIR = 'env'
CODE_DIR = 'mma-dexter'
PROD_HOSTS = ['wazimap.co.za']
@task
def prod():
env.deploy_type = 'prod'
env.deploy_dir = '/home/mma/mma-de... | apache-2.0 | Python |
2df5b967bf395932390960e248dffddc48834337 | use rw:* supervisor group in fabfile | Lancey6/redwind,Lancey6/redwind,Lancey6/redwind | fabfile.py | fabfile.py | from fabric.api import local, prefix, cd, run, env, lcd
import datetime
env.hosts = ['orin.kylewm.com']
REMOTE_PATH = '/srv/www/kylewm.com/redwind'
def backup():
backup_dir = '~/Backups/kylewm.com/{}/'.format(
datetime.date.isoformat(datetime.date.today()))
local('mkdir -p ' + backup_dir)
local(... | from fabric.api import local, prefix, cd, run, env, lcd
import datetime
env.hosts = ['orin.kylewm.com']
REMOTE_PATH = '/srv/www/kylewm.com/redwind'
def backup():
backup_dir = '~/Backups/kylewm.com/{}/'.format(
datetime.date.isoformat(datetime.date.today()))
local('mkdir -p ' + backup_dir)
local('... | bsd-2-clause | Python |
862c50b2617d1ac5aeda844d64e7d987181dfd98 | Update parser.py | pkug/intelmq,aaronkaplan/intelmq,robcza/intelmq,sch3m4/intelmq,aaronkaplan/intelmq,robcza/intelmq,robcza/intelmq,aaronkaplan/intelmq,pkug/intelmq,sch3m4/intelmq,pkug/intelmq,robcza/intelmq,sch3m4/intelmq,certtools/intelmq,certtools/intelmq,certtools/intelmq,sch3m4/intelmq,pkug/intelmq | intelmq/bots/inputs/phishtank/parser.py | intelmq/bots/inputs/phishtank/parser.py | import StringIO, csv
from intelmq.lib.bot import Bot, sys
from intelmq.lib.event import Event
class PhishTankParserBot(Bot):
def process(self):
report = self.receive_message()
report = report.strip()
if report:
columns = ["__IGNORE__", "url", "description_url", "source_time", ... | import StringIO, csv
from intelmq.lib.bot import Bot, sys
from intelmq.lib.event import Event
class PhishTankParserBot(Bot):
def process(self):
report = self.receive_message()
report = report.strip()
if report:
columns = ["__IGNORE__", "url", "description_url", "source_time", ... | agpl-3.0 | Python |
29c422ea482b022bae07fcd389313152ef3d1c3c | Document Exception attributes, #15 | numberoverzero/bloop,numberoverzero/bloop | bloop/exceptions.py | bloop/exceptions.py | CONSTRAINT_FAILURE = "Failed to meet expected condition during {}"
NOT_MODIFIED = "Failed to modify some obects during {}"
TABLE_MISMATCH = "Existing table for model {} does not match expected"
UNBOUND = "Failed to {} unbound model. Did you forget to call engine.bind()?"
class ConstraintViolation(Exception):
"""... | CONSTRAINT_FAILURE = "Failed to meet expected condition during {}"
NOT_MODIFIED = "Failed to modify some obects during {}"
TABLE_MISMATCH = "Existing table for model {} does not match expected"
UNBOUND = "Failed to {} unbound model. Did you forget to call engine.bind()?"
class ConstraintViolation(Exception):
"""... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.