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 |
|---|---|---|---|---|---|---|---|---|
81cac4850f8b3c4c2d8a0ed754bd68c6e5a279d0 | test ml lr | IntelLabs/hpat,IntelLabs/hpat,IntelLabs/hpat,IntelLabs/hpat | hpat/tests/test_ml.py | hpat/tests/test_ml.py | import unittest
import pandas as pd
import numpy as np
import numba
import h5py
import hpat
from hpat.tests.test_utils import (count_array_REPs, count_parfor_REPs,
count_parfor_OneDs, count_array_OneDs, dist_IR_contains)
class TestML(unittest.TestCase):
def test_logistic_regression(sel... | bsd-2-clause | Python | |
6fc1018686f2fa6c2f9216047bfaae365d39ebb3 | Create osmTGmod.py | wupperinst/osmTGmod,wupperinst/osmTGmod | osmTGmod.py | osmTGmod.py | print 'test'
| apache-2.0 | Python | |
b1001c02188829923699c48f1218486da7dbf1da | Add a trivial management command to start a Twisted reactor. | campbe13/openhatch,ehashman/oh-mainline,ehashman/oh-mainline,heeraj123/oh-mainline,vipul-sharma20/oh-mainline,eeshangarg/oh-mainline,sudheesh001/oh-mainline,waseem18/oh-mainline,willingc/oh-mainline,openhatch/oh-mainline,SnappleCap/oh-mainline,moijes12/oh-mainline,waseem18/oh-mainline,jledbetter/openhatch,eeshangarg/oh... | mysite/customs/management/commands/customs_twist.py | mysite/customs/management/commands/customs_twist.py | from django.core.management.base import BaseCommand
from twisted.internet import reactor
class Command(BaseCommand):
help = "Call this when you want to run a Twisted reactor."
def handle(self, *args, **options):
print 'Starting Reactor...'
reactor.run()
print '...reactor finished!'
| agpl-3.0 | Python | |
d7856578ace25a67151c658e37857a3f3aceb741 | split ICD and CPT codes | nwams/Medline-Pubmed-Search-Engine,xiaoluobo/Medline-Pubmed-Search-Engine,xiaoluobo/Medline-Pubmed-Search-Engine,nwams/Medline-Pubmed-Search-Engine | build/lib/pymetamap/app.py | build/lib/pymetamap/app.py | from pymetamap import MetaMap
import csv
def getCPTandICD():
"""
get CPT and ICD codes, put in dictionary
:return: the dictionary of codes
"""
with open('../codes/CPTandICD.csv', 'rU') as csvfile:
reader = csv.reader(csvfile)
codeDict = {rows[0]:rows[1] for rows in reader}
r... | apache-2.0 | Python | |
8bc93447c1a89ecf92cc34180727d2c25c44f6e1 | Allow setting port on commandline | supriyantomaftuh/zget,nils-werner/zget,nils-werner/zget,supriyantomaftuh/zget | zget/put.py | zget/put.py | #!/usr/bin/env python
from __future__ import absolute_import, division, print_function, \
unicode_literals
import os
import sys
import socket
try:
import urllib.request as urllib
except ImportError:
import urllib
import hashlib
import argparse
from zeroconf import ServiceInfo, Zeroconf
try:
from http.s... | #!/usr/bin/env python
from __future__ import absolute_import, division, print_function, \
unicode_literals
import os
import sys
import socket
try:
import urllib.request as urllib
except ImportError:
import urllib
import hashlib
import argparse
from zeroconf import ServiceInfo, Zeroconf
try:
from http.s... | mit | Python |
1a1e6dd6fd72d52d9a901580ea1b85d9cfdf6c3e | move the yum priority utility to hosts/util | osynge/ceph-deploy,jumpstarter-io/ceph-deploy,isyippee/ceph-deploy,ddiss/ceph-deploy,ddiss/ceph-deploy,codenrhoden/ceph-deploy,SUSE/ceph-deploy,rtulke/ceph-deploy,codenrhoden/ceph-deploy,alfredodeza/ceph-deploy,ceph/ceph-deploy,jumpstarter-io/ceph-deploy,ceph/ceph-deploy,Vicente-Cheng/ceph-deploy,ktdreyer/ceph-deploy,g... | ceph_deploy/hosts/util.py | ceph_deploy/hosts/util.py | """
A utility module that can host utilities that will be used by more than
one type of distro and not common to all of them
"""
def install_yum_priorities(distro, _yum=None):
"""
EPEL started packaging Ceph so we need to make sure that the ceph.repo we
install has a higher priority than the EPEL repo so t... | mit | Python | |
74dab4e4e7c87e247659bff6cfd4e333b7cd71f7 | Add normalize and Vector substraction functions | MindCookin/python-exercises | chapter03/triangleArea.py | chapter03/triangleArea.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import math
print 'Insert one points, separated with commas: '
xy = input('Insert first point: ')
x2y2 = input('Insert second point: ')
def substractVectors(a, b):
return (a[0] - b[0], a[1] - b[1])
def normalize(x, y):
return math.sqrt(x**2 + y**2)
print normalize(... | apache-2.0 | Python | |
e21d3a1da1d20a341ae165c0fa3605248744ce7e | Add example - Cumulative count | altair-viz/altair,jakevdp/altair | altair/examples/cumulative_count_chart.py | altair/examples/cumulative_count_chart.py | """
Cumulative Count Chart
----------------------
This example shows an area chart with cumulative count.
Adapted from https://vega.github.io/vega-lite/examples/area_cumulative_freq.html
"""
# category: area charts
import altair as alt
from vega_datasets import data
source = data.movies.url
alt.Chart(source).transf... | bsd-3-clause | Python | |
fecb71a7e58163ecf4290490f2299c4479396761 | Add script sandbox/update_plugins_messagespot.py. | ProgVal/Limnoria-test,Ban3/Limnoria,ProgVal/Limnoria-test,Ban3/Limnoria | sandbox/update_plugins_messagespot.py | sandbox/update_plugins_messagespot.py | import os
import pbs
pbs.cd('Admin')
for plugin in os.listdir('..'):
path = os.path.join('..', plugin)
print(repr(path))
assert os.path.exists(path)
if not os.path.isdir(path):
print 1
continue
print 2
pbs.cd(path)
pbs.pygettext('-D', 'config.py', 'plugin.py')
| bsd-3-clause | Python | |
9eb7cf316766f3d6820b834b54702b99a7b9e66f | Add tinyfpga BX platform. | mithro/HDMI2USB-litex-firmware,mithro/HDMI2USB-litex-firmware,mithro/HDMI2USB-litex-firmware,mithro/HDMI2USB-litex-firmware | platforms/tinyfpga_bx.py | platforms/tinyfpga_bx.py | from litex.build.generic_platform import *
from litex.build.lattice import LatticePlatform
from litex.build.lattice.programmer import TinyProgProgrammer
_io = [
("user_led", 0, Pins("B3"), IOStandard("LVCMOS33")),
("usb", 0,
Subsignal("d_p", Pins("B4")),
Subsignal("d_n", Pins("A4")),
S... | bsd-2-clause | Python | |
43f288c72e2836db848fa1b3cc4b597e715a7352 | Add pypi plugin. | sk89q/Plumeria,sk89q/Plumeria,sk89q/Plumeria | plumeria/plugins/pypi.py | plumeria/plugins/pypi.py | import asyncio
import xmlrpc.client as xmlrpclib
from plumeria.command import commands, CommandError
from plumeria.util.ratelimit import rate_limit
client = xmlrpclib.ServerProxy('https://pypi.python.org/pypi')
@commands.register("pypi", category="Development")
@rate_limit()
async def pypi(message):
"""
Sea... | mit | Python | |
b81d7731118853cb8dab4f8a3d30b8a9a7d9fbb9 | Add 42nd marker | Facenapalm/NapalmBot | scripts/markers/mark_error_42.py | scripts/markers/mark_error_42.py | """Marks all fixed errors #42 on ruwiki's CheckWikipedia."""
import re
import pywikibot
from checkwiki import load_page_list, mark_error_done, log
NUMBER = "42"
REGEXP = r"<\/?strike"
FLAGS = re.I
def main():
"""Main script function."""
site = pywikibot.Site()
for line in load_page_list(NUMBER):
p... | mit | Python | |
7bb3950b0d1569cf30fc539b3416c7abf6ec4182 | create an example file for common g-function interfacing | MassimoCimmino/pygfunction | pygfunction/examples/common_g_function_interface.py | pygfunction/examples/common_g_function_interface.py | # -*- coding: utf-8 -*-
""" An example showing how to make use of the common g-function interface via
- dictionary access
- listing arguments
"""
def main():
a = 1
if __name__ == '__main__':
main()
| bsd-3-clause | Python | |
c79d80a29108b6eee8cfb202d8519986c9cf2831 | Create remove-comments.py | tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015 | Python/remove-comments.py | Python/remove-comments.py | # Time: O(n), n is the length of the source
# Space: O(k), k is the max length of a line.
# Given a C++ program, remove comments from it.
# The program source is an array where source[i] is the i-th line of the source code.
# This represents the result of splitting the original source code string by the newline chara... | mit | Python | |
b2e117b06ac91be4760bc89b858dd1af7e21694f | add db handler | KleeTaurus/pinax-eventlog | pinax/eventlog/handlers.py | pinax/eventlog/handlers.py | import logging
from .models import Log as model
class DBHandler(logging.Handler):
def __init__(self):
logging.Handler.__init__(self)
def emit(self, record):
log_entry = model(user=None,
action=record.levelname,
extra={'pathname': record.pa... | mit | Python | |
0a55273067a38cc2c930e4950cb161767beee38f | Update ex1.py | frodo4fingers/appfs,appfs/appfs,FirstSanny/appfs,appfs/appfs,appfs/appfs,frodo4fingers/appfs,appfs/appfs,ray-chew/appfs,frodo4fingers/appfs,appfs/appfs,FirstSanny/appfs,FirstSanny/appfs,frodo4fingers/appfs,appfs/appfs,FirstSanny/appfs,frodo4fingers/appfs,frodo4fingers/appfs,FirstSanny/appfs,FirstSanny/appfs,frodo4finge... | christopher_wyczisk/ex1.py | christopher_wyczisk/ex1.py |
import math, types
# Diesen Code hat Christopher Wyczisk runtergesaut.
class GeometrischesMittelDerWerteZweiterLocations(object):
def __init__(self):
self.__productFromValuesOfLocation1 = 1.0
self.__productFromValuesOfLocation2 = 1.0
self.__values1 = []
self.__values2 = []
... | mit | Python | |
a400e71c45710f04e68aba782123cbe3aab667b3 | Create webcrawler.py | jg7/WebCrawler | webcrawler.py | webcrawler.py | import sys
def add_to_index(index, keyword, url):
for entry in index:
if entry[0] == keyword:
if not url in entry[1]:
entry[1].append(url)
return
# not found, add new keyword to index
if lookup(index,keyword) == None:
index.append([keyword, [url]])
... | mit | Python | |
44a1ddf716f2202d2639809431bb5c796f01c8a3 | Add fra2lmf.py, generate lexical entry | moreymat/omw-graph,moreymat/omw-graph,moreymat/omw-graph | parser/omwg/srcs/fra2lmf.py | parser/omwg/srcs/fra2lmf.py | #!/usr/bin/env python
#-*- coding: utf-8 -*-
"""
"""
import re, sys
import collections
fra = open('wolf-1.0b4.xml', 'r')
lmf = open('wolf-1.0b4-lmf.xml', 'w')
wid = 0
word2synset = collections.defaultdict(list)
for line in fra:
synsetite = re.search(r'<ID>eng-30-(.*-[avnrb])<\/ID>', line)
if synsetite:
... | mit | Python | |
f672a6fb6392aa1a2f5c85f2a9d9c4c8b2672119 | Create scarp_diffusion_with_component.py | landlab/drivers | scripts/diffusion/scarp_diffusion_with_component.py | scripts/diffusion/scarp_diffusion_with_component.py | #Import statements so that you will have access to the necessary functions
import numpy
from landlab import RasterModelGrid
from landlab.components.diffusion.diffusion import DiffusionComponent
from landlab.plot.imshow import imshow_node_grid
from pylab import show, figure
#Create a raster grid with 25 rows, 40 colum... | mit | Python | |
c49fb766493d0e7684513f644f8eaa03c99adbd0 | Make CrashSignature constructor take the raw signature source | sigma-random/FuzzManager,MozillaSecurity/FuzzManager,lazyparser/FuzzManager,cihatix/FuzzManager,cihatix/FuzzManager,lazyparser/FuzzManager,sigma-random/FuzzManager,sigma-random/FuzzManager,MozillaSecurity/FuzzManager,MozillaSecurity/FuzzManager,cihatix/FuzzManager,MozillaSecurity/FuzzManager,lazyparser/FuzzManager,ciha... | FTB/Signatures/CrashSignature.py | FTB/Signatures/CrashSignature.py | '''
Crash Signature
Represents a crash signature as specified in https://wiki.mozilla.org/Security/CrashSignatures
@author: Christian Holler (:decoder)
@license:
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can ... | '''
Crash Signature
Represents a crash signature as specified in https://wiki.mozilla.org/Security/CrashSignatures
@author: Christian Holler (:decoder)
@license:
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can ... | mpl-2.0 | Python |
1f9e118c9a7ae16b3f9efcc42ea20ac6b358b791 | Create solution_1.py | DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectEuler,DestructHub/ProjectE... | Problem055/Python/solution_1.py | Problem055/Python/solution_1.py | #code created by NamanNimmo Gera
#4:57pm, May 1, 2019.
def reverse(x):
return int(str(x)[::-1])
def Palindrome(x):
if x == reverse(x):
return True
else:
return False
#function to check if a number is a Lychrel number or not
def checkLyr(x):
tot = 0
while True:
x = x + rev... | mit | Python | |
b6e5d49fbbcee01ba8a1792fda199f2fd6530da3 | Create pdb_on_error.py | ticcky/code101,ticcky/code101 | pdb_on_error.py | pdb_on_error.py | # Source: http://stackoverflow.com/questions/242485/starting-python-debugger-automatically-on-error
import sys
def info(type, value, tb):
if hasattr(sys, 'ps1') or not sys.stderr.isatty():
# we are in interactive mode or we don't have a tty-like
# device, so we call the default hook
sys.__exceptho... | apache-2.0 | Python | |
e3ae0dda56ff602754657917b7d469f06632c689 | Create runtests.py | kiaderouiche/hilbmetrics | runtests.py | runtests.py | import sys
import unittest
import warnings
| apache-2.0 | Python | |
2d782422081871681b18052d61e7fa4b662a7704 | add some super simple exception tests | kezabelle/clastic,kezabelle/clastic | clastic/tests/test_exceptions.py | clastic/tests/test_exceptions.py | from __future__ import unicode_literals
from nose.tools import ok_, eq_, raises
from werkzeug.test import Client
from werkzeug.wrappers import BaseResponse
from clastic import Application
from common import hello_world, RequestProvidesName
from clastic.exceptions import (make_error_handler_map,
... | bsd-3-clause | Python | |
a4b2d0235f49c44b26783a73dc5a2f920891201f | Create fib.py | UmassJin/Leetcode | Array/fib.py | Array/fib.py | '''
Reference
Analysis: http://tech-queries.blogspot.com/2010/09/nth-fibbonacci-number-in-ologn.html
Python: http://stackoverflow.com/questions/12338802/how-efficient-is-this-python-code-for-the-fibonacci-sequence
G4G: http://www.geeksforgeeks.org/program-for-nth-fibonacci-number/
Wiki: https://en.wikipedia.org/wiki/Fi... | mit | Python | |
7af8f3149e3e2d3053062857c846c9be21c5fca3 | delete rarely quried products - db cleanup - for review | KlubJagiellonski/pola-backend,KlubJagiellonski/pola-backend,KlubJagiellonski/pola-backend,KlubJagiellonski/pola-backend | pola/management/commands/delete_rare_products.py | pola/management/commands/delete_rare_products.py | from django.core.management.base import BaseCommand, CommandError
from product.models import Product
from report.models import Report
from reversion.models import Version
from pola.models import Query
from django.db import connection
from datetime import datetime
class Command(BaseCommand):
help = 'Deletes rarely ... | bsd-3-clause | Python | |
25bc5a76bd2170b9ae1ddaa6df4c464381c1ec70 | Teste com Noh Ok | jpaDeveloper/estrutura-de-dados | estrutura-de-dados-master/__init__.py | estrutura-de-dados-master/__init__.py | __author__ = 'Aluno'
| mit | Python | |
fd8aaf82e4cd69d9358e1802f17d6c5d0a8b1841 | Add 66: Plus One | ovaskevich/leetcode,ovaskevich/leetcode | algorithms/66_plus_one.py | algorithms/66_plus_one.py | #!/usr/bin/env python
#
# Given a non-negative number represented as an array of digits, plus one to the
# number. The digits are stored such that the most significant digit is at the
# head of the list.
#
# LeetCode Runtime: 40 ms (beats 100% of Python coders)
# Author: oleg@osv.im
import sys
class Solution(object):... | apache-2.0 | Python | |
2e7a17327c3bc31a387cc78b237cbb8d19d49107 | Create test.py | Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Show-Me-the-Code/python,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Show-Me-the-Code/python | ammmerzougui/0001/test.py | ammmerzougui/0001/test.py | '''
Generating a random code
By @ammmerzougui
'''
import random
def genCode(length):
s = "abcdefghijklmnopqrstuvwxyz01234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()?"
return "".join(random.sample(s,length))
l=input("Enter the length of the random code: ")
print(genCode(int(l)))
| mit | Python | |
c0c61a87fd1279bfa344422049208ade7c2f503c | Add printkeys script | skunkwerks/netinf,skunkwerks/netinf,skunkwerks/netinf,skunkwerks/netinf,skunkwerks/netinf,skunkwerks/netinf,skunkwerks/netinf,skunkwerks/netinf | python/nilib/printkeys.py | python/nilib/printkeys.py | #!/usr/bin/python
import redis
import pprint
c = redis.StrictRedis()
print "List of keys in database:"
redis_keys = c.keys()
pprint.pprint(redis_keys)
| apache-2.0 | Python | |
ec042a1c6e01f447785dcc31bee4a7bd642009a4 | Add in modified jaro-winkler implementation. | reticulatingspline/NFL,cottongin/NFL,fasteddie2/NFL | local/winkler.py | local/winkler.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
def winklerCompareP(str1, str2):
"""
Source: http://stackoverflow.com/questions/2741872/python-performance-improvement-request-for-winkler
Return approximate string comparator measure (between 0.0 and 1.0)
Updated to include improvements.
USAGE:
s... | mit | Python | |
e14a5585c1db92361d27bfd3ab89ce919bd75058 | Add coinflip.py | moul/bolosseum,moul/bolosseum,moul/bolosseum | test/coinflip.py | test/coinflip.py | #!/usr/bin/env python
import json
import random
import sys
class BolosseumBot():
def handle(self, args):
method = args['action'].replace("-", "_")
return getattr(self, method)(args)
class CoinflipBot(BolosseumBot):
def init(self, args):
return {"name": "coinflip-bot"}
def play_... | mit | Python | |
0791b7f6fea1bcfd9a9d7549028b267c0ec0d164 | Add send_email management command | rhertzog/parrainage,rhertzog/parrainage,rhertzog/parrainage | parrainage/app/management/commands/send_email.py | parrainage/app/management/commands/send_email.py | # Copyright 2017 Raphaël Hertzog
#
# This file is subject to the license terms in the LICENSE file found in
# the top-level directory of this distribution.
import argparse
from datetime import datetime
import logging
from django.core.management.base import BaseCommand
from django.core.mail import EmailMessage, get_co... | mit | Python | |
36286510a54f441c0cbc350402d899df0c51904a | deploy test | JustineKay/psychic-octo-carnival | deploy/main.py | deploy/main.py | def lambda_handler(event, context):
# TODO implement
return 'Hello from Lambda'
| mit | Python | |
1c13e8d3180e44ed82efa34d5d27fb8ad5c6affd | Add shell module | richese/i3pystatus,plumps/i3pystatus,drwahl/i3pystatus,eBrnd/i3pystatus,plumps/i3pystatus,m45t3r/i3pystatus,MaicoTimmerman/i3pystatus,MaicoTimmerman/i3pystatus,juliushaertl/i3pystatus,paulollivier/i3pystatus,ismaelpuerto/i3pystatus,ncoop/i3pystatus,facetoe/i3pystatus,yang-ling/i3pystatus,schroeji/i3pystatus,fmarchenko/... | i3pystatus/shell.py | i3pystatus/shell.py | from i3pystatus import IntervalModule
from subprocess import check_output, CalledProcessError
class Shell(IntervalModule):
"""
Shows output of shell command
"""
color = "#FFFFFF"
error_color = "#FF0000"
settings = (
("command", "command to be executed"),
("color", "standard co... | mit | Python | |
1a1a8c00e3dc4101be78a69b3bae7d27fbb51b39 | Add a debugging file connecting Python to GH | pilcru/ghpythonremote,Digital-Structures/ghpythonremote | ghpythonremote/examples/CPython_to_GH_manual.py | ghpythonremote/examples/CPython_to_GH_manual.py | import rpyc
c = rpyc.utils.factory.connect(
"localhost",
18871,
service=rpyc.core.service.ClassicService,
config={"sync_request_timeout": None},
ipv6=False,
keepalive=True,
)
rghcomp = c.root.get_component
rgh = c
Rhino = rgh.modules.Rhino
rs = rgh.modules.rhinoscriptsyntax
readopt = Rhino.Fi... | mit | Python | |
a2eef595fcb928ebbb37872c22d85379b12c1ebb | Create sqlite2slastic.py | jmlero/beegfs-web-overview | sqlite2elastic/sqlite2elastic.py | sqlite2elastic/sqlite2elastic.py | #!/bin/python
from datetime import datetime
from elasticsearch import Elasticsearch
import sqlite3
import requests
import json
res = requests.get('http://elastic.int.cemm.at:9200')
con = sqlite3.connect("/mnt/fhgfsMgmt/admon/fhgfs-admon-data.db")
es = Elasticsearch([{'host': 'elastic.int.cemm.at', 'port': 9200}])
... | mit | Python | |
76bcb9a7486e5f255dd0cadec1f036f6e27c8fef | test app | christoflemke/flaskplan,christoflemke/flaskplan,christoflemke/flaskplan | test/test_app.py | test/test_app.py | # -*- coding: utf-8 -*-
import sys
import os
import unittest
import json
sys.path.insert(0, os.path.abspath('..'))
from website import app
class TestApp(unittest.TestCase):
'test app with rejseplanen api'
def setUp(self):
app.config['TESTING'] = True
app.config['DEBUG'] = True
self.a... | apache-2.0 | Python | |
6ce72675f56a8b33993b86fa4a66fb53799c3c96 | Add constants module | jniedrauer/dfman | dfman/const.py | dfman/const.py | """Constants"""
import os
NAME = 'dfman'
DEFAULT_CFG = os.path.join('resources', NAME + '.conf')
USER_CFG = os.path.join(os.environ.get('HOME'), NAME, NAME + '.conf')
| mit | Python | |
135b11a2c896d865f8dc970165bde617b32b785c | add test | sequana/sequana,sequana/sequana,sequana/sequana,sequana/sequana,sequana/sequana | test/test_mgi.py | test/test_mgi.py | from sequana.mgi import MGI
from sequana import sequana_data
def test_mgi():
m = MGI(sequana_data("test_mgi.fqStat.txt"))
m.plot_acgt()
m.boxplot_quality()
| bsd-3-clause | Python | |
d9db8056450528f10b9bfaa9f6226486108ac37d | Put constants into a dedicated module | bbockelm/glideinWMS,holzman/glideinwms-old,holzman/glideinwms-old,bbockelm/glideinWMS,bbockelm/glideinWMS,bbockelm/glideinWMS,holzman/glideinwms-old | creation/lib/cgWConsts.py | creation/lib/cgWConsts.py | ####################################
#
# Keep all the constants used to
# create glidein entries in this
# module
#
# Author: Igor Sfiligoi
#
####################################
import time
start_time_tuple=time.localtime()
TIMESTR=(string.printable[start_time_tuple[0]-2000]+ #year, will work until ~2060
st... | bsd-3-clause | Python | |
a8393b7f705efd85641e0a53aa8b5dc35f91a48d | change initial migration because no DB's set up | CharlesGust/django-imagr,defzzd/django-imagr | imagr_site/imagr_app/migrations/0001_initial.py | imagr_site/imagr_app/migrations/0001_initial.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='ImagrUser',
... | mit | Python | |
342b2cf92eefcbbcd91366c64ea6c04b1c1d3b15 | Initialize Ch. 15 PracticeQuestions | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | books/CrackingCodesWithPython/Chapter15/PracticeQuestions.py | books/CrackingCodesWithPython/Chapter15/PracticeQuestions.py | # Chapter 15 Practice Questions
# 1. What does 2 ** 5 evaluate to?
print(2 ** 5)
# 2. What does 6 ** 2 evaluate to?
print(6 ** 2)
# 3. What does the following code print?
for i in range(5):
if i == 2:
continue
print(i)
# 4. Does the main() function of affineHacker.py get called if another program
# ... | mit | Python | |
3756fa9cef258e91ebd8d344f6773cfc2ac537dd | Add a benchmark of import time | numba/numba-benchmark,gmarkall/numba-benchmark | benchmarks/bench_misc.py | benchmarks/bench_misc.py | """
Miscellaneous benchmarks.
"""
import subprocess
import sys
import time
from numba import jit
class InitializationTime:
# Measure wall clock time, not CPU time of calling process
timer = time.time
number = 1
repeat = 10
def time_new_process_import_numba(self):
subprocess.check_call([... | bsd-2-clause | Python | |
56a810983bc9bb6965a2ffd038306cb36923d23d | add names of modules that are imported into the current scope | mitar/pychecker,mitar/pychecker | pychecker2/ImportChecks.py | pychecker2/ImportChecks.py |
from pychecker2.Check import Check
from pychecker2.util import BaseVisitor
from compiler import walk, symbols, parseFile
import sys, os
class ImportCheck(Check):
"Get 'from module import *' names hauled into the file and modules"
def check(self, unused_modules, file, unused_options):
class FromImp... | bsd-3-clause | Python | |
ff494ccb25937dc919490309af326bdaefe6bf6a | add tool for managing calibration dbs | legacysurvey/rapala,legacysurvey/rapala,imcgreer/rapala | bokpipe/tools/bokcaldb.py | bokpipe/tools/bokcaldb.py | #!/usr/bin/env python
import sys
from collections import defaultdict
import numpy as np
from astropy.table import Table
from bokpipe.bokdm import load_caldb,write_caldb
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("caldb",type=str,
help="input calibrations database")
par... | bsd-3-clause | Python | |
f94a55e303902222f951771742a3d06d2f995db3 | Rework to_dict method of sdk resource in functional test | openstack/senlin,openstack/senlin,tengqm/senlin-container,openstack/senlin,stackforge/senlin,tengqm/senlin-container,stackforge/senlin | senlin/tests/functional/drivers/openstack/sdk.py | senlin/tests/functional/drivers/openstack/sdk.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed unde... | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed unde... | apache-2.0 | Python |
145e333575b7c4c480724e6155bd8db6d6af5b05 | Create 0001.py | renzongxian/Show-Me-the-Code,wangjun/python,DanielShangHai/python,zhakui/python,EricSekyere/python,Jaccorot/python,ionutcipriananescu/python,fairyzoro/python,DanielShangHai/python,12wang3/python,Yrthgze/prueba-sourcetree2,JiYouMCC/python,karnikamit/python,yangzilong1986/python,Pritesh242/python,hooting/show-me-the-code... | razzl/0001/0001.py | razzl/0001/0001.py | #!/usr/bin/env python
'''
It can generate the activation code
'''
import random
#import string
f = open('C:\Users\zzl\Desktop\2.txt','w')
for x in range(200):
words = [chr(a) for a in range(65,91)]+[chr(a) for a in range(97,122)]+[str(a) for a in range(0,11)]
# It is equal to string.ascii_letters + string.digits
... | mit | Python | |
f18a83cba2bfd4a73db8a943508a32ebce1adf7c | Add rm test | silas/ops | tests/test_rm.py | tests/test_rm.py | import helper
import os
import unittest
import opsutils
class RmTestCase(unittest.TestCase):
def setUp(self):
self.workspace = helper.Workspace()
def tearDown(self):
self.workspace.destroy()
def setup_file(self):
self.path = self.workspace.join('file1')
with open(self.pa... | mit | Python | |
d2281e493541ee3367df8af72d220f84c035a9c7 | add migration for the "please test" stamp | numbas/editor,numbas/editor,numbas/editor | editor/migrations/0006_add_please_test_stamp.py | editor/migrations/0006_add_please_test_stamp.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('editor', '0005_stamp_of_approval'),
]
operations = [
migrations.AlterField(
model_name='stampofapproval',
... | apache-2.0 | Python | |
fcdb0abedeb5e8973a2e70fbae7ad3d0f704744a | Add a devstack.py file | edx/xqueue,EDUlib/xqueue,edx/xqueue,EDUlib/xqueue,EDUlib/xqueue,edx/xqueue | xqueue/devstack.py | xqueue/devstack.py | from settings import *
import json
with open(ENV_ROOT / "xqueue.env.json") as env_file:
ENV_TOKENS = json.load(env_file)
XQUEUES = ENV_TOKENS['XQUEUES']
XQUEUE_WORKERS_PER_QUEUE = ENV_TOKENS['XQUEUE_WORKERS_PER_QUEUE']
WORKER_COUNT = ENV_TOKENS.get('WORKER_COUNT', XQUEUE_WORKERS_PER_QUEUE * 2)
ALLOWED_HOSTS = EN... | agpl-3.0 | Python | |
057ae13abfe40b6ed77159d9e3fb3a9e4f717f09 | add skeleton ajp connector | mor1/ucas-www,mor1/ucas-www | server.py | server.py | #!/usr/bin/env python
#
# Copyright (C) 2012 Richard Mortier <mort@cantab.net>. All Rights
# Reserved.
import ConfigParser
Config = ConfigParser.RawConfigParser()
Config.read('ucas.ini')
from flup.server.ajp import WSGIServer
import ucas
WSGIServer(ucas.app,
scriptName=Config.get('server', 'scriptname')... | bsd-2-clause | Python | |
256e1913bb0aff04d3a20935a49c603b6388dee5 | test code for user login | kwantopia/shoppley-migrate,kwantopia/shoppley-migrate,kwantopia/shoppley-migrate,kwantopia/shoppley-migrate,kwantopia/shoppley-migrate,kwantopia/shoppley-migrate,kwantopia/shoppley-migrate | shoppley.com/shoppley/apps/shoppleyuser/tests.py | shoppley.com/shoppley/apps/shoppleyuser/tests.py | from django.test import TestCase
from django.test.client import Client
from django.core.urlresolvers import reverse
from datetime import datetime, timedelta
from random import randint
from shoppleyuser.models import *
import json
from mailer.models import Message
class SimpleTest(TestCase):
fixtures = ['']
def r... | mit | Python | |
4577a6f03b93621d226d5f3fdfed940edd842dfe | add migration for previous commit | lafranceinsoumise/api-django,lafranceinsoumise/api-django,lafranceinsoumise/api-django,lafranceinsoumise/api-django | src/groups/migrations/0021_auto_20180119_1740.py | src/groups/migrations/0021_auto_20180119_1740.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-01-19 16:40
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('groups', '0020_auto_20180119_1451'),
]
operations = [... | agpl-3.0 | Python | |
3feab4a988ce47fc3e2a7681cd78e4bbd747216b | add iter_pitch_shifts | waltaskew/book-to-music-converter | bemusic/features.py | bemusic/features.py | """Grab gramatical features from the text."""
import itertools
SHIFT_SEGMENTS = 1.0 / 18.0
SHIFT_MAP = {
0: 0, 1: 0, 2: 1, 3: -1, 4: 2, 5: -2, 6: 3, 7: -3, 8: 4, 9: -4,
10: 5, 11: -5, 12: 6, 13: -6, 14: 7, 15: -7, 16: 8, 17: -8}
def iter_n_grams(text, n):
"""Return n-length pairs from the iter... | unlicense | Python | |
7d17d22d84c677d0d6eabec930196fa1d53a2d19 | Create regexUtils.py | tejasnikumbh/Algorithms,tejasnikumbh/Algorithms,tejasnikumbh/Algorithms | genericCode/stringAlgos/regexUtils.py | genericCode/stringAlgos/regexUtils.py | # Utilities for regex
import re
'''
Explanation :
Finds indices of all occurences of a pattern p inside a string. The pattern is passed as
a string and not as a compiled regex.
Returns : The list of starting indices of all occurences of pattern, non Overlapping
'''
def findallNonOverlapping(pattern, search... | bsd-2-clause | Python | |
39039b8a6584984d6778b271a4b9c8a181198cd3 | Add basic test for CaseBulkDB | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/hqcase/tests/test_bulk.py | corehq/apps/hqcase/tests/test_bulk.py | import uuid
from unittest import mock
from django.test import TestCase
from casexml.apps.case.mock import CaseBlock
from corehq.apps.hqcase.bulk import CaseBulkDB
from corehq.form_processor.interfaces.dbaccessors import CaseAccessors
from corehq.form_processor.models import XFormInstance
from corehq.form_processor.t... | bsd-3-clause | Python | |
2b78fbec8fe0528c165eb150feca1429a2d90d77 | test WebSocket client | warner/magic-wormhole-transit-relay | ws_client.py | ws_client.py | from __future__ import print_function
from twisted.internet import endpoints
from twisted.internet.defer import (
Deferred,
inlineCallbacks,
)
from twisted.internet.task import react
from twisted.internet.error import (
ConnectionDone,
)
from twisted.internet.protocol import (
Protocol,
Factory,
)
... | mit | Python | |
9ee86f8c05f1ffa3743f743e9e3bf4c1b1111117 | Add missing file. | Yubico/yubikey-manager,Yubico/yubikey-manager | ykman/base.py | ykman/base.py | # Copyright (c) 2015-2020 Yubico AB
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of co... | bsd-2-clause | Python | |
ed425026d24de7e34891a88987fbe2c225f6d4e9 | Create solution.py | lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges | hackerrank/algorithms/implementation/easy/service_lane/py/solution.py | hackerrank/algorithms/implementation/easy/service_lane/py/solution.py | #!/bin/python3
import sys
n, t = map(int, input().split())
width = list(map(int, input().split()))
for a0 in range(t):
i, j = map(int, input().strip().split(' '))
veh = min(width[i:j + 1])
print(veh)
| mit | Python | |
c39f826128c7704f47fe61e59e45446ff07e06d5 | Add missing declarative.py | zorainc/django-datafilters,freevoid/django-datafilters,zorainc/django-datafilters | datafilters/declarative.py | datafilters/declarative.py | from django.utils.datastructures import SortedDict
def get_declared_fields(bases, attrs, cls_filter,
with_base_fields=True,
extra_attr_name='base_fields'):
"""
Create a list of form field instances from the passed in 'attrs', plus any
similar fields on the base classes (in 'bases'). This i... | mit | Python | |
fd357d5fca2f4433d7a4290c371566147bb38d21 | Add fake json generator | ozshel/theseus,ozshel/theseus,ozshel/theseus,ozshel/theseus | html/fake_webservice/generate_json.py | html/fake_webservice/generate_json.py | from pprint import pprint
from loremipsum import get_paragraphs, get_sentences
from datetime import datetime
import time
import json
user_list_attr = {"type": "user_list", "data": ["id", "username", "lastname", "password", "birthday", "phone", "created_at", "address", "group"]}
group_list_attr = {"type": "group_list",... | bsd-3-clause | Python | |
cdc406606bd0d5626ffea5bb857a047f6cb1646f | Create remplace_text_all_files.py | Endika/test_script,Endika/test_script,Endika/test_script | remplace_text_all_files.py | remplace_text_all_files.py | import os
FIND="TEXTO QUE QUEREMOS BUSCAR PARA REMPLAZAR"
REMPLACE="LO REMPLAZAMOS POR ESTO"
DIRECTORIO="/home/endikaig/Escritorio/ejemplos/"
def load_file(name):
f=open(name,'r')
lineas=f.readlines()
f.close()
text=""
for x in lineas:
text+=x
return text
def new_file(name,text):
... | mit | Python | |
d0d4483d81eb8b0cf8626d4fcff1fd96bccce26c | Add script to print 'docker run' command which would join production stack | berkmancenter/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud | dev/print_docker_run_in_stack.py | dev/print_docker_run_in_stack.py | #!/usr/bin/env python3
"""
Print 'docker run' command which joins a running stack with the right production configuration (environment variables).
Usage:
./dev/print_docker_run_in_stack.py ~/production-docker-config/docker-compose.yml topics-mine
"""
import argparse
import shlex
import sys
from typing import L... | agpl-3.0 | Python | |
2874d3e319bcd0385853e82df6a35f597d67fe7b | add speed test that retrieves the world. | versionone/VersionOne.SDK.Python,doubleO8/versionone-sdk-spoon,aarcro/VersionOne.SDK.Python,coddingtonbear/VersionOne.SDK.Python | examples/speed_example.py | examples/speed_example.py |
import time
from v1pysdk import V1Meta
meta = V1Meta()
t0 = time.time()
all_asset_types = meta.AssetType.query()
all_queries = [meta.asset_class(type.Name).query() for type in all_asset_types]
all_assets = [asset
for query in all_queries
for asset in query ]
t1 = time.time()
elapsed ... | bsd-3-clause | Python | |
8bcf866129432d35d17c06b06ebd13f3cfd4ab67 | Add ASCII 2D loader | SasView/sasview,SasView/sasview,SasView/sasview,lewisodriscoll/sasview,SasView/sasview,lewisodriscoll/sasview,SasView/sasview,lewisodriscoll/sasview,lewisodriscoll/sasview,lewisodriscoll/sasview,SasView/sasview | src/sas/sascalc/file_converter/ascii2d_loader.py | src/sas/sascalc/file_converter/ascii2d_loader.py | """
ASCII 2D Loader
"""
from sas.sascalc.dataloader.data_info import Data2D
from sas.sascalc.file_converter.nxcansas_writer import NXcanSASWriter
import numpy as np
# ISIS 2D ASCII File Format
# line: property
# 0: File header
# 1: q_x axis label and units
# 2: q_y axis label and units
# 3: Intensity axis label and un... | bsd-3-clause | Python | |
f76441a6383af9ec7c2a84773ab558440baa3e89 | check machine runs by listing screen sessions | KevinHCChen/wireless-aoa,KevinHCChen/wireless-aoa,KevinHCChen/wireless-aoa | simulations/check_runs.py | simulations/check_runs.py | import os
nodes = [11,12,13,14]
for i in nodes:
os.system("ssh eigen%d screen -ls" % (i))
| mit | Python | |
4a032ba09838f470184ab719bc5192cd0e81b5ff | Fix for #19: last_seen date was not updating. | Goldmund-Wyldebeast-Wunderliebe/raven-python,korealerts1/sentry,percipient/raven-python,ewdurbin/raven-python,Kryz/sentry,TedaLIEz/sentry,ifduyue/sentry,getsentry/raven-python,boneyao/sentry,dbravender/raven-python,beniwohli/apm-agent-python,recht/raven-python,kevinlondon/sentry,looker/sentry,pauloschilling/sentry,Kron... | djangodblog/middleware.py | djangodblog/middleware.py | import traceback
import socket
import warnings
import datetime
from django.conf import settings
from django.http import Http404
from django.utils.hashcompat import md5_constructor
from djangodblog.models import Error, ErrorBatch
__all__ = ('DBLogMiddleware', 'DBLOG_CATCH_404_ERRORS')
DBLOG_CATCH_404_ERRORS = getatt... | import traceback
import socket
import warnings
from django.conf import settings
from django.http import Http404
from django.utils.hashcompat import md5_constructor
from djangodblog.models import Error, ErrorBatch
__all__ = ('DBLogMiddleware', 'DBLOG_CATCH_404_ERRORS')
DBLOG_CATCH_404_ERRORS = getattr(settings, 'DBL... | bsd-3-clause | Python |
f1228e5d7d8fa7096b39c77e9512f1b2d7cf2811 | Add settings file to configure static file paths | ThunderousFigs/Genomes,ThunderousFigs/Genomes,ThunderousFigs/Genomes | settings.py | settings.py | PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.9/howto/static-files/
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'staticfiles')
STATIC_URL = '/static/'
# Extra places for collectstatic to find static files.
STATICFILES_DIRS = (
... | mit | Python | |
fffbddb420aaecf0cd9c238f4dd3fb33fb13a5ac | add factories for member | savoirfairelinux/sous-chef,savoirfairelinux/sous-chef,madmath/sous-chef,savoirfairelinux/santropol-feast,savoirfairelinux/sous-chef,madmath/sous-chef,savoirfairelinux/santropol-feast,madmath/sous-chef,savoirfairelinux/santropol-feast | django/santropolFeast/member/factories.py | django/santropolFeast/member/factories.py | # coding=utf-8
import factory
from santropolFeast.member.models import Member, Address, Contact ,Client
class MemberFactory (factory.DjangoModelFactory):
class Meta:
model = Member
firstname = "VaÈËÇç"
lastname = "ËÏÉéè"
class AdressFactory (factory.DjangoModelFactory):
class Meta:
m... | agpl-3.0 | Python | |
2407ee00bc0a31dafc4bef571089e16bed67c71c | fix missing description in csv | benabraham/cz.pycon.org-2017,benabraham/cz.pycon.org-2017,benabraham/cz.pycon.org-2017,pyvec/cz.pycon.org-2016,pyvec/cz.pycon.org-2017,pyvec/cz.pycon.org-2017,pyvec/cz.pycon.org-2017,pyvec/cz.pycon.org-2016,pyvec/cz.pycon.org-2016 | pyconcz_2016/speakers/management/commands/schedule_to_csv.py | pyconcz_2016/speakers/management/commands/schedule_to_csv.py | import csv
import sys
from django.core.management import BaseCommand
from pyconcz_2016.speakers.models import Slot, EndTime
def slot2dict(slot):
shared = {
'date_start': slot.date,
'date_end': slot.date_end,
'room': slot.room,
}
if slot.content_object:
if slot.content_ty... | import csv
import sys
from django.core.management import BaseCommand
from pyconcz_2016.speakers.models import Slot, EndTime
def slot2dict(slot):
shared = {
'date_start': slot.date,
'date_end': slot.date_end,
'room': slot.room,
}
if slot.content_object:
if slot.content_ty... | mit | Python |
9a493ef3881ba1153a1894c6fb19a5a54da24183 | Add support for running modules chrooted in a local dir | thaim/ansible,thaim/ansible | lib/ansible/runner/connection_plugins/chroot.py | lib/ansible/runner/connection_plugins/chroot.py | # (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible 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 lat... | mit | Python | |
dba0efe8bc15c1452db62ba934759f2a03a5460b | Add grains | isbm/salt-huelamp | salt/grains/philips_hue.py | salt/grains/philips_hue.py | # -*- coding: utf-8 -*-
'''
Generate baseline proxy minion grains
'''
__proxyenabled__ = ['philips_hue']
__virtualname__ = 'hue'
def __virtual__():
if 'proxy' not in __opts__:
return False
else:
return __virtualname__
def kernel():
return {'kernel': 'RTOS'}
def os():
return {'os':... | apache-2.0 | Python | |
37fce5a1128a645321bbb15a0ae9c3165ae83334 | Use Agg backend. | RaoUmer/distarray,enthought/distarray,RaoUmer/distarray,enthought/distarray | distarray/plotting/tests/test_plotting.py | distarray/plotting/tests/test_plotting.py | # encoding: utf-8
# ---------------------------------------------------------------------------
# Copyright (C) 2008-2014, IPython Development Team and Enthought, Inc.
# Distributed under the terms of the BSD License. See COPYING.rst.
# ---------------------------------------------------------------------------
"""... | # encoding: utf-8
# ---------------------------------------------------------------------------
# Copyright (C) 2008-2014, IPython Development Team and Enthought, Inc.
# Distributed under the terms of the BSD License. See COPYING.rst.
# ---------------------------------------------------------------------------
"""... | bsd-3-clause | Python |
547549b019ce25dfdabc8ab8dd4fc7b9e73fc171 | add tests | Carreau/jupytercontrib | jupytercontrib/tests/tests_imports.py | jupytercontrib/tests/tests_imports.py |
def test_import():
from jupytercontrib.py2to3exporter import Python2to3Exporter
Python2to3Exporter()
| mit | Python | |
6d8449c19da95152ce9cff841b09d33d99423668 | add huc12 mapping app | akrherz/idep,akrherz/idep,akrherz/dep,akrherz/idep,akrherz/idep,akrherz/dep,akrherz/dep,akrherz/idep,akrherz/dep,akrherz/idep,akrherz/dep | scripts/ucs/huc12_map.py | scripts/ucs/huc12_map.py | from pyiem.plot import MapPlot, nwsprecip
from shapely.wkb import loads
import psycopg2
import sys
import numpy as np
from matplotlib.patches import Polygon
from matplotlib.collections import PatchCollection
import matplotlib.colors as mpcolors
import matplotlib.pyplot as plt
DBCONN = psycopg2.connect(database='idep',... | mit | Python | |
f7966fbc7484b8cfd858662602bbd3f9642afc48 | test navigation (failing) | xs2maverick/adhocracy3.mercator,liqd/adhocracy3.mercator,fhartwig/adhocracy3.mercator,fhartwig/adhocracy3.mercator,liqd/adhocracy3.mercator,fhartwig/adhocracy3.mercator,fhartwig/adhocracy3.mercator,fhartwig/adhocracy3.mercator,fhartwig/adhocracy3.mercator,liqd/adhocracy3.mercator,xs2maverick/adhocracy3.mercator,liqd/ad... | src/mercator/tests/acceptance/test_navigation.py | src/mercator/tests/acceptance/test_navigation.py | from adhocracy_frontend.tests.acceptance.shared import wait
class TestNavigation(object):
def test_simple(self, browser_with_proposal): # FIXME: bad name
browser = browser_with_proposal
column_structure = browser.find_by_css('.moving-column-structure').first
column_content = browser.find... | agpl-3.0 | Python | |
1bd85bbf95a34c4c6f52cd4944a8f00bcef5a995 | package init | samrushing/caesure,samrushing/caesure | caesure/__init__.py | caesure/__init__.py | # -*- Mode: Python -*-
| bsd-2-clause | Python | |
cb3a95f0f5671528948c2904058ddbf87ec9d6db | add script to plot power/bandwidth | umd-memsys/DRAMsim3,umd-memsys/DRAMsim3,umd-memsys/DRAMsim3 | scripts/plot_time_series.py | scripts/plot_time_series.py | #!/usr/bin/python
"""
Generate time series graphs of power/bandwidth/energy...
"""
import argparse
import os
import sys
import pandas as pd
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
def plot_line(x, y, x_label, y_label, save_to=""):
fig = plt.figure()
ax = fig.ad... | mit | Python | |
d9b38ab8ea6f9207b830931ba1ff846f730de870 | Create basic CircuitBreaker class | rgunther30/circuitbreaker | breaker.py | breaker.py | import time
import functools
CLOSED = 0
OPEN = 1
class CircuitBreaker(object):
def __init__(self, allowed_fails=3, retry_time=30):
'''
Initializes Breaker object
Args:
allowed_fails(int): Maximum number of consecutive failures allowed before
o... | mit | Python | |
9b9859762886a8d20e4db95bb35a49ac6b77fbb4 | add header | sequana/sequana,sequana/sequana,sequana/sequana,sequana/sequana,sequana/sequana | sequana/utils/df2html.py | sequana/utils/df2html.py | # -*- coding: utf-8 -*-
#
# This file is part of Sequana software
#
# Copyright (c) 2016-2021 - Sequana Development Team
#
# File author(s):
# Thomas Cokelaer <thomas.cokelaer@pasteur.fr>
#
# Distributed under the terms of the 3-clause BSD license.
# The full license is in the LICENSE file, distributed with t... | bsd-3-clause | Python | |
e3845e03ea1f3dd393cd077f7c2b3d2ce31b86a9 | Add script to remove unnecessary numbers from people's locations. | SnappleCap/oh-mainline,ehashman/oh-mainline,mzdaniel/oh-mainline,jledbetter/openhatch,sudheesh001/oh-mainline,openhatch/oh-mainline,jledbetter/openhatch,SnappleCap/oh-mainline,openhatch/oh-mainline,ehashman/oh-mainline,waseem18/oh-mainline,vipul-sharma20/oh-mainline,jledbetter/openhatch,ojengwa/oh-mainline,waseem18/oh-... | mysite/scripts/remove_numbers_from_locations.py | mysite/scripts/remove_numbers_from_locations.py | import re
import mysite
Person = mysite.profile.models.Person
people_with_weird_locations = Person.objects.filter(location_display_name__regex=', [0-9][0-9],')
for p in people_with_weird_locations:
location_pieces = re.split(r', \d\d', p.location_display_name)
unweirded_location = "".join(location_pieces)
... | agpl-3.0 | Python | |
67eaa449d64851b59901c15b6fdeac47b718b311 | Add script for generating jamendo rewrite rules | 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 | scripts/jamendo-rewrite.py | scripts/jamendo-rewrite.py | #!/usr/bin/env python
# Jamendo database dumps can be fetched from: http://img.jamendo.com/data/dbdump_artistalbumtrack.xml.gz
import xml.etree.cElementTree as ElementTree
import sys, gzip, time, os, os.path, urllib, threading
class JamendoRewrite:
def __init__(self, path):
self.music_path = path
print "Rewrit... | agpl-3.0 | Python | |
642b777f5eabc02abd54208e3895c0b1898401db | Convert csv to json for clusters | YongchaoShang/tika-img-similarity,chrismattmann/tika-similarity,harsham05/tika-similarity,chrismattmann/tika-similarity,chrismattmann/tika-img-similarity,YongchaoShang/tika-img-similarity,harsham05/tika-similarity,chrismattmann/tika-img-similarity | edit-cosine-cluster.py | edit-cosine-cluster.py | #!/usr/bin/env python2.7
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "... | apache-2.0 | Python | |
f3e4cbb960ddbd2bb6ee18d1f24fa29c00568666 | Update check_all_managed_nodes_status.py | Tendrl/node-agent,r0h4n/node-agent,Tendrl/node-agent,r0h4n/node-agent,Tendrl/node_agent,Tendrl/node_agent,Tendrl/node-agent,r0h4n/node-agent | tendrl/node_agent/node_sync/check_all_managed_nodes_status.py | tendrl/node_agent/node_sync/check_all_managed_nodes_status.py | import etcd
def run():
try:
nodes = NS._int.client.read("/nodes")
except etcd.EtcdKeyNotFound:
return
for node in nodes.leaves:
node_id = node.key.split('/')[-1]
try:
NS._int.client.write(
"/nodes/{0}/NodeContext/status".format(node_id),
... | import etcd
def run():
try:
nodes = NS._int.client.read("/nodes")
except etcd.EtcdKeyNotFound:
return
for node in nodes.leaves:
node_id = node.key.split('/')[-1]
try:
NS._int.client.write(
"/nodes/{0}/NodeContext/status".format(node_id),
... | lgpl-2.1 | Python |
6fb6829c6ac0f755b468393042f538c5073c76ff | Add script to create copies of PNG files w/ filenames prefixed with their creation time (Windows only) | joymachinegames/joymachine-public,joymachinegames/joymachine-public,joymachinegames/joymachine-public,joymachinegames/joymachine-public,joymachinegames/joymachine-public,joymachinegames/joymachine-public | tools/rename_by_timestamp/rename_by_timestamp.py | tools/rename_by_timestamp/rename_by_timestamp.py | import os, os.path
import shutil
from datetime import datetime
import sys
def do_folder(src_folder):
assert os.path.isdir(src_folder)
dst_folder = os.path.join(src_folder, 'timestamp_prefixed')
print 'Input dir: %s'%src_folder
print 'Output dir: %s'%dst_folder
if not os.path.exists(dst_folder):
... | mit | Python | |
ab5089ebe17f4cbd998885332a48568c319cb64c | Add restriction classes | ceramyq/python-ems | ems/schema/restrictions.py | ems/schema/restrictions.py | #!/usr/bin/env python
#
# Copyright 2016 Opsview Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | apache-2.0 | Python | |
70a4bf1519110ce4918b76b6b456520f713fa446 | Create lc1359r.py | FiveEye/ProblemSet,FiveEye/ProblemSet | LeetCode/lc1359r.py | LeetCode/lc1359r.py | class Solution:
def countOrders(self, n: int) -> int:
MOD = 10**9+7
if n == 1:
return 1
return self.countOrders(n-1) * n * (2 * n-1) % MOD
| mit | Python | |
8275f2837b51e76ca252eaf68910ad8d790f23ad | Add pyaudio_tfr example | pyacq/pyacq,pyacq/pyacq | example/pyaudio_tfr.py | example/pyaudio_tfr.py | """
Simple demonstration of streaming data from a PyAudio device to a QOscilloscope
viewer.
Both device and viewer nodes are created locally without a manager.
"""
from pyacq.devices.audio_pyaudio import PyAudio
from pyacq.viewers import QTimeFreq
from pyacq.core import create_manager
import pyqtgraph as pg
# Start... | bsd-3-clause | Python | |
4aa98792d4a8d06840bb18bd55234d7fdff2294b | Add average of integers | sitdh/com-prog | ch03_03.py | ch03_03.py | number_list = input().strip()
minus_position = number_list.find('-1')
if -1 == number_list.find('-1'):
exit()
number_list = number_list[:minus_position].strip().split()
summation = 0
for number in number_list:
summation += int(number)
print(summation / len(number_list))
| mit | Python | |
1b971b32d57df48919e0c45372237d858996e3d9 | Add test for GMEU entry "a", part C | amperser/proselint,amperser/proselint,amperser/proselint,amperser/proselint,amperser/proselint | tests/test_gmeu/test_a_C.py | tests/test_gmeu/test_a_C.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Test GMEU entry 'a', part C.
This entry is about pronunciation of the word 'a' and is unlikely to be
relevant to usage in written language.
"""
| bsd-3-clause | Python | |
2acef1faad657f72b9dcab46a3b456d075fa9585 | Solve 1001 in python | deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playgr... | solutions/uri/1003/1003.py | solutions/uri/1003/1003.py | a = int(input())
b = int(input())
print("SOMA = {}".format(a + b))
| mit | Python | |
cea54800ae2ac13b830984aa368125faf02ba429 | Add example for CLI object | MuhammadAlkarouri/hug,timothycrosley/hug,MuhammadAlkarouri/hug,timothycrosley/hug,MuhammadAlkarouri/hug,timothycrosley/hug | examples/cli_object.py | examples/cli_object.py | import hug
@hug.cli_object(name='git', version='1.0.0')
class GIT(object):
"""An example of command like calls via an Object"""
@hug.cli_object()
def push(self, branch='master'):
return 'Pushing {}'.format(branch)
@hug.cli_object()
def pull(self, branch='master'):
return 'Pulling... | mit | Python | |
ee70c1718b1af70e9152cbd7b35987b097482cb6 | test script to cache Genewiki content | SuLab/scheduled-bots,SuLab/scheduled-bots,SuLab/scheduled-bots | scheduled_bots/cache/genes/getWDGenes.py | scheduled_bots/cache/genes/getWDGenes.py | from wikidataintegrator import wdi_core
import pandas as pd
from rdflib import Graph
import time
import sys
query = """
SELECT * WHERE {
?item wdt:P31 wd:Q7187 .
}
"""
kg = Graph()
kg.
results = wdi_core.WDItemEngine.execute_sparql_query(query)
i =0
for qid in results["results"]["bindings"]:
try:
# print... | mit | Python | |
7edea4361f724a50e3925751ed4604652d58cb74 | Add installer for SAWs (#3186) | EmreAtes/spack,iulian787/spack,EmreAtes/spack,LLNL/spack,EmreAtes/spack,mfherbst/spack,tmerrick1/spack,skosukhin/spack,tmerrick1/spack,matthiasdiener/spack,skosukhin/spack,lgarren/spack,LLNL/spack,LLNL/spack,TheTimmy/spack,iulian787/spack,skosukhin/spack,iulian787/spack,matthiasdiener/spack,krafczyk/spack,krafczyk/spac... | var/spack/repos/builtin/packages/saws/package.py | var/spack/repos/builtin/packages/saws/package.py | ##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python | |
14e3fe43f2687b5944576e60003bf538b4fc0bd8 | Add tests for angle | ppb/ppb-vector,ppb/ppb-vector | tests/test_vector2_angle.py | tests/test_vector2_angle.py | from ppb_vector import Vector2
from math import isclose
import pytest
@pytest.mark.parametrize("left, right, expected", [
(Vector2(1, 1), Vector2(0, -1), 135),
(Vector2(1, 1), Vector2(-1, 0), 135),
(Vector2(0, 1), Vector2(0, -1), 180),
(Vector2(-1, -1), Vector2(1, 0), 135),
(Vector2(-1, -1), Vector... | artistic-2.0 | Python | |
fd48746e8d1d2d94a7453a4a976ffbf362711f63 | Add new tool to set bytes in file | Dentosal/rust_os,Dentosal/rust_os,Dentosal/rust_os | tools/setbyte.py | tools/setbyte.py | #!/usr/bin/env python3
import sys
import ast
try:
file_name, location, new_byte = sys.argv[1:]
except:
print("Usage: ./{} file location newbyte".format(sys.argv[0]))
sys.exit(1)
addr = int(ast.literal_eval(location))
byte = int(ast.literal_eval(new_byte))
assert 0 <= addr
assert 0 <= byte < 2**8
with op... | mit | Python | |
2dca5ed6f5c250556f7dd2d8b2937e07ff4c4094 | add example how to read comments from DXF file | mozman/ezdxf,mozman/ezdxf,mozman/ezdxf,mozman/ezdxf,mozman/ezdxf | examples/load_comments.py | examples/load_comments.py | import sys
from ezdxf.lldxf.validator import is_dxf_file
from ezdxf.filemanagement import dxf_file_info
def load_comments(stream):
line = 1
while True:
try:
code = stream.readline()
value = stream.readline()
except EOFError:
return
if code and value:... | mit | Python | |
d60ef98c1148c31bd443e892396a170458511072 | add init.py file | biless/CrossBuildPlatform | Golang/init.py | Golang/init.py | #!/usr/bin/python
import os
import re
import subprocess
import sys
import urllib
import platform
import zipfile
root_path = sys.path[0]
root_bin_path = root_path + "/bin/"
system_name = platform.system()
machine = platform.machine()
root_zip_path = root_bin_path
repo_version = "0.0.0.0"
go_root = ""
def process(coun... | apache-2.0 | Python | |
47c4043dfecd95686b1520c93717fa4c512c4e74 | Add tentative construct format for ClientHello messages. | Ayrx/tlsenum,Ayrx/tlsenum | tlsenum/hello_constructs.py | tlsenum/hello_constructs.py | from construct import Array, Bytes, Struct, UBInt16, UBInt32, UBInt8
ProtocolVersion = Struct(
"version",
UBInt8("major"),
UBInt8("minor")
)
Random = Struct(
"random",
UBInt32("gmt_unix_time"),
Bytes("random_bytes", 28)
)
SessionID = Struct(
"session_id",
UBInt8("length"),
Bytes(... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.