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 |
|---|---|---|---|---|---|---|---|---|
3d61ee94a63d6ae96775d4146d6f8a09dcb845b4 | update signal | cenkalti/kuyruk-sentry | kuyruk_sentry.py | kuyruk_sentry.py | import os
import sys
import socket
from datetime import datetime
import raven
from kuyruk import signals
CONFIG_KEYS = ["SENTRY_DSN"]
class Sentry(object):
def __init__(self, kuyruk):
self.client = raven.Client(kuyruk.config.SENTRY_DSN)
signals.worker_failure.connect(
self.capture_... | import raven
from kuyruk.signals import task_failure
CONFIG_KEYS = ["SENTRY_DSN"]
class Sentry(object):
def __init__(self, kuyruk):
self.client = raven.Client(kuyruk.config.SENTRY_DSN)
task_failure.connect(self.capture_exception, sender=kuyruk, weak=False)
def capture_exception(self, sende... | mit | Python |
86f07cb8dfffd1802d03e08a8c7a4c071a3b4d22 | Handle volumes with no image | xchewtoyx/pulldb | pulldb/volumes.py | pulldb/volumes.py | # Copyright 2013 Russell Heilling
from google.appengine.ext import ndb
import webapp2
import pycomicvine
from pulldb.admin import Setting
from pulldb.base import BaseHandler
from pulldb import publishers
class Volume(ndb.Model):
'''Volume object in datastore.
Holds volume data.
'''
identifier = ndb.Intege... | # Copyright 2013 Russell Heilling
from google.appengine.ext import ndb
import webapp2
import pycomicvine
from pulldb.admin import Setting
from pulldb.base import BaseHandler
from pulldb import publishers
class Volume(ndb.Model):
'''Volume object in datastore.
Holds volume data.
'''
identifier = ndb.Intege... | mit | Python |
bf9017ea02f0bfa5bfd47ea40626c0600891b1da | Add setup event and --verbose switch. | sk89q/Plumeria,sk89q/Plumeria,sk89q/Plumeria | bot.py | bot.py | #!/usr/bin/env python3
import asyncio
import pkgutil
import sys
import argparse
import logging
from plumeria import config
from plumeria.config import boolstr
from plumeria.event import bus
import plumeria.plugins
logger = logging.getLogger(__name__)
async def startup():
logging.info("Calling all setup handlers.... | #!/usr/bin/env python3
import asyncio
import pkgutil
import sys
import argparse
import logging
from plumeria import config
from plumeria.config import boolstr
from plumeria.event import bus
import plumeria.plugins
logger = logging.getLogger(__name__)
async def startup():
logging.info("Calling all pre-init handle... | mit | Python |
dab22d947fa66f34b2bb697b9a5d2b91a2cddd8c | Add wiki title to bot's welcome message | dotdoom/comicsbot,dotdoom/comicsbot | bot.py | bot.py | #!/usr/bin/env python2.7
# coding: utf-8
import inspect
import logging
logging.basicConfig()
import uuid
from comicsbot import ComicsBot
from dokuwiki import DokuWiki
from roomlogger import RoomLogger
execfile("config.py")
w = DokuWiki()
if w.dokuwiki.login(config["dokuwiki"]["username"],
config["dokuwiki"]... | #!/usr/bin/env python2.7
# coding: utf-8
import inspect
import logging
logging.basicConfig()
import uuid
from comicsbot import ComicsBot
from dokuwiki import DokuWiki
from roomlogger import RoomLogger
execfile("config.py")
w = DokuWiki()
if w.dokuwiki.login(config["dokuwiki"]["username"],
config["dokuwiki"]... | mit | Python |
a6c937562b5c04d0d3cd62d3eb51471722dce0f0 | Update phone_number_mnemonic.py | napplebee/EPI,napplebee/algorithms | epi/phone_number_mnemonic.py | epi/phone_number_mnemonic.py | # 6.22
mapping = {
2: ["a", "b", "c"],
3: ["d", "e", "f"],
4: ["g", "h", "i"],
5: ["j", "k", "l"],
6: ["m", "n", "o"],
7: ["p", "q", "r", "s"],
8: ["t", "u", "v"],
9: ["w", "x", "y", "z"]
}
def get_mnemonics_recursive(ph_num, mnemonic):
if len(ph_num) == 0:
print mnemonic
... | # 6.22
def get_mnemonics(ph_num, mapping):
pass
def test():
pass
| mit | Python |
8c8c5c38bf8095d334d5a540fc25ff3fe07f5d37 | Test new settings | luisfdez/oauthenticator,luisfdez/oauthenticator | example/jupyterhub_config.py | example/jupyterhub_config.py | # Configuration file for Jupyter Hub
import os
c = get_config()
c.JupyterHub.log_level = 10
c.JupyterHub.authenticator_class = 'oauthenticator.openshift.OpenShiftOAuthenticator'
c.JupyterHub.spawner_class = 'kubespawner.KubeSpawner'
c.JupyterHub.ip = '0.0.0.0'
c.JupyterHub.hub_ip = '0.0.0.0'
# Don't try to cleanup... | # Configuration file for Jupyter Hub
c = get_config()
c.JupyterHub.log_level = 10
c.JupyterHub.authenticator_class = 'oauthenticator.openshift.OpenShiftOAuthenticator'
c.JupyterHub.spawner_class = 'kubernetes_spawner.KubernetesSpawner'
c.KubernetesSpawner.verify_ssl = False
#c.KubernetesSpawner.hub_ip_from_service =... | bsd-3-clause | Python |
890860f89e353e6afb45dec06e3617f0f70e1ad7 | Remove time.sleep from example, no longer required | liquidinstruments/pymoku,benizl/pymoku | examples/basic_datalogger.py | examples/basic_datalogger.py | from pymoku import Moku
from pymoku.instruments import *
import time, logging
logging.basicConfig(format='%(asctime)s:%(name)s:%(levelname)s::%(message)s')
logging.getLogger('pymoku').setLevel(logging.INFO)
# Use Moku.get_by_serial() or get_by_name() if you don't know the IP
m = Moku.get_by_name('example')
i = Oscil... | from pymoku import Moku
from pymoku.instruments import *
import time, logging
logging.basicConfig(format='%(asctime)s:%(name)s:%(levelname)s::%(message)s')
logging.getLogger('pymoku').setLevel(logging.INFO)
# Use Moku.get_by_serial() or get_by_name() if you don't know the IP
m = Moku.get_by_name('example')
i = Oscil... | mit | Python |
f86a40ee9519bc7cd56296147376857802de239b | modify stable loop example | sunqm/pyscf,sunqm/pyscf,sunqm/pyscf,sunqm/pyscf | examples/scf/17-stability.py | examples/scf/17-stability.py | #!/usr/bin/env python
#
# Author: Qiming Sun <osirpt.sun@gmail.com>
#
'''
SCF wavefunction stability analysis
'''
from pyscf import gto, scf
mol = gto.M(atom='C 0 0 0; O 0 0 1.2', basis='631g*')
mf = scf.RHF(mol).run()
# Run stability analysis for the SCF wave function
mf.stability()
#
# This instability is associa... | #!/usr/bin/env python
#
# Author: Qiming Sun <osirpt.sun@gmail.com>
#
'''
SCF wavefunction stability analysis
'''
from pyscf import gto, scf
mol = gto.M(atom='C 0 0 0; O 0 0 1.2', basis='631g*')
mf = scf.RHF(mol).run()
# Run stability analysis for the SCF wave function
mf.stability()
#
# This instability is associa... | apache-2.0 | Python |
3232981112be6028ca691f09a2b0a87dedc6007d | store lml | glimix/limix-inference,limix/glimix-core,glimix/limix-inference | speed_1k.py | speed_1k.py | import numpy as np
import numpy_sugar as ns
from glimix_core.glmm import GLMMExpFam
if __name__ == '__main__':
nsamples = 1000
random = np.random.RandomState(1)
X = random.randn(nsamples, nsamples + 1)
X -= X.mean(0)
X /= X.std(0)
X /= np.sqrt(X.shape[1])
K = X.dot(X.T)
z = random.... | import numpy as np
import numpy_sugar as ns
from glimix_core.glmm import GLMMExpFam
if __name__ == '__main__':
nsamples = 1000
random = np.random.RandomState(1)
X = random.randn(nsamples, nsamples + 1)
X -= X.mean(0)
X /= X.std(0)
X /= np.sqrt(X.shape[1])
K = X.dot(X.T)
z = random.... | mit | Python |
70536212d5ea1dd265ad72ee2eaff333b17815f6 | Remove TODO, make output more clear. | cwyark/micropython,turbinenreiter/micropython,selste/micropython,toolmacher/micropython,HenrikSolver/micropython,ryannathans/micropython,adafruit/micropython,TDAbboud/micropython,swegener/micropython,infinnovation/micropython,ganshun666/micropython,cwyark/micropython,henriknelson/micropython,trezor/micropython,PappaPep... | examples/unix/ffi_example.py | examples/unix/ffi_example.py | import ffi
libc = ffi.open("libc.so.6")
print("libc:", libc)
print()
# Declare few functions
perror = libc.func("v", "perror", "s")
time = libc.func("i", "time", "p")
open = libc.func("i", "open", "si")
qsort = libc.func("v", "qsort", "piip")
# And one variable
errno = libc.var("i", "errno")
print("time:", time)
pri... | import ffi
libc = ffi.open("libc.so.6")
print("libc:", libc)
print()
# Declare few functions
perror = libc.func("v", "perror", "s")
time = libc.func("i", "time", "p")
open = libc.func("i", "open", "si")
qsort = libc.func("v", "qsort", "piip")
# And one variable
errno = libc.var("i", "errno")
print("time:", time)
pri... | mit | Python |
e0c19d6224868ba6a143f0d0f9e1cc92c000ef6c | set the CORS header for all responses | prigarimalla/piLight,prigarimalla/piLight,prigarimalla/piLight | src/api2.py | src/api2.py | from flask import Flask, request, Response
from flask_cors import CORS
import httplib, json
from LightManager import LightManager
app = Flask(__name__, static_url_path='')
CORS(app)
manager = LightManager()
def getColor():
if 'red' in request.args and 'green' in request.args and 'blue' in request.args:
... | from flask import Flask, request, Response
import httplib, json
from LightManager import LightManager
app = Flask(__name__, static_url_path='')
manager = LightManager()
def getColor():
if 'red' in request.args and 'green' in request.args and 'blue' in request.args:
color = (int(request.args.get('red')... | mit | Python |
fe0ac50ee3e40e2447ff7ccf33abdd54c974a8e3 | update journal stream for new API, event names | mediachain/mediachain-client,mediachain/mediachain-client | mediachain/transactor/client.py | mediachain/transactor/client.py | from grpc.beta import implementations
from mediachain.datastore.data_objects import Artefact, Entity, ChainCell, \
MultihashReference
from mediachain.proto import Transactor_pb2 #pylint: disable=no-name-in-module
from mediachain.reader.api import get_object
TIMEOUT_SECS = 120
def assert_canonical(record):
a... | from grpc.beta import implementations
from mediachain.datastore.data_objects import Artefact, Entity, ChainCell, \
MultihashReference
from mediachain.proto import Transactor_pb2 #pylint: disable=no-name-in-module
from mediachain.reader.api import get_object
TIMEOUT_SECS = 120
def assert_canonical(record):
a... | mit | Python |
96347d5e382a176e31e320f3104373686ba00039 | Add AST print flag | PetukhovVictor/compiler,PetukhovVictor/compiler | src/main.py | src/main.py | import argparse
import os
import sys
from Compiler.ASM.Core.run import compile_asm
from Compiler.VM.Helpers.run import compile_vm
from Interpreter.Helpers.run import interpret
from Lexer.run import run as lex
from Parser.run import parse
from Parser.Helpers.ast_printer import ast_print
from VM.parser import parse as v... | import argparse
import os
import sys
from Compiler.ASM.Core.run import compile_asm
from Compiler.VM.Helpers.run import compile_vm
from Interpreter.Helpers.run import interpret
from Lexer.run import run as lex
from Parser.run import parse
from Parser.Helpers.ast_printer import ast_print
from VM.parser import parse as v... | mit | Python |
5bb6e416cf7c59b7a5f85b1b0b037df7667d5d88 | Include all static files in build by default | hzdg/django-ecstatic,hzdg/django-staticbuilder | staticbuilder/conf.py | staticbuilder/conf.py | from appconf import AppConf
class StaticBuilderConf(AppConf):
BUILD_COMMANDS = []
COLLECT_BUILT = True
INCLUDE_FILES = ['*']
class Meta:
required = [
'BUILT_ROOT',
]
| from appconf import AppConf
class StaticBuilderConf(AppConf):
BUILD_COMMANDS = []
COLLECT_BUILT = True
INCLUDE_FILES = ['*.css', '*.js']
class Meta:
required = [
'BUILT_ROOT',
]
| mit | Python |
a97b557146edfb340ad83fd95838dc2a627ce32f | Fix urlconf to avoid string view arguments to url() | luac/django-argcache,luac/django-argcache | src/urls.py | src/urls.py |
__author__ = "Individual contributors (see AUTHORS file)"
__date__ = "$DATE$"
__rev__ = "$REV$"
__license__ = "AGPL v.3"
__copyright__ = """
This file is part of ArgCache.
Copyright (c) 2015 by the individual contributors
(see AUTHORS file)
This program is free software: you can redistribute it and/... |
__author__ = "Individual contributors (see AUTHORS file)"
__date__ = "$DATE$"
__rev__ = "$REV$"
__license__ = "AGPL v.3"
__copyright__ = """
This file is part of ArgCache.
Copyright (c) 2015 by the individual contributors
(see AUTHORS file)
This program is free software: you can redistribute it and/... | agpl-3.0 | Python |
d00d9a2473f95bceace95d8ef267ab6d2868a74b | Use ColorMode enum in velux (#70552) | mezz64/home-assistant,nkgilley/home-assistant,mezz64/home-assistant,toddeye/home-assistant,nkgilley/home-assistant,toddeye/home-assistant,w1ll1am23/home-assistant,w1ll1am23/home-assistant | homeassistant/components/velux/light.py | homeassistant/components/velux/light.py | """Support for Velux lights."""
from __future__ import annotations
from pyvlx import Intensity, LighteningDevice
from homeassistant.components.light import ATTR_BRIGHTNESS, ColorMode, LightEntity
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from ho... | """Support for Velux lights."""
from __future__ import annotations
from pyvlx import Intensity, LighteningDevice
from pyvlx.node import Node
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
COLOR_MODE_BRIGHTNESS,
LightEntity,
)
from homeassistant.core import HomeAssistant
from homeassistant.h... | apache-2.0 | Python |
1f796ca0e5a2c2469880a269425b753a8fb96f02 | Bump version to 4.1.1a1 | platformio/platformio-core,platformio/platformio-core,platformio/platformio | platformio/__init__.py | platformio/__init__.py | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | apache-2.0 | Python |
8ea10a18d3de95311f67397b4fc71850d33dbea0 | Bump version to 4.4.0b3 | platformio/platformio,platformio/platformio-core,platformio/platformio-core | platformio/__init__.py | platformio/__init__.py | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | apache-2.0 | Python |
f7930008fb2f6e0582d13e6d190229907dbdb834 | remove extra arg | XertroV/nodeup-xk-io,XertroV/nodeup-xk-io,XertroV/nodeup-xk-io,XertroV/nodeup-xk-io | nodeup-server/admin.py | nodeup-server/admin.py | import argparse
import logging
from models import ssh_management_key, vultr_api_key, xpub, Account, nodes_recently_updated, db, ssh_auditor_key, droplets_to_configure
from handlers import process_uid
from constants import MIN_TIME
from monitor_nodes import process_next_creation, configure_droplet
logging.basicConfig(... | import argparse
import logging
from models import ssh_management_key, vultr_api_key, xpub, Account, nodes_recently_updated, db, ssh_auditor_key, droplets_to_configure
from handlers import process_uid
from constants import MIN_TIME
from monitor_nodes import process_next_creation, configure_droplet
logging.basicConfig(... | mit | Python |
d96714270863a2a2dbf767b87a9bf25a6d223cfd | Add MemCache proxy, add redis.jget and redis.jset. | ooda/cloudly,ooda/cloudly | cloudly/cache.py | cloudly/cache.py | """This module provide access to redis and memcache servers with some sugar
coating.
"""
import os
import json
import memcache
import redis as pyredis
from cloudly.aws import ec2
from cloudly.memoized import Memoized
import cloudly.logger as logger
log = logger.init(__name__)
@Memoized
def get_redis_connection():... | import os
import redis as pyredis
from cloudly.aws import ec2
from cloudly.memoized import Memoized
import cloudly.logger as logger
log = logger.init(__name__)
@Memoized
def get_conn():
""" Get a connection to a Redis server. The priority is:
- look for an environment variable REDIS_HOST, else
... | mit | Python |
da6832ff0ba3b74b9ffcb2bdbfe6246cc029c740 | Add docstring to classproperty | DasIch/pyalysis,DasIch/pyalysis | pyalysis/utils.py | pyalysis/utils.py | # coding: utf-8
"""
pyalysis.utils
~~~~~~~~~~~~~~
:copyright: 2014 by Daniel Neuhäuser and Contributors
:license: BSD, see LICENSE.rst for details
"""
import math
import re
import codecs
import tokenize
from pyalysis._compat import PY2
# as defined in PEP 263
_magic_encoding_comment = re.compile("co... | # coding: utf-8
"""
pyalysis.utils
~~~~~~~~~~~~~~
:copyright: 2014 by Daniel Neuhäuser and Contributors
:license: BSD, see LICENSE.rst for details
"""
import math
import re
import codecs
import tokenize
from pyalysis._compat import PY2
# as defined in PEP 263
_magic_encoding_comment = re.compile("co... | bsd-3-clause | Python |
38347cda0d24f8bd267c95fe183d5bc6be1db4be | bump version | Technologicat/pydgq,Technologicat/pydgq | pydgq/__init__.py | pydgq/__init__.py | # -*- coding: utf-8 -*-
#
"""Integrate first-order ODE system u'(t) = f(u, t).
The main point of interest in this library is dG(q), i.e. the
time-discontinuous Galerkin method using a Lobatto basis
(a.k.a. hierarchical polynomial basis). See ivp().
For preparing the data file used by the integrator (pydgq_data.bin),... | # -*- coding: utf-8 -*-
#
"""Integrate first-order ODE system u'(t) = f(u, t).
The main point of interest in this library is dG(q), i.e. the
time-discontinuous Galerkin method using a Lobatto basis
(a.k.a. hierarchical polynomial basis). See ivp().
For preparing the data file used by the integrator (pydgq_data.bin),... | bsd-2-clause | Python |
c6b4a04b4a1e0abb1d81bc2be58c337b9f700df3 | Fix return object | corerd/PyDomo,corerd/PyDomo,corerd/PyDomo,corerd/PyDomo | pydimage/pilib.py | pydimage/pilib.py | #!/usr/bin/env python
# The MIT License (MIT)
#
# Copyright (c) 2015 Corrado Ubezio
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the ri... | #!/usr/bin/env python
# The MIT License (MIT)
#
# Copyright (c) 2015 Corrado Ubezio
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the ri... | mit | Python |
964d1e8ef44e8925635bceb9a34631f609568a56 | add missing import to reconst_dsid.py | villalonreina/dipy,StongeEtienne/dipy,matthieudumont/dipy,villalonreina/dipy,FrancoisRheaultUS/dipy,nilgoyyou/dipy,nilgoyyou/dipy,FrancoisRheaultUS/dipy,matthieudumont/dipy,StongeEtienne/dipy | doc/examples/reconst_dsid.py | doc/examples/reconst_dsid.py | """
========================
DSI Deconvolution vs DSI
========================
An alternative method to DSI is the method proposed by [Canales10]_ which is
called DSI with Deconvolution. This algorithm is using Lucy-Richardson
deconvolution in the diffusion propagator with the goal to create sharper ODFs
with higher a... | """
========================
DSI Deconvolution vs DSI
========================
An alternative method to DSI is the method proposed by [Canales10]_ which is
called DSI with Deconvolution. This algorithm is using Lucy-Richardson
deconvolution in the diffusion propagator with the goal to create sharper ODFs
with higher a... | bsd-3-clause | Python |
dbe1bc624c93b019eefe588f1e48050e19132b4b | update format json module, update otype to itype, similar to issue #53 | csirtgadgets/csirtgsdk-py | whitefacesdk/format/format_json.py | whitefacesdk/format/format_json.py | import json
import sys
from whitefacesdk.constants import COLUMNS, MAX_FIELD_SIZE
class JSON(object):
def __init__(self, data, cols=COLUMNS, max_field_size=MAX_FIELD_SIZE):
cols += [u'firsttime', u'created_at', u'itype', u'lasttime', u'id']
self.cols = cols
self.max_field_size = max_fiel... | import json
import sys
from whitefacesdk.constants import COLUMNS, MAX_FIELD_SIZE
class JSON(object):
def __init__(self, data, cols=COLUMNS, max_field_size=MAX_FIELD_SIZE):
cols += [u'firsttime', u'created_at', u'otype', u'lasttime', u'id']
self.cols = cols
self.max_field_size = max_fiel... | mpl-2.0 | Python |
4e56e3cde29f61d187c84c2cc286becb9ded93e8 | Add comments to configuration settings | loomchild/puffin,loomchild/jenca-puffin,loomchild/jenca-puffin,loomchild/puffin,puffinrocks/puffin,loomchild/puffin,puffinrocks/puffin,loomchild/puffin,loomchild/puffin | puffin/core/config.py | puffin/core/config.py | import subprocess, re, os
from ..util.homer import HOME
from .. import app
class DefaultConfig:
# Interface and port where to serve Puffin
HOST = "0.0.0.0"
PORT = 8080
# Number of threads serving the requests (keep in mind in CPython there's [GIL]()).
THREADS = 1
# Debugging settings, they ... | import subprocess, re, os
from ..util.homer import HOME
from .. import app
class DefaultConfig:
HOST = "0.0.0.0"
PORT = 8080
THREADS = 1
DEBUG = False
TESTING = False
SERVER_NAME = None
APPLICATION_ROOT = None
SECRET_KEY = b"puffin"
DB_HOST = "localhost"
DB_PORT = "5432... | agpl-3.0 | Python |
fb47455f7e0d4e0ac51f8e2cc29a5168a38957ee | Tweak BTG SEC prefix. | richardkiss/pycoin,richardkiss/pycoin | pycoin/symbols/btg.py | pycoin/symbols/btg.py | from pycoin.networks.bitcoinish import create_bitcoinish_network
from pycoin.coins.bgold.Tx import Tx as BgoldTx
from pycoin.coins.bgold.Block import Block as BgoldBlock
# fork at block 491407
network = create_bitcoinish_network(
symbol="BTG", network_name="Bgold", subnet_name="mainnet", tx=BgoldTx, block=BgoldB... | from pycoin.networks.bitcoinish import create_bitcoinish_network
from pycoin.coins.bgold.Tx import Tx as BgoldTx
from pycoin.coins.bgold.Block import Block as BgoldBlock
# fork at block 491407
network = create_bitcoinish_network(
symbol="BTG", network_name="Bgold", subnet_name="mainnet", tx=BgoldTx, block=BgoldB... | mit | Python |
828839c56741e97a58e6ffc2ec49cdaa9da8af64 | manage Temperature on DXL | pollen/pyrobus | pyluos/modules/dxl.py | pyluos/modules/dxl.py | from .module import Module, interact
class DynamixelMotor(Module):
def __init__(self, id, alias, robot):
Module.__init__(self, 'DynamixelMotor', id, alias, robot)
# Read
self.position = None
self.temperature = None
# Write
self._target_position = None
self._... | from .module import Module, interact
class DynamixelMotor(Module):
def __init__(self, id, alias, robot):
Module.__init__(self, 'DynamixelMotor', id, alias, robot)
# Read
self.position = None
# Write
self._target_position = None
self._moving_speed = None
self... | mit | Python |
2d44f2ceaf6405dd38966f964925ef053bdc2615 | Bump version to 0.1.4. | Digsolab/pymystem3 | pymystem3/metadata.py | pymystem3/metadata.py | # -*- coding: utf-8 -*-
"""Project metadata.
Information describing the project.
"""
# The package name, which is also the "UNIX name" for the project.
package = 'pymystem3'
project = "Python MyStem 3"
project_no_spaces = project.replace(' ', '-')
version = '0.1.4'
description = 'Python wrapper for the Yandex MyStem ... | # -*- coding: utf-8 -*-
"""Project metadata.
Information describing the project.
"""
# The package name, which is also the "UNIX name" for the project.
package = 'pymystem3'
project = "Python MyStem 3"
project_no_spaces = project.replace(' ', '-')
version = '0.1.3'
description = 'Python wrapper for the Yandex MyStem ... | mit | Python |
ff8ddd52e9ab459db25365f2950a752d0ea8c124 | add own GenericFunction | geoalchemy/geoalchemy2 | geoalchemy2/sql/functions.py | geoalchemy2/sql/functions.py | from sqlalchemy.sql import functions
from .. import types
class GenericFunction(functions.GenericFunction):
def __init__(self, *args, **kwargs):
expr = kwargs.pop('expr', None)
if expr is not None:
args = (expr,) + args
functions.GenericFunction.__init__(self, *args, **kwargs... | from sqlalchemy.sql.functions import GenericFunction
from .. import types
class GeometryType(GenericFunction):
name = 'ST_GeometryType'
identifier = 'geometry_type'
package = 'geo'
class Buffer(GenericFunction):
name = 'ST_Buffer'
identifier = 'buffer'
type_ = types.Geometry
package = '... | mit | Python |
248dbe0e533c7d97c0d60570811f782c6d60bff0 | Fix SD data source | GoogleCloudPlatform/covid-19-open-data,GoogleCloudPlatform/covid-19-open-data | src/pipelines/epidemiology/sd_humdata.py | src/pipelines/epidemiology/sd_humdata.py | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | apache-2.0 | Python |
b5332e11f2124076d6d2faef7770ef39836aa9df | Add `get_api_url` helper function | os/slacker | slacker/utilities.py | slacker/utilities.py | def get_api_url(method):
"""
Returns API URL for the given method.
:param method: Method name
:type method: str
:returns: API URL for the given method
:rtype: str
"""
return 'https://slack.com/api/{}'.format(method)
def get_item_id_by_name(list_dict, key_name):
for d in list_dict... | #!/usr/bin/python
# -*- coding: utf-8 -*-
def get_item_id_by_name(list_dict, key_name):
for d in list_dict:
if d['name'] == key_name:
return d['id']
| apache-2.0 | Python |
7cf34b2f6351789ff3b8d15da6b9e1a87fdd6762 | Fix TestAttachDenied.py remote execution on Linux. | apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb | test/functionalities/process_attach/attach_denied/TestAttachDenied.py | test/functionalities/process_attach/attach_denied/TestAttachDenied.py | """
Test denied process attach.
"""
import os
import time
import unittest2
import lldb
from lldbtest import *
exe_name = 'AttachDenied' # Must match Makefile
class AttachDeniedTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
def run_platform_command(self, cmd):
platform = self.dbg.GetS... | """
Test denied process attach.
"""
import os
import shutil
import tempfile
import unittest2
import lldb
from lldbtest import *
exe_name = 'AttachDenied' # Must match Makefile
class AttachDeniedTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipIfWindows
def test_attach_to_process_by_id... | apache-2.0 | Python |
c9fed17fd41e5e494b4fd0f27887273090f76a57 | Bump the timeout to 10 minutes | lichia/docker-scripts,jpopelka/docker-scripts,TomasTomecek/docker-scripts,goldmann/docker-squash,goldmann/docker-scripts | docker_scripts/lib/common.py | docker_scripts/lib/common.py | # -*- coding: utf-8 -*-
import docker
import os
import sys
import requests
DEFAULT_TIMEOUT_SECONDS = 600
def docker_client():
# Default timeout 10 minutes
try:
timeout = int(os.getenv('DOCKER_TIMEOUT', 600))
except ValueError as e:
print("Provided timeout value: %s cannot be parsed as i... | # -*- coding: utf-8 -*-
import docker
import os
import sys
import requests
def docker_client():
if os.environ.get('DOCKER_CONNECTION'):
try:
client = docker.Client(base_url=os.environ['DOCKER_CONNECTION'])
except docker.errors.DockerException as e:
print("Error while creat... | mit | Python |
1ea6a0b43e4b05bdb743b0e2be86174062581d03 | Add a new error code | mhl/gib,mhl/gib | errors.py | errors.py | class Errors:
'''enum-like values to use as exit codes'''
USAGE_ERROR = 1
DEPENDENCY_NOT_FOUND = 2
VERSION_ERROR = 3
GIT_CONFIG_ERROR = 4
STRANGE_ENVIRONMENT = 5
EATING_WITH_STAGED_CHANGES = 6
BAD_GIT_DIRECTORY = 7
BRANCH_EXISTS_ON_INIT = 8
NO_SUCH_BRANCH = 9
REPOSITORY_NOT_I... | class Errors:
'''enum-like values to use as exit codes'''
USAGE_ERROR = 1
DEPENDENCY_NOT_FOUND = 2
VERSION_ERROR = 3
GIT_CONFIG_ERROR = 4
STRANGE_ENVIRONMENT = 5
EATING_WITH_STAGED_CHANGES = 6
BAD_GIT_DIRECTORY = 7
BRANCH_EXISTS_ON_INIT = 8
NO_SUCH_BRANCH = 9
REPOSITORY_NOT_I... | lgpl-2.1 | Python |
5d57c4919cc9bd4db56dc79127544bdf8effc304 | Fix encoding of client secret | ByteInternet/django-oidc-provider,wojtek-fliposports/django-oidc-provider,wojtek-fliposports/django-oidc-provider,bunnyinc/django-oidc-provider,juanifioren/django-oidc-provider,torreco/django-oidc-provider,ByteInternet/django-oidc-provider,torreco/django-oidc-provider,juanifioren/django-oidc-provider,bunnyinc/django-oi... | oidc_provider/admin.py | oidc_provider/admin.py | from hashlib import md5
from random import randint
from uuid import uuid4
from django.forms import ModelForm
from django.contrib import admin
from oidc_provider.models import Client, Code, Token, RSAKey
class ClientForm(ModelForm):
class Meta:
model = Client
exclude = []
def __init__(self,... | from hashlib import md5
from random import randint
from uuid import uuid4
from django.forms import ModelForm
from django.contrib import admin
from oidc_provider.models import Client, Code, Token, RSAKey
class ClientForm(ModelForm):
class Meta:
model = Client
exclude = []
def __init__(self,... | mit | Python |
c29f55196f97ef3fa70124628fd94c78b90162ea | Add an option to output both realtime and monotime. | synety-jdebp/rtpproxy,dsanders11/rtpproxy,synety-jdebp/rtpproxy,jevonearth/rtpproxy,jevonearth/rtpproxy,synety-jdebp/rtpproxy,sippy/rtpproxy,dsanders11/rtpproxy,jevonearth/rtpproxy,jevonearth/rtpproxy,dsanders11/rtpproxy,sippy/rtpproxy,synety-jdebp/rtpproxy,sippy/rtpproxy | python/getmonotime.py | python/getmonotime.py | import getopt, sys
if __name__ == '__main__':
sippy_path = None
try:
opts, args = getopt.getopt(sys.argv[1:], 'rS:')
except getopt.GetoptError:
usage()
out_realtime = False
for o, a in opts:
if o == '-S':
sippy_path = a.strip()
continue
if o... | import getopt, sys
if __name__ == '__main__':
sippy_path = None
try:
opts, args = getopt.getopt(sys.argv[1:], 's:S:i:o:b')
except getopt.GetoptError:
usage()
for o, a in opts:
if o == '-S':
sippy_path = a.strip()
continue
if sippy_path != None:
... | bsd-2-clause | Python |
14b73fd8ff7e12b14fc3986c7b962afef40f37dc | Add new helper | sayoun/pyvac,sayoun/pyvac,sayoun/pyvac | pyvac/helpers/util.py | pyvac/helpers/util.py | # -*- coding: utf-8 -*-
import json
from ldap import dn
from datetime import timedelta
from pyramid.httpexceptions import HTTPNotFound
def flash_type(message):
if ';' in message:
return message.split(';', 1)[0]
return 'error'
def flash_msg(message):
if ';' in message:
return message.spli... | # -*- coding: utf-8 -*-
import json
from ldap import dn
from datetime import timedelta
from pyramid.httpexceptions import HTTPNotFound
def flash_type(message):
if ';' in message:
return message.split(';', 1)[0]
return 'error'
def flash_msg(message):
if ';' in message:
return message.spli... | bsd-3-clause | Python |
8fd6f3ba4af6886e7fa4e0b7138fa663fe76d604 | fix scaling of BitmapFunction | michaellaier/pymor,michaellaier/pymor,michaellaier/pymor,michaellaier/pymor | src/pymor/playground/functions/bitmap.py | src/pymor/playground/functions/bitmap.py | # This file is part of the pyMOR project (http://www.pymor.org).
# Copyright Holders: Rene Milk, Stephan Rave, Felix Schindler
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
from __future__ import absolute_import, division, print_function
import numpy as np
from pymor.functions.basic i... | # This file is part of the pyMOR project (http://www.pymor.org).
# Copyright Holders: Rene Milk, Stephan Rave, Felix Schindler
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
from __future__ import absolute_import, division, print_function
import numpy as np
from pymor.functions.basic i... | bsd-2-clause | Python |
0af4866b5a97a33c6e3f3d4c8b175d8706034164 | Fix 9.0 version number | thinkopensolutions/server-tools,thinkopensolutions/server-tools,JayVora-SerpentCS/server-tools,ovnicraft/server-tools,ClearCorp/server-tools,ovnicraft/server-tools,JayVora-SerpentCS/server-tools,ovnicraft/server-tools,ClearCorp/server-tools | users_ldap_populate/__openerp__.py | users_ldap_populate/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2012 Therp BV (<http://therp.nl>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2012 Therp BV (<http://therp.nl>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... | agpl-3.0 | Python |
39bdb772c97a2d8d0ed6c56ce651337f8a8c4548 | Add cbz option and messages are now displayed properly | J-CPelletier/webcomix,J-CPelletier/webcomix,J-CPelletier/WebComicToCBZ | gui.py | gui.py | #! python3
# -*- coding: utf-8 -*-
import sys
from main import supported_comics
from comic import Comic
from PyQt5.QtWidgets import (QWidget, QLabel,
QComboBox, QApplication,
QPushButton, QTextEdit,
QCheckBox)
import click
class ... | #! python3
# -*- coding: utf-8 -*-
import sys
from main import supported_comics
from comic import Comic
from PyQt5.QtWidgets import (QWidget, QLabel,
QComboBox, QApplication,
QPushButton, QTextEdit,
QCheckBox)
import click
class ... | mit | Python |
c7434b524be39274f9913901bec76b1ed9ea134b | Update test_create_mapping | 4dn-dcic/fourfront,kidaa/encoded,ENCODE-DCC/encoded,ENCODE-DCC/snovault,ENCODE-DCC/snovault,ENCODE-DCC/snovault,4dn-dcic/fourfront,hms-dbmi/fourfront,hms-dbmi/fourfront,philiptzou/clincoded,kidaa/encoded,philiptzou/clincoded,kidaa/encoded,ENCODE-DCC/encoded,ENCODE-DCC/snovault,ENCODE-DCC/encoded,ENCODE-DCC/snovault,T2D... | src/encoded/tests/test_create_mapping.py | src/encoded/tests/test_create_mapping.py | import pytest
from ..loadxl import ORDER
@pytest.mark.parametrize('item_type', ORDER)
def test_create_mapping(root, registry, item_type):
from ..commands.create_mapping import collection_mapping
collection = root[item_type]
calculated_properties = registry['calculated_properties']
mapping = collection... | import pytest
from ..loadxl import ORDER
@pytest.mark.parametrize('item_type', ORDER)
def test_create_mapping(root, item_type):
from ..commands.create_mapping import collection_mapping
collection = root[item_type]
mapping = collection_mapping(collection)
assert mapping
| mit | Python |
f5056c2949903c4f67d3f556d88c8f4523e93212 | Revert "Add debug print to see why tests are failing on travis." | Plexxi/st2,nzlosh/st2,Plexxi/st2,StackStorm/st2,Plexxi/st2,Plexxi/st2,StackStorm/st2,nzlosh/st2,nzlosh/st2,nzlosh/st2,StackStorm/st2,StackStorm/st2 | st2common/st2common/util/monkey_patch.py | st2common/st2common/util/monkey_patch.py | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | apache-2.0 | Python |
6601402491499236a39d83b1981acaee1a9a78f4 | update py file. | wangdiwen/ip2geo | ip2geo.py | ip2geo.py | #!/usr/bin/python3
# encoding=utf-8
import argparse
import requests
import urllib
import re
# parse the console params
parser = argparse.ArgumentParser()
parser.add_argument('domain', help='a domain like baidu.com | a ipv4 addr', type=str)
parser.add_argument('-v', help='show request detail info', action='store_true'... | #!/usr/bin/python3
# encoding=utf-8
import argparse
import requests
import urllib
import re
# parse the console params
parser = argparse.ArgumentParser()
parser.add_argument('domain', help='a domain like baidu.com | a ipv4 addr', type=str)
parser.add_argument('-v', help='show request detail info', action='store_true'... | mit | Python |
e8205431bf98b18a978d5f42aac3f5680ecf42b5 | Update benchmark script | kz26/PyExcelerate | pyexcelerate/tests/benchmark.py | pyexcelerate/tests/benchmark.py | from ..Workbook import Workbook
import openpyxl
import xlsxwriter.workbook
import time
ROWS = 6500
COLUMNS = 100
testData = [[1] * COLUMNS] * ROWS
def run_pyexcelerate():
wb = Workbook()
stime = time.clock()
ws = wb.new_sheet("Test 1", data=testData)
wb.save("test_pyexcelerate.xlsx")
print "pyexce... | from ..Workbook import Workbook
import openpyxl
import xlsxwriter.workbook
import time
ROWS = 6500
COLUMNS = 100
testData = [[1] * COLUMNS] * ROWS
def run_pyexcelerate():
wb = Workbook()
stime = time.clock()
ws = wb.new_sheet("Test 1", data=testData)
wb.save("test_pyexcelerate.xlsx")
print "pyexcel... | bsd-2-clause | Python |
c365466e6db18f31d57e7293f99907a6a48d9717 | Update __init__.py | inkenbrandt/loggerloader | loggerloader/__init__.py | loggerloader/__init__.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import os
from .transport import *
__version__ = '0.1.0'
__author__ = 'Paul Inkenbrandt'
__name__ = 'loggerloader'
__all__ = ['well_baro_merge']
| # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import os
from .transport import *
from .usgs import *
from .chem import *
from .mesopy import *
from .graphs import *
from .MannKendall import *
__version__ = '0.1.0'
__author__ = 'Paul Inkenbrandt'
__name__ =... | mit | Python |
967e78dcda1ad7df49ea8b32cf0f5b560b4537c2 | Remove useless import in previews | novafloss/django-mail-factory,novafloss/django-mail-factory | mail_factory/previews.py | mail_factory/previews.py | # -*- coding: utf-8 -*-
from django.conf import settings
from mail_factory.messages import EmailMultiRelated
class PreviewMessage(EmailMultiRelated):
def has_body_html(self):
"""Test if a message contains an alternative rendering in text/html"""
return 'text/html' in self.rendering_formats
@... | # -*- coding: utf-8 -*-
from django.conf import settings
from django.utils.encoding import smart_str
from mail_factory.messages import EmailMultiRelated
class PreviewMessage(EmailMultiRelated):
def has_body_html(self):
"""Test if a message contains an alternative rendering in text/html"""
return ... | bsd-3-clause | Python |
0ab5044c1539014d4ad11dabbfb403e259301f29 | Remove use of deprecated django.conf.urls.url | tomhoule/django-minio-storage | tests/django_minio_storage_tests/urls.py | tests/django_minio_storage_tests/urls.py | """django_minio_storage_tests URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/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, nam... | """django_minio_storage_tests URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/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, nam... | apache-2.0 | Python |
8f361bb17cb71c02971a4a45e57662fa2af49d02 | Append datetime to name of old directory. | rsmith-nl/scripts,rsmith-nl/scripts | old.py | old.py | #!/usr/bin/env python3
# vim:fileencoding=utf-8
#
# Author: R.F. Smith <rsmith@xs4all.nl>
# Created: 2014-02-10 21:43:11 +0100
# Last modified: 2016-06-26 11:33:55 +0200
#
# To the extent possible under law, R.F. Smith has waived all copyright and
# related or neighboring rights to old.py. This work is published
# from... | #!/usr/bin/env python3
# vim:fileencoding=utf-8
#
# Author: R.F. Smith <rsmith@xs4all.nl>
# Created: 2014-02-10 21:43:11 +0100
# Last modified: 2016-06-26 11:17:51 +0200
#
# To the extent possible under law, R.F. Smith has waived all copyright and
# related or neighboring rights to old.py. This work is published
# from... | mit | Python |
4f4c850099df86f3696d3f1dee93d184d2367827 | remove unused variable | mutantmonkey/yubikey-googleauth | otp.py | otp.py | #!/usr/bin/python3
################################################################################
# otp.py - Google OTP generator with secret stored on Yubikey
#
# author: mutantmonkey <mutantmonkey@mutantmonkey.in>
################################################################################
import binascii
impo... | #!/usr/bin/python3
################################################################################
# otp.py - Google OTP generator with secret stored on Yubikey
#
# author: mutantmonkey <mutantmonkey@mutantmonkey.in>
################################################################################
import binascii
impo... | isc | Python |
bce90f2ea1c29b27c565a9c389e22b5915f724a4 | add a vref accessor for slices | dreibh/planetlab-lxc-plcapi,dreibh/planetlab-lxc-plcapi,dreibh/planetlab-lxc-plcapi,dreibh/planetlab-lxc-plcapi | PLC/Accessors/Accessors_standard.py | PLC/Accessors/Accessors_standard.py | # Thierry Parmentelat - INRIA
# $Id$
from PLC.Nodes import Node
from PLC.Interfaces import Interface
from PLC.Slices import Slice
from PLC.Ilinks import Ilink
from PLC.Accessors.Factory import define_accessors, all_roles, tech_roles
import sys
current_module = sys.modules[__name__]
# NOTE.
# most of these tag types... | # Thierry Parmentelat - INRIA
# $Id$
from PLC.Nodes import Node
from PLC.Interfaces import Interface
from PLC.Slices import Slice
from PLC.Ilinks import Ilink
from PLC.Accessors.Factory import define_accessors, all_roles, tech_roles
import sys
current_module = sys.modules[__name__]
# NOTE.
# most of these tag types... | bsd-3-clause | Python |
3c7698d69f7e328e2760e31c1db97ee152f8e4d3 | Clean import | jdauphant/ansible-cloudsigma-inventory | cloudsigma-inventory.py | cloudsigma-inventory.py | #!/usr/bin/env python
'''
Cloudsigma external inventory script
=================================
Generates inventory that Ansible can understand by making API request to
Cloudsigma using the cloudsigma library.
NOTE: This script assumes Ansible is being executed where the environment
variables needed for cloudsigma l... | #!/usr/bin/env python
'''
Cloudsigma external inventory script
=================================
Generates inventory that Ansible can understand by making API request to
Cloudsigma using the cloudsigma library.
NOTE: This script assumes Ansible is being executed where the environment
variables needed for cloudsigma l... | bsd-2-clause | Python |
4016f9a9de41a09973f9011c13111c0b0021fd95 | Update XenBus to #117 | xenserver/win-installer,OwenSmith/win-installer,xenserver/win-installer,xenserver/win-installer,xenserver/win-installer,OwenSmith/win-installer,xenserver/win-installer,OwenSmith/win-installer,OwenSmith/win-installer,OwenSmith/win-installer | manifestspecific.py | manifestspecific.py | # Copyright (c) Citrix Systems 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 of conditions a... | # Copyright (c) Citrix Systems 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 of conditions a... | bsd-2-clause | Python |
1d1d7eaefe1205281ebda2d25199dff84d4fc7e6 | add Status.log_status | webkom/coffee,webkom/coffee | coffee/models.py | coffee/models.py | import redis
from datetime import datetime
from coffee.config import app_config
class Status (object):
def __init__(self):
self.redis = redis.Redis(
host=app_config['REDIS_HOST'],
port=app_config['REDIS_PORT'],
db=app_config['REDIS_DB'],
password=app_conf... | import redis
from datetime import datetime
from coffee.config import app_config
class Status (object):
def __init__(self):
self.redis = redis.Redis(
host=app_config['REDIS_HOST'],
port=app_config['REDIS_PORT'],
db=app_config['REDIS_DB'],
password=app_conf... | mit | Python |
89ace8e82e154e3243310812ea68eb13a6ac8e12 | Update the launcher to handle the new service threads | adamnew123456/jobmon | jobmon/launcher.py | jobmon/launcher.py | """
JobMon Launcher
===============
Launches the JobMon supervisor as a daemon - generally, the usage pattern for
this module will be something like the following::
>>> from jobmon import config
>>> config_handler = config.ConfigHandler
>>> config_handler.load(SOME_FILE)
>>> run(config_handler)
"""
im... | """
JobMon Launcher
===============
Launches the JobMon supervisor as a daemon - generally, the usage pattern for
this module will be something like the following::
>>> from jobmon import config
>>> config_handler = config.ConfigHandler
>>> config_handler.load(SOME_FILE)
>>> run(config_handler)
"""
im... | bsd-2-clause | Python |
35a4dc39ca66395384d2c5e29957b4aad2c2644c | fix ia mine docopt parsing issue. Fixes #31 | JesseWeinstein/internetarchive,jjjake/internetarchive,wumpus/internetarchive,brycedrennan/internetarchive,dattasaurabh82/internetarchive | iacli/ia_mine.py | iacli/ia_mine.py | """Concurrently download metadata for items on Archive.org.
usage:
ia mine [--cache | --output=<output.json>] [--workers=<count>] <itemlist.txt>
ia mine --help
options:
-h, --help
-c, --cache Write item metadata to a file called <identifier>_meta.json
-o, --output=<output.json> ... | """Concurrently download metadata for items on Archive.org.
usage:
ia mine [--cache | --output=<output.json>] [--workers] <itemlist.txt>
ia mine --help
options:
-h, --help
-c, --cache Write item metadta to a file called <identifier>_meta.json
-o, --output=<output.json> Write all... | agpl-3.0 | Python |
0d18ccf482aa33a0ea3fc283db77398526d9caa0 | bump version | obestwalter/mau-mau | mau_mau/__init__.py | mau_mau/__init__.py | __version__ = '4.0.0'
| __version__ = '1.1.0.dev0'
| mit | Python |
4f26fac210caa4bd74725eb86c65247201b88ffb | Add image resize option for better performance | mkermani144/sudo-make-me-a-sandwitch | color-palette.py | color-palette.py | '''
This script generates a color pallete containing the colors which are most used
in a picture.
'''
import sys
from PIL import Image
from collections import Counter as counter
from optparse import OptionParser
def rgb_to_hex(rgb):
return '#{:02x}{:02x}{:02x}'.format(*rgb)
parser = OptionParser('Usage: color-pa... | '''
This script generates a color pallete containing the colors which are most used
in a picture.
'''
import sys
from PIL import Image
from collections import Counter as counter
from optparse import OptionParser
def rgb_to_hex(rgb):
return '#{:02x}{:02x}{:02x}'.format(*rgb)
parser = OptionParser('Usage: color-pa... | mit | Python |
cc6e9e0af8bc3a654070c34ec8b069beec8f033a | Add TODO | renalreg/radar,renalreg/radar,renalreg/radar,renalreg/radar | radar/models/posts.py | radar/models/posts.py | from sqlalchemy import Column, Integer, Text, DateTime
from radar.lib.database import db
# TODO add metadata
class Post(db.Model):
__tablename__ = 'posts'
id = Column(Integer, primary_key=True)
title = Column(Text, nullable=False)
body = Column(Text, nullable=False)
published = Column(DateTime... | from sqlalchemy import Column, Integer, Text, DateTime
from radar.lib.database import db
class Post(db.Model):
__tablename__ = 'posts'
id = Column(Integer, primary_key=True)
title = Column(Text, nullable=False)
body = Column(Text, nullable=False)
published = Column(DateTime(timezone=True), nulla... | agpl-3.0 | Python |
4a9e9c7e4dae95cba37572961711e34f719475fb | Update __init__.py | xmedius/xmedius-mailrelayserver | xmediusmailrelayserver/__init__.py | xmediusmailrelayserver/__init__.py | from xmediusmailrelayserver import *
| from xmediusrelayserver import *
| mit | Python |
26668ba5e53d648e34cc8bc661b326f49f6d2721 | change local to heroku path | nokia-wroclaw/innovativeproject-cross-app-links,nokia-wroclaw/innovativeproject-cross-app-links,nokia-wroclaw/innovativeproject-cross-app-links | api/mail.py | api/mail.py | from flask import Flask, render_template
from api import app
from api.models import User, Invites
from flask_mail import Mail
from flask_mail import Message
app.config.update(
MAIL_SERVER = 'smtp.yandex.com',
MAIL_PORT = 465,
MAIL_USE_SSL = True ,
MAIL_USERNAME = 'cross-apps@yandex.com',
MAIL_... | from flask import Flask, render_template
from api import app
from api.models import User, Invites
from flask_mail import Mail
from flask_mail import Message
app.config.update(
MAIL_SERVER = 'smtp.yandex.com',
MAIL_PORT = 465,
MAIL_USE_SSL = True ,
MAIL_USERNAME = 'cross-apps@yandex.com',
MAIL_... | mit | Python |
75dbd6cea16b6d8c59ae3f26691a22419f2a8269 | Fix publisher autocomplete so searches is case-insensitive | Princeton-CDH/winthrop-django,Princeton-CDH/winthrop-django,Princeton-CDH/winthrop-django | winthrop/books/views.py | winthrop/books/views.py | from dal import autocomplete
from .models import Publisher
class PublisherAutocomplete(autocomplete.Select2QuerySetView):
# basic publisher autocomplete lookup, based on
# django-autocomplete-light tutorial
# restricted to staff only in url config
def get_queryset(self):
return Publisher.obj... | from dal import autocomplete
from .models import Publisher
class PublisherAutocomplete(autocomplete.Select2QuerySetView):
# basic publisher autocomplete lookup, based on
# django-autocomplete-light tutorial
# restricted to staff only in url config
def get_queryset(self):
return Publisher.obj... | apache-2.0 | Python |
4073677432b60eb416eb06949ea6a6cc74ba0354 | Make flake8 happy | evernym/plenum,evernym/zeno | plenum/common/timer.py | plenum/common/timer.py | from abc import ABC, abstractmethod
from bisect import bisect_right
from typing import Callable
import time
class TimerInterface(ABC):
@abstractmethod
def schedule(self, delay: int, callback: Callable):
pass
@abstractmethod
def cancel(self, callback: Callable):
pass
class Timer(Tim... | from abc import ABC, abstractmethod
from bisect import bisect_right
from typing import Callable
import time
class TimerInterface(ABC):
@abstractmethod
def schedule(self, delay: int, callback: Callable):
pass
@abstractmethod
def cancel(self, callback: Callable):
pass
class Timer(Tim... | apache-2.0 | Python |
1bef7fd0986b5abb3e990d05a8877ec1f1ba74d2 | change tempdir | trichter/rf | rf/tests/util.py | rf/tests/util.py | # Author: Tom Richter
import contextlib
import os
import shutil
import sys
import tempfile
class _Devnull(object):
def write(self, _):
pass
@contextlib.contextmanager
def quiet():
stdout_save = sys.stdout
sys.stdout = _Devnull()
try:
yield
finally:
sys.stdout = stdout_s... | # Author: Tom Richter
import contextlib
import os
import shutil
import sys
import tempfile
class _Devnull(object):
def write(self, _):
pass
@contextlib.contextmanager
def quiet():
stdout_save = sys.stdout
sys.stdout = _Devnull()
try:
yield
finally:
sys.stdout = stdout_s... | mit | Python |
c88a0b09003fba409c15541579f77a3c2340ace7 | use dict.copy() | timchen86/gdcmdtools,tienfuc/gdcmdtools,commonssibi/gdcmdtools | gdperm.py | gdperm.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from gdcmdtools.perm import GDPerm
from gdcmdtools.perm import permission_resource_properties
import argparse
from argparse import RawTextHelpFormatter
from gdcmdtools.base import BASE_INFO
import logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from gdcmdtools.perm import GDPerm
from gdcmdtools.perm import permission_resource_properties
import argparse
from argparse import RawTextHelpFormatter
import copy
from gdcmdtools.base import BASE_INFO
import logging
logger = logging.getLogger(__name__)
logger.setLevel... | bsd-2-clause | Python |
0ac059f2335f1b16407ef5507a07b12da44e8111 | Add pad widget. | peterhinch/micropython-lcd160cr-gui | gui/widgets/pad.py | gui/widgets/pad.py | # pad.py Extension to lcd160gui providing the invisible touchpad class
# Released under the MIT License (MIT). See LICENSE.
# Copyright (c) 2020 Peter Hinch
# Usage: import classes as required:
# from gui.widgets.pad import Pad
import uasyncio as asyncio
from gui.core.lcd160_gui import Touchable
from gui.primitives... | # pad.py Extension to lcd160gui providing the invisible touchpad class
# Released under the MIT License (MIT). See LICENSE.
# Copyright (c) 2020 Peter Hinch
# Usage: import classes as required:
# from gui.widgets.pad import Pad
import uasyncio as asyncio
from gui.core.lcd160_gui import Touchable
from gui.primitives... | mit | Python |
372a23988e098f03a986eed6e7f45ccc6635aa4c | Fix tests to use {% load url from future %} | pjdelport/feincms,nickburlett/feincms,matthiask/feincms2-content,pjdelport/feincms,matthiask/django-content-editor,feincms/feincms,michaelkuty/feincms,matthiask/django-content-editor,joshuajonah/feincms,mjl/feincms,michaelkuty/feincms,mjl/feincms,nickburlett/feincms,nickburlett/feincms,joshuajonah/feincms,matthiask/dja... | tests/testapp/applicationcontent_urls.py | tests/testapp/applicationcontent_urls.py | """
This is a dummy module used to test the ApplicationContent
"""
from django import template
from django.conf.urls.defaults import *
from django.http import HttpResponse, HttpResponseRedirect
from feincms.views.decorators import standalone
def module_root(request):
return 'module_root'
def args_test(request... | """
This is a dummy module used to test the ApplicationContent
"""
from django import template
from django.conf.urls.defaults import *
from django.http import HttpResponse, HttpResponseRedirect
from feincms.views.decorators import standalone
def module_root(request):
return 'module_root'
def args_test(request... | bsd-3-clause | Python |
b86c1a5c3bad311d458bd0e198ae5ff878e23e34 | Añade a la vista admin membership_status | abertal/alpha,migonzalvar/alpha,abertal/alpha,migonzalvar/alpha,abertal/alpha,migonzalvar/alpha,abertal/alpha,migonzalvar/alpha | core/admin.py | core/admin.py | from django.contrib import admin
from . import models
@admin.register(models.Person)
class Person(admin.ModelAdmin):
search_fields = ['name', 'surname']
list_display = ('id',
'name',
'surname',
'phone_number',
'birthday',
... | from django.contrib import admin
from . import models
@admin.register(models.Person)
class Person(admin.ModelAdmin):
search_fields = ['name', 'surname']
list_display = ('id',
'name',
'surname',
'phone_number',
'birthday',
... | bsd-3-clause | Python |
067f9367fcfda3abc664978d2ff8193685b1766b | Add examples to docstring | titansgroup/python-phonenumbers,gencer/python-phonenumbers,SergiuMir/python-phonenumbers,agentr13/python-phonenumbers,daviddrysdale/python-phonenumbers,roubert/python-phonenumbers,daviddrysdale/python-phonenumbers,daviddrysdale/python-phonenumbers,daodaoliang/python-phonenumbers,dongguangming/python-phonenumbers,shikig... | python/phonenumbers/__init__.py | python/phonenumbers/__init__.py | """Python phone number parsing and formatting library
Examples of use:
>>> import phonenumbers
>>> x = phonenumbers.parse("+442083661177", None)
>>> print x
Country Code: 44 National Number: 2083661177 Leading Zero: False
>>> phonenumbers.format_number(x, phonenumbers.PhoneNumberFormat.NATIONAL)
u'020 8366 1177'
>>> ... | """Python phone number parsing and formatting library"""
# 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... | apache-2.0 | Python |
e5567f2c41a364391f334267f26a5dfb4bcf015a | Add debug output | ojarva/home-info-display,ojarva/home-info-display,ojarva/home-info-display,ojarva/home-info-display | homedisplay/control_milight/tasks.py | homedisplay/control_milight/tasks.py | from __future__ import absolute_import
from celery import shared_task
from django.conf import settings
from django.utils import timezone
from ledcontroller import LedController
import datetime
import logging
import redis
logger = logging.getLogger("%s.%s" % ("homecontroller", __name__))
redis_instance = redis.StrictR... | from __future__ import absolute_import
from celery import shared_task
from django.conf import settings
from django.utils import timezone
from ledcontroller import LedController
import datetime
import logging
import redis
logger = logging.getLogger("%s.%s" % ("homecontroller", __name__))
redis_instance = redis.StrictR... | bsd-3-clause | Python |
899c501bd78475b35aef8149c60391d312a94d67 | Fix for broken jetsamproperties file. | ScheerMT/OS-X-Yosemite-Security-and-Privacy-Guide,drduh/OS-X-Security-and-Privacy-Guide,drduh/OS-X-Yosemite-Security-and-Privacy-Guide,DeadLion/macOS-Security-and-Privacy-Guide,drduh/macOS-Security-and-Privacy-Guide | read_launch_plists.py | read_launch_plists.py | #!/usr/bin/env python
#
# This script reads system launch daemon and agent plists.
import glob
import hashlib
import os
import plistlib
import subprocess
import csv
header ='filename,label,program,sha256,runatload,comment'
location = '/System/Library/Launch%s/*.plist'
comments = {}
def LoadPlist(filename):
"""Plis... | #!/usr/bin/env python
#
# This script reads system launch daemon and agent plists.
import glob
import hashlib
import os
import plistlib
import subprocess
import csv
header ='filename,label,program,sha256,runatload,comment'
location = '/System/Library/Launch%s/*.plist'
comments = {}
def LoadPlist(filename):
"""Plis... | mit | Python |
b8fb3700cdec2bc972f80bf07407ec5150582345 | Fix snapshot view querysets | DMPwerkzeug/DMPwerkzeug,DMPwerkzeug/DMPwerkzeug,rdmorganiser/rdmo,rdmorganiser/rdmo,DMPwerkzeug/DMPwerkzeug,rdmorganiser/rdmo | rdmo/projects/views/snapshot.py | rdmo/projects/views/snapshot.py | import logging
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.urls import reverse
from django.views.generic import CreateView, DetailView, UpdateView
from rdmo.core.views import ObjectPermissionMixin, RedirectViewMixin
from ..forms import SnapshotCreateForm
fr... | import logging
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.urls import reverse
from django.views.generic import CreateView, DetailView, UpdateView
from rdmo.core.views import ObjectPermissionMixin, RedirectViewMixin
from ..forms import SnapshotCreateForm
fr... | apache-2.0 | Python |
5ba0ec170b482de1bdf31bddb6aa231e8c8b6495 | fix vestigial /srv/mint holdover | sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint | mint/distro/jsversion.py | mint/distro/jsversion.py | #
# Copyright (c) 2004-2006 rPath, Inc.
#
# All Rights Reserved
#
import os
import re
from mint import constants
from mint import mint_error
from conary import versions
from conary.conaryclient.cmdline import parseTroveSpec
DEFAULT_BASEPATH = os.path.join(os.path.sep, 'srv', 'rbuilder', 'jobserver')
def getVersions... | #
# Copyright (c) 2004-2006 rPath, Inc.
#
# All Rights Reserved
#
import os
import re
from mint import constants
from mint import mint_error
from conary import versions
from conary.conaryclient.cmdline import parseTroveSpec
DEFAULT_BASEPATH = os.path.join(os.path.sep, 'srv', 'mint', 'jobserver')
def getVersionsOnDi... | apache-2.0 | Python |
cd1da150b41f2a83379a6fc8ce122d6f591d73ef | Remove unused import. | zhilts/pymockito,zhilts/pymockito | mockito/static_mocker.py | mockito/static_mocker.py | import inspect
class StaticMocker:
"""Deals with static methods AND class methods AND with module functions.
As they all are just static, procedural-like functions, hence StaticMocker"""
def __init__(self):
self.originals = []
self.static_mocks = {}
def stub(self, mock, method_name):... | import inspect
import mock
class StaticMocker:
"""Deals with static methods AND class methods AND with module functions.
As they all are just static, procedural-like functions, hence StaticMocker"""
def __init__(self):
self.originals = []
self.static_mocks = {}
def stub(self, mock, ... | mit | Python |
59b88e9bfbfe0f2042b18387b082c015b90c1158 | Fix for a test regression on the ROCm platform - 200207 - 2 | frreiss/tensorflow-fred,tensorflow/tensorflow-pywrap_tf_optimizer,karllessard/tensorflow,aldian/tensorflow,aam-at/tensorflow,frreiss/tensorflow-fred,gautam1858/tensorflow,annarev/tensorflow,aldian/tensorflow,petewarden/tensorflow,tensorflow/tensorflow,paolodedios/tensorflow,frreiss/tensorflow-fred,frreiss/tensorflow-fr... | tensorflow/python/eager/profiler_test.py | tensorflow/python/eager/profiler_test.py | # Copyright 2018 The TensorFlow 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 applica... | # Copyright 2018 The TensorFlow 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 applica... | apache-2.0 | Python |
e9c53e0dd36f42786596eafdd334ae6c96bae043 | Disable ipython shell in c/utils/inspect_tree.py | spranesh/Redhawk,spranesh/Redhawk,spranesh/Redhawk,spranesh/Redhawk | redhawk/c/utils/inspect_tree.py | redhawk/c/utils/inspect_tree.py | from __future__ import absolute_import
from __future__ import print_function
import redhawk.utils.util as U
import redhawk.c.c_parser as parser
import sys
def ShowObject(a):
for name in dir(a):
if name[:2] != "__":
print(("%10s : %s"%(name, str(getattr(a, name)))))
return
try:
filename = sys.argv[1]
... | from __future__ import absolute_import
from __future__ import print_function
import redhawk.utils.util as U
import redhawk.c.c_parser as parser
import sys
def ShowObject(a):
for name in dir(a):
if name[:2] != "__":
print(("%10s : %s"%(name, str(getattr(a, name)))))
return
try:
filename = sys.argv[1]
... | bsd-2-clause | Python |
0a269fcfe01659537081696c35dfde9d312565ef | fix S3 URL of the artifacts. | mjs/juju,mjs/juju,mjs/juju,mjs/juju,mjs/juju,mjs/juju,mjs/juju | copy_artifacts_to_s3.py | copy_artifacts_to_s3.py | #!/usr/bin/env python
"""Copy build artifacts to the S3 bucket 'juju-qa-data'.
Required environment variables:
BUILD_NUMBER - set by Jenkins
S3CFG - Path to the config file for s3cmd. Default:
~/cloud-city/juju-qa.s3cfg
"""
from __future__ import print_function
from jenkins import Jenkins
import... | #!/usr/bin/env python
"""Copy build artifacts to the S3 bucket 'juju-qa-data'.
Required environment variables:
BUILD_NUMBER - set by Jenkins
S3CFG - Path to the config file for s3cmd. Default:
~/cloud-city/juju-qa.s3cfg
"""
from __future__ import print_function
from jenkins import Jenkins
import... | agpl-3.0 | Python |
6f47bc3fb2b5617b4355c9c81649d7feb09b790a | set CORS on .well-known URI to unbreak modular | matrix-org/synapse,matrix-org/synapse,matrix-org/synapse,matrix-org/synapse,matrix-org/synapse,matrix-org/synapse | synapse/rest/well_known.py | synapse/rest/well_known.py | # -*- coding: utf-8 -*-
# Copyright 2018 New Vector Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | # -*- coding: utf-8 -*-
# Copyright 2018 New Vector Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | apache-2.0 | Python |
29ec84cdb2a6c75031a507a6fc16db614e8c607c | fix command line parsing bug | semanticize/semanticizest | semanticizest/parse_wikidump/__main__.py | semanticizest/parse_wikidump/__main__.py | """parse_wikidump
Usage:
parse_wikidump [options] <dump> <model-filename>
Options:
--ngram=order, -N order Maximum order of ngrams [default 7, None to disable]
--help, -h This help
"""
from __future__ import print_function
from os.path import dirname, join
import sqlite3
from docopt import ... | """parse_wikidump
Usage:
parse_wikidump [options] <dump> <model-filename>
Options:
--ngram=order, -N order Maximum order of ngrams [default 7, None to disable]
--help, -h This help
"""
from __future__ import print_function
from os.path import dirname, join
import sqlite3
from docopt import ... | apache-2.0 | Python |
42e7d88a5b9927c8f58f2d975fbb33cf884792e6 | Add an empty string to link if none could be found | matachi/sputnik,matachi/sputnik,matachi/sputnik,matachi/sputnik | podcasts/feed_tools.py | podcasts/feed_tools.py | from bs4 import BeautifulSoup
import feedparser
from urllib.error import HTTPError
from urllib.request import urlopen
def get_podcast_data(feed_url):
try:
feed_request = urlopen(feed_url)
except HTTPError as e:
raise e
feed_xml = feed_request.read()
feed = feedparser.parse(feed_xml).... | from bs4 import BeautifulSoup
import feedparser
from urllib.error import HTTPError
from urllib.request import urlopen
def get_podcast_data(feed_url):
try:
feed_request = urlopen(feed_url)
except HTTPError as e:
raise e
feed_xml = feed_request.read()
feed = feedparser.parse(feed_xml).... | mit | Python |
decaeb5d8dc1b4f5cb9064a5a05bf214ab58f6b2 | Update versions' apis with new endpoint | polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon | polyaxon/api/versions/views.py | polyaxon/api/versions/views.py | from rest_framework.response import Response
from api.endpoint.base import BaseEndpoint, RetrieveEndpoint
from db.models.versions import ChartVersion, CliVersion, LibVersion, PlatformVersion
from polyaxon.config_manager import config
from schemas.log_handler import LogHandlerConfig
from schemas.version import (
Ch... | from rest_framework.generics import RetrieveAPIView
from rest_framework.response import Response
from db.models.versions import ChartVersion, CliVersion, LibVersion, PlatformVersion
from polyaxon.config_manager import config
from schemas.log_handler import LogHandlerConfig
from schemas.version import (
ChartVersio... | apache-2.0 | Python |
73902e0f166457af5f504ef468f2da85fa3de798 | Fix prospector | polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon | polyaxon_deploy/schemas/ssl.py | polyaxon_deploy/schemas/ssl.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from marshmallow import fields
from polyaxon_deploy.schemas.base import BaseConfig, BaseSchema
class SSLSchema(BaseSchema):
enabled = fields.Bool(allow_none=True)
secretName = fields.Str(allow_none=True)
path = field... | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from marshmallow import fields
from polyaxon_deploy.schemas.base import BaseConfig, BaseSchema
class SSLSchema(BaseSchema):
enabled = fields.Bool(allow_none=True)
secretName = fields.Str(allow_none=True)
path = field... | apache-2.0 | Python |
24456bdd6627485f8528cc1ed5af18add056fd8f | Fix hide_ip templatetag | guswnsxodlf/k-board,kboard/kboard,hyesun03/k-board,kboard/kboard,darjeeling/k-board,kboard/kboard,guswnsxodlf/k-board,guswnsxodlf/k-board,hyesun03/k-board,hyesun03/k-board | kboard/board/templatetags/hide_ip.py | kboard/board/templatetags/hide_ip.py | import re
from django import template
register = template.Library()
@register.simple_tag
def hide_ip(ip):
m = re.match('\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}', str(ip))
if m is not None:
ip_arr = str(ip).split('.')
ip_arr[2] = 'xxx'
return '.'.join(ip_arr)
else:
return ip
| import re
from django import template
register = template.Library()
@register.simple_tag
def hide_ip(ip):
m = re.match('\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}', str(ip))
if m is not None:
ip_arr = str(ip).split('.')
ip_arr[2] = 'xxx'
return '.'.join(ip_arr)
else:
return str(i... | mit | Python |
acbf964a0c5df40db581b24ad858501bfe3e722c | Make PEP8 compliant with autopep8. | msabramo/requests-unixsocket,esben/requests-unixsocket | requests_unixsocket/adapters.py | requests_unixsocket/adapters.py | import socket
from requests.adapters import HTTPAdapter
from requests.compat import urlparse, unquote
try:
from requests.packages.urllib3.connection import HTTPConnection
from requests.packages.urllib3.connectionpool import HTTPConnectionPool
except ImportError:
from urllib3.connection import HTTPConnectio... | import socket
from requests.adapters import HTTPAdapter
from requests.compat import urlparse, unquote
try:
from requests.packages.urllib3.connection import HTTPConnection
from requests.packages.urllib3.connectionpool import HTTPConnectionPool
except ImportError:
from urllib3.connection import HTTPConnectio... | apache-2.0 | Python |
69ac4f5f315dc37ba8e1292dc70b843bd77f1bb8 | Make resave_es_forms_with_unknown_user_type not use pickle serializer | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/pillows/tasks.py | corehq/pillows/tasks.py | from datetime import timedelta
from celery.schedules import crontab
from celery.task import periodic_task
from corehq.apps.es import FormES
from corehq.apps.es.aggregations import CardinalityAggregation
from corehq.form_processor.models import XFormInstance
from corehq.form_processor.utils.xform import resave_form
fr... | from datetime import timedelta
from celery.schedules import crontab
from celery.task import periodic_task
from corehq.apps.es import FormES
from corehq.apps.es.aggregations import CardinalityAggregation
from corehq.form_processor.models import XFormInstance
from corehq.form_processor.utils.xform import resave_form
fr... | bsd-3-clause | Python |
7a116293cddbdfaf764615d253a34e369100df96 | create vocab from autogenerated vocab. | naturalness/sensibility,naturalness/sensibility,naturalness/sensibility,naturalness/sensibility | vocabulary.py | vocabulary.py | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
import logging
logger = logging.getLogger(__name__)
UNK_TOKEN = '/*<unknown>*/'
START_TOKEN = '/*<start>*/'
END_TOKEN = '/*<end>*/'
class Vocabulary:
"""
>>> v = Vocabulary([START_TOKEN, 'var', '$identifier', ';', END_TOKEN])
>>> v.to_text(2)
'$ide... | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
UNK_TOKEN = '/*<unknown>*/'
START_TOKEN = '/*<start>*/'
END_TOKEN = '/*<end>*/'
class Vocabulary:
"""
>>> v = Vocabulary([START_TOKEN, 'var', '$identifier', ';', END_TOKEN])
>>> v.to_text(2)
'$identifier'
>>> v.to_index('var')
1
>>> len(... | apache-2.0 | Python |
8ce2c3e3a30ebf8a99e884594a26aec388f2b282 | Make controller button and axis a dom widget. | ipython/ipywidgets,ipython/ipywidgets,SylvainCorlay/ipywidgets,jupyter-widgets/ipywidgets,jupyter-widgets/ipywidgets,ipython/ipywidgets,SylvainCorlay/ipywidgets,jupyter-widgets/ipywidgets,ipython/ipywidgets,SylvainCorlay/ipywidgets,ipython/ipywidgets,jupyter-widgets/ipywidgets,SylvainCorlay/ipywidgets | ipywidgets/widgets/widget_controller.py | ipywidgets/widgets/widget_controller.py | # Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
"""Controller class.
Represents a Gamepad or Joystick controller.
"""
from .valuewidget import ValueWidget
from .widget import register, widget_serialization
from .domwidget import DOMWidget
from .widget_core import ... | # Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
"""Controller class.
Represents a Gamepad or Joystick controller.
"""
from .valuewidget import ValueWidget
from .widget import register, widget_serialization
from .domwidget import DOMWidget
from .widget_core import ... | bsd-3-clause | Python |
3f48ed30be7fe338216eb3968c64e54284b21029 | fix avgpool issue in TF | eyaler/tensorpack,haamoon/tensorpack,haamoon/tensorpack,eyaler/tensorpack,haamoon/tensorpack,ppwwyyxx/tensorpack,ppwwyyxx/tensorpack | tensorpack/libinfo.py | tensorpack/libinfo.py |
# issue#1924 may happen on old systems
import cv2 # noqa
# issue#7378 may happen with custom opencv. It doesn't hurt to disable opencl
import os
os.environ['OPENCV_OPENCL_RUNTIME'] = ''
os.environ['TF_ENABLE_WINOGRAD_NONFUSED'] = '1' # issue#9339
os.environ['TF_AUTOTUNE_THRESHOLD'] = '3' # use more warm-up
os.en... |
# issue#1924 may happen on old systems
import cv2 # noqa
# issue#7378 may happen with custom opencv. It doesn't hurt to disable opencl
import os
os.environ['OPENCV_OPENCL_RUNTIME'] = ''
os.environ['TF_ENABLE_WINOGRAD_NONFUSED'] = '1' # issue#9339
os.environ['TF_AUTOTUNE_THRESHOLD'] = '3' # use more warm-up
__ve... | apache-2.0 | Python |
1337c88779b77be72af92dcb855c8b0b9219ac37 | add __name__.. | Yokan-Study/study,Yokan-Study/study,Yokan-Study/study | 2018/04.10/python/jya_Gapi_class.py | 2018/04.10/python/jya_Gapi_class.py | import requests, base64
import config
id = config.GAPI_CONFIG['client_id']
secret = config.GAPI_CONFIG['client_secret']
type = config.GAPI_CONFIG['grant_type']
class GapiClass:
def __init__(self, host='https://gapi.gabia.com'):
self.__host = host
self.__headers = self.__encoded_token()
def __... | import requests, base64
import config
id = config.GAPI_CONFIG['client_id']
secret = config.GAPI_CONFIG['client_secret']
type = config.GAPI_CONFIG['grant_type']
class GapiClass:
def __init__(self, host='https://gapi.gabia.com'):
self.__host = host
self.__headers = self.__encoded_token()
def __... | mit | Python |
bff5416e69a60ef80f936515a5c72e795b5de477 | Remove dead code | originell/jpype,originell/jpype,originell/jpype,originell/jpype,originell/jpype | test/jpypetest/conftest.py | test/jpypetest/conftest.py | import pytest
import jpype
def pytest_addoption(parser):
parser.addoption('--classpath', action="store", default=None,
help="Use a jar rather than the thunks")
parser.addoption('--convertStrings', action="store_true",
default=False, help="Give convert strings to start... | import pytest
import jpype
def pytest_addoption(parser):
parser.addoption('--classpath', action="store", default=None,
help="Use a jar rather than the thunks")
parser.addoption('--convertStrings', action="store_true",
default=False, help="Give convert strings to start... | apache-2.0 | Python |
a74e87725afd1d405d0eaea6f016059c9a65a310 | Clean up comments | eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog,eliben/code-for-blog | 2018/markov-simple/markov-simple.py | 2018/markov-simple/markov-simple.py | from collections import defaultdict, Counter
import random
import sys
# This is the length of the "state" the current character is predicted from.
# For Markov chains with memory, this is the "order" of the chain. For n-grams,
# n is STATE_LEN+1 since it includes the predicted character as well.
STATE_LEN = 4
def wei... | # TODO: remove all debugging code for presentation
from collections import defaultdict, Counter
import random
import sys
# This is the length of the "state" the current character is predicted from.
# For Markov chains with memory, this is the "order" of the chain. For n-grams,
# n is STATE_LEN+1 since it includes the ... | unlicense | Python |
cb135dc346dd801ad46436b0b131d141dbeec1bf | Change inheritance so that the base MFIL class is just an object, and MFIL2 inherits MFIL, dict | jleclanche/pywow,jleclanche/pywow,jleclanche/pywow,jleclanche/pywow,jleclanche/pywow,jleclanche/pywow | mfil/__init__.py | mfil/__init__.py | # -*- coding: utf-8 -*-
"""
MFIL - Blizzard Manifest File
Used for Blizzard Installer
Version 1:
- Simple dictionary
- Simple list
Version 2:
- Dictionary
- Nested keys
"""
SEEK_CUR = 1
class MFILError(Exception):
"""
Generic MFIL exception
"""
pass
class MFIL(object):
"""
Dictionary class for Blizzard M... | # -*- coding: utf-8 -*-
"""
MFIL - Blizzard Manifest File
Used for Blizzard Installer
Version 1:
- Simple dictionary
- Simple list
Version 2:
- Dictionary
- Nested keys
"""
SEEK_CUR = 1
class MFILError(Exception):
"""
Generic MFIL exception
"""
pass
class MFIL(dict):
"""
Dictionary class for Blizzard Man... | cc0-1.0 | Python |
0bda6a9c3f1c4e315a8d589228d4c9cd5e0c4069 | fix test | fukuball/fuku-ml,fukuball/fuku-ml | test_pla.py | test_pla.py | #encoding=utf8
import unittest
import FukuML.PLA as pla
import numpy as np
class PLATestCase(unittest.TestCase):
def test_train_pla(self):
pla.load_train_data()
pla.init_W()
W = pla.train()
print("\n訓練得出權重模型:")
print(W)
print('-'*70)
test_data_x = np.arra... | #encoding=utf8
import unittest
import FukuML.PLA as pla
import numpy as np
class PLATestCase(unittest.TestCase):
def test_train_pla(self):
pla.load_train_data()
pla.init_W()
W = pla.train()
print ("\n訓練得出權重模型:")
print W
print ('-'*70)
test_data_x = np.arr... | mit | Python |
7009db06baca16bb54fa0c6d01f1fa9ba19689df | Fix string matching | lnsp/tea,lnsp/tea | runtime/lexer.py | runtime/lexer.py | """Split the expression into tokens."""
import re
import collections
REGEX_OPERATOR = r"^([+\-*/=:()]?|([+\-*/%]=)|)$"
REGEX_WHITESPACE = r"^\s+$"
REGEX_NUMBER = r"^\-?[0-9]+(\.[0-9]+)?$"
REGEX_IDENTIFIER = r"^[a-zA-Z_]+([0-9a-zA-Z_]+)?$"
REGEX_STRING = r'^"[^\n\r"]*"?$'
class TokenType(collections.namedtuple("TokenT... | """Split the expression into tokens."""
import re
import collections
REGEX_OPERATOR = r"^([+\-*/=:()]?|([+\-*/%]=)|)$"
REGEX_WHITESPACE = r"^\s+$"
REGEX_NUMBER = r"^\-?[0-9]+(\.[0-9]+)?$"
REGEX_IDENTIFIER = r"^[a-zA-Z_]+([0-9a-zA-Z_]+)?$"
REGEX_STRING = "\"(\\.|[^\"])*(\")?"
class TokenType(collections.namedtuple("To... | mit | Python |
d0e91359d6589212d6ca0c6a4df79c27e2bc6d99 | Set `__module__` attr to parameterized class | cupy/cupy,cupy/cupy,cupy/cupy,cupy/cupy | cupy/testing/_bundle.py | cupy/testing/_bundle.py | import inspect
import sys
def make_decorator(test_case_generator):
# `test_case_generator` is a callable that receives the source test class
# (typically a subclass of unittest.TestCase) and returns an iterable of
# generated test cases.
# Each element of the iterable is a 3-element tuple:
# [0] G... | import inspect
import sys
def make_decorator(test_case_generator):
# `test_case_generator` is a callable that receives the source test class
# (typically a subclass of unittest.TestCase) and returns an iterable of
# generated test cases.
# Each element of the iterable is a 3-element tuple:
# [0] G... | mit | Python |
19beca072fe4a5126a91b469e26142e4e46a02b1 | Remove duplicate import from helpers.__init__ | muhammadnadeem/diagnostic-feedback,muhammadnadeem/diagnostic-feedback,muhammadnadeem/diagnostic-feedback | diagnostic_feedback/helpers/__init__.py | diagnostic_feedback/helpers/__init__.py | from buzzfeed_choice import BuzzfeedChoice
from category import Category
from choice import Choice
from diagnostic_choice import DiagnosticChoice
from question import Question
from range import Range
from helper import MainHelper
| from buzzfeed_choice import BuzzfeedChoice
from buzzfeed_choice import BuzzfeedChoice
from category import Category
from choice import Choice
from diagnostic_choice import DiagnosticChoice
from question import Question
from range import Range
from helper import MainHelper
| agpl-3.0 | Python |
62780af0821d6c7576ff9ae1a74311b16343daf3 | add notes for more devel | derwolfe/teiler,derwolfe/teiler | src/actions/client.py | src/actions/client.py | import os
import errno
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
from twisted.application.internet import MulticastServer
import requests
# should be limited to this module only
_fileserver = ''
"""
There are several ways you could go about getting the directory obj... | import os
import errno
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
from twisted.application.internet import MulticastServer
import requests
# should be limited to this module only
_fileserver = ''
def get_file_urls(url):
r = requests.get("http://" + url + '/teiler... | mit | Python |
8f97f2e05c32e1c65647fa24423ca2e06b5aaef3 | Add docstring to helper | angelmtenor/data-science-keras | helper.py | helper.py | """
Helper module for Data-Science-Keras repository
"""
import matplotlib.pyplot as plt
def show_training(history):
"""
Print the final loss and plot its evolution in the training process.
The same applies to 'validation loss', 'accuracy', and 'validation accuracy' if available
:param history: Keras h... | import matplotlib.pyplot as plt
def show_training(history):
"""
Print the final loss and plot its evolution in the training process.
The same applies to 'validation loss', 'accuracy', and 'validation accuracy' if available
:param history: Keras history object (model.fit return)
:return:
"""
... | mit | Python |
547e6bfcc8d839b8b72a2f9d3bba0df6deccbb98 | Bump version for pypi to 0.2018.06.10.1938 | oduwsdl/ipwb,oduwsdl/ipwb,oduwsdl/ipwb,oduwsdl/ipwb | ipwb/__init__.py | ipwb/__init__.py | __version__ = '0.2018.06.10.1938'
| __version__ = '0.2018.06.10.1932'
| mit | Python |
58eeadf482bd22c12305e208d7cf68917ff66741 | copy maximum strlen | f-prettyland/angr,iamahuman/angr,tyb0807/angr,axt/angr,iamahuman/angr,chubbymaggie/simuvex,chubbymaggie/simuvex,f-prettyland/angr,tyb0807/angr,angr/simuvex,tyb0807/angr,schieb/angr,f-prettyland/angr,angr/angr,chubbymaggie/angr,chubbymaggie/angr,chubbymaggie/simuvex,schieb/angr,chubbymaggie/angr,angr/angr,zhuyue1314/sim... | simuvex/procedures/libc.so.6/__init__.py | simuvex/procedures/libc.so.6/__init__.py | import simuvex
max_variable_size = 2 ** 16
class SimStateLibc(simuvex.SimStatePlugin):
'''
This state plugin keeps track of various libc stuff:
'''
#__slots__ = [ 'heap_location', 'max_str_symbolic_bytes' ]
def __init__(self):
simuvex.SimStatePlugin.__init__(self)
# various thre... | import simuvex
max_variable_size = 2 ** 16
class SimStateLibc(simuvex.SimStatePlugin):
'''
This state plugin keeps track of various libc stuff:
'''
#__slots__ = [ 'heap_location', 'max_str_symbolic_bytes' ]
def __init__(self):
simuvex.SimStatePlugin.__init__(self)
# various thre... | bsd-2-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.