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 |
|---|---|---|---|---|---|---|---|---|
f2413f05bc64818297541112f42e2a8d5ae72cbe | Create test_setup.py | CoDaS-Lab/image_analysis | test_setup.py | test_setup.py | import wget
import os
test_files_path = os.getcwd() + '/image-analysis/test/test_data/'
# test files will be here whether is data, images, videos ect.
test_files = ["https://s3.amazonaws.com/testcodas/test_video.mp4"]
for file_path in test_files:
wget.download(file_path, test_files_path)
| apache-2.0 | Python | |
c54c948531cd73b0c0dd78b6bc8a1c5245886c97 | add visualise.py | hiromu/mothur_bruteforce,hiromu/mothur_bruteforce | visualize.py | visualize.py | #!/usr/bin/env python
import json
import math
import numpy
import os
import re
import sys
if __name__ == '__main__':
if len(sys.argv) < 3:
print('usage: %s [result dir] [output html]' % sys.argv[0])
sys.exit()
result = [[], [], [], []]
for filename in os.listdir(sys.argv[1]):
matc... | mit | Python | |
6c61c2d367e698861657d4cfc9bba0ba3789f197 | add naive bayes | CMPS242-fsgh/project | nb.py | nb.py | import numpy as np
class NaiveBayes:
def __init__(self):
self._prior = None
self._mat = None
def train(self, X, y):
y = np.matrix(y)
p1 = y*X
p2 = (1-y)*X
p = np.vstack([
np.log(p1+1) - np.log(p1.sum() + p1.shape[1]),
np.log(p2+1) - np.lo... | mit | Python | |
9a33761f33c4f49a27d72944c231cb447353d81e | Add problem 10 | severinkaderli/Project-Euler-Python | 010.py | 010.py | #!/usr/bin/env python3
# Author: Severin Kaderli <severin.kaderli@gmail.com>
#
# Project Euler - Problem 10:
# Find the sum of all the primes below two million.
def get_prime_numbers(n):
"""Gets all prime numbers below n."""
primes, sieve = [], [True] * n
for i in range(2, n):
if sieve[i]:
... | mit | Python | |
d075d188d541090ad8d3a5c4cf583ba10063aa88 | Move timing to right location for staging. | ProjectFacet/facet,ProjectFacet/facet,ProjectFacet/facet,ProjectFacet/facet,ProjectFacet/facet | project/project/timing.py | project/project/timing.py | import time
from django.utils.deprecation import MiddlewareMixin
class TimingMiddleware(object):
"""Times a request and adds timing information to the content.
Adds an attribute, `_timing`, onto the request, and uses this at the end
of the rendering chain to find the time difference. It replaces a token... | mit | Python | |
2e503a58a1f9893d25cf2dbb2c885bc9834faebf | Create urls.py | raiderrobert/django-webhook | tests/urls.py | tests/urls.py | from django.conf.urls import url, include
from webhook.base import WebhookBase
class WebhookView(WebhookBase):
def process_webhook(self, data, meta):
pass
urlpatterns = [
url(r'^webhook-receiver', WebhookView.as_view(), name='web_hook'),
]
| mit | Python | |
0b3bfeb06a4594a2c188e623835c3a54262cca5d | Write initial Bible book HTML parser | caleb531/youversion-suggest,caleb531/youversion-suggest | utilities/book_parser.py | utilities/book_parser.py | # utilities.book_parser
# coding=utf-8
from __future__ import unicode_literals
import yvs.shared as shared
from HTMLParser import HTMLParser
class BookParser(HTMLParser):
# Resets parser variables (implicitly called on instantiation)
def reset(self):
HTMLParser.reset(self)
self.depth = 0
... | mit | Python | |
7b2d3aedbc2f78119974c9e724b37b2b336297d1 | Add device_hive_api.py | devicehive/devicehive-python | devicehive/device_hive_api.py | devicehive/device_hive_api.py | from devicehive.handler import Handler
from devicehive.device_hive import DeviceHive
class ApiCallHandler(Handler):
"""Api call handler class."""
def __init__(self, api, call, *call_args, **call_kwargs):
super(ApiCallHandler, self).__init__(api)
self._call = call
self._call_args = cal... | apache-2.0 | Python | |
1d4e462188e95b1270d45f95112c2458cbeb7b2f | Add definitions.py | franckbrignoli/twitter-bot-detection | definitions.py | definitions.py |
def API_launch():
global app_config
global tweepy
# Twitter API configuration
consumer_key = app_config.twitter["consumer_key"]
consumer_secret = app_config.twitter["consumer_secret"]
access_token = app_config.twitter["access_token"]
access_token_secret = app_config.twitter["access_token... | mit | Python | |
32067112c7e0d681b84975b0e9b2fe974f1440ac | Add IINet module | teto/i3pystatus,schroeji/i3pystatus,richese/i3pystatus,eBrnd/i3pystatus,yang-ling/i3pystatus,enkore/i3pystatus,facetoe/i3pystatus,enkore/i3pystatus,fmarchenko/i3pystatus,teto/i3pystatus,richese/i3pystatus,drwahl/i3pystatus,Arvedui/i3pystatus,eBrnd/i3pystatus,facetoe/i3pystatus,fmarchenko/i3pystatus,juliushaertl/i3pysta... | i3pystatus/iinet.py | i3pystatus/iinet.py | import requests
from i3pystatus import IntervalModule
from i3pystatus.core.color import ColorRangeModule
__author__ = 'facetoe'
class IINet(IntervalModule, ColorRangeModule):
"""
Check IINet Internet usage.
Requires `requests` and `colour`
Formatters:
* `{percentage_used}` — percentage ... | mit | Python | |
045a10457cd87e37ef5862de55e344db5e9228cf | Add configfile.py | jhogan/commonpy,jhogan/epiphany-py | configfile.py | configfile.py | # vim: set et ts=4 sw=4 fdm=marker
"""
MIT License
Copyright (c) 2016 Jesse Hogan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to u... | mit | Python | |
2275ae52e336bd2e07e32fa3a2559926734c3567 | add pyunit for PUBDEV-1480 | mathemage/h2o-3,h2oai/h2o-dev,madmax983/h2o-3,pchmieli/h2o-3,YzPaul3/h2o-3,michalkurka/h2o-3,mathemage/h2o-3,mathemage/h2o-3,h2oai/h2o-3,h2oai/h2o-dev,mathemage/h2o-3,h2oai/h2o-3,h2oai/h2o-dev,h2oai/h2o-3,jangorecki/h2o-3,YzPaul3/h2o-3,jangorecki/h2o-3,h2oai/h2o-3,michalkurka/h2o-3,h2oai/h2o-dev,michalkurka/h2o-3,madma... | h2o-py/tests/testdir_jira/pyunit_NOPASS_INTERNAL_pubdev_1480_medium.py | h2o-py/tests/testdir_jira/pyunit_NOPASS_INTERNAL_pubdev_1480_medium.py | import sys, os
sys.path.insert(1, "../../")
import h2o, tests
def pubdev_1480():
if not tests.hadoop_namenode_is_accessible(): raise(EnvironmentError, "Not running on H2O internal network. No access to HDFS.")
train = h2o.import_file("hdfs://mr-0xd6/datasets/kaggle/sf.crime.train.gz")
test = h2o.import_f... | apache-2.0 | Python | |
b16f6ea8a723fa064a78e014ab767be1a797e613 | Create cab.py | stkyle/stk,stkyle/stk,stkyle/stk | cab.py | cab.py | """
Work with *.cab files
"""
from ctypes import pythonapi
from ctypes import cdll
from ctypes import cast
import ctypes as _ctypes
libc = cdll[_ctypes.util.find_library('c')]
libcab = cdll[_ctypes.util.find_library('cabinet')]
PyMem_Malloc = pythonapi.PyMem_Malloc
PyMem_Malloc.restype = _ctypes.c_size_t
PyMem_Malloc... | mit | Python | |
e17adde73c146ded7ed5a1a347f104a5e7a09f62 | Add bzl macro. | google/tink,google/tink,google/tink,google/tink,google/tink,google/tink,google/tink,google/tink | tools/testing/python/py23.bzl | tools/testing/python/py23.bzl | """Macro to generate python 2 and 3 binaries."""
def py23_binary(name, **kwargs):
"""Generates python 2 and 3 binaries. Accepts any py_binary arguments."""
native.py_binary(
name = name + "2",
python_version = "PY2",
**kwargs
)
native.py_binary(
name = name + "3",
... | apache-2.0 | Python | |
596f432eb7d4b3fa5d1bf5dec33cc882546e8233 | Add a script to convert a GRLevelX colortable file to a dict data structure (and optionally boundaries for norm) for use with Matplotlib. | ahill818/MetPy,ahaberlie/MetPy,ahaberlie/MetPy,Unidata/MetPy,Unidata/MetPy,jrleeman/MetPy,ShawnMurd/MetPy,dopplershift/MetPy,deeplycloudy/MetPy,jrleeman/MetPy,dopplershift/MetPy | trunk/metpy/vis/util/gr2_to_mpl_colortable.py | trunk/metpy/vis/util/gr2_to_mpl_colortable.py | #!/usr/bin/env python
# This script is used to convert colortables from GRLevelX to data for a
# matplotlib colormap
import sys
from optparse import OptionParser
#Set up command line options
opt_parser = OptionParser(usage="usage: %prog [options] colortablefile")
opt_parser.add_option("-s", "--scale", action="store_tr... | bsd-3-clause | Python | |
a041c683475f78d6101fe1741a561a6c00492007 | add pautils, to host various utility functions like loading the P2TH keys into the local or remote node over JSON-RPC. | PeerAssets/pypeerassets,backpacker69/pypeerassets | pypeerassets/pautils.py | pypeerassets/pautils.py |
'''miscellaneous utilities.'''
def testnet_or_mainnet(node):
'''check if local node is configured to testnet or mainnet'''
q = node.getinfo()
if q["testnet"] is True:
return "testnet"
else:
return "mainnet"
def load_p2th_privkeys_into_node(node):
if testnet_or_mainnet(node) is ... | bsd-3-clause | Python | |
7012a90cd1468da95c8939a0f0c1193766595ae8 | Add event spooler module | ColtonProvias/pytest-watch,rakjin/pytest-watch,blueyed/pytest-watch,joeyespo/pytest-watch | pytest_watch/spooler.py | pytest_watch/spooler.py | # -*- coding: utf-8
from multiprocessing import Queue, Process, Event
class Timer(Process):
def __init__(self, interval, function, args=[], kwargs={}):
super(Timer, self).__init__()
self.interval = interval
self.function = function
self.args = args
self.kwargs = kwargs
... | mit | Python | |
0ff9373de6e11d7040b6b289cb3239a9ee9a924d | Fix haproxy agent unit test to be runnable alone by tox | aristanetworks/neutron,takeshineshiro/neutron,redhat-openstack/neutron,bigswitch/neutron,glove747/liberty-neutron,mattt416/neutron,vijayendrabvs/hap,suneeth51/neutron,sasukeh/neutron,chitr/neutron,asgard-lab/neutron,Juniper/neutron,infobloxopen/neutron,jumpojoy/neutron,huntxu/neutron,alexandrucoman/vbox-neutron-agent,n... | neutron/tests/unit/services/loadbalancer/drivers/haproxy/test_agent.py | neutron/tests/unit/services/loadbalancer/drivers/haproxy/test_agent.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2013 New Dream Network, LLC (DreamHost)
#
# 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/li... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2013 New Dream Network, LLC (DreamHost)
#
# 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/li... | apache-2.0 | Python |
e4ef868660878e1ad1749be915b88ab6fea929b5 | Add asyncio example | timofurrer/w1thermsensor,timofurrer/w1thermsensor | examples/async.py | examples/async.py | """
w1thermsensor
~~~~~~~~~~~~~
A Python package and CLI tool to work with w1 temperature sensors.
:copyright: (c) 2020 by Timo Furrer <tuxtimo@gmail.com>
:license: MIT, see LICENSE for more details.
"""
import asyncio
from w1thermsensor import AsyncW1ThermSensor
async def main():
# initialize sensor with fir... | mit | Python | |
ef4aeb1e16245c76e7d10091b6fc8b0b289d635f | Split IP validation to a module | danclegg/py-sony | validateIp.py | validateIp.py | #!/usr/bin/env python
import socket
def parse(ip):
# parse and validate ip address
try:
socket.inet_pton(socket.AF_INET,ip)
return "valid"
except socket.error, e:
try:
socket.inet_pton(socket.AF_INET6,ip)
return "valid"
except:
print "ERRO... | apache-2.0 | Python | |
d0ce887da3043106da1b875a46b6fe1bc0ce7145 | Create 0018_auto_20201109_0655.py | PeteAndersen/swarfarm,porksmash/swarfarm,PeteAndersen/swarfarm,porksmash/swarfarm,porksmash/swarfarm,porksmash/swarfarm,PeteAndersen/swarfarm,PeteAndersen/swarfarm | herders/migrations/0018_auto_20201109_0655.py | herders/migrations/0018_auto_20201109_0655.py | # Generated by Django 2.2.17 on 2020-11-09 14:55
import django.contrib.postgres.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('herders', '0017_auto_20200808_1642'),
]
operations = [
migrations.AlterField(
model_name=... | apache-2.0 | Python | |
f9db946f9b067495d2785d46efe447371e22eb26 | Add tex2pdf function | PythonSanSebastian/docstamp | docstamp/pdflatex.py | docstamp/pdflatex.py | # coding=utf-8
# -------------------------------------------------------------------------------
# Author: Alexandre Manhaes Savio <alexsavio@gmail.com>
# Grupo de Inteligencia Computational <www.ehu.es/ccwintco>
# Universidad del Pais Vasco UPV/EHU
#
# 2015, Alexandre Manhaes Savio
# Use this at your own risk!
# -----... | apache-2.0 | Python | |
96a9d00ea20dee3ffd9114b4a094868ed7ae2413 | add createmask.py | DuinoDu/label_ellipse | createMask.py | createMask.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
python createmask.py [voc-like dir]
'''
import os, sys
import numpy as np
import cv2
def parsexml(xmlfile):
tree = ET.parse(xmlfile)
width = int(tree.find('size').find('width').text)
height = int(tree.find('size').find('height').text)
objs = tree.finda... | mit | Python | |
45bc2562d3afd3674929e56425b597b54e74ba24 | Create Legends.py | mayankdcoder/Matplotlib | Legends.py | Legends.py | #Draws Legends, Titles and Labels using matplotlib
import matplotlib.pyplot as plt
x = [1, 2, 3]
y = [5, 7, 4]
x1 = [1, 2, 3]
y1 = [10, 14, 12]
plt.plot(x, y, label='First Line')
plt.plot(x1, y1, label='Second Line')
plt.xlabel('X Axis')
plt.ylabel('Y Axis')
plt.title('This is a Title')
plt.legend()
plt.show()
| mit | Python | |
3adbcb8bc7fb4c805e7933a362b62f70873d4f9f | Add emergency_scale module | Yelp/paasta,Yelp/paasta,somic/paasta,gstarnberger/paasta,gstarnberger/paasta,somic/paasta | paasta_tools/paasta_cli/cmds/emergency_scale.py | paasta_tools/paasta_cli/cmds/emergency_scale.py | #!/usr/bin/env python
# Copyright 2015 Yelp Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | apache-2.0 | Python | |
29090add692e6c32a75e123be6cd201949efd6ce | Add elasticsearch-administer | qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq | scripts/elasticsearch-administer.py | scripts/elasticsearch-administer.py | """
Utilities for administering elasticsearch
"""
from argparse import ArgumentParser, RawDescriptionHelpFormatter
from collections import namedtuple
import json
import sys
from elasticsearch import Elasticsearch
from elasticsearch.client import ClusterClient, NodesClient, CatClient
def pprint(data):
print json.... | bsd-3-clause | Python | |
eee700f46e1edee1133722ee94992abda1ad6a4c | Add GYP build for zlib | AlphaStaxLLC/rackspace-monitoring-agent,cp16net/virgo-base,cp16net/virgo-base,cp16net/virgo-base,cp16net/virgo-base,virgo-agent-toolkit/rackspace-monitoring-agent,kaustavha/rackspace-monitoring-agent,AlphaStaxLLC/rackspace-monitoring-agent,kaustavha/rackspace-monitoring-agent,christopherjwang/rackspace-monitoring-agent... | deps/zlib.gyp | deps/zlib.gyp | {
'target_defaults': {
'conditions': [
['OS != "win"', {
'defines': [
'_LARGEFILE_SOURCE',
'_FILE_OFFSET_BITS=64',
'_GNU_SOURCE',
'HAVE_SYS_TYPES_H',
'HAVE_STDINT_H',
'HAVE_STDDEF_H',
],
},
{ # windows
'defines':... | apache-2.0 | Python | |
c46962f8055dc1c9d45a35b21afaac363ec3eb46 | add home view | elliotpeele/simple_media_service | simple_media_service/views/pages.py | simple_media_service/views/pages.py | #
# Copyright (c) Elliot Peele <elliot@bentlogic.net>
#
# This program is distributed under the terms of the MIT License as found
# in a file called LICENSE. If it is not present, the license
# is always available at http://www.opensource.org/licenses/mit-license.php.
#
# This program is distributed in the hope that it... | mit | Python | |
597e9d6f3d5804d403e3cd58a380ea882cbd5267 | Add tracker init support | keaneokelley/home,keaneokelley/home,keaneokelley/home | home/iot/tracker.py | home/iot/tracker.py | import functools
from flask import abort, request
from flask_login import login_required
from flask_socketio import join_room, emit
from home.core.models import get_device
from home.settings import DEBUG
from home.web.utils import api_auth_required
from home.web.web import socketio, app
class TrackedDevice:
def ... | mit | Python | |
860f6b612c39bb5b569b0fae8279134bca264e70 | Add 2017-faust/toilet | integeruser/on-pwning,integeruser/on-pwning,integeruser/on-pwning | 2017-faust/toilet/toilet.py | 2017-faust/toilet/toilet.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
import re
import dateutil.parser
from pwn import *
context(arch='amd64', os='linux')
def get_latest_shas(io):
io.sendline('8')
io.recvuntil('#################################################################################################')
logs = io.recvu... | mit | Python | |
571334df8e26333f34873a3dcb84441946e6c64c | Bump version number to 0.12.2 | dawran6/flask,pallets/flask,pallets/flask,tristanfisher/flask,drewja/flask,pallets/flask,fkazimierczak/flask,mitsuhiko/flask,dawran6/flask,tristanfisher/flask,fkazimierczak/flask,mitsuhiko/flask,drewja/flask,fkazimierczak/flask,drewja/flask | flask/__init__.py | flask/__init__.py | # -*- coding: utf-8 -*-
"""
flask
~~~~~
A microframework based on Werkzeug. It's extensively documented
and follows best practice patterns.
:copyright: (c) 2015 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
__version__ = '0.12.2'
# utilities we import from Werkzeug and... | # -*- coding: utf-8 -*-
"""
flask
~~~~~
A microframework based on Werkzeug. It's extensively documented
and follows best practice patterns.
:copyright: (c) 2015 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
__version__ = '0.12.2-dev'
# utilities we import from Werkzeug... | bsd-3-clause | Python |
a5188b4a172e17ac755ba4ce8d8890c7b211eb74 | Create ex11.py | stephaneAG/Python_tests,stephaneAG/Python_tests,stephaneAG/Python_tests,stephaneAG/Python_tests | learningpythonthehardway/ex11.py | learningpythonthehardway/ex11.py | print "How old are you brother ?"
age = raw_input() # will get some text ;def
print "How tall are you ?"
height = raw_input()
print "do you eat enough ?"
eat = raw_input()
print "So, you're a %r years old and %r tall guy that says : '%r' to the food, right ?" % (age, height, eat)
# Nb: to get a number from the return... | mit | Python | |
e4bc9684c10a360ad8df32b2c6bfb8f013ea4b77 | Add Composite.py | MoriokaReimen/DesignPattern,MoriokaReimen/DesignPattern | Python/Composite/Composite.py | Python/Composite/Composite.py | #! /usr/bin/python
# -*- coding: utf-8 -*-
'''
Composite Pattern
Author: Kei Nakata
Data: Oct.10.2014
'''
import abc
import exceptions
class Component(object):
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def __init__(self, name):
pass
@abc.abstractmethod
def add(self, child):
... | mit | Python | |
ac3b5be9a6f71afb402db2f293e1198bce973440 | Create the login server using Flask | debuggers-370/awesomeprojectnumberone,debuggers-370/awesomeprojectnumberone,debuggers-370/awesomeprojectnumberone | flask/login.py | flask/login.py | from abc import ABCMeta, ABC, abstractmethod, abstractproperty
from flask import Flask, app
import flask
from flask_login import LoginManager
class User(ABC):
authenticated = False
active = False
anonymous = False
id = None
def is_authenticated(self):
return self.authenticated
def is... | agpl-3.0 | Python | |
e15f59f29907d740d0a0f8dab46d77aa833ef802 | fix "peru -v" | oconnor663/peru,enzochiau/peru,buildinspace/peru,olson-sean-k/peru,oconnor663/peru,ierceg/peru,nivertech/peru,olson-sean-k/peru,ierceg/peru,scalp42/peru,enzochiau/peru,scalp42/peru,buildinspace/peru,nivertech/peru | peru/main.py | peru/main.py | #! /usr/bin/env python3
import os
import sys
from . import runtime
from . import module
def main():
peru_file_name = os.getenv("PERU_FILE_NAME") or "peru.yaml"
if not os.path.isfile(peru_file_name):
print(peru_file_name + " not found.")
sys.exit(1)
r = runtime.Runtime()
m = module.par... | #! /usr/bin/env python3
import os
import sys
from . import runtime
from . import module
def main():
peru_file_name = os.getenv("PERU_FILE_NAME") or "peru.yaml"
if not os.path.isfile(peru_file_name):
print(peru_file_name + " not found.")
sys.exit(1)
r = runtime.Runtime()
m = module.par... | mit | Python |
0d2c04790fb6c97b37f6e0700bb0162796e3dc4c | Add unit tests for AmountTaxScale serialization | openfisca/openfisca-core,openfisca/openfisca-core | tests/web_api/test_scale_serialization.py | tests/web_api/test_scale_serialization.py | # -*- coding: utf-8 -*-
from openfisca_web_api.loader.parameters import walk_node
from openfisca_core.parameters import ParameterNode, Scale
def test_amount_scale():
parameters = []
metadata = {'location':'foo', 'version':'1', 'repository_url':'foo'}
root_node = ParameterNode(data = {})
amount_scale_d... | agpl-3.0 | Python | |
b0f8064d0d6a747aac5b45bc44c3c4abda7873ad | Add unit test | i2p/i2p.itoopie,i2p/i2p.itoopie,i2p/i2p.itoopie,i2p/i2p.itoopie | apps/sam/python/src/i2p/test/test_select.py | apps/sam/python/src/i2p/test/test_select.py |
# -----------------------------------------------------
# test_select.py: Unit tests for select.py.
# -----------------------------------------------------
# Make sure we can import i2p
import sys; sys.path += ['../../']
import time
import traceback, sys
from i2p import socket, select
import i2p.socket
import socke... | apache-2.0 | Python | |
a04d5745257c16e127711fbded6899f8f226aeba | add html generator using pdoc3 | potassco/clingo,potassco/clingo,potassco/clingo,potassco/clingo | doc/py/gen.py | doc/py/gen.py | import os
import pdoc
import clingo
import clingo.ast
import re
ctx = pdoc.Context()
cmod = pdoc.Module(clingo, context=ctx)
amod = pdoc.Module(clingo.ast, supermodule=cmod, context=ctx)
cmod.doc["ast"] = amod
pdoc.link_inheritance(ctx)
def replace(s):
s = s.replace('href="clingo.html', 'href="clingo/')
s = ... | mit | Python | |
e4efaa947533e6d63eb7518306e31386ec688c73 | write testing test | hargup/bioinformatics,hargup/bioinformatics | bioinformatics/tests/test_frequent_words.py | bioinformatics/tests/test_frequent_words.py | def test_sanity_check_pass():
assert True
def test_sanity_check_fail():
assert False
def test_sanity_check_error():
assert 0/0
| bsd-3-clause | Python | |
42f614e7f22dfa93c07c09e6e2fedb5546f8d236 | read pwscf occupations and evals | Paul-St-Young/QMC,Paul-St-Young/QMC,Paul-St-Young/QMC | qe_reader.py | qe_reader.py | import numpy as np
from mmap import mmap
def retrieve_occupations(nscf_outfile, max_nbnd_lines=10):
""" read the eigenvalues and occupations of DFT orbitals at every available kpoint in an non-scf output produced by pwscf """
fhandle = open(nscf_outfile,'r+')
mm = mmap(fhandle.fileno(),0)
# read num... | mit | Python | |
aee6afe48bf4d2992c39a22d9e492377dcec527c | Add migrations | rapidpro/dash,rapidpro/dash | dash/orgs/migrations/0029_auto_20211025_1504.py | dash/orgs/migrations/0029_auto_20211025_1504.py | # Generated by Django 3.2.6 on 2021-10-25 15:04
import functools
from django.db import migrations, models
import dash.utils
class Migration(migrations.Migration):
dependencies = [
("orgs", "0028_alter_org_config"),
]
operations = [
migrations.AlterField(
model_name="org",
... | bsd-3-clause | Python | |
6b9933cce4cac3131d603880969e1d9b78b1e4f0 | Remove party_affiliation table | teampopong/pokr.kr,teampopong/pokr.kr,teampopong/pokr.kr,teampopong/pokr.kr | alembic/versions/138c92cb2218_feed.py | alembic/versions/138c92cb2218_feed.py | """Remove PartyAffiliation
Revision ID: 138c92cb2218
Revises: 3aecd12384ee
Create Date: 2013-09-28 16:34:40.128374
"""
# revision identifiers, used by Alembic.
revision = '138c92cb2218'
down_revision = '3aecd12384ee'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.drop_table(u'party_affiliati... | apache-2.0 | Python | |
6f7afea4aed4dd77cd06e8dce66e9ed1e6390a00 | Add a dummy label printer server. | chaosdorf/labello,chaosdorf/labello,chaosdorf/labello | dummyprint.py | dummyprint.py | #!/usr/bin/env python3
# It does work with Python 2.7, too.
from __future__ import print_function
from __future__ import unicode_literals
try:
from SocketServer import TCPServer, BaseRequestHandler
except ImportError: # Python 3
from socketserver import TCPServer, BaseRequestHandler
class DummyHandler(BaseRe... | mit | Python | |
d173374a2bb0b3336a44c204f250ee1fa928051f | Add CLI mechanics stub. | m110/grafcli,m110/grafcli | grafcli/cli.py | grafcli/cli.py |
from grafcli.config import config
from grafcli.elastic import Elastic
from grafcli.filesystem import FileSystem
ROOT_PATH = "/"
PROMPT = "> "
class GrafCLI(object):
def __init__(self):
self._elastic = Elastic()
self._filesystem = FileSystem()
self._current_path = ROOT_PATH
def run... | mit | Python | |
e937e461e7e130dc80e1a4403b0a810db0e04b29 | Create an environment based on a config file. | csdms/wmt-exe,csdms/wmt-exe,csdms/wmt-exe,csdms/wmt-exe | wmtexe/env.py | wmtexe/env.py | from os import path, pathsep
import subprocess
def find_babel_libs():
try:
return subprocess.check_output(['cca-spec-babel-config',
'--var', 'CCASPEC_BABEL_LIBS']).strip()
except (OSError, subprocess.CalledProcessError):
return None
def python_version(... | mit | Python | |
590f9b896be367ded589c90ac5eacd4d3006ebc8 | Create Combinations_001.py | Chasego/codi,cc13ny/algo,Chasego/cod,Chasego/codi,Chasego/codirit,cc13ny/algo,Chasego/codirit,cc13ny/Allin,Chasego/codirit,Chasego/codirit,Chasego/cod,cc13ny/Allin,cc13ny/Allin,Chasego/codi,Chasego/cod,cc13ny/algo,cc13ny/Allin,Chasego/cod,Chasego/codirit,Chasego/cod,Chasego/codi,cc13ny/algo,Chasego/codi,cc13ny/algo,cc1... | leetcode/077-Combinations/Combinations_001.py | leetcode/077-Combinations/Combinations_001.py | class Solution:
# @param {integer} n
# @param {integer} k
# @return {integer[][]}
def combine(self, n, k):
if k < 1 or k > n:
return []
if k == 1:
return [[i] for i in range(1, n+1)]
res = self.combine(n - 1, k -1)
[i.append(n) for i in re... | mit | Python | |
0f0116be7870490447bbfa794c118205e8eca120 | Add an adapter for pecan. | stackforge/wsme | wsme/pecan.py | wsme/pecan.py | import inspect
import sys
import json
import xml.etree.ElementTree as et
import wsme
import wsme.protocols.commons
import wsme.protocols.restjson
import wsme.protocols.restxml
pecan = sys.modules['pecan']
class JSonRenderer(object):
def __init__(self, path, extra_vars):
pass
def render(self, temp... | mit | Python | |
b113689db8b845471728a336b0fae30b45333022 | Create hilightresponses.py | Vlek/plugins | HexChat/hilightresponses.py | HexChat/hilightresponses.py | import hexchat
__module_name__ = 'Hilight Responses'
__module_version__ = '0.0.1'
__module_description__ = 'Highlights messages after yours'
__module_author__ = 'Vlek'
_lastresponder = {}
def check_for_highlight(word, word_to_eol, userdata):
global _lastresponder
context = hexchat.get_context()
channelna... | mit | Python | |
8f3f9d79d8ce1960ad225e236ca3e11c72de28e0 | Add test for dials.report on integrated data | dials/dials,dials/dials,dials/dials,dials/dials,dials/dials | test/command_line/test_report.py | test/command_line/test_report.py | from __future__ import absolute_import, division, print_function
import os
import procrunner
def test_report_integrated_data(dials_regression, run_in_tmpdir):
"""Simple test to check that dials.symmetry completes"""
result = procrunner.run(
[
"dials.report",
os.path.join(dial... | bsd-3-clause | Python | |
74329cd397e9dc4593333591700923e0ba7453a1 | Create __init__.py (#148) | ARISE-Initiative/robosuite | robosuite/environments/manipulation/__init__.py | robosuite/environments/manipulation/__init__.py | mit | Python | ||
6167ef40df491985749102bd4ca3f3f656f71f6c | Add migrations | meine-stadt-transparent/meine-stadt-transparent,meine-stadt-transparent/meine-stadt-transparent,meine-stadt-transparent/meine-stadt-transparent,meine-stadt-transparent/meine-stadt-transparent | mainapp/migrations/0030_auto_20210125_1431.py | mainapp/migrations/0030_auto_20210125_1431.py | # Generated by Django 3.1.5 on 2021-01-25 13:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mainapp', '0029_auto_20201206_2026'),
]
operations = [
migrations.AddField(
model_name='file',
name='manually_delete... | mit | Python | |
7f94b7fa328583c7b0bf617c6c69c06af78b49d8 | Add files via upload | ifrguy/NHWG-MIMS,ifrguy/NHWG-MIMS,ifrguy/NHWG-MIMS,ifrguy/NHWG-MIMS | src/getCAPMemberInfo.py | src/getCAPMemberInfo.py | #!/usr/bin/env /usr/bin/python3
#
# Find a member or members and print all contacts
#
# Input: CAPID or first letters of last name to search for,
# plus optional first name.
#
# History:
# 18Aug19 MEG Search by CAPID, better agg pipeline handling.
# 17Aug19 MEG Made parseable for data extraction by other scripts... | apache-2.0 | Python | |
f6d3c63a0131a7532a091c1cc492ef7d7c84263e | Access realm alias objects in lower-case. | joyhchen/zulip,reyha/zulip,joyhchen/zulip,Juanvulcano/zulip,jackrzhang/zulip,vabs22/zulip,souravbadami/zulip,arpith/zulip,PhilSk/zulip,reyha/zulip,isht3/zulip,brockwhittaker/zulip,joyhchen/zulip,Juanvulcano/zulip,eeshangarg/zulip,arpith/zulip,PhilSk/zulip,jphilipsen05/zulip,reyha/zulip,shubhamdhama/zulip,Juanvulcano/zu... | zerver/management/commands/realm_alias.py | zerver/management/commands/realm_alias.py | from __future__ import absolute_import
from __future__ import print_function
from typing import Any
from argparse import ArgumentParser
from django.core.management.base import BaseCommand
from zerver.models import Realm, RealmAlias, get_realm, can_add_alias
from zerver.lib.actions import realm_aliases
import sys
cla... | from __future__ import absolute_import
from __future__ import print_function
from typing import Any
from argparse import ArgumentParser
from django.core.management.base import BaseCommand
from zerver.models import Realm, RealmAlias, get_realm, can_add_alias
from zerver.lib.actions import realm_aliases
import sys
cla... | apache-2.0 | Python |
a6d958b7c29f11014ed322b9f153e8ad0c1a2cda | Add local server. | pghilardi/live-football-client | runserver.py | runserver.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask_rest_service import app
app.run(debug=True)
| mit | Python | |
40b0f0cb42b14d79fc0cd4451b592a6933b436e4 | Add Python script to generate AOM CTC-formatted CSV files. | tdaede/awcy,tdaede/awcy,tdaede/awcy,tdaede/awcy,tdaede/awcy,tdaede/awcy | csv_export.py | csv_export.py | #!/usr/bin/env python
import argparse
import json
import os
import csv
import sys
from numpy import *
#offset by 3
met_index = {'PSNR': 0, 'PSNRHVS': 1, 'SSIM': 2, 'FASTSSIM': 3, 'CIEDE2000': 4,
'PSNR Cb': 5, 'PSNR Cr': 6, 'APSNR': 7, 'APSNR Cb': 8, 'APSNR Cr':9,
'MSSSIM':10, 'Encoding Time'... | mit | Python | |
a00dc9b0b1779ee8218917bca4c75823081b7854 | Add migration file for new database model | inventree/InvenTree,SchrodingersGat/InvenTree,inventree/InvenTree,SchrodingersGat/InvenTree,SchrodingersGat/InvenTree,inventree/InvenTree,SchrodingersGat/InvenTree,inventree/InvenTree | InvenTree/part/migrations/0072_bomitemsubstitute.py | InvenTree/part/migrations/0072_bomitemsubstitute.py | # Generated by Django 3.2.5 on 2021-10-12 23:24
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('part', '0071_alter_partparametertemplate_name'),
]
operations = [
migrations.CreateModel(
name=... | mit | Python | |
88087c9416103ae7f56749f59cdfabcd19fb14ab | Add a snippet. | jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets | python/notion_api/update_a_page_and_its_icon.py | python/notion_api/update_a_page_and_its_icon.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#################################################################
# Install the Python requests library: pip install requests
# http://docs.python-requests.org/en/master/user/quickstart/
#################################################################
# Src: https://dev... | mit | Python | |
a962de79938c73b5c0e0459be7b82265bde76b40 | Test case for LSPI on gridworld. | silgon/rlpy,MDPvis/rlpy,imanolarrieta/RL,BerkeleyAutomation/rlpy,imanolarrieta/RL,MDPvis/rlpy,rlpy/rlpy,BerkeleyAutomation/rlpy,BerkeleyAutomation/rlpy,rlpy/rlpy,imanolarrieta/RL,silgon/rlpy,silgon/rlpy,MDPvis/rlpy,rlpy/rlpy | cases/gridworld/lspi.py | cases/gridworld/lspi.py | #!/usr/bin/env python
__author__ = "William Dabney"
from Domains import GridWorld
from Tools import Logger
from Agents import LSPI
from Representations import Tabular
from Policies import eGreedy
from Experiments import Experiment
def make_experiment(id=1, path="./Results/Temp"):
"""
Each file specifying an... | bsd-3-clause | Python | |
72559b02424b933322b2e5c6c9873a8a6b63ef78 | Add eclipse update script | perdian/dotfiles,perdian/dotfiles,perdian/dotfiles | environments/auto/macos/bin/eclipse-update.py | environments/auto/macos/bin/eclipse-update.py | #!/usr/bin/python
import os
import subprocess
import sys
p2repositoryLocations = [
"http://download.eclipse.org/eclipse/updates/4.7",
"http://download.eclipse.org/releases/oxygen",
"http://dist.springsource.com/release/TOOLS/update/e4.7/",
"http://jeeeyul.github.io/update/",
"http://andrei.gmxhome.... | mit | Python | |
b514cf783d53a5c713911729422239c9b0f0ff99 | Add automatic leak detection python script in examples | edkit/edkit-agent,edkit/edkit-agent,edkit/edkit-agent | client/python/examples/edleak_autodetect.py | client/python/examples/edleak_autodetect.py | import sys
import rpc.ws
import edleak.api
import edleak.slice_runner
def usage():
print('autodetect [period] [duration]')
def print_leaker(leaker):
print('-------------------------------')
print('class : ' + leaker['leak_factor']['class'])
print('leak size : ' + str(leaker['leak_factor']['leak']))
... | mit | Python | |
c7b756c69f3fce63208d1378ccee8d76e8574f3f | Add basic_bond_seed_file for 5 bonds. | bsmukasa/bond_analytics | bond_analytics_project/basic_bond_seed_file.py | bond_analytics_project/basic_bond_seed_file.py | import datetime
import os
import django
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'bond_analytics_project.settings')
django.setup()
from bondapi.models import Bond
test_bond_list = [
dict(name='test_bond_1', face_value=1000, annual_interest=27.5 * 2, annual_coupon_rate=5.50,
market_interest_rate=... | mit | Python | |
04da8d531267972554c6300c24a5a7b2c7def59d | add basic unit testing for appliance instances (incomplete) | dssg/wikienergy,dssg/wikienergy,dssg/wikienergy,dssg/wikienergy,dssg/wikienergy | tests/test_appliance_instance.py | tests/test_appliance_instance.py | import sys
sys.path.append('..')
import disaggregator as da
import unittest
import pandas as pd
import numpy as np
class ApplianceInstanceTestCase(unittest.TestCase):
def setUp(self):
indices = [pd.date_range('1/1/2013', periods=96, freq='15T'),
pd.date_range('1/2/2013', periods=96, fre... | mit | Python | |
879744e19cab5cc7357912ba670d200adfd58be6 | add aur-update | tobi-wan-kenobi/bumblebee-status,tobi-wan-kenobi/bumblebee-status | bumblebee_status/modules/contrib/aur-update.py | bumblebee_status/modules/contrib/aur-update.py | """Check updates for AUR.
Requires the following packages:
* yay (used as default)
Note - You can replace yay by changing the "yay -Qum"
command for your preferred AUR helper. Few examples:
paru -Qum
pikaur -Qua
rua upgrade --printonly
trizen -Su --aur --quiet
yay -Qum
contributed by `ishaanbhimwal <https://git... | mit | Python | |
4175f27a03be52baa8b4245df96a03e6bbd22310 | Add test for pygame sound play hook | nickodell/morse-code | modulation_test.py | modulation_test.py | import pygame
import random
from demodulate.cfg import *
from gen_tone import *
if __name__ == "__main__":
pygame.mixer.pre_init(frequency = int(SAMPLE_FREQ), channels = 1)
pygame.mixer.init()
WPM = random.uniform(2,20)
pattern = [1,0,1,1,1,0,0,0,0,0,0,0] # morse code 'A'
#gen_test_data()
data = gen_tone(pattern... | mit | Python | |
cfeab0e8f704a4681e1ec887b3ce116839557af9 | update tests to changes in graph_lasso | victorbergelin/scikit-learn,frank-tancf/scikit-learn,adamgreenhall/scikit-learn,zorroblue/scikit-learn,zuku1985/scikit-learn,Aasmi/scikit-learn,jereze/scikit-learn,potash/scikit-learn,phdowling/scikit-learn,kjung/scikit-learn,Akshay0724/scikit-learn,fzalkow/scikit-learn,equialgo/scikit-learn,jaidevd/scikit-learn,466152... | sklearn/covariance/tests/test_graph_lasso.py | sklearn/covariance/tests/test_graph_lasso.py | """ Test the graph_lasso module.
"""
import sys
from StringIO import StringIO
import numpy as np
from scipy import linalg
from sklearn.covariance import graph_lasso, GraphLasso, GraphLassoCV, \
empirical_covariance
from sklearn.datasets.samples_generator import make_sparse_spd_matrix
from sklearn.utils im... | """ Test the graph_lasso module.
"""
import sys
from StringIO import StringIO
import numpy as np
from scipy import linalg
from sklearn.covariance import graph_lasso, GraphLasso, GraphLassoCV
from sklearn.datasets.samples_generator import make_sparse_spd_matrix
from sklearn.utils import check_random_state
def test_g... | bsd-3-clause | Python |
dd9893eec00c16f55b77944509bafe4864319b72 | create main function | plinecom/JobManager | JobManager.py | JobManager.py |
import filelib.parser.ma
import filelib.parser.mb
import os.path
import sys
if __name__ == "__main__":
addFilePath = "/root/test_maya_2015.mb"
if(len(sys.argv) > 1):
addFilePath = sys.argv[1]
(dir,jobExt) = os.path.splitext(addFilePath)
jobExt = jobExt.lower()
if jobExt == ".ma":
... | mit | Python | |
c65731de77f88380f2c816fa9667d153140bfbe1 | Add LDA script | rnowling/pop-gen-models | lda/lda_analysis.py | lda/lda_analysis.py | import sys
from sklearn.lda import LDA
import matplotlib.pyplot as plt
import numpy as np
def read_variants(flname):
fl = open(flname)
markers = []
individuals = []
population_ids = []
population = -1
for ln in fl:
if "Marker" in ln:
if len(individuals) == 0:
continue
marker = dict()
marker["ind... | apache-2.0 | Python | |
cf97c95ab9dcb3b1dba6608639471375a1cbef42 | Create afUdimLayout.py | aaronfang/personal_scripts | scripts/afUdimLayout.py | scripts/afUdimLayout.py | import pymel.core as pm
import maya.mel as mel
allSets = pm.ls(sl=1,type="objectSet")
for i in range(0,len(allSets)):
if i<10:
pm.select(allSets[i],r=1,ne=1)
pm.select(hierarchy=1)
mel.eval("ConvertSelectionToUVs;")
pm.polyEditUV(u=i,v=0)
elif i>=10<20:
pm.select(allSet... | mit | Python | |
49f557228a6c826598c48a08f6a0de4ee176d888 | add python script to send ogg audio stream over LCM messages | openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro | software/tools/tools/scripts/oggStreamLCM.py | software/tools/tools/scripts/oggStreamLCM.py | import bot_core
import lcm
import urllib2
import time
import sys
import os
import select
import subprocess
import threading
# VLC command:
# cvlc <input> --sout '#transcode{acodec=vorb,ab=10,channels=1,samplerate=8000}:std{access=http,mux=ogg,url=localhost:8080}'
# where <input> is a file or a url
serverChannel = '... | bsd-3-clause | Python | |
76be22f3d1aa86616ecd06a326344f24ff03adbe | Add function to generate uniform addresses | opencleveland/RTAHeatMap,skorasaurus/RTAHeatMap | DataGeneration/GenerateUniformAddresses.py | DataGeneration/GenerateUniformAddresses.py | # The purpose of this script is to generate a uniformly distributed series of
# lat/long coordinates given max/min latitude, max/min longitude, latitude
# resolution, and longitude resolution, where resolution is the desired number
# of degrees between output coordinates
# Outputs a pandas dataframe of lat/long coor... | mit | Python | |
05f87be4c85036c69abc9404acb824c58d71f101 | Add border operation... Damn that was easy | meshulam/sly | slice_ops.py | slice_ops.py | import slicer
import shapely.ops
import shapely.geometry
def border(sli, amount):
cuts = [cut.polygon(True) for cut in sli.cuts]
cut_outline = shapely.ops.cascaded_union(cuts) \
.buffer(amount / 2)
shape_outline = sli.poly.boundary.buffer(amount)
outlines = cut_outline.unio... | mit | Python | |
a3089dd3d9c31d0d705fe54858fdc0ebee76f488 | write a Python client for Sift Science's REST API | MichalKononenko/rmc,shakilkanji/rmc,duaayousif/rmc,sachdevs/rmc,ccqi/rmc,shakilkanji/rmc,rageandqq/rmc,UWFlow/rmc,MichalKononenko/rmc,UWFlow/rmc,shakilkanji/rmc,JGulbronson/rmc,rageandqq/rmc,duaayousif/rmc,rageandqq/rmc,MichalKononenko/rmc,rageandqq/rmc,JGulbronson/rmc,shakilkanji/rmc,JGulbronson/rmc,duaayousif/rmc,rag... | server/sift_client.py | server/sift_client.py | """Python client for Sift Science's REST API
(https://siftscience.com/docs/rest-api).
"""
import json
import logging
import traceback
import requests
API_URL = 'https://api.siftscience.com/v202/events'
sift_logger = logging.getLogger('sift_client')
class Client(object):
def __init__(self, api_key, api_url=API... | mit | Python | |
f3f5249c0ac7d41ebf2115fb0b5c7576012bcb38 | Add production settings | ccwang002/biocloud-server-kai,ccwang002/biocloud-server-kai,ccwang002/biocloud-server-kai | src/biocloud/settings/production.py | src/biocloud/settings/production.py | # In production set the environment variable like this:
# DJANGO_SETTINGS_MODULE=my_proj.settings.production
from .base import * # NOQA
import logging.config
# For security and performance reasons, DEBUG is turned off
DEBUG = False
# Must mention ALLOWED_HOSTS in production!
# ALLOWED_HOSTS = []
# Ca... | mit | Python | |
cda1efa55242641accf78162493c3ebb3582399e | Create AM_example.py | Souloist/Audio-Effects | Effects/Amplitude_Modulation/AM_example.py | Effects/Amplitude_Modulation/AM_example.py | # Play a wave file with amplitude modulation.
# Assumes wave file is mono.
# This implementation reads and plays a one frame (sample) at a time (no blocking)
"""
Read a signal from a wave file, do amplitude modulation, play to output
Original: pyrecplay_modulation.py by Gerald Schuller, Octtober 2013
Modified to read ... | mit | Python | |
2387d8f269cbe1943db1b1e6304603ccb6901e43 | Add flashcards for powers of two estimation | oldhill/halloween,oldhill/halloween,oldhill/halloween,oldhill/halloween | flashcards.py | flashcards.py | import random
import time
DELAY = 10
while 1:
time.sleep(DELAY)
useful_powers_of_2 = {7, 8, 10, 16, 20, 30, 32, 40}
random_power_of_2 = random.sample(useful_powers_of_2, 1)[0]
print '\nWhat\'s the largest %s bit integer?' % random_power_of_2
time.sleep(DELAY)
print 'Answer: %s' % '{:,}'.format(2 ** rando... | mit | Python | |
7a79c163144b242be57ed8cf45ae4fb5097f11fa | Create defaultlog.py | rtogo/commons | defaultlog.py | defaultlog.py | # -*- coding: utf-8 -*-
"""Console and file logging configuration.
This module automatically configures the logging to use a colored console
format, and a timed rotating log file that rolls over at midnight.
The log formats results in the following outputs:
Console:
[INFO ] This is some info (root)
... | mit | Python | |
2acf089d00426d8b61317c6d031aee7696d42b03 | Create script to import Wicklow data | schmave/demschooltools,schmave/demschooltools,schmave/demschooltools,schmave/demschooltools,schmave/demschooltools | import_wicklow.py | import_wicklow.py | import psycopg2
import re
import sys
ORG_ID = 10
conn = psycopg2.connect("dbname=school_crm user=postgres host=localhost port=5432")
cur = conn.cursor()
# cur.execute("set client_encoding to 'latin1'")
def import_names():
cur.execute("DELETE FROM person_tag WHERE person_id in (SELECT person_id from person where ... | mit | Python | |
f8b9e697f4d49f35dda322817ac8ac63d96b6732 | Add failing wait tests | tpouyer/nova-lxd,tpouyer/nova-lxd,Saviq/nova-compute-lxd,Saviq/nova-compute-lxd | nclxd/tests/test_container_utils.py | nclxd/tests/test_container_utils.py | # Copyright 2015 Canonical Ltd
# 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... | # Copyright 2015 Canonical Ltd
# 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... | apache-2.0 | Python |
51ee19f41e6fc48d4791bde97c5d28d55d76cdf4 | Add brute force inplementation | Cosiek/KombiVojager | solvers/BruteForce.py | solvers/BruteForce.py | #!/usr/bin/env python
# encoding: utf-8
from itertools import permutations
from base_solver import BaseSolver
class BruteForceSolver(BaseSolver):
def run_search(self):
# get list of mid nodes names
mid_nodes = []
for node in self.task.mid_nodes:
mid_nodes.append(node.name)
... | mit | Python | |
46496d8761ae94a349ed3b592ec7ee7e0c7e1a15 | Remove unused import; add missing import | mer-tools/git-repo,testbetta/git-repo-pub,FuangCao/repo,qioixiy/git-repo,jingyu/git-repo,simbasailor/git-repo,testbetta/git-repo-pub,testbetta/repo-pub,TheQtCompany/git-repo,ediTLJ/git-repo,ronan22/repo,aosp-mirror/tools_repo,FlymeOS/repo,ronan22/repo,jingyu/git-repo,zemug/repo,couchbasedeps/git-repo,11NJ/git-repo,chzh... | gitc_utils.py | gitc_utils.py | #
# Copyright (C) 2015 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | #
# Copyright (C) 2015 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | apache-2.0 | Python |
4dfc0c49cec86f3c03b90fa66e1fc9de2ac665e6 | Add migration file (fix fields) | gems-uff/labsys,gems-uff/labsys,gems-uff/labsys | samples/migrations/0012_auto_20170512_1138.py | samples/migrations/0012_auto_20170512_1138.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-05-12 14:38
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('samples', '0011_fluvaccine_date_applied'),
]
operations = [
migrations.AlterF... | mit | Python | |
947551083798e3125cf0782df44cc18728c6bca4 | test messages | SUNET/eduid-webapp,SUNET/eduid-webapp,SUNET/eduid-webapp | src/eduid_webapp/security/tests/test_msgs.py | src/eduid_webapp/security/tests/test_msgs.py | # -*- coding: utf-8 -*-
import unittest
from eduid_webapp.security.helpers import SecurityMsg
class MessagesTests(unittest.TestCase):
def test_messages(self):
""""""
self.assertEqual(str(SecurityMsg.out_of_sync.value), 'user-out-of-sync')
self.assertEqual(str(SecurityMsg.stale_reauthn.v... | bsd-3-clause | Python | |
fcfb84838c7bb111fb9710f4984767b2233caed3 | test commit | eahneahn/eahneahn.github.io,eahneahn/eahneahn.github.io,eahneahn/eahneahn.github.io | test.py | test.py | print("Content-Type: text/plain")
print("")
print("Fuck you")
| bsd-3-clause | Python | |
f4f3429d157988d4823f20d5155b951f8471fb1b | Fix test app | wong2/gunicorn,gtrdotmcs/gunicorn,zhoucen/gunicorn,elelianghh/gunicorn,mvaled/gunicorn,urbaniak/gunicorn,wong2/gunicorn,ccl0326/gunicorn,urbaniak/gunicorn,MrKiven/gunicorn,mvaled/gunicorn,malept/gunicorn,GitHublong/gunicorn,tempbottle/gunicorn,prezi/gunicorn,jamesblunt/gunicorn,gtrdotmcs/gunicorn,1stvamp/gunicorn,malep... | test.py | test.py |
def app(environ, start_response):
"""Simplest possible application object"""
data = 'Hello, World!\n'
status = '200 OK'
response_headers = [
('Content-type','text/plain'),
('Content-Length', len(data))
]
start_response(status, response_headers)
return [data]
|
from gunicorn.httpserver import WSGIServer
def app(environ, start_response):
"""Simplest possible application object"""
data = 'Hello, World!\n'
status = '200 OK'
response_headers = [
('Content-type','text/plain'),
('Content-Length', len(data))
]
start_response(status, respo... | mit | Python |
bc0aa69adc5b1e290941c221ddd498d3fb92244e | Add simple recipe tagger experiment | recipi/recipi,recipi/recipi,recipi/recipi | test.py | test.py | import nltk
from nltk.classify import MaxentClassifier
# Set up our training material in a nice dictionary.
training = {
'ingredients': [
'Pastry for 9-inch tart pan',
'Apple cider vinegar',
'3 eggs',
'1/4 cup sugar',
],
'steps': [
'Sift the powdered sugar and cocoa ... | isc | Python | |
5d9200298ab660bee79d7958f8e155023893be08 | Change author | ClearCorp/odoo-costa-rica,ClearCorp-dev/odoo-costa-rica | l10n_cr_account_banking_cr_bcr/__openerp__.py | l10n_cr_account_banking_cr_bcr/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Addons modules by CLEARCORP S.A.
# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
#
# This program is free software: you can redistribute... | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Addons modules by CLEARCORP S.A.
# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
#
# This program is free software: you can redistribute... | agpl-3.0 | Python |
ab458e10742897c692e3d4e4066ed193e141e258 | add filterfuncs module | daler/Pharmacogenomics_Prediction_Pipeline_P3,NCBI-Hackathons/Pharmacogenomics_Prediction_Pipeline_P3,DCGenomics/multiple_myeloma_rnaseq_drug_response_hackathon_v002,DCGenomics/Pharmacogenomics_Prediction_Pipeline_P3,DCGenomics/Pharmacogenomics_Prediction_Pipeline_P3,daler/Pharmacogenomics_Prediction_Pipeline_P3,DCGeno... | filterfuncs.py | filterfuncs.py | from tools import pipeline_helpers
import pandas as pd
def run1(infile, features_label, output_label):
"""
Handle variant data by only keeping rows where 10-90% of samples have
variants.
For CNV data, don't do any filtering.
Otherwise, simply remove rows with zero variance.
"""
if (featur... | cc0-1.0 | Python | |
b9d5e015b291f27becc682f05a12ec5c6a0cf467 | Implement module to create new pads on collabedit.com. | thsnr/gygax | gygax/modules/pad.py | gygax/modules/pad.py | # -*- coding: utf-8 -*-
"""
:mod:`gygax.modules.pad` --- Module for creating pads on collabedit.com
=======================================================================
"""
from http import client
from gygax.modules import admin
def pad(bot, sender, text):
if not admin.is_admin(sender):
bot.reply("un... | mit | Python | |
7cc86a96427cc35824960c01d84fbe8d45364670 | Add admin page for User | shirlei/helios-server,shirlei/helios-server,shirlei/helios-server,shirlei/helios-server,shirlei/helios-server | helios_auth/admin.py | helios_auth/admin.py | from django.contrib import admin
from helios.models import User
class UserAdmin(admin.ModelAdmin):
exclude = ('info', 'token')
admin.site.register(User, UserAdmin) | apache-2.0 | Python | |
e99700ff985e9821faf390ca6070a0c879eafc20 | Add perkeyavg python example | holdenk/learning-spark-examples,JerryTseng/learning-spark,rex1100/learning-spark,XiaoqingWang/learning-spark,negokaz/learning-spark,jaehyuk/learning-spark,coursera4ashok/learning-spark,asarraf/learning-spark,huydx/learning-spark,databricks/learning-spark,UsterNes/learning-spark,anjuncc/learning-spark-examples,gaoxueson... | src/python/PerKeyAvg.py | src/python/PerKeyAvg.py | """
>>> from pyspark.context import SparkContext
>>> sc = SparkContext('local', 'test')
>>> b = sc.parallelize([("coffee", 1), ("pandas", 2), ("coffee", 3), ("very", 4)])
>>> perKeyAvg(b)
"""
import sys
from pyspark import SparkContext
def perKeyAvg(nums):
"""Compute the avg"""
sumCount = nums.combineByKey(... | mit | Python | |
a640bf45c4fb8829888f664e48058d6647473449 | Fix migrations | softwaresaved/fat,softwaresaved/fat,softwaresaved/fat,softwaresaved/fat | lowfat/migrations/0113_merge_20171103_0948.py | lowfat/migrations/0113_merge_20171103_0948.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-11-03 09:48
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('lowfat', '0112_auto_20171031_1133'),
('lowfat', '0111_auto_20171009_0933'),
]
opera... | bsd-3-clause | Python | |
8d2c141ac6c2d1772561d36c38cbbf8140abd9db | Add day 12. | masasin/advent_of_code_2015 | day_12.py | day_12.py | """
http://adventofcode.com/day/11
--- Day 12: JSAbacusFramework.io ---
Santa's Accounting-Elves need help balancing the books after a recent order.
Unfortunately, their accounting software uses a peculiar storage format. That's
where you come in.
They have a JSON document which contains a variety of things: arrays ... | mit | Python | |
946c5b14ec95af2e4dde406e94a50e7d5cdc1502 | Create BalanceData.py | vidhyal/WitchMusic | BalanceData.py | BalanceData.py | #Copyright (c) 2016 Vidhya, Nandini
import os
import numpy as np
import operator
from constants import *
FIX_DEV = 0.00000001
rootdir = os.getcwd()
newdir = os.path.join(rootdir,'featurefiles')
def LoadData():
data_file = open(os.path.join(newdir,'out_2.txt'),'r')
unprocessed_data = data_file.readlines()
... | mit | Python | |
3811bf52733bfbac7e5720f860cced216b530963 | Add a Theme object | geotagx/geotagx-project-template,geotagx/geotagx-project-template | src/theme.py | src/theme.py | # This module is part of the GeoTag-X project builder.
# Copyright (C) 2015 UNITAR.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option... | agpl-3.0 | Python | |
7bace5ca301124f03d7ff98669ac08c0c32da55f | Add example OOP python script | boundary/tsi-lab,jdgwartney/tsi-lab,jdgwartney/tsi-lab,boundary/tsi-lab,jdgwartney/tsi-lab,jdgwartney/tsi-lab,boundary/tsi-lab,boundary/tsi-lab | labs/lab-5/oop.py | labs/lab-5/oop.py | #!/usr/bin/python
#
# Copyright 2016 BMC Software, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | apache-2.0 | Python | |
5f2533e090e181d84c3e5567131447aa4326773a | Add libx11 package | trigger-happy/conan-packages | libx11/conanfile.py | libx11/conanfile.py | from conans import ConanFile, AutoToolsBuildEnvironment, tools
import os
class Libx11Conan(ConanFile):
name = "libx11"
version = "1.6.5"
license = "Custom https://cgit.freedesktop.org/xorg/lib/libX11/tree/COPYING"
url = "https://github.com/trigger-happy/conan-packages"
description = "X11 client-si... | mit | Python | |
e972bb5127b231bfbdf021597f5c9a32bb6e21c8 | Create gametesting.py | JadedCoder712/Final-Project | gametesting.py | gametesting.py | mit | Python | ||
a83a48f6c9276b86c3cc13aeb000611036a6e3c4 | Make all end-points accepting post | micbou/JediHTTP,micbou/JediHTTP,vheon/JediHTTP,vheon/JediHTTP | jedihttp/handlers.py | jedihttp/handlers.py | import bottle
from bottle import response, request
import json
import jedi
import logging
app = bottle.Bottle( __name__ )
logger = logging.getLogger( __name__ )
@app.post( '/healthy' )
def healthy():
return _Json({})
@app.post( '/ready' )
def ready():
return _Json({})
@app.post( '/completions' )
def complet... | import bottle
from bottle import response, request
import json
import jedi
import logging
app = bottle.Bottle( __name__ )
logger = logging.getLogger( __name__ )
@app.get( '/healthy' )
def healthy():
return _Json({})
@app.get( '/ready' )
def ready():
return _Json({})
@app.post( '/completions' )
def completio... | apache-2.0 | Python |
64e91bf4a7fb8dae8ae49db64396bdfed12bec63 | Add deploy script for pypi. | mayfield/shellish | deploy.py | deploy.py | """
Deploy this package to PyPi.
If the package is already uploaded (by --version) then this will do nothing.
Reqires Python3.
"""
import http.client
import json
import subprocess
def setup(*args):
o = subprocess.check_output('python3 ./setup.py %s' % ' '.join(args),
shell=True)
... | mit | Python | |
03137f65202f5423ea705db601aaea7f18c590f9 | add the main file | WheatonCS/Lexos,WheatonCS/Lexos,WheatonCS/Lexos | lexos/__main__.py | lexos/__main__.py | """Module allowing for ``python -m lexos ...``."""
from lexos import application
application.run()
| mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.