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 |
|---|---|---|---|---|---|---|---|---|
c948c075760137daea5c25c005a17ac851b7c6a0 | create main.py | MohsinTariq10/Amazon-Dropdown-Suggestion-Scrapper | main.py | main.py | import time
from selenium import webdriver
import sys
sting = ""
x =0
for arg in sys.argv:
if (x == 0):
x+=1
continue
sting += arg
sting += " "
i = 1
driver = webdriver.Firefox()
driver.get('https://www.amazon.com/')
elem = driver.find_element_by_id("twotabsearchtextbox")
elem.send_keys("l... | apache-2.0 | Python | |
919b50a3be6ce65c20a5c643e8aa5a52bce06032 | Create misc.py | vincentdavis/Gradient_Delauney_heatmap | misc.py | misc.py | #Read sabple data
import csv
from pygeocoder import Geocoder
# open samle data with per row dictionary
data = csv.DictReader(open("sampledata.csv"))
# GeoCode from address
latlon = []
propvalue = []
for row in data:
propvalue.append(row["VALACT"])
addr = [row["PRPSTRNUM"], row["PRPSTRDIR"], row["PRPSTRNAM"]... | mit | Python | |
3cf7dff46613aa0837066229749891a613395b59 | add str02.py | devlights/try-python | trypython/basic/str02.py | trypython/basic/str02.py | # coding: utf-8
"""splitlinesメソッドについてのサンプルです。"""
import os
from trypython.common.commoncls import SampleBase
from trypython.common.commonfunc import pr
DATA = """
一行目
二行目
三行目
"""
class Sample(SampleBase):
def exec(self):
# ----------------------------------------
# splitとsplitlines
# ---... | mit | Python | |
82c75639b3b57f922991bfa9255f4eef87db010d | Add new "quickstart" samples [(#547)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/547) | googleapis/python-pubsub,googleapis/python-pubsub | samples/snippets/quickstart.py | samples/snippets/quickstart.py | #!/usr/bin/env python
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | apache-2.0 | Python | |
5c3a54a79a763b3b761f053f7360ad2d670ae5cb | Add BSSRDF render widget file. | tatsy/bssrdf-estimate,tatsy/bssrdf-estimate | bssrdf_estimate/interface/bssrdf_redner_widget.py | bssrdf_estimate/interface/bssrdf_redner_widget.py | # -*- coding: utf-8 -*-
from .image_widget import ImageWidget
class BSSRDFRenderWidget(ImageWidget):
def __init__(self, parent=None):
super(BSSRDFRenderWidget, self).__init__(parent)
| mit | Python | |
b9b78201bf66aff1dc7b3d10e13d0f62b23349b0 | add missing file | bchavez/rethinkdb,JackieXie168/rethinkdb,jmptrader/rethinkdb,robertjpayne/rethinkdb,JackieXie168/rethinkdb,mbroadst/rethinkdb,bpradipt/rethinkdb,grandquista/rethinkdb,jmptrader/rethinkdb,grandquista/rethinkdb,bpradipt/rethinkdb,mbroadst/rethinkdb,JackieXie168/rethinkdb,bpradipt/rethinkdb,catroot/rethinkdb,jmptrader/ret... | scripts/build-web-assets-rc.py | scripts/build-web-assets-rc.py | #!/usr/bin/env python
from __future__ import print_function
import os
import sys
import itertools
def main():
assets_root = sys.argv[1]
assert os.path.isdir(assets_root)
output_dir = sys.argv[2]
assert os.path.isdir(output_dir)
assets = [
os.path.relpath(os.path.join(root, path), assets_... | agpl-3.0 | Python | |
6a3d0ae17efd09bbfc184a4c28115cb61b2006e7 | Add a utility to parse the BJCP 2015 Styles csv | chrisgilmerproj/brewdata,chrisgilmerproj/brewdata | bjcp/style_parser.py | bjcp/style_parser.py | #! /usr/bin/env python
import csv
import pprint
import string
"""
Parse the BJCP 2015 Styles CSV file
"""
def main():
styles = {}
filename = '2015_Styles.csv'
with open(filename, 'rb') as f:
reader = csv.reader(f)
stylename = ''
for row in reader:
if row[0] and row[1... | mit | Python | |
3763078a5a9a1973b17fd1c11411c29e176a034f | Add py solution for 682. Baseball Game | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | py/baseball-game.py | py/baseball-game.py | class Solution(object):
def calPoints(self, ops):
"""
:type ops: List[str]
:rtype: int
"""
s = 0
stack = []
for c in ops:
try:
v = int(c)
stack.append(v)
except ValueError:
if c == 'C':
... | apache-2.0 | Python | |
f25364ba8dbbd7924e068146599f56e5bd797c4e | Add a test case for lldbutil.lldb_iter() which returns an iterator object for lldb objects which can contain other lldb objects. Examples are: SBTarget contains SBModule, SBModule contains SBSymbols, SBProcess contains SBThread, SBThread contains SBFrame, etc. | apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb | test/python_api/lldbutil/TestLLDBIterator.py | test/python_api/lldbutil/TestLLDBIterator.py | """
Test lldbutil.lldb_iter() which returns an iterator object for lldb's aggregate
data structures.
"""
import os, time
import re
import unittest2
import lldb
from lldbtest import *
class LLDBIteratorTestCase(TestBase):
mydir = "python_api/lldbutil"
def setUp(self):
# Call super's setUp().
... | apache-2.0 | Python | |
299a5c80a87ad19f3409f920f38898e828b53b12 | Add files via upload | joievoyage/LPTHW_EXsss,vanzaj/LPTHW_EXsss | ex26.py | ex26.py | def break_words(stuff):
"""This function will break up words for us."""
words = stuff.split(' ')
return words
def sort_words(words):
"""Sorts the words."""
return sorted(words)
def print_first_word(words):
"""Prints the first word after popping it off."""
word = words.pop(0)
print wo... | mpl-2.0 | Python | |
aa837386f4cce1ff23fbdf58a633d0e4bf1cc846 | Add a password hasher for opers | ElementalAlchemist/txircd,Heufneutje/txircd | setup-utils/passhash_pbkdf2.py | setup-utils/passhash_pbkdf2.py | import sys
sys.path.append("..") # This needs to work from the setup-utils subdirectory
from txircd.modules.hash_pbkdf2 import HashPBKDF2
if len(sys.argv) < 2:
print("Usage: {} password".format(__file__))
else:
hasher = HashPBKDF2()
hashedPass = hasher.hash(sys.argv[1])
print(hashedPass) | bsd-3-clause | Python | |
2ace7da5c0ba3efcc2af1ccec864b3a4b1221ad3 | Create Baxter_reward_node.py | ricardodeazambuja/BrianConnectUDP | examples/Baxter_reward_node.py | examples/Baxter_reward_node.py | '''
Generates the reward spikes!
'''
import argparse
from brian_multiprocess_udp import BrianConnectUDP
def reward_generator(spikes_pipe_in, spikes_pipe_out):
"""
This function substitutes the run_brian_simulation and converts the received spikes into Baxter joint angles.
"""
import numpy
im... | cc0-1.0 | Python | |
165c316bbe4977ea10979a5a0e42f3df97ec8dfa | Add new migrations. | torreco/django-oidc-provider,torreco/django-oidc-provider,juanifioren/django-oidc-provider,bunnyinc/django-oidc-provider,wayward710/django-oidc-provider,juanifioren/django-oidc-provider,ByteInternet/django-oidc-provider,wayward710/django-oidc-provider,wojtek-fliposports/django-oidc-provider,bunnyinc/django-oidc-provide... | oidc_provider/migrations/0004_remove_userinfo.py | oidc_provider/migrations/0004_remove_userinfo.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('oidc_provider', '0003_code_nonce'),
]
operations = [
migrations.RemoveField(
model_name='userinfo',
... | mit | Python | |
ceb793fe80574504ce70b3a446a203b0e8be9e52 | add gatk printreads test | Intel-HLS/GKL,Intel-HLS/GKL,Intel-HLS/GKL,Intel-HLS/GKL,Intel-HLS/GKL,Intel-HLS/GKL,Intel-HLS/GKL,Intel-HLS/GKL | scripts/gatk-printreads-test.py | scripts/gatk-printreads-test.py | #!/usr/bin/env python
import logging
import os
import subprocess
import sys
logger = None
def initLogger(filename):
global logger
if logger == None:
logger = logging.getLogger()
else:
for handler in logger.handlers[:]:
logger.removeHandler(handler)
logger.setLevel(logging.... | mit | Python | |
eae062a84a525c5bceea3f5d75e0567198259257 | add data.py | aksnzhy/xLearn,aksnzhy/xLearn,aksnzhy/xLearn,PKU-Cloud-Lab/xLearn,PKU-Cloud-Lab/xLearn,aksnzhy/xLearn,PKU-Cloud-Lab/xLearn,PKU-Cloud-Lab/xLearn | python-package/xlearn/data.py | python-package/xlearn/data.py | # coding: utf-8
class DMatrix(object): | apache-2.0 | Python | |
bee9396a4a8bdef3a22b2010cf873637d5bf56db | Add a function can convert number to Hangul string. | iandmyhand/python-utils | numberutils.py | numberutils.py | ##-*- coding: utf-8 -*-
#!/usr/bin/python
'''
Number to Hangul string util.
'''
__author__ = 'SeomGi, Han'
__credits__ = ['SeomGi, Han']
__copyright__ = 'Copyright 2015, Python Utils Project'
__license__ = 'MIT'
__version__ = '0.0.1'
__maintainer__ = 'SeomGi, Han'
__email__ = 'iandmyhand@gmail.com'
__status__ = 'Pro... | mit | Python | |
d116c4013ebf8b5831d450ae12932446056e7a84 | Add means to dump model for manual classification | hptruong93/MouseGestureRecognition,hptruong93/MouseGestureRecognition | dump_model.py | dump_model.py |
import pickle
import numpy as np
import random
import os
import struct
from config import *
def binary(num):
"""
Float to IEEE-754 single precision binary string.
"""
return ''.join(bin(ord(c)).replace('0b', '').rjust(8, '0') for c in struct.pack('!f', num))
def test_manual_classification(model)... | mit | Python | |
8daec16ca7d2c7d70db3edc23c8d71411df549ea | Fix DummyMixIn. | mhaulo/python-astm,tectronics/python-astm,pombreda/python-astm,MarcosHaenisch/python-astm,eddiep1101/python-astm,tinoshot/python-astm,LogicalKnight/python-astm,andrexmd/python-astm,Alwnikrotikz/python-astm,briankip/python-astm,123412345/python-astm,kxepal/python-astm,asingla87/python-astm,AlanZatarain/python-astm,Iskan... | astm/tests/utils.py | astm/tests/utils.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2012 Alexander Shorin
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
class DummyMixIn(object):
_input_buffer = ''
def flush(self):
pass
def close(sel... | # -*- coding: utf-8 -*-
#
# Copyright (C) 2012 Alexander Shorin
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
class DummyMixIn(object):
_input_buffer = ''
def flush(self):
pass
class CallLogger... | bsd-3-clause | Python |
000c72d4dc8e5b0ef46d432822a4cba5438419f7 | add build-interactive.py | ilius/starcal-server,ilius/starcal-server,ilius/starcal-server | build-interactive.py | build-interactive.py | #!/usr/bin/python3
import sys
import os
from os.path import dirname, join, abspath, isdir, isfile
import subprocess
from prompt_toolkit.history import FileHistory
from prompt_toolkit.auto_suggest import AutoSuggestFromHistory
rootDir = dirname(abspath(__file__))
settingsDir = join(rootDir, "settings")
sys.path.inser... | agpl-3.0 | Python | |
c200f2b15bab3518c60569bb9781c1ecff3fa50f | Add aio ble example. | openmv/openmv,openmv/openmv,kwagyeman/openmv,kwagyeman/openmv,iabdalkader/openmv,kwagyeman/openmv,iabdalkader/openmv,openmv/openmv,openmv/openmv,iabdalkader/openmv,iabdalkader/openmv,kwagyeman/openmv | scripts/examples/Arduino/Nano-RP2040/02-Bluetooth/temp_sensor_aioble.py | scripts/examples/Arduino/Nano-RP2040/02-Bluetooth/temp_sensor_aioble.py | import sys
sys.path.append("")
from micropython import const
import uasyncio as asyncio
import aioble
import bluetooth
import random
import struct
# org.bluetooth.service.environmental_sensing
_ENV_SENSE_UUID = bluetooth.UUID(0x181A)
# org.bluetooth.characteristic.temperature
_ENV_SENSE_TEMP_UUID = bluetooth.UUID(... | mit | Python | |
5a01ab4a4730c916b6a0dcd65aba248444db4802 | add missing compiler.py | PolyJIT/benchbuild,PolyJIT/benchbuild,PolyJIT/benchbuild,PolyJIT/benchbuild | driver/pprof/utils/compiler.py | driver/pprof/utils/compiler.py | from pprof.settings import config
from plumbum import local
from os import path
def lt_clang(flags_to_hide):
"""Return a clang that hides :flags_to_hide: from reordering of libtool.
This will generate a wrapper script in :p:'s builddir and return a path
to it.
:flags_to_hide: the flags libtool is no... | mit | Python | |
a49adce8b7822d972bfef5046d69366a4b26e0bb | Print sequence of bytes that comprise the class file | justinccdev/jjvm | jjvm.py | jjvm.py | #!/usr/bin/python
import argparse
import sys
class MyParser(argparse.ArgumentParser):
def error(self, message):
sys.stderr.write('error: %s\n' % message)
self.print_help()
sys.exit(2)
parser = MyParser('Run bytecode in jjvm')
parser.add_argument('path', help='path to class')
args = parser... | apache-2.0 | Python | |
737bc180f038824fbb2996d1ae50db1d4cf640b6 | add data migration for language contactfields | tsotetsi/textily-web,reyrodrigues/EU-SMS,Thapelo-Tsotetsi/rapidpro,tsotetsi/textily-web,ewheeler/rapidpro,pulilab/rapidpro,reyrodrigues/EU-SMS,praekelt/rapidpro,praekelt/rapidpro,pulilab/rapidpro,praekelt/rapidpro,Thapelo-Tsotetsi/rapidpro,harrissoerja/rapidpro,pulilab/rapidpro,praekelt/rapidpro,harrissoerja/rapidpro,p... | temba/contacts/migrations/0018_auto_20150727_0727.py | temba/contacts/migrations/0018_auto_20150727_0727.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def rename_language_contactfields(apps, schema_editor):
ContactField = apps.get_model("contacts", "ContactField")
for contactfield in ContactField.objects.filter(label__iexact='language'):
contact... | agpl-3.0 | Python | |
a1ddea1d98e9f349da82a706ec5cd6a6f6b74e92 | Add tool to count the verification tasks. | delcypher/fp-bench,delcypher/fp-bench,delcypher/fp-bench | svcb/tools/correctness-count.py | svcb/tools/correctness-count.py | #!/usr/bin/env python
# Copyright (c) 2016, Daniel Liew
# This file is covered by the license in LICENSE-SVCB.txt
"""
Traverse a directory looking for benchmarks
and group them by expected correctness
"""
from load_svcb import add_svcb_to_module_search_path
add_svcb_to_module_search_path()
import svcb.schema
import svc... | bsd-3-clause | Python | |
d54ea67f0d99827e30e008c12e42aa4c6f01e775 | Create final_exam.py | gaurav61/MIT6.00x | final_exam.py | final_exam.py | # PROBLEM 1 :
def dict_invert(d):
d2=dict()
for i in d:
d2.setdefault(d[i],[]).append(i)
for i in d2:
d2[i].sort()
return d2
# PROBLEM 2 part 1:
def getSublists(L, n):
ans=[]
for i in range(0,len(L)-n+1):
lt=[]
for j in range(i,i+n):
a=L[j]
... | mit | Python | |
5c9eab76072dc9acc92eb6a228cd4c0f631707c0 | rename 'squezeenet' to 'firemodule' | AlexandruBurlacu/keras_squeezenet,AlexandruBurlacu/keras_squeezenet | firemodule.py | firemodule.py | from keras.models import Model
from keras.layers import (Input, Dense, Convolution2D,
MaxPooling2D, Dropout, BatchNormalization,
Flatten, merge, Activation)
from keras.utils import np_utils
import numpy as np
import theano as tn
import multiprocessing as mp
tn.confi... | mit | Python | |
2f109f8991c73639db3140ba65bc05001b2b5e26 | add memeXml2bam.py | evolu-tion/GenomeManagement | memeXml2bam.py | memeXml2bam.py | #!/usr/bin/python3
"""
Copyright (c) 2016 King Mongkut's University technology Thonburi
Author: Nattawet Sriwichai
Contact: nattawet.sri@mail.kmutt.ac.th
Version: 1.0
License: MIT License
The MIT License
Copyright (c) 2016 King Mongkut's University technology Thonburi
Permission is hereby granted, fre... | mit | Python | |
0c4d113b7379ac4eea6a51f1c510881095caf9e8 | Add simple script for generating session keys | frenche/mod_auth_gssapi,frenche/mod_auth_gssapi,frenche/mod_auth_gssapi,frenche/mod_auth_gssapi | contrib/session_generator.py | contrib/session_generator.py | #!/usr/bin/env python
# Works with both python2 and python3; please preserve this property
# Copyright (C) 2016 mod_auth_gssapi contributors - See COPYING for (C) terms
# Simple script to generate GssapiSessionKey values
import base64
import os
bits = base64.b64encode(os.urandom(32))
print("GssapiSessionKey key:" +... | mit | Python | |
03793aada69d78b2e771302b8299c369938d27d1 | Create __init__.py | stkyle/serengeti,stkyle/serengeti | serengeti/__init__.py | serengeti/__init__.py | #!/usr/bin/env python
"""
__author__ = "Steve Kyle"
__license__ = "GPL"
__version__ = "1"
__maintainer__ = "Steve Kyle"
__email__ = " "
__status__ = "Development"
"""
import sys
import os
| mit | Python | |
f3f9db16032bbf6651611c4943c240ed2e777a08 | Create flask_app2.py | mechanicalgirl/young-coders-tutorial,bradmontgomery/young-coders-tutorial,bradmontgomery/young-coders-tutorial,mechanicalgirl/young-coders-tutorial | 2016/Intermediate/flask/flask_app2.py | 2016/Intermediate/flask/flask_app2.py | from flask import Flask, redirect, render_template, request, url_for
app = Flask(__name__)
app.config["DEBUG"] = True
comments = []
@app.route('/', methods=["GET", "POST"])
def index():
if request.method == "GET":
return render_template("main_page.html", comments=comments)
comments.append(request.fo... | mit | Python | |
050981e3a100894053fec076d6a3f58ad8d3a868 | add solution for Flatten Binary Tree to Linked List | zhyu/leetcode,zhyu/leetcode | src/flattenBinaryTreeToLinkedList.py | src/flattenBinaryTreeToLinkedList.py | # Definition for a binary tree node
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
# @param root, a tree node
# @return nothing, do it in place
def flatten(self, root):
self.connect(root)
def conne... | mit | Python | |
a06c4669781a8352cd7bd9f79f5e0ce348dbee3b | Add gibbs data gen | agnusmaximus/cyclades,agnusmaximus/cyclades,agnusmaximus/cyclades,agnusmaximus/cyclades | data/gibbs/generate_2d_lattice_graph.py | data/gibbs/generate_2d_lattice_graph.py | from __future__ import print_function
import sys
from math import sqrt
N = int(sys.argv[1])
out_fname = sys.argv[2]
f_out = open(out_fname, "w")
if int(sqrt(N)) ** 2 != N:
print("Error: N must be a square.")
sys.exit(0)
n = int(sqrt(N))
m = {}
for i in range(n):
for j in range(n):
index = i * n +... | apache-2.0 | Python | |
deb5db8f38b86b03ee55d5e7b68839f44b398358 | Add initial implementation | pvtodorov/indra,sorgerlab/indra,johnbachman/belpy,sorgerlab/belpy,johnbachman/belpy,bgyori/indra,bgyori/indra,johnbachman/indra,pvtodorov/indra,jmuhlich/indra,sorgerlab/indra,sorgerlab/belpy,sorgerlab/belpy,bgyori/indra,jmuhlich/indra,johnbachman/belpy,johnbachman/indra,jmuhlich/indra,pvtodorov/indra,johnbachman/indra,... | indra/cx_assembler.py | indra/cx_assembler.py | import json
import itertools
from indra.statements import *
class CxAssembler():
# http://www.ndexbio.org/data-model/
def __init__(self):
self.statements = []
self.existing_nodes = []
self.existing_edges = []
self.cx = {'nodes': [], 'edges': [],
'nodeAttrib... | bsd-2-clause | Python | |
7e0f1552ebdadb8f2023167afcd557bdc09b06f9 | Add plotting script for analyzing velocity based position controller | jhu-asco/aerial_autonomy,jhu-asco/aerial_autonomy,jhu-asco/aerial_autonomy,jhu-asco/aerial_autonomy,jhu-asco/aerial_autonomy,jhu-asco/aerial_autonomy | scripts/analysis/plot_velocity_based_position_controller_data.py | scripts/analysis/plot_velocity_based_position_controller_data.py | import numpy as np
import matplotlib.pyplot as plt
import sys
if sys.argc < 2:
print "Usage ./plot_velocity_based_position_controller.py [File_name]"
sys.exit(-1)
data = np.genfromtxt(sys.argv[-1], delimiter=',')
# 0 for x, 1 for y 2 for z and 3 for yaw
plot_axis = 3;
ts = (data[:,0] - data[0, 0])/1e9
plt.fi... | mpl-2.0 | Python | |
12044cc9cc0b58baa2e922fa5c40832cbb912833 | add hash.py | FreeJournal/freejournal,FreeJournal/freejournal,FreeJournal/freejournal | models/hash.py | models/hash.py | from sqlalchemy import Column, ForeignKey, Integer, String
from models import DecBase
class Hash(DecBase):
""" A document represents a single document shared to the network.
Documents are indexed by tuples contained in their respective collections.
Documents are stored and retreived from the Freen... | mit | Python | |
2a9d8d455d69cf32440af79b734b493d2c4eb500 | add grabframe | nvoehsen/pi-smart-meter | code/grabframe.py | code/grabframe.py | import cv2
import sys
import numpy as np
from datetime import datetime, date, time
# Usage grabframe.py DIR [VIDFILENAME]
# DIR: target directory for image
# VIDFILENAME: optional video file name
# The red mark is recognized by a color between these values
lower_red = np.array([0,160,50])
upper_red = np.array([60,25... | mit | Python | |
90d24daf144339cf84be94883ac41dd5d4429cc6 | implement Deck | Nayed/war | Deck.py | Deck.py | from Card import Card
class Deck:
def __init__(self):
self.cards = []
for val in range(2, 15):
for col in range(4):
self.cards.append(Card(val, col))
def __str__(self):
game_cards = ""
for card in self.cards:
if game_cards == "":
... | mit | Python | |
181991f45408a085f1e02a95cb2716b3aee15417 | Create Game.py | petehopkins/Untitled-CSET1100-Project | Game.py | Game.py | #Game class
# The main class which will provide the framework for the rest of the
# game objects to run in.
# Includes the main event loop, clock, window settings, etc.
# Requires pygame
import pygame
class Game():
name = "Baller: Defeat the oppressive war machine of the evil Quadratic invaders!"
stageWidth ... | mit | Python | |
035a2a720ba38bf9f56aa0332f083bab0c7534cb | Add failing tests for issue #1130. | techtonik/pip,xavfernandez/pip,zvezdan/pip,RonnyPfannschmidt/pip,RonnyPfannschmidt/pip,pfmoore/pip,sbidoul/pip,pfmoore/pip,rouge8/pip,rouge8/pip,pradyunsg/pip,xavfernandez/pip,pypa/pip,zvezdan/pip,zvezdan/pip,pypa/pip,techtonik/pip,techtonik/pip,rouge8/pip,pradyunsg/pip,xavfernandez/pip,sbidoul/pip,RonnyPfannschmidt/pi... | tests/functional/test_vcs.py | tests/functional/test_vcs.py | import os
from pip._internal.utils.temp_dir import TempDirectory
from pip._internal.vcs.git import Git
def test_git_dir_ignored():
"""
Test that a GIT_DIR environment variable is ignored.
"""
git = Git()
with TempDirectory() as temp:
temp_dir = temp.path
env = {'GIT_DIR': 'foo'}
... | mit | Python | |
9c4516aacd0600b1e0b785e79d8d1da9b0a86e4a | test tl.utils on tutorial_mnist_simple.py | zsdonghao/tensorlayer,zsdonghao/tensorlayer | examples/basic_tutorials/tutorial_mnist_simple.py | examples/basic_tutorials/tutorial_mnist_simple.py | #! /usr/bin/python
# -*- coding: utf-8 -*-
import tensorflow as tf
import tensorlayer as tl
import numpy as np
tl.logging.set_verbosity(tl.logging.DEBUG)
# prepare data
X_train, y_train, X_val, y_val, X_test, y_test = tl.files.load_mnist_dataset(shape=(-1, 784))
# define the network
ni = tl.layers.Input([None, 784]... | apache-2.0 | Python | |
3e1e26f2a16e25a35fdeb6b28e9971b54c8f0576 | add unit test | IntelRealSense/librealsense,IntelRealSense/librealsense,IntelRealSense/librealsense,IntelRealSense/librealsense,IntelRealSense/librealsense,IntelRealSense/librealsense,IntelRealSense/librealsense,IntelRealSense/librealsense,IntelRealSense/librealsense | unit-tests/live/options/test-set-gain-stress-test.py | unit-tests/live/options/test-set-gain-stress-test.py | # License: Apache 2.0. See LICENSE file in root directory.
# Copyright(c) 2021 Intel Corporation. All Rights Reserved.
# test:device D400*
import pyrealsense2 as rs
from rspy import test, log
import time
import datetime
# Test multiple set_pu commands checking that the set control event polling works as expected.
# ... | apache-2.0 | Python | |
26c413ca10550454c773829d4fa7fceafe2e9504 | Add basic test of data_checksums | pyne/simplesim | tests/test_data_checksums.py | tests/test_data_checksums.py | """ test data_checksums"""
from nose.tools import assert_equal
def test_data_checksums():
from pyne.data import data_checksums
assert_equal(len(data_checksums), 6)
assert_equal(data_checksums['/neutron/simple_xs'], '3d6e086977783dcdf07e5c6b0c2416be') | bsd-3-clause | Python | |
83c1f035a2bcaf61e781cead1fb3930230c22fa2 | Add new package: pciutils (#18795) | LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack | var/spack/repos/builtin/packages/pciutils/package.py | var/spack/repos/builtin/packages/pciutils/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 Pciutils(MakefilePackage):
"""This package contains the PCI Utilities."""
homepage = ... | lgpl-2.1 | Python | |
50a2690ce13388f3e5b13192cf09f757ed6389a1 | Add new package:py-json5 (#16273) | iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack | var/spack/repos/builtin/packages/py-json5/package.py | var/spack/repos/builtin/packages/py-json5/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 PyJson5(PythonPackage):
"""The JSON5 Data Interchange Format (JSON5) is a superset of JSON... | lgpl-2.1 | Python | |
a3f76740e7e4fac0bde7245502df8c5b77177f51 | add new package (#25237) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/xwidgets/package.py | var/spack/repos/builtin/packages/xwidgets/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 *
class Xwidgets(CMakePackage):
"""A C++ backend for Jupyter interactive widgets"""
homepage ... | lgpl-2.1 | Python | |
467566fdc1a12ba04af3b2a975ecc7b7fa61b224 | add init | jean/ZopeSkel | zopeskel/templates/basic_zope/+namespace_package+/+package+/__init__.py | zopeskel/templates/basic_zope/+namespace_package+/+package+/__init__.py | #
| mit | Python | |
bc2d5b19e0611fb5b484011403d21d9069837e17 | add simplified semaphore implementation | abn/python-cafe-consul | cafe/consul/semaphore.py | cafe/consul/semaphore.py | from twisted.internet import defer
from cafe.consul.kv import KVData
from cafe.logging import LoggedObject
class Semaphore(LoggedObject):
"""
A simplified semaphore implementation.
"""
def __init__(self, agent, prefix=None, limit=3, cardinality=None):
self.agent = agent
""":type: caf... | apache-2.0 | Python | |
943b8b93b0daa8b8e546a2710d92fa00c08a40b2 | add config file | jackylee0424/shybot,jackylee0424/shybot,jackylee0424/shybot | p2p/config_.py | p2p/config_.py | import landerdb
import socket
import random
try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("google.com", 80))
local_ip = s.getsockname()[0]
s.close()
except:
local_ip = "127.0.0.1"
label = "peer%d" % int(random.random()*100)
sleep_time = 1
# master node needs to be a relay
... | mit | Python | |
4eb18bb737cd878fb684d7ce4a0718ff88a1238d | Add a script to installer/tools to dump a shortcut's property bag. | ltilve/ChromiumGStreamerBackend,CapOM/ChromiumGStreamerBackend,CapOM/ChromiumGStreamerBackend,ltilve/ChromiumGStreamerBackend,CapOM/ChromiumGStreamerBackend,CapOM/ChromiumGStreamerBackend,ltilve/ChromiumGStreamerBackend,ltilve/ChromiumGStreamerBackend,CapOM/ChromiumGStreamerBackend,CapOM/ChromiumGStreamerBackend,CapOM/... | chrome/installer/tools/shortcut_properties.py | chrome/installer/tools/shortcut_properties.py | # Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Dumps a Windows shortcut's property bag to stdout.
This is required to confirm correctness of properties that aren't readily
available in Windows UI.
"""... | bsd-3-clause | Python | |
7359fe1edcd357efc28af6ca58ba991fa4e3144c | Add a script to run the W3C test suite (for tests that have a reference.) | marclaporte/WeasyPrint,andrewleech/WeasyPrint,prepare/TestWeasyPrint,prepare/TestWeasyPrint,Kozea/WeasyPrint,andrewleech/WeasyPrint,jasco/WeasyPrint,marclaporte/WeasyPrint,jasco/WeasyPrint,Kozea/WeasyPrint | weasy/tests/w3_test_suite.py | weasy/tests/w3_test_suite.py | # coding: utf8
# WeasyPrint converts web documents (HTML, CSS, ...) to PDF.
# Copyright (C) 2011 Simon Sapin
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of t... | bsd-3-clause | Python | |
6973d59155ad6540b2d7d73efb596e5792056770 | add a precess_results.py | xumiao/pymonk,xumiao/pymonk,xumiao/pymonk,xumiao/pymonk | experiments/precess_results.py | experiments/precess_results.py | # -*- coding: utf-8 -*-
"""
Created on Tue Jul 08 15:04:24 2014
@author: xumiao
"""
import pymongo as pm
from kafka.client import KafkaClient
from kafka.producer import UserProducer
import simplejson
import logging
from monk.math.flexible_vector import FlexibleVector
from random import sample
import pickle
import num... | mit | Python | |
05094a13d698305c959b2252a9a1cb9ea42e6e03 | Add config tests | christabor/flask_extras,christabor/jinja2_template_pack,christabor/flask_extras,christabor/jinja2_template_pack | filters/tests/config_test.py | filters/tests/config_test.py | from __future__ import absolute_import
import unittest
from flask import Flask
from .. import config
app = Flask('__config_test')
class GetFuncsTest(unittest.TestCase):
def test_get_module_funcs(self):
"""Test the return value."""
self.assertIsInstance(config._get_funcs('__main__'), dict)
cl... | mit | Python | |
26f631024a871c091274877b3f7d8fa12e14afcb | implement file check for CI jobs | morgenst/PyAnalysisTools,morgenst/PyAnalysisTools,morgenst/PyAnalysisTools | run_scripts/run_file_check.py | run_scripts/run_file_check.py | #!/usr/bin/env python
import unittest
from PyAnalysisTools.base import get_default_argparser, default_init
from PyAnalysisTools.base.FileHandle import FileHandle as fh
def create_test_case(_, input_fn, reference_fn):
class FileChecker(unittest.TestCase):
"""
Class to compare root file (main purpo... | mit | Python | |
ff9d5ccbc1e296faba9e0382864a54e7f6b40983 | Create 0120_song_feeling.py | boisvert42/npr-puzzle-python | 2019/0120_song_feeling.py | 2019/0120_song_feeling.py | """
NPR 2019-01-20
https://www.npr.org/2019/01/20/686968039/sunday-puzzle-youre-halfway-there
This challenge comes from listener Steve Baggish of Arlington, Mass.
Take the name of a classic song that became the signature song of the artist who performed it.
It has two words; five letters in the first, three letters ... | cc0-1.0 | Python | |
da666e65499c7120cea6f9ac2e750932105b39ea | Remove unused import. | subutai/nupic,pulinagrawal/nupic,pap/nupic,alfonsokim/nupic,passiweinberger/nupic,pulinagrawal/nupic,blueburningcoder/nupic,wanghaven/nupic,ben-hopps/nupic,allanino/nupic,scottpurdy/nupic,mcanthony/nupic,go-bears/nupic,glorizen/nupic,elkingtonmcb/nupic,fergalbyrne/nupic,cogmission/nupic,eranchetz/nupic,allanino/nupic,a... | nupic/utils.py | nupic/utils.py | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2014, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2014, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | agpl-3.0 | Python |
4f78d79e54593094af714cb99cdb8732623e0e77 | Add WSGI script to record bandwidth/latency probes | OSGConnect/bandwidth-monitors,OSGConnect/bandwidth-monitors | web/record_network_test.wsgi | web/record_network_test.wsgi | #!/usr/bin/env python
from cgi import parse_qs, escape
import sys
import datetime
import elasticsearch
def get_db_client():
""" Instantiate DB client and pass connection back """
client = elasticsearch.Elasticsearch(host='student01.ci-connect.net')
return client
def insert_record(client = None, record ... | apache-2.0 | Python | |
235958ab26743b8ed78c9ccad440c64559260248 | Add generate_example.py | rstebbing/bspline-regression | generate_example.py | generate_example.py | # generate_example.py
# Imports
import argparse
import json
import numpy as np
import scipy.spatial
from uniform_bspline import Contour
# main
def main():
parser = argparse.ArgumentParser()
parser.add_argument('degree', type=int)
parser.add_argument('num_control_points', type=int)
pa... | mit | Python | |
5c7936979160f0c8ccea77bee74715aa6dcad107 | Add script to generate command summary | benwebber/craftctl,benwebber/craftctl,benwebber/craftctl | scripts/generate.py | scripts/generate.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
"""
from __future__ import print_function
import subprocess
import re
formatter = ' {}'.format
def get_help_page(page=None):
command = ['./dist/craftctl', 'help']
if page:
command.append(str(page))
return subprocess.check_output(command).str... | mit | Python | |
4017efe0bf610e1e74600493d5a8265eebff17c5 | Solve Code Fights minesweeper problem | HKuz/Test_Code | CodeFights/minesweeper.py | CodeFights/minesweeper.py | #!/usr/local/bin/python
# Code Fights Add Border Problem
def minesweeper(matrix):
num_mines = []
rows = len(matrix)
cols = len(matrix[0])
adj = [-1, 0, 1]
for r in range(rows):
curr_row = []
for c in range(cols):
curr_row.append(sum([matrix[r + i][c + j] for i in adj if... | mit | Python | |
80c01ac201962b9618c4843faca405cd3c2b1aca | Create __init__.py | dwkegu/garmentMatchingNet | data/__init__.py | data/__init__.py | apache-2.0 | Python | ||
1ba50843aabaff9cbcd22865f14f517125214101 | add ex10 | AisakaTiger/Learn-Python-The-Hard-Way,AisakaTiger/Learn-Python-The-Hard-Way | ex10.py | ex10.py | tabby_cat = "\tI'm tabbled in."
persian_cat = "I'm split\non a line."
backslash_cat = "I'm \\ a \\ cat."
fat_cat = """
I'll do a list:
\t* Cat food
\t* Fishies
\t* Catnip\n\t* Grass
"""
print tabby_cat
print persian_cat
print backslash_cat
print fat_cat
| mit | Python | |
4ed4baae070cd6be5164e03369aa28c75e7684f2 | Add loader for singleton apps | datamora/datamora,datamora/datamora | spec/bottling_specs/factory_specs/BottleSingletonAppLoader_specs.py | spec/bottling_specs/factory_specs/BottleSingletonAppLoader_specs.py | import fudge
from bottling.factory import BottleSingletonAppLoader
class describe_init:
def it_initializes_with_given_options(self):
ref = 'my_module:app'
kind = None
loader = BottleSingletonAppLoader(ref, kind)
assert loader.ref == ref
assert loader.kind == None... | mit | Python | |
5c6fd66ab8a0de6c69314270fa13b02a57ebba62 | add script to create a heatmap on gmaps using the portal data | sandrotosi/ingresstools | iitc2heatmap_gmplot.py | iitc2heatmap_gmplot.py | import json
import gmplot
j = json.load(file('portalData/49k_portalData.json'))
# portals in ingress are stored multplied by 10^6
points = [(x[1]['latE6']/10.0**6, x[1]['lngE6']/10.0**6) for x in j.items()]
# rough filter for portals inside the m25
p2 = [x for x in points if 51.443052 < x[0] < 51.611683 and -0.29170... | mit | Python | |
97c2011179881cc0ffb749d73fbc3ddbba5c4d61 | add explore script that will help to check out results | lpantano/seqcluster,lpantano/seqcluster,lpantano/seqcluster,lpantano/seqcluster,lpantano/seqcluster | seqcluster/explore_cluster.py | seqcluster/explore_cluster.py | #import sys
import os
#from os import listdir
#from os.path import isfile, join
import re
import logging
from libs.classes import sequence_unique
from libs.tools import parse_ma_file
logger = logging.getLogger('explore')
def explore(args):
"""Create mapping of sequences of two clusters
"""
logger.info("r... | mit | Python | |
dfe339f6bca63954cfa83961f09daa722e83db0c | add unit test for clustering simple experiment | RNAer/Calour | calour/tests/test_sorting.py | calour/tests/test_sorting.py | # ----------------------------------------------------------------------------
# Copyright (c) 2016--, Calour development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# -----------------------------------------------... | bsd-3-clause | Python | |
4b71b54d3a25417161d061f2638739cccadbe589 | Add cython compile util | MITRECND/multiscanner,mitre/multiscanner,awest1339/multiscanner,jmlong1027/multiscanner,mitre/multiscanner,awest1339/multiscanner,jmlong1027/multiscanner,awest1339/multiscanner,awest1339/multiscanner,jmlong1027/multiscanner,MITRECND/multiscanner,mitre/multiscanner,jmlong1027/multiscanner | utils/cython_compile_libs.py | utils/cython_compile_libs.py | #!/bin/env python
from __future__ import division, absolute_import, with_statement, print_function, unicode_literals
import os
import sys
import shutil
from pyximport.pyxbuild import pyx_to_dll
WD = os.path.dirname(os.path.dirname((os.path.abspath(__file__))))
LIBS = os.path.join(WD, 'libs')
# Adds the libs directory t... | mpl-2.0 | Python | |
fac907d2163e7a2c379eda5dec9b94deb3405492 | Rename performance script | anthony-tresontani/django-adaptors | performance.py | performance.py | from datetime import datetime
from adaptor.model import CsvModel
from adaptor.fields import *
class MyCSvModel(CsvModel):
name = CharField()
age = IntegerField()
length = FloatField()
class Meta:
delimiter = ";"
def test_performance():
before = datetime.now()
data = ['jojo; 12; 1.8']*... | bsd-3-clause | Python | |
f5f186431bab87323ac4b6f4e2517d85ba3e728d | Create pileupTools.py | teasdalm/pileupTools,teasdalm/pileupTools | pileupTools.py | pileupTools.py | """
The MIT License (MIT)
Copyright (c) 2016 Matthew Teasdale
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, me... | bsd-3-clause | Python | |
2af89742ffbf2582ef84f11905c4f425f806d189 | Add GDM implementation from netdisco | pkkid/python-plexapi,mjs7231/python-plexapi | plexapi/gdm.py | plexapi/gdm.py | """
Support for discovery using GDM (Good Day Mate), multicast protocol by Plex.
# Licensed Apache 2.0
# From https://github.com/home-assistant/netdisco/netdisco/gdm.py
Inspired by
hippojay's plexGDM:
https://github.com/hippojay/script.plexbmc.helper/resources/lib/plexgdm.py
iBaa's PlexConnect: https://github.c... | bsd-3-clause | Python | |
b8e59cec5058d1987763e10a81650db1cedef55f | Create solution.py | lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges | leetcode/easy/ransom_note/py/solution.py | leetcode/easy/ransom_note/py/solution.py | class Solution(object):
def canConstruct(self, ransomNote, magazine):
"""
:type ransomNote: str
:type magazine: str
:rtype: bool
"""
import collections
c1 = collections.Counter(ransomNote)
c2 = collections.Counter(magazine)
fo... | mit | Python | |
3f9472d8db88080626c36c686a355dfd0ed146da | Add support for Ravelry | foauth/foauth.org,foauth/foauth.org,foauth/foauth.org,foauth/oauth-proxy | services/ravelry.py | services/ravelry.py | import foauth.providers
class Ravelry(foauth.providers.OAuth1):
# General info about the provider
provider_url = 'http://www.ravelry.com/'
docs_url = 'http://www.ravelry.com/groups/ravelry-api/pages/API-Documentation'
category = 'Crafts'
# URLs to interact with the API
request_token_url = 'ht... | bsd-3-clause | Python | |
3221d85fb3b28def4cb65f23f92fca331660c8bc | Create pionscript2.py | jcoombes/computing-year-2 | pionscript2.py | pionscript2.py | """
Unit test to ensure pions are created with the right distribution (exponential)
Nothing decays yet.
Source of /graphics/generating_pions.png
"""
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import pion
import numpy as np
fig = plt.figure()
ax = fig.add_subplot(111)
ilist = []
for ii i... | unlicense | Python | |
8aa7c345a08229728c16efa75c6f30f01948b08c | add tasks for fixing most of the location data | p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles | studygroups/management/commands/fix_learning_circle_locations.py | studygroups/management/commands/fix_learning_circle_locations.py | from django.core.management.base import BaseCommand, CommandError
from cities.google import google_places_api
from cities import data
from studygroups.models import StudyGroup
import requests
keys = ["place_id", "city", "region", "country", "country_en", "latitude", "longitude"]
data_fixes = {
"Chicago, Illinois... | mit | Python | |
9a4d56b68ebe617a289c30844933e444a759ba77 | Add WebKit blog | andre487/news487,andre487/news487,andre487/news487,andre487/news487 | collector/rss/webkit_blog.py | collector/rss/webkit_blog.py | import feedparser
import logging
from util import date, tags
SOURCE_NAME = 'WebkitBlog'
FEED_URL = 'https://webkit.org/feed/atom/'
log = logging.getLogger('app')
def parse():
feed = feedparser.parse(FEED_URL)
data = []
for entry in feed['entries']:
author_name = ''
text = ''
a... | mit | Python | |
0ed99d17c0d2ac457cada378ba370b3f23667af1 | Create Generate_Parentheses.py | UmassJin/Leetcode | Array/Generate_Parentheses.py | Array/Generate_Parentheses.py | Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.
For example, given n = 3, a solution set is:
"((()))", "(()())", "(())()", "()(())", "()()()"
class Solution:
# @param an integer
# @return a list of string
def generateParenthesis(self, n):
list... | mit | Python | |
b8707742e216b9ac2410b2e93ee6a468b5a3303a | add simple test for argparse Action | poldracklab/niworkflows,poldracklab/niworkflows,oesteban/niworkflows,oesteban/niworkflows,oesteban/niworkflows | niworkflows/utils/tests/test_spaces.py | niworkflows/utils/tests/test_spaces.py | import pytest
from ..spaces import Space, SpatialReferences, StoreSpacesAction
@pytest.fixture
def parser():
import argparse
pars = argparse.ArgumentParser()
pars.add_argument('--spaces', nargs='+', action=StoreSpacesAction,
help='user defined spaces')
return pars
@pytest.mar... | apache-2.0 | Python | |
9b3501a8f95015a5b3f20cbda488af0964a716b0 | Create EditDistance.py | Chasego/codirit,Chasego/codi,Chasego/codirit,cc13ny/algo,cc13ny/algo,cc13ny/Allin,Chasego/cod,Chasego/codi,cc13ny/Allin,Chasego/codirit,cc13ny/algo,Chasego/codirit,Chasego/codirit,cc13ny/Allin,cc13ny/algo,Chasego/cod,cc13ny/algo,cc13ny/Allin,Chasego/cod,Chasego/codi,cc13ny/Allin,Chasego/cod,Chasego/codi,Chasego/cod,Cha... | leetcode/072-Edit-Distance/EditDistance.py | leetcode/072-Edit-Distance/EditDistance.py | class Solution(object):
def minDistance(self, word1, word2):
"""
:type word1: str
:type word2: str
:rtype: int
"""
n1 = len(word1) + 1
n2 = len(word2) + 1
dp = [[0 for j in xrange(n2)] for i in xrange(n1)]
for j in xrange(1, n... | mit | Python | |
72042164ee1b31436697961e701d3ee49aa873f3 | Add Attribute classes | Echelon9/vulk,Echelon9/vulk,realitix/vulk,realitix/vulk | vulk/graphic/d3/attribute.py | vulk/graphic/d3/attribute.py | '''
This package contains material and attributes class
'''
# ----------
# Attributes
# ----------
class Attributes():
'''Attributes is the base class for all attributes container.
`Environment` and `Material` are attribute container
'''
def __init__(self, attributes=None):
'''
*Param... | apache-2.0 | Python | |
bdc0a39e0068ad0117bdffe19ef1ec32a51f7788 | Add tests for bytecode modification in frame evaluation | Elizaveta239/PyDev.Debugger,fabioz/PyDev.Debugger,Elizaveta239/PyDev.Debugger,Elizaveta239/PyDev.Debugger,Elizaveta239/PyDev.Debugger,fabioz/PyDev.Debugger,fabioz/PyDev.Debugger,Elizaveta239/PyDev.Debugger,fabioz/PyDev.Debugger,fabioz/PyDev.Debugger | tests_pydevd_python/test_bytecode_modification.py | tests_pydevd_python/test_bytecode_modification.py | import sys
import unittest
from io import StringIO
from _pydevd_frame_eval.pydevd_modify_bytecode import insert_code
TRACE_MESSAGE = "Trace called"
def tracing():
print(TRACE_MESSAGE)
def bar(a, b):
return a + b
class TestInsertCode(unittest.TestCase):
lines_separator = "---Line tested---"
def c... | epl-1.0 | Python | |
18140608b6cdcc5d773512ec82f77029c7acece9 | add problem 073 | smrmkt/project_euler | problem_073.py | problem_073.py | #!/usr/bin/env python
#-*-coding:utf-8-*-
'''
Consider the fraction, n/d, where n and d are positive integers.
If n<d and HCF(n,d)=1, it is called a reduced proper fraction.
If we list the set of reduced proper fractions for d ≤ 8 in ascending order of size, we get:
1/8, 1/7, 1/6, 1/5, 1/4, 2/7, 1/3, 3/8, 2/5, 3/7... | mit | Python | |
5496ccfc164a235521d2b6412b836c3ad84eebc1 | Add database revision which adds `stores_managers` table | beni55/overholt,mattupstate/overholt,RohithKP/overholt,beni55/overholt,jstacoder/overholt,alexmerser/overholt,jstacoder/overholt,bbuneci/overholt,jstacoder/overholt,qpxu007/overholt,mattupstate/overholt,qpxu007/overholt,qpxu007/overholt,alexmerser/overholt,RohithKP/overholt,jamesblunt/overholt,manhtuhtk/overholt,Rohith... | alembic/versions/4fe474604dbb_add_stores_managers_.py | alembic/versions/4fe474604dbb_add_stores_managers_.py | """Add `stores_managers` table
Revision ID: 4fe474604dbb
Revises: 5a0e003fafb2
Create Date: 2013-06-28 22:18:42.292040
"""
# revision identifiers, used by Alembic.
revision = '4fe474604dbb'
down_revision = '5a0e003fafb2'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated... | mit | Python | |
edac41e64614d84c67ee2f409f897d870d4459cd | Write /vendors/products/<id> test | osu-cass/whats-fresh-api,iCHAIT/whats-fresh-api,osu-cass/whats-fresh-api,osu-cass/whats-fresh-api,iCHAIT/whats-fresh-api,iCHAIT/whats-fresh-api,osu-cass/whats-fresh-api,iCHAIT/whats-fresh-api | whats_fresh/whats_fresh_api/tests/views/test_vendors_products.py | whats_fresh/whats_fresh_api/tests/views/test_vendors_products.py | from django.test import TestCase
from django.test.client import Client
from django.core.urlresolvers import reverse
from whats_fresh_api.models import *
from django.contrib.gis.db import models
import json
class VendorsProductsTestCase(TestCase):
fixtures = ['whats_fresh_api/tests/testdata/test_fixtures.json']
... | apache-2.0 | Python | |
3b4d73a6ec4936a76a39ebb5c12f21e6c6f7366e | add problem 25 | smrmkt/project_euler | problem_025.py | problem_025.py | #!/usr/bin/env python
#-*-coding:utf-8-*-
'''
The Fibonacci sequence is defined by the recurrence relation:
Fn = Fn−1 + Fn−2, where F1 = 1 and F2 = 1.
Hence the first 12 terms will be:
F1 = 1
F2 = 1
F3 = 2
F4 = 3
F5 = 5
F6 = 8
F7 = 13
F8 = 21
F9 = 34
F10 = 55
F11 = 89
F12 = 144
The 12th term, F12, is the first term ... | mit | Python | |
213686f445188dcb40a87ca2750c4f2574b6d898 | Add progress bar | kedz/cuttsum,kedz/cuttsum,kedz/cuttsum,kedz/cuttsum | trec2014/python/cuttsum/misc.py | trec2014/python/cuttsum/misc.py | import sys
class ProgressBar:
def __init__(self, max_jobs):
self.max_jobs_ = max_jobs
self.n_job_ = 0
self.term_width_ = 70
self.bin_size_ = max_jobs / float(self.term_width_)
def update(self):
self.n_job_ += 1
if self.n_job_ == self.max_jobs_:
sys.st... | apache-2.0 | Python | |
e099b6a8d08dd5a371b64b5c73a744b4ee9c30b3 | Write parser for basic yaml strings | hackebrot/poyo | poyo/parser.py | poyo/parser.py | # -*- coding: utf-8 -*-
import re
from ._nodes import Root, Section, Simple
from .patterns import (
COMMENT, BLANK_LINE, SECTION, SIMPLE,
NULL, TRUE, FALSE, INT, FLOAT, STR
)
class _Parser(object):
def __init__(self, source):
self.pos = 0
self.source = source
self.max_pos = len(s... | mit | Python | |
cadde63fc953e8ffa5eca857367e3a747b203257 | add problem 047 | smrmkt/project_euler | problem_047.py | problem_047.py | #!/usr/bin/env python
#-*-coding:utf-8-*-
'''
'''
import math
import timeit
primes = [2, 3, 5, 7]
def prime_factorization(n):
ps = []
while True:
n, p = factorize(n)
if p == 1:
if n != 1:
ps.append(n)
return ps
ps.append(p)
def factorize(n... | mit | Python | |
b096b3aee871596a535b05266a63fe2655883e91 | Add script for comparing rankings | rnowling/asaph,rnowling/asaph,rnowling/aranyani | compare_rankings.py | compare_rankings.py | """
Copyright 2017 Ronald J. Nowling
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, softw... | apache-2.0 | Python | |
9bdbce01e2d69ff728c90751177f92a0359c3b2a | Add admin interface for the plots app | ankeshanand/benchmark,ankeshanand/benchmark,ankeshanand/benchmark,ankeshanand/benchmark | plots/admin.py | plots/admin.py | __author__ = 'ankesh'
from django.contrib import admin
from plots.models import BenchmarkLogs, EmailLogs, EmailVerificationLogs, MachineInfo, Md5Log, RtAverage, RtBldg391, RtM35, RtMoss, RtSphflake, RtStar
admin.site.register(BenchmarkLogs)
admin.site.register(MachineInfo)
| bsd-2-clause | Python | |
f550f9a006b1d4a258e9f8c613f3792578275418 | add git_pull cmd | Rj48/ircbot,Rouji/Yui | plugins/git.py | plugins/git.py | import subprocess
@yui.admin
@yui.threaded
@yui.command('git_pull')
def git_pull(argv):
"""Does a git pull on the working dir of the bot. Usage: git_pull [repo]"""
args = ['git', 'pull']
if len(argv) > 1:
args.append(argv[1])
proc = subprocess.Popen(args)
code = proc.wait()
if code ==... | mit | Python | |
09ddf323de41ea910075f03f1276c3d8f84bb5f6 | Add pydockerize.py | msabramo/pydockerize | pydockerize.py | pydockerize.py | #!/usr/bin/env python
import os
import subprocess
import sys
import click
@click.command()
@click.version_option()
@click.argument('requirements_file', type=click.Path(exists=True))
@click.pass_context
def pydockerize(ctx, requirements_file):
"""Create Docker images for Python apps"""
print('requirements_fi... | mit | Python | |
3ea9b9a01406aee77b9206ef72e8db2ff0837173 | Add new package: findbugs (#17825) | iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack | var/spack/repos/builtin/packages/findbugs/package.py | var/spack/repos/builtin/packages/findbugs/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 Findbugs(Package):
"""a program which uses static analysis to look for bugs in Java code.
... | lgpl-2.1 | Python | |
0f0e2c4397e71ec85ccbbdfed168f6d3775a72ee | add new package : logstash (#14164) | iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/logstash/package.py | var/spack/repos/builtin/packages/logstash/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 Logstash(Package):
"""
Logstash is part of the Elastic Stack along with Beats, Elastic... | lgpl-2.1 | Python | |
81c6991dd0ecbab937662506161344ed7eee4914 | Create waas_rest_api_key_v4_example.py | barracudanetworks/waf-automation,barracudanetworks/waf-automation,barracudanetworks/waf-automation,barracudanetworks/waf-automation,barracudanetworks/waf-automation | waf-as-a-service-api/waas_rest_api_key_v4_example.py | waf-as-a-service-api/waas_rest_api_key_v4_example.py |
import requests
import json
import sys
from urllib.parse import urljoin
API_BASE = "https://api.waas.barracudanetworks.com/v4/waasapi/"
def waas_api_get(token, path):
res = requests.get(urljoin(API_BASE, path), headers={"Content-Type": "application/json", "Authorization": f"Bearer {token}"})
res.raise_for_s... | mit | Python | |
d6e0a46775381162d302e6b165c44d194ba8a2cf | Add initial lib | thatch45/spawnsh | spawnsh/__init__.py | spawnsh/__init__.py | '''
An interface to cleanly communicate with a systemd-nspawn container
'''
# Import python libs
import time
# Import salt libs
import salt.utils.vt
class Spawn(object):
'''
Spawn and control a container
'''
def __init__(self, dir_, user, passwd):
self.dir = dir_
self.user = user
... | apache-2.0 | Python | |
adf33d9a540ff89f5488f017f93f44d0ef22445b | add add_campaign_draft.py code example (#251) | googleads/google-ads-python | examples/campaign_management/add_campaign_draft.py | examples/campaign_management/add_campaign_draft.py | #!/usr/bin/env python
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | apache-2.0 | Python | |
72af2309be2d14eab05c584f7b9520d6821254c1 | add a script to fit the HBT radii | chunshen1987/hadronic_afterburner_toolkit,chunshen1987/hadronic_afterburner_toolkit,chunshen1987/hadronic_afterburner_toolkit,chunshen1987/hadronic_afterburner_toolkit | ebe_scripts/fit_HBT_radii.py | ebe_scripts/fit_HBT_radii.py | #!/usr/bin/env python3
from os import path
import sys
from numpy import *
from scipy.optimize import curve_fit
import h5py
hbarc = 0.19733
eps = 1e-15
def gaussian_3d(q_arr, lambda_, R_out, R_side, R_long, R_os, R_ol):
""" the fit function is according to arXiv: 1403.4972v1 """
(q_out, q_side, q_long) = q_a... | mit | Python | |
f128723fe11506d780efd6f6105e15d5c1d30d80 | Add python test file | schmichael/gologd,schmichael/gologd | punish_logd.py | punish_logd.py | import errno
import os
import signal
import socket
import sys
import time
import traceback
RETRY_ERRORS = frozenset((
None, # socket.timeout().errno is None
errno.ENOENT,
errno.EPIPE,
errno.ECONNREFUSED,
errno.ECONNRESET,
))
def connect(url):
s = socket.socket(socket.AF_UNIX, socket.SOCK_SEQ... | bsd-3-clause | Python | |
8ca71942490e5aef83aa7fe4e53f1f8f76d7555c | add a command to force a key rolloer | crate-archive/crate-site,crateio/crate.pypi,crate-archive/crate-site | crate_project/apps/crate/management/commands/force_key_rollover.py | crate_project/apps/crate/management/commands/force_key_rollover.py | from django.core.management.base import BaseCommand
from pypi.tasks import pypi_key_rollover
class Command(BaseCommand):
def handle(self, *args, **options):
pypi_key_rollover.delay()
| bsd-2-clause | Python | |
b9b5973fe9a54db328d98e572dabf8dce71ed34f | Create raw_sniffer.py | razzor12/sniffer | raw_sniffer.py | raw_sniffer.py | import socket
import struct
s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_ICMP)
#s = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, socket.ntohs(3)) # Capture Ether
#s.bind(('', 0))
while True:
pacote = s.recvfrom(65565)
traduzido = struct.unpack('!BBHHHBBH4s4s', pacote[0][0:20])
... | mit | Python | |
096b6065f8454ff70b07dc45b9fc24619397ab8b | add sample code create node uncustomised | samuelchong/libcloud,apache/libcloud,samuelchong/libcloud,t-tran/libcloud,andrewsomething/libcloud,StackPointCloud/libcloud,pquentin/libcloud,vongazman/libcloud,mistio/libcloud,StackPointCloud/libcloud,mistio/libcloud,erjohnso/libcloud,illfelder/libcloud,apache/libcloud,andrewsomething/libcloud,Kami/libcloud,t-tran/lib... | docs/examples/compute/dimensiondata/Nodes_Create_mcp2_Uncustomised.py | docs/examples/compute/dimensiondata/Nodes_Create_mcp2_Uncustomised.py | from pprint import pprint
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
import libcloud.security
# Get dimension data driver
libcloud.security.VERIFY_SSL_CERT = True
cls = get_driver(Provider.DIMENSIONDATA)
driver = cls('myusername','mypassword', region='dd-au')
# Get l... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.