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 |
|---|---|---|---|---|---|---|---|---|
c05c354f6edae812a1484f46d15ad8c77c9cc1ae | Update rates.py | MichaelCurrin/twitterverse,MichaelCurrin/twitterverse | app/lib/twitter/rates.py | app/lib/twitter/rates.py | # -*- coding: utf-8 -*-
"""
Handle Twitter API rate limit error.
The newer version of tweepy accepts the following in tweepy.API object.
- wait_on_rate_limit: If the api until next rate limit window is reached
to continue. Default is False.
- wait_on_rate_limit_notify: Default is False. If the api prints a notific... | # -*- coding: utf-8 -*-
"""
Handle Twitter API rate limit error.
The newer version of tweepy accepts the following the api object.
- wait_on_rate_limit: Wait until next rate limit window is reached to continue
making queries. Default is True, so errors are prevented when iterating
over a cursor.
- wait_on_rate... | mit | Python |
a1fdefa0ca15479cd9eb165ec0df02bb15d0e7f5 | refactor filename part | leakim/svtplay-dl,olof/svtplay-dl,selepo/svtplay-dl,dalgr/svtplay-dl,OakNinja/svtplay-dl,iwconfig/svtplay-dl,OakNinja/svtplay-dl,leakim/svtplay-dl,dalgr/svtplay-dl,selepo/svtplay-dl,qnorsten/svtplay-dl,iwconfig/svtplay-dl,leakim/svtplay-dl,spaam/svtplay-dl,qnorsten/svtplay-dl,spaam/svtplay-dl,OakNinja/svtplay-dl,olof/s... | lib/svtplay_dl/service/raw.py | lib/svtplay_dl/service/raw.py | from __future__ import absolute_import
import copy
import os
from svtplay_dl.service import Service
from svtplay_dl.fetcher.hds import hdsparse
from svtplay_dl.fetcher.hls import hlsparse, HLS
from svtplay_dl.log import log
class Raw(Service):
def get(self, options):
error, data = self.get_urldata()
... | from __future__ import absolute_import
import copy
import os
from svtplay_dl.service import Service
from svtplay_dl.fetcher.hds import hdsparse
from svtplay_dl.fetcher.hls import hlsparse, HLS
from svtplay_dl.log import log
class Raw(Service):
def get(self, options):
error, data = self.get_urldata()
... | mit | Python |
5f7fde839d131b6681aa930a9582128747792b78 | Bump version to v0.0.5 | strinking/statbot,strinking/statbot | statbot/__init__.py | statbot/__init__.py | #
# __init__.py
#
# statbot - Store Discord records for later analysis
# Copyright (c) 2017 Ammon Smith
#
# statbot is available free of charge under the terms of the MIT
# License. You are free to redistribute and/or modify it under those
# terms. It is distributed in the hopes that it will be useful, but
# WITHOUT AN... | #
# __init__.py
#
# statbot - Store Discord records for later analysis
# Copyright (c) 2017 Ammon Smith
#
# statbot is available free of charge under the terms of the MIT
# License. You are free to redistribute and/or modify it under those
# terms. It is distributed in the hopes that it will be useful, but
# WITHOUT AN... | mit | Python |
94c6a843ce68e9d44e4402b501efabc6c3fa6358 | Update houghcolourcapture.py | RobertABT/Image_analysis | houghcolourcapture.py | houghcolourcapture.py | import numpy as np
import cv2
import cv2.cv as cv
import datetime
cap = cv2.VideoCapture(0) #this uses the first webcam on the system, change to (1) to use the second camera
while(True):
# capture frame-by-frame
ret, frame = cap.read()
#our operations on the frame come here
gray = cv2.cvtColor(frame, cv2.COLOR_BG... | import numpy as np
import cv2
import cv2.cv as cv
import datetime
# loading in a colour image as greyscale (could help see edges?)
cap = cv2.VideoCapture(1)
while(True):
# capture frame-by-frame
ret, frame = cap.read()
#our operations on the frame come here
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
# Displ... | mit | Python |
4b06a32753fa94803e1134076fa299bcce69b299 | update the path to timestr | OakNinja/svtplay-dl,spaam/svtplay-dl,spaam/svtplay-dl,leakim/svtplay-dl,qnorsten/svtplay-dl,leakim/svtplay-dl,olof/svtplay-dl,OakNinja/svtplay-dl,iwconfig/svtplay-dl,selepo/svtplay-dl,selepo/svtplay-dl,leakim/svtplay-dl,dalgr/svtplay-dl,iwconfig/svtplay-dl,dalgr/svtplay-dl,qnorsten/svtplay-dl,OakNinja/svtplay-dl,olof/s... | lib/svtplay_dl/tests/utils.py | lib/svtplay_dl/tests/utils.py | #!/usr/bin/python
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
# The unittest framwork doesn't play nice with pylint:
# pylint: disable-msg=C0103
from __future__ import absolute_import
import unittest
import svtplay_dl.subtitle
class timestrTest(unittest.TestCase):
d... | #!/usr/bin/python
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
# The unittest framwork doesn't play nice with pylint:
# pylint: disable-msg=C0103
from __future__ import absolute_import
import unittest
import svtplay_dl.utils
class timestrTest(unittest.TestCase):
def ... | mit | Python |
d5f2e2e965046c2557c9d54f10a6b9a8936b6461 | bump version 0.1.5 | solvebio/solvebio-python,solvebio/solvebio-python,solvebio/solvebio-python | solve/__init__.py | solve/__init__.py | # -*- coding: utf-8 -*-
#
# Copyright © 2013 Solve, Inc. <http://www.solvebio.com>. All rights reserved.
#
# email: contact@solvebio.com
#
# 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
#
# ... | # -*- coding: utf-8 -*-
#
# Copyright © 2013 Solve, Inc. <http://www.solvebio.com>. All rights reserved.
#
# email: contact@solvebio.com
#
# 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
#
# ... | mit | Python |
35f9c78274876c6eb1e487071c7957c9b8460f68 | Simplify our argspec compatability shim. | pecan/pecan,ryanpetrello/pecan,pecan/pecan,ryanpetrello/pecan | pecan/compat/__init__.py | pecan/compat/__init__.py | import inspect
import six
if six.PY3:
import urllib.parse as urlparse
from urllib.parse import quote, unquote_plus
from urllib.request import urlopen, URLError
from html import escape
izip = zip
else:
import urlparse # noqa
from urllib import quote, unquote_plus # noqa
from urllib2 i... | import inspect
import six
if six.PY3:
import urllib.parse as urlparse
from urllib.parse import quote, unquote_plus
from urllib.request import urlopen, URLError
from html import escape
izip = zip
else:
import urlparse # noqa
from urllib import quote, unquote_plus # noqa
from urllib2 i... | bsd-3-clause | Python |
3f76ee6a526f1933164aa9907221a61ada9c5b5d | add rotated potential | adrn/StreamMorphology,adrn/StreamMorphology,adrn/StreamMorphology | streammorphology/potential.py | streammorphology/potential.py | # coding: utf-8
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Third-party
import astropy.units as u
import numpy as np
# Project
import gary.potential as gp
from gary.units import galactic
__all__ = ['potential_registry']
# built-in potentials
potential_registry =... | # coding: utf-8
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Third-party
import astropy.units as u
import numpy as np
# Project
import gary.potential as gp
from gary.units import galactic
__all__ = ['potential_registry']
# built-in potentials
potential_registry =... | mit | Python |
b696389324860b6e0bf2a763f3a1d3dc34ff7937 | improve print output | yuyu2172/chainercv,yuyu2172/chainercv,chainer/chainercv,pfnet/chainercv,chainer/chainercv | examples/classification/eval_imagenet.py | examples/classification/eval_imagenet.py | import argparse
import random
import sys
import time
import numpy as np
import chainer
import chainer.links as L
import chainer.functions as F
from chainer import iterators
from chainer import training
from chainer.training import extensions
from chainercv.datasets import ImageFolderDataset
from chainercv.links impo... | import argparse
import random
import sys
import time
import numpy as np
import chainer
import chainer.links as L
import chainer.functions as F
from chainer import iterators
from chainer import training
from chainer.training import extensions
from chainercv.datasets import ImageFolderDataset
from chainercv.links impo... | mit | Python |
a29b551506454b0982a3edd981bda302372a39bb | add boolean on ipeds importer variables as a flag for if it's been used already | texastribune/the-dp,texastribune/the-dp,texastribune/the-dp,texastribune/the-dp | ipeds_importer/models.py | ipeds_importer/models.py | from django.contrib import admin
from django.db import models
class Variable(models.Model):
""" An IPEDS report variable """
code = models.CharField(max_length=20)
short_name = models.CharField(max_length=8)
category = models.CharField(max_length=150)
long_name = models.CharField(max_length=80)
... | from django.db import models
class Variable(models.Model):
""" An IPEDS report variable """
code = models.CharField(max_length=20)
short_name = models.CharField(max_length=8)
category = models.CharField(max_length=150)
long_name = models.CharField(max_length=80)
raw = models.CharField(max_leng... | apache-2.0 | Python |
bc044c5d7cb1394ad889f5458b9660bcc33b990a | Remove test code | internship2016/sovolo,internship2016/sovolo,internship2016/sovolo | app/base/utils.py | app/base/utils.py | from django.template.backends.django import Template
from django.template.loader import get_template
from django.template import Context
from django.core.mail import EmailMessage
def send_template_mail(template, context, from_address, to_addresses, bcc_addresses=None):
if not isinstance(template, Template):
... | from django.template.backends.django import Template
from django.template.loader import get_template
from django.template import Context
from django.core.mail import send_mail
from django.core.mail import EmailMessage
def send_template_mail(template, context, from_address, to_addresses, bcc_addresses=None):
if no... | mit | Python |
8660dbca015640bf7ff4fb3e480b115f5a298007 | Reset the counter in the test for matching technique | jaraco/irc | irc/tests/test_client.py | irc/tests/test_client.py | from __future__ import print_function
import itertools
import time
import pytest
import mock
import irc.client
def test_version():
assert 'VERSION' in vars(irc.client)
assert isinstance(irc.client.VERSION, tuple)
assert irc.client.VERSION, "No VERSION detected."
@mock.patch('irc.connection.socket')
def test_pri... | from __future__ import print_function
import itertools
import time
import pytest
import mock
import irc.client
def test_version():
assert 'VERSION' in vars(irc.client)
assert isinstance(irc.client.VERSION, tuple)
assert irc.client.VERSION, "No VERSION detected."
@mock.patch('irc.connection.socket')
def test_pri... | mit | Python |
f926a48718fe07351d6803fa2949ce3c4055e44a | Update autofill test script -- flatten.py -- for multi-valued fields | jaruba/chromium.src,dushu1203/chromium.src,Pluto-tv/chromium-crosswalk,Fireblend/chromium-crosswalk,mogoweb/chromium-crosswalk,ChromiumWebApps/chromium,Jonekee/chromium.src,axinging/chromium-crosswalk,anirudhSK/chromium,fujunwei/chromium-crosswalk,robclark/chromium,bright-sparks/chromium-spacewalk,jaruba/chromium.src,a... | chrome/test/data/autofill/merge/tools/flatten.py | chrome/test/data/autofill/merge/tools/flatten.py | # Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import sys
def main():
"""Converts a vertical serialization into a compact, horizontal serialization.
"""
COLUMNS = ['First name', 'Middle name'... | # Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import sys
def main():
"""Converts a vertical serialization into a compact, horizontal serialization.
"""
COLUMNS = ['First name', 'Middle name'... | bsd-3-clause | Python |
f631a7ece947845ac8db4d38cd0dafccf5b7fdf9 | Add topLists frontend | esneider/relationshit-server | app.py | app.py | import os
import sys
from flask import Flask, request
from flask.ext.sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ['DATABASE_URL']
db = SQLAlchemy(app)
import database
@app.route('/')
def hello():
return 'Hello World!'
@app.route('/fakemessage', methods ... | import os
import sys
from flask import Flask, request
from flask.ext.sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ['DATABASE_URL']
db = SQLAlchemy(app)
import database
@app.route('/')
def hello():
return 'Hello World!'
@app.route('/fakemessage', methods ... | mit | Python |
1354646dc33c64a292ad707a921c6bea878fa615 | Update version.py | scikit-hep/uproot,scikit-hep/uproot,scikit-hep/uproot,scikit-hep/uproot | uproot/version.py | uproot/version.py | #!/usr/bin/env python
# Copyright (c) 2017, DIANA-HEP
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list ... | #!/usr/bin/env python
# Copyright (c) 2017, DIANA-HEP
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list ... | bsd-3-clause | Python |
00370cd524647d263a99cf9b28f0757ba5f54368 | change _print parameters | magne4000/ask | ask.py | ask.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Distributed under terms of the MIT license.
from question import Question
import readline, sys, struct, fcntl, termios
"""
A question/answer based prompt python lib
"""
class Ask:
asking = False
def __init__(self, prompt='-> '):
self.ps = prompt
... | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Distributed under terms of the MIT license.
from question import Question
import readline, sys, struct, fcntl, termios
"""
A question/answer based prompt python lib
"""
class Ask:
asking = False
def __init__(self, prompt='-> '):
self.ps = prompt
... | mit | Python |
3cdc2ac4fce77eea104415549c344b545fc420d0 | update sqlite3.py for osx | cornell-cup/cs-r2bot2,cornell-cup/cs-r2bot2,cornell-cup/cs-r2bot2,cornell-cup/cs-r2bot2,cornell-cup/cs-r2bot2 | lib/sqlite3.py | lib/sqlite3.py | i# sqlite
# https://sqlite.org
# SQLite is a light SQL database engine
# 1. Head to https://sqlite.org/download.html
# 2. Download the source amalgamation
# 3. Extract source amalgamation to `sqlite`
# 4. Download precompiled binaries
# 5. Extract to `sqlite`
import subprocess
import platform
if __name__=="__main__"... | # sqlite
# https://sqlite.org
# SQLite is a light SQL database engine
# 1. Head to https://sqlite.org/download.html
# 2. Download the source amalgamation
# 3. Extract source amalgamation to `sqlite`
# 4. Download precompiled binaries
# 5. Extract to `sqlite`
import subprocess
import platform
if __name__=="__main__":... | mit | Python |
faf28c3f8994ffff88a435b81a7926b39d310bca | Allow Varcode to work with mouse data via Genome | hammerlab/varcode,hammerlab/varcode | test/test_mouse.py | test/test_mouse.py | from __future__ import absolute_import
from nose.tools import eq_
from varcode import load_vcf, load_vcf_fast, Variant, Substitution
from pyensembl import Genome
from . import data_path
MOUSE_GTF_PATH = "ftp://ftp.ensembl.org/pub/release-81/gtf/mus_musculus/Mus_musculus.GRCm38.81.gtf.gz"
MOUSE_TRANSCRIPT_FASTA_PATH ... | from __future__ import absolute_import
from nose.tools import eq_
from varcode import load_vcf, load_vcf_fast, Variant, Substitution
from pyensembl import Genome, GenomeSource
from . import data_path
MOUSE_GTF_PATH = "ftp://ftp.ensembl.org/pub/release-81/gtf/mus_musculus/Mus_musculus.GRCm38.81.gtf.gz"
MOUSE_TRANSCRI... | apache-2.0 | Python |
c60b05d44a74c86eb4e77ee4796b72bba4fc700b | Update callback_data.py | WebShark025/TheZigZagProject,WebShark025/TheZigZagProject | plugins/callback_data.py | plugins/callback_data.py | @bot.callback_query_handler(func=lambda call: True)
def callback_inline(call):
if call.message:
if call.data == "help":
bot.send_message(call.message.chat.id, START_MSG.encode("utf-8"), parse_mode="Markdown")
bot.answer_callback_query(callback_query_id=call.id, show_alert=False, text="Here you are!")
... | @bot.callback_query_handler(func=lambda call: True)
def callback_inline(call):
if call.message:
if call.data == "help":
bot.send_message(call.message.chat.id, START_MSG.encode("utf-8"), parse_mode="Markdown")
bot.answer_callback_query(callback_query_id=call.id, show_alert=False, text="Here you are!")
... | mit | Python |
d97c19194cf05a7fabd6d3deea1d70feecff9e9c | remove email specific checks from auth.user.message | DanielNeugebauer/adhocracy,alkadis/vcv,phihag/adhocracy,DanielNeugebauer/adhocracy,alkadis/vcv,DanielNeugebauer/adhocracy,phihag/adhocracy,alkadis/vcv,alkadis/vcv,phihag/adhocracy,liqd/adhocracy,phihag/adhocracy,alkadis/vcv,liqd/adhocracy,liqd/adhocracy,liqd/adhocracy,DanielNeugebauer/adhocracy,phihag/adhocracy,DanielN... | src/adhocracy/lib/auth/user.py | src/adhocracy/lib/auth/user.py | from paste.deploy.converters import asbool
from pylons import tmpl_context as c
from adhocracy import config
from adhocracy.lib.auth.authorization import has
from adhocracy.lib.auth.authorization import NOT_LOGGED_IN
def is_not_demo(check, u):
if u is not None:
demo_users = config.get_list('adhocracy.dem... | from paste.deploy.converters import asbool
from pylons import tmpl_context as c
from adhocracy import config
from adhocracy.lib.auth.authorization import has
from adhocracy.lib.auth.authorization import NOT_LOGGED_IN
def is_not_demo(check, u):
if u is not None:
demo_users = config.get_list('adhocracy.dem... | agpl-3.0 | Python |
65697bff8a510efaad1059168de1bc38b2f56ff0 | Fix unit test failures | openstack/congress,ramineni/my_congress,openstack/congress,ramineni/my_congress,ramineni/my_congress,ramineni/my_congress | congress/api/base.py | congress/api/base.py | # Copyright (c) 2016 NEC 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 (c) 2016 NEC 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 |
ab21db0d5ef2d808a0e80ab5905aad78c24d8796 | send an int value... not float | MaxMorgenstern/EmeraldAI,MaxMorgenstern/EmeraldAI,MaxMorgenstern/EmeraldAI,MaxMorgenstern/EmeraldAI,MaxMorgenstern/EmeraldAI | EmeraldAI/Application/Clock.py | EmeraldAI/Application/Clock.py | import time
import sys
from os.path import dirname, abspath
sys.path.append(dirname(dirname(dirname(abspath(__file__)))))
reload(sys)
sys.setdefaultencoding('utf-8')
from EmeraldAI.Logic.Modules import Pid
import rospy
from std_msgs.msg import String
def RunClock():
rospy.init_node('clock_node', anonymous=True)... | import time
import sys
from os.path import dirname, abspath
sys.path.append(dirname(dirname(dirname(abspath(__file__)))))
reload(sys)
sys.setdefaultencoding('utf-8')
from EmeraldAI.Logic.Modules import Pid
import rospy
from std_msgs.msg import String
def RunClock():
rospy.init_node('clock_node', anonymous=True)... | apache-2.0 | Python |
27ac2ad9b17307a8a49c4b04d76a253c668da098 | remove empty or unused lines, optimize lines count | mesenev/top_bot_lyceum | bot.py | bot.py | import infra.logging
infra.logging.setup_logger() # this should go before anything else
from telegram.ext import Updater
import infra
import methods
from config import *
updater = Updater(token=BOT_TOKEN)
j = updater.job_queue
infra.logging.setup_dispatcher_logging(updater.dispatcher)
infra.storage.setup_database(... | import infra.logging
infra.logging.setup_logger() # this should go before anything else
from telegram.ext import Updater
import infra
import methods
from config import *
updater = Updater(token=BOT_TOKEN)
j = updater.job_queue
infra.logging.setup_dispatcher_logging(updater.dispatcher)
infra.storage.setup_databas... | mit | Python |
788bc646cad2d48d97789c80b4b7550163488304 | bump version to 0.0.24 | rygwdn/equals,toddsifleet/equals | equals/__init__.py | equals/__init__.py | from __future__ import absolute_import
__version__ = '0.0.24'
import numbers # noqa
import collections # noqa
from equals.equals import Equals as instance_of # noqa
from equals.constraints.anything_true import AnythingTrue # noqa
from equals.constraints.anything_false import AnythingFalse # noqa
anything = in... | from __future__ import absolute_import
__version__ = '0.0.23'
import numbers # noqa
import collections # noqa
from equals.equals import Equals as instance_of # noqa
from equals.constraints.anything_true import AnythingTrue # noqa
from equals.constraints.anything_false import AnythingFalse # noqa
anything = in... | mit | Python |
e287eac462040275d7f02d113b4d261c4d2ccaac | Add light palette for light backgrounds | inscriptionweb/mitmproxy,sethp-jive/mitmproxy,mosajjal/mitmproxy,ZeYt/mitmproxy,dufferzafar/mitmproxy,ujjwal96/mitmproxy,mosajjal/mitmproxy,ccccccccccc/mitmproxy,dxq-git/mitmproxy,onlywade/mitmproxy,zbuc/mitmproxy,bazzinotti/mitmproxy,sethp-jive/mitmproxy,guiquanz/mitmproxy,syjzwjj/mitmproxy,xbzbing/mitmproxy,ParthGana... | libmproxy/console/palettes.py | libmproxy/console/palettes.py | # Copyright (C) 2012 Aldo Cortesi
#
# This program 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
# (at your option) any later version.
#
# This program is distributed in ... | # Copyright (C) 2012 Aldo Cortesi
#
# This program 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
# (at your option) any later version.
#
# This program is distributed in ... | mit | Python |
e82dddf0360f8fd694a886fd86ad93b682554515 | Use maas_common in error_instances.py | miguelgrinberg/rpc-openstack,galstrom21/rpc-openstack,cfarquhar/rpc-maas,xeregin/rpc-openstack,xeregin/rpc-openstack,cloudnull/rpc-maas,mancdaz/rpc-openstack,mattt416/rpc-openstack,stevelle/rpc-openstack,npawelek/rpc-maas,jacobwagner/rpc-openstack,robb-romans/rpc-openstack,busterswt/rpc-openstack,BjoernT/rpc-openstack,... | error_instances.py | error_instances.py | #!/usr/bin/env python
#
# Copyright 2012, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | #!/usr/bin/env python
#
# Copyright 2012, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | apache-2.0 | Python |
5e6351d7b891cf11aa8465bffb4b7cde34824a60 | Update vault.py | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/pillar/vault.py | salt/pillar/vault.py | # -*- coding: utf-8 -*-
'''
Vault Pillar Module
:maintainer: SaltStack
:maturity: New
:platform: all
.. versionadded:: 2016.11.0
This module allows pillar data to be stored in Hashicorp Vault.
Base configuration instructions are documented in the :ref:`execution module docs <vault-setup>`.
Below are no... | # -*- coding: utf-8 -*-
'''
Vault Pillar Module
:maintainer: SaltStack
:maturity: New
:platform: all
.. versionadded:: 2016.11.0
This module allows pillar data to be stored in Hashicorp Vault.
Base configuration instructions are documented in the :ref:`execution module docs <vault-setup>`.
Below are no... | apache-2.0 | Python |
8d20d52671e57850c956d0a1097d651bfd111abf | ADD /guests and /key endpoints to allow guest mode and authentication by registered signing keys | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | packages/grid/backend/grid/api/auth/login.py | packages/grid/backend/grid/api/auth/login.py | # stdlib
from datetime import timedelta
from typing import Any
# third party
from fastapi import APIRouter
from fastapi import Body
from fastapi import HTTPException
from fastapi.responses import JSONResponse
from loguru import logger
from nacl.encoding import HexEncoder
from nacl.signing import SigningKey
# syft abs... | # stdlib
from datetime import timedelta
from typing import Any
# third party
from fastapi import APIRouter
from fastapi import Body
from fastapi import HTTPException
from fastapi.responses import JSONResponse
from loguru import logger
# syft absolute
from syft import serialize # type: ignore
from syft.core.node.comm... | apache-2.0 | Python |
251aed886951ad5a7111abe80532b806a11086e3 | Fix Hyperband’s test | learning-on-chip/google-cluster-prediction | prediction/test_tuner.py | prediction/test_tuner.py | from .tuner import Hyperband
import unittest
class HyperbandTestCase(unittest.TestCase):
def test_run(self):
observed_n = []
observed_r = []
observed_c = []
def _get(n):
observed_n.append(n)
return list(range(n))
def _test(r, c):
observed... | from .tuner import Hyperband
import unittest
class HyperbandTestCase(unittest.TestCase):
def test_run(self):
observed_n = []
observed_r = []
observed_c = []
def _get(n):
observed_n.append(n)
return list(range(n))
def _test(r, c):
observed... | mit | Python |
d05551ca398f8ad324ff1a387afeb3acfa54f8c5 | Fix return value | agurfinkel/brunch,agurfinkel/brunch | spacer/name_z3.py | spacer/name_z3.py | #! /usr/bin/env python3
# Suggest name to z3 binary based on it its sha
import sys
import words
import subprocess
import argparse
import os.path
class Z3Namer(object):
def __init__(self):
self._name = 'name_z3'
self._help = 'Name for z3 binary'
def mk_arg_parser(self, ap):
ap.add_a... | #! /usr/bin/env python3
# Suggest name to z3 binary based on it its sha
import sys
import words
import subprocess
import argparse
import os.path
class Z3Namer(object):
def __init__(self):
self._name = 'name_z3'
self._help = 'Name for z3 binary'
def mk_arg_parser(self, ap):
ap.add_a... | mit | Python |
bb1adc0441ed4e6d451daf1d1bff5773d65c7c5e | Fix wrong attr name | caseman/grease | grease/component/general.py | grease/component/general.py | import base
import field
from grease.entity import ComponentEntitySet
class Component(dict):
"""General component with a configurable schema"""
def __init__(self, **fields):
"""Initialize the component
The field schema is defined via keyword args where the
arg name is the field name and the value is the typ... | import base
import field
from grease.entity import ComponentEntitySet
class Component(dict):
"""General component with a configurable schema"""
def __init__(self, **fields):
"""Initialize the component
The field schema is defined via keyword args where the
arg name is the field name and the value is the typ... | mit | Python |
6a081bd56e0c501d5407e3f4f4309dd30dfb7bc6 | initialize bst.py | constanthatz/data-structures2 | bst.py | bst.py | class Node(object):
node.left
key
value
node.right
| mit | Python | |
f97a7e18d2a7dd9c48186fccd5efdcdeaeb2af32 | add the ability to use requests timeout | davebshow/gremlinrestclient | gremlinrestclient/client.py | gremlinrestclient/client.py | import collections
import json
import requests
from gremlinrestclient.exceptions import RequestError, GremlinServerError
__all__ = ("GremlinRestClient", "Response")
Response = collections.namedtuple(
"Response",
["status_code", "data", "message", "metadata"])
class GremlinRestClient(object):
HEADERS... | import collections
import json
import requests
from gremlinrestclient.exceptions import RequestError, GremlinServerError
__all__ = ("GremlinRestClient", "Response")
Response = collections.namedtuple(
"Response",
["status_code", "data", "message", "metadata"])
class GremlinRestClient(object):
HEADERS... | mit | Python |
7e6bd245581d584b9ebad0da6890143e55a81621 | Improve warnings-related comments. | Disassem/urllib3,boyxuper/urllib3,haikuginger/urllib3,tutumcloud/urllib3,Lukasa/urllib3,matejcik/urllib3,denim2x/urllib3,tutumcloud/urllib3,urllib3/urllib3,Disassem/urllib3,denim2x/urllib3,boyxuper/urllib3,mikelambert/urllib3,sileht/urllib3,silveringsea/urllib3,silveringsea/urllib3,sigmavirus24/urllib3,sileht/urllib3,s... | urllib3/__init__.py | urllib3/__init__.py | """
urllib3 - Thread-safe connection pooling and re-using.
"""
__author__ = 'Andrey Petrov (andrey.petrov@shazow.net)'
__license__ = 'MIT'
__version__ = '1.10.2'
from .connectionpool import (
HTTPConnectionPool,
HTTPSConnectionPool,
connection_from_url
)
from . import exceptions
from .filepost import en... | """
urllib3 - Thread-safe connection pooling and re-using.
"""
__author__ = 'Andrey Petrov (andrey.petrov@shazow.net)'
__license__ = 'MIT'
__version__ = '1.10.2'
from .connectionpool import (
HTTPConnectionPool,
HTTPSConnectionPool,
connection_from_url
)
from . import exceptions
from .filepost import en... | mit | Python |
7748415db3e5e6ecb6ee3592f0a8ca4abd84898c | Remove d3 download | jakevdp/mpld3,etgalloway/mpld3,jakevdp/mpld3,mpld3/mpld3,e-koch/mpld3,mpld3/mpld3,etgalloway/mpld3,e-koch/mpld3 | create_example.py | create_example.py | import os
import urllib2
import numpy as np
import matplotlib.pyplot as plt
from mpld3 import fig_to_d3, show_d3
#----------------------------------------------------------------------
# create the figure and axes
fig, ax = plt.subplots(2, 2, figsize=(8, 8),
subplot_kw={'axisbg':'#EEEEEE'})
for... | import os
import urllib2
import numpy as np
import matplotlib.pyplot as plt
from mpld3 import fig_to_d3, show_d3
# Download d3 file locally
d3_filename = 'd3.v3.min.js'
if not os.path.exists(d3_filename):
page = urllib2.urlopen('http://d3js.org/d3.v3.min.js')
with open(d3_filename, 'w') as f:
f.write(p... | bsd-3-clause | Python |
73822f9041e451d706ff14e2d7699d574ebc270b | change db path | bjadel/weatherstation-maincontrolcenter,bjadel/weatherstation-maincontrolcenter | programs/MeasurandDAO.py | programs/MeasurandDAO.py | import sqlite3
class MeasurandDAO:
DATABASE_FILE = '/home/pi/station/weatherstation-maincontrolcenter/data/database/weatherstation/sqlite/var/measuranddb'
def __init__(self):
try:
self.conn = sqlite3.connect(MeasurandDAO.DATABASE_FILE)
except sqlite3.OperationalError: # Can't locate database file
exit(1)... | import sqlite3
class MeasurandDAO:
DATABASE_FILE = '/mnt/data/database/weatherstation/sqlite/var/measuranddb'
def __init__(self):
try:
self.conn = sqlite3.connect(MeasurandDAO.DATABASE_FILE)
except sqlite3.OperationalError: # Can't locate database file
exit(1)
self.cursor = self.conn.cursor()
def p... | agpl-3.0 | Python |
95df74d05e88df214ccced8194c5e5e1b2c9feb5 | remove newline | geometalab/drf-utm-zone-info,geometalab/osmaxx-frontend,geometalab/osmaxx-frontend,geometalab/osmaxx-frontend,geometalab/osmaxx-frontend,geometalab/drf-utm-zone-info,geometalab/osmaxx,geometalab/osmaxx,geometalab/osmaxx,geometalab/osmaxx | fontforge_font_creator/yaml_generator.py | fontforge_font_creator/yaml_generator.py | #!/usr/bin/env python3
import os
import unicodedata
class UnicodeRanger:
def __init__(self, start, stop):
self.current = start
self.high = stop
self.stop = stop
self._allowed_ranges = [
('Co', 'Other', 'Private Use'),
('LC', 'Letter', 'Cased'),
(... | #!/usr/bin/env python3
import os
import unicodedata
class UnicodeRanger:
def __init__(self, start, stop):
self.current = start
self.high = stop
self.stop = stop
self._allowed_ranges = [
('Co', 'Other', 'Private Use'),
('LC', 'Letter', 'Cased'),
(... | isc | Python |
6b68b3895dda55ea3d65596347525823e137a73f | Remove outdated constraint from docstring | zenhack/python-gtkclassbuilder | gtkclassbuilder/__init__.py | gtkclassbuilder/__init__.py | """``gtkclassbuilder`` converts Gtk Builder files to python classes.
This is in contrast to what Gtk Builder does, i.e. creating an instance
of the class. Gtk Builder's behavior is problematic since it makes it
difficult to create multiple instances of a widget from the same
``.glade`` file.
===========
Limitations
=... | """``gtkclassbuilder`` converts Gtk Builder files to python classes.
This is in contrast to what Gtk Builder does, i.e. creating an instance
of the class. Gtk Builder's behavior is problematic since it makes it
difficult to create multiple instances of a widget from the same
``.glade`` file.
===========
Limitations
=... | lgpl-2.1 | Python |
25724b50e10ce9a7c847f42fdfa94c0fbd99be3a | fix bug in getting the message from context | texttochange/vusion-backend,texttochange/vusion-backend,texttochange/vusion-backend | vusion/context.py | vusion/context.py |
class Context(object):
def __init__(self, **kwargs):
self.payload = kwargs
def __eq__(self, other):
if isinstance(other, Context):
return self.payload == other.payload
return False
def __str__(self):
return "Context %s" % repr(self.payload)
def __rep... |
class Context(object):
def __init__(self, **kwargs):
self.payload = kwargs
def __eq__(self, other):
if isinstance(other, Context):
return self.payload == other.payload
return False
def __str__(self):
return "Context %s" % repr(self.payload)
def __rep... | bsd-3-clause | Python |
4138fdf51d49bcf69b46e627115cde74fd34d45a | Remove django-jsoneditor | synw/django-vvpages,synw/django-vvpages,synw/django-vvpages | vvpages/models.py | vvpages/models.py | # -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.db.models.signals import post_save, post_delete
from jsonfield import JSONField
from mptt.models import TreeForeignKey, MPTTModel
from vvpages.conf import USER_MODEL
from vvpages.signals import buil... | # -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.db.models.signals import post_save, post_delete
from jsoneditor.fields.django_jsonfield import JSONField
from mptt.models import TreeForeignKey, MPTTModel
from vvpages.conf import USER_MODEL
from vv... | mit | Python |
5745d0ce6d8401abd23ccd8c1c6b468a88c69e17 | Update TrafficXMLParser.py | autopkg/dataJAR-recipes,autopkg/dataJAR-recipes,autopkg/dataJAR-recipes | Traffic/TrafficXMLParser.py | Traffic/TrafficXMLParser.py | #!/usr/bin/python
# Copyright 2018 dataJAR
#
# 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 ... | #!/usr/bin/python
# Copyright 2018 macmule
#
# 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 ... | apache-2.0 | Python |
f9fcdc59e835a6d10292181522ccd7a97a6d84f2 | Add custom rack upgrade test (#2591) | mesosphere/dcos-commons,mesosphere/dcos-commons,mesosphere/dcos-commons,mesosphere/dcos-commons,mesosphere/dcos-commons | frameworks/cassandra/tests/test_racks.py | frameworks/cassandra/tests/test_racks.py | import logging
import pytest
import sdk_install
import sdk_upgrade
import sdk_utils
from tests import config
from tests import nodetool
log = logging.getLogger(__name__)
@pytest.fixture(scope="module", autouse=True)
def configure_package(configure_security):
try:
sdk_install.uninstall(config.PACKAGE_NAM... | import logging
import pytest
import sdk_install
import sdk_utils
from tests import config
from tests import nodetool
log = logging.getLogger(__name__)
@pytest.fixture(scope='module', autouse=True)
def configure_package(configure_security):
try:
sdk_install.uninstall(config.PACKAGE_NAME, config.get_folde... | apache-2.0 | Python |
95612ec20c44766ef332a894dac4d6d6a3b5c5ad | Remove time consuming step | nayyarv/MonteGMM | Python/GPUGMMLL.py | Python/GPUGMMLL.py | import pycuda.autoinit
# from pycuda import curandom
from pycuda import gpuarray
from pycuda.compiler import SourceModule
# from pycuda.tools import DeviceData
import numpy as np
from pythonGMMLL import pythonLL
#prepare for global usage
def largertest(numRuns = 1000, numPoints = 512, dim = 13, numMixtures = 8):
... | import pycuda.autoinit
# from pycuda import curandom
from pycuda import gpuarray
from pycuda.compiler import SourceModule
# from pycuda.tools import DeviceData
import numpy as np
from pythonGMMLL import pythonLL
#prepare for global usage
def largertest(numRuns = 1000, numPoints = 512, dim = 13, numMixtures = 8):
... | mit | Python |
10af1018457410c8797ee9bb8bd51f6209e79bef | Fix changing dict value for key scenario | pecet/pytosg,pecet/pytosg | TwitterStatsLib/LazyDict.py | TwitterStatsLib/LazyDict.py | """ Simple module implementing lazy-loading dictionary class LazyDict """
class LazyDict(dict):
""" Simple implementation of dictionary which lazily compute values for its keys
when they are accessed
Note: calling repr function on LazyDict object does not compute any values
Usage:... | """ Simple module implementing lazy-loading dictionary class LazyDict """
class LazyDict(dict):
""" Simple implementation of dictionary which lazily compute values for its keys
when they are accessed
Note: calling repr function on LazyDict object does not compute any values
Usage:... | mit | Python |
8cbf0321a432463fdc79fc162b587e8b41892bd7 | move if statement to remove potentially uncessary symbol assignment. | constanthatz/data-structures | linked_list.py | linked_list.py | #!/usr/bin/env python
from __future__ import print_function
from __future__ import unicode_literals
class Node(object):
def __init__(self, value, next=None):
self.val = value
self.next = next
class LinkedList(object):
def __init__(self):
self.head = None
def insert(self, val):... | #!/usr/bin/env python
from __future__ import print_function
from __future__ import unicode_literals
class Node(object):
def __init__(self, value, next=None):
self.val = value
self.next = next
class LinkedList(object):
def __init__(self):
self.head = None
def insert(self, val):... | mit | Python |
2f101d165cf5b172f5a892b2ff1a44ae558bbc4c | Add some default parameter values to the world. | EmbodiedCognition/pagoda,EmbodiedCognition/pagoda | examples/cooper.py | examples/cooper.py | #!/usr/bin/env python
# Copyright (c) 2013 Leif Johnson <leif@leifjohnson.net>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
... | #!/usr/bin/env python
# Copyright (c) 2013 Leif Johnson <leif@leifjohnson.net>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
... | mit | Python |
6432d92533953c2873b315945254e5260a109106 | Modify way to find earliest date | StoDevX/cs251-toolkit,StoDevX/cs251-toolkit,StoDevX/cs251-toolkit,StoDevX/cs251-toolkit | cs251tk/student/markdownify/check_submit_date.py | cs251tk/student/markdownify/check_submit_date.py | import os
from dateutil.parser import parse
from ...common import run, chdir
def check_dates(spec_id, username, spec, basedir):
""" Port of the CheckDates program from C++
Finds the first submission date for an assignment
by comparing first commits for all files in the spec
and re... | import os
from dateutil.parser import parse
from ...common import run, chdir
def check_dates(spec_id, username, spec, basedir):
""" Port of the CheckDates program from C++
Finds the first submission date for an assignment
by comparing first commits for all files in the spec
and re... | mit | Python |
dc286973c2354728eec36b5b23e0f268baf9914b | update is_active status on the run | jmp0xf/django-currencies | currencies/management/commands/initcurrencies.py | currencies/management/commands/initcurrencies.py | import json
from urllib2 import urlopen
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.management.base import CommandError, BaseCommand
from currencies.models import Currency
CURRENCY_API_URL = "http://openexchangerates.org/currencies.json"
class Command(Bas... | import json
from urllib2 import urlopen
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.management.base import CommandError, BaseCommand
from currencies.models import Currency
CURRENCY_API_URL = "http://openexchangerates.org/currencies.json"
class Command(Bas... | bsd-3-clause | Python |
1b3f253070739aea28ef5c8729dd641eddcb9323 | Clean titles before querying the DB | dMaggot/ArtistGraph | src/artgraph/plugins/plugin.py | src/artgraph/plugins/plugin.py | import MySQLdb
import mwparserfromhell
class Plugin():
def get_wikicode(self, title):
# TODO Make this a conf
db = MySQLdb.connect(host="localhost", user="root", passwd="", db="BigData")
clean_title = title.replace(" ", "_")
cursor = db.cursor()
cursor.execute("""
... | import MySQLdb
import mwparserfromhell
class Plugin():
def get_wikicode(self, title):
# TODO Make this a conf
db = MySQLdb.connect(host="localhost", user="root", passwd="", db="BigData")
cursor = db.cursor()
cursor.execute("""
SELECT old_text
FROM text
INNER... | mit | Python |
f5477ea1aa848fa798c871a40284fd88e79e4432 | clean up: remove unused module and double import of 'os' | dietmarw/trimtrailingwhitespaces | testBinaryMagic.py | testBinaryMagic.py | #!/usr/bin/env python
"""
This binary tester uses the python magic implementation from
Adam Hupp, http://hupp.org/adam/hg/python-magic
"""
import os, sys, magic, textwrap
mime = magic.Magic(mime=True)
# detect the mime type of the text file
def detecttype(filename):
type = mime.from_file(filename)
if "text/" in ... | #!/usr/bin/env python
"""
This binary tester uses the python magic implementation from
Adam Hupp, http://hupp.org/adam/hg/python-magic
"""
import string, sys, magic, textwrap
mime = magic.Magic(mime=True)
# detect the mime type of the text file
def detecttype(filename):
type = mime.from_file(filename)
if "text/"... | unlicense | Python |
6a4d926e88c83fdac1f7bc046bc70fb21c8c23bf | reformat test and use better testing values | ImmobilienScout24/afp-cli,ImmobilienScout24/afp-cli,ImmobilienScout24/afp-cli | src/unittest/python/cli_functions_tests.py | src/unittest/python/cli_functions_tests.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from unittest2 import TestCase
import afp_cli.cli_functions as cli
from datetime import datetime
class CliFunctionsTest(TestCase):
def test_format_aws_credentials_with_prefix(self):
credentials = {"AWS_ACCESS_KEY_ID": "testAccessKey"}
self.assertEqua... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from unittest2 import TestCase
import afp_cli.cli_functions as cli
from datetime import datetime
class CliFunctionsTest(TestCase):
def test_format_aws_credentials_with_prefix(self):
credentials = {"AWS_ACCESS_KEY_ID": "testAccessKey"}
self.assertEqua... | apache-2.0 | Python |
7591133cc1dca212ec906ddcaa3f2cda9a99f154 | use custom faceted search view | datamade/chi-councilmatic,tor-councilmatic/tor-councilmatic,tor-councilmatic/tor-councilmatic,patcon/sfo-councilmatic,datamade/chi-councilmatic,datamade/chi-councilmatic,patcon/sfo-councilmatic,CivicTechTO/tor-councilmatic,CivicTechTO/tor-councilmatic,tor-councilmatic/tor-councilmatic,datamade/chi-councilmatic,datamade... | councilmatic/urls.py | councilmatic/urls.py | """councilmatic URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/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')
Clas... | """councilmatic URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/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')
Clas... | mit | Python |
99313cc5fdc6e2a2791e2d6efc05a49be5fac1cf | Update makeWordPatterns: fixed PEP8 spacing | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | books/CrackingCodesWithPython/Chapter17/makeWordPatterns.py | books/CrackingCodesWithPython/Chapter17/makeWordPatterns.py | # Makes the wordPatterns.py File
# https://www.nostarch.com/crackingcodes (BSD Licensed)
# Creates wordPatterns.py based on the words in our dictionary
# text file, dictionary.txt. (Download this file from
# https://invpy.com/dictionary.txt)
import pprint
def getWordPattern(word):
# Returns a string of the patt... | # Makes the wordPatterns.py File
# https://www.nostarch.com/crackingcodes (BSD Licensed)
# Creates wordPatterns.py based on the words in our dictionary
# text file, dictionary.txt. (Download this file from
# https://invpy.com/dictionary.txt)
import pprint
def getWordPattern(word):
# Returns a string of the patt... | mit | Python |
8d070b0605cb5412aa1ab8249ce00e726210dc68 | Update IP for test | rmarchant/gandi-ddns | test_gandi_ddns.py | test_gandi_ddns.py | import gandi_ddns as script
import socket
def test_get_ip():
assert script.get_ip() == socket.gethostbyname(socket.gethostname()) | import gandi_ddns as script
def test_get_ip():
assert script.get_ip() == 'test-toto' | mit | Python |
0885f22b5d1edf509badf66bb26324739526b37e | Tweak and clean up | dgaston/ddb-datastore,dgaston/ddbio-variantstore,GastonLab/ddb-datastore,dgaston/ddb-variantstore | coverage_analysis.py | coverage_analysis.py | #!/usr/bin/env python
import sys
import csv
import argparse
import utils
import getpass
import plotly
from coveragestore import AmpliconCoverage
from cassandra.cqlengine import connection
from cassandra.auth import PlainTextAuthProvider
def get_regions(infile):
regions = list()
with open(infile, 'r') as csv... | #!/usr/bin/env python
import sys
import csv
import argparse
import utils
import getpass
import plotly
from coveragestore import AmpliconCoverage
from cassandra.cqlengine import connection
from cassandra.auth import PlainTextAuthProvider
def get_regions(infile):
regions = list()
with open(infile, 'r') as csv... | mit | Python |
286fa872ed4f8b376a7f29de575bd3f8fd632ba9 | fix a bug in clearDataBase | yliu120/dbsystem,yliu120/dbsystem,yliu120/dbsystem | HW3/dbsys-hw3/clearDataBase.py | HW3/dbsys-hw3/clearDataBase.py | from Database import Database
from Catalog.Schema import DBSchema
import os;
# close all the files in that directory.
def list_files(path):
# returns a list of names (with extension, without full path) of all files
# in folder path
files = []
for name in os.listdir(path):
if os.path.isfile(os.... | from Database import Database
from Catalog.Schema import DBSchema
import os;
# close all the files in that directory.
def list_files(path):
# returns a list of names (with extension, without full path) of all files
# in folder path
files = []
for name in os.listdir(path):
if os.path.isfile(os.... | apache-2.0 | Python |
27a337eee136f407a315c20c10d142b656ad7a31 | Refactor tests | reubano/amzn-search-api,reubano/amzn-search-api,reubano/amzn-search-api | app/api.py | app/api.py | # -*- coding: utf-8 -*-
""" Interface to Amazon API """
from os import getenv
from amazon.api import AmazonAPI
class Amazon(AmazonAPI):
"""An Amazon search"""
def __init__(self, region='US', **kwargs):
"""
Initialization method.
Parameters
----------
key : AWS_ACCESS_KEY_ID
secret : AWS_SECRET_ACCESS... | # -*- coding: utf-8 -*-
""" Interface to Amazon API """
from os import getenv
from amazon.api import AmazonAPI
class Amazon(AmazonAPI):
"""An Amazon search"""
def __init__(self, region='US', **kwargs):
"""
Initialization method.
Parameters
----------
key : AWS_ACCESS_KEY_ID
secret : AWS_SECRET_ACCESS... | mit | Python |
18cbb9bdc6d7fce6fc009758ec6f1916c7db4444 | Fix permissions setup: previously the setup_groups function was getting called once after the contrib.auth syncdb, resulting in permissions for 'filesystem_administrators' not getting created for chroma_core models. | intel-hpdd/intel-manager-for-lustre,intel-hpdd/intel-manager-for-lustre,intel-hpdd/intel-manager-for-lustre | chroma-manager/chroma_core/management/__init__.py | chroma-manager/chroma_core/management/__init__.py | #
# ========================================================
# Copyright (c) 2012 Whamcloud, Inc. All rights reserved.
# ========================================================
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
import django.contrib.auth as auth
f... | #
# ========================================================
# Copyright (c) 2012 Whamcloud, Inc. All rights reserved.
# ========================================================
from django.contrib.auth.models import User
from django.db.models.signals import post_syncdb
from django.contrib.contenttypes.models import... | mit | Python |
ad2b4d887be98179c9b4537fd4f8d6af4654ca62 | Add test for backward | jnishi/chainer,chainer/chainer,niboshi/chainer,kashif/chainer,ktnyt/chainer,ysekky/chainer,hvy/chainer,keisuke-umezawa/chainer,keisuke-umezawa/chainer,okuta/chainer,niboshi/chainer,chainer/chainer,cupy/cupy,jnishi/chainer,niboshi/chainer,jnishi/chainer,wkentaro/chainer,kiyukuta/chainer,keisuke-umezawa/chainer,wkentaro/... | tests/chainer_tests/functions_tests/array_tests/test_stack.py | tests/chainer_tests/functions_tests/array_tests/test_stack.py | import unittest
import numpy
import chainer
from chainer import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
@testing.parameterize(*testing.product_dict(
[
{'shape': (3, 4), 'axis': 0, 'y_shape': (2, 3, 4)},
{'... | import unittest
import numpy
import chainer
from chainer import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
@testing.parameterize(*testing.product_dict(
[
{'shape': (3, 4), 'axis': 0},
{'shape': (3, 4), 'axis'... | mit | Python |
bfc4402ecacf5e0f76cdafd8c03705dbde45e6e2 | change default notice to not mail | Turan-no/Turan,Turan-no/Turan,Turan-no/Turan,Turan-no/Turan | apps/turan/management.py | apps/turan/management.py | from django.conf import settings
from django.db.models import signals
from django.utils.translation import ugettext_noop as _
if "notification" in settings.INSTALLED_APPS:
from notification import models as notification
def create_notice_types(app, created_models, verbosity, **kwargs):
notification.cr... | from django.conf import settings
from django.db.models import signals
from django.utils.translation import ugettext_noop as _
if "notification" in settings.INSTALLED_APPS:
from notification import models as notification
def create_notice_types(app, created_models, verbosity, **kwargs):
notification.cr... | agpl-3.0 | Python |
f58940027a0e152ba68917a4b85dd1dfed1095a9 | Add data: and unsafe-local for base64 fonts and inline js | LandRegistry-Attic/flask-examples,LandRegistry-Attic/flask-examples,LandRegistry-Attic/flask-examples,LandRegistry-Attic/flask-examples | appname/server.py | appname/server.py | from flask import render_template
from appname import app, db
from models import Foo
from flask.ext.assets import Environment, Bundle
# Static assets
assets = Environment(app)
css_main = Bundle(
'stylesheets/main.scss',
filters='scss',
output='build/main.css',
depends="**/*.scss"
)
assets.register('cs... | from flask import render_template
from appname import app, db
from models import Foo
from flask.ext.assets import Environment, Bundle
# Static assets
assets = Environment(app)
css_main = Bundle(
'stylesheets/main.scss',
filters='scss',
output='build/main.css',
depends="**/*.scss"
)
assets.register('cs... | mit | Python |
141c71ee25d26c46116c40e652065d75abf8d411 | Add an error handling for missing modules of the gs subcommand | thombashi/sqlitebiter,thombashi/sqlitebiter | sqlitebiter/subcommand/_gs.py | sqlitebiter/subcommand/_gs.py | """
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
import msgfy
import pytablereader as ptr
from ._base import SourceInfo, TableConverter
class GoogleSheetsConverter(TableConverter):
def convert(self, credentials, title):
logger = self._logger
result_counter = self._result_... | """
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
import msgfy
import pytablereader as ptr
from ._base import SourceInfo, TableConverter
class GoogleSheetsConverter(TableConverter):
def convert(self, credentials, title):
logger = self._logger
result_counter = self._result_... | mit | Python |
df677a5b5c2833a789247a499a1fda05bb6c35a2 | Add __repr__ to Token. | SunDwarf/asyncqlio | katagawa/sql/__init__.py | katagawa/sql/__init__.py | """
SQL generators for Katagawa.
"""
import abc
import typing
class Token(abc.ABC):
"""
Base class for a token.
"""
__slots__ = ()
def __init__(self, subtokens: typing.List['Token']=None):
"""
:param subtokens: Any subtokens this token has.
"""
if subtokens is Non... | """
SQL generators for Katagawa.
"""
import abc
import typing
class Token(abc.ABC):
"""
Base class for a token.
"""
__slots__ = ()
def __init__(self, subtokens: typing.List['Token']=None):
"""
:param subtokens: Any subtokens this token has.
"""
if subtokens is Non... | mit | Python |
facafb6e2a466162ca1cb872d81960d40cecb2d5 | Add terminal colors to main entry point | pennsignals/aptos | aptos/__main__.py | aptos/__main__.py | import argparse
import json
import sys
from .parser import SchemaParser
from .visitor import ValidationVisitor
from .schema.visitor import AvroSchemaVisitor
class TermColors:
GREEN = '\033[92m'
RED = '\033[91m'
DEFAULT = '\033[0m'
def validate(arguments):
with open(arguments.schema) as fp:
... | import argparse
import json
import sys
from .parser import SchemaParser
from .visitor import ValidationVisitor
from .schema.visitor import AvroSchemaVisitor
def validate(arguments):
with open(arguments.schema) as fp:
schema = json.load(fp)
component = SchemaParser.parse(schema)
try:
compo... | apache-2.0 | Python |
dfca7727f37c8893eb481163cdaebce43ba31a1f | Add AudioLibrary update and clean functions in prep for audio library | robweber/maraschino,awagnon/maraschino,awagnon/maraschino,insertnamehere1/maraschino,runjmc/maraschino,insertnamehere1/maraschino,gugahoi/maraschino,insertnamehere1/maraschino,gugahoi/maraschino,mrkipling/maraschino,mrkipling/maraschino,mboeru/maraschino,insertnamehere1/maraschino,awagnon/maraschino,mboeru/maraschino,g... | controls.py | controls.py | from flask import Flask, jsonify
import jsonrpclib
from maraschino import app
from settings import *
from noneditable import *
from tools import *
@app.route('/xhr/play_episode/<int:episode_id>')
@requires_auth
def xhr_play_episode(episode_id):
xbmc = jsonrpclib.Server(server_api_address())
xbmc.Playlist.Clea... | from flask import Flask, jsonify
import jsonrpclib
from maraschino import app
from settings import *
from noneditable import *
from tools import *
@app.route('/xhr/play_episode/<int:episode_id>')
@requires_auth
def xhr_play_episode(episode_id):
xbmc = jsonrpclib.Server(server_api_address())
xbmc.Playlist.Clea... | mit | Python |
5a649690bddadafc1037fe4dcbd90efcd66741d2 | sort imports | ZeitOnline/zeit.content.portraitbox | src/zeit/content/portraitbox/interfaces.py | src/zeit/content/portraitbox/interfaces.py | # Copyright (c) 2007-2010 gocept gmbh & co. kg
# See also LICENSE.txt
from zeit.cms.i18n import MessageFactory as _
import zeit.cms.content.contentsource
import zeit.content.image.interfaces
import zope.interface
import zope.schema
class IPortraitbox(zope.interface.Interface):
name = zope.schema.TextLine(
... | # Copyright (c) 2007-2010 gocept gmbh & co. kg
# See also LICENSE.txt
import zope.interface
import zope.schema
import zeit.cms.content.contentsource
import zeit.content.image.interfaces
from zeit.cms.i18n import MessageFactory as _
class IPortraitbox(zope.interface.Interface):
name = zope.schema.TextLine(
... | bsd-3-clause | Python |
68658bfc8827cf5799f0c96b6b94b38bbcdfc30b | add operation state vars | dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq | corehq/sql_accessors/migrations/0010_update_state_type_values.py | corehq/sql_accessors/migrations/0010_update_state_type_values.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from corehq.form_processor.models import CaseTransaction, XFormInstanceSQL, CommCareCaseIndexSQL, XFormOperationSQL
from corehq.sql_db.operations import RawSQLMigration, HqRunSQL
migrator = RawSQLMigration(('core... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from corehq.form_processor.models import CaseTransaction, XFormInstanceSQL, CommCareCaseIndexSQL
from corehq.sql_db.operations import RawSQLMigration, HqRunSQL
migrator = RawSQLMigration(('corehq', 'sql_accessors... | bsd-3-clause | Python |
99ca98eaea235d801af08af7953e0160229633f1 | Rename colour_up/colour_down to color_up/color_down | enkore/i3pystatus,yang-ling/i3pystatus,drwahl/i3pystatus,m45t3r/i3pystatus,ncoop/i3pystatus,facetoe/i3pystatus,yang-ling/i3pystatus,asmikhailov/i3pystatus,eBrnd/i3pystatus,facetoe/i3pystatus,fmarchenko/i3pystatus,richese/i3pystatus,richese/i3pystatus,schroeji/i3pystatus,teto/i3pystatus,Arvedui/i3pystatus,drwahl/i3pysta... | i3pystatus/openvpn.py | i3pystatus/openvpn.py | from i3pystatus import IntervalModule
from i3pystatus.core.command import run_through_shell
__author__ = 'facetoe'
class OpenVPN(IntervalModule):
"""
Monitor OpenVPN connections.
Currently only supports systems that use Systemd.
Formatters:
* {vpn_name} — Same as setting.
* {status} — Unico... | from i3pystatus import IntervalModule
from i3pystatus.core.command import run_through_shell
__author__ = 'facetoe'
class OpenVPN(IntervalModule):
"""
Monitor OpenVPN connections.
Currently only supports systems that use Systemd.
Formatters:
* {vpn_name} — Same as setting.
* {status} — Unico... | mit | Python |
32f06a7d3fc14600792a07bf00fab60af4ac395a | Add wrapper for render_to_resposne to include tmpl context processors easily | artefactual/archivematica-history,artefactual/archivematica-history,artefactual/archivematica-history,artefactual/archivematica-history | src/dashboard/src/contrib/utils.py | src/dashboard/src/contrib/utils.py | from django.shortcuts import render_to_response
from django.template.context import RequestContext
def render(request, template, context={}):
return render_to_response(template, context, context_instance=RequestContext(request))
def get_directory_name(job):
"""
Expected format:
%sharedPath%watched... | def get_directory_name(job):
"""
Expected format:
%sharedPath%watchedDirectories/workFlowDecisions/createDip/ImagesSIP-69826e50-87a2-4370-b7bd-406fc8aad94f/
"""
import re
directory = job.directory
uuid = job.sipuuid
try:
return re.search(r'^.*/(?P<directory>.*)-[\w]{8}(-[\w... | agpl-3.0 | Python |
d15c830111987388bec89c2549a16b809d656a83 | Add run_sftp and remove URL manipulation methods from SCP. | Jarn/jarn.mkrelease | jarn/mkrelease/scp.py | jarn/mkrelease/scp.py | from tempfile import NamedTemporaryFile
from process import Process
from exit import err_exit
class SCP(object):
"""Secure copy and FTP abstraction."""
def __init__(self, process=None):
self.process = process or Process()
def run_scp(self, distfile, location):
if not self.process.quiet:... | from process import Process
from exit import err_exit
class SCP(object):
"""Secure copy abstraction."""
def __init__(self, process=None):
self.process = process or Process()
def has_host(self, location):
colon = location.find(':')
slash = location.find('/')
return colon >... | bsd-2-clause | Python |
c2d7f4c6ae9042d1cc7f11fa82d7133e9b506ad7 | Fix UTF-8 encoding for json exports | dainst/gazetteer,dainst/gazetteer,dainst/gazetteer,dainst/gazetteer,dainst/gazetteer,dainst/gazetteer | src/main/scripts/data_exports/export_json.py | src/main/scripts/data_exports/export_json.py | from lib.harvester import Harvester
from lib.cli_helper import is_writable_directory
import argparse
import logging
import json
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
logging.basicConfig(format="%(asctime... | from lib.harvester import Harvester
from lib.cli_helper import is_writable_directory
import argparse
import logging
import json
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
logging.basicConfig(format="%(asctime... | apache-2.0 | Python |
83fda4fbc5c7ba46d2c84ad2f1264931e486f6f3 | Fix leeds_sports_pose_extended urls | dbcollection/dbcollection,farrajota/dbcollection | dbcollection/datasets/leeds_sports_pose/lsp_extended/__init__.py | dbcollection/datasets/leeds_sports_pose/lsp_extended/__init__.py | """
Leeds Sports Pose Exntended (LSPe) Dataset download/process functions.
"""
from dbcollection.datasets.dbclass import BaseDataset
from .keypoints import Keypoints
class LSPe(BaseDataset):
""" Leeds Sports Pose Extended (LSPe) Dataset preprocessing/downloading functions """
# download url
url = ["htt... | """
Leeds Sports Pose Exntended (LSPe) Dataset download/process functions.
"""
from dbcollection.datasets.dbclass import BaseDataset
from .keypoints import Keypoints
class LSPe(BaseDataset):
""" Leeds Sports Pose Extended (LSPe) Dataset preprocessing/downloading functions """
# download url
url = ["htt... | mit | Python |
cf492580687160408a38a8a0c38db01bf851e5ea | Fix issue with project names in PubAnnotation | jakelever/kindred,jakelever/kindred | kindred/pubannotation.py | kindred/pubannotation.py | """
Importer for PubAnnotation data
"""
import sys
import kindred
import requests
import re
from kindred.loadFunctions import parseJSON
def load(projectName):
projectURL = "http://pubannotation.org/projects/%s/docs.json" % projectName
loaded = kindred.Corpus()
docs = requests.get(projectURL)
for doc in docs.... | """
Importer for PubAnnotation data
"""
import sys
import kindred
import requests
import re
from kindred.loadFunctions import parseJSON
def load(projectName):
projectURL = "http://pubannotation.org/projects/%s/docs.json" % projectName
loaded = kindred.Corpus()
docs = requests.get(projectURL)
for doc in docs.... | mit | Python |
ffdb1d14c4cd2be987e02822d79ead63b812081d | Update kotlin version for 02_10_2022 release. | android/android-test,android/android-test,android/android-test,android/android-test,android/android-test | build_extensions/axt_versions.bzl | build_extensions/axt_versions.bzl | """Defines current AXT versions and dependencies."""
# AXT versions
RUNNER_VERSION = "1.5.0-alpha01" # stable 1.4.0
RULES_VERSION = "1.4.1-alpha04" # stable 1.4.0
MONITOR_VERSION = "1.6.0-alpha01" # stable 1.5.0
ESPRESSO_VERSION = "3.5.0-alpha04" # stable 3.4.0
CORE_VERSION = "1.4.1-alpha04" # stable 1.4.0
ANDROI... | """Defines current AXT versions and dependencies."""
# AXT versions
RUNNER_VERSION = "1.5.0-alpha01" # stable 1.4.0
RULES_VERSION = "1.4.1-alpha04" # stable 1.4.0
MONITOR_VERSION = "1.6.0-alpha01" # stable 1.5.0
ESPRESSO_VERSION = "3.5.0-alpha04" # stable 3.4.0
CORE_VERSION = "1.4.1-alpha04" # stable 1.4.0
ANDROI... | apache-2.0 | Python |
420aeb571c75f3511ed0de1dc21e7a9f717c8d4a | Add Bullseye to Constants | cqse/teamscale-client-python | teamscale_client/constants.py | teamscale_client/constants.py | """This module contains multiple constants collections typically used when
communicating metrics and findings with Teamscale."""
from __future__ import absolute_import
from __future__ import unicode_literals
class Assessment:
"""Constants to be used as assessment levels."""
RED = "RED"
YELLOW = "YELLOW"... | """This module contains multiple constants collections typically used when
communicating metrics and findings with Teamscale."""
from __future__ import absolute_import
from __future__ import unicode_literals
class Assessment:
"""Constants to be used as assessment levels."""
RED = "RED"
YELLOW = "YELLOW"... | apache-2.0 | Python |
83981c8026da1992b7a5630d4db9d6cd538c6afd | test script for random classifier | vincentadam87/gatsby-hackathon-seizure,vincentadam87/gatsby-hackathon-seizure | code/python/seizures/tests/xvalidation_random_classifier.py | code/python/seizures/tests/xvalidation_random_classifier.py | '''
Created on 28 Jun 2014
@author: heiko
'''
import numpy as np
from seizures.evaluation.XValidation import XValidation
from seizures.prediction.RandomPredictor import RandomPredictor
if __name__ == '__main__':
predictor = RandomPredictor()
N = 1000
D = 2
X = np.random.randn(N, D)
y = np.ra... | '''
Created on 28 Jun 2014
@author: heiko
'''
import numpy as np
from seizures.evaluation.XValidation import XValidation
from seizures.prediction.ForestPredictor import ForestPredictor
from seizures.prediction.RandomPredictor import RandomPredictor
def test_predictor(predictor_cls):
predictor = predictor_cls()
... | bsd-2-clause | Python |
51f9ec0360fa810d0b9709dedb4c9342fc2220dd | Update last seen when a message is received too. | MJB47/Jokusoramame,MJB47/Jokusoramame,MJB47/Jokusoramame | joku/cogs/tracking.py | joku/cogs/tracking.py | """
NSA-tier presence tracking.
"""
import datetime
import time
import discord
from discord import Status
from discord.ext import commands
from joku.bot import Context
from joku.cogs._common import Cog
class Tracking(Cog):
async def on_message(self, message: discord.Message):
author = message.author # ... | """
NSA-tier presence tracking.
"""
import datetime
import time
import discord
from discord import Status
from discord.ext import commands
from joku.bot import Context
from joku.cogs._common import Cog
class Tracking(Cog):
async def on_message(self, message: discord.Message):
author = message.author # ... | mit | Python |
61a41a65162d10f757e4aa937f69822d08ba63c3 | Remove hardcoded connection values | horkko/biomaj-postgres,horkko/biomaj-postgres | bm2bp.py | bm2bp.py | __author__ = 'tuco'
from pymongo import MongoClient
import psycopg2
from psycopg2 import OperationalError, DatabaseError, IntegrityError
import json
from biomaj.config import BiomajConfig
import os
"""
This small script is a test script to transfert data from a Biomaj MongoDB
database into a PostgreSQL data using Json... | __author__ = 'tuco'
from pymongo import MongoClient
import psycopg2
from psycopg2 import OperationalError, DatabaseError, IntegrityError
import json
from biomaj.config import BiomajConfig
"""
This small script is a test script to transfert data from a Biomaj MongoDB
database into a PostgreSQL data using Jsonb data ty... | agpl-3.0 | Python |
da819f39fcfa9c50d89be4ea372dea9eb48ce84d | use absolute file path | thekingofkings/chicago-crime,thekingofkings/urban-flow-analysis,thekingofkings/chicago-crime,thekingofkings/chicago-crime,thekingofkings/chicago-crime,thekingofkings/urban-flow-analysis,thekingofkings/chicago-crime,thekingofkings/urban-flow-analysis,thekingofkings/chicago-crime,thekingofkings/urban-flow-analysis,thekin... | python/chicago_crime_server.py | python/chicago_crime_server.py | from flask import Flask, request, jsonify
from flask import render_template
from NBRegression import *
import os
here = os.path.dirname(__file__)
app = Flask(__name__)
app.debug=True
features = ['density', 'disadvantage', 'ethnic', 'pctblack', 'pctship',
'population', 'poverty', 'residential', '... | from flask import Flask, request, jsonify
from flask import render_template
from NBRegression import *
app = Flask(__name__)
features = ['density', 'disadvantage', 'ethnic', 'pctblack', 'pctship',
'population', 'poverty', 'residential', 'sociallag', 'spatiallag',
'temporallag']
@app.route('... | mit | Python |
9c5d51609974c50f0b0b3dd66bf810dd0e2ae218 | Fix pyflakes style | instagrambot/instabot,misisnik/testinsta,Diapostrofo/instabot,ohld/instabot,misisnik/testinsta,instagrambot/instabot,sudoguy/instabot | instabot/bot/delay.py | instabot/bot/delay.py | """
Function to calculate delays for like/follow/unfollow etc.
"""
import time
import random
def add_dispersion(delay_value):
return delay_value * 3 / 4 + delay_value * random.random() / 2
# this function will sleep only if elapsed time since `last_action` is less than `target_delay`
def sleep_if_need(last... | """
Function to calculate delays for like/follow/unfollow etc.
"""
import time
import random
def add_dispersion(delay_value):
return delay_value * 3 / 4 + delay_value * random.random() / 2
# this function will sleep only if elapsed time since `last_action` is less than `target_delay`
def sleep_if_need(last... | apache-2.0 | Python |
c537555c8b3471af8a9c814500f92b4363b7b2f5 | Bump minor version for Py3 compat (#33) | fastly/fastly-py,fastly/fastly-py | fastly/_version.py | fastly/_version.py | __version__ = '0.1.4'
| __version__ = '0.1.3'
| mit | Python |
fd4063401ecf8153dba59f801e78e37d4c6fa3bf | Use tracks page instead of library. | foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm | lastscrape/lastscrape.py | lastscrape/lastscrape.py | #!/usr/bin/env python
#-*- coding: utf-8 -*-
"""usage: lastscrape.py USER [OUTPUT_FILE]"""
import sys
import time
import codecs
import urllib2
from BeautifulSoup import BeautifulSoup
sys.stdout = codecs.lookup('utf-8')[-1](sys.stdout)
def parse_page(page):
"""Parse a page of recently listened tracks and return a lis... | #!/usr/bin/env python
#-*- coding: utf-8 -*-
"""usage: lastscrape.py USER [OUTPUT_FILE]"""
import sys
import time
import codecs
import urllib2
from BeautifulSoup import BeautifulSoup
sys.stdout = codecs.lookup('utf-8')[-1](sys.stdout)
def parse_page(page):
soup = BeautifulSoup(urllib2.urlopen(page))
for row in soup... | agpl-3.0 | Python |
93312a0d8c2fe42cec38c26fbeb3e59c10e99274 | use django-genericadmin if available for admin UI | pombredanne/django-activity-stream,justquick/django-activity-stream,pknowles/django-activity-stream,pombredanne/django-activity-stream,jimlyndon/django-activity-stream,pknowles/django-activity-stream,intelivix/django-activity-stream,thelabnyc/django-activity-stream,jimlyndon/django-activity-stream,intelivix/django-acti... | actstream/admin.py | actstream/admin.py | from django.contrib import admin
from actstream import models
# Use django-generic-admin widgets if available
try:
from genericadmin.admin import GenericAdminModelAdmin as ModelAdmin
except ImportError:
ModelAdmin = admin.ModelAdmin
class ActionAdmin(ModelAdmin):
date_hierarchy = 'timestamp'
list_dis... | from django.contrib import admin
from actstream import models
class ActionAdmin(admin.ModelAdmin):
date_hierarchy = 'timestamp'
list_display = ('__str__', 'actor', 'verb', 'target')
list_editable = ('verb',)
list_filter = ('timestamp',)
raw_id_fields = ('actor_content_type', 'target_content_type'... | bsd-3-clause | Python |
2f3139b2dfa2662daa7e57b221836ff2923c5fc9 | Add 'public' field to ActionAdmin list display | druss16/danslist,Shanto/django-activity-stream,jimlyndon/django-activity-stream,intelivix/django-activity-stream,pombredanne/django-activity-stream,github-account-because-they-want-it/django-activity-stream,thelabnyc/django-activity-stream,github-account-because-they-want-it/django-activity-stream,pknowles/django-activ... | actstream/admin.py | actstream/admin.py | from django.contrib import admin
from actstream import models
# Use django-generic-admin widgets if available
try:
from genericadmin.admin import GenericAdminModelAdmin as ModelAdmin
except ImportError:
ModelAdmin = admin.ModelAdmin
class ActionAdmin(ModelAdmin):
date_hierarchy = 'timestamp'
list_dis... | from django.contrib import admin
from actstream import models
# Use django-generic-admin widgets if available
try:
from genericadmin.admin import GenericAdminModelAdmin as ModelAdmin
except ImportError:
ModelAdmin = admin.ModelAdmin
class ActionAdmin(ModelAdmin):
date_hierarchy = 'timestamp'
list_dis... | mit | Python |
5409e2c07e92ebe9483ed3edf7f55f54f70fc920 | bump version to 0.25.0 | jythontools/wheel,jythontools/wheel | wheel/__init__.py | wheel/__init__.py | # __variables__ with double-quoted values will be available in setup.py:
__version__ = "0.25.0"
| # __variables__ with double-quoted values will be available in setup.py:
__version__ = "0.24.0"
| mit | Python |
cb0def14a532cb71ac74d85c26453316410dade5 | Use new Generator Archaius attributes | gogoair/foremast,gogoair/foremast | src/foremast/s3/create_archaius.py | src/foremast/s3/create_archaius.py | """Archaius functions for deployment."""
import logging
import boto3
from ..utils import get_app_details
LOG = logging.getLogger(__name__)
def init_properties(env='dev', app='unnecessary'):
"""Make sure _application.properties_ file exists in S3.
For Applications with Archaius support, there needs to be a... | """Archaius functions for deployment."""
import logging
import boto3
from ..utils import get_app_details
LOG = logging.getLogger(__name__)
def init_properties(env='dev', app='unnecessary'):
"""Make sure _application.properties_ file exists in S3.
For Applications with Archaius support, there needs to be a... | apache-2.0 | Python |
0fa9685ee47aeae36add5e1dbf77090651a3af88 | Rename testcase name | gutomaia/chipy8 | tests/test_arch.py | tests/test_arch.py | from unittest import TestCase
from chipy8 import Chip8
class TestChip8Architecture(TestCase):
def setUp(self):
self.cpu = Chip8()
def test_memory_length(self):
'Chip8 has 4096 bytes of memory.'
self.assertEqual(4096, len(self.cpu.memory))
def test_memory_clear(self):
'Chi... | from unittest import TestCase
from chipy8 import Chip8
class Chip8Architecture(TestCase):
def setUp(self):
self.cpu = Chip8()
def test_memory_length(self):
'Chip8 has 4096 bytes of memory.'
self.assertEqual(4096, len(self.cpu.memory))
def test_memory_clear(self):
'Chip8 m... | bsd-3-clause | Python |
3ea4b551bd8159cc6ea21ca591d0e4c1b2825481 | Debug Selenium | SURFscz/SCZ-deploy,SURFscz/SCZ-deploy,SURFscz/SCZ-deploy,SURFscz/SCZ-deploy | scripts/sbs-login.py | scripts/sbs-login.py | #!/usr/bin/env python
# -*- coding: future_fstrings -*-
from selenium.webdriver import Chrome
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support.expected_conditions import staleness_of, title_is, presence_of_element_located
fr... | #!/usr/bin/env python
# -*- coding: future_fstrings -*-
from selenium.webdriver import Chrome
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support.expected_conditions import staleness_of, title_is, presence_of_element_located
fr... | apache-2.0 | Python |
0651ef7340ed2caed641f62f27129e1e24c94679 | remove application id validation | mauriceyap/ccm-assistant | src/alexa-main.py | src/alexa-main.py | import handlers.events as events
APPLICATION_ID = "amzn1.ask.skill.dd677950-cade-4805-b1f1-ce2e3a3569f0"
def lambda_handler(event, context):
if event['session']['new']:
events.on_session_started({'requestId': event['request']['requestId']},
event['session'])
request... | import handlers.events as events
APPLICATION_ID = "amzn1.ask.skill.dd677950-cade-4805-b1f1-ce2e3a3569f0"
def lambda_handler(event, context):
# Make sure only this Alexa skill can use this function
if event['session']['application']['applicationId'] != APPLICATION_ID:
raise ValueError("Invalid Applica... | mit | Python |
01cd6bda62d881f0b40bd2cf2b3cfc9b3accf179 | add tactics reader | nclab/autoprover,elic-eon/autoprover | utils/tactic.py | utils/tactic.py | def tacticReader(tacticBase):
tactics = []
for line in tacticBase:
line = line.strip()
if not line.startwith("#"):
for tactic in line.rstrip().split(','):
tactics.append((tactic, repeatable))
repeatable = True
else:
if line.startwith("#... | mit | Python | |
c984c1d9118eea29c19165214992db37b9d4e3a1 | add init | dpressel/baseline,dpressel/baseline,dpressel/baseline,dpressel/baseline | python/xpctl/xpctl/__init__.py | python/xpctl/xpctl/__init__.py | apache-2.0 | Python | ||
83667826884fae7aa3dfbcf3b73aedab9922a356 | Create ActivitySelection (#1384) | TheAlgorithms/Python | other/activity_selection.py | other/activity_selection.py | """The following implementation assumes that the activities
are already sorted according to their finish time"""
"""Prints a maximum set of activities that can be done by a
single person, one at a time"""
# n --> Total number of activities
# start[]--> An array that contains start time of all activities
# finish... | mit | Python | |
1003e28f3989c95369d2f9e0c034093b1fac70dc | Add impute_names script | sbt9uc/osf.io,sloria/osf.io,jnayak1/osf.io,zamattiac/osf.io,caneruguz/osf.io,samanehsan/osf.io,ckc6cz/osf.io,leb2dg/osf.io,binoculars/osf.io,ckc6cz/osf.io,kch8qx/osf.io,ZobairAlijan/osf.io,fabianvf/osf.io,brianjgeiger/osf.io,haoyuchen1992/osf.io,billyhunt/osf.io,SSJohns/osf.io,himanshuo/osf.io,mluke93/osf.io,amyshi188/... | scripts/impute_names.py | scripts/impute_names.py | """
Email users to verify citation information.
"""
from framework.auth.utils import parse_name
from framework.email.tasks import send_email
from website.app import init_app
from website import models
from website import settings
app = init_app('website.settings', set_backends=True, routes=True)
email_template = ''... | apache-2.0 | Python | |
c0d074cb5de58b8d8da84ff93d52ca49bf58bb42 | Add wip view class, should have basic functionally at this point. | explosiveduck/ed2d,explosiveduck/ed2d | ed2d/view.py | ed2d/view.py | from ed2d import idgen
class View(object):
def __init__(self):
self.sids = idgen.IdGenerator()
self.programs = []
self.uniforms = []
self.uniformIds = []
self.pids = idgen.IdGenerator()
self.projections = []
self.projNames = []
self.progPerProj = [... | bsd-2-clause | Python | |
510117cb0f487232d1cd0c5392a4514e1dc1b46e | Add testing publisher script for dummy myo data | ipab-rad/myo_baxter_pc,ipab-rad/myo_baxter_pc,ipab-rad/baxter_myo,ipab-rad/baxter_myo | scripts/produce_data.py | scripts/produce_data.py | #!/usr/bin/python
import time
import sys
import random
import rospy
import cv_bridge
import cv
import rospkg
from geometry_msgs.msg import Vector3
class DataTester(object):
def __init__(self, myo_number, mode="zero"):
self.mode = mode
self._myo_name = "myo_" + str(myo_number)
rospy.init... | mit | Python | |
982a4e48762f0c70c5b9043ce0ffcf99e7bb2230 | Add AngelList | foauth/foauth.org,foauth/foauth.org,foauth/foauth.org,foauth/oauth-proxy | services/angellist.py | services/angellist.py | import foauth.providers
class AngelList(foauth.providers.OAuth2):
# General info about the provider
provider_url = 'https://angel.co/'
docs_url = 'https://angel.co/api'
category = 'Money'
# URLs to interact with the API
authorize_url = 'https://angel.co/api/oauth/authorize'
access_token_u... | bsd-3-clause | Python | |
c14d1fa81c0f77d43d0a087858fde1db878a9ee2 | add geom_ridge diagram | probml/pyprobml,probml/pyprobml,probml/pyprobml,probml/pyprobml | scripts/geom_ridge.py | scripts/geom_ridge.py | # Geometry of Ridge Regression
# Author: Gerardo Durán Martín
import numpy as np
import matplotlib.pyplot as plt
import warnings
# Filter warning creating parts of the ellipses that
# do not exist
warnings.filterwarnings("ignore", category=RuntimeWarning)
def range_chebyshev(a, b, steps):
"""
Create a grid... | mit | Python | |
319416957cfa653dbc96af4a2a6c8ee93881b122 | add performance_Events.py in examples/ROOT | TaiSakuma/AlphaTwirl,TaiSakuma/AlphaTwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl | examples/ROOT/performance_Events.py | examples/ROOT/performance_Events.py | #!/usr/bin/env python
# Tai Sakuma <tai.sakuma@cern.ch>
##__________________________________________________________________||
import os, sys
import timeit
import array
import ROOT
from AlphaTwirl import Events, BEvents
##__________________________________________________________________||
inputPath = '/Users/sakuma/... | bsd-3-clause | Python | |
de2db2ce301caca008396a79a8e7c547e64ed8b4 | Add Trello backend support | tobias47n9e/social-core,cmichal/python-social-auth,tkajtoch/python-social-auth,garrett-schlesinger/python-social-auth,rsteca/python-social-auth,python-social-auth/social-core,muhammad-ammar/python-social-auth,lneoe/python-social-auth,mchdks/python-social-auth,Andygmb/python-social-auth,ononeor12/python-social-auth,rste... | social/backends/trello.py | social/backends/trello.py | """
Trello OAuth support.
This contribution adds support for Trello OAuth service. The settings
SOCIAL_AUTH_TRELLO_KEY and SOCIAL_AUTH_TRELLO_SECRET must be defined with the values
given by `https://trello.com/1/appKey/generate`.
Extended permissions are supported by defining TRELLO_EXTENDED_... | bsd-3-clause | Python | |
03fa294d4ae21dc0de4682befd1392bcc928489c | add file | dialounke/pylayers,dialounke/pylayers,pylayers/pylayers,pylayers/pylayers | essai.py | essai.py | import numpy as np
| mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.