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
e69546bbead4b46a64aa027c314ac87677df8852
make sine wave generator in python
HyungJiny/soundBeacon,HyungJiny/soundBeacon
sinewaveGenerator.py
sinewaveGenerator.py
import numpy import pyaudio import math class ToneGenerator(object): def __init__(self, samplerate=44100, frames_per_buffer=4410): self.p = pyaudio.PyAudio() self.samplerate = samplerate self.frames_per_buffer = frames_per_buffer self.streamOpen = False def sinewave(self): if self.buffer_offset + self.fra...
apache-2.0
Python
6b68c1579b8e22616512b7aad81039e97d3b4f1f
Add a handler which rejects all extensions. Review URL: https://codereview.appspot.com/7015043
bpsinc-native/src_third_party_pywebsocket_src,bpsinc-native/src_third_party_pywebsocket_src,bpsinc-native/src_third_party_pywebsocket_src,bpsinc-native/src_third_party_pywebsocket_src
example/echo_noext_wsh.py
example/echo_noext_wsh.py
# Copyright 2013, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the f...
bsd-3-clause
Python
72c6fc2fdaf1d516a9692f6ccf8ac5b8a0c817fb
add new package (#24319)
LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack
var/spack/repos/builtin/packages/kineto/package.py
var/spack/repos/builtin/packages/kineto/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 Kineto(CMakePackage): """A CPU+GPU Profiling library that provides access to timeline trac...
lgpl-2.1
Python
c1bc1be2a75b62ea01d8c2e16ab46c379069c50f
Add NekCEM package to spack (#6509)
EmreAtes/spack,mfherbst/spack,matthiasdiener/spack,tmerrick1/spack,LLNL/spack,mfherbst/spack,matthiasdiener/spack,EmreAtes/spack,iulian787/spack,krafczyk/spack,LLNL/spack,krafczyk/spack,iulian787/spack,tmerrick1/spack,LLNL/spack,tmerrick1/spack,LLNL/spack,krafczyk/spack,mfherbst/spack,iulian787/spack,matthiasdiener/spa...
var/spack/repos/builtin/packages/nekcem/package.py
var/spack/repos/builtin/packages/nekcem/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
566845f934297a5df2759aced6937fe2b805bf07
Add example that saves data for stats
openego/dingo,openego/dingo
examples/example_stats.py
examples/example_stats.py
#!/usr/bin/env python3 """This is a simple example file for DINGO. __copyright__ = "Reiner Lemoine Institut, openego development group" __license__ = "GNU GPLv3" __author__ = "Jonathan Amme, Guido Pleßmann" """ import matplotlib.pyplot as plt import oemof.db as db import time # import objgraph from dingo.core impor...
agpl-3.0
Python
df8e3a2b6f7c8dbb0b93e06e204e802104aad70f
Add russian words for date_time
joke2k/faker,joke2k/faker,danhuss/faker,trtd/faker
faker/providers/date_time/ru_RU/__init__.py
faker/providers/date_time/ru_RU/__init__.py
# coding: utf-8 from __future__ import unicode_literals from .. import Provider as DateTimeProvider class Provider(DateTimeProvider): @classmethod def day_of_week(cls): day = cls.date('%w') DAY_NAMES = { "0": "Воскресенье", "1": "Понедельник", "2": "Вторни...
mit
Python
6d9b28f2ea07d61a856cf6fddf0bbe0b61e0bdb2
add example to show how to read mitmproxy dump files, refs #207
MatthewShao/mitmproxy,legendtang/mitmproxy,ddworken/mitmproxy,jpic/mitmproxy,elitest/mitmproxy,Endika/mitmproxy,ZeYt/mitmproxy,devasia1000/mitmproxy,claimsmall/mitmproxy,ujjwal96/mitmproxy,noikiy/mitmproxy,zlorb/mitmproxy,tekii/mitmproxy,bltb/mitmproxy,meizhoubao/mitmproxy,sethp-jive/mitmproxy,gzzhanghao/mitmproxy,meiz...
examples/read_dumpfile.py
examples/read_dumpfile.py
#!/usr/bin/env python # # Simple script showing how to read a mitmproxy dump file # from libmproxy import flow import json, sys with open("logfile", "rb") as f: freader = flow.FlowReader(f) try: for i in freader.stream(): print i.request.host json.dump(i._get_state(), sys.stdout...
mit
Python
dae35852804fa23009e745e7030ae072ca086b3f
Add ds_invert_hashtables.py
bowen0701/algorithms_data_structures
ds_invert_hashtables.py
ds_invert_hashtables.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function def invert_dictionaries(): pass def main(): pass if __name__ == '__main__': main()
bsd-2-clause
Python
0aeafdca943aa69408752941a565e3d3d0116182
add a new planetfedora app which aggregates planetfedora
Fale/fedora-packages,Fale/fedora-packages,fedora-infra/fedora-packages,fedora-infra/fedora-packages,fedora-infra/fedora-packages,Fale/fedora-packages,fedora-infra/fedora-packages
myfedora/apps/planetfedora.py
myfedora/apps/planetfedora.py
from tg import url from tw.api import Widget, JSLink from tw.jquery import jquery_js, jQuery from myfedora.lib.app_factory import AppFactory import feedparser ui_js = JSLink(link='/javascript/myfedora.ui.js') class PlanetFedoraBaseWidget(Widget): """ The base widget for the Fedora People view. """ params ...
agpl-3.0
Python
4bc41c2425aa46965e16ddbb149058ac37e24e87
Add the progress meter module of tqdm
xgfone/pycom,xgfone/xutils
xutils/tqdm.py
xutils/tqdm.py
"""Add a progress meter to your loops in a second. """ import sys import time __all__ = ['tqdm', 'trange'] def format_interval(t): mins, s = divmod(int(t), 60) h, m = divmod(mins, 60) if h: return '%d:%02d:%02d' % (h, m, s) else: return '%02d:%02d' % (m, s) def format_meter(n, tota...
mit
Python
4f1595301da88ee34471a7701a69f1441be069d4
Create lazycseqabs.py
IljaZakharov/benchexec,ultimate-pa/benchexec,dbeyer/benchexec,ultimate-pa/benchexec,sosy-lab/benchexec,ultimate-pa/benchexec,dbeyer/benchexec,martin-neuhaeusser/benchexec,martin-neuhaeusser/benchexec,martin-neuhaeusser/benchexec,ultimate-pa/benchexec,sosy-lab/benchexec,ultimate-pa/benchexec,ultimate-pa/benchexec,sosy-l...
benchexec/tools/lazycseqabs.py
benchexec/tools/lazycseqabs.py
""" BenchExec is a framework for reliable benchmarking. This file is part of BenchExec. Copyright (C) 2007-2015 Dirk Beyer 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 ...
apache-2.0
Python
91506438fb0def22370d7f90235bf36567bb5730
Create setup.py
scienceopen/findssh
setup.py
setup.py
#!/usr/bin/env python from setuptools import setup setup(name='findssh', version='0.1', description='find servers with open ports without nmap', long_description=long_description, author='Michael Hirsch', url='https://github.com/scienceopen/findssh', dependency_links = [], install_re...
mit
Python
c31e6f86bccd7ffa3c368fafab625fabad9ab676
Create TrackingAdafruit16CServoDriver.py
MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab
home/Mats/TrackingAdafruit16CServoDriver.py
home/Mats/TrackingAdafruit16CServoDriver.py
port = "COM4" xServoPin = 2 yServoPin = 3 mouthServoPin = 4 # Create the Tracker service to be able setup how it should connect before starting it tracker = Runtime.create("tracker","Tracking") sleep(1) servoX = tracker.getX() servoY = tracker.getY() # Create the Adafruit16CServoDriver service to be able setup how ...
apache-2.0
Python
a7cf36565ea710fe77c5cd3c049156b88ecb6643
Add setup for installation
RuiShu/tensorbayes
setup.py
setup.py
"""Setup file for tensorbayes For easy installation and uninstallation, do the following. INSTALL: python setup.py install --record files.txt UNINSTALL: cat files.txt | xargs rm -r Pip installation will be made available soon. """ from setuptools import setup, find_packages import os setup( name="tensorbayes", ...
mit
Python
ae4e880c60c4ee4db675f03a39dd55e738d78422
Add setup.py
henriquebastos/fixofx,Zavteq/fixofx
setup.py
setup.py
import setuptools setuptools.setup( name='fixofx', version='', description='', long_description='', author='', author_email='', url='', #packages=[], #install_requires=[], entry_points={ 'console_scripts': [ 'fixofx = fixofx', ] }, license='A...
apache-2.0
Python
aacfe9087d381c4245733c3439a773a4ce54e266
add setup.py
alexex/alebot
setup.py
setup.py
""" alebot ---------------- alebot is a super lean and highly modularized irc bot that lets you extend it in a python way, using classes and decorators. It supports both hooks and background tasks in an easy and fail-safe way. Links ````` * `source code <https://github.com/alexex/aleb...
mit
Python
458076444e41fd1ccbb167308ac95de79a87d7df
Add setup instruction
inabhi9/django-taxrates
setup.py
setup.py
''' django taxrates setup script ''' try: from setuptools import setup, find_packages except ImportError: from distutils.core import setup me = 'Abhinav Kotak' memail = 'in.abhi9@gmail.com' packages = ['taxrates.'] setup( name='django-taxrates', version='0.0.1', zip_safe=True, description='D...
mit
Python
93ccf0db369ff6115851051f1fbc7c88b75dc3d0
Add setup.py
arbylee/python-warrior
setup.py
setup.py
from setuptools import setup, find_packages setup( name='pythonwarrior', version='0.0.1', packages=find_packages(), scripts=['bin/pythonwarrior'], author="Richard Lee", author_email="rblee88@gmail.com", description=("Game written in Python for learning Python and AI - " "a...
mit
Python
578c0a708ea746f9cd4a3a9d179a4d409168f381
add basic setup
bfarr/kombine,stevertaylor/kombine
setup.py
setup.py
#!/usr/bin/env python from distutils.core import setup setup(name='kombine', version='1.0', description='An embarrassingly parallel, kernel-density-based ensemble sampler', author='Ben Farr', author_email='farr@uchicago.edu', url='https://github.com/bfarr/kombine', packages=['kombi...
mit
Python
f7d88e7df3a213be75fcb11bcde8a3ed77050a7c
add setup.py.
kaniini/elasticsearch-eventlet
setup.py
setup.py
from distutils.core import setup, Extension setup ( name='elasticsearch_eventlet', version='0', packages=['elasticsearch_eventlet'], description='elasticsearch library which uses eventlet primitives', author='William Pitcock', author_email='nenolod@dereferenced.org', url='http://kaniini.der...
isc
Python
1d15ddc816a34f09a33d0df1ca3cb74c0eb7e69f
add setup.py
byteweaver/django-skrill
setup.py
setup.py
import os from setuptools import setup, find_packages import skrill def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() setup( name='django-skrill', version=skrill.__version__, description='A reuseable Django application for integrating the Skrill (Moneybookers) payme...
bsd-3-clause
Python
ba38e891cabdc2107f96bb031b8a5348a1040245
add setup
xju2/HZZ_llvv_ws,xju2/HZZ_llvv_ws,xju2/HZZ_llvv_ws
setup.py
setup.py
from setuptools import setup setup(name='HZZ_llvv_ws', version='0.1', description='Script to make workspace', url='https://github.com/xju2/HZZ_llvv_ws', author='Xiangyang Ju', author_email='xiangyang.ju@gmail.com', license='MIT', packages=['HZZ_llvv_ws'], zip_safe=False ...
mit
Python
d420c3850df54a1ff1abbf22187597e5e5d60dba
Create Response.py
codefordc/ERDA
Response.py
Response.py
import csv # Open and read file data = open('fullEmergencyData.csv', "r") emer = csv.reader(data) emer.next() # Final Columns response_time = [] vehicle_type = [] city_quadrant = [] time_of_day = [] month = [] holiday = [] # Response Time for row in emer: time = row[4] time = time.split(":") if time[0] ...
bsd-3-clause
Python
7d3f33ab6a3e604fa6512e7e90437cdb83fe1de1
Set up challenge 32
HKuz/PythonChallenge
Challenges/chall_32.py
Challenges/chall_32.py
#!/usr/local/bin/python3 # Python Challenge - 32 # http://www.pythonchallenge.com/pc/rock/arecibo.html # Username: kohsamui; Password: thailand # Keyword: ''' Uses Anaconda environment with Pillow for image processing - Python 3.7, numpy, and Pillow (PIL) - Run `source activate imgPIL`, `python chall_32.py` ''...
mit
Python
9d20bd988004c2ae4ffa172b765ae24faf24e9fa
add a command to reset cron status
Ixxy-Open-Source/django-cron,radiosilence/django-cron,peterbe/django-cron
django_cron/management/commands/cron_reset.py
django_cron/management/commands/cron_reset.py
# # run the cron service (intended to be executed from a cron job) # # usage: manage.py cronjobs from django.core.management.base import NoArgsCommand from django_cron.models import Cron class Command(NoArgsCommand): help = "reset the django cron status" def handle_noargs(self, **options): print 'Dja...
mit
Python
d6cf9df23e8c9e3b6a8d261ea79dfe16cfa1dbb1
Add test for function re-definition
IntelLabs/numba,GaZ3ll3/numba,stuartarchibald/numba,pitrou/numba,seibert/numba,stefanseefeld/numba,ssarangi/numba,jriehl/numba,seibert/numba,gdementen/numba,pombredanne/numba,sklam/numba,stefanseefeld/numba,jriehl/numba,IntelLabs/numba,stefanseefeld/numba,pombredanne/numba,seibert/numba,stonebig/numba,GaZ3ll3/numba,skl...
numba/tests/test_redefine.py
numba/tests/test_redefine.py
from numba import * import unittest class TestRedefine(unittest.TestCase): def test_redefine(self): def foo(x): return x + 1 jfoo = jit(int32(int32))(foo) # Test original function self.assertTrue(jfoo(1), 2) jfoo = jit(int32(int32))(foo) # Test re-c...
bsd-2-clause
Python
a5b754fe9f0f8663438cb7c3cc3cadd6aebd5da6
Create Switch_Agent.py
MobileConvergenceLab/HA-SwitchedNetworks
src/Switch_Agent.py
src/Switch_Agent.py
import socket, os, threading, pickle def link_load(): os.system('bwm-ng -o csv -c 1 -T rate > bandwidth.log') f_load=open('bandwidth.log') link_load=[] line = f_load.readline() while line: link_load.append([line.split(';')[1], (line.split(';')[2], line.split(';')[3])]) line = f_load.readline() retur...
apache-2.0
Python
f38db7bc73b73ead28c755493003ec08e2b6f951
Create HTMLTitles.py
jankcat/python-scripts
HTMLTitles/HTMLTitles.py
HTMLTitles/HTMLTitles.py
#!/usr/bin/env python3 import csv import sys import os import getopt import requests def main(argv): print('Requires python-requests. Install with "pip install requests"') # get args inputfile = '' outputfile = '' helpstring = 'HTMLTitles.py -i <inputfile.csv> -o <outputfile.csv>\nInput file required\nOutput file...
mit
Python
1ed10633ae63a8780da68ba0175a49799fee0273
add multisite migration
scattermagic/django-wizard-builder,SexualHealthInnovations/callisto-core,project-callisto/callisto-core,SexualHealthInnovations/django-wizard-builder,SexualHealthInnovations/django-wizard-builder,project-callisto/callisto-core,scattermagic/django-wizard-builder,SexualHealthInnovations/callisto-core
wizard_builder/migrations/0003_multisite.py
wizard_builder/migrations/0003_multisite.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.3 on 2017-04-10 15:41 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion import django.db.models.manager import wizard_builder.models class Migration(migrations.Migration): dependencies = [ ...
agpl-3.0
Python
545aaec13a60e661d896559cabe0e21a5f60a8e1
Add tests for solving
adrianliaw/PyCuber
tests/test_basic_solve.py
tests/test_basic_solve.py
import pycuber as pc from pycuber.solver import CFOPSolver """These two tests only make sure no uncaught errors get raised. They do not test the validity of the solve. """ def test_for_basic_ability_to_solve(): c = pc.Cube() alg = pc.Formula() random_alg = alg.random() c(random_alg) solver = C...
mit
Python
0cde2319ded92be83d8b40d5463430d454a780bb
Create smallest-range.py
kamyu104/LeetCode,kamyu104/LeetCode,yiwen-luo/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,yiwen-luo/LeetCode,yiwen-luo/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCo...
Python/smallest-range.py
Python/smallest-range.py
# Time: O(nlogk) # Space: O(k) # You have k lists of sorted integers in ascending order. # Find the smallest range that includes at least one number from each of the k lists. # # We define the range [a,b] is smaller than range [c,d] if b-a < d-c or a < c if b-a == d-c. # # Example 1: # Input:[[4,10,15,24,26], [0,9,12...
mit
Python
6ef97bb1c031f9957ea0559937219a1fb9fac012
Split tile objects off into seperate files
chao-master/openTTDMapper
tiles.py
tiles.py
import struct,sys import traceback import lzma import StringIO import colorsys from openttdMap import * class Tile(object): def __init__(self,tHeight,gameMap): self.height = tHeight self.gameMap = gameMap self.owner = None @staticmethod def ofType(tType,tHeight,mapRef): ...
mit
Python
6fa6ee508a20f75bca8664660ef8aebf40c2a97f
add Trail
KingPixil/ice,KingPixil/ice
trail.py
trail.py
import math import colorsys import png import src.loader import src.seed import src.random # Configuration width = 1000 height = 1000 # Initialize print("\x1b[36mIce\x1b[0m Crafting Trail 💡") seedText = src.seed.generateSeed() data = [] for y in range(height): current = [] for x in range(width): cu...
mit
Python
5bd89a793fddf7ed58ff1bfe31f3bfe2e59ead87
Create pangram.py
ZorbaTheStrange/pangram
pangram.py
pangram.py
#! /usr/bin/python3 ''' panogram.py - this program recongizes pangrams. 2016.2.6 by zorba ''' import sys def pangram_check(sentence_or_word): ''' checks the user input to see if it is a pangram. ''' letters = set('abcdefghijklmnopqrstuvwxyz') if sentence_or_word.lower() == 'done': z ...
mit
Python
b44346490a5ec2394ddb18bdefe81e8282e8d073
add Properties() class
mozman/ezdxf,mozman/ezdxf,mozman/ezdxf,mozman/ezdxf,mozman/ezdxf
src/ezdxf/addons/drawing/properties.py
src/ezdxf/addons/drawing/properties.py
# Copyright (c) 2020, Manfred Moitzi # License: MIT License from typing import TYPE_CHECKING, Tuple if TYPE_CHECKING: from ezdxf.eztypes import DXFGraphic CONTINUOUS_PATTERN = (1.0,) class EntityContext: def resolve_color(self, entity: 'DXFGraphic'): raise NotImplementedError def resolve_linety...
mit
Python
0ac5cd3fb1711d03a2aeef598f1c9a60da9035e4
add bundestag_down
defgsus/sociopyth,defgsus/sociopyth,defgsus/sociopyth
bundestag_down/bundestag_down.py
bundestag_down/bundestag_down.py
# script to download all "Drucksachen" from the Deutscher Bundestag # dipbt.bundestag.de/doc/btd/01/000/0100001.pdf base_url = "http://dipbt.bundestag.de/doc/btd/" def get_name( period, docnum ): return base_url + '{:=02}'.format(period) + "/" + '{:=03}'.format(docnum/100) + "/" + '{:=02}'.format(period) + '{:=05...
lgpl-2.1
Python
25c36491343d0a3c9c2b18d4e568f589a9c73299
make a config file
nyu-dl/dl4mt-simul-trans,nyu-dl/dl4mt-simul-trans,nyu-dl/dl4mt-simul-trans,nyu-dl/dl4mt-simul-trans,nyu-dl/dl4mt-simul-trans
config.py
config.py
""" Configuration for Simultaneous Neural Machine Translation """ def pretrain_config(): pass
bsd-3-clause
Python
95445abd547d7107b41ed134659a33daad87dcc2
Create conway.py
mcfey/Conway-Life,afeyrer/Conway-Life,RDanilek/Conway-Life,sarahdunbar/Conway-Life,tiggerntatie/Conway-Life,APikielny/Conway-Life,HHS-IntroProgramming/Conway-Life,tiggerntatie/Conway-Life,mcfey/Conway-Life,afeyrer/Conway-Life,glenpassow/Conway-Life,glenpassow/Conway-Life,kingmayonaise/Conway-Life,HHStudent/Conway-Life,...
conway.py
conway.py
"""
mit
Python
7448b7d0188eeef2ed0311892d5b1d24549150b8
support module for cPickle
sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator
Lib/copy_reg.py
Lib/copy_reg.py
dispatch_table = {} safe_constructors = {} def pickle(ob_type, pickle_function, constructor_ob = None): dispatch_table[ob_type] = pickle_function if (constructor_ob is not None): constructor(constructor_ob) def constructor(object): safe_constructors[object] = 1 def pickle_complex(c): return ...
mit
Python
c59408e6c8b6d4b6a8cb1c642c87b5835dfb2a42
Create fourvectors.py
jcoombes/computing-year-2
fourvectors.py
fourvectors.py
# -*- coding: utf-8 -*- """ Implements relativistic four vectors. Note we assume natural units c = 1 here. """ from __future__ import division import numpy as np class FourVector(object): """ Represents a point in Minkowsky space. ct - float, time-like component. r - array, space-like component. ...
unlicense
Python
f3bb73edc5857905beab11553a6eee828f00f10e
Create raspi-alarm.py
furiousmonkey/raspi-socialalarmclock
raspi-alarm.py
raspi-alarm.py
#!/usr/local/bin/python2.7 ## raspi-alarm.py -- for waking up ## Created by furiousmonkey ## Last Updated 4-Oct-2014 import sched import time import os import RasPi.GPIO as GPIO from datetime import datetime, timedelta GPIO.setmode(GPIO.BOARD) GPIO.setup(12, GPIO.OUT) global alarm_hour, alarm_minute, alarm_mp3 par...
mit
Python
956d524a8694bb63532ac5f4a8121f57d75b7ad1
Add a test case for guessing the BuildDir associated with a subdirectory argument.
Distrotech/scons,Distrotech/scons,Distrotech/scons,Distrotech/scons,Distrotech/scons
test/BuildDir/guess-subdir.py
test/BuildDir/guess-subdir.py
#!/usr/bin/env python # # __COPYRIGHT__ # # 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, merge, publish, ...
mit
Python
51258975d763c9471859d635e6080c2ec02e8647
decrypt file
gpg/gpgme,gpg/gpgme,gpg/gpgme,gpg/gpgme,gpg/gpgme,gpg/gpgme,gpg/gpgme
lang/python/examples/howto/decrypt-file.py
lang/python/examples/howto/decrypt-file.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from __future__ import absolute_import, division, unicode_literals # Copyright (C) 2018 Ben McGinnes <ben@gnupg.org> # # This program is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free S...
lgpl-2.1
Python
654d2070dc25a288f680b5d93e5eb4662da403eb
Add the start of the UVA scraper.
mblayman/lcp,mblayman/lcp,mblayman/lcp
planner/scrapers/virginia.py
planner/scrapers/virginia.py
from lxml import etree from planner.scrapers.base import Scraper class UVAScraper(Scraper): """Scraper for the University of Virginia""" def scrape(self): with open('/home/matt/lcp/uva.html', 'r') as f: text = f.read() html = etree.HTML(text) # Filter to a closer div to...
bsd-2-clause
Python
d601d8229cd3c25b887f415830058ae4ac5f4399
Create automate.py
Babtsov/Python-Scripts
automate.py
automate.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import subprocess import os DEVNULL = open(os.devnull, 'w') def execute(command): output = subprocess.check_output(command, shell=True, stderr=DEVNULL) if outpu...
mit
Python
909d1c9471e0646e1e74f688a357139d34911bfe
Add script to regenerate projects using premake (#755)
munificent/wren,munificent/wren,munificent/wren,munificent/wren,munificent/wren,munificent/wren
util/generate_projects.py
util/generate_projects.py
#!/usr/bin/env python import sys from os import getenv, path from subprocess import PIPE, run PREMAKE_DIR = path.join(path.dirname(__file__), "../projects/premake") def has(prog): return run(["command", "-v", prog], stdout=PIPE, stderr=PIPE).returncode == 0 def run_premake(action, os): run([premake, actio...
mit
Python
f9fd80380f8143258596031ff89a05241e4e9805
Work in progress: Python code to construct an Octree grid from SPH particles
bluescarni/hyperion,hyperion-rt/hyperion,hyperion-rt/hyperion,hyperion-rt/hyperion,bluescarni/hyperion
hyperion/importers/sph.py
hyperion/importers/sph.py
import numpy as np def refine(xmin, xmax, ymin, ymax, zmin, zmax, px, py, pz): xmid = 0.5 * (xmin + xmax) ymid = 0.5 * (ymin + ymax) zmid = 0.5 * (zmin + zmax) if len(px) < 3: return [0], [(px, py, pz)], [(xmin, xmax, ymin, ymax, zmin, zmax)] b_all = [1] p_all = [([],[],[])] l_a...
bsd-2-clause
Python
004c1c33487691747123331b4169e355a054add5
Create rainbow.py
kajackdfw/python_rpi_sense_hat_demos
rainbow.py
rainbow.py
from sense_hat import SenseHat sense = SenseHat() r = [255,0,0] o = [255,127,0] y = [255,255,0] g = [0,255,0] b = [0,0,255] i = [75,0,130] v = [159,0,255] e = [0,0,0] image = [ e,e,e,e,e,e,e,e, e,e,e,r,r,e,e,e, e,r,r,o,o,r,r,e, r,o,o,y,y,o,o,r, o,y,y,g,g,y,y,o, y,g,g,b,b,g,g,y, b,b,b,i,i,b,b,b, b,i,i,v,v,i,i,b ] se...
cc0-1.0
Python
14d385abf0cf0548107447b693717e160de98abb
migrate to unarchived campaign flows
pulilab/rapidpro,pulilab/rapidpro,tsotetsi/textily-web,tsotetsi/textily-web,tsotetsi/textily-web,pulilab/rapidpro,pulilab/rapidpro,tsotetsi/textily-web,tsotetsi/textily-web,pulilab/rapidpro
temba/flows/migrations/0073_auto_20161019_0146.py
temba/flows/migrations/0073_auto_20161019_0146.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models def noop(apps, schema): pass def activate_campaign_flows(apps, schema): CampaignEvent = apps.get_model('campaigns', 'Campaign') # any flow that is archived referenced by an active event events ...
agpl-3.0
Python
ccdc9e81b12c0bf3fb950c126c38fc66e4e5b48d
Add tests for TempfileManager (#142)
ros-infrastructure/superflore,ros-infrastructure/superflore
tests/test_TempfileManager.py
tests/test_TempfileManager.py
# Copyright 2018 Open Source Robotics Foundation, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
apache-2.0
Python
5408203b09861833a4d973b1f3ffe037e6934c3c
Create Interface.py
RicoAntonioFelix/ATM-SIMULATOR
src/Interface.py
src/Interface.py
# Copyright 2014 Rico Antonio Felix # # 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 writin...
apache-2.0
Python
b139502a1965ba5cd7f0e96e886ed9bedb16f077
Add torchbench.py script for running benchmarks
iree-org/iree-torch,iree-org/iree-torch
torchdynamo_poc/torchbench.py
torchdynamo_poc/torchbench.py
# Copyright 2021 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 agreed to in writing, ...
apache-2.0
Python
27aacc7a8cef41e3e788addfbd56f05e802bebb3
update doc2vec gensim version
AppleFairy/machinelearning,AppleFairy/machinelearning
toy/doc2vec/doc2vec_gensim.py
toy/doc2vec/doc2vec_gensim.py
import gensim import os import collections import smart_open import random import logging import time """ Reference: Doc2Vec Tutorial on the Lee Dataset: https://github.com/RaRe-Technologies/gensim/blob/develop/docs/notebooks/doc2vec-lee.ipynb gensim doc2vec & IMDB sentiment dataset: https://github.c...
mit
Python
77f56d7e9eb080faaac46129618e203631c2cb5d
Implement channel mode +s
ElementalAlchemist/txircd,Heufneutje/txircd
txircd/modules/rfc/cmode_s.py
txircd/modules/rfc/cmode_s.py
from twisted.plugin import IPlugin from twisted.words.protocols import irc from txircd.module_interface import IMode, IModuleData, Mode, ModuleData from txircd.utils import ModeType from zope.interface import implements class SecretMode(ModuleData, Mode): implements(IPlugin, IModuleData, IMode) name = "Se...
bsd-3-clause
Python
09f910902a4ba68d1a7a33fdcafe41866eb4d42c
Add py-chalice (#19199)
LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack
var/spack/repos/builtin/packages/py-chalice/package.py
var/spack/repos/builtin/packages/py-chalice/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 PyChalice(PythonPackage): """Python Serverless Microframework for AWS.""" homepage = ...
lgpl-2.1
Python
5d78b32f2b33d26db421c4f53656da43c834ec26
Put local Docker setting into Jinja2 if block
ad-m/cookiecutter-django,hackebrot/cookiecutter-django,topwebmaster/cookiecutter-django,pydanny/cookiecutter-django,pydanny/cookiecutter-django,ryankanno/cookiecutter-django,Parbhat/cookiecutter-django-foundation,pydanny/cookiecutter-django,ddiazpinto/cookiecutter-django,trungdong/cookiecutter-django,luzfcb/cookiecutte...
{{cookiecutter.project_slug}}/config/settings/local.py
{{cookiecutter.project_slug}}/config/settings/local.py
# -*- coding: utf-8 -*- """ Local settings - Run in Debug mode {% if cookiecutter.use_mailhog == 'y' and cookiecutter.use_docker == 'y' %} - Use mailhog for emails {% else %} - Use console backend for emails {% endif %} - Add Django Debug Toolbar - Add django-extensions as app """ import socket import os from .base i...
# -*- coding: utf-8 -*- """ Local settings - Run in Debug mode {% if cookiecutter.use_mailhog == 'y' and cookiecutter.use_docker == 'y' %} - Use mailhog for emails {% else %} - Use console backend for emails {% endif %} - Add Django Debug Toolbar - Add django-extensions as app """ import socket import os from .base i...
bsd-3-clause
Python
633c1e9e519f61b4f522c2e5d52b9a50dffaa2e9
Add specific config file for uk_17
softwaresaved/international-survey
survey_creation/config/uk_17_config.py
survey_creation/config/uk_17_config.py
bsd-3-clause
Python
6907ca6e8b7a104c7af48a84f264078284019cc3
Add ping script
abrookins/siren
bin/ping.py
bin/ping.py
#!/usr/bin/env python import urllib2 # Ping the site every 10 minutes, to make sure Heroku doesn't spin it down. resp = urllib2.urlopen('http://pdxcrime.herokuapp.com') print resp.read()
mit
Python
dfc2bcb9f0418005279db95aa47840f53b59e0e7
add a test for reset (#326)
appium/python-client,appium/python-client
test/unit/webdriver/device/app_test.py
test/unit/webdriver/device/app_test.py
#!/usr/bin/env python # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software...
apache-2.0
Python
e3a631c90ee5538cba419e15b8071f5fd123d629
Add Astra package (#2800)
iulian787/spack,krafczyk/spack,LLNL/spack,lgarren/spack,EmreAtes/spack,tmerrick1/spack,LLNL/spack,mfherbst/spack,krafczyk/spack,lgarren/spack,krafczyk/spack,tmerrick1/spack,LLNL/spack,lgarren/spack,EmreAtes/spack,matthiasdiener/spack,skosukhin/spack,mfherbst/spack,EmreAtes/spack,iulian787/spack,tmerrick1/spack,skosukhi...
var/spack/repos/builtin/packages/astra/package.py
var/spack/repos/builtin/packages/astra/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
6ff7dde9a50270a4efa22c937e3a083a419ed514
Add package for ngmlr (#4618)
EmreAtes/spack,iulian787/spack,krafczyk/spack,tmerrick1/spack,TheTimmy/spack,EmreAtes/spack,lgarren/spack,matthiasdiener/spack,TheTimmy/spack,tmerrick1/spack,iulian787/spack,krafczyk/spack,EmreAtes/spack,skosukhin/spack,tmerrick1/spack,lgarren/spack,krafczyk/spack,iulian787/spack,skosukhin/spack,skosukhin/spack,lgarren...
var/spack/repos/builtin/packages/ngmlr/package.py
var/spack/repos/builtin/packages/ngmlr/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
7a8488327ba41275d4b569fc73da617140e64aea
Add a visitor to generate the github history link.
Legilibre/SedLex
sedlex/AddGitHubArticleLinkVisitor.py
sedlex/AddGitHubArticleLinkVisitor.py
# -*- coding: utf-8 -*- from AbstractVisitor import AbstractVisitor class AddGitHubArticleLinkVisitor(AbstractVisitor): def __init__(self, args): self.repo = args.github_repository self.law_id = None super(AddGitHubArticleLinkVisitor, self).__init__() def visit_law_reference_node(sel...
agpl-3.0
Python
6200630904db2452ecfb551d54974acfad978d17
Add server TLS context factory
illicitonion/synapse,illicitonion/synapse,howethomas/synapse,TribeMedia/synapse,iot-factory/synapse,matrix-org/synapse,illicitonion/synapse,iot-factory/synapse,iot-factory/synapse,iot-factory/synapse,rzr/synapse,illicitonion/synapse,TribeMedia/synapse,matrix-org/synapse,rzr/synapse,howethomas/synapse,rzr/synapse,howeth...
synapse/crypto/context_factory.py
synapse/crypto/context_factory.py
from twisted.internet import reactor, ssl from OpenSSL import SSL class ServerContextFactory(ssl.ContextFactory): """Factory for PyOpenSSL SSL contexts that are used to handle incoming connections and to make connections to remote servers.""" def __init__(self, config): self._context = SSL.Contex...
apache-2.0
Python
c7daf4548580b0de2aa9ec02cffc17ef3e796b28
Add a silly test for vertex.q2qclient.enregister.
insequent/vertex,twisted/vertex,glyph/vertex,insequent/vertex,twisted/vertex
vertex/test/test_q2qclient.py
vertex/test/test_q2qclient.py
# Copyright 2005-2008 Divmod, Inc. See LICENSE file for details # -*- vertex.test.test_q2q.UDPConnection -*- """ Tests for L{vertex.q2qclient}. """ from twisted.trial import unittest from twisted.internet.protocol import Factory from twisted.protocols.amp import Command, AMP, AmpBox from vertex import q2q, q2qclie...
mit
Python
af70046e9876e859aea4f76adc8b07f70ccd53a1
add HQAccountingSetupError exception to accounting models
qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,gmimano/commcaretest,SEL-Columbia/commcare-hq,dimagi/commcare-hq,SEL-Columbia/commcare-hq,dimagi/commcare-hq,gmimano/commcaretest,puttarajubr/commcare-hq,dim...
corehq/apps/accounting/models.py
corehq/apps/accounting/models.py
class HQAccountingSetupError(Exception): pass
bsd-3-clause
Python
b447470e8f4e8826d87f712c6726bf8855216330
Add migration to add photo blocks type
Ilhasoft/ureport,rapidpro/ureport,rapidpro/ureport,Ilhasoft/ureport,Ilhasoft/ureport,rapidpro/ureport,Ilhasoft/ureport,rapidpro/ureport
ureport/jobs/migrations/0005_add_photos.py
ureport/jobs/migrations/0005_add_photos.py
# Generated by Django 2.2.5 on 2019-09-26 23:07 from django.db import migrations def generate_job_block_types(apps, schema_editor): User = apps.get_model("auth", "User") root = User.objects.filter(username="root").first() if not root: root = User.objects.create(username="root") DashBlockTyp...
agpl-3.0
Python
9618f20a2252cdaa9a888536d7b8512e051a82a5
Add unfinished mmstats reader
schmichael/mmstats,schmichael/mmstats,schmichael/mmstats,schmichael/mmstats
slurpstats.py
slurpstats.py
#!/usr/bin/env python import os import sys import tempfile import traceback def err(msg): sys.stderr.write('%s\n' % msg) def slurp_stats(contents): import json print json.dumps(contents) def main(): searchdir = tempfile.gettempdir() for fn in os.listdir(searchdir): if fn.startswith('mm...
bsd-3-clause
Python
94139c926af6f310e6faa67d796ce3b197ee965b
Add merge migration
mfraezz/osf.io,CenterForOpenScience/osf.io,HalcyonChimera/osf.io,adlius/osf.io,Johnetordoff/osf.io,adlius/osf.io,aaxelb/osf.io,CenterForOpenScience/osf.io,HalcyonChimera/osf.io,cslzchen/osf.io,mattclark/osf.io,baylee-d/osf.io,saradbowman/osf.io,cslzchen/osf.io,HalcyonChimera/osf.io,mfraezz/osf.io,pattisdr/osf.io,cslzch...
osf/migrations/0133_merge_20180921_0025.py
osf/migrations/0133_merge_20180921_0025.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.13 on 2018-09-21 00:25 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('osf', '0132_merge_20180914_2001'), ('osf', '0129_merge_20180831_1412'), ] operatio...
apache-2.0
Python
7ffa87fc6595b53388df66dd25656753ec861aae
add select example
ubolonton/twisted-csp
select.py
select.py
import csp def go(): chan1 = csp.Channel() chan2 = csp.Channel() quit = csp.Channel() @csp.process def one(): yield csp.wait(0.5) yield chan1.put("one") @csp.process def two(): yield csp.wait(0.5) yield chan2.put("two") @csp.process def q(): ...
epl-1.0
Python
58a6a2ae0c96cbea76c5c8a22bc9df871b91f820
Fix projection issue.
MapofLife/MOL,MapofLife/MOL,MapofLife/MOL,MapofLife/MOL,MapofLife/MOL,MapofLife/MOL,MapofLife/MOL,MapofLife/MOL
workflow/mol-data/shp2pgis.py
workflow/mol-data/shp2pgis.py
#!/usr/bin/env python # Copyright 2011 Aaron Steele # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
bsd-3-clause
Python
20bd74177ba28c435a23c634043686bec4a513f7
Create LabelVerticesAndEdges.py
lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples
src/Python/Graphs/LabelVerticesAndEdges.py
src/Python/Graphs/LabelVerticesAndEdges.py
#!/usr/bin/env python import vtk def main(): colors = vtk.vtkNamedColors() g = vtk.vtkMutableUndirectedGraph() # Create 3 vertices v1 = g.AddVertex() v2 = g.AddVertex() v3 = g.AddVertex() # Create a fully connected graph g.AddEdge(v1, v2) g.AddEdge(v2, v3) g.AddEdge(v1...
apache-2.0
Python
71bc85e6535e9d83bf39abed59695d36788b6320
Add fmt to Folly's open-source dependencies
facebook/watchman,nodakai/watchman,wez/watchman,wez/watchman,nodakai/watchman,nodakai/watchman,facebook/watchman,wez/watchman,nodakai/watchman,wez/watchman,wez/watchman,wez/watchman,facebook/watchman,facebook/watchman,facebook/watchman,facebook/watchman,nodakai/watchman,wez/watchman,facebook/watchman,wez/watchman,nodak...
build/fbcode_builder/specs/fmt.py
build/fbcode_builder/specs/fmt.py
#!/usr/bin/env python # Copyright (c) Facebook, Inc. and its affiliates. from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals def fbcode_builder_spec(builder): builder.add_option('fmtlib/fmt:git_hash', '5.3.0') ret...
mit
Python
73da6927c15dbd15f00d655b685006f912b66d38
Add header
AleksNeStu/ggrc-core,VinnieJohns/ggrc-core,AleksNeStu/ggrc-core,edofic/ggrc-core,kr41/ggrc-core,prasannav7/ggrc-core,edofic/ggrc-core,NejcZupec/ggrc-core,edofic/ggrc-core,prasannav7/ggrc-core,j0gurt/ggrc-core,j0gurt/ggrc-core,plamut/ggrc-core,prasannav7/ggrc-core,j0gurt/ggrc-core,VinnieJohns/ggrc-core,selahssea/ggrc-co...
test/selenium/src/examples/__init__.py
test/selenium/src/examples/__init__.py
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: jernej@reciprocitylabs.com # Maintained By: jernej@reciprocitylabs.com
apache-2.0
Python
a75716d77eb388d8bbcd2f8f245d3a46d51d3d3f
Add expand.py
nlpub/hyperstar,nlpub/hyperstar,dustalov/projlearn,nlpub/hyperstar
expand.py
expand.py
#!/usr/bin/env python from batch_sim.nn_vec import nn_vec import argparse import csv import glob import os import pickle import re import sys from gensim.models.word2vec import Word2Vec from collections import defaultdict import numpy as np import tensorflow as tf from projlearn import * MODELS = { 'baseline': ...
mit
Python
fe87c94d48fcce3a30be53434194b251547da4c8
Create unit test
WheatonCS/Lexos,WheatonCS/Lexos,WheatonCS/Lexos
test/unit_test/test_utility_topword.py
test/unit_test/test_utility_topword.py
from lexos.processors.analyze.topword import _z_test_ def test_z_test(): assert _z_test_()
mit
Python
93a52bf702ca548a2bf1dd733907652c6513af96
Add run script for exporter class
SpringerPE/cf-configuration-exporter
export.py
export.py
import os import pyaml from exporter.exporter import Exporter from cfconfigurator.cf import CF from cfconfigurator.uaa import UAA, UAAException if __name__ == "__main__": api_url = os.environ.get("EXPORTER_API_URL") admin_user = os.environ.get("EXPORTER_ADMIN_USER") admin_password = os.environ.get("EXPORTER_ADMIN_...
mit
Python
12aeaf2385d8814528a6a3394942bf0284756862
Add new Plane3D class.
PytLab/catplot
catplot/grid_components/planes.py
catplot/grid_components/planes.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from copy import deepcopy import numpy as np class Plane3D(object): """ Plane in 3D canvas. Parameters: ----------- x: 1-d array, the range of the plane along "x" axis (it's a generalized x, it depends on the axis value). y: 1-d array, the r...
mit
Python
f7dbdc2d3422e481b03fe89787dbec308e4371b9
add tests for evolutions steps
fhartwig/adhocracy3.mercator,liqd/adhocracy3.mercator,xs2maverick/adhocracy3.mercator,liqd/adhocracy3.mercator,liqd/adhocracy3.mercator,fhartwig/adhocracy3.mercator,fhartwig/adhocracy3.mercator,fhartwig/adhocracy3.mercator,fhartwig/adhocracy3.mercator,xs2maverick/adhocracy3.mercator,fhartwig/adhocracy3.mercator,xs2mave...
src/adhocracy/adhocracy/evolution/test_.py
src/adhocracy/adhocracy/evolution/test_.py
############ # helper # ############ class DummyFolder(dict): __acl__ = [] ################ # test steps # ################ def test_add_root_element(config): from adhocracy.evolution import add_app_root_element config.include("substanced.content") config.include("adhocracy.resources") roo...
agpl-3.0
Python
a9b80aa0288578ec58167622b0e3b088968e6941
Add mechanism to enable functions in development
DiamondLightSource/ispyb-api,DiamondLightSource/ispyb-api
ispyb/model/__future__.py
ispyb/model/__future__.py
from __future__ import absolute_import, division, print_function # Enables direct database functions in places where stored procedures are not # yet available. To use, run: # # import ispyb.model.__future__ # ispyb.model.__future__.enable('/path/to/.../database.cfg') try: import configparser except ImportError: i...
apache-2.0
Python
3683728082e0ffe394412000da61761805efc329
fix test cases and switch to test generator
reox/androguard,androguard/androguard,androguard/androguard,shuxin/androguard,huangtao2003/androguard
tests/test_decompiler.py
tests/test_decompiler.py
import unittest from androguard.misc import AnalyzeDex import sys import re from androguard.misc import AnalyzeAPK from androguard.decompiler.dad.decompile import DvMethod PATH_INSTALL = "./" sys.path.append(PATH_INSTALL) class DecompilerTest(unittest.TestCase): def testSimplification(self): h, d, dx = ...
import unittest from androguard.misc import AnalyzeDex import sys from androguard.misc import AnalyzeAPK from androguard.decompiler.dad.decompile import DvMethod PATH_INSTALL = "./" sys.path.append(PATH_INSTALL) class DecompilerTest(unittest.TestCase): def testSimplification(self): h, d, dx = AnalyzeDex...
apache-2.0
Python
3c01ff0ecee7abdd25a5812c5d3a9bfcb1df732d
Add tests for backslash escapes in route paths
bbangert/routes,webknjaz/routes
tests/test_units/test_route_escapes.py
tests/test_units/test_route_escapes.py
import unittest from routes.route import Route class TestRouteEscape(unittest.TestCase): def test_normal_route(self): r = Route('test', '/foo/bar') self.assertEqual(r.routelist, ['/foo/bar']) def test_route_with_backslash(self): r = Route('test', '/foo\\\\bar') self.assertEqua...
mit
Python
52c34e5cd6222de35ab750e6feb88be4ef8498f1
Add basic framework for middleware.
TouK/vumi,TouK/vumi,harrissoerja/vumi,vishwaprakashmishra/xmatrix,vishwaprakashmishra/xmatrix,TouK/vumi,harrissoerja/vumi,harrissoerja/vumi,vishwaprakashmishra/xmatrix
vumi/middleware/session_length.py
vumi/middleware/session_length.py
# -*- test-case-name: vumi.middleware.tests.test_provider_setter -*- from twisted.internet.defer import inlineCallbacks from vumi.middleware.base import BaseMiddleware from vumi.persist.txredis_manager import TxRedisManager class SessionLengthMiddleware(BaseMiddleware): """ Middleware for storing the session le...
bsd-3-clause
Python
a872cd2cdbce456206b3b3929dfefbc67db80dcc
Create 389_find_the_difference.py
jsingh41/algos
389_find_the_difference.py
389_find_the_difference.py
""" https://leetcode.com/problems/find-the-difference/description/ Given two strings s and t which consist of only lowercase letters. String t is generated by random shuffling string s and then add one more letter at a random position. Find the letter that was added in t. Example: Input: s = "abcd" t = "abcde" Out...
mit
Python
8eb21692d01f474b2dd8f0d7e05cb0713dbb0475
Solve Code Fights growing plant problem
HKuz/Test_Code
CodeFights/growingPlant.py
CodeFights/growingPlant.py
#!/usr/local/bin/python # Code Fights Growing Plant Problem def growingPlant(upSpeed, downSpeed, desiredHeight): if upSpeed >= desiredHeight: return 1 else: return (desiredHeight // (upSpeed - downSpeed)) def main(): tests = [ [100, 10, 910, 10], [10, 9, 4, 1] ] ...
mit
Python
869acc26022ce770f4b2e1c5c907e7c4174bc059
add tests for networkx.algorithms.reciprocity
SanketDG/networkx,NvanAdrichem/networkx,OrkoHunter/networkx,michaelpacer/networkx,goulu/networkx,jfinkels/networkx,Sixshaman/networkx,andnovar/networkx,cmtm/networkx,JamesClough/networkx
networkx/algorithms/tests/test_reciprocity.py
networkx/algorithms/tests/test_reciprocity.py
from nose.tools import * import networkx as nx class TestReciprocity(object): # test overall reicprocity by passing whole graph def test_reciprocity_digraph(self): DG = nx.DiGraph([(1, 2), (2, 1)]) reciprocity = nx.reciprocity(DG) assert reciprocity == 1.0 # test empty graph's ov...
bsd-3-clause
Python
36a65246e23d8281c0e47e517d67af15b18111be
Create calcul.p2.q1.py
emeric254/qnap-STRI
qnap/partie2/calcul.p2.q1.py
qnap/partie2/calcul.p2.q1.py
# -*- coding: utf-8 -*- # module maths import math paquet = 10 * pow(10, 3) debit = 10 * pow(10, 6) tps_moy_serv = paquet * 1.0 / debit for p in range(1, 100): p = p / 100 lambd = p * 1.0 / tps_moy_serv n = p / (1 - p) w = 1 / (1 / tps_moy_serv - lambd) print(str(tps_moy_serv) + ' ' + str(lamb...
mit
Python
7886a9bcf7b97d55086abf395e21c4751e61fada
Add __init__.py
grigorisg9gr/menpofit,yuxiang-zhou/menpofit,yuxiang-zhou/menpofit,grigorisg9gr/menpofit
menpofit/clm/algorithm/__init__.py
menpofit/clm/algorithm/__init__.py
from gd import ( GradientDescentCLMAlgorithm, ActiveShapeModel, RegularisedLandmarkMeanShift)
bsd-3-clause
Python
39ff196a16ec3b8005137a6749ed525f2d305bde
Fix lint warning in control_assessment.py
hasanalom/ggrc-core,j0gurt/ggrc-core,VinnieJohns/ggrc-core,AleksNeStu/ggrc-core,edofic/ggrc-core,hyperNURb/ggrc-core,hasanalom/ggrc-core,vladan-m/ggrc-core,AleksNeStu/ggrc-core,j0gurt/ggrc-core,kr41/ggrc-core,selahssea/ggrc-core,andrei-karalionak/ggrc-core,selahssea/ggrc-core,uskudnik/ggrc-core,prasannav7/ggrc-core,jma...
src/ggrc/models/control_assessment.py
src/ggrc/models/control_assessment.py
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: anze@reciprocitylabs.com # Maintained By: anze@reciprocitylabs.com from ggrc import db from .mixins import ( deferred, BusinessObject, Timeboxe...
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: anze@reciprocitylabs.com # Maintained By: anze@reciprocitylabs.com from ggrc import db from .mixins import ( deferred, BusinessObject, Timeboxe...
apache-2.0
Python
25c047f152353d2ea8e48e083f5db163f7869e6f
add new test file which shouldn't produce errors (but does in one case that needs to be fixed--in TODO)
thomasvs/pychecker,thomasvs/pychecker,akaihola/PyChecker,akaihola/PyChecker
test_input/test6.py
test_input/test6.py
"doc" from metaslash.db import db class X(db.Record) : "doc" def __init__(self): "shouldn't be a warning" db.Record.__init__(self, "") class Y(Exception): "doc" def __init__(self, err): "this shouldn't produce a warning" Exception.__init__(self, err) def uuu(func): "shouldn't cra...
bsd-3-clause
Python
a3b7be86d5a1e81851a785f12dea414a0b513d96
Create ip2geo.py
MikeAguilar/ip2geo
ip2geo.py
ip2geo.py
#!/usr/bin/python # # Author: Miguel Aguilar # Project: IP to Geo locator # Location: Seattle, WA. Aug 5, 2015 # Script: ip2geo.py # Logs: ./geoInfo.log # # Objective: This script is designed to take an IP and return a set of data related to its Geolocation. # As it stands right now, using ho...
apache-2.0
Python
9bb295ebafe31529b079a07977014050feea6a9f
Create Server.py
bendurham441/Python-Chat-Server
Server.py
Server.py
mit
Python
924d9137b1c44a18a468d9e355a7326a3e2ebcaa
Add merge migration
theirc/ServiceInfo-ircdeploy,theirc/ServiceInfo,theirc/ServiceInfo,theirc/ServiceInfo,theirc/ServiceInfo
services/migrations/0015_merge.py
services/migrations/0015_merge.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('services', '0014_auto_20150130_1431'), ('services', '0011_auto_20150129_1534'), ] operations = [ ]
bsd-3-clause
Python
febada8fbdff9b43edb01557c61ded00a8459b84
add half-baked main-app example
Dovyski/cvui,Dovyski/cvui,Dovyski/cvui
example/src/main-app/main-app.py
example/src/main-app/main-app.py
# # This is a demo application to showcase the UI components of cvui. # # Copyright (c) 2018 Fernando Bevilacqua <dovyski@gmail.com> # Licensed under the MIT license. # # Include the directory where cvui is so we can load it import sys sys.path.append('../../../') import numpy as np import cv2 import cvui WINDOW_NAM...
mit
Python
21deca79b741d03bc466d426837f650f58ee18bc
Create __init__.py
allox/django-base-template,allox/django-base-template,allox/django-base-template,allox/django-base-template
project_name/__init__.py
project_name/__init__.py
""" {{ project_name }} """
bsd-3-clause
Python
a8741127630dcb25e4c6861c08e30d6dc48b00f0
Create keyfob.py
jryanishere/GM-Car-Automation,jryanishere/GM-Car-Automation
keyfob.py
keyfob.py
import time import serial import subprocess import sys # Enter the mac address of the MX Bluetooth here subprocess.call("sudo rfcomm bind 0 MA:CO:FD:EV:IC:E4", shell=True) # Serial settings, this will most likely stay the same ser = serial.Serial( port='/dev/rfcomm0', baudrate=115200, parity=serial.PARITY_...
apache-2.0
Python
824eea86b5166bce428c466c867708a9c8b15fb0
Add example for high and low peak detection
MonsieurV/py-findpeaks,MonsieurV/py-findpeaks
tests/lows_and_highs.py
tests/lows_and_highs.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np from vector import cb, plot_peaks import peakutils.peak def plot_peaks_lows_highs(x, highs, lows, algorithm=None, mph=None, mpd=None): """Plot results of the peak dectection.""" try: import matplotlib.pyplot as plt except ImportError:...
mit
Python
972502073c2575fda938a7a021f937e546e78815
Create lru_cache.py
AdityaSoni19031997/Machine-Learning,AdityaSoni19031997/Machine-Learning
lld_practice/lru_cache.py
lld_practice/lru_cache.py
class Node: def __init__(self, key=-1, val=-1, nxt=None, prv=None): self.key, self.val, self.next, self.prev = key, val, nxt, prv class LinkedList: def __init__(self): # Head is the Most Recently Used -- Tail is the Least Recently Used self.head = self.tail = None def appendleft(s...
mit
Python
aee808eb6119f193d1baa34ccb3403c7a9e97691
build migration table
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
custom/icds_reports/utils/build_migration_table.py
custom/icds_reports/utils/build_migration_table.py
from corehq.apps.locations.models import SQLLocation from datetime import date from custom.icds_reports.tasks import icds_state_aggregation_task from dateutil.relativedelta import relativedelta DASHBOARD_DOMAIN='icds-cas' state_ids = list(SQLLocation.objects .filter(domain=DASHBOARD_DOMAIN, locat...
bsd-3-clause
Python
00376a052aeff0a94b1b82791d43de74e055da3b
Add cleanup script (for development)
jacksontj/dataman
examples/python/forum/cleanup.py
examples/python/forum/cleanup.py
import psycopg2 import psycopg2.extras from schema import DBNAME # Router node if True: conn = psycopg2.connect("dbname=%s user='postgres' host='localhost' password='password'" % "dataman_router") cur = conn.cursor(cursor_factory=psycopg2.extras.DictCursor) queries = [ "DELETE FROM collection_p...
mit
Python
73f891d7eebb5d524cee2da606bc0d195aeea890
Add new test for CheckResult
jackstanek/BotBot,jackstanek/BotBot
tests/test_checkinfo.py
tests/test_checkinfo.py
from itertools import combinations from string import ascii_lowercase from botbot import checkinfo as ci def test_bidirectional_problem_serialization(tmpdir): info = ci.CheckResult(tmpdir.strpath) for probs in combinations(ascii_lowercase, 3): info.add_problem(''.join(probs)) old_probs = info.pro...
mit
Python