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
6963c7c9651d6770c742c50f5fd0fbee68b4f66f
Fix test naming spelling errors
authentik8/rover
tests/test_rover_init.py
tests/test_rover_init.py
def test_rover_init_with_default_parameters(): from rover import Rover rover = Rover() assert rover.x == 0 assert rover.y == 0 assert rover.direction == 'N' def test_rover_init_with_custom_parameters(): from rover import Rover rover = Rover(3, 7, 'W') assert rover.x == 3 assert rove...
def test_rover_init_with_default_parameters(): from rover import Rover rover = Rover() assert rover.x == 0 assert rover.y == 0 assert rover.direction == 'N' def test_rover_init_with_custom_paramaters(): from rover import Rover rover = Rover(3, 7, 'W') assert rover.x == 3 assert rove...
mit
Python
a13837118e8ba927598122ba7d59655c3a7632f7
fix import Result
williamchai/cadmv,williamchai/cadmv
server.py
server.py
import tornado.ioloop,tornado.web,os from cadmv import Result import cadmv class MainHandler(tornado.web.RequestHandler): def get(self): cache = cadmv.cacheInit(cadmv.cacheFile) results = [] for oId in cadmv.allIdByName: result = cache.get(oId,None) if not result: co...
import tornado.ioloop,tornado.web,os from cadmv import Result,cacheFile,allIdByName,cacheInit class MainHandler(tornado.web.RequestHandler): def get(self): cache = cacheInit(cacheFile) results = [] for oId in allIdByName: result = cache.get(oId,None) if not result: c...
mit
Python
6f6b0f2c8470e472cc4f4084980627a92482d8c5
Update lighthouse hours 7pm-9pm
tipsqueal/duwamish-lighthouse,illumenati/duwamish-lighthouse,illumenati/duwamish-lighthouse,tipsqueal/duwamish-lighthouse
server.py
server.py
import bottle import waitress import controller import breathe from pytz import timezone from apscheduler.schedulers.background import BackgroundScheduler bottle_app = bottle.app() scheduler = BackgroundScheduler() scheduler.configure(timezone=timezone('US/Pacific')) breather = breathe.Breathe() my_controller = contro...
import bottle import waitress import controller import breathe from pytz import timezone from apscheduler.schedulers.background import BackgroundScheduler bottle_app = bottle.app() scheduler = BackgroundScheduler() scheduler.configure(timezone=timezone('US/Pacific')) breather = breathe.Breathe() my_controller = contro...
mit
Python
3ed2cbb1ab1287ea9f89ad3b218fd1947d8b3c70
Fix a small bug in server.py.
metamarcdw/nowallet
server.py
server.py
from aiohttp import web import json, asyncio, sys from nowallet.scrape import scrape_electrum_servers from nowallet import BTC, TBTC, LTC CHAINS = [chain.chain_1209k for chain in (BTC, TBTC, LTC)] class Server: def __init__(self, chain): self.chain = chain self.app = web.Application() self...
from aiohttp import web import json, asyncio, sys from nowallet.scrape import scrape_electrum_servers from nowallet import BTC, TBTC, LTC CHAINS = [chain.chain_1209k for chain in (BTC, TBTC, LTC)] class Server: def __init__(self, chain): self.app = web.Application() self.app.router.add_get('/serve...
mit
Python
fa6bc493683136f078473498860e864c35786507
Improve the string module tests.
kalekundert/nonstdlib,KenKundert/nonstdlib,KenKundert/nonstdlib,kalekundert/nonstdlib
string.py
string.py
#!/usr/bin/env python import re def wrap(*lines, **options): indent = options.get("indent", 0) * ' ' columns = options.get("columns", 79) input = ''.join(lines) words = re.split('( )+', input) line = indent lines = [] for word in words: if len(line) + len(word) + 1 < columns: ...
#!/usr/bin/env python import re def wrap(*lines, **options): indent = options.get("indent", 0) * ' ' columns = options.get("columns", 79) input = ''.join(lines) words = re.split('( )+', input) line = indent lines = [] for word in words: if len(line) + len(word) + 1 < columns: ...
mit
Python
2f784f1849e67443f323f7ee83ec91f59fc3747a
switch to installing from git again
codebynumbers/smr,50onRed/smr
smr/default_config.py
smr/default_config.py
from __future__ import (absolute_import, division, print_function, unicode_literals) # commands to run for each EC2 instance to initialize smr from .version import __version__ AWS_EC2_INITIALIZE_SMR_COMMANDS = [ "while pgrep cloud-init > /dev/null; do sleep 1; done", "DEBIAN_FRONTEND=no...
from __future__ import (absolute_import, division, print_function, unicode_literals) # commands to run for each EC2 instance to initialize smr from .version import __version__ AWS_EC2_INITIALIZE_SMR_COMMANDS = [ "while pgrep cloud-init > /dev/null; do sleep 1; done", "DEBIAN_FRONTEND=no...
mit
Python
4c12a357e73d443a3c248b6a6fd0e784b0be15ff
Update evaluate-division.py
tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,jaredkoontz/leetcode,kamyu104/LeetCode,githubutilities/LeetCode,kamyu104/LeetCode,yiwen-luo/LeetCode,jaredkoontz/leetcode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,g...
Python/evaluate-division.py
Python/evaluate-division.py
# Time: O(e + q * |V|!), |V| is the number of variables # Space: O(e) # Equations are given in the format A / B = k, # where A and B are variables represented as strings, # and k is a real number (floating point number). # Given some queries, return the answers. # If the answer does not exist, return -1.0. # # Exampl...
# Time: O(e + q * e) # Space: O(e) # Equations are given in the format A / B = k, # where A and B are variables represented as strings, # and k is a real number (floating point number). # Given some queries, return the answers. # If the answer does not exist, return -1.0. # # Example: # Given a / b = 2.0, b / c = 3.0...
mit
Python
f07e4535c191abf7c53103809564dd8f01fa5af7
Update first-bad-version.py
yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,jaredkoontz/leetcode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,githubutilities/LeetCode,jaredkoontz/leetcode,tudennis/LeetCode---kamyu104-11-24-2015,githubutilities/Leet...
Python/first-bad-version.py
Python/first-bad-version.py
# Time: O(logn) # Space: O(1) # # You are a product manager and currently leading a team to # develop a new product. Unfortunately, the latest version of # your product fails the quality check. Since each version is # developed based on the previous version, all the versions # after a bad version are also bad. # # Su...
# Time: O(logn) # Space: O(1) # # You are a product manager and currently leading a team to # develop a new product. Unfortunately, the latest version of # your product fails the quality check. Since each version is # developed based on the previous version, all the versions # after a bad version are also bad. # # Su...
mit
Python
bbc8741c7bd1b9cab03fbe4f9db3570bf1cbde6d
Update read_temperature.py
dombold/MyHydroPi,dombold/MyHydroPi,dombold/MyHydroPi
Sensors/read_temperature.py
Sensors/read_temperature.py
#!/usr/bin/env python ############################################################################## # Written by Dominic Bolding for myhydropi.com - 2016 # # Feel free to use and modify this code for you own use in any way. # # This program is designed to read the temperature in Celcius or Fahrenheit # from a DS18B20...
#!/usr/bin/env python ############################################################################## # Written by Dominic Bolding for myhydropi.com - 2016 # # Feel free to use and modify this code for you own use in any way. # # This program is designed to read the temperature in Celcius or Fahrenheit # from a DS18B20...
mit
Python
09108fbe60167401ba16662c6dc476916ceb7f61
reorder imports for pep8
PrestigeDox/Watashi-SelfBot
cogs/animate.py
cogs/animate.py
import asyncio from discord.ext import commands class Animate: def __init__(self, bot): self.bot = bot @commands.group(invoke_without_command=True, aliases=['anim']) async def animate(self, ctx, *, file): """Animated Text Files onto Discord""" try: with open(f'animatio...
from discord.ext import commands import asyncio class Animate: def __init__(self, bot): self.bot = bot @commands.group(invoke_without_command=True, aliases=['anim']) async def animate(self, ctx, *, file): """Animated Text Files onto Discord""" try: with open(f'animatio...
mit
Python
797ff0a95893e72ead1ea6873086a1efd1ea3e48
fix forgotten mark
Fresnoy/kart,Fresnoy/kart
assets/tests/test_models.py
assets/tests/test_models.py
import pytest @pytest.mark.django_db class TestGalery: def test_str(self, gallery): gallery_str = str(gallery) assert gallery.label in gallery_str assert gallery.description in gallery_str @pytest.mark.django_db class TestMedium: def test_str(self, medium): medium_str = str(m...
import pytest @pytest.mark.django_db class TestGalery: def test_str(self, gallery): gallery_str = str(gallery) assert gallery.label in gallery_str assert gallery.description in gallery_str class TestMedium: def test_str(self, medium): medium_str = str(medium) assert m...
agpl-3.0
Python
8abe361cca56a58d82048f602697699ca1b951bd
remove debugging print
BryceLohr/authentic,incuna/authentic,pu239ppy/authentic2,BryceLohr/authentic,incuna/authentic,adieu/authentic2,BryceLohr/authentic,incuna/authentic,adieu/authentic2,BryceLohr/authentic,adieu/authentic2,pu239ppy/authentic2,pu239ppy/authentic2,adieu/authentic2,incuna/authentic,incuna/authentic,pu239ppy/authentic2
authentic2/sslauth/views.py
authentic2/sslauth/views.py
import functools import registration.views from django.contrib.auth import REDIRECT_FIELD_NAME from django.conf import settings import forms def register(request): '''Registration page for SSL auth without CA''' next = request.GET.get(REDIRECT_FIELD_NAME, settings.LOGIN_REDIRECT_URL) return registration....
import functools import registration.views from django.contrib.auth import REDIRECT_FIELD_NAME from django.conf import settings import forms def register(request): '''Registration page for SSL auth without CA''' next = request.GET.get(REDIRECT_FIELD_NAME, settings.LOGIN_REDIRECT_URL) print 'toto', reques...
agpl-3.0
Python
e9411f80d822820003ff1bab9575a5f21ab09ddb
Fix analysis test
choderalab/perses,choderalab/perses
perses/tests/test_analysis.py
perses/tests/test_analysis.py
""" Test storage layer. TODO: * Write tests """ __author__ = 'John D. Chodera' ################################################################################ # IMPORTS ################################################################################ from simtk import openmm, unit from simtk.openmm import app impo...
""" Test storage layer. TODO: * Write tests """ __author__ = 'John D. Chodera' ################################################################################ # IMPORTS ################################################################################ from simtk import openmm, unit from simtk.openmm import app impo...
mit
Python
dda1c469054322cf5519197359fcf265bf98b213
use center_id (not re)
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
custom/cowin/repeater_generators.py
custom/cowin/repeater_generators.py
import json from django.core.serializers.json import DjangoJSONEncoder from corehq.motech.repeaters.repeater_generators import ( CaseRepeaterJsonPayloadGenerator, ) class BeneficiaryRegistrationPayloadGenerator(CaseRepeaterJsonPayloadGenerator): def get_payload(self, repeat_record, cowin_api_data_registrati...
import json from django.core.serializers.json import DjangoJSONEncoder from corehq.motech.repeaters.repeater_generators import ( CaseRepeaterJsonPayloadGenerator, ) class BeneficiaryRegistrationPayloadGenerator(CaseRepeaterJsonPayloadGenerator): def get_payload(self, repeat_record, cowin_api_data_registrati...
bsd-3-clause
Python
d92ec3a001d508dda595ef675caf3225a70e7206
Integrate LLVM at llvm/llvm-project@e2f627e5e385
tensorflow/runtime,tensorflow/runtime,tensorflow/runtime,tensorflow/runtime
third_party/llvm/workspace.bzl
third_party/llvm/workspace.bzl
"""Provides the repository macro to import LLVM.""" load("//third_party:repo.bzl", "tfrt_http_archive") def repo(name): """Imports LLVM.""" LLVM_COMMIT = "e2f627e5e3855309f3a7421f6786b401efb6b7c7" LLVM_SHA256 = "228c37eecf8a8027ab32ac466b988712136191a0076d80750c646a3a9b1dc5d2" tfrt_http_archive( ...
"""Provides the repository macro to import LLVM.""" load("//third_party:repo.bzl", "tfrt_http_archive") def repo(name): """Imports LLVM.""" LLVM_COMMIT = "b96fc4860f1615d8d1f686f1e400cc1f8e0d58ac" LLVM_SHA256 = "a520b986d9f40fb2b8714dab378b68225927b333f544974079b5cc5e9c535f42" tfrt_http_archive( ...
apache-2.0
Python
04c0f9704b282465295d20dd57ddb4fd625ebaea
Integrate LLVM at llvm/llvm-project@1db2551cc1a3
tensorflow/runtime,tensorflow/runtime,tensorflow/runtime,tensorflow/runtime
third_party/llvm/workspace.bzl
third_party/llvm/workspace.bzl
"""Provides the repository macro to import LLVM.""" load("//third_party:repo.bzl", "tfrt_http_archive") def repo(name): """Imports LLVM.""" LLVM_COMMIT = "1db2551cc1a356a67c0967f424d6158e2ea127e3" LLVM_SHA256 = "f1c5128fad0c6f973d105f4a91ca4d7d8f3be3423c4d83c5602c201156c050fe" tfrt_http_archive( ...
"""Provides the repository macro to import LLVM.""" load("//third_party:repo.bzl", "tfrt_http_archive") def repo(name): """Imports LLVM.""" LLVM_COMMIT = "88326bbce38c53f4782ba3b593b6720438a9569c" LLVM_SHA256 = "2ff862caf9626a35afcc037991ccaa300644f6e7cc7463b7ad435f78775feaa8" tfrt_http_archive( ...
apache-2.0
Python
a8035134de28b4a900dc280af24f12867366dee2
Integrate LLVM at llvm/llvm-project@9968896cd62a
tensorflow/tensorflow-pywrap_tf_optimizer,karllessard/tensorflow,sarvex/tensorflow,tensorflow/tensorflow-pywrap_saved_model,karllessard/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,sarvex/tensorflow,tensorflow/tensorflow-pywrap_saved_model,sarvex/tensorflow,karllessard/...
third_party/llvm/workspace.bzl
third_party/llvm/workspace.bzl
"""Provides the repository macro to import LLVM.""" load("//third_party:repo.bzl", "tf_http_archive") def repo(name): """Imports LLVM.""" LLVM_COMMIT = "9968896cd62a62b11ac61085534dd598c4bd3c60" LLVM_SHA256 = "003be922b3caa2c53d9ab0acaa0e2e26022f8f0cda1d0b1775e254928cce9556" tf_http_archive( ...
"""Provides the repository macro to import LLVM.""" load("//third_party:repo.bzl", "tf_http_archive") def repo(name): """Imports LLVM.""" LLVM_COMMIT = "8086f9d87ee81aacf829bdad94744a75cf692ebc" LLVM_SHA256 = "7298d56127fba1267a48dbce2b6e99318c2e962b1636e4239ff5d58520ea110b" tf_http_archive( ...
apache-2.0
Python
65e76bea1ccb9a77bbb1d90a14de81558c2d32c4
Integrate LLVM at llvm/llvm-project@08192340335e
gautam1858/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,karllessard/tensorflow,tensorflow/tensorflow-pywrap_saved_model,tensorflow/tensorflow-pywrap_saved_model,tensorflow/tensorflow-pywrap_saved_model,Intel-Corporation/tensorflow,tensorflow/tensorflow,yongtang/tensorflow,tensorflow/tensorfl...
third_party/llvm/workspace.bzl
third_party/llvm/workspace.bzl
"""Provides the repository macro to import LLVM.""" load("//third_party:repo.bzl", "tf_http_archive") def repo(name): """Imports LLVM.""" LLVM_COMMIT = "08192340335e640dd7cb8f136bda783e441a789d" LLVM_SHA256 = "aa441a8a2cb8810c161e0f6b236e097b056d9b413772f1da77233f636db4a204" tf_http_archive( ...
"""Provides the repository macro to import LLVM.""" load("//third_party:repo.bzl", "tf_http_archive") def repo(name): """Imports LLVM.""" LLVM_COMMIT = "7171af744543433ac75b232eb7dfdaef7efd4d7a" LLVM_SHA256 = "f03b208330df0fe8431085ea917e63289a51944202c4d251367fc1c7d6e36d3f" tf_http_archive( ...
apache-2.0
Python
af83ec743a1f0db04bd6e80ef8f10f5ff61cf257
Integrate LLVM at llvm/llvm-project@7128bb61fb59
tensorflow/runtime,tensorflow/runtime,tensorflow/runtime,tensorflow/runtime
third_party/llvm/workspace.bzl
third_party/llvm/workspace.bzl
"""Provides the repository macro to import LLVM.""" load("//third_party:repo.bzl", "tfrt_http_archive") def repo(name): """Imports LLVM.""" LLVM_COMMIT = "7128bb61fb59bd1d170865b5a5f0fe8fe0c00491" LLVM_SHA256 = "067381e9c6276cd24c6384a8cb0b0b5ecfa95952a8a7a95f61b54f1e0ef0503a" tfrt_http_archive( ...
"""Provides the repository macro to import LLVM.""" load("//third_party:repo.bzl", "tfrt_http_archive") def repo(name): """Imports LLVM.""" LLVM_COMMIT = "128c6ed73b8f906a13ae908008c6f415415964bb" LLVM_SHA256 = "1708ed634016e3bce06acaac481aeaa6c5d0fcaa8bfa7819dfaf8b77bdf18ae2" tfrt_http_archive( ...
apache-2.0
Python
abdbd66ce977ac536528492fc1aa82128174b57b
Integrate LLVM at llvm/llvm-project@f885c08034fe
karllessard/tensorflow,tensorflow/tensorflow-pywrap_saved_model,Intel-tensorflow/tensorflow,yongtang/tensorflow,yongtang/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow-pywrap_tf_optimizer,Intel-tensorflow/tensorflow,tensorflow/tensorflow-pywrap_saved_model,yongtang/tensorflow,paolodedios/ten...
third_party/llvm/workspace.bzl
third_party/llvm/workspace.bzl
"""Provides the repository macro to import LLVM.""" load("//third_party:repo.bzl", "tf_http_archive") def repo(name): """Imports LLVM.""" LLVM_COMMIT = "f885c08034feaeb955bd74e3093d245125aa075d" LLVM_SHA256 = "1520f5b491d2eeef72f916b8213fdc3098655b3162de62a6f6176540d2516dbe" tf_http_archive( ...
"""Provides the repository macro to import LLVM.""" load("//third_party:repo.bzl", "tf_http_archive") def repo(name): """Imports LLVM.""" LLVM_COMMIT = "42d80de82a63a252901aca8b08184471c9f27ccf" LLVM_SHA256 = "7378a0635e66934e45eaa6fa300711aab89136f7a8fd1326bf1eaf797d8275d8" tf_http_archive( ...
apache-2.0
Python
c13e5b1f490b1f761559256f8d883f347c87d714
Fix handles method.
ericbmerritt/sinan,erlware-deprecated/sinan,erlware-deprecated/sinan,ericbmerritt/sinan,erlware-deprecated/sinan,ericbmerritt/sinan
client/libsinan/handler.py
client/libsinan/handler.py
import libsinan.output import libsinan.encoder import re import os import httplib class Handler: DEFAULT_VALIDATOR = re.compile('\w+') def ask_user(self, prompt, default = None, regexp = DEFAULT_VALIDATOR): if default: prompt += ' [default ' + default + ']' prompt = prompt + "> "...
import libsinan.output import libsinan.encoder import re import os import httplib class Handler: DEFAULT_VALIDATOR = re.compile('\w+') def ask_user(self, prompt, default = None, regexp = DEFAULT_VALIDATOR): if default: prompt += ' [default ' + default + ']' prompt = prompt + "> "...
mit
Python
7a4e3a0b4459c05320b9d247854f20f07ffc1517
Test email sending.
dinie/django-registration,FundedByMe/django-registration,Avenza/django-registration,dinie/django-registration,FundedByMe/django-registration
registration/tests.py
registration/tests.py
""" Unit tests for django-registration. """ from django.core import mail from django.test import TestCase class DefaultBackendTestCase(TestCase): """ Test the default registration backend. """ def setUp(self): """ Create an instance of the default backend for use in testing. ...
""" Unit tests for django-registration. """ from django.test import TestCase class DefaultBackendTestCase(TestCase): """ Test the default registration backend. """ def setUp(self): """ Create an instance of the default backend for use in testing. """ fro...
bsd-3-clause
Python
ac2b01e9177d04a6446b770639745010770cb317
Add 'vsd_managed' to the GET subnet response for ML2
nuagenetworks/nuage-openstack-neutron,naveensan1/nuage-openstack-neutron,naveensan1/nuage-openstack-neutron,nuagenetworks/nuage-openstack-neutron
nuage_neutron/plugins/nuage_ml2/nuage_subnet_ext_driver.py
nuage_neutron/plugins/nuage_ml2/nuage_subnet_ext_driver.py
# Copyright 2015 Intel Corporation. # 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 requir...
# Copyright 2015 Intel Corporation. # 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 requir...
apache-2.0
Python
1baafae8ac3699b36b8bde4d7de80d8c084f771f
Add array splitting function
RuiShu/tensorbayes
tensorbayes/nputils.py
tensorbayes/nputils.py
import numpy as np def log_sum_exp(x, axis=-1): a = x.max(axis=axis, keepdims=True) out = a + np.log(np.sum(np.exp(x - a), axis=axis, keepdims=True)) return np.squeeze(out, axis=axis) def kl_normal(qm, qv, pm, pv): return 0.5 * np.sum(np.log(pv) - np.log(qv) + qv/pv + np.square...
import numpy as np def log_sum_exp(x, axis=-1): a = x.max(axis=axis, keepdims=True) out = a + np.log(np.sum(np.exp(x - a), axis=axis, keepdims=True)) return np.squeeze(out, axis=axis) def kl_normal(qm, qv, pm, pv): return 0.5 * np.sum(np.log(pv) - np.log(qv) + qv/pv + np.square...
mit
Python
a49e058c3832f46e3fdb6202f64d0629d31128ef
fix import
ynop/spych,ynop/spych
spych/data/features/pipeline/__init__.py
spych/data/features/pipeline/__init__.py
from .base import Pipeline from .base import ExtractionStage from .base import ProcessingStage from .extraction import SpectrumExtractionStage from .extraction import MelFilterbankExtractionStage from .extraction import MFCCExtractionStage from .scaling import ExponentialStage from .scaling import LogStage from .sca...
from . import base from.base import Pipeline from .base import ExtractionStage from .base import ProcessingStage from .extraction import SpectrumExtractionStage from .extraction import MelFilterbankExtractionStage from .extraction import MFCCExtractionStage from .scaling import ExponentialStage from .scaling import...
mit
Python
85cac65417617f4de6c3ab63033c33341c493c44
Update config.py
teaguesterling/aggregator-advisor-example,teaguesterling/aggregator-advisor-example
aggregatoradvisor/config.py
aggregatoradvisor/config.py
# Database Configuration SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://agad:agad@localhost/agad' SQLALCHEMY_ECHO = True # Administrator Configuration ADMINS = { # Username: (PASSWORD_HASH, EMAIL_ADDRESS), 'agadmin': ('frodo', 'email@address.com'), } # Forms Configuration WTF_CSRF_ENABLED = True SECRET_KE...
# Database Configuration SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://agad:agad@localhost/agad' SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://teague:56545654@localhost/agad' SQLALCHEMY_ECHO = True # Administrator Configuration ADMINS = { # Username: (PASSWORD_HASH, EMAIL_ADDRESS), 'agadmin': ('frodo', ...
mit
Python
f933aa3495f92e3cc6e29fd627352e6593b651fb
make heinously ugly check_for_winner method
IanDCarroll/xox
source/referee_highchair.py
source/referee_highchair.py
import game_table import player_chair import display class Referee(object): def __init__(self, board, player1, player2): self.board = board self.player1 = player1 self.player2 = player2 self.whos_turn = self.player1 def start_game(self): display.show(display.start) ...
import game_table import player_chair import display class Referee(object): def __init__(self, board, player1, player2): self.board = board self.player1 = player1 self.player2 = player2 self.whos_turn = self.player1 def start_game(self): display.show(display.start) ...
mit
Python
164d86c6dfe2f46366e991ac45d06841be760fd6
fix docs for HP Cloud
t-tran/libcloud,Scalr/libcloud,marcinzaremba/libcloud,ZuluPro/libcloud,wuyuewen/libcloud,niteoweb/libcloud,Itxaka/libcloud,Cloud-Elasticity-Services/as-libcloud,supertom/libcloud,pquentin/libcloud,jimbobhickville/libcloud,ByteInternet/libcloud,andrewsomething/libcloud,illfelder/libcloud,sfriesel/libcloud,jerryblakley/l...
docs/examples/compute/openstack/hpcloud.py
docs/examples/compute/openstack/hpcloud.py
from libcloud.compute.types import Provider from libcloud.compute.providers import get_driver HPCLOUD_AUTH_URL = 'https://region-a.geo-1.identity.hpcloudsvc.com:35357' OpenStack = get_driver(Provider.OPENSTACK) #HP Cloud US West AZ 1 driver = OpenStack('your_auth_username', 'your_auth_password', ex...
from libcloud.compute.types import Provider from libcloud.compute.providers import get_driver HPCLOUD_AUTH_URL = 'https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/' OpenStack = get_driver(Provider.OPENSTACK) #HP Cloud US West AZ 1 driver = OpenStack('your_auth_username', 'your_auth_password', ...
apache-2.0
Python
27ae09f83b0165c36c78297708b4a2e75c9a2dad
Fix auth issues
yeti-platform/yeti,yeti-platform/yeti,yeti-platform/yeti,yeti-platform/yeti
core/auth/local/user_management.py
core/auth/local/user_management.py
import os import hmac from hashlib import sha512 from flask import current_app from flask_login.mixins import AnonymousUserMixin from werkzeug.security import check_password_hash, generate_password_hash from core.user import User from mongoengine import DoesNotExist DEFAULT_PERMISSIONS = { "feed": {"read": True...
import os import hmac from hashlib import sha512 from flask import current_app from flask_login.mixins import AnonymousUserMixin from werkzeug.security import check_password_hash, generate_password_hash from core.user import User from mongoengine import DoesNotExist DEFAULT_PERMISSIONS = { "feed": {"read": True...
apache-2.0
Python
59919b777649f8c26a2bf38cc5e39b90ad112376
Fix u2f server error
chiaki64/Windless,chiaki64/Windless
core/components/security/factor.py
core/components/security/factor.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import json from u2flib_server.u2f import (begin_registration, begin_authentication, complete_registration, complete_authentication) from components.eternity import config facet...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import json from u2flib_server.u2f import (begin_registration, begin_authentication, complete_registration, complete_authentication) from components.eternity import config facet...
mit
Python
8387c97bfe4bdf53c4ec448b952dee38d277c1c2
Fix broken cluster view (#702)
hasadna/anyway,hasadna/anyway,boazin/anyway,hasadna/anyway,boazin/anyway,boazin/anyway,hasadna/anyway
clusters_calculator.py
clusters_calculator.py
from models import Marker from static.pymapcluster import calculate_clusters import logging import concurrent.futures import multiprocessing def retrieve_clusters(**kwargs): marker_boxes = divide_to_boxes(kwargs['ne_lat'], kwargs['ne_lng'], kwargs['sw_lat'], kwargs['sw_lng']) result_futures = [] logging.i...
from models import Marker from static.pymapcluster import calculate_clusters import logging import concurrent.futures import multiprocessing def retrieve_clusters(**kwargs): marker_boxes = divide_to_boxes(kwargs['ne_lat'], kwargs['ne_lng'], kwargs['sw_lat'], kwargs['sw_lng']) result_futures = [] logging.i...
mit
Python
7f6f6b3b37a56f445bc211417bee3486d4d0ea94
Print output of dependency decompression
eloquentstore/appimager,eloquentstore/appimager
cli/install.py
cli/install.py
from cli import base from core import data, container import shutil import os import sys import tarfile from docker import Client from urllib.request import urlretrieve from cement.core.controller import CementBaseController, expose class InstallController(CementBaseController): class Meta: label = 'instal...
from cli import base from core import data, container import shutil import os import sys import tarfile from docker import Client from urllib.request import urlretrieve from cement.core.controller import CementBaseController, expose class InstallController(CementBaseController): class Meta: label = 'instal...
mit
Python
5cfed359d4e9bc181342663ab582f5306469e9ae
fix wrong funcion name
tborisova/hackfmi4
images.py
images.py
import pygame images = { "top_wall" : pygame.image.load("images/top_wall.png"), "bad_luck" : pygame.image.load("images/bad_luck.png"), "good_luck" : pygame.image.load("images/good_luck.png"), # "arrow_of_fortune" : pygame.image.load("images/arrow_of_fortune.png") ...
import pygame images = { "top_wall" : pygame.image.load("images/top_wall.png"), "bad_luck" : pygame.image.load("images/bad_luck.png"), "good_luck" : pygame.image.load("images/good_luck.png"), "arrow_of_fortune" : pygame.load("images/arrow_of_fortune") }
mit
Python
9ffdae7e9f9e54e4c31478ca72638608d811cb73
refactor common setup
Endika/sale-workflow,grap/sale-workflow,akretion/sale-workflow,BT-jmichaud/sale-workflow,kittiu/sale-workflow,kittiu/sale-workflow,Antiun/sale-workflow,akretion/sale-workflow,damdam-s/sale-workflow,jabibi/sale-workflow,brain-tec/sale-workflow,fevxie/sale-workflow,credativUK/sale-workflow,luistorresm/sale-workflow,guewe...
sale_exception_nostock/tests/test_dropshipping_skip_check.py
sale_exception_nostock/tests/test_dropshipping_skip_check.py
# Author: Leonardo Pistone # Copyright 2014 Camptocamp SA # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any la...
# Author: Leonardo Pistone # Copyright 2014 Camptocamp SA # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any la...
agpl-3.0
Python
21543a8acb39ac096e678a735b9d21d5b75b6f26
Update 0097_engagement_type.py
rackerlabs/django-DefectDojo,rackerlabs/django-DefectDojo,rackerlabs/django-DefectDojo,rackerlabs/django-DefectDojo
dojo/db_migrations/0097_engagement_type.py
dojo/db_migrations/0097_engagement_type.py
# Generated by Django 2.2.20 on 2021-05-02 13:17 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('dojo', '0096_engagement_type'), ] operations = [ migrations.RemoveField( model_name='engagement', name='eng_type', ...
# Generated by Django 2.2.20 on 2021-05-02 13:17 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('dojo', '0096_grype_name_change'), ] operations = [ migrations.RemoveField( model_name='engagement', name='eng_type', ...
bsd-3-clause
Python
f32e1b0ddbbfea78d0fcd6809b71137eb70342e9
Fix iconsole issue
Opticalp/instrumentall,Opticalp/instrumentall,Opticalp/instrumentall,Opticalp/instrumentall
conf/console.py
conf/console.py
# -*- coding: utf-8 -*- ## @file conf/console.py ## @date jun. 2013 ## @author PhRG / opticalp.fr ## @license MIT # # Copyright (c) 2013 Ph. Renaud-Goud / Opticalp # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "So...
# -*- coding: utf-8 -*- ## @file conf/console.py ## @date jun. 2013 ## @author PhRG / opticalp.fr ## @license MIT # # Copyright (c) 2013 Ph. Renaud-Goud / Opticalp # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "So...
mit
Python
effa6cbb708abe0aada9163d1b0cb051c39010d3
Bump version
ktalik/tornado-json,hfaran/Tornado-JSON,Tarsbot/Tornado-JSON
tornado_json/__init__.py
tornado_json/__init__.py
# As setup.py imports this module to get the version, try not to do anything # with dependencies for the project here. If that happens, setup.py # should not import tornado_json and instead use this find_version # thing: https://github.com/jezdez/envdir/blob/a062497e4339d5eb11e8a95dc6186dea6231aeb1/setup.py#L24 #...
# As setup.py imports this module to get the version, try not to do anything # with dependencies for the project here. If that happens, setup.py # should not import tornado_json and instead use this find_version # thing: https://github.com/jezdez/envdir/blob/a062497e4339d5eb11e8a95dc6186dea6231aeb1/setup.py#L24 #...
mit
Python
eeb05cfa8f6f5c255c034cb3a8594104bbd5b3e4
Add UUID generator
csparpa/robograph,csparpa/robograph
datamodel/nodes/quick/randomizer.py
datamodel/nodes/quick/randomizer.py
import random import uuid from datamodel.base import node class IntegerRandomizer(node.Node): def __init__(self, range_lower=0, range_upper=10, name=None): node.Node.__init__(self, name=name) self._range_lower = range_lower self._range_upper = range_upper def input(s...
import random from datamodel.base import node class IntegerRandomizer(node.Node): def __init__(self, range_lower=0, range_upper=10, name=None): node.Node.__init__(self, name=name) self._range_lower = range_lower self._range_upper = range_upper def input(self, contex...
apache-2.0
Python
4ee689a4825a93cf6b0116b6b7343028c96b5cfb
Fix bare 'except' in DiscordHandler
leviroth/bernard
bernard/discord_notifier.py
bernard/discord_notifier.py
"""A logging handler that emits to a Discord webhook.""" import requests from logging import Handler class DiscordHandler(Handler): """A logging handler that emits to a Discord webhook.""" def __init__(self, webhook, *args, **kwargs): """Initialize the DiscordHandler class.""" super().__init_...
"""A logging handler that emits to a Discord webhook.""" import requests from logging import Handler class DiscordHandler(Handler): """A logging handler that emits to a Discord webhook.""" def __init__(self, webhook, *args, **kwargs): """Initialize the DiscordHandler class.""" super().__init_...
mit
Python
02eede0f30a62337c15f55b4271522638fb3f3fe
Put requests inside method swither into lambda, to make request lazy
messagebird/python-rest-api
messagebird/http_client.py
messagebird/http_client.py
import requests from enum import Enum from messagebird.serde import json_serialize try: from urllib.parse import urljoin except ImportError: from urlparse import urljoin class ResponseFormat(Enum): text = 1 binary = 2 class HttpClient(object): """Used for sending simple HTTP requests.""" ...
import requests from enum import Enum from messagebird.serde import json_serialize try: from urllib.parse import urljoin except ImportError: from urlparse import urljoin class ResponseFormat(Enum): text = 1 binary = 2 class HttpClient(object): """Used for sending simple HTTP requests.""" ...
bsd-2-clause
Python
80cabc1eacdf61ac2e3bae1a68589b4def61164c
use correct form field
Liongold/crash,Liongold/crash,Liongold/crash,mmohrhard/crash,mmohrhard/crash,mmohrhard/crash
django/crashreport/symbols/views.py
django/crashreport/symbols/views.py
# -*- Mode: python; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # from django.shortcuts import rende...
# -*- Mode: python; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # from django.shortcuts import rende...
mpl-2.0
Python
46b60a1e0e6aa4b2903071808ac55ea26c324a89
remove redundant (read & write) option from admin form when in RW mode
20c/django-namespace-perms,20c/django-namespace-perms
django_namespace_perms/constants.py
django_namespace_perms/constants.py
PERM_DENY = 0 # if NSP_MODE is unset or set to "rw", PERM_WRITE will give # access to all writes PERM_READ = 0x01 PERM_WRITE = 0x02 # if NSP_MODE is set to "crud", permission flags for write operations # will be more granular PERM_UPDATE = PERM_WRITE PERM_CREATE = 0x04 PERM_DELETE = 0x08 PERM_CRUD = PERM_CREATE | P...
PERM_DENY = 0 # if NSP_MODE is unset or set to "rw", PERM_WRITE will give # access to all writes PERM_READ = 0x01 PERM_WRITE = 0x02 # if NSP_MODE is set to "crud", permission flags for write operations # will be more granular PERM_UPDATE = PERM_WRITE PERM_CREATE = 0x04 PERM_DELETE = 0x08 PERM_CRUD = PERM_CREATE | P...
apache-2.0
Python
396455271657c297a953ea21be2728d1feb13578
Fix isort
arturfelipe/condobus,arturfelipe/condobus,arturfelipe/condobus,arturfelipe/condobus
transport/tests/test_models.py
transport/tests/test_models.py
from django.test import TestCase from org.models import Organization from ..models import Bus, Route class BusModelTest(TestCase): def setUp(self): self.org = Organization.objects.create( name='Some Org', logo='/media/logos/some-org-logo.jpg', description='We are a fa...
from django.test import TestCase from org.models import Organization from ..models import Bus, Route class BusModelTest(TestCase): def setUp(self): self.org = Organization.objects.create( name='Some Org', logo='/media/logos/some-org-logo.jpg', description='We are a fa...
mit
Python
f0ff8557a6358dc2e7372aa9c9271dac9fccd0fa
Work in progress on target parser.
nens/tslib
tslib/readers/pi_xml_reader.py
tslib/readers/pi_xml_reader.py
from .ts_reader import TimeSeriesReader from datetime import datetime import logging import pandas as pd logger = logging.getLogger(__name__) try: # Fastest? from lxml import etree assert etree # Silence pyflakes logger.debug('Running with lxml.etree') except ImportError: try: # Faster? ...
from .ts_reader import TimeSeriesReader import logging logger = logging.getLogger(__name__) try: # Fastest? from lxml import etree assert etree # Silence pyflakes logger.debug('Running with lxml.etree') except ImportError: try: # Faster? import xml.etree.cElementTree as etree ...
mit
Python
405ef473f9f8eda9acffc8fd0ab89cf5349bc567
Improve Python intro (#4707)
mne-tools/mne-python,teonlamont/mne-python,larsoner/mne-python,pravsripad/mne-python,kingjr/mne-python,olafhauk/mne-python,olafhauk/mne-python,wmvanvliet/mne-python,bloyl/mne-python,Eric89GXL/mne-python,pravsripad/mne-python,olafhauk/mne-python,larsoner/mne-python,mne-tools/mne-python,adykstra/mne-python,Teekuningas/mn...
tutorials/plot_python_intro.py
tutorials/plot_python_intro.py
""" .. _tut_intro_python: Introduction to Python ====================== `Python <https://www.python.org/>`_ is a modern general-purpose object-oriented high-level programming language. First make sure you have a working Python environment and dependencies (see :ref:`install_python_and_mne_python`). If you are complet...
""" .. _tut_intro_pyton: Introduction to Python ====================== Python is a modern, general-purpose, object-oriented, high-level programming language. First make sure you have a working python environment and dependencies (see :ref:`install_python_and_mne_python`). If you are completely new to python, don't wo...
bsd-3-clause
Python
63ae1d28dd4d87de3a7478f60d2f1c2f9aab4ed2
check for presence of %s before doing string formatting
neynt/tsundiary,neynt/tsundiary,neynt/tsundiary,neynt/tsundiary
tsundiary/views/index.py
tsundiary/views/index.py
import hashlib from datetime import timedelta from flask import g, render_template from tsundiary import app from tsundiary.utils import unix_timestamp, datestamp from tsundiary.prompts import PROMPTS # Index/home! @app.route('/', methods=['GET', 'POST']) def index(): if g.user: current_post = g.user.pos...
import hashlib from datetime import timedelta from flask import g, render_template from tsundiary import app from tsundiary.utils import unix_timestamp, datestamp from tsundiary.prompts import PROMPTS # Index/home! @app.route('/', methods=['GET', 'POST']) def index(): if g.user: current_post = g.user.pos...
mit
Python
73ef8de04b92bc963d9af42ad3856b964688bbfd
Use Total Usage to compute BW usage until the limit
bsandrow/rogers-usage
rogers_usage/usage.py
rogers_usage/usage.py
import re import lxml.html current_usage_url = 'https://www.rogers.com/web/myrogers/internetUsageBeta?actionTab=CurrentUsageSummary' def current_usage_info(session): response = session.get(current_usage_url) html = lxml.html.fromstring(response.text) def clean_text(text): # Note: \xa0 is Unicode...
import re import lxml.html current_usage_url = 'https://www.rogers.com/web/myrogers/internetUsageBeta?actionTab=CurrentUsageSummary' def current_usage_info(session): response = session.get(current_usage_url) html = lxml.html.fromstring(response.text) def clean_text(text): # Note: \xa0 is Unicode...
mit
Python
fd10d3d0c7d311aa652f0cfe6792c59969747ade
Correct logger and update sleep time
ericfourrier/raspberry-scripts,ericfourrier/raspberry-scripts
weather_pred/main.py
weather_pred/main.py
#!/usr/bin/env python # -*- coding: utf-8 -*-u """ Purpose : Get weather predition using https://developer.forecast.io/ and the pip install python-forecastio python wrapper Requirements ------------ * pip install python-forecastio """ import os import forecastio import datetime import time import RPi.GPIO as GPIO ...
#!/usr/bin/env python # -*- coding: utf-8 -*-u """ Purpose : Get weather predition using https://developer.forecast.io/ and the pip install python-forecastio python wrapper Requirements ------------ * pip install python-forecastio """ import os import forecastio import datetime import time import RPi.GPIO as GPIO ...
mit
Python
1683cb41b5ffee4d48e8ec700382ad40e8370520
Add test to check that password reset view loads fine
astrobin/astrobin,astrobin/astrobin,astrobin/astrobin,astrobin/astrobin
astrobin/tests/test_auth.py
astrobin/tests/test_auth.py
# Django from django.contrib.auth.models import User from django.core.urlresolvers import reverse from django.test import TestCase class LoginTest(TestCase): def setUp(self): self.user = User.objects.create_user( 'test', 'test@test.com', 'password') def tearDown(self): self.user.de...
# Django from django.contrib.auth.models import User from django.test import TestCase class LoginTest(TestCase): def setUp(self): self.user = User.objects.create_user( 'test', 'test@test.com', 'password') def tearDown(self): self.user.delete() def test_login_view(self): ...
agpl-3.0
Python
a0f0ce5395ba17b14a2e4a70aaf17026f5944026
use SDSS-IV SAS URL
ceb8/astroquery,imbasimba/astroquery,imbasimba/astroquery,ceb8/astroquery
astroquery/sdss/__init__.py
astroquery/sdss/__init__.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ SDSS Spectra/Image/SpectralTemplate Archive Query Tool ------------------------------------------------------ """ from astropy import config as _config class Conf(_config.ConfigNamespace): """ Configuration parameters for `astroquery.sdss`. ...
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ SDSS Spectra/Image/SpectralTemplate Archive Query Tool ------------------------------------------------------ """ from astropy import config as _config class Conf(_config.ConfigNamespace): """ Configuration parameters for `astroquery.sdss`. ...
bsd-3-clause
Python
7abe9e0a2f311b7b03fd36f1a8eae07744c8d0fb
Fix a typo
diath/AutoReiv
autoreiv/plugins/history.py
autoreiv/plugins/history.py
import asyncio import sqlite3 from time import time from datetime import datetime from autoreiv import BasePlugin from autoreiv import config class Plugin(BasePlugin): def __init__(self): super().__init__() self.name = 'History' self.command = 'search' self.reqParams = True self.db = None def __del__(se...
import asyncio import sqlite3 from time import time from datetime import datetime from autoreiv import BasePlugin from autoreiv import config class Plugin(BasePlugin): def __init__(self): super().__init__() self.name = 'History' self.command = 'search' self.reqParams = True self.db = None def __del__(se...
mit
Python
cc824ea1e37f7292d38383e98ce3ea0875fbc1d0
add podcast plugin to publishconf
gustavofoa/blog.musicasparamissa.com.br,gustavofoa/blog.musicasparamissa.com.br,gustavofoa/blog.musicasparamissa.com.br,gustavofoa/blog.musicasparamissa.com.br
publishconf.py
publishconf.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # from __future__ import unicode_literals # This file is only used if you use `make publish` or # explicitly specify it as your config file. import os import sys sys.path.append(os.curdir) from pelicanconf import * SITEURL = 'https://blog.musicasparamissa.com.br' RELATIV...
#!/usr/bin/env python # -*- coding: utf-8 -*- # from __future__ import unicode_literals # This file is only used if you use `make publish` or # explicitly specify it as your config file. import os import sys sys.path.append(os.curdir) from pelicanconf import * SITEURL = 'https://blog.musicasparamissa.com.br' RELATIV...
mit
Python
d71cdcec2856e6938b3829004653020deb0cb9d2
Enable Sentry release tracking
bosondata/badwolf,bosondata/badwolf,bosondata/badwolf
badwolf/default_settings.py
badwolf/default_settings.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import os import sys import raven # is debugging DEBUG = False JSON_AS_ASCII = False # secret key SECRET_KEY = '' # Sentry SENTRY_DSN = '' # Docker DOCKER_HOST = os.environ.get('DOCKER_HOST', 'unix://var/run/docker.sock') DOCKER_API_TIMEOUT = 600 # ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals import os import sys # is debugging DEBUG = False JSON_AS_ASCII = False # secret key SECRET_KEY = '' # Sentry SENTRY_DSN = '' # Docker DOCKER_HOST = os.environ.get('DOCKER_HOST', 'unix://var/run/docker.sock') DOCKER_API_TIMEOUT = 600 # Logging LOGGIN...
mit
Python
99fbf97643bdfd42b1dc8890a7cfeccc61ae973f
Fix claims handling on create_user
akatsoulas/mozmoderator,mozilla/mozmoderator,johngian/mozmoderator,mozilla/mozmoderator,akatsoulas/mozmoderator,akatsoulas/mozmoderator,johngian/mozmoderator,johngian/mozmoderator,mozilla/mozmoderator,johngian/mozmoderator
moderator/moderate/auth.py
moderator/moderate/auth.py
from mozilla_django_oidc.auth import OIDCAuthenticationBackend from moderator.moderate.mozillians import is_vouched, BadStatusCodeError class ModeratorAuthBackend(OIDCAuthenticationBackend): def create_user(self, claims, **kwargs): try: data = is_vouched(claims.get('email')) except Ba...
from mozilla_django_oidc.auth import OIDCAuthenticationBackend from moderator.moderate.mozillians import is_vouched, BadStatusCodeError class ModeratorAuthBackend(OIDCAuthenticationBackend): def create_user(self, email, **kwargs): try: data = is_vouched(email) except BadStatusCodeErro...
agpl-3.0
Python
2de2827a4a6b926681975826a43218d3d27ce23f
Fix combine script
hadim/fiji_scripts,hadim/fiji_scripts,hadim/fiji_tools,hadim/fiji_scripts,hadim/fiji_tools
src/main/resources/script_templates/Hadim_Scripts/Combine_Single_Frame_To_Stack.py
src/main/resources/script_templates/Hadim_Scripts/Combine_Single_Frame_To_Stack.py
# @Dataset(label="Single Frame") singleFrame # @Dataset(label="Stack") stack1 # @ImageJ ij # @OUTPUT Dataset stack from net.imglib2.view import Views from net.imglib2.img import ImgView from net.imglib2.img.array import ArrayImgFactory from net.imagej.axis import Axes from net.imagej import ImgPlus nFrames = stack1.g...
# @Dataset(label="Single Frame") singleFrame # @Dataset(label="Stack") stack1 # @ImageJ ij # @OUTPUT Dataset stack from net.imglib2.view import Views from net.imglib2.img import ImgView from net.imglib2.img.array import ArrayImgFactory from net.imagej.axis import Axes from net.imagej import ImgPlus nFrames = stack1.g...
bsd-3-clause
Python
96042b6b9d478179bc78d29b63b787602f79cb12
Increment minor version, fixing up PEP8 in version.py
arokem/AFQ-Browser,yeatmanlab/AFQ-Browser,richford/AFQ-Browser,yeatmanlab/AFQ-Browser,arokem/AFQ-Browser,yeatmanlab/AFQ-viz,richford/AFQ-Browser,yeatmanlab/AFQ-viz,richford/AFQ-viz,richford/AFQ-viz,richford/AFQ-Browser,yeatmanlab/AFQ-Browser,arokem/AFQ-Browser
afqbrowser/version.py
afqbrowser/version.py
from __future__ import absolute_import, division, print_function import os.path as op from os.path import join as pjoin import glob # Format expected by setup.py and doc/source/conf.py: string of form "X.Y.Z" _version_major = 0 _version_minor = 1 _version_micro = 2 # use '' for first of series, number for 1 and above...
from __future__ import absolute_import, division, print_function import os.path as op from os.path import join as pjoin import glob # Format expected by setup.py and doc/source/conf.py: string of form "X.Y.Z" _version_major = 0 _version_minor = 1 _version_micro = 1 # use '' for first of series, number for 1 and above...
bsd-3-clause
Python
58af6b71a0a6149b364ffe0d00bf08be009f94aa
Add staticmethod decorator to methods since parent object isn't called
mandeep/conda-verify
conda_verify/verify.py
conda_verify/verify.py
# -*- coding: utf-8 -*- from conda_verify.checks import CondaPackageCheck, CondaRecipeCheck class Verify(object): @staticmethod def verify_package(path_to_package=None, verbose=True, pedantic=False): package_check = CondaPackageCheck(path_to_package, verbose) package_check.check_duplicate_mem...
# -*- coding: utf-8 -*- from conda_verify.checks import CondaPackageCheck, CondaRecipeCheck class Verify(object): def verify_package(self, path_to_package=None, verbose=True, pedantic=False): package_check = CondaPackageCheck(path_to_package, verbose) package_check.check_duplicate_members() ...
bsd-3-clause
Python
11b25b7adaee6d4cccb7af037319c1fb835fa4ae
update test for Commit message
evernym/plenum,evernym/zeno
plenum/test/input_validation/message_validation/test_commit_message.py
plenum/test/input_validation/message_validation/test_commit_message.py
import pytest from plenum.common.types import Commit from collections import OrderedDict from plenum.common.messages.fields import NonNegativeNumberField EXPECTED_ORDERED_FIELDS = OrderedDict([ ("instId", NonNegativeNumberField), ("viewNo", NonNegativeNumberField), ("ppSeqNo", NonNegativeNumberField), ]) ...
import pytest from plenum.common.types import Commit from collections import OrderedDict from plenum.common.messages.fields import NonNegativeNumberField EXPECTED_ORDERED_FIELDS = ["instId", "viewNo", "ppSeqNo"] EXPECTED_ORDERED_VALIDATORS = [NonNegativeNumberField, NonNegativeNumberFiel...
apache-2.0
Python
eebc47920f4f00d072f46ffd9c671f563292ae3f
Add Tim's homework.
bigfatpanda-training/pandas-practical-python-primer,bigfatpanda-training/pandas-practical-python-primer
training/level-1-the-zen-of-python/dragon-warrior/palindrome/twilson2_homework1.py
training/level-1-the-zen-of-python/dragon-warrior/palindrome/twilson2_homework1.py
#__author__ = 'twilson2' x_range = range(900,1000) y_range = range(900,1000) # print(len(x_range)) print(min(x_range)) print(max(x_range)) #print(x_range[300]) #print(x_range.count(300)) #print(x_range.index(300)) for x_num in x_range: for y_num in y_range: z_num = (x_num * y_num) z...
#__author__ = 'twilson2' x_range = range(900,1000) y_range = range(900,1000) # print(len(x_range)) print(min(x_range)) print(max(x_range)) #print(x_range[300]) #print(x_range.count(300)) #print(x_range.index(300)) for x_num in x_range: for y_num in y_range: z_num = (x_num * y_num) z_list = list(ma...
artistic-2.0
Python
fa2d0a645e0fc7d8c3d481229fc23d567e5339e5
Move max_count into util
grigi/pypred,armon/pypred
pypred/util.py
pypred/util.py
""" Various utility methods that are used """ from collections import defaultdict def mode(lst): "Returns the most common value" # Count each item counts = defaultdict(int) for x in lst: counts[x] += 1 # Determine the maximum count max = 0 item = None for val, count in counts.i...
""" Various utility methods that are used """ from collections import defaultdict def mode(lst): "Returns the most common value" # Count each item counts = defaultdict(int) for x in lst: counts[x] += 1 # Determine the maximum count max = 0 item = None for count, val in counts.i...
bsd-3-clause
Python
36eb16c9ad5555b6667e6388c929ab2333dff844
fix comment
robjwells/adventofcode-solutions,robjwells/adventofcode-solutions,robjwells/adventofcode-solutions,robjwells/adventofcode-solutions,robjwells/adventofcode-solutions,robjwells/adventofcode-solutions
python/day6.py
python/day6.py
#!/usr/local/bin/python3 with open('../day6_input.txt') as f: lines = [line.rsplit(maxsplit=3) for line in f.read().splitlines()] # Part one # Part one # lights = [[False for i in range(1000)] for j in range(1000)] # Part two lights = [[0 for i in range(1000)] for j in range(1000)] for instruction, start, _, e...
#!/usr/local/bin/python3 with open('../day6_input.txt') as f: lines = [line.rsplit(maxsplit=3) for line in f.read().splitlines()] # Part one # Part one # lights = [[False for i in range(1000)] for j in range(1000)] # Part two lights = [[0 for i in range(1000)] for j in range(1000)] for instruction, start, _, e...
mit
Python
6c590e8df66498ba5f4bcb3eae01f2adfcd35388
Debug output
Henning-Klatt/alkan-plotter
python/test.py
python/test.py
from vapory import * import json from pprint import pprint from moviepy.editor import VideoClip with open('data.json') as data_file: data = json.load(data_file) obj = [] def make_scene(t, x): camera = Camera( 'location', [t*20,20,-x/1.5], 'look_at', [x/2,5,0]) return Scene( camera, objects= obj, included...
from vapory import * import json from pprint import pprint from moviepy.editor import VideoClip with open('data.json') as data_file: data = json.load(data_file) obj = [] def make_scene(t, x): camera = Camera( 'location', [t*20,20,-x/1.5], 'look_at', [x/2,5,0]) return Scene( camera, objects= obj, included...
mit
Python
0ca12062bd5929dac57763464e6172ed590b5990
fix job max runtime
pywren/pywren,pywren/pywren
pywren/wren.py
pywren/wren.py
from __future__ import absolute_import import logging import os import pywren.invokers as invokers import pywren.queues as queues import pywren.wrenconfig as wrenconfig from pywren.executor import Executor from pywren.wait import wait, ALL_COMPLETED, ANY_COMPLETED # pylint: disable=unused-import logger = logging.get...
from __future__ import absolute_import import logging import os import pywren.invokers as invokers import pywren.queues as queues import pywren.wrenconfig as wrenconfig from pywren.executor import Executor from pywren.wait import wait, ALL_COMPLETED, ANY_COMPLETED # pylint: disable=unused-import logger = logging.get...
apache-2.0
Python
1e45ff0c1a93794e97c6275fc63132313f1b69bc
Update 7colors.py
rafaelkperes/raspberrypi-examples,rafaelkperes/raspberrypi-examples,timwaizenegger/raspberrypi-examples,timwaizenegger/raspberrypi-examples
actor-7_2-colors/7colors.py
actor-7_2-colors/7colors.py
# Benoetigte Module werden importiert und eingerichtet import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) # Hier werden die Ausgangs-Pin deklariert, an dem die LEDs angeschlossen sind. LED_ROT = 5 LED_GRUEN = 4 GPIO.setup(LED_ROT, GPIO.OUT, initial= GPIO.LOW) GPIO.setup(LED_GRUEN, GPIO.OUT, initial= GPI...
import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setup(14, GPIO.OUT) #red GPIO.output(14,1) GPIO.setup(13, GPIO.OUT) #green GPIO.output(13,1) GPIO.setup(12, GPIO.OUT) #blue GPIO.output(12,1) try: while(True): request = raw_input("RGB-->") if (len(request) == 3): GPIO.output(14, int...
mit
Python
3dc1cd8aef22915af8c8c585391b180630236bd0
Fix some travis issue
JonathanSalwan/Triton,JonathanSalwan/Triton,JonathanSalwan/Triton,JonathanSalwan/Triton,JonathanSalwan/Triton
src/testers/unittests/test_examples.py
src/testers/unittests/test_examples.py
#!/usr/bin/env python2 # coding: utf-8 """Tester for examples.""" import glob import itertools import os import platform import subprocess import sys import unittest EXAMPLE_DIR = os.path.join(os.path.dirname(__file__), "..", "..", "examples", "python") ARGS = { "small_x86-64_symbolic_emulator.py": ...
#!/usr/bin/env python2 # coding: utf-8 """Tester for examples.""" import glob import itertools import os import platform import subprocess import sys import unittest EXAMPLE_DIR = os.path.join(os.path.dirname(__file__), "..", "..", "examples", "python") ARGS = { "small_x86-64_symbolic_emulator.py": ...
apache-2.0
Python
55f8f9ca97415b5a90bd8a53b886cfc75ced0b37
remove unnecessary line
texttochange/vusion-backend,texttochange/vusion-backend,texttochange/vusion-backend
components/rate_manager.py
components/rate_manager.py
from twisted.internet.defer import inlineCallbacks, returnValue class RateManager(object): def __init__(self, redis, window_size=100, per_seconds=1): self.window_size = window_size self.per_seconds = per_seconds self.redis = redis def rate_key(self, key): return self.redis._k...
from twisted.internet.defer import inlineCallbacks, returnValue class RateManager(object): def __init__(self, redis, window_size=100, per_seconds=1): self.window_size = window_size self.per_seconds = per_seconds self.per_milliseconds = per_seconds * 1000 self.redis = redis de...
bsd-3-clause
Python
45f2e557819bfdbe7e4c4543b637fdb339fa010b
add redirect for favicon at root of site
emory-libraries/readux,emory-libraries/readux,emory-libraries/readux
readux/urls.py
readux/urls.py
from django.conf import settings from django.conf.urls import patterns, include, url from django.conf.urls.static import static from django.contrib import admin from django.contrib.sitemaps import views as sitemap_views from django.views.generic import TemplateView from django.views.generic.base import RedirectView fr...
from django.conf import settings from django.conf.urls import patterns, include, url from django.conf.urls.static import static from django.contrib import admin from django.contrib.sitemaps import views as sitemap_views from django.views.generic import TemplateView from readux.collection.sitemaps import CollectionSite...
apache-2.0
Python
7c925778eb8cef57d01602da236d4a1c723d07d1
Fix velbus climate current temp (#62329)
mezz64/home-assistant,GenericStudent/home-assistant,w1ll1am23/home-assistant,rohitranjan1991/home-assistant,rohitranjan1991/home-assistant,nkgilley/home-assistant,rohitranjan1991/home-assistant,w1ll1am23/home-assistant,toddeye/home-assistant,toddeye/home-assistant,nkgilley/home-assistant,GenericStudent/home-assistant,m...
homeassistant/components/velbus/climate.py
homeassistant/components/velbus/climate.py
"""Support for Velbus thermostat.""" from __future__ import annotations from typing import Any from velbusaio.channels import Temperature as VelbusTemp from homeassistant.components.climate import ClimateEntity from homeassistant.components.climate.const import ( HVAC_MODE_HEAT, SUPPORT_PRESET_MODE, SUPP...
"""Support for Velbus thermostat.""" from __future__ import annotations from typing import Any from velbusaio.channels import Temperature as VelbusTemp from homeassistant.components.climate import ClimateEntity from homeassistant.components.climate.const import ( HVAC_MODE_HEAT, SUPPORT_PRESET_MODE, SUPP...
apache-2.0
Python
b9fe4daf26c4fab4ccc55507d4f7f3a83eefcc08
Support Debian's "nodejs"
renchaorevee/gerrit,WANdisco/gerrit,qtproject/qtqa-gerrit,gerrit-review/gerrit,qtproject/qtqa-gerrit,gerrit-review/gerrit,MerritCR/merrit,WANdisco/gerrit,GerritCodeReview/gerrit,WANdisco/gerrit,MerritCR/merrit,joshuawilson/merrit,gerrit-review/gerrit,GerritCodeReview/gerrit,joshuawilson/merrit,renchaorevee/gerrit,joshu...
tools/js/run_npm_binary.py
tools/js/run_npm_binary.py
#!/usr/bin/env python # Copyright (C) 2015 The Android Open Source Project # # 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 b...
#!/usr/bin/env python # Copyright (C) 2015 The Android Open Source Project # # 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 b...
apache-2.0
Python
c72d9060142fe1de1e2201fc355f2ee95f5354c7
Fix database migration for invoices application.
opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/nodeconductor-assembly-waldur
src/waldur_mastermind/invoices/migrations/0023_invoice_current_cost.py
src/waldur_mastermind/invoices/migrations/0023_invoice_current_cost.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.7 on 2018-06-19 08:47 from __future__ import unicode_literals from django.db import migrations, models def migrate_data(apps, schema_editor): from waldur_mastermind.invoices.models import Invoice for invoice in Invoice.objects.all(): invoice.update_...
# -*- coding: utf-8 -*- # Generated by Django 1.11.7 on 2018-06-19 08:47 from __future__ import unicode_literals from django.db import migrations, models def migrate_data(apps, schema_editor): Invoice = apps.get_model('invoices', 'Invoice') for invoice in Invoice.objects.all(): invoice.update_curren...
mit
Python
8dfc9f18d365d8decd635f69b2b03dcb7f254ad6
Improve the description as the produce is now Manufacture
ClearCorp-dev/odoo,odooindia/odoo,sysadminmatmoz/OCB,FlorianLudwig/odoo,dariemp/odoo,joariasl/odoo,jpshort/odoo,fossoult/odoo,feroda/odoo,idncom/odoo,BT-ojossen/odoo,mkieszek/odoo,nuncjo/odoo,0k/odoo,JGarcia-Panach/odoo,prospwro/odoo,omprakasha/odoo,blaggacao/OpenUpgrade,bplancher/odoo,minhtuancn/odoo,SerpentCS/odoo,de...
addons/project_mrp/__openerp__.py
addons/project_mrp/__openerp__.py
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
agpl-3.0
Python
3c0160e2857b357b12a138334cea310d2a6b1c87
Use singular "generate_module_list"
madan96/sympy,sampadsaha5/sympy,rahuldan/sympy,postvakje/sympy,souravsingh/sympy,jaimahajan1997/sympy,rahuldan/sympy,postvakje/sympy,chaffra/sympy,souravsingh/sympy,sampadsaha5/sympy,madan96/sympy,souravsingh/sympy,skidzo/sympy,jaimahajan1997/sympy,chaffra/sympy,skidzo/sympy,drufat/sympy,madan96/sympy,kaushik94/sympy,c...
bin/generate_module_list.py
bin/generate_module_list.py
""" Execute like this: $ python bin/generate_module_list.py modules = [ 'sympy.assumptions', 'sympy.assumptions.handlers', 'sympy.benchmarks', 'sympy.calculus', 'sympy.categories', 'sympy.codegen', 'sympy.combinatorics', 'sympy.concrete', 'sympy.core', 'sympy.core.benchmarks', ...
""" Execute like this: $ python bin/generate_module_list.py modules = [ 'sympy.assumptions', 'sympy.assumptions.handlers', 'sympy.benchmarks', 'sympy.calculus', 'sympy.categories', 'sympy.codegen', 'sympy.combinatorics', 'sympy.concrete', 'sympy.core', 'sympy.core.benchmarks', ...
bsd-3-clause
Python
1a39de42c08e1aff66724f41b6a464614fd9a6f7
fix doc
yuyu2172/chainercv,chainer/chainercv,yuyu2172/chainercv,chainer/chainercv,pfnet/chainercv
chainercv/transforms/keypoint/flip_keypoint.py
chainercv/transforms/keypoint/flip_keypoint.py
def flip_keypoint(keypoint, size, x_flip=False, y_flip=False): """Modify keypoints according to image flips. Args: keypoint (~numpy.ndarray): Keypoints in the image. The shape of this array is :math:`(K, 2)`. :math:`K` is the number of keypoints in the image. The las...
def flip_keypoint(keypoint, size, x_flip=False, y_flip=False): """Modify keypoints according to image flips. Args: keypoint (~numpy.ndarray): Keypoints in the image. The shape of this array is :math:`(K, 2)`. :math:`K` is the number of keypoint in the image. The last...
mit
Python
7c2c1ac9a5e4461f4ff40d82af1ffb167fb9e23c
Fix nits leftover from 11771
chaincoin/chaincoin,chaincoin/chaincoin,chaincoin/chaincoin,chaincoin/chaincoin,chaincoin/chaincoin,chaincoin/chaincoin
test/functional/p2p_invalid_tx.py
test/functional/p2p_invalid_tx.py
#!/usr/bin/env python3 # Copyright (c) 2015-2017 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test node responses to invalid transactions. In this test we connect to one node over p2p, and test tx...
#!/usr/bin/env python3 # Copyright (c) 2015-2017 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test node responses to invalid transactions. In this test we connect to one node over p2p, and test tx...
mit
Python
3b76fd659a508cec57a25a830309040234af5af7
Raise specific exception when extraction failed
znerol/spreadflow-exiftool
spreadflow_exiftool/proc.py
spreadflow_exiftool/proc.py
from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals import json from twisted.internet import defer, protocol from twisted.internet.endpoints import clientFromString from twisted_exiftool import ExiftoolProtocol class ExiftoolProtocolFactory(protocol.ClientFac...
from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals import json from twisted.internet import defer, protocol from twisted.internet.endpoints import clientFromString from twisted_exiftool import ExiftoolProtocol class ExiftoolProtocolFactory(protocol.ClientFac...
mit
Python
8b0e3b6994b67200a55a9e7cb9c4658a06883d86
Rewrite test_queue_monkeypatch.py to be pytest-style
urllib3/urllib3,Disassem/urllib3,sigmavirus24/urllib3,urllib3/urllib3,sigmavirus24/urllib3,Disassem/urllib3
test/test_queue_monkeypatch.py
test/test_queue_monkeypatch.py
from __future__ import absolute_import import mock import pytest from urllib3 import HTTPConnectionPool from urllib3.exceptions import EmptyPoolError from urllib3.packages.six.moves import queue class BadError(Exception): """ This should not be raised. """ pass class TestMonkeypatchResistance(obj...
from __future__ import absolute_import import mock import sys import urllib3 from urllib3.exceptions import EmptyPoolError from urllib3.packages.six.moves import queue if sys.version_info >= (2, 7): import unittest else: import unittest2 as unittest class BadError(Exception): """ This should not be...
mit
Python
64511934b93530928c1beae3028e11724dc7185e
Update the icqsol_color_surface_field tool to use icqsol_utils encapsulation.
gregvonkuster/galaxy-csg,pletzer/galaxy-csg,gregvonkuster/galaxy-csg,pletzer/galaxy-csg
tools/icqsol_color_surface_field/icqsol_color_surface_field.py
tools/icqsol_color_surface_field/icqsol_color_surface_field.py
#!/usr/bin/env python import argparse import shutil import icqsol_utils # Parse Command Line. parser = argparse.ArgumentParser() parser.add_argument('--input', dest='input', help='Shape dataset selected from history') parser.add_argument('--input_file_format_and_type', dest='input_file_format_and_type', help='Input f...
#!/usr/bin/env python import argparse import shutil import icqsol_utils from icqsol.shapes.icqShapeManager import ShapeManager # Parse Command Line. parser = argparse.ArgumentParser() parser.add_argument('--input', dest='input', help='Shape dataset selected from history') parser.add_argument('--input_file_format_and_...
mit
Python
64d083ab7c5c72f5a12eab4f443ef72d5c39e780
Fix csvfile docstring.
amorphic/braubuddy,amorphic/braubuddy,amorphic/braubuddy
braubuddy/output/csvfile.py
braubuddy/output/csvfile.py
# -*- coding: utf-8 -*- from braubuddy.output import TextFileOutput class CSVFileOutput(TextFileOutput): """ Output to CSV file. This is just a shortcut to create a TextFileOutput in CSV format. :param units: Temperature units to output. Use 'celsius' or 'fahrenheit'. :type units: :class...
# -*- coding: utf-8 -*- from braubuddy.output import TextFileOutput class CSVFileOutput(TextFileOutput): """ Output to CSV file. This is just a shortcut to create a TextFileOutput in CSV format. :param units: Temperature units to output. Use 'celsius' or 'fahrenheit'. :type units: :class...
bsd-3-clause
Python
3b2f306584e01bb1887dc74a0d0f7c0ca69bdee4
set port
genenetwork/genenetwork2_diet,genenetwork/genenetwork2_diet,genenetwork/genenetwork2_diet,genenetwork/genenetwork2_diet,genenetwork/genenetwork2_diet
wqflask/runserver.py
wqflask/runserver.py
from wqflask import app # Please note, running with host set externally below combined with debug mode # is a big security no-no # Unless you have a firewall setup # # Something like /sbin/iptables -A INPUT -p tcp -i eth0 -s ! 71.236.239.43 --dport 5000 -j DROP # should do the trick # # You'll probably have to firewal...
from wqflask import app # Please note, running with host set externally below combined with debug mode # is a big security no-no # Unless you have a firewall setup # # Something like /sbin/iptables -A INPUT -p tcp -i eth0 -s ! 71.236.239.43 --dport 5000 -j DROP # should do the trick # # You'll probably have to firewal...
agpl-3.0
Python
f2d9b413d2e958b9ee02ad97ce483bd6e50343d1
fix bug in replay memory length
steveKapturowski/tensorflow-rl
utils/replay_memory.py
utils/replay_memory.py
# -*- coding: utf-8 -*- import os import tempfile import numpy as np class ReplayMemory(object): def __init__(self, maxlen, input_shape, action_size): self.maxlen = maxlen dirname = tempfile.mkdtemp() #use memory maps so we won't have to worry about eating up lots of RAM get_path = lambda name: os.path.join...
# -*- coding: utf-8 -*- import os import tempfile import numpy as np class ReplayMemory(object): def __init__(self, maxlen, input_shape, action_size): self.maxlen = maxlen dirname = tempfile.mkdtemp() #use memory maps so we won't have to worry about eating up lots of RAM get_path = lambda name: os.path.join...
apache-2.0
Python
d4154f7cde83f3f48ff70bb7abe110e03679ff9d
Add helper to check instance and subclass
vovanbo/aiohttp_json_api
aiohttp_json_api/helpers.py
aiohttp_json_api/helpers.py
""" Helpers ======= """ import inspect from collections import Mapping, Iterable def is_generator(obj): """Return True if ``obj`` is a generator """ return inspect.isgeneratorfunction(obj) or inspect.isgenerator(obj) def is_iterable_but_not_string(obj): """Return True if ``obj`` is an iterable objec...
""" Helpers ======= """ import inspect from collections import Mapping, Iterable def is_generator(obj): """Return True if ``obj`` is a generator """ return inspect.isgeneratorfunction(obj) or inspect.isgenerator(obj) def is_iterable_but_not_string(obj): """Return True if ``obj`` is an iterable objec...
mit
Python
ee130f5c2f886ffe5d08910f4c73a3332feb5d7b
remove tf import from decorators
ufal/neuralmonkey,ufal/neuralmonkey,bastings/neuralmonkey,bastings/neuralmonkey,juliakreutzer/bandit-neuralmonkey,bastings/neuralmonkey,juliakreutzer/bandit-neuralmonkey,juliakreutzer/bandit-neuralmonkey,ufal/neuralmonkey,juliakreutzer/bandit-neuralmonkey,juliakreutzer/bandit-neuralmonkey,ufal/neuralmonkey,bastings/neu...
neuralmonkey/decorators.py
neuralmonkey/decorators.py
from functools import wraps from neuralmonkey.model.model_part import ModelPart def tensor(func): @wraps(func) def decorate(self, *args, **kwargs): attribute_name = "_{}_cached_placeholder".format(func.__name__) if not hasattr(self, attribute_name): if isinstance(self, ModelPart):...
from functools import wraps import tensorflow as tf from neuralmonkey.model.model_part import ModelPart def tensor(func): @wraps(func) def decorate(self, *args, **kwargs): attribute_name = "_{}_cached_placeholder".format(func.__name__) if not hasattr(self, attribute_name): if isin...
bsd-3-clause
Python
7e30006461bb95bea175d18522bbd2ceb17a7516
Fix indentation
opencivicdata/scrapers-ca,opencivicdata/scrapers-ca
ca_qc_longueuil/__init__.py
ca_qc_longueuil/__init__.py
# coding: utf-8 from __future__ import unicode_literals from utils import CanadianJurisdiction from opencivicdata.divisions import Division from pupa.scrape import Organization class Longueuil(CanadianJurisdiction): classification = 'legislature' division_id = 'ocd-division/country:ca/csd:2458227' divisio...
# coding: utf-8 from __future__ import unicode_literals from utils import CanadianJurisdiction from opencivicdata.divisions import Division from pupa.scrape import Organization class Longueuil(CanadianJurisdiction): classification = 'legislature' division_id = 'ocd-division/country:ca/csd:2458227' divisio...
mit
Python
cd0cd4434c43e17e98f16fd05c83ac96dc690124
Disable disallowed features on type change
mvidalgarcia/indico,indico/indico,pferreir/indico,ThiefMaster/indico,mvidalgarcia/indico,mvidalgarcia/indico,DirkHoffmann/indico,mic4ael/indico,OmeGak/indico,mic4ael/indico,DirkHoffmann/indico,OmeGak/indico,OmeGak/indico,mvidalgarcia/indico,indico/indico,ThiefMaster/indico,ThiefMaster/indico,pferreir/indico,pferreir/in...
indico/modules/events/features/__init__.py
indico/modules/events/features/__init__.py
# This file is part of Indico. # Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN). # # Indico is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 3 of the # License, or (a...
# This file is part of Indico. # Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN). # # Indico is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 3 of the # License, or (a...
mit
Python
a2b91435d65faa85aa37970268bc14dc719db8dd
add some useful info in __init__
unixsurfer/anycast_healthchecker,unixsurfer/anycast_healthchecker,unixsurfer/anycast_healthchecker
anycast_healthchecker/__init__.py
anycast_healthchecker/__init__.py
# -*- coding: utf-8 -*- # vim:fenc=utf-8 # __title__ = 'anycast_healthchecker' __author__ = 'Pavlos Parissis' __version__ = '0.2.0' __copyright__ = 'Copyright 2015 Pavlos Parissis'
apache-2.0
Python
90e91a359f62b63bddc8df2b4b1c53271bf1ae81
fix bugs
superbigsea/zabbix-wechat,superbigsea/zabbix-wechat
zabbixwechat/urls.py
zabbixwechat/urls.py
"""zabbixwechat URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Cla...
"""zabbixwechat URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Cla...
apache-2.0
Python
e0608476944bba7c21b89930028f4559e4cee186
fix bug in remove
Anaconda-Server/chalmers,Anaconda-Server/chalmers
chalmers/commands/remove.py
chalmers/commands/remove.py
''' Remove a program definition from chalmers ''' from __future__ import unicode_literals, print_function from argparse import RawDescriptionHelpFormatter import logging import sys from chalmers import errors from chalmers.utils.cli import add_selection_group, select_programs from clyent.logs.colors.printer import pr...
''' Remove a program definition from chalmers ''' from __future__ import unicode_literals, print_function from argparse import RawDescriptionHelpFormatter import logging import sys from chalmers import errors from chalmers.utils.cli import add_selection_group, select_programs from clyent.logs.colors.printer import pr...
mit
Python
351542796928e899e66a21baaa17967e0fefff2e
use a define for nb of sample
flagos/pico-brewUI,flagos/pico-brewUI,flagos/pico-brewUI,flagos/pico-brewUI,flagos/pico-brewUI
Tank.py
Tank.py
import time from datetime import timedelta, datetime from PID import PID SAMPLE_HISTORY = 10 class List_max(): def __init__(self, max_size): self.max_size = max_size self.array = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] def append(self, obj): if (len(self.array) >= self.max_size): ...
import time from datetime import timedelta, datetime from PID import PID class List_max(): def __init__(self, max_size): self.max_size = max_size self.array = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] def append(self, obj): if (len(self.array) >= self.max_size): self.array.pop(0)...
mit
Python
52405c4983b38f2536bea63e5402427f5749854a
fix test on py2.6. skip python -m test
Hinidu/doit,wangpanjun/doit,saimn/doit,JohannesBuchner/doit,lelit/doit,gh0std4ncer/doit,lelit/doit,lelit/doit,pydoit/doit,lelit/doit
tests/test___main__.py
tests/test___main__.py
import sys import subprocess import pytest @pytest.mark.skipif('sys.version_info < (2,7,0)') def test_execute(): assert 0 == subprocess.call(['python', '-m', 'doit', 'list'])
import subprocess def test_execute(): assert 0 == subprocess.call(['python', '-m', 'doit', 'list'])
mit
Python
4efab6cd3189a8116bcd5fa037717d75bf0d5152
Choose a seed with good initialization.
probcomp/cgpm,probcomp/cgpm
tests/test_binomial.py
tests/test_binomial.py
# -*- coding: utf-8 -*- # The MIT License (MIT) # Copyright (c) 2016 MIT Probabilistic Computing Project # 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 # wi...
# -*- coding: utf-8 -*- # The MIT License (MIT) # Copyright (c) 2016 MIT Probabilistic Computing Project # 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 # wi...
apache-2.0
Python
9253c7e2deaf4d86d372d164aa1c75e353ee5386
save in 07-29-11-13-03
Qingluan/QmongoHelper,Qingluan/QmongoHelper
__db.py
__db.py
import motor from tornado.ioloop import IOLoop from time import * def _run(func): def _init(*args,**kargs): dbhelper.instance.result = None res = func(*args,**kargs) IOLoop.instance().start() if dbhelper.instance.result: return dbhelper.instance.result return _init def _insert(func): def _init(*args,**...
import motor from tornado.ioloop import IOLoop from time import * def _run(func): def _init(*args,**kargs): dbhelper.instance.result = None res = func(*args,**kargs) IOLoop.instance().start() if dbhelper.instance.result: return dbhelper.instance.result return _init def _insert(func): def _init(*args,**...
bsd-2-clause
Python
497918755352b785ca4dc09515ca392a83fad284
add ServiceStatus, Team and PropertyType to modules
jordanbettis/chipy-mentorship,jordanbettis/chipy-mentorship,jordanbettis/chipy-mentorship
chipyprj/chipyapp/models.py
chipyprj/chipyapp/models.py
from django.db import models class Module(models.Model): module_number = models.IntegerField() def __unicode__(self): return unicode(self.module_number) class Area(models.Model): area = models.CharField(max_length=10) def __unicode__(self): return unicode(self.area) class ServiceStatus...
from django.db import models class Module(models.Model): module_number = models.IntegerField() def __unicode__(self): return unicode(self.module_number) class Area(models.Model): area = models.CharField(max_length=10) def __unicode__(self): return unicode(self.area) class ServiceStatus...
bsd-2-clause
Python
677d2d4f422f9b05746fa80d63492de4ae9aced4
Rework for handling of examples/
cihai/cihai,cihai/cihai
tests/test_examples.py
tests/test_examples.py
import importlib import importlib.util import sys import types import pytest def load_script(example: str) -> types.ModuleType: file_path = f"examples/{example}.py" module_name = "run" spec = importlib.util.spec_from_file_location(module_name, file_path) assert spec is not None module = importli...
import pytest import examples.basic_usage import examples.basic_usage_manual import examples.dataset import examples.variant_ts_difficulties import examples.variants def test_dataset(unihan_options): examples.dataset.run() def test_variants(unihan_options): examples.variants.run(unihan_options=unihan_optio...
mit
Python
888baa1007c884c40cd5685e59daca3ddb8c3a00
Update test_generate.py
PyThaiNLP/pythainlp
tests/test_generate.py
tests/test_generate.py
# -*- coding: utf-8 -*- import unittest from pythainlp.generate import Unigram, Bigram, Trigram from pythainlp.generate.thai2fit import gen_sentence class TestGeneratePackage(unittest.TestCase): def test_unigram(self): _tnc_unigram = Unigram("tnc") self.assertIsNotNone(_tnc_unigram.gen_sentence(...
# -*- coding: utf-8 -*- import unittest from pythainlp.generate import Unigram, Bigram, Trigram from pythainlp.generate.thai2fit import gen_sentence class TestGeneratePackage(unittest.TestCase): def test_unigram(self): _tnc_unigram = Unigram("tnc") self.assertIsNotNone(_tnc_unigram.gen_sentence(...
apache-2.0
Python
231331aa045ed926b0d92d4b03a36c5452f3cca4
Add tests for coaching code
mhoye/gitcoach,mhoye/gitcoach
tests/test_gitcoach.py
tests/test_gitcoach.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_gitcoach ---------------------------------- Tests for `gitcoach` module. """ from nose.tools import eq_ from gitcoach import learn, coach def test_find_correlations(): input = [ ['f1', 'f2', 'f3', 'f4'], ['f2', 'f3', 'f4'], ['f2', '...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_gitcoach ---------------------------------- Tests for `gitcoach` module. """ from nose.tools import eq_ from gitcoach import learn def test_find_correlations(): input = [ ['f1', 'f2', 'f3', 'f4'], ['f2', 'f3', 'f4'], ['f2', 'f4'], ...
bsd-3-clause
Python
bb7ea0a2a347e229529e47fa3d1ed7ab6f3fe55d
Update again validator for nonbond metadata
dgasmith/EEX_scratch
tests/test_metadata.py
tests/test_metadata.py
""" Validates the EEX metadata """ import eex import pytest import numpy as np import random import numexpr as ne np.random.seed(0) random.seed(0) # Test the two-order forms term_dict = {} term_dict["two"] = eex.metadata.two_body_metadata term_dict["three"] = eex.metadata.three_body_metadata term_dict["four"] = eex....
""" Validates the EEX metadata """ import eex import pytest import numpy as np import random import numexpr as ne np.random.seed(0) random.seed(0) # Test the two-order forms term_dict = {} term_dict["two"] = eex.metadata.two_body_metadata term_dict["three"] = eex.metadata.three_body_metadata term_dict["four"] = eex....
bsd-3-clause
Python
03bd379f908be0cd1ed9db05d47dfc0d299fce34
allow setting includes as a nice list
ztane/tet
tet/config/__init__.py
tet/config/__init__.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, division,\ print_function, unicode_literals from pyramid.config import * class TetAppFactory(object): scan = None includes = None def __init__(self, *args, **kwargs): super(TetAppFactory, self).__init__(*args, **kwargs) d...
# -*- coding: utf-8 -*- from __future__ import absolute_import, division,\ print_function, unicode_literals from pyramid.config import * class TetAppFactory(object): def __init__(self, *args, **kwargs): super(TetAppFactory, self).__init__(*args, **kwargs) def _dummy(self, *a, **kw): pa...
bsd-3-clause
Python
983df9ceaebb42ca31b131f437362193070eb1db
Fix regression in manpages build
Yelp/paasta,Yelp/paasta
paasta_tools/clusterman.py
paasta_tools/clusterman.py
import staticconf CLUSTERMAN_YAML_FILE_PATH = '/nail/srv/configs/clusterman.yaml' CLUSTERMAN_METRICS_YAML_FILE_PATH = '/nail/srv/configs/clusterman_metrics.yaml' def get_clusterman_metrics(): try: import clusterman_metrics clusterman_yaml = CLUSTERMAN_YAML_FILE_PATH staticconf.YamlConfigu...
import staticconf CLUSTERMAN_YAML_FILE_PATH = '/nail/srv/configs/clusterman.yaml' CLUSTERMAN_METRICS_YAML_FILE_PATH = '/nail/srv/configs/clusterman_metrics.yaml' def get_clusterman_metrics(): try: import clusterman_metrics clusterman_yaml = CLUSTERMAN_YAML_FILE_PATH staticconf.YamlConfigu...
apache-2.0
Python
d20175a31ddad3d0da9a45e48e2fcfef8648d0d5
Fix temp files with doctestplus 0.6+
mhvk/astropy,pllim/astropy,aleksandr-bakanov/astropy,saimn/astropy,pllim/astropy,dhomeier/astropy,saimn/astropy,lpsinger/astropy,dhomeier/astropy,StuartLittlefair/astropy,mhvk/astropy,lpsinger/astropy,aleksandr-bakanov/astropy,astropy/astropy,mhvk/astropy,saimn/astropy,larrybradley/astropy,dhomeier/astropy,StuartLittle...
docs/conftest.py
docs/conftest.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # This file needs to be included here to make sure commands such # as ``python setup.py test ... -t docs/...`` works, since this # will ignore the conftest.py file at the root of the repository # and the one in astropy/conftest.py import os import tempfi...
# Licensed under a 3-clause BSD style license - see LICENSE.rst # This file needs to be included here to make sure commands such # as ``python setup.py test ... -t docs/...`` works, since this # will ignore the conftest.py file at the root of the repository # and the one in astropy/conftest.py import os import tempfi...
bsd-3-clause
Python
bf5ec5a459dc9dbe38a6806b513616aa769134a2
Use `map` to test version
veegee/amqpy,gst/amqpy
amqpy/tests/test_version.py
amqpy/tests/test_version.py
import re def get_field(doc: str, name: str): match = re.search(':{}: (.*)$'.format(name), doc, re.IGNORECASE | re.MULTILINE) if match: return match.group(1).strip() class TestVersion: def test_version_is_consistent(self): from .. import VERSION with open('README.rst') as f: ...
import re def get_field(doc: str, name: str): match = re.search(':{}: (.*)$'.format(name), doc, re.IGNORECASE | re.MULTILINE) if match: return match.group(1).strip() class TestVersion: def test_version_is_consistent(self): from .. import VERSION with open('README.rst') as f: ...
mit
Python