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 |
|---|---|---|---|---|---|---|---|---|
b5972a5651ba1ace28ae54d5a1a4f31a07e97670 | add server_costs table | CottageLabs/finance,CottageLabs/finance,CottageLabs/finance,CottageLabs/finance | migrations/versions/1e27c434bb14_create_server_costs.py | migrations/versions/1e27c434bb14_create_server_costs.py | """create server_costs table
Revision ID: 1e27c434bb14
Revises: fa0f07475596
Create Date: 2016-03-14 15:57:19.945327
"""
# revision identifiers, used by Alembic.
revision = '1e27c434bb14'
down_revision = 'fa0f07475596'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
def up... | apache-2.0 | Python | |
ff519b5145accbc10fcb7baa955bc1fe44774c27 | Add browser/websocket.py | jonathanverner/brython,molebot/brython,JohnDenker/brython,rubyinhell/brython,brython-dev/brython,JohnDenker/brython,Hasimir/brython,firmlyjin/brython,amrdraz/brython,Mozhuowen/brython,firmlyjin/brython,jonathanverner/brython,Hasimir/brython,JohnDenker/brython,rubyinhell/brython,brython-dev/brython,Hasimir/brython,Hasim... | src/Lib/browser/websocket.py | src/Lib/browser/websocket.py | from browser import window
import javascript
WebSocket = javascript.JSConstructor(window.WebSocket) | bsd-3-clause | Python | |
126491288a532da08fb3923eae2635a84736798d | Add new package: libsamplerate (#16143) | LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack | var/spack/repos/builtin/packages/libsamplerate/package.py | var/spack/repos/builtin/packages/libsamplerate/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Libsamplerate(AutotoolsPackage):
"""libsamplerate (also known as Secret Rabbit Code) is a ... | lgpl-2.1 | Python | |
4e6a6e4f2758bd616f0c2c2703160cbb9c539b63 | add new package (#23843) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-kubernetes/package.py | var/spack/repos/builtin/packages/py-kubernetes/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyKubernetes(PythonPackage):
"""Official Python client library for kubernetes. """
h... | lgpl-2.1 | Python | |
04d6fd6ceabf71f5f38fd7cf25cd4ac2bcb6b57f | Add simple web server to display measurements | rigtorp/rpi2-sensors | server.py | server.py | import sqlite3
from flask import Flask, g, render_template_string
app = Flask(__name__)
def get_db():
db = getattr(g, '_database', None)
if db is None:
db = g._database = sqlite3.connect('sensors.db')
return db
index_tmpl = """
<!doctype html>
<title>Sensors</title>
<body>
<h1>Senors</h1>
<dl>
<dt... | mit | Python | |
acc23fe67231f8b556b2de7bd19f0050cbe379e6 | Add total calculation script | haozai309/hello_python | total_prices.py | total_prices.py | prices = {
"banana" : 4,
"apple" : 2,
"orange" : 1.5,
"pear" : 3
}
stock = {
"banana" : 6,
"apple" : 0,
"orange" : 32,
"pear" : 15,
}
total = 0
for key in prices:
print key
print "price: %s" % prices[key]
print "stock: %s" % stock[key]
print prices[key] * stock[... | apache-2.0 | Python | |
31af4f92e97c83c42baff4e902cddf8184d84e4d | allow to run tox as 'python -m tox', which is handy on Windoze | gaborbernat/tox,selimb/tox,loechel/tox,Avira/tox,tox-dev/tox | tox/__main__.py | tox/__main__.py | from tox._cmdline import main
main()
| mit | Python | |
f86d07998a2a80fcf9e69cca9d89c2ca4d982e02 | Fix windows dist script | victorvde/rust,stepancheg/rust-ide-rust,zaeleus/rust,dinfuehr/rust,kimroen/rust,AerialX/rust-rt-minimal,servo/rust,dwillmer/rust,ktossell/rust,kwantam/rust,jroesch/rust,ejjeong/rust,ebfull/rust,robertg/rust,mahkoh/rust,mdinger/rust,miniupnp/rust,zubron/rust,defuz/rust,P1start/rust,ktossell/rust,KokaKiwi/rust,mdinger/ru... | src/etc/copy-runtime-deps.py | src/etc/copy-runtime-deps.py | #!/usr/bin/env python
# xfail-license
# Copies Rust runtime dependencies to the specified directory
import snapshot, sys, os, shutil
def copy_runtime_deps(dest_dir):
for path in snapshot.get_winnt_runtime_deps():
shutil.copy(path, dest_dir)
lic_dest = os.path.join(dest_dir, "third-party")
if os.... | #!/usr/bin/env python
# xfail-license
# Copies Rust runtime dependencies to the specified directory
import snapshot, sys, os, shutil
def copy_runtime_deps(dest_dir):
for path in snapshot.get_winnt_runtime_deps():
shutil.copy(path, dest_dir)
lic_dest = os.path.join(dest_dir, "third-party")
shutil... | apache-2.0 | Python |
d206b02e12cf7f5418cd02987313bd7ddd807901 | add geom_tile layer. | has2k1/plotnine,has2k1/plotnine | ggplot/geoms/geom_tile.py | ggplot/geoms/geom_tile.py | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from geom import geom
class geom_tile(geom):
VALID_AES = ['x', 'y', 'fill']
def plot_layer(self, layer):
layer = {k: v for k, v in layer.iteritems() if k in self.VALID_AES}
layer.update(self.manual_aes)
x = layer... | mit | Python | |
d940ce7cbd92c0e886139eaec3faa75aabbce16a | add test models | byteweaver/django-singleactiveobject | singleactiveobject/tests/models.py | singleactiveobject/tests/models.py | from singleactiveobject.models import SingleActiveObjectMixin
class SingleActiveObject(SingleActiveObjectMixin):
pass
| bsd-3-clause | Python | |
71d3375c4ca1acb106f8825d2f39ca602fa47e94 | Test astroid trajectory implementation | bit0001/trajectory_tracking,bit0001/trajectory_tracking | src/test/trajectory/test_astroid_trajectory.py | src/test/trajectory/test_astroid_trajectory.py | #!/usr/bin/env python
import unittest
from geometry_msgs.msg import Point
from trajectory.astroid_trajectory import AstroidTrajectory
class AstroidTrajectoryTest(unittest.TestCase):
def setUp(self):
self.delta = 0.000001
self.radius = 5
self.period = 4
self.expected_position = P... | mit | Python | |
835b5f20061033b6fcf2a8b86203a42c5d4835ee | Add initial unit tests for parameter.py (List) | bees4ever/spotpy,bees4ever/spotpy,thouska/spotpy,thouska/spotpy,thouska/spotpy,bees4ever/spotpy | spotpy/unittests/test_parameter.py | spotpy/unittests/test_parameter.py | import unittest
try:
import spotpy
except ImportError:
import sys
sys.path.append(".")
import spotpy
from spotpy import parameter
import numpy as np
#https://docs.python.org/3/library/unittest.html
class TestListParameterDistribution(unittest.TestCase):
def setUp(self):
self.values = [1, ... | mit | Python | |
e9a5a0c22de92f3b5eb5df567475736b72c5067c | Add pa300_calc_coord.py | wataash/Instr,wataash/Instr | pa300_calc_coord.py | pa300_calc_coord.py | # Std libs
from itertools import product
import sqlite3
# My libs
import constants as c
conn_params = sqlite3.connect(c.sql_params_dropbox)
cur_params = conn_params.cursor()
dats = cur_params.execute('''SELECT mask, mesa, xm_mesa, ym_mesa, xm_pad, ym_pad
FROM mesas''').fetchall()
for dat... | mit | Python | |
a52ae7a34b9ec1dd03653c6c735b3930033ac830 | add a sample of visitor pattern for resolving recursion limit problem using generator. | ptrsxu/snippetpy | patterns/visitor.py | patterns/visitor.py | """
from python cookbook 3rd edition. PY3 only.
Resolve the recursion limit problem.
"""
import types
class Node:
pass
class NodeVisitor:
def visit(self, node):
stack = [node]
last_result = None
while stack:
try:
last = stack[-1]
if isinsta... | mit | Python | |
b3c89917895786bfab5d4fae9ce086767575a506 | Add a deployment script | slice/dogbot,slice/dogbot,sliceofcode/dogbot,slice/dogbot,sliceofcode/dogbot | deploy.py | deploy.py | """ This is a script that deploys Dogbot. """
import os
from pathlib import Path
from ruamel.yaml import YAML
import requests
# load the webhook url from the configuration
with open('config.yml') as f:
webhook_url = YAML(typ='safe').load(f)['monitoring']['health_webhook']
def info(text):
print('\033[32m[in... | mit | Python | |
10b3ae6ab5009fe0c43b744dc655bd6512cec041 | Include basic version of contract object | leaffan/pynhldb | db/contract.py | db/contract.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from .common import Base, session_scope
class Contract(Base):
__tablename__ = 'contracts'
__autoload__ = True
def __init__(self, player_id, contract_data):
| mit | Python | |
aef7c25964883bae893913524bc9ff3dc0bdcde3 | Add a docker helper script (#18) | woofwoofinc/cargo-sphinx,woofwoofinc/cargo-sphinx | docker.py | docker.py | #!/usr/bin/env python3
import argparse
import subprocess
IMAGE_NAME = 'cargo-sphinx'
def has_image(name):
cmd = "docker images | awk '{{print $1}}' | grep '^{name}$' > /dev/null".format(
name=name),
proc = subprocess.run(cmd, shell=True)
return proc.returncode == 0
def main():
parser =... | apache-2.0 | Python | |
647fd44f829a308dc16eb86a663dc1a3719476ab | add solution for Search a 2D Matrix II | zhyu/leetcode,zhyu/leetcode | algorithms/searchA2DMatrixII/searchA2DMatrixII.py | algorithms/searchA2DMatrixII/searchA2DMatrixII.py | class Solution:
# @param {integer[][]} matrix
# @param {integer} target
# @return {boolean}
def searchMatrix(self, matrix, target):
n = len(matrix)
m = len(matrix[0])
x = n-1
y = 0
while x >= 0 and y < m:
if matrix[x][y] == target:
ret... | mit | Python | |
00e68a20d4691ae3172ae0bb11b8440387acc0d6 | Add the server based on oslo.service. | xgfone/pycom,xgfone/xutils | pycom/server.py | pycom/server.py | # encoding: utf-8
from __future__ import absolute_import, print_function, unicode_literals
import os
import socket
import logging
import functools
import greenlet
import eventlet
from oslo_service import service
LOG = logging.getLogger(__name__)
def listen_socket(host, port, backlog=1024, reuse=True):
sock = s... | mit | Python | |
ada6128817769886e2869944fac3a8cea0b5b109 | Add a missing module | drtconway/pykmer | pykmer/timer.py | pykmer/timer.py | """
This module provides a simple timer class for instrumenting code.
"""
import time
class timer(object):
def __init__(self):
self.start = time.time()
self.sofar = 0.0
self.paused = False
self.events = 0
def pause(self):
now = time.time()
self.sofar += now - s... | apache-2.0 | Python | |
6e767e8f5b219d9883fb1a16846830efabac7d5b | Add python | koverholt/hello-world,koverholt/hello-world,koverholt/hello-world,koverholt/hello-world,koverholt/hello-world,koverholt/hello-world | python/hello.py | python/hello.py | print("Hello, World!")
| bsd-3-clause | Python | |
01472504fc42137a05a85ae5ad6d4b7956865680 | Add autosolver for regex. | hghwng/mooc-algs2,hghwng/mooc-algs2 | quiz/5-regex.py | quiz/5-regex.py | #!/usr/bin/env python3
def make_array(text):
import re
regex = re.compile('(\d+)->(\d+)')
pairs = regex.findall(text)
ret = list()
for (src, dst) in pairs:
src = int(src)
dst = int(dst)
ret.append((src, dst))
return ret
def make_transitive_closure(states, eps_trans):
... | mit | Python | |
2c1b5aedc5f4503a738ef7e9ffa0a7f969fecfef | add argparse example | familug/FAMILUG,familug/FAMILUG,familug/FAMILUG,familug/FAMILUG,familug/FAMILUG,familug/FAMILUG,familug/FAMILUG,familug/FAMILUG | Python/calculator_argp.py | Python/calculator_argp.py | import argparse
def main():
parser = argparse.ArgumentParser(description='Calculate two input numbers')
parser.add_argument(
'first', metavar='int', type=int,
help='first number')
parser.add_argument(
'oper', metavar='oper', type=str,
help='operator +, - or... | bsd-2-clause | Python | |
ed5f68211e93df983a5e15c7f1ce812b810b49c0 | Add ANTs package (#7717) | LLNL/spack,krafczyk/spack,krafczyk/spack,iulian787/spack,tmerrick1/spack,iulian787/spack,LLNL/spack,iulian787/spack,krafczyk/spack,matthiasdiener/spack,mfherbst/spack,EmreAtes/spack,LLNL/spack,matthiasdiener/spack,matthiasdiener/spack,tmerrick1/spack,EmreAtes/spack,matthiasdiener/spack,LLNL/spack,iulian787/spack,EmreAt... | var/spack/repos/builtin/packages/ants/package.py | var/spack/repos/builtin/packages/ants/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 | |
744cedc7e999f96aa0646bb43c039882991228ae | Add Asio package (#24485) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/asio/package.py | var/spack/repos/builtin/packages/asio/package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
import os.path
class Asio(AutotoolsPackage):
"""C++ library for network and low-level I/O progra... | lgpl-2.1 | Python | |
b1feed0ced6d1328cc39bc9bba36331ec6da7803 | Add ban for pgp/gpg private key blocks | pre-commit/pre-commit-hooks,Harwood/pre-commit-hooks | pre_commit_hooks/detect_private_key.py | pre_commit_hooks/detect_private_key.py | from __future__ import print_function
import argparse
import sys
BLACKLIST = [
b'BEGIN RSA PRIVATE KEY',
b'BEGIN DSA PRIVATE KEY',
b'BEGIN EC PRIVATE KEY',
b'BEGIN OPENSSH PRIVATE KEY',
b'BEGIN PRIVATE KEY',
b'PuTTY-User-Key-File-2',
b'BEGIN SSH2 ENCRYPTED PRIVATE KEY',
b'BEGIN PGP PRI... | from __future__ import print_function
import argparse
import sys
BLACKLIST = [
b'BEGIN RSA PRIVATE KEY',
b'BEGIN DSA PRIVATE KEY',
b'BEGIN EC PRIVATE KEY',
b'BEGIN OPENSSH PRIVATE KEY',
b'BEGIN PRIVATE KEY',
b'PuTTY-User-Key-File-2',
b'BEGIN SSH2 ENCRYPTED PRIVATE KEY',
]
def detect_priv... | mit | Python |
6b9b9642ca09f3b33bdf61bb5dacbaa7c29de8fc | Create __main__.py | 0xC70FF3/pyarchetype,0xC70FF3/pyarchetype | src/__main__.py | src/__main__.py | mit | Python | ||
a58a7f3206168ae98b952e804404c46b89e81640 | Add a snippet (Pillow). | 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/pil/python3_pillow_fork/show.py | python/pil/python3_pillow_fork/show.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Jérémie DECOCK (http://www.jdhp.org)
# 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 witho... | mit | Python | |
21f789eb05788fcaf0be1960b3c1171437d8a299 | Replace Dict by Mapping. | arpith/zulip,Diptanshu8/zulip,Diptanshu8/zulip,showell/zulip,sonali0901/zulip,mohsenSy/zulip,dhcrzf/zulip,showell/zulip,ryanbackman/zulip,joyhchen/zulip,AZtheAsian/zulip,amanharitsh123/zulip,mohsenSy/zulip,punchagan/zulip,eeshangarg/zulip,showell/zulip,jrowan/zulip,christi3k/zulip,Diptanshu8/zulip,joyhchen/zulip,verma-... | zerver/lib/session_user.py | zerver/lib/session_user.py | from __future__ import absolute_import
from django.contrib.auth import SESSION_KEY, get_user_model
from django.contrib.sessions.models import Session
from typing import Mapping, Optional
from six import text_type
def get_session_dict_user(session_dict):
# type: (Mapping[text_type, int]) -> Optional[int]
# C... | from __future__ import absolute_import
from django.contrib.auth import SESSION_KEY, get_user_model
from django.contrib.sessions.models import Session
from typing import Dict, Optional
from six import text_type
def get_session_dict_user(session_dict):
# type: (Dict[text_type, int]) -> Optional[int]
# Compare... | apache-2.0 | Python |
7037762247bd40455eb1944dc21684561c5f97ba | add a __init__ file | ManushiM/infoviz_refugee_project,ManushiM/infoviz_refugee_project,ManushiM/infoviz_refugee_project,Elixeus/infoviz_refugee_project,Elixeus/infoviz_refugee_project,Elixeus/infoviz_refugee_project,jgrundy/infoviz_refugee_project,jgrundy/infoviz_refugee_project,jgrundy/infoviz_refugee_project | dataScraping/__init__.py | dataScraping/__init__.py | #!/usr/bin/env python
| mit | Python | |
2b4544820bf6549bc172f8d5b3532a9103190920 | add utility I used to generate random ph and temp readings | aquarimeter/aquarimeter,aquarimeter/aquarimeter | utils/generate_random_values.py | utils/generate_random_values.py | import random
ph = [random.uniform(0, 14) for x in range(30000)]
temp = [random.uniform(55, 90) for x in range(30000)]
temp_file = open('temp.csv', 'w+')
ph_file = open('ph.csv', 'w+')
for x in range(len(temp)):
temp_file.write("%.2f," % temp[x])
ph_file.write("%.2f," % ph[x])
temp_file.close()
ph_file.close()
| apache-2.0 | Python | |
4883bd13c6e07a0568c29fd26a141888b52292b7 | Add retriever object for player draft information | leaffan/pynhldb | utils/player_draft_retriever.py | utils/player_draft_retriever.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import requests
from lxml import html
from db.team import Team
from db.player_draft import PlayerDraft
class PlayerDraftRetriever():
NHL_PLAYER_DRAFT_PREFIX = "https://www.nhl.com/player"
DRAFT_INFO_REGEX = re.compile(
"(\d{4})\s(.+),\s(\d+).+... | mit | Python | |
a5e18330ac84a93b9a3ffe7d8493c401d3ade11e | Create version.py | HarllanAndrye/nilmtk,pauldeng/nilmtk,jaduimstra/nilmtk,nilmtk/nilmtk,mmottahedi/nilmtk,AlexRobson/nilmtk,josemao/nilmtk,nilmtk/nilmtk | nilmtk/version.py | nilmtk/version.py | version = '0.1.0'
| apache-2.0 | Python | |
776350aaaed8a8e3f00a492c1a1735c24f595d89 | add config_dialog.py | mynicolas/KeyCounter,mynicolas/KeyCounter,mynicolas/KeyCounter | dialogs/config_dialog.py | dialogs/config_dialog.py | #-*- coding: utf-8 -*-
from win32ui import IDD_SET_TABSTOPS
from win32ui import IDC_EDIT_TABS
from win32ui import IDC_PROMPT_TABS
from win32con import IDOK
from win32con import IDCANCEL
import win32ui
import win32con
from pywin.mfc import dialog
IDC_EDIT_USERNAME = 2000
IDC_EDIT_PASSWORD = 2001
def ConfigDialogTem... | mit | Python | |
42faf76ffe421802e628dd2a79f518765d43284b | Create recordsCheck.py | abhishekg2389/youtube-8m-challenge | recordsCheck.py | recordsCheck.py | import tensorflow as tf
import glob as glob
import getopt
import sys
import cPickle as pkl
import numpy as np
import time
opts, _ = getopt.getopt(sys.argv[1:],"",["input_dir=", "input_file=", "output_file="])
input_dir = "/data/video_level_feat_v3/"
input_file = ""
output_file = ""
print(opts)
for opt, arg in opts:
... | mit | Python | |
f4bd76b7ebe376a2a0cea0ac1a44be4d741ce5c5 | Create LeetCode-541.py | yolozhang/Python-route | LeetCode-541.py | LeetCode-541.py | import math
class Solution(object):
def ReverseStr(self, str, k):
ans=''
n = int (math.ceil(len(str) / (2.0*k) ))
for i in range(n):
ans += str[2*i*k:(2*i+1)*k][::-1] #reverse k str
print '1',ans
ans += str[(2*i+1)*k:(2*i+2)*k]
print '2',ans
... | unlicense | Python | |
ed1dd068e41138f1f3b18b028e20e542965d2c7f | add word_dictionary.py task from week7 | pepincho/HackBulgaria,pepincho/Python101-and-Algo1-Courses,pepincho/HackBulgaria,pepincho/Python101-and-Algo1-Courses | Algo-1/week7/1-Word-Dictionary/word_dictionary.py | Algo-1/week7/1-Word-Dictionary/word_dictionary.py | class WordDictionary:
class Node:
def __init__(self, char):
# char is a substring of the phone number
self.char = char
# 10 digits
self.children_nodes = [None for i in range(26)]
self.isTerminal = False
def get_char(self):
re... | mit | Python | |
a71b50f4b6a3bc1e760e3796f8c14f6c3e865a34 | replace identity translators with None | sloria/modular-odm,CenterForOpenScience/modular-odm,icereval/modular-odm,chrisseto/modular-odm | modularodm/translators/__init__.py | modularodm/translators/__init__.py | from dateutil import parser as dateparser
from bson import ObjectId
class DefaultTranslator(object):
null_value = None
to_default = None
from_default = None
class JSONTranslator(DefaultTranslator):
def to_datetime(self, value):
return str(value)
def from_datetime(self, value):
... | from dateutil import parser as dateparser
from bson import ObjectId
class DefaultTranslator(object):
null_value = None
def to_default(self, value):
return value
def from_default(self, value):
return value
def to_ObjectId(self, value):
return str(value)
def from_ObjectId... | apache-2.0 | Python |
4cdeb6987910d4d5b33d37486ddeaafcde54bb2f | add classify_neuralnet script | NickleDave/hybrid-vocal-classifier | hvc/classify_neuralnet.py | hvc/classify_neuralnet.py | #from standard library
import glob
import sys
import os
import shelve
#from third-party
import numpy as np
import scipy.io as scio # to load matlab files
import numpy as np
from scipy.io import wavfile
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import StratifiedKFold
from keras.utils... | bsd-3-clause | Python | |
bb785321cbb9d372f2009a4577404ae75fbd889a | exclude TestApp from cppcheck script | al2950/mygui,fmwviormv/mygui,fmwviormv/mygui,fmwviormv/mygui,scrawl/mygui,Anomalous-Software/mygui,scrawl/mygui,al2950/mygui,al2950/mygui,scrawl/mygui,al2950/mygui,Anomalous-Software/mygui,Anomalous-Software/mygui,Anomalous-Software/mygui,fmwviormv/mygui,scrawl/mygui | Scripts/cppcheck/cppcheck.py | Scripts/cppcheck/cppcheck.py | # run from root sources directory: python Scripts/cppcheck/cppcheck.py
import os
ignoredEndings = ["is never used", "It is safe to deallocate a NULL pointer", "Throwing exception in destructor"]
ignoredContent = ["MyGUI_UString"]
def isIgnoredWarning(warning):
for ignore in ignoredEndings:
if warning.endswith(igno... | # run from root sources directory: python Scripts/cppcheck/cppcheck.py
import os
ignoredEndings = ["is never used", "It is safe to deallocate a NULL pointer", "Throwing exception in destructor"]
ignoredContent = ["MyGUI_UString"]
def isIgnoredWarning(warning):
for ignore in ignoredEndings:
if warning.endswith(igno... | mit | Python |
bc34d530f4a21b5f06228d626f446c617b9c8876 | Add example that mirrors defconfig and oldconfig. | ulfalizer/Kconfiglib,ulfalizer/Kconfiglib | examples/defconfig_oldconfig.py | examples/defconfig_oldconfig.py | # Produces exactly the same output as the following script:
#
# make defconfig
# echo CONFIG_ETHERNET=n >> .config
# make oldconfig
# echo CONFIG_ETHERNET=y >> .config
# yes n | make oldconfig
#
# This came up in https://github.com/ulfalizer/Kconfiglib/issues/15.
import kconfiglib
import sys
conf = kconfiglib.Config(... | isc | Python | |
7c270e2fb5e3169f179e045cc58fdd4d58672859 | add fixCAs.py to master | django-rea/nrp,valnet/valuenetwork,valnet/valuenetwork,django-rea/nrp,FreedomCoop/valuenetwork,valnet/valuenetwork,django-rea/nrp,FreedomCoop/valuenetwork,django-rea/nrp,FreedomCoop/valuenetwork,valnet/valuenetwork,FreedomCoop/valuenetwork | fixCAs.py | fixCAs.py | import sys
from valuenetwork.valueaccounting.models import *
agents = EconomicAgent.objects.all()
#import pdb; pdb.set_trace()
count = 0
for agent in agents:
agent.is_context = agent.agent_type.is_context
try:
agent.save()
count = count + 1
except:
print "Unexpected error:", sys.e... | agpl-3.0 | Python | |
171d573082e528b1f103db7ea22022fdcb24d629 | Create count-depth_true_false_unknown.py | CAMI-challenge/evaluation,CAMI-challenge/evaluation | binning/count-depth_true_false_unknown.py | binning/count-depth_true_false_unknown.py | #!/usr/bin/env python
from sys import argv, stdout, stderr, exit
from numpy import mean
# simple dummy weight function counting each sequences as one
class oneweight:
__getitem__ = lambda self,key: 1
def usage():
print >> stderr, 'Usage: ', argv[0], '--labels lab.racol --predictions pred.racol [--with-unknown-labe... | mit | Python | |
38f90c31f6a0f4459a8ba2f96205d80588b384c5 | Add CollectDict (incomplete dicts) | EricssonResearch/calvin-base,EricssonResearch/calvin-base,EricssonResearch/calvin-base,EricssonResearch/calvin-base | calvin/actorstore/systemactors/json/CollectDict.py | calvin/actorstore/systemactors/json/CollectDict.py | # -*- coding: utf-8 -*-
# Copyright (c) 2017 Ericsson AB
#
# 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 ... | apache-2.0 | Python | |
625139f9d3e5c06f4e5b355eaa070389f9a81954 | Add utils module | aaxelb/osf.io,ZobairAlijan/osf.io,haoyuchen1992/osf.io,caseyrygt/osf.io,HarryRybacki/osf.io,adlius/osf.io,jeffreyliu3230/osf.io,acshi/osf.io,dplorimer/osf,brandonPurvis/osf.io,DanielSBrown/osf.io,njantrania/osf.io,samanehsan/osf.io,petermalcolm/osf.io,mattclark/osf.io,caseyrollins/osf.io,kch8qx/osf.io,RomanZWang/osf.io... | website/addons/dropbox/utils.py | website/addons/dropbox/utils.py | # -*- coding: utf-8 -*-
import os
from website.project.utils import get_cache_content
from website.addons.dropbox.client import get_node_addon_client
def get_file_name(path):
return os.path.split(path.strip('/'))[1]
# TODO(sloria): TEST ME
def render_dropbox_file(file_obj, client=None):
# Filename for the ... | apache-2.0 | Python | |
1cf4de645dd44269b01b7f57322a3edca8334fc8 | Add another example script for MIDI output: a minimal drum pattern sequencer | SpotlightKid/microbit-worldtour-monifa | mididrumbox.py | mididrumbox.py | from microbit import button_a, display
from microbit import uart
from microbit import running_time, sleep
NOTE_ON = 0x90
CONTROLLER_CHANGE = 0xB0
PROGRAM_CHANGE = 0xC0
class MidiOut:
def __init__(self, device, channel=1):
if channel < 1 or channel > 16:
raise ValueError('channel must be an int... | mit | Python | |
821a3826110ecfc64ab431b7028af3aae8aa80db | Add 20150522 question. | fantuanmianshi/Daily,fantuanmianshi/Daily | LeetCode/house_robbers.py | LeetCode/house_robbers.py | """
You are a professional robber planning to rob houses along a street. Each house
has a certain amount of money stashed, the only constraint stopping you from
robbing each of them is that adjacent houses have security system connected and
it will automatically contact the police if two adjacent houses were broken
int... | mit | Python | |
06cd9e8e5006d68d7656b7f147442e54aaf9d7a1 | Add female Public Health College and Club | enjaz/enjaz,osamak/student-portal,osamak/student-portal,enjaz/enjaz,osamak/student-portal,osamak/student-portal,enjaz/enjaz,osamak/student-portal,enjaz/enjaz,enjaz/enjaz | clubs/migrations/0035_add_public_health_college.py | clubs/migrations/0035_add_public_health_college.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def add_college(apps, schema_editor):
Club = apps.get_model('clubs', 'Club')
College = apps.get_model('clubs', 'College')
StudentClubYear = apps.get_model('core', 'StudentClubYear')
year_2015_2016 ... | agpl-3.0 | Python | |
c2257a268662c4ea220c6c4d869d38c9f9ab55de | Create hcsr04.py | ric96/joypi3 | hcsr04.py | hcsr04.py | !/usr/bin/env python
#
# HC-SR04 interface code for the Raspberry Pi
#
# William Henning @ http://Mikronauts.com
#
# uses joan's excellent pigpio library
#
# Does not quite work in one pin mode, will be updated in the future
#
import time
import pigpio
import memcache
mc = memcache.Client(['127.0.0.1:11211'], debug=0)... | mit | Python | |
f4357343df1d13f5828c233e84d14586a1f786d0 | add functools03.py | devlights/try-python | trypython/stdlib/functools03.py | trypython/stdlib/functools03.py | # coding: utf-8
"""
functoolsモジュールについて
singledispatch関数についてのサンプルです.
"""
import functools
import html
import numbers
from trypython.common.commoncls import SampleBase
from trypython.common.commonfunc import pr
# ---------------------------------------------
# singledispatch化したい関数に対して
# @functools.singledispatch デコレータ... | mit | Python | |
17cdae7f50a7ed15c4e8a84cdb0000a32f824c5f | Add an oauth example script. | xrg/tweepy,raymondethan/tweepy,damchilly/tweepy,mlinsey/tweepy,ze-phyr-us/tweepy,obskyr/tweepy,markunsworth/tweepy,edsu/tweepy,kcompher/tweepy,yared-bezum/tweepy,tuxos/tweepy,alexhanna/tweepy,nickmalleson/tweepy,iamjakob/tweepy,cogniteev/tweepy,cinemapub/bright-response,nickmalleson/tweepy,conversocial/tweepy,cinemapub... | examples/outh/getaccesstoken.py | examples/outh/getaccesstoken.py | import webbrowser
import tweepy
"""
Query the user for their consumer key/secret
then attempt to fetch a valid access token.
"""
if __name__ == "__main__":
consumer_key = raw_input('Consumer key: ').strip()
consumer_secret = raw_input('Consumer secret: ').strip()
auth = tweepy.OAuthHandler(consu... | mit | Python | |
62f44daaf325d94c7374836f3bb50fd5694c62c0 | Add utilities/extract_scores.py | nettrom/Wiki-Class | wikiclass/utilities/extract_scores.py | wikiclass/utilities/extract_scores.py |
r"""
Gathers the scores for a set of revisions and
prints a TSV to stdout of the format:
<page_id>\t<title>\n<rev_id>\t<prediction>\t<weighted_sum>
See https://phabricator.wikimedia.org/T135684 for more information.
Usage:
extract_scores -h | --help
extract_scores --dump=<dump-file>... --model=<model-file>
... | mit | Python | |
3898bec1a5470c79f93e7c69f6700a4af1801670 | Create love6.py | dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey | Python/CodingBat/love6.py | Python/CodingBat/love6.py | # http://codingbat.com/prob/p100958
def love6(a, b):
return ( (a == 6) or (b == 6) or (a+b == 6) or (abs(a-b) == 6) )
| mit | Python | |
be095fdb2163575803020cefcfa0d86cff1d990f | Create new package (#6453) | krafczyk/spack,mfherbst/spack,mfherbst/spack,EmreAtes/spack,krafczyk/spack,krafczyk/spack,mfherbst/spack,iulian787/spack,EmreAtes/spack,EmreAtes/spack,LLNL/spack,matthiasdiener/spack,LLNL/spack,tmerrick1/spack,EmreAtes/spack,matthiasdiener/spack,matthiasdiener/spack,LLNL/spack,matthiasdiener/spack,tmerrick1/spack,mfher... | var/spack/repos/builtin/packages/r-lars/package.py | var/spack/repos/builtin/packages/r-lars/package.py | ##############################################################################
# Copyright (c) 2013-2017, 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 | |
4acf6d76bf7ec982573331835f7bcddd8487b18b | Add package for unison | skosukhin/spack,mfherbst/spack,EmreAtes/spack,tmerrick1/spack,matthiasdiener/spack,TheTimmy/spack,LLNL/spack,krafczyk/spack,TheTimmy/spack,iulian787/spack,TheTimmy/spack,TheTimmy/spack,tmerrick1/spack,krafczyk/spack,LLNL/spack,matthiasdiener/spack,mfherbst/spack,TheTimmy/spack,skosukhin/spack,krafczyk/spack,lgarren/spa... | var/spack/repos/builtin/packages/unison/package.py | var/spack/repos/builtin/packages/unison/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 | |
77d3756d27758276c084cf20693202cfa645df3e | Add fptool.py that will replace flash_fp_mcu | coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec | util/fptool.py | util/fptool.py | #!/usr/bin/env python3
# Copyright 2021 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A tool to manage the fingerprint system on Chrome OS."""
import argparse
import os
import shutil
import subprocess
import sys
... | bsd-3-clause | Python | |
bc32b2bccc82caecea0cf936e13c3ae70d0e9486 | Add script to remove broken images. | Lodour/Weibo-Album-Crawler | utils/check.py | utils/check.py | from pathlib import Path
from PIL import Image
from concurrent.futures import ProcessPoolExecutor
import os
import sys
def verify_or_delete(filename):
try:
Image.open(filename).load()
except OSError:
return False
return True
if __name__ == '__main__':
if len(sys.argv) < 2:
pri... | mit | Python | |
388bbd915a5e40a2e096eb22ab294ffcbd3db936 | Add a gmm, currently wrapping sklearn | bccp/bananaplots,bccp/bananaplots | bananas/model.py | bananas/model.py | import numpy
# FIXME: copy the functions here
from sklearn.mixture.gmm import log_multivariate_normal_density, logsumexp
class GMM(object):
def __init__(self, weights, means, covs):
self.weights = numpy.array(weights)
self.means = numpy.array(means)
self.covs = numpy.array(covs)
def s... | apache-2.0 | Python | |
b1bea70df1f62e4c0447a406b77266b804eec5df | add new Package (#15894) | iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack | var/spack/repos/builtin/packages/nanomsg/package.py | var/spack/repos/builtin/packages/nanomsg/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Nanomsg(CMakePackage):
"""The nanomsg library is a simple high-performance
implemen... | lgpl-2.1 | Python | |
f069a3feda43ebc436e404dad66dfaa06055e35a | Add h5sh python package (#14001) | iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack | var/spack/repos/builtin/packages/py-h5sh/package.py | var/spack/repos/builtin/packages/py-h5sh/package.py | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyH5sh(PythonPackage):
"""Shell-like environment for HDF5."""
homepage = "https://pyp... | lgpl-2.1 | Python | |
5d3a774587bef551553a731d4f9dcfeefdb70ed3 | Add package for scalpel@0.5.3 (#5901) | skosukhin/spack,EmreAtes/spack,tmerrick1/spack,EmreAtes/spack,tmerrick1/spack,LLNL/spack,LLNL/spack,EmreAtes/spack,skosukhin/spack,matthiasdiener/spack,lgarren/spack,iulian787/spack,matthiasdiener/spack,skosukhin/spack,mfherbst/spack,tmerrick1/spack,lgarren/spack,EmreAtes/spack,matthiasdiener/spack,krafczyk/spack,skosu... | var/spack/repos/builtin/packages/scalpel/package.py | var/spack/repos/builtin/packages/scalpel/package.py | ##############################################################################
# Copyright (c) 2013-2017, 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 | |
1f731dcbfcff76ba63e4aea4fc05a15dd5021daa | Test for overriding sys.stdout. | pfalcon/micropython,pfalcon/micropython,pfalcon/micropython,pfalcon/micropython,pfalcon/micropython | tests/io/sys_stdio_override.py | tests/io/sys_stdio_override.py | try:
import uio as io
except ImportError:
try:
import io
except ImportError:
print("SKIP")
raise SystemExit
import sys
try:
sys.stdout = sys.stdout
except AttributeError:
print("SKIP")
raise SystemExit
buf = io.StringIO()
sys.stdout = buf
print(1, "test", 10 + 20)
| mit | Python | |
855d10b768fbfec7772f8e5df4c181d971fe0dd4 | add tests. | hickford/primesieve-python | tests/test_primesieve_array.py | tests/test_primesieve_array.py | from primesieve.array import n_primes, primes
def assert_array_equal(have, want):
assert list(have) == want
def test_primes_array():
assert_array_equal(primes(10), [2,3,5,7])
assert_array_equal(primes(10, 20), [11,13,17,19])
def test_n_primes_array():
assert_array_equal(n_primes(7), [2,3,5,7,11,13,17... | mit | Python | |
9de475e8007b209d005ed222686cb46bddef053d | Integrate LLVM at llvm/llvm-project@9e37b1e5a0c1 | tensorflow/tensorflow,tensorflow/tensorflow-pywrap_saved_model,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow-pywrap_saved_model,karllessard/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow,karllessard/tensorflow,Intel-tensorflow/tensorflow,paolodedios/tens... | third_party/llvm/workspace.bzl | third_party/llvm/workspace.bzl | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "9e37b1e5a0c15f36c5642406d5aa02a657a0b19c"
LLVM_SHA256 = "e2cca91a76ee6b44a6af91874e429af582b248b96ccd139373fec69ed0b0215f"
tf_http_archive(
... | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "ab85996e475ceddfda82255c314229ac0c0f4994"
LLVM_SHA256 = "140b4198fa4f0ec1917a0e252feec5e19ccd9d7e96fc818c555b5551c796ec5b"
tf_http_archive(
... | apache-2.0 | Python |
c6b0b5a8cef752481d5ec6672313ec8829d4299f | Create saving.py | mauerflitza/Probieren2,mauerflitza/Probieren2,mauerflitza/Probieren2,mauerflitza/Probieren2 | Webpage/cgi-bin/saving.py | Webpage/cgi-bin/saving.py | #!/usr/bin/python3
import os
import os.path
import cgi, cgitb
import re
import pickle
#own packages
import dbcPattern
def dbc_main(): # NEW except for the call to processInput
form = cgi.FieldStorage() # standard cgi script lines to here!
# use format of next two lines with YOUR names and default data... | mit | Python | |
8c6335c7ba7ebb34566603eb2943752fd3f524db | Add Exercise 9.13. | jcrist/pydy,skidzo/pydy,jcrist/pydy,Shekharrajak/pydy,Shekharrajak/pydy,oliverlee/pydy,Shekharrajak/pydy,jcrist/pydy,oliverlee/pydy,jcrist/pydy,Shekharrajak/pydy,jcrist/pydy,skidzo/pydy,skidzo/pydy,jcrist/pydy,oliverlee/pydy,skidzo/pydy,jcrist/pydy | Kane1985/Chapter5/Ex9.13.py | Kane1985/Chapter5/Ex9.13.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Exercise 9.13 from Kane 1985."""
from __future__ import division
from sympy import expand, symbols
from sympy.physics.mechanics import ReferenceFrame, Point
from sympy.physics.mechanics import dynamicsymbols
from util import msprint, partial_velocities
from util import ... | bsd-3-clause | Python | |
5a2f8967ac09b3aa1fc1cda21fd6dc5cf1d3f896 | Add gesture recognition prototype | aikikode/uspeak | gesture_recognition/__init__.py | gesture_recognition/__init__.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import pygame
from pygame import camera
from pygame.constants import QUIT, K_ESCAPE, KEYDOWN
import numpy as np
class Capture(object):
def __init__(self):
camera.init()
self.size = (640, 480, )
# create a display surface. standard pygame stuf... | mit | Python | |
41ee54414845c3d8c1592048fe2f7cee57153eee | Add Python Numpy and Pandas cheatsheet | HKuz/Test_Code | pythonCheatsheet.py | pythonCheatsheet.py | #!/usr/local/bin/python
# Python Numpy and Pandas Cheatsheet
| mit | Python | |
a813d79ccd63c9ff40afaf3fda4e2c8c0a37ee25 | Add wsgi file | atsuyim/readthedocs.org,royalwang/readthedocs.org,asampat3090/readthedocs.org,atsuyim/readthedocs.org,sils1297/readthedocs.org,techtonik/readthedocs.org,mrshoki/readthedocs.org,michaelmcandrew/readthedocs.org,d0ugal/readthedocs.org,soulshake/readthedocs.org,emawind84/readthedocs.org,takluyver/readthedocs.org,LukasBoers... | readthedocs/wsgi.py | readthedocs/wsgi.py | import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
# This application object is used by any WSGI server configured to use this
# file. This includes Django's development server, if the WSGI_APPLICATION
# setting points here.
from django.core.wsgi import get_wsgi_application
application = get_wsgi_a... | mit | Python | |
7e9794dc98a268479f0f57128effc67f88586c8f | Add default message for list pages | nfletton/bvspca,nfletton/bvspca,nfletton/bvspca,nfletton/bvspca | bvspca/core/migrations/0025_auto_20180202_1214.py | bvspca/core/migrations/0025_auto_20180202_1214.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-02-02 19:14
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0024_contentindexpage_empty_message'),
]
operations = [
migrations.... | mit | Python | |
63db1dc6c23c4afd41bca5cf06207e383c982b51 | structure of the commandprocessor | omarayad1/cantkeepup,omarayad1/cantkeepup,omarayad1/cantkeepup | app/core/commandprocessor.py | app/core/commandprocessor.py | class CommandProcessor:
def parseCommand(self):
pass
def constructUrl(self):
pass
def processCommand(self):
pass
| mit | Python | |
2c687118a9aa248d6e6f28259d8a81217ee9cb1d | add solution for Number of Digit One | zhyu/leetcode,zhyu/leetcode | algorithms/numberOfDigitOne/numberOfDigitOne.py | algorithms/numberOfDigitOne/numberOfDigitOne.py | class Solution:
# @param {integer} n
# @return {integer}
def countDigitOne(self, n):
res = prev = 0
x = 1
while n > 0: # n = 23[y]xxx
y = n % 10
n /= 10
if y > 1:
res += x # 23[2]xxx
elif y == 1:
res +... | mit | Python | |
67dfcd5abb73aff7fd416f665de0d8461ba3e8b4 | Create Subset.py | MariusWirtz/TM1py,OLAPLINE/TM1py | Tests/Subset.py | Tests/Subset.py | __author__ = 'Marius Wirtz'
from TM1py import TM1Queries, Subset
import uuid
import json
import unittest
class TestAnnotationMethods(unittest.TestCase):
q = TM1Queries(ip='', port=8008, user='admin', password='apple', ssl=True)
random_string1 = str(uuid.uuid4()).replace('-', '_')
random_string2 = str(uui... | mit | Python | |
93d6915c0e45d1873a48c298749d6956edbc337e | add remote ssh capability to fs-drift.py | parallel-fs-utils/fs-drift,bengland2/fsstress,bengland2/fsstress,parallel-fs-utils/fs-drift | ssh_thread.py | ssh_thread.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
'''
ssh_thread.py -- manages parallel execution of shell commands on remote hosts
Copyright 2012 -- Ben England
Licensed under the Apache License at http://www.apache.org/licenses/LICENSE-2.0
See Appendix on this page for instructions pertaining to license.
'''
import threadi... | apache-2.0 | Python | |
88e05bd1fe0f2e46e740a3d8d631d4a810c155a6 | Complete P8 | medifle/python_6.00.1x | Quiz/Problem8_satisfiesF.py | Quiz/Problem8_satisfiesF.py | def satisfiesF(L):
"""
Assumes L is a list of strings
Assume function f is already defined for you and it maps a string to a Boolean
Mutates L such that it contains all of the strings, s, originally in L such
that f(s) returns True, and no other elements
Returns the length of L after mut... | mit | Python | |
820fe44762f0037eaacba9b7bf4129a29e25e799 | add migration | masschallenge/django-accelerator,masschallenge/django-accelerator | accelerator/migrations/0036_add_user_deferrable_modal.py | accelerator/migrations/0036_add_user_deferrable_modal.py | # Generated by Django 2.2.10 on 2021-03-03 17:08
from django.conf import settings
from django.db import (
migrations,
models,
)
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('accelerato... | mit | Python | |
a5cabf4b778d03cac472e22b0e62bc262796b5ff | Add tests for `cms.templatetags.pagination`. | jamesfoley/cms,danielsamuels/cms,danielsamuels/cms,dan-gamble/cms,jamesfoley/cms,lewiscollard/cms,lewiscollard/cms,jamesfoley/cms,jamesfoley/cms,dan-gamble/cms,lewiscollard/cms,danielsamuels/cms,dan-gamble/cms | cms/tests/test_templatetags_pagination.py | cms/tests/test_templatetags_pagination.py | from django.http import Http404
from django.test import RequestFactory, TestCase
from ..templatetags.pagination import paginate, pagination, pagination_url
class Object(object):
paginator = None
class PaginationTest(TestCase):
def setUp(self):
self.factory = RequestFactory()
self.request =... | bsd-3-clause | Python | |
aa218407a9efdde9daa53d638fdfdacff873f14b | test change | dlresende/extreme-carpaccio,octo-technology/extreme-carpaccio,octo-technology/extreme-carpaccio,jak78/extreme-carpaccio,dlresende/extreme-carpaccio,dlresende/extreme-carpaccio,jak78/extreme-carpaccio,dlresende/extreme-carpaccio,jak78/extreme-carpaccio,dlresende/extreme-carpaccio,octo-technology/extreme-carpaccio,jak78/... | clients/python/flask-server/tests/client_tests.py | clients/python/flask-server/tests/client_tests.py | """
integration test in python
!!!! NEED PYTHON 2.7.8
"""
import unittest
import urllib2
import urllib
import thread
import time
import json
from client import app
from multiprocessing import Process
class ServerHandlerTest(unittest.TestCase):
server = Process(target=app.run)
@classmethod
def setUpClass(... | bsd-3-clause | Python | |
e2ed85ae1bb3f647095abb00b118cf06ae7549aa | add setup (even if not really needed) | kif/HPP,kif/HPP | 0_Python/setup.py | 0_Python/setup.py | #!/usr/bin/python
from distutils.core import setup
from Cython.Distutils import build_ext
from distutils.extension import Extension
cy_mod = Extension("inside_polygon",
sources= ["inside_polygon.pyx"])
setup(ext_modules=[cy_mod],
cmdclass={'build_ext': build_ext})
| mit | Python | |
cd1c88c519a7079b2cef752473e5da3ddb4224e3 | Add stress package (#3695) | iulian787/spack,LLNL/spack,skosukhin/spack,skosukhin/spack,matthiasdiener/spack,tmerrick1/spack,iulian787/spack,krafczyk/spack,LLNL/spack,TheTimmy/spack,iulian787/spack,lgarren/spack,mfherbst/spack,tmerrick1/spack,EmreAtes/spack,lgarren/spack,skosukhin/spack,EmreAtes/spack,krafczyk/spack,EmreAtes/spack,krafczyk/spack,E... | var/spack/repos/builtin/packages/stress/package.py | var/spack/repos/builtin/packages/stress/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 | |
9ce90bc43cfcc5a56be958671f304e7929eb0446 | Add missing migration step dua changes in model | nimbis/cmsplugin-collapse,nimbis/cmsplugin-collapse | cmsplugin_collapse/migrations/0002_auto_20160210_0651.py | cmsplugin_collapse/migrations/0002_auto_20160210_0651.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('cmsplugin_collapse', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='accordionheader',
... | bsd-3-clause | Python | |
b0ea743fa320f0df6e35b4381e6bd778906a5532 | Add caching mechanism | gateway4labs/labmanager,labsland/labmanager,morelab/labmanager,labsland/labmanager,morelab/labmanager,porduna/labmanager,porduna/labmanager,labsland/labmanager,porduna/labmanager,porduna/labmanager,gateway4labs/labmanager,go-lab/labmanager,morelab/labmanager,morelab/labmanager,go-lab/labmanager,gateway4labs/labmanager,... | labmanager/rlms/caches.py | labmanager/rlms/caches.py | import calendar
from cachecontrol import CacheControl
from cachecontrol.caches import FileCache
from cachecontrol.heuristics import LastModified, TIME_FMT
from email.utils import formatdate, parsedate, parsedate_tz
class LastModifiedNoDate(LastModified):
""" This takes the original LastModified implementation of... | bsd-2-clause | Python | |
b6ac6a73cf10372be3384dbeb99b82b137a9daa2 | Use chevrons instead of arrows in sortable links | sonofatailor/django-oscar,vovanbo/django-oscar,DrOctogon/unwash_ecom,Jannes123/django-oscar,ahmetdaglarbas/e-commerce,sonofatailor/django-oscar,amirrpp/django-oscar,ademuk/django-oscar,dongguangming/django-oscar,sonofatailor/django-oscar,eddiep1101/django-oscar,ka7eh/django-oscar,adamend/django-oscar,nickpack/django-os... | oscar/templatetags/sorting_tags.py | oscar/templatetags/sorting_tags.py | # This is a rewrite of django-sorting but with added support for i18n title
# strings.
# See https://github.com/directeur/django-sorting
from django import template
from django.conf import settings
register = template.Library()
DEFAULT_SORT_UP = getattr(
settings, 'DEFAULT_SORT_UP',
'<i class="icon-chevron-u... | # This is a rewrite of django-sorting but with added support for i18n title
# strings.
# See https://github.com/directeur/django-sorting
from django import template
from django.conf import settings
register = template.Library()
DEFAULT_SORT_UP = getattr(settings, 'DEFAULT_SORT_UP', '↑')
DEFAULT_SORT_DOWN = geta... | bsd-3-clause | Python |
38f28bd0e5d4ea5af69ac7ccc553403a85ac61be | add problem 053 | smrmkt/project_euler | problem_053.py | problem_053.py | #!/usr/bin/env python
#-*-coding:utf-8-*-
'''
There are exactly ten ways of selecting three from five, 12345:
123, 124, 125, 134, 135, 145, 234, 235, 245, and 345
In combinatorics, we use the notation, 5C3 = 10.
In general,
nCr =
n!
r!(n−r)!
,where r ≤ n, n! = n×(n−1)×...×3×2×1, and 0! = 1.
It is not until n = 23, th... | mit | Python | |
ac2d5c10e7895515acd63e2ca91924e99ec17003 | add (Failing) test | salilab/rmf,salilab/rmf,salilab/rmf,salilab/rmf | test/test_writing.py | test/test_writing.py | import RMF
RMF.set_log_level("trace")
path = RMF._get_temporary_file_path("writing.rmf")
print path
fh = RMF.create_rmf_file(path)
fh.add_frame("frame", RMF.FRAME)
fn = fh.get_root_node().add_child("frag", RMF.REPRESENTATION)
pf = RMF.ParticleFactory(fh)
ff = RMF.FragmentFactory(fh)
pf.get(fn).set_radius(1.0)
pf.get... | apache-2.0 | Python | |
3c7b4f727f5f4a061e3e2d8bcabdc007175ab4db | Add cache structures from pycrest (as base work) | Kyria/EsiPy,a-tal/EsiPy | esipy/cache.py | esipy/cache.py | # -*- encoding: utf-8 -*-
import hashlib
import zlib
import os
try:
import pickle
except ImportError: # pragma: no cover
import cPickle as pickle
import logging
logger = logging.getLogger("esipy.cache")
class BaseCache(object):
""" Base cache 'abstract' object that defined
the cache... | bsd-3-clause | Python | |
492d90e1197803f2dbce0b07417d12497c9031fe | Implement away-notify | Heufneutje/txircd,ElementalAlchemist/txircd | txircd/modules/ircv3/awaynotify.py | txircd/modules/ircv3/awaynotify.py | from twisted.plugin import IPlugin
from txircd.module_interface import IModuleData, ModuleData
from zope.interface import implements
class AwayNotify(ModuleData):
implements(IPlugin, IModuleData)
name = "AwayNotify"
def actions(self):
return [ ("usermetadataupdate", 10, self.sendAwayNotice),
("capa... | bsd-3-clause | Python | |
a6ca9fdb71eacffe94fad476712650f82870bb2e | Add base code for choosing solver | fangohr/oommf-python,ryanpepper/oommf-python,ryanpepper/oommf-python,fangohr/oommf-python,ryanpepper/oommf-python,ryanpepper/oommf-python,fangohr/oommf-python | pyoommf/sim.py | pyoommf/sim.py | import os
from drivers.llg import LLG
import oommfmif as o
class Sim(object):
def __init__(self, mesh, Ms, name=None):
self.mesh = mesh
self.Ms = Ms
self.name = name
self.gamma = 2.21e5
self.energies = []
self.N_Sims_Run = 0
# Want some kind of persistent '... | import os
from drivers.llg import LLG
import oommfmif as o
class Sim(object):
def __init__(self, mesh, Ms, name=None):
self.mesh = mesh
self.Ms = Ms
self.name = name
self.gamma = 2.21e5
self.energies = []
self.N_Sims_Run = 0
# Want some kind of persistent '... | bsd-2-clause | Python |
cc78dc401b16ff189b86466e3c0cb4609a72af0d | add tester | regardscitoyens/nosdeputes.fr,regardscitoyens/nosdeputes.fr,regardscitoyens/nosdeputes.fr,regardscitoyens/nosdeputes.fr,regardscitoyens/nosdeputes.fr | batch/depute/test.py | batch/depute/test.py | #!/usr/bin/env python
import os, sys, json
split = False
splitval = False
if len(sys.argv) > 1:
field = sys.argv[1]
if len(sys.argv) > 2:
split = True
if len(sys.argv) > 3:
splitval = int(sys.argv[3])
else:
field = "all"
values = {}
def add_value(val):
if split and ' / ' i... | agpl-3.0 | Python | |
b674a3e4de86728139e97bb02fa90a62a7700c31 | add speech processing test | MaxMorgenstern/EmeraldAI,MaxMorgenstern/EmeraldAI,MaxMorgenstern/EmeraldAI,MaxMorgenstern/EmeraldAI,MaxMorgenstern/EmeraldAI | testing/miniBrain.py | testing/miniBrain.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import time
from os.path import dirname, abspath
sys.path.append(dirname(dirname(abspath(__file__))))
reload(sys)
sys.setdefaultencoding('utf-8')
from EmeraldAI.Pipelines.InputProcessing.ProcessInput import ProcessInput
from EmeraldAI.Pipelines.ScopeAnalyzer.Analyze... | apache-2.0 | Python | |
0942d6bcc1d15b16b4d3170a1574fc5218b2c53b | add python_tips.py | coderzh/CodeTips,coderzh/CodeTips,coderzh/CodeTips | python_tips.py | python_tips.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import argparse
import subprocess
# print 尽量用函数,不用语句
print('Hello World')
# do not use
print 'Hello World'
def subprocess_test():
# 执行子进程获得输出内容,尽量用 subprocess吧
text = os.popen('echo 123').read()
print(text)
# subprocess
#... | mit | Python | |
842c796a223ee9cb78c69ccb59416a2afe0fcee0 | Add tests for Permission class. | Acidity/PyPermissions | tests/permissions.py | tests/permissions.py | import unittest
from permission import Permission, PERMISSION_DELIMITER
class BasicPermissionTests(unittest.TestCase):
def setUp(self):
self.p1 = Permission("test{0}1{0}hello".format(PERMISSION_DELIMITER))
self.p2 = Permission("test{0}2{0}hello".format(PERMISSION_DELIMITER))
self.p3 = Per... | mit | Python | |
cb7d205add1d6e114277e596b2023c755dd1ff19 | add an example unit test | cloudmesh/cloudmesh.docker,karvenka/cloudmesh.docker,cloudmesh/cloudmesh.docker,karvenka/cloudmesh.docker | tests/test_docker.py | tests/test_docker.py | """ run with
python setup.py install; pip install . ; nosetests -v --nocapture tests/docker/test_docker.py
python setup.py install; pip install . ; nosetests -v --nocapture tests/docker/test_docker.py:Test_docker.test_001
nosetests -v --nocapture tests/cm_basic/test_var.py
or
nosetests -v tests/cm_basic/test_var.py... | apache-2.0 | Python | |
4e0476fa83d0832c328abf00b5167887a0af3fe6 | Add tests for hashes | pydanny/webhooks | tests/test_hashes.py | tests/test_hashes.py | from webhooks.hashes import placebo_hash_function, basic_hash_function
def test_placebo():
assert placebo_hash_function() == ""
def test_basic():
hashes = set([basic_hash_function() for x in range(30)])
assert len(hashes) == 30
| bsd-3-clause | Python | |
ef8ca51dbd9b93a801a4a87be3c04f2c56cdef5a | test for call to enqueue passing | algorithmic-music-exploration/amen-server,algorithmic-music-exploration/amen-server | tests/test_server.py | tests/test_server.py | import hashlib
import json
from unittest.mock import Mock
from unittest.mock import ANY
from queue_functions import do_work
from server import handle_post
from uploaders.s3 import get_url
from uploaders.s3 import upload
def test_post():
q = Mock()
filename = 'afakefilename'
files = {'file': [{'body': b'a... | bsd-2-clause | Python | |
b73e125fdcb12649e79aa2e108dcc019d9fffeb0 | add strtol test | f-prettyland/angr,angr/angr,angr/angr,schieb/angr,axt/angr,tyb0807/angr,schieb/angr,angr/angr,chubbymaggie/angr,tyb0807/angr,iamahuman/angr,axt/angr,chubbymaggie/angr,haylesr/angr,iamahuman/angr,haylesr/angr,schieb/angr,f-prettyland/angr,iamahuman/angr,tyb0807/angr,axt/angr,chubbymaggie/angr,f-prettyland/angr | tests/test_strtol.py | tests/test_strtol.py | import nose
import angr
import subprocess
import logging
l = logging.getLogger('angr.tests.strtol')
import os
test_location = str(os.path.dirname(os.path.realpath(__file__)))
def test_strtol():
b = angr.Project(os.path.join(test_location, "../../binaries/tests/x86_64/strtol_test"))
pg = b.factory.path_grou... | bsd-2-clause | Python | |
f5d2b17371dbd974820b9b8ab1fcdb11ad8fa646 | Add in script to count duplicates. | materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org | backend/scripts/countdups.py | backend/scripts/countdups.py | #!/usr/bin/env python
import rethinkdb as r
conn = r.connect('localhost', 30815, db='materialscommons')
rql = r.table('datafiles').filter(r.row['usesid'].match("^[0-9a-f]")).pluck('size')
total_bytes = 0
total_files = 0
for doc in rql.run(conn):
total_bytes = total_bytes + doc['size']
total_files = total_file... | mit | Python | |
8488e7c5245758e4651e6d723f93d52f3ff54d73 | Add tool for submitting jobs to AreWeCompressedYet | luctrudeau/daala,kodabb/daala,vr000m/daala,nvoron23/daala,iankronquist/daala,kustom666/daala,kustom666/daala,jmvalin/daala,kbara/daala,xiph/daala,kbara/daala,xiph/daala,jmvalin/daala,ascent12/daala,tribouille/daala,tribouille/daala,xiph/daala,xiphmont/daala,ycho/daala,xiph/daala,HeadhunterXamd/daala,nvoron23/daala,Head... | tools/submit_awcy.py | tools/submit_awcy.py | #!/usr/bin/env python
from __future__ import print_function
import requests
import argparse
import os
import subprocess
import sys
if 'DAALA_ROOT' not in os.environ:
print("Please specify the DAALA_ROOT environment variable to use this tool.")
sys.exit(1)
keyfile = open('secret_key','r')
key = keyfile.read(... | bsd-2-clause | Python | |
0c145918d0f34bee1193eeaa0488eb369f0e843e | Use item_lookup_field for DELETE methods | sebest/eve,amagdas/eve,bcrochet/eve,elpoisterio/eve,EasonYi/eve,superdesk/eve,opticode/eve,matthieuprat/eve,pjs7678/eve,kynan/eve,julianhille/eve,jzorrof/eve,yanyanqin/eve,mugurrus/eve,hustlzp/eve,stratosgear/eve,kidaa/eve,kalbasit/eve,mcreenan/eve,eduardomb/eve | eve/methods/delete.py | eve/methods/delete.py | # -*- coding: utf-8 -*-
"""
eve.methods.delete
~~~~~~~~~~~~~~~~~~
This module imlements the DELETE method.
:copyright: (c) 2013 by Nicola Iarocci.
:license: BSD, see LICENSE for more details.
"""
from flask import current_app as app, abort
from eve.utils import config
from eve.auth import requir... | # -*- coding: utf-8 -*-
"""
eve.methods.delete
~~~~~~~~~~~~~~~~~~
This module imlements the DELETE method.
:copyright: (c) 2013 by Nicola Iarocci.
:license: BSD, see LICENSE for more details.
"""
from flask import current_app as app, abort
from eve.utils import config
from eve.auth import requir... | bsd-3-clause | Python |
837089f9195af984597522fffc8c2c6a02e73097 | Create config.example.py | trolleway/osmot | scripts/eurotram/config.example.py | scripts/eurotram/config.example.py | dbname='gis'
user='trolleway'
host='localhost'
password='admin'
ngw_url='http://trolleway.nextgis.com'
ngw_resource_id=
ngw_login = 'administrator'
ngw_password = 'admin'
| unlicense | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.