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
a466a89cd18252c6d90fd3b590148ca3268ff637
Add a couple of simple tests for LPD geometry
European-XFEL/h5tools-py
karabo_data/tests/test_lpd_geometry.py
karabo_data/tests/test_lpd_geometry.py
from matplotlib.figure import Figure import numpy as np from karabo_data.geometry2 import LPD_1MGeometry def test_inspect(): geom = LPD_1MGeometry.from_quad_positions([ (11.4, 299), (-11.5, 8), (254.5, -16), (278.5, 275) ]) # Smoketest fig = geom.inspect() assert is...
bsd-3-clause
Python
efac5a6167e2ac437072084f0e48147ccccab793
test read() on all examples
rcs-analytics/icy
test/test_examples.py
test/test_examples.py
import icy import contextlib import os from datetime import datetime class DummyFile(object): def write(self): pass if __name__ == '__main__': print('running examples tests ...') t0 = datetime.now() results = [0, 0, 0, 0] for ex in sorted(icy.examples): t1 = datetime.now() try: ...
mit
Python
796f000d3ba2fd2f289bb68ce817a81eb56dcb3d
Test for issue200
armandobs14/rdflib,marma/rdflib,RDFLib/rdflib,dbs/rdflib,marma/rdflib,yingerj/rdflib,RDFLib/rdflib,dbs/rdflib,ssssam/rdflib,avorio/rdflib,yingerj/rdflib,armandobs14/rdflib,RDFLib/rdflib,dbs/rdflib,armandobs14/rdflib,armandobs14/rdflib,marma/rdflib,dbs/rdflib,avorio/rdflib,ssssam/rdflib,avorio/rdflib,RDFLib/rdflib,yinge...
test/test_issue200.py
test/test_issue200.py
#!/usr/bin/env python import os, sys import rdflib import unittest try: from hashlib import md5 except ImportError: from md5 import md5 if sys.platform == 'Java': from nose import SkipTest raise SkipTest('No os.pipe() in Jython, skipping') # Adapted from http://icodesnip.com/snippet/python/simple-uni...
bsd-3-clause
Python
defe99d80e102527140fb5742f4deedb6748f05e
add execute.
wings27/sc_spider
sc_spider/execute.py
sc_spider/execute.py
from scrapy.cmdline import execute execute()
apache-2.0
Python
80f35ad0d3a6a1f04eb0339bb1088ebe6eb27af5
Add result classes for update/insert/delete ops
vmalloc/mongomock,marcinbarczynski/mongomock,mdomke/mongomock,drorasaf/mongomock,magaman384/mongomock,StarfishStorage/mongomock,julianhille/mongomock
mongomock/results.py
mongomock/results.py
try: from pymongo.results import InsertOneResult from pymongo.results import InsertManyResult from pymongo.results import UpdateResult from pymongo.results import DeleteResult except ImportError: class _WriteResult(object): def __init__(self, acknowledged=True): self.__acknowled...
bsd-3-clause
Python
35b5ef2d39363e893796a8384209034093d8a11e
add import script for Burnley
chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations
polling_stations/apps/data_collection/management/commands/import_burnley.py
polling_stations/apps/data_collection/management/commands/import_burnley.py
from data_collection.management.commands import BaseXpressWebLookupCsvImporter class Command(BaseXpressWebLookupCsvImporter): council_id = 'E07000117' # note: extension is TSV, but file is actually comma seperated addresses_name = 'BurnleyPropertyPostCodePollingStationWebLookup-2017-03-10.TSV' st...
bsd-3-clause
Python
6fce34ca55d4dfaee921480077b48e0984d8fe1c
Create max_of_three.py
lcnodc/codes,lcnodc/codes
09-revisao/practice_python/max_of_three.py
09-revisao/practice_python/max_of_three.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Exercise 28: Max Of Three Implement a function that takes as input three variables, and returns the largest of the three. Do this without using the Python max() function! The goal of this exercise is to think about some internals that Python normally takes care of for...
mit
Python
54940c2532d90e23b919031e948e4c7b608b1866
add import script for Wycombe
DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations
polling_stations/apps/data_collection/management/commands/import_wycombe.py
polling_stations/apps/data_collection/management/commands/import_wycombe.py
from django.contrib.gis.geos import Point from data_collection.management.commands import BaseCsvStationsShpDistrictsImporter from data_finder.helpers import geocode_point_only, PostcodeError class Command(BaseCsvStationsShpDistrictsImporter): srid = 27700 council_id = 'E07000007' districts_name = 'Polling...
bsd-3-clause
Python
0c5c2dd033a4d586e24fc76a7f5398db52470ac6
Add python wrapper
jarikomppa/escapi,jarikomppa/escapi,jarikomppa/escapi,jarikomppa/escapi
python/camera.py
python/camera.py
""" A simple python wrapper around escapi Usage: from camera import Device device = Deveice.connect(0, 500, 500) image = device.get_image() """ import os from ctypes import * from PIL import Image def resolve(name): f = os.path.join(os.path.dirname(__file__), name) return f class CAPTURE_PROPETIES: C...
unlicense
Python
a877ba0845ea868a79d89965c419ec637bc85ff1
add python
Stymphalian/CodeSnacks,Stymphalian/CodeSnacks,Stymphalian/CodeSnacks,Stymphalian/CodeSnacks
python/python.py
python/python.py
from collections import namedtuple Point = namedtuple('Point',['x','y']) if __name__ == "__main__": main() import heapq heap = [] heapq.heapify(heap) heapq.heappush(heap,(1,2))
mit
Python
5ba42c79d777b8afad82a6dc120afc366643e9b8
Create test.py
tspannhw/nlp-utilities,tspannhw/nlp-utilities
test.py
test.py
import spacy nlp = spacy.load('en') doc5 = nlp(u"Timothy Spann is studying at Princeton University in New Jersey.") # Named Entity Recognizer (NER) for ent in doc5.ents: print ent, ent.label, ent.label_
apache-2.0
Python
e5f22aaf4de371df0b52a275dbebbd4cd6c1d980
add test file
j-salazar/mchacks15,j-salazar/mchacks15,j-salazar/mchacks15
test.py
test.py
import os import logging import redis import gevent from flask import Flask, render_template from flask_sockets import Sockets
mit
Python
50c3e9ffeacf7db5c002186e178ca24a6c14bf22
Add py-watchdog (#19167)
iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack
var/spack/repos/builtin/packages/py-watchdog/package.py
var/spack/repos/builtin/packages/py-watchdog/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 PyWatchdog(PythonPackage): """Python library and shell utilities to monitor filesystem eve...
lgpl-2.1
Python
c151f843964408481a5f6569718537a786ff5722
range excluding script, still lacks some error checking
bpcox/range-exclude
range-exclude.py
range-exclude.py
#! /usr/bin/env python3.4 import ipaddress import math supernet = False subnet = False while not supernet: inputRange = input('Input the IP range you would like remove a subrange from: ') try: supernet =ipaddress.ip_network(inputRange) except ValueError: print('Invalid input, try again') while not subnet: ...
mit
Python
e639cea1f5264870e3f5f19fbd88345a23ef61a9
add timestamps to debug logging
dashpay/sentinel,ivansib/sentinel,ivansib/sentinel,thelazier/sentinel,thelazier/sentinel,dashpay/sentinel
lib/misc.py
lib/misc.py
import time import re import sys, os sentinel_options = [] def is_numeric(strin): import decimal # Decimal allows spaces in input, but we don't if strin.strip() != strin: return False try: value = decimal.Decimal(strin) except decimal.InvalidOperation as e: return False ...
import time import re import sys, os sentinel_options = [] def is_numeric(strin): import decimal # Decimal allows spaces in input, but we don't if strin.strip() != strin: return False try: value = decimal.Decimal(strin) except decimal.InvalidOperation as e: return False ...
mit
Python
9d44e4eb4c8d2c2f10152894f7c53d9feaae528c
Add ip-restriction plugin to declare ip whitelists/blacklists and restrict api access
menecio/django-api-bouncer
api_bouncer/middlewares/ip_restriction.py
api_bouncer/middlewares/ip_restriction.py
import ipaddress from django.http import JsonResponse from ..models import Plugin def get_client_ip(request): x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR') if x_forwarded_for: ip = x_forwarded_for.split(',')[0] else: ip = request.META.get('REMOTE_ADDR') return ip class...
apache-2.0
Python
b62256d47ebf5df9404441f5ac450b780b4937ae
add twinkle effect
ethanacm/the_snake_lights
test.py
test.py
# NeoPixel library strandtest example # Author: Tony DiCola (tony@tonydicola.com) # # Direct port of the Arduino NeoPixel library strandtest example. Showcases # various animations on a strip of NeoPixels. import time from neopixel import * # LED strip configuration: LED_COUNT = 300 # Number of LED pixels. LED_PIN ...
mit
Python
db692a253a606923096a2a12359bad5302e53e55
Create test.py
okraus/DeepLoc,okraus/DeepLoc
test.py
test.py
print "test.py"
bsd-3-clause
Python
5606c7ad952b45c0bbb77b605dede737d65d7a17
Create thor.py
nbar1/thor
thor.py
thor.py
# thor # # Process files in a given rootFolder to meet specific naming criteria # # @created 5/4/2013 # @modified 5/18/2013 # @author Nick Barone import os, re, string # folder to process rootFolder = "/home/dlna01/stream/videos/" # processFile # return root folder # # @param string path # @return string root path d...
mit
Python
9f8e7ff3220c81e22fde17a85989653b45602f28
Create 6kyu_n-centered_array.py
Orange9000/Codewars,Orange9000/Codewars
Solutions/6kyu/6kyu_n-centered_array.py
Solutions/6kyu/6kyu_n-centered_array.py
from math import ceil def is_centered(arr,n): return any(sum(arr[i:-i])==n for i in range(ceil(len(arr)/2))) or sum(arr)==n
mit
Python
46ebd88e56300d6f64421acaa2a3eb42db7acc81
Add simple CFR implementation
JakubPetriska/poker-cfr,JakubPetriska/poker-cfr
kuhn_poker/train_cfr.py
kuhn_poker/train_cfr.py
import random NUM_ACTIONS = 2 class Node: def __init__(self, info_set): super().__init__() self.info_set = info_set self.regret_sum = [0] * NUM_ACTIONS self.strategy = [0] * NUM_ACTIONS self.strategy_sum = [0] * NUM_ACTIONS def get_strategy(self, realization_weight): ...
mit
Python
bf0be80bdc2ec691fb0f0ac1bcfe3337f070c199
Add some tests
spreadflow/spreadflow-core,znerol/spreadflow-core
spreadflow_core/test/test_jobqueue.py
spreadflow_core/test/test_jobqueue.py
# -*- coding: utf-8 -*- """Tests for cooperative job queue. """ from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals from twisted.internet import defer from twisted.trial import unittest from spreadflow_core.jobqueue import JobQueue class JobQueueTestCase(un...
mit
Python
7d9aed1bed273b1b83f22436e5c24cde3cc93586
add an rnn model
longjie/chainer-char-rnn,yusuketomoto/chainer-char-rnn,yanweifu/chainer-char-rnn,longjie/chainer-char-rnn,kylemcdonald/chainer-char-rnn,kl-ing-one/chainer-char-rnn
CharRNN.py
CharRNN.py
import numpy as np from chainer import Variable, FunctionSet import chainer.functions as F class CharRNN(FunctionSet): def __init__(self, n_vocab, n_units): super(CharRNN, self).__init__( embed = F.EmbedID(n_vocab, n_units), l1_x = F.Linear(n_units, 4*n_units), l1_h = F...
mit
Python
b291408936aeff869aa8bb9754687b2949bfc2a4
Add laupdate, a script to update list of admins
PersianWikipedia/fawikibot,PersianWikipedia/fawikibot
laupdate.py
laupdate.py
#!/usr/bin/python # -*- coding: utf-8 -*- # Credit: Amir Sarabadani <ladsgroup@gmail.com> import pywikibot import time from pywikibot.data.api import Request import re site = pywikibot.Site('fa', fam='wikipedia') print "Fetching admins list" data = Request(site=site, action="query", list="allusers", augroup="sysop", au...
mit
Python
31cc4f9c90ce231c3cb75318db31a711b325947a
add pixiv downloader.
stefco/dotfiles,stefco/dotfiles,stefco/dotfiles
bin/pixiv_dl.py
bin/pixiv_dl.py
# coding: utf-8 import os import logging from netrc import netrc from random import random from time import sleep import pixivpy3 logging.basicConfig(level=logging.DEBUG) LOG = logging.getLogger(__name__) SIZES = {'large', 'original'} DIRNAME = os.path.expanduser(os.path.join("~", "Downloads", "pixiv")) if not os.path....
mit
Python
bd68dd06ba24806d1c216d3fc818d5597dc469d2
add leetcode Merge Two Sorted Lists
Fity/2code,Fity/2code,Fity/2code,Fity/2code,Fity/2code,Fity/2code
leetcode/MergeTwoSortedLists/solution.py
leetcode/MergeTwoSortedLists/solution.py
# -*- coding:utf-8 -*- # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: # @param two ListNodes # @return a ListNode def mergeTwoLists(self, l1, l2): if not l1: return l2 if not...
mit
Python
94d8adf9d48c6118a3467947ad8b1ae0b6dd3d63
Fix - add missed migrations
fidals/refarm-site,fidals/refarm-site,fidals/refarm-site
blog/migrations/0006_auto_20160513_1634.py
blog/migrations/0006_auto_20160513_1634.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.5 on 2016-05-13 13:34 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('blog', '0005_auto_20160422_1256'), ] operations = [ migrations.AddField( ...
mit
Python
17c9cd8fcd597f5ecef00ee6cf494d3b3dc77e6b
add nonlinear fv advection operator
michaellaier/pymor,michaellaier/pymor,michaellaier/pymor,michaellaier/pymor
src/pymor/operators/fv.py
src/pymor/operators/fv.py
# -*- coding: utf-8 -*- # This file is part of the pyMor project (http://www.pymor.org). # Copyright Holders: Felix Albrecht, Rene Milk, Stephan Rave # License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause) from __future__ import absolute_import, division, print_function import numpy as np from s...
bsd-2-clause
Python
70c1772f339b3638e1ed29a56c2cab9aa9a29c1e
Create Battleship.py
THEMVFFINMAN/Python-Games,THEMVFFINMAN/PyttleShip
Battleship.py
Battleship.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import curses import time screen = curses.initscr() curses.noecho() curses.curs_set(2) screen.keypad(1) def createBoards(): enemyBoard = [ ['+', '=', '=', '=', '=', '=', '=', '=', '=', '=', '=', '+'], ['|', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', '|...
mit
Python
a9c0b9f026ac10ca058afc2f7ad311e7431407f8
add modules to follow
sdpython/pymyinstall,sdpython/pymyinstall,sdpython/pymyinstall,sdpython/pymyinstall
src/pymyinstall/packaged/packaged_config_C_tofollow.py
src/pymyinstall/packaged/packaged_config_C_tofollow.py
#-*- coding: utf-8 -*- """ @file @brief Defines a set of modules to try """ import sys from ..installhelper.module_install import ModuleInstall def follow_set(): """ modules to follow """ mod = [ ModuleInstall( "langdetect", "pip", usage="WEB", purpose="Language detecti...
mit
Python
1bb393531771f877e9d4e9c2a0b99446f8873fc9
Create gatherThreatIntel_ISC_IPs.py
ahhh/SPSE,thedarkcoder/SPSE
gatherThreatIntel_ISC_IPs.py
gatherThreatIntel_ISC_IPs.py
#!/bin/python # Inspired by: https://bitbucket.org/whyJoseph/spse-whyjoseph/src/a9cb102ae93826cd7155ff77c2c4a24f584ff0a3/SANSTopXIP.py from optparse import OptionParser import logging import urllib import re import sys # Uses BeautifulSoup4 from bs4 import BeautifulSoup def threatIPs(quantity): page = urllib.urlope...
mit
Python
75ce58aa8073e29fcc54d45b8f3dec24cacd05a4
Add missed needs_update attribute, which is referenced from the RTPproxy client code.
sippy/b2bua,AVOXI/b2bua,AVOXI/b2bua,sippy/b2bua
sippy/SdpMediaDescription.py
sippy/SdpMediaDescription.py
from SdpConnecton import SdpConnecton from SdpMedia import SdpMedia from SdpGeneric import SdpGeneric f_types = {'m':SdpMedia, 'i':SdpGeneric, 'c':SdpConnecton, 'b':SdpGeneric, \ 'k':SdpGeneric} class SdpMediaDescription(object): m_header = None i_header = None c_header = None b_header = None k...
from SdpConnecton import SdpConnecton from SdpMedia import SdpMedia from SdpGeneric import SdpGeneric f_types = {'m':SdpMedia, 'i':SdpGeneric, 'c':SdpConnecton, 'b':SdpGeneric, \ 'k':SdpGeneric} class SdpMediaDescription(object): m_header = None i_header = None c_header = None b_header = None k...
bsd-2-clause
Python
86861db1c67ac4c5b069e0035ed33c18100d582e
Add a default tokenizer
mozilla/spicedham,mozilla/spicedham
spicedham/split_tokenizer.py
spicedham/split_tokenizer.py
from re import split from spicedham.tokenizer import BaseTokenizer class SplitTokenizer(BaseTokenizer): def tokenize(self, text): """ Split the text on punctuation and newlines, lowercase everything, and filter the empty strings """ text = split('[ ,.?!\n\r]', text) ...
mpl-2.0
Python
40692d016b19c852364c879b7adb2672b023fe8e
add compile_commands.json gyp generator
nodejs/node-gyp,nodejs/node-gyp,nodegit/node-gyp,nodegit/node-gyp,nodegit/node-gyp,nodegit/node-gyp,nodejs/node-gyp,nodejs/node-gyp,nodegit/node-gyp,nodejs/node-gyp
tools/gyp/pylib/gyp/generator/compile_commands_json.py
tools/gyp/pylib/gyp/generator/compile_commands_json.py
# Copyright (c) 2016 Ben Noordhuis <info@bnoordhuis.nl>. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import gyp.common import gyp.xcode_emulation import json import os generator_additional_non_configuration_keys = [] generator_additional_p...
mit
Python
dbe697ba4c74f2552678775ff25cb266d52cd312
Update build script.
qiuwch/unrealcv,qiuwch/unrealcv,unrealcv/unrealcv,qiuwch/unrealcv,unrealcv/unrealcv,unrealcv/unrealcv,qiuwch/unrealcv,unrealcv/unrealcv,qiuwch/unrealcv,unrealcv/unrealcv,qiuwch/unrealcv
build-plugin.py
build-plugin.py
import os UnrealEnginePath='~/workspace/UnrealEngine/Engine' UATScript = os.path.join(UnrealEnginePath, 'Build/BatchFiles/RunUAT.sh') if not os.path.isfile(UATScript): print('Can not find Automation Script of UE4 %s' % UATScript) print('Please set UnrealEnginePath correctly first') else: FullPluginFile = o...
import os UnrealEnginePath='~/workspace/UnrealEngine/Engine' UATScript = os.path.join(UnrealEnginePath, 'Build/BatchFiles/RunUAT.sh') if not os.path.isfile(UATScript): print('Can not find Automation Script of UE4 %s' % UATScript) print('Please set UnrealEnginePath correctly first') FullPluginFile = os.path.abs...
mit
Python
50c8258f657837f5be36e1d449702da58ee22531
add an incredibly basic test script
dmc2015/census,sunlightlabs/census,joehand/census,UDST/census
census/tests.py
census/tests.py
import os import unittest from core import Census, UnsupportedYearException KEY = os.environ.get('CENSUS_KEY', '') class TestUnsupportedYears(unittest.TestCase): def setUp(self): self.client = Census(KEY, year=2008) def test_acs(self): self.assertRaises(UnsupportedYearException, ...
bsd-3-clause
Python
aec48ebe3b0431fe39e3f59dc92b8e66eaddb318
Add languagebar.py
phuang/ibus,Keruspe/ibus,j717273419/ibus,ueno/ibus,ueno/ibus,ibus/ibus-cros,ibus/ibus-cros,j717273419/ibus,Keruspe/ibus,luoxsbupt/ibus,ibus/ibus,luoxsbupt/ibus,fujiwarat/ibus,luoxsbupt/ibus,phuang/ibus,luoxsbupt/ibus,Keruspe/ibus,ueno/ibus,fujiwarat/ibus,fujiwarat/ibus,luoxsbupt/ibus,j717273419/ibus,Keruspe/ibus,ibus/i...
panel/languagebar.py
panel/languagebar.py
import gtk import gtk.gdk as gdk import gobject from image import Image from handle import Handle class LanguageBar (gtk.Toolbar): def __init__ (self): gtk.Toolbar.__init__ (self) self.set_property ("icon-size", gtk.ICON_SIZE_MENU) # self.set_orientation (gtk.ORIENTATION_VERTICAL) self._create_items () def...
lgpl-2.1
Python
4b356690500c7374acb166f8055edc8eb7e57509
Create wget.py
shahsaifi/handystuff
wget.py
wget.py
import urllib import sys w = sys.argv[1] def wget(w): return urllib.urlopen(w).read() def getbase(w): return w.split("/")[-1] def write(filename): f = open((filename),"w") f.write(wget(w)) f.close() def main(): if w.endswith("/"): write("index.html") print "saving %s as index.html" % w else: write(getb...
unlicense
Python
c261ae123a3967af0e0bf5640d115f623ff6b446
Add conpaas.core.agent.BaseAgent which all service agents can extend
mihaisoloi/conpaas,mihaisoloi/conpaas,mihaisoloi/conpaas,mihaisoloi/conpaas,mihaisoloi/conpaas
conpaas-services/src/conpaas/core/agent.py
conpaas-services/src/conpaas/core/agent.py
""" Copyright (c) 2010-2013, Contrail consortium. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions ...
bsd-3-clause
Python
b420c9e24372d5c7057f7f3102cf7b364023f62c
Add files via upload
noxterrain/codex
SimpleGUI.py
SimpleGUI.py
"""" Creates a simple GUI for summing two numbers. """ import tkinter from tkinter import ttk class Adder(ttk.Frame): """The adders gui and functions.""" def __init__(self, parent, *args, **kwargs): ttk.Frame.__init__(self, parent, *args, **kwargs) self.root = parent self.init_gui() ...
mit
Python
34e2e605cbecbf9bcd7fee652095636a84e685b5
Add : first attempt to autodetection.
xorpaul/shinken,staute/shinken_deb,Simage/shinken,xorpaul/shinken,savoirfairelinux/shinken,xorpaul/shinken,rednach/krill,staute/shinken_package,savoirfairelinux/shinken,naparuba/shinken,h4wkmoon/shinken,kaji-project/shinken,dfranco/shinken,xorpaul/shinken,fpeyre/shinken,geektophe/shinken,rednach/krill,mohierf/shinken,m...
libexec/show_nmap.py
libexec/show_nmap.py
from xml.etree.ElementTree import ElementTree tree = ElementTree() tree.parse("local.xml") #tree.parse("www.google.com.xml") p = tree.findall('host') print "Number of host", len(p) # Say if a host is up or not def is_up(h): status = h.find('status') state = status.attrib['state'] return state == 'up' cl...
agpl-3.0
Python
79804cf72d096483d8c2483c0d02a21b715ddd5f
Add files via upload
Scaravex/clue-hackathon,Scaravex/clue-hackathon,adrinjalali/clue-hackathon,adrinjalali/clue-hackathon
ideas_v0.py
ideas_v0.py
# -*- coding: utf-8 -*- """ Created on Tue Mar 15 23:23:24 2017 @author: Flaminia """ import pandas as pd import random import numpy as np import seaborn as sb sample = pd.read_csv("data/data_sample.csv") # the first sample, one single file # List users udser_id = list(pd.unique(sample.user_id)) # density is a kin...
apache-2.0
Python
b8f90d2f2ab7fb439ddf912a47b7856dcb040a39
Add move subcommand for label handling
Anaconda-Platform/anaconda-client,Anaconda-Platform/anaconda-client,Anaconda-Platform/anaconda-client
binstar_client/commands/move.py
binstar_client/commands/move.py
# -*- coding: utf-8 -*- """ Move packages between labels. """ # Standard library imports from __future__ import unicode_literals, print_function import logging # Local imports from binstar_client import errors from binstar_client.utils import get_server_api, parse_specs logger = logging.getLogger('binstar.move') ...
bsd-3-clause
Python
50e2cfbcb2444fd34a77d42589afbf8929c1cf00
add module that may be useful
biokit/biokit,biokit/biokit
biokit/rtools/nbstreamreader.py
biokit/rtools/nbstreamreader.py
# http://eyalarubas.com/python-subproc-nonblock.html from threading import Thread try: from Queue import Queue, Empty except ImportError: from queue import Queue, Empty class NonBlockingStreamReader: def __init__(self, stream): """ stream: the stream to read from. Usuall...
bsd-2-clause
Python
7523a3212a79228b3cffe82d50a7383a5d101aec
Add watcher(pagerduty) bot
forter/boten
boten/bots_available/watcher.py
boten/bots_available/watcher.py
from __future__ import absolute_import from boten import core import pygerduty import datetime from boten.config import watcher as config class Bot(core.BaseBot): def __init__(self): super(Bot, self).__init__() self.pager = pygerduty.PagerDuty(config.ORG_NAME, config.PAGERDUTY_KEY) def comman...
apache-2.0
Python
023ca9fac2963d5dc998c1ba501e5705ec7dfe26
Create elasticsearch_storage.py
jmlong1027/multiscanner,jmlong1027/multiscanner,awest1339/multiscanner,mitre/multiscanner,awest1339/multiscanner,awest1339/multiscanner,mitre/multiscanner,jmlong1027/multiscanner,mitre/multiscanner,MITRECND/multiscanner,MITRECND/multiscanner,awest1339/multiscanner,jmlong1027/multiscanner
storage/elasticsearch_storage.py
storage/elasticsearch_storage.py
''' Storage module that will interact with elasticsearch. ''' from uuid import uuid4 from elasticsearch import Elasticsearch, helpers import storage class ElasticSearchStorage(storage.Storage): ''' Subclass of Storage. ''' DEFAULTCONF = { 'ENABLED': True, 'host': 'localhost', '...
mpl-2.0
Python
4d5b94ac4eded101148e21b4faa0ca7dafe74770
fix the pylint "Class 'Position' has no 'objects' member" error
yohanboniface/memopol-core,stfp/memopol2,stfp/memopol2,yohanboniface/memopol-core,yohanboniface/memopol-core,stfp/memopol2
memopol2/main/models.py
memopol2/main/models.py
from django.db import models from memopol2 import settings from couchdbkit import * class Mep(dict): """ Our Mep pseudo model. Currently we use couchdbkit as a glorified http client and json parser, the objets we work with are just dicts. This is here to wrap things a little bit, and do our fixups (wh...
from django.db import models from memopol2 import settings from couchdbkit import * class Mep(dict): """ Our Mep pseudo model. Currently we use couchdbkit as a glorified http client and json parser, the objets we work with are just dicts. This is here to wrap things a little bit, and do our fixups (wh...
agpl-3.0
Python
4681ee081f5600cebf7540862efc60dbf1d190d7
Rename test module and add test for login page content
mkiterian/bucket-list-app,mkiterian/bucket-list-app,mkiterian/bucket-list-app
test_app.py
test_app.py
import unittest from unittest import TestCase from user import User from bucketlist import BucketList from flask import url_for from app import app class BucketListTest(TestCase): def setUp(self): # creates a test client self.client = app.test_client() self.client.testing = True ...
mit
Python
f6c64846fc066403d39d7cb60ce0bcc455aff2d5
Add conversions for MIDI to hertz and hertz to MIDI
TheUnderscores/midi-beeper-orchestra
src/server/convert.py
src/server/convert.py
# midi-beeper-orchestra - program to create an orchestra from PC speakers # Copyright (C) 2015 The Underscores # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the Lice...
agpl-3.0
Python
57abe384393d9ec14e8c066d674e49742d42d12c
Return result code.
tnotstar/pycalcstats,tnotstar/pycalcstats,bmcculley/pycalcstats,bmcculley/pycalcstats
src/stats/__main__.py
src/stats/__main__.py
#!/usr/bin/env python3 ## Copyright (c) 2011 Steven D'Aprano. ## See the file __init__.py for the licence terms for this software. """ Run the stats package as if it were an executable module. Usage: $ python3 -m stats [options] Options: -h --help Print this help text. -V --version Print the ...
#!/usr/bin/env python3 ## Copyright (c) 2011 Steven D'Aprano. ## See the file __init__.py for the licence terms for this software. """ Run the stats package as if it were an executable module. Usage: $ python3 -m stats [options] Options: -h --help Print this help text. -V --version Print the ...
mit
Python
a26b56085598bed7afe7cfef43fd1e2547b3831d
Add script to generate TF-TRT model to be used for testing
tensorflow/tensorflow-pywrap_tf_optimizer,jhseu/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,Intel-tensorflow/tensorflow,sarvex/tensorflow,gunan/tensorflow,cxxgtxy/tensorflow,freedomtan/tensorflow,renyi533/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,petewarden/te...
tensorflow/python/compiler/tensorrt/test/testdata/gen_tftrt_model.py
tensorflow/python/compiler/tensorrt/test/testdata/gen_tftrt_model.py
# Copyright 2019 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
apache-2.0
Python
82761fcdce049ec0d8205a68c0899b8f03f0a38c
Add FileTree
coala-analyzer/coala-gui
source/support/FileTree.py
source/support/FileTree.py
import os from gi.repository import Gtk from gi.repository.GdkPixbuf import Pixbuf class FileTree(Gtk.TreeStore): def __init__(self, path): Gtk.TreeStore.__init__(self, str, Pixbuf, str) self.path = path self.populateFileTree(self.path) self.fileTreeView = Gtk.TreeView(self) ...
agpl-3.0
Python
f1e600ed5dfa8955af93c6ecd05d27cd8c63b2e0
Add migration
softwaresaved/fat,softwaresaved/fat,softwaresaved/fat,softwaresaved/fat
fat/migrations/0058_auto_20160808_1007.py
fat/migrations/0058_auto_20160808_1007.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.5 on 2016-08-08 10:07 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('fat', '0057_blog_reviewer'), ] operations = [ migrations.AddField( ...
bsd-3-clause
Python
fe3e90794c2f6ad2657dc1b02d71806d2d7dbfd0
Add base feed collection models
jasonthomas/zamboni,ingenioustechie/zamboni,jamesthechamp/zamboni,Hitechverma/zamboni,diox/zamboni,mozilla/zamboni,shahbaz17/zamboni,ddurst/zamboni,elysium001/zamboni,mudithkr/zamboni,Jobava/zamboni,clouserw/zamboni,Jobava/zamboni,shahbaz17/zamboni,shahbaz17/zamboni,ayushagrawal288/zamboni,jamesthechamp/zamboni,kumar30...
mkt/feed/models_base.py
mkt/feed/models_base.py
from django.db import models import amo.models from amo.decorators import use_master from amo.models import SlugField from addons.models import clean_slug from mkt.webapps.models import Webapp from mkt.webapps.tasks import index_webapps class BaseFeedCollectionMembership(amo.models.ModelBase): """ """ ...
bsd-3-clause
Python
4ffad6ba3804238b288be59c7e0fc33206f79ca4
Create ReaderAuthenticated.py
stoeps13/ibmcnx2,stoeps13/ibmcnx2
ibmcnx/config/j2ee/ReaderAuthenticated.py
ibmcnx/config/j2ee/ReaderAuthenticated.py
###### # Set Reader Roles to Restricted # no anonymous access possible # # Author: Christoph Stoettner # Blog: http://www.stoeps.de # E-Mail: # Documentation: http://scripting101.stoeps.de # # Version: 2.0 # Date: 2014-07-16 # # License: Apache 2.0 # # Description: # Script is tested wit...
apache-2.0
Python
d335496951e5979d9d8442369f47ca7c99f805e7
Introduce a very simple vim modeline parser.
pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments
pygments/modeline.py
pygments/modeline.py
# -*- coding: utf-8 -*- """ pygments.modeline ~~~~~~~~~~~~~~~~~ A simple modeline parser (based on pymodeline). :copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re __all__ = ['get_filetype_from_buffer'] modeline_re = re.compile...
bsd-2-clause
Python
27568f245f76aaf85f4a3db5b2a3486b37afd047
add scripts that converts smiles to graph object
snap-stanford/ogb
examples/graphproppred/mol/smiles2graph.py
examples/graphproppred/mol/smiles2graph.py
from ogb.utils.features import (allowable_features, atom_to_feature_vector, bond_to_feature_vector, atom_feature_vector_to_dict, bond_feature_vector_to_dict) from rdkit import Chem import numpy as np def mol_to_data_obj(smile_string): """ Converts SMILE string to graph Data object :input: SMILE string (s...
mit
Python
d967163ee3bdd2f86041cace5b6e3d859d471f4f
add sample length test
Turan-no/Turan,Turan-no/Turan,Turan-no/Turan,Turan-no/Turan
tests/samplelength.py
tests/samplelength.py
from turan.models import * eds = Exercise.objects.get(pk=3723).exercisedetail_set.all() a = {} previous = eds[0].time for e in eds: time_d = (e.time - previous).seconds if not time_d in a: a[time_d] = 0 a[time_d] += 1 previous = e.time
agpl-3.0
Python
ee0b02841427b8251d1ecb39a8b91c3bc033a400
Add first version of vertical dispersion fitting
lnls-fac/apsuite
generic_scripts/fit_vertical_dispersion.py
generic_scripts/fit_vertical_dispersion.py
"""Script to fit vertical dispersion with skew-quadrupoles."""" import numpy as np from mathphys.functions import load_pickle import pyaccel as pa from pymodels import si import siriuspy.clientconfigdb as servconf from apsuite.orbcorr import OrbRespmat from apsuite.optics_analysis.tune_correction import TuneCorr d...
mit
Python
17cc4de3c0d6b7e3c843085a1f7f6694930a7e84
Add Graham's Scan in Python
Deepak345/al-go-rithms,manikTharaka/al-go-rithms,Cnidarias/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,manikTharaka/al-go-rithms,Deepak345/al-go-rithms,ZoranPandovski/al-go-rithms,Cnidarias/al-go-rithms,ZoranPandovski/al-go-rithms,manikTharaka/al-go-rithms,ZoranPandovski/al-go-rithms,Deepak345/...
geometry/graham_scan/python/graham_scan.py
geometry/graham_scan/python/graham_scan.py
#!/usr/bin/env python import Tkinter as tk from random import random def make_a_right_turn(a, b, c): """Going from a to b to c involves a right turn?""" u = (c[0] - b[0], c[1] - b[1]) v = (a[0] - b[0], a[1] - b[1]) cross_product = u[0] * v[1] - u[1] * v[0] return cross_product < 0 def graham_s...
cc0-1.0
Python
a9515ca8738520a9b963b74c509b3c32761528df
test convert
embali/imgpy
tests/test_convert.py
tests/test_convert.py
from tempfile import TemporaryFile import pytest from imgpy import Img @pytest.mark.parametrize('image', ({ 'sub': 'anima/bordered.gif', 'res': ('P', 38) }, { 'sub': 'anima/clear.gif', 'res': ('P', 12) }, { 'sub': 'fixed/bordered.jpg', 'res': ('L', 1) }, { 'sub': 'fixed/clear.jpg', '...
mit
Python
c4de706925684bac2b540bef0b54f72821d0fdc8
Add test that would have caught #135
mwclient/mwclient,ubibene/mwclient
tests/test_listing.py
tests/test_listing.py
# encoding=utf-8 from __future__ import print_function import unittest import pytest import logging import requests import responses import mock import mwclient from mwclient.listing import List, GeneratorList try: import json except ImportError: import simplejson as json if __name__ == "__main__": print...
mit
Python
7ff804bb10b945d38e8ce98f176abcbe4255f65c
Test subdict
nvander1/skrt
tests/test_subdict.py
tests/test_subdict.py
from nose.tools import raises from skrt.utils import subdict @raises(KeyError) def test_missing_key(): dict_ = {'a': 1, 'b': 2, 'c': 3, 'd': 4} subdict_ = subdict(['e'], dict_) def test_subdict(): dict_ = {'a': 1, 'b': 2, 'c': 3, 'd': 4} assert subdict(['a', 'c'], dict_) == {'c': 3, 'a': 1}
mit
Python
d9780fc7151a719b9cbd88622b6c2868eaa64d34
Add tasks to manage system services
vmalavolta/fabix
fabix/system.py
fabix/system.py
from cuisine import upstart_ensure from fabric.api import sudo from fabric.decorators import task @task def restart_service(service, force_start=True): if force_start: upstart_ensure(service) else: sudo('service {0} restart').format(service)) @task def reload_service(service): sudo('servi...
mit
Python
8e687ab4f85561e31e4da06d89e9505179abc127
Modify the example of vgpu white_list set
openstack/nova,mikalstill/nova,mahak/nova,openstack/nova,klmitch/nova,gooddata/openstack-nova,klmitch/nova,mikalstill/nova,gooddata/openstack-nova,phenoxim/nova,rahulunair/nova,klmitch/nova,phenoxim/nova,mikalstill/nova,openstack/nova,mahak/nova,rahulunair/nova,rahulunair/nova,gooddata/openstack-nova,klmitch/nova,mahak...
nova/conf/devices.py
nova/conf/devices.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
# 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 # d...
apache-2.0
Python
215bef9d71097a18ad5ee6f20232a08ba88e9983
Create example1.py
intelidomo/rpi_snippets
stepper_motor/example1.py
stepper_motor/example1.py
from stepper_motor import StepperMotor # Instance the motor supplying GPIO ports # Instancia al motor indicando los puertos GPIO a los que está conectado motor = StepperMotor(12,16,20,21) # Go 100 steps forward # Avanza 100 pasos a la derecha motor.goForward(100) # Go 150 steps backwards # Avanza 150 pasos a la izqu...
mit
Python
1d311f7e53ac1081d801e902d8cb1d9a0ad8d1ec
Add test for iteration loop bytecode generation
ytanay/thinglang,ytanay/thinglang,ytanay/thinglang,ytanay/thinglang
tests/compiler/test_loop_compilation.py
tests/compiler/test_loop_compilation.py
from tests.compiler import compile_local, LST_ID, IMPLICIT_ITERATOR_ID, IMPLICIT_ITERATION_ID from thinglang.compiler.opcodes import OpcodePushLocal, OpcodeCallInternal, OpcodePopLocal, OpcodeJumpConditional, \ OpcodeJump from thinglang.foundation.definitions import INTERNAL_TYPE_ORDERING from thinglang.lexer.value...
mit
Python
bd2e55e3e8d4c7c2e9af3aa43dff209a98fbf3d5
test pabot suiten names io
mkorpela/pabot,mkorpela/pabot
tests/test_pabotsuitenames_io.py
tests/test_pabotsuitenames_io.py
import os import shutil import stat import subprocess import sys import tempfile import textwrap import unittest from pabot import pabot class TestPabotSuiteNamesIO(unittest.TestCase): def setUp(self): self.tmpdir = tempfile.mkdtemp() robot_file = open('{}/test.robot'.format(self.tmpdir), 'w') ...
apache-2.0
Python
0222cfe6555074cee63fd30dbd419efbfd0274b3
add prof perf test
JensTimmerman/radical.pilot,JensTimmerman/radical.pilot,JensTimmerman/radical.pilot,JensTimmerman/radical.pilot
tests/test_profile_writer.py
tests/test_profile_writer.py
#!/usr/bin/env python import os import csv import time import threading AGENT_THREADS = 'threads' AGENT_MODE = AGENT_THREADS profile_agent = True # ------------------------------------------------------------------------------ # timestamp_zero = float(os.environ.get('TIME_ZERO', time.time())) def timestamp_no...
mit
Python
7c609188df1ef457440543beb9dc4dbf286abd87
Add some source cache tests.
girder/large_image,girder/large_image,girder/large_image
test/test_cache_source.py
test/test_cache_source.py
import pytest import large_image from large_image.cache_util import cachesClear from .datastore import datastore @pytest.mark.singular def testCacheSourceStyle(): cachesClear() imagePath = datastore.fetch('sample_image.ptif') ts1 = large_image.open(imagePath) ts2 = large_image.open(imagePath, style=...
apache-2.0
Python
5d58788f75a7334def3dc5a2471c9e0ed2893589
Test ConfigItem created in __init__ goes to parent
lhupfeldt/multiconf
test/item_in_init_test.py
test/item_in_init_test.py
# Copyright (c) 2012 Lars Hupfeldt Nielsen, Hupfeldt IT # All rights reserved. This work is under a BSD license, see LICENSE.TXT. from multiconf import mc_config, ConfigItem from multiconf.envs import EnvFactory ef = EnvFactory() prod = ef.Env('prod') def test_item_in_init_goes_to_parent(): parent = [None] ...
bsd-3-clause
Python
2b8b1f80febc621e64c5bfcd0adcc6e5e0d5fa07
add rss module base
p22co/edaemon,p22co/edaemon,paulsnar/edaemon,paulsnar/edaemon,p22co/edaemon,paulsnar/edaemon
vendor/edaemon/rss.py
vendor/edaemon/rss.py
from flask import Blueprint, Response bp = Blueprint('rss', __name__)
bsd-3-clause
Python
54844ebf6903cdbac108cda01e2bd5e3962edaa4
Add registration unit test
wjchen84/lfd,rll/lfd,wjchen84/lfd,rll/lfd,wjchen84/lfd,rll/lfd
test/test_registration.py
test/test_registration.py
#!/usr/bin/env python from __future__ import division import numpy as np from core.demonstration import Demonstration, SceneState from registration.registration import TpsRpmRegistrationFactory from registration import solver, solver_gpu from tempfile import mkdtemp import sys, time import unittest class TestRegistr...
bsd-2-clause
Python
12616c6cf3957d9d7b3e20fa20d7d597d5b3cc6e
Add validator to import_series
v17al/Flexget,xfouloux/Flexget,oxc/Flexget,LynxyssCZ/Flexget,X-dark/Flexget,Flexget/Flexget,X-dark/Flexget,jawilson/Flexget,dsemi/Flexget,lildadou/Flexget,tvcsantos/Flexget,malkavi/Flexget,qvazzler/Flexget,ratoaq2/Flexget,cvium/Flexget,Flexget/Flexget,qvazzler/Flexget,tsnoam/Flexget,X-dark/Flexget,patsissons/Flexget,to...
flexget/plugins/plugin_import_series.py
flexget/plugins/plugin_import_series.py
from flexget.plugin import register_plugin, get_plugin_by_name, get_plugins_by_event, PluginError from flexget.plugins.filter_series import FilterSeriesBase import logging log = logging.getLogger('imp_series') class ImportSeries(FilterSeriesBase): """Generates series configuration from any input (supporting API...
from flexget.plugin import register_plugin, get_plugin_by_name, PluginError from flexget.plugins.filter_series import FilterSeriesBase import logging log = logging.getLogger('imp_series') class ImportSeries(FilterSeriesBase): """Generates series configuration from any input (supporting API version 2, soon all) ...
mit
Python
8618c68046487d475c077cb30070c9080cc4fbc7
Test prototype for WOA from a netCDF file.
castelao/oceansdb,castelao/pyWOA
tests/test_WOA_from_nc.py
tests/test_WOA_from_nc.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ """ from datetime import datetime from WOA.woa import WOA def test_import(): # A shortcut from WOA import WOA db = WOA() def test_available_vars(): db = WOA() for v in ['TEMP', 'PSAL']: assert v in db.keys() def test_get_pr...
bsd-3-clause
Python
2c8a867a810b0e7af6e14be7ed3a70a8fb134252
Add the py-vine package (#13857)
LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack
var/spack/repos/builtin/packages/py-vine/package.py
var/spack/repos/builtin/packages/py-vine/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 PyVine(PythonPackage): """Promises, promises, promises.""" homepage = "https://pypi.o...
lgpl-2.1
Python
a746c674747fe25bed4af2d56738cf5075d475ad
add integration test
alessandrod/twiggy,alessandrod/twiggy
tests/test_integration.py
tests/test_integration.py
import unittest import twiggy import StringIO import time from . import when def fake_gmtime(): return when class IntegrationTestCase(unittest.TestCase): def setUp(self): twiggy._populate_globals() twiggy.log._fields['time'] = fake_gmtime def tearDown(self): twiggy._del_glob...
bsd-3-clause
Python
82e186c25971008444e33c6b4924232d690b6d15
Add git diff python tool that outputs file:line in front of diff output.
dushu1203/chromium.src,anirudhSK/chromium,M4sse/chromium.src,hujiajie/pa-chromium,Chilledheart/chromium,timopulkkinen/BubbleFish,crosswalk-project/chromium-crosswalk-efl,mogoweb/chromium-crosswalk,rogerwang/chromium,Fireblend/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,zcbenz/cefode-chromium,zcbenz/cefo...
tools/git/git-diff-ide.py
tools/git/git-diff-ide.py
#!/usr/bin/env python # Copyright (c) 2012 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. """ Invokes git diff [args...] and inserts file:line in front of each line of diff output where possible. This is useful fro...
bsd-3-clause
Python
7593923070766f53a35d3c404523199f68accd3e
Implement tests for a new _config_file fixture
hackebrot/pytest-cookies
tests/test_user_config.py
tests/test_user_config.py
# -*- coding: utf-8 -*- def test_config(testdir): """Make sure that pytest accepts the `cookies` fixture.""" # create a temporary pytest test module testdir.makepyfile(""" import json def test_user_dir(tmpdir_factory, _config_file): basetemp = tmpdir_factory.getbasetemp() ...
mit
Python
4973cf7fda38168c8189d77ced2ee2a2c89cadfa
Add py solution for 605. Can Place Flowers
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
py/can-place-flowers.py
py/can-place-flowers.py
from itertools import groupby class Solution(object): def canPlaceFlowers(self, flowerbed, n): """ :type flowerbed: List[int] :type n: int :rtype: bool """ prev = None l = len(flowerbed) for i, f in enumerate(flowerbed): if f == 0: ...
apache-2.0
Python
5dc2ad1bf129ba2b4f77602678f8e62d26d132a9
Add new utility script to add sample feeds as files
flacerdk/smoke-signal,flacerdk/smoke-signal,flacerdk/smoke-signal
utils/add_sample_feeds.py
utils/add_sample_feeds.py
from smoke_signal import app, init_db from smoke_signal.database.helpers import add_feed from utils.generate_feed import SampleFeed from os import walk feeds_dir = app.root_path + "/test_resources/feeds/" app.config['DATABASE_PATH'] = 'sqlite:///smoke_signal/test_resources/posts.db' def create_sample_feed_files(nu...
mit
Python
d8968cd7697fd165194e6692e9322e7992564323
Add xor_gate
yukihirai0505/tutorial-program,yukihirai0505/tutorial-program,yukihirai0505/tutorial-program,yukihirai0505/tutorial-program,yukihirai0505/tutorial-program,yukihirai0505/tutorial-program,yukihirai0505/tutorial-program,yukihirai0505/tutorial-program,yukihirai0505/tutorial-program
python/ch02/xor_gate.py
python/ch02/xor_gate.py
from ch02.and_gate02 import AND from ch02.nand_gate import NAND from ch02.or_gate import OR def XOR(x1, x2): s1 = NAND(x1, x2) s2 = OR(x1, x2) return AND(s1, s2) if __name__ == '__main__': for xs in [(0, 0), (1, 0), (0, 1), (1, 1)]: y = XOR(xs[0], xs[1]) print(str(xs) + " -> " + str(...
mit
Python
399568bbb0c88b2aa3919ac3552483a9dd8f01ab
Add an example that uses the interators
Vector35/binaryninja-api,Vector35/binaryninja-api,joshwatson/binaryninja-api,Vector35/binaryninja-api,Vector35/binaryninja-api,joshwatson/binaryninja-api,joshwatson/binaryninja-api,joshwatson/binaryninja-api,Vector35/binaryninja-api,joshwatson/binaryninja-api,Vector35/binaryninja-api,Vector35/binaryninja-api
python/examples/instruction-iterator.py
python/examples/instruction-iterator.py
#!/usr/bin/env python import sys try: import binaryninja except ImportError: sys.path.append("/Applications/Binary Ninja.app/Contents/Resources/python/") import binaryninja import time if sys.platform.lower().startswith("linux"): bintype="ELF" elif sys.platform.lower() == "darwin": bintype="Mach-O" else...
mit
Python
3474dd5d406b47c6d29e296b3c2f0fe622e4d7ba
Create new package. (#6595)
mfherbst/spack,EmreAtes/spack,iulian787/spack,mfherbst/spack,matthiasdiener/spack,tmerrick1/spack,mfherbst/spack,LLNL/spack,krafczyk/spack,EmreAtes/spack,mfherbst/spack,matthiasdiener/spack,tmerrick1/spack,tmerrick1/spack,matthiasdiener/spack,LLNL/spack,LLNL/spack,iulian787/spack,tmerrick1/spack,LLNL/spack,mfherbst/spa...
var/spack/repos/builtin/packages/r-tidycensus/package.py
var/spack/repos/builtin/packages/r-tidycensus/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
2d1d7630cb0d74e18fd9ca359569069a841acae6
Create intent_bifuz.py
Android-leak/bifuz,fuzzing/bifuz,Android-leak/bifuz,fuzzing/bifuz,fuzzing/bifuz,Android-leak/bifuz,Android-leak/bifuz,fuzzing/bifuz
intent_bifuz.py
intent_bifuz.py
#!/usr/bin/env python # Intent bifuz. # # Copyright (C) 2015 Intel Corporation # Author: Andreea Brindusa Proca <andreea.brindusa.proca@intel.com> # Author: Razvan-Costin Ionescu <razvan.ionescu@intel.com> # # Licensed under the MIT license, see COPYING.MIT for details import os, sys import re import pprint import ra...
mit
Python
467ffbc0b15a290eb20f5971ba0fca6aea0dc6f4
add handler for application v43 with preliminary fields
funginstitute/patentprocessor,nikken1/patentprocessor,nikken1/patentprocessor,funginstitute/patentprocessor,yngcan/patentprocessor,yngcan/patentprocessor,funginstitute/patentprocessor,nikken1/patentprocessor,yngcan/patentprocessor
lib/handlers/application_handler_v43.py
lib/handlers/application_handler_v43.py
#!/usr/bin/env python """ Uses the extended ContentHandler from xml_driver to extract the needed fields from patent grant documents """ from cStringIO import StringIO from datetime import datetime from unidecode import unidecode from handler import Patobj, PatentHandler import re import uuid import xml.sax import xml...
bsd-2-clause
Python
6b2a84f1199615b09e1a14210302a814730869ed
Solve quicksort2
rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank
python/quicksort2.py
python/quicksort2.py
def print_arr(arr): print(" ".join(map(str, arr))) def divide(arr, pivot_i=0): if len(arr) <= 1: return arr pivot = arr[pivot_i] left = [] right = [] for i in arr: if i < pivot: left.append(i) elif i > pivot: right.append(i) sorted_ar...
mit
Python
d4f3e8a4c18fa21cb00af85dac3955f79ae5f886
Add gcps command
brendan-ward/rasterio,brendan-ward/rasterio,brendan-ward/rasterio
rasterio/rio/gcps.py
rasterio/rio/gcps.py
"""Command access to dataset metadata, stats, and more.""" import json import click from cligj import ( compact_opt, use_rs_opt, geojson_type_collection_opt, geojson_type_feature_opt, projection_geographic_opt, projection_projected_opt, precision_opt, indent_opt) import rasterio import rasterio.crs from...
bsd-3-clause
Python
fdc403cb477d6dbadd4b7b744f5107465c8ce697
Add _compat module
Xion/recursely
recursely/_compat.py
recursely/_compat.py
""" Compatibility shims for different Python versions and platforms. """ import sys IS_PY3 = sys.version_info[0] == 3 class metaclass(object): """Decorator for creating a class through a metaclass. Unlike ``__metaclass__`` attribute from Python 2, or ``metaclass=`` keyword argument from Python 3, the ``@...
bsd-2-clause
Python
e868f47852ee814975861c61167b82243dc310ad
add script for extracting a list of translators from the .po files
gogobook/wagtail,gasman/wagtail,rsalmaso/wagtail,wagtail/wagtail,nealtodd/wagtail,chrxr/wagtail,rsalmaso/wagtail,quru/wagtail,rsalmaso/wagtail,nilnvoid/wagtail,davecranwell/wagtail,quru/wagtail,kurtrwall/wagtail,nealtodd/wagtail,davecranwell/wagtail,mixxorz/wagtail,timorieber/wagtail,wagtail/wagtail,mikedingjan/wagtail...
scripts/get-translator-credits.py
scripts/get-translator-credits.py
import subprocess import re from collections import defaultdict authors_by_locale = defaultdict(set) file_listing = subprocess.Popen('find ../wagtail -iname *.po', shell=True, stdout=subprocess.PIPE) for file_listing_line in file_listing.stdout: filename = file_listing_line.strip() # extract locale string f...
bsd-3-clause
Python
214c81265db7dc23a805717126fad6f97d391fe8
Add marker for 105 error
Facenapalm/NapalmBot
scripts/markers/mark_error_105.py
scripts/markers/mark_error_105.py
"""Marks all fixed errors #105 on ruwiki's CheckWikipedia.""" import re import pywikibot from checkwiki import load_page_list, mark_error_done, log NUMBER = "105" def main(): """Main script function.""" site = pywikibot.Site() for pagename in load_page_list(NUMBER): page = pywikibot.Page(site, pag...
mit
Python
2ea6920a498dcc2dee4c1b7d7dc5e454f8071aa8
Add DeliveryBox table tests.
LegionXI/pydarkstar,AdamGagorik/pydarkstar
tests/tables/delivery_box.py
tests/tables/delivery_box.py
""" .. moduleauthor:: Adam Gagorik <adam.gagorik@gmail.com> """ import unittest import pydarkstar.logutils import pydarkstar.tables.delivery_box pydarkstar.logutils.setDebug() class TestDeliveryBox(unittest.TestCase): def test_init(self): pydarkstar.tables.delivery_box.DeliveryBox() if __name__ == '__mai...
mit
Python
7a669705a4870f04dfee620f24fb98d60b31b901
add initial skeleton for carpenter tests
IanDCarroll/xox
tests/test_carpenter_shop.py
tests/test_carpenter_shop.py
import unittest from source.carpenter_shop import * class CarpenterTestCase(unittest.TestCase): def setUp(self): pass def test_something(self): pass
mit
Python
052a176e0c3b38dc9390edc66b7ca3125106bead
add a new test case TestImport_01
alphatwirl/alphatwirl,alphatwirl/alphatwirl,TaiSakuma/AlphaTwirl,TaiSakuma/AlphaTwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl
tests/unit/test_Import_01.py
tests/unit/test_Import_01.py
import AlphaTwirl import unittest import inspect ##__________________________________________________________________|| hasPandas = False try: import pandas hasPandas = True except ImportError: pass ##__________________________________________________________________|| hasROOT = False try: import ROO...
bsd-3-clause
Python
d438f1e54743b64eb0d6518df0f90956711568a6
Add trace api module.
jagguli/intellij-community,fitermay/intellij-community,fitermay/intellij-community,mglukhikh/intellij-community,vvv1559/intellij-community,slisson/intellij-community,apixandru/intellij-community,fengbaicanhe/intellij-community,kdwink/intellij-community,ThiagoGarciaAlves/intellij-community,mglukhikh/intellij-community,n...
python/helpers/pydev/pydevd_trace_api.py
python/helpers/pydev/pydevd_trace_api.py
def add_line_breakpoint(plugin, pydb, type, file, line, condition, expression, func_name): return None def add_exception_breakpoint(plugin, pydb, type, exception): return False def remove_exception_breakpoint(plugin, pydb, type, exception): return False def get_breakpoints(plugin, pydb): return None ...
apache-2.0
Python
ac39bd6abfaf715ed30f5836cc3021fa87dccae7
Add tests for dtypes.py
aleju/imgaug,aleju/ImageAugmenter,aleju/imgaug
test/test_dtypes.py
test/test_dtypes.py
from __future__ import print_function, division, absolute_import import time import matplotlib matplotlib.use('Agg') # fix execution of tests involving matplotlib on travis import numpy as np from imgaug import dtypes as iadt def main(): time_start = time.time() test_copy_dtypes_for_restore() time_e...
mit
Python
579b73cbeeddbba66e5fa0d9026a8a94036de0b0
Make sure that CacheDir() works even when timestamp signatures are used.
azatoth/scons,azatoth/scons,azatoth/scons,azatoth/scons,azatoth/scons
test/CacheDir/timestamp.py
test/CacheDir/timestamp.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
ad96a3c1269f5615ad22b02620e1da7dfc02b9e3
Add filtering by CIV equivalent width
sbird/fake_spectra,sbird/fake_spectra,sbird/fake_spectra
civspectra.py
civspectra.py
# -*- coding: utf-8 -*- """Class to gather and analyse various metal line statistics""" import numpy as np import hdfsim import spectra class CIVSpectra(spectra.Spectra): """Generate metal line spectra from simulation snapshot""" def __init__(self,num, base, numlos=5000, res = 1., cdir = None, thresh=0.05, sa...
mit
Python
857b962e4a0e2209ff50508783b6856b6dd689d6
Test object loader
alexandermendes/pybossa-analyst,LibCrowds/libcrowds-analyst,alexandermendes/pybossa-analyst,alexandermendes/pybossa-analyst
test/test_object_loader.py
test/test_object_loader.py
# -*- coding: utf8 -*- """Test the object loader module for libcrowds-analyst.""" from libcrowds_analyst import object_loader class TestObjectLoader(object): def test_correct_objects_are_loaded(self, result): """Test that objects are loaded.""" func = lambda **x: [result] object_list = o...
unknown
Python
c8fc95cfe4dc8d8d5956b4e1cce994c3350eca8b
add plugins_redis
yixuanzi/blackmoon
plugins/exploit/plugin_redis.py
plugins/exploit/plugin_redis.py
#!/usr/bin/env python # -*- coding:utf-8 -*- import socket import urlparse from bmplugin import * info={'desc':"redis unauth vulns and get a shell", 'cve':'', 'link':"https://www.sebug.net/vuldb/ssvid-89715"} def init_plugin(main): active=main.maintive active.regcommand('redis',redis_act,"redis ...
apache-2.0
Python