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
78cc6be2243e1e41000f4ff214fe8edea391780c
Create mixcolumns.py
UCSBarchlab/PyRTL,nvandervoort/PyRTL,deekshadangwal/PyRTL,UCSBarchlab/PyRTL,nvandervoort/PyRTL,deekshadangwal/PyRTL
research/aes/mixcolumns.py
research/aes/mixcolumns.py
# mixcolumns.py import sys sys.path.append("../..") import pyrtl from pyrtl import * def MixColumns(in_vector): """ MixColumns round of AES. Input: A single wirevector of bitwidth 128. Output: A single wirevector of bitwidth 128. """ a0 = in_vector[120:128] a1 = in_vector[112:120] a2 = in_vector[104:112] a3...
bsd-3-clause
Python
cec17c0aaf794cdd108713642e0662c7eac7a020
Create cesarEncription.py
ferreiro/Python,ferreiro/Python-Introduction-SQL,ferreiro/Python,ferreiro/Python,ferreiro/Python-Introduction-SQL,ferreiro/Python-Introduction-SQL
assigment1/cesarEncription.py
assigment1/cesarEncription.py
# Chechinput: returns false is the inputed text # has any numeric character def checkInput(userInput): return userInput.isalpha() # CheckNumber: returns false is the inputed text # has any numeric character def checkNumber(userInput): return userInput.isdigit() def readMessage(): valid = False; message = '...
apache-2.0
Python
fc35e902e4a41176e1860b5a42fb5ce51c3042f7
Add scaleioutil
swevm/scaleio-py
scaleiopy/scaleioutil.py
scaleiopy/scaleioutil.py
import logging class ScaleIOLogger: instance = None @classmethod def get(cls): if cls.instance is None: cls.instance = cls() return cls.instance def __init__(self): # How to use: # loggerInstance = ScaleIOLogger.get() # logger = loggerInstance.get...
apache-2.0
Python
606b00e7f09e45e57cf6872c67db2d2af8aeff27
Add augeas module
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
salt/modules/augeas_cfg.py
salt/modules/augeas_cfg.py
''' Manages configuration files via augeas ''' def __virtual__(): ''' Only run this module if the augeas python module is installed ''' try: from augeas import Augeas _ = Augeas except ImportError: return False else: return "augeas" def _recurmatch(path, aug): '''...
apache-2.0
Python
156d635653e1ec93fbaff7ee7c872a5f6035f9a8
Add new-command.py to standard_commands
mnieber/dodo_commands
extra/standard_commands/new-command.py
extra/standard_commands/new-command.py
"""Finds a directory or file inside the current project.""" from . import DodoCommand from dodo_commands.framework.config import CommandPath import os import sys script_src = """# noqa from dodo_commands.default_commands.standard_commands import DodoCommand class Command(DodoCommand): # noqa help = "" decor...
mit
Python
421bd355cb3d471ac61d608c9e39cc821b06089f
Create analyzefiles.py
suzannerohrback/somaticCNVpipeline,suzannerohrback/somaticCNVpipeline
bin/interpret/analyzefiles.py
bin/interpret/analyzefiles.py
#!/usr/bin/python
mit
Python
4ec3cb1ddb08e14ba3c2ba169b4c5c47c779740a
Add new package: unuran (#8397)
mfherbst/spack,mfherbst/spack,LLNL/spack,iulian787/spack,tmerrick1/spack,LLNL/spack,iulian787/spack,krafczyk/spack,tmerrick1/spack,tmerrick1/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,krafczyk/spack,tmerrick1/spack,matthiasdiener/spack,matthiasdiener/spack,matthiasdiener/spack,krafczyk/spack,mfherbst/s...
var/spack/repos/builtin/packages/unuran/package.py
var/spack/repos/builtin/packages/unuran/package.py
############################################################################## # Copyright (c) 2013-2018, 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
f111f106722afd3929073f78d9c52fd4e1d804e1
add androcov_report script
nastya/droidbot,honeynet/droidbot,nastya/droidbot,lynnlyc/droidbot,honeynet/droidbot,nastya/droidbot,honeynet/droidbot,honeynet/droidbot,nastya/droidbot,lynnlyc/droidbot
evaluation_scripts/androcov_report.py
evaluation_scripts/androcov_report.py
# analyze androcov result # giving the instrumentation.json generated by androcov and the logcat generated at runtime __author__ = 'yuanchun' import os import re import json from datetime import datetime # logcat regex, which will match the log message generated by `adb logcat -v threadtime` LOGCAT_THREADTIME_RE = re.c...
mit
Python
ef62d0cca3f9f28cef6891b87da7b3d9e0ade953
Add stub file
robjwells/adventofcode-solutions,robjwells/adventofcode-solutions,robjwells/adventofcode-solutions,robjwells/adventofcode-solutions,robjwells/adventofcode-solutions,robjwells/adventofcode-solutions
2018/python/2018_02.py
2018/python/2018_02.py
"""Advent of Code 2018 Day 2: Inventory Management System""" import aoc_common import pytest DAY = 2 if __name__ == '__main__': puzzle_input = aoc_common.load_puzzle_input(DAY)
mit
Python
d5b1dd851b87542ff215bc74f74e3b2e76fc5894
create traditional box score
jaebradley/nba_data
nba_data/data/traditional_box_score.py
nba_data/data/traditional_box_score.py
class TraditionalBoxScore: def __init__(self, seconds_played, field_goals_made, field_goal_attempted, three_point_field_goals_made, three_point_field_goal_attempted, free_throws_made, free_throws_attempted, offensive_rebounds, defensive_rebounds, assists, steals, b...
mit
Python
c87f42579826cf236953bc955d15a9cc98c67d05
Add Migration File this time.
ropable/statdev,xzzy/statdev,xzzy/statdev,brendanc-dpaw/statdev,parksandwildlife/statdev,ropable/statdev,parksandwildlife/statdev,xzzy/statdev,parksandwildlife/statdev,brendanc-dpaw/statdev
applications/migrations/0029_application_proposed_development_description.py
applications/migrations/0029_application_proposed_development_description.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.6 on 2017-03-30 05:56 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('applications', '0028_auto_20170329_1445'), ] operations = [ migrations.AddF...
apache-2.0
Python
609e143589d89b5be167914b70de99658776745f
add redirection test
persiaAziz/trafficserver,duke8253/trafficserver,reveller/trafficserver,reveller/trafficserver,SolidWallOfCode/trafficserver,clearswift/trafficserver,chenglongwei/trafficserver,pbchou/trafficserver,taoyunxing/trafficserver,rahmalik/trafficserver,rpufky/trafficserver,PSUdaemon/trafficserver,bryancall/trafficserver,duke82...
ci/new_tsqa/tests/test_redirection.py
ci/new_tsqa/tests/test_redirection.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may...
apache-2.0
Python
2d8b0266dc1bf0eadc2737d35844f5fb45bedd12
Add functional tests for loading by name
little-dude/nose2,ezigman/nose2,ojengwa/nose2,ptthiem/nose2,ptthiem/nose2,leth/nose2,leth/nose2,little-dude/nose2,ojengwa/nose2,ezigman/nose2
nose2/tests/functional/test_loading.py
nose2/tests/functional/test_loading.py
""" pkg1 pkg1.test pkg1.test.test_things pkg1.test.test_things.test_func pkg1.test.test_things.test_gen pkg1.test.test_things.test_gen:3 pkg1.test.test_things.SomeTests pkg1.test.test_things.SomeTests.test_ok # generator method # generator method index # param func # param func index # param method # param method ind...
bsd-2-clause
Python
0a610a44f0d20170ba9c3e6f9ec4eafaac937be1
Add unit test for Pattern filterer.
4degrees/mill,4degrees/sawmill
test/unit/filterer/test_pattern.py
test/unit/filterer/test_pattern.py
# :coding: utf-8 # :copyright: Copyright (c) 2013 Martin Pengelly-Phillips # :license: See LICENSE.txt. import pytest from bark.log import Log from bark.filterer.pattern import Pattern def test_missing_key_passes(): '''Test log record with missing key passes.''' log = Log() filterer = Pattern('bark\.tes...
apache-2.0
Python
ef65c5eefdcbb21b83504710e3131affbeb88c88
Create map-reduce-advanced-count-number-of-friends.py
fermin-silva/hackerrank,fermin-silva/hackerrank
databases/nosql_xml_mapreduce/map-reduce-advanced-count-number-of-friends.py
databases/nosql_xml_mapreduce/map-reduce-advanced-count-number-of-friends.py
import sys from collections import OrderedDict class MapReduce: def __init__(self): self.intermediate = OrderedDict() self.result = [] def emitIntermediate(self, key, value): self.intermediate.setdefault(key, []) self.intermediate[key].append(value) def emit(self, value):...
mit
Python
517cb7c66f28e977bf44b7013846f50af8f673fb
Create QiClient.py
osisoft/Qi-Samples,osisoft/Qi-Samples,osisoft/Qi-Samples,osisoft/Qi-Samples,osisoft/Qi-Samples,osisoft/Qi-Samples
Basic/Python/QiPy/Python2/QiClient.py
Basic/Python/QiPy/Python2/QiClient.py
apache-2.0
Python
1c1967e5a1e941ffa6a8f32d35269f333644cd98
Create 1.py
UCollegeChitkara/CryptoHacktober
solutions/1.py
solutions/1.py
CODE = {'A': '.-', 'B': '-...', 'C': '-.-.', 'D': '-..', 'E': '.', 'F': '..-.', 'G': '--.', 'H': '....', 'I': '..', 'J': '.---', 'K': '-.-', 'L': '.-..', 'M': '--', 'N': '-.', 'O': '---', 'P': '.--.', 'Q': '--.-', 'R': '.-.', 'S': '...', 'T': '-', 'U':...
mit
Python
4a7b60d47a20084867015490cc52f3c5967b979f
add test file
yeatmanlab/pyAFQ,yeatmanlab/pyAFQ,arokem/pyAFQ,arokem/pyAFQ
AFQ/utils/tests/test_conversions.py
AFQ/utils/tests/test_conversions.py
import numpy as np import numpy.testing as npt import AFQ.data as afd from AFQ.utils.conversion import matlab_tractography, matlab_mori_groups import os def test_matlab_tractography(): sft = matlab_tractography( "AFQ/tests/data/WholeBrainFG_test.mat", afd.read_mni_template()) npt.assert_equal...
bsd-2-clause
Python
c64a687f738cefd6f9461f487e76a3920d0f652c
Add new example
eandersson/amqpstorm,eandersson/amqpstorm,eandersson/amqp-storm
examples/consume_queue_until_empty.py
examples/consume_queue_until_empty.py
import logging from amqpstorm import Connection logging.basicConfig(level=logging.DEBUG) def consume_until_queue_is_empty(): with Connection('127.0.0.1', 'guest', 'guest') as connection: with connection.channel() as channel: while True: message = channel.basic.get('simple_que...
mit
Python
f09ee3772d6e15a104af284ed6864005cf8450ef
Add example from listing 11.4
oysstu/pyopencl-in-action
ch11/radix_sort8.py
ch11/radix_sort8.py
""" Listing 11.4: An eight-element radix sort """ from io import open import numpy as np import pyopencl as cl import utility NUM_SHORTS = 8 kernel_src = ''' __kernel void radix_sort8(__global ushort8 *global_data) { typedef union { ushort8 vec; ushort array[8]; } vec_array; uint one_count, ze...
mit
Python
75a0cbbd5af597c6683b6644659780c3076b835e
Disable test_nonlocal_symbol unit test
tensorflow/tensorflow-experimental_link_static_libraries_once,freedomtan/tensorflow,arborh/tensorflow,sarvex/tensorflow,annarev/tensorflow,gautam1858/tensorflow,gautam1858/tensorflow,gunan/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,arborh/tensorflow,frreiss/tensorflow-fred,davidzchen/tenso...
tensorflow/python/autograph/pyct/static_analysis/activity_py3_test.py
tensorflow/python/autograph/pyct/static_analysis/activity_py3_test.py
# python3 # Copyright 2017 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 ...
# python3 # Copyright 2017 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 ...
apache-2.0
Python
f5271083eb9f90fba51bea91126d5eb7005f7c51
add script to delete webhooks
Ziggeo/ZiggeoPythonSdk,Ziggeo/ZiggeoPythonSdk
demos/webhooks_delete.py
demos/webhooks_delete.py
import sys from Ziggeo import Ziggeo if(len(sys.argv) < 4): print ("Error\n") print ("Usage: $>python webhooks_delete.py YOUR_API_TOKEN YOUR_PRIVATE_KEY WEBHOOK_URL \n") print ("Example: $>python webhooks_delete.py 1234567890abcdef 1234567890abcdef http://yoursite.com \n") sys.exit() api_token = sys....
apache-2.0
Python
bbf056f834724a263dbce5c58104db296240a49c
add gyp file
ContinuumIO/tty.js,clementfarabet/gfx.js,recomputation/tty.js,IonicaBizau/web-term,mannby/gfx.js,jwcooper/tty.js,callmeyan/tty.js,weebygames/tty.js,Stackato-Apps/tty.js,meteora9479/gfx.js,mannby/gfx.js,jsio-private/tty.js,clementfarabet/gfx.js,mabel/tty.js,node-proj/tty.js,hooray-hjh/triggerTest,risacher/ttyx,runvnc/tt...
pty.gyp
pty.gyp
{ 'targets': [{ 'target_name': 'pty', 'type': 'loadable_module', 'product_extension': 'node', 'product_prefix': '', 'include_dirs': [ './src' ], 'sources': [ 'src/pty.cc' ], 'libraries': [ '-lutil' ] }] }
mit
Python
d98db37dc70a1126de371bf64e89cc4f20e03511
Create repr.py
akshaynagpal/python_snippets,akshaynagpal/python_web_crawler
repr.py
repr.py
""" One useful class method to override is the built-in __repr__() method, which is short for representation; by providing a return value in this method, we can tell Python how to represent an object of our class """ class Point3D(object): def __init__(self,x,y,z): self.x = x self.y = y sel...
mit
Python
e7faa99d9816745338ada38d1a7d974bf3a739ae
Create pretty table of tie averages + function for pretty averages
alexmilesyounger/ds_basics
s5v3.py
s5v3.py
from s5v2 import * from prettytable import PrettyTable def my_table(): # no arguments are passed in, which seems a bit weird. We're hard-coding a function that only does one thing. x = PrettyTable(['Style', 'Average Price']) # setup a new pretty table list and give and give it two list items x.add_row(['Print', pret...
mit
Python
dd9c96c7b12221029b7ea1a4f9748106520bd7a6
add syntax checker/linter/gotype support
dlclark/GoSublime,alexmullins/GoSublime,Mistobaan/GoSublime,FWennerdahl/GoSublime,cdht/GoSublime,DisposaBoy/GoSublime-next,anacrolix/GoSublime,justinfx/GoSublime,FWennerdahl/GoSublime,allgeek/GoSublime,Mistobaan/GoSublime,DisposaBoy/GoSublime-next,simman/GoSublime,alexmullins/GoSublime,allgeek/GoSublime,cdht/GoSublime,...
gslint.py
gslint.py
import sublime, sublime_plugin import gscommon as gs import re, threading LINE_PAT = re.compile(r':(\d+):(\d+):\s+(.+)\s*$', re.MULTILINE) class GsLint(sublime_plugin.EventListener): rc = 0 errors = {} def on_selection_modified(self, view): sel = view.sel()[0].begin() if view.score_select...
mit
Python
0e681d5b5e0d23517a6f050d168e1e86de9eb074
Add unit test for utils.termcolor (closes #4)
RootForum/magrathea,RootForum/magrathea
test/t_utils/test_termcolor.py
test/t_utils/test_termcolor.py
# -*- coding: utf-8 -*- """ test.t_utils.test_termcolor ~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: Copyright 2014 by the RootForum.org team, see AUTHORS. :license: MIT License, see LICENSE for details. """ from unittest import TestCase from magrathea.utils.termcolor import supports_color class TestMagra...
mit
Python
9b2166c62b312baf7769279ca56b02eca3ea0078
check host smallRNA end point
shengqh/ngsperl,shengqh/ngsperl,shengqh/ngsperl,shengqh/ngsperl
lib/SmallRNA/smallRNAEndPosition.py
lib/SmallRNA/smallRNAEndPosition.py
import sys import gzip import os import logging import argparse import re from Bio import SeqIO from Bio.Seq import Seq from CountXmlUtils import readCountXmlFeatures from Feature import FeatureItem, FeatureGroup from audioop import reverse DEBUG = 1 if DEBUG: #inputFile="/scratch/cqs/shengq2/vickers...
apache-2.0
Python
6aa2621afd8253036834f48da6562c25deed54ec
Add tests
jasontbradshaw/gapbuffer
test_pe.py
test_pe.py
#!/usr/bin/env python import unittest import pe class TestGapBuffer(unittest.TestCase): def setUp(self): # correct content for each typecode self.valid_content = { "c": str("abc"), "b": [0, 1, 2], "B": [0, 1, 2], "u": unicode("abc"), "h":...
mit
Python
a48c52ccb6e89edbc186e4e916b8151ff0fa232f
Add an admin
kronok/django-sendgrid-events,rorito/django-sendgrid-events,digital-eskimo/django-sendgrid-events,eldarion/django-sendgrid-events
sendgrid_events/admin.py
sendgrid_events/admin.py
from django.contrib import admin from .models import Event admin.site.register(Event, list_display=["kind", "email", "created_at"], list_filter=["created_at", "kind"], search_fields=["email", "data"])
bsd-3-clause
Python
ad59ee2bce3e0de3e6fce9647a0ae7faa33e6135
Create testGame.py
joaofanti/TrabRedesIIFinal
Testes/testGame.py
Testes/testGame.py
import sys # Adicionar o caminho do MAP FACTORY sys.path.insert(0, '../Modelos/') sys.path.insert(0, '../Modelos/Mapa/') from Game import * from Map import * from MapFactory import * import json """ Metodo principal para rodar o cliente """ if __name__ == "__main__": fct = MapFactory() with open('../Recursos/M...
mit
Python
3a7459f0f9e171954eb1f86a9e320ef889b9d1a5
Tidy up and en-repo my little monitor
Rosuav/shed,Rosuav/shed,Rosuav/shed,Rosuav/shed,Rosuav/shed
watch_emotes.py
watch_emotes.py
import sys import time import pprint import subprocess import requests sys.path.append("../mustard-mine") import config emote_count = None while emote_count is None or emote_count == len(emotes): req = requests.get("https://api.twitch.tv/kraken/chat/emoticon_images?emotesets=317117,317121,317122", headers={...
mit
Python
5e5e74e606d9be3c60fb810ed215dfa109a6ad9f
fix #5 wavファイルを生成する処理を行うクラスを定義
000ubird/HighResolution
libs/audio/create.py
libs/audio/create.py
import wave import struct from pylab import * """ 振幅amp、基本周波数frq、サンプリング周波数 fs、 ビット深度bit_depthbit、長さlength秒の正弦波を作成して返す """ def createSineWave(amp, frq, fs, bit_depth, length) : data = [] clip_hi = 1.0 clip_lo = -1.0 #正規化した波を整数値に変換する時の倍率 mult_bit = 0 if bit_depth == 16 : mult_bit = 32767.0 ...
mit
Python
acda4ae5deff6b45f56b84cdecb867a09586af4a
Add lc295_find_median_from_data_stream.py
bowen0701/algorithms_data_structures
lc295_find_median_from_data_stream.py
lc295_find_median_from_data_stream.py
"""Leetcode 295. Find Median from Data Stream Hard URL: https://leetcode.com/problems/find-median-from-data-stream/ Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two middle value. For example, [2,3,4], the median i...
bsd-2-clause
Python
e2a47d1ef44aa6b0ccc294aae68babd8ca54eb22
Create search_log_files.py
joshisumit/pythonic_scripts
search_log_files.py
search_log_files.py
#!/usr/bin/env python import os.path #Author: Sumit Joshi #date:5/12/2015 # Log File Search Script # This Script is useful for searching specific keyword in log files. For specific keyword it returns matching lines. print "*******************************************************" print "" print "" print "Welcome to t...
mit
Python
ae90cf26caa471f85d7e5e20ef2e349b78183f41
make python2 wokr
ccxt/ccxt,ccxt/ccxt,ccxt/ccxt,ccxt/ccxt,ccxt/ccxt
python/static_dependencies/__init__.py
python/static_dependencies/__init__.py
__all__ = ['ecdsa']
mit
Python
54250baa4e2a34146506693b2da683ded2ee7cdb
add fake client ability that performs all required API calls
bboozzoo/mender-backend-cli
mender/cli/client.py
mender/cli/client.py
# The MIT License (MIT) # # Copyright (c) 2016 Gregorio Di Stefano # # 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, cop...
mit
Python
5dc22c0a30b2e326665f67df1d85cd2ae0243c00
Increase the sleep timeout to 4 seconds to prevent the main thread from quitting
komakino/plugin.video.pulsar,likeitneverwentaway/plugin.video.quasar,steeve/plugin.video.pulsar,peer23peer/plugin.video.quasar,peer23peer/plugin.video.quasar,pmphxs/plugin.video.pulsar,likeitneverwentaway/plugin.video.quasar,Zopieux/plugin.video.pulsar,johnnyslt/plugin.video.quasar,elrosti/plugin.video.pulsar,johnnyslt...
resources/site-packages/pulsar/main.py
resources/site-packages/pulsar/main.py
import threading import xbmc from pulsar.rpc import server_thread from pulsar.monitor import PulsarMonitor from pulsar.daemon import pulsard_thread def main(): # Make sure the XBMC jsonrpc server is started. xbmc.startServer(xbmc.SERVER_JSONRPCSERVER, True) # Start the JSONRPC thread threading.Thread...
import threading import xbmc from pulsar.rpc import server_thread from pulsar.monitor import PulsarMonitor from pulsar.daemon import pulsard_thread def main(): # Make sure the XBMC jsonrpc server is started. xbmc.startServer(xbmc.SERVER_JSONRPCSERVER, True) # Start the JSONRPC thread threading.Thread...
bsd-3-clause
Python
fe5100f5d13ed7461619c8beff791d40306f83ff
Remove annoying SQL view that prevents some operations
blaggacao/OpenUpgrade,kirca/OpenUpgrade,csrocha/OpenUpgrade,bwrsandman/OpenUpgrade,Endika/OpenUpgrade,grap/OpenUpgrade,bwrsandman/OpenUpgrade,pedrobaeza/OpenUpgrade,sebalix/OpenUpgrade,mvaled/OpenUpgrade,pedrobaeza/OpenUpgrade,OpenUpgrade/OpenUpgrade,sebalix/OpenUpgrade,OpenUpgrade/OpenUpgrade,mvaled/OpenUpgrade,blagga...
addons/document/migrations/8.0.2.1/pre-migration.py
addons/document/migrations/8.0.2.1/pre-migration.py
# -*- coding: utf-8 -*- ############################################################################## # # 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 # License...
agpl-3.0
Python
935115215259ce011f3f0b46781655119413e720
Add a directives file for pygments support.
btnpushnmunky/pelican,koobs/pelican,garbas/pelican,JeremyMorgan/pelican,jo-tham/pelican,lazycoder-ru/pelican,crmackay/pelican,iurisilvio/pelican,btnpushnmunky/pelican,TC01/pelican,douglaskastle/pelican,Summonee/pelican,51itclub/pelican,number5/pelican,koobs/pelican,levanhien8/pelican,florianjacob/pelican,zackw/pelican,...
pelican/rstdirectives.py
pelican/rstdirectives.py
# -*- coding: utf-8 -*- from docutils import nodes from docutils.parsers.rst import directives, Directive from pygments.formatters import HtmlFormatter from pygments import highlight from pygments.lexers import get_lexer_by_name, TextLexer INLINESTYLES = False DEFAULT = HtmlFormatter(noclasses=INLINESTYLES) VARIANTS =...
agpl-3.0
Python
1b22ec95ec7a659031e59b5a14d018028b29485b
Create hcf.py
ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovs...
math/highest_common_factor/cpp/hcf.py
math/highest_common_factor/cpp/hcf.py
#A python program to determine the highest common factor of positive integers only. def hcf(x, y): #set the highest common factor to 1 hcf = 1 #To check if one of the number is divisible by the other if x % y == 0: return y #iterate within half the range of one of the ...
cc0-1.0
Python
3a6f724e7d31c1f42bfd426623dcaec3cdd642a8
add utils for multi gpus
stereoboy/object_detection,stereoboy/object_detection
multi_gpus.py
multi_gpus.py
import tensorflow as tf import numpy as np def average_gradients(tower_grads): """Calculate the average gradient for each shared variable across all towers. Note that this function provides a synchronization point across all towers. Args: tower_grads: List of lists of (gradient, variable) tuples. The outer...
mit
Python
a2ec630cde4e36cc391ac5eee560c8097c8ceab3
Copy in constants file from master
architecture-building-systems/CEAforArcGIS,architecture-building-systems/CEAforArcGIS
cea/technologies/constants.py
cea/technologies/constants.py
""" Constants used throughout the cea.technologies package. History lesson: This is a first step at removing the `cea.globalvars.GlobalVariables` object. """ # Heat Exchangers U_cool = 2500.0 # W/m2K U_heat = 2500.0 # W/m2K dT_heat = 5.0 # K - pinch delta at design conditions dT_cool = 2.0 # K - pinch delta a...
mit
Python
77b9961cbf6b4ce6d453bbc974b0c695308fdd83
add import script for Broxbourne (closes #1167)
DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations
polling_stations/apps/data_collection/management/commands/import_broxbourne.py
polling_stations/apps/data_collection/management/commands/import_broxbourne.py
from data_collection.management.commands import BaseDemocracyCountsCsvImporter class Command(BaseDemocracyCountsCsvImporter): council_id = 'E07000095' addresses_name = 'local.2018-05-03/Version 1/Democracy Club - Polling Districts-2018- Broxbourne.csv' stations_name = 'local.2018-05-03/Version 1/Democracy ...
bsd-3-clause
Python
e8e8c20422248fa4c394efbe1b8f04adbc006674
Add lc0111_minimum_depth_of_binary_tree.py
bowen0701/algorithms_data_structures
lc0111_minimum_depth_of_binary_tree.py
lc0111_minimum_depth_of_binary_tree.py
"""Leetcode 111. Minimum Depth of Binary Tree Easy URL: https://leetcode.com/problems/minimum-depth-of-binary-tree/ Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node. Note: A leaf is a node with no children....
bsd-2-clause
Python
312bbdefa256413b4891cd0e13e6ccf3c614541f
Add datetime header to Crank
jad-b/Crank
util.py
util.py
""" util === Common utilities across the Crank system. """ from datetime import datetime DATETIME_FORMAT = '%Y %b %d @ %H%M' def get_timestamp_header(): return datetime.now().strftime(DATETIME_FORMAT)
mit
Python
776efb9c76f29fa7e15066fa38d3fbb06f959e61
update 040.py
liuyang1/euler,liuyang1/euler,liuyang1/euler
040_1.py
040_1.py
#! /usr/bin/python # 得到数字n的第bit位(从左起) def getNbit(n, bit): return int(str(n)[bit]) def cham(n): t = thresh() while 1: low, high, bit = t.next() if n <= high: #若t<high,则为此区间内 offset = n - low # 本区间内的偏移量 num = offset / bit + pow(10, bit - 1) #...
mit
Python
a737acb0310c11618802ed8610cf8b7d3bafd543
Add Python EC2 example change_instance_security_groups.py
awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,a...
python/example_code/ec2/change_instance_security_groups.py
python/example_code/ec2/change_instance_security_groups.py
# snippet-comment:[These are tags for the AWS doc team's sample catalog. Do not remove.] # snippet-sourcedescription:[create_instance.py demonstrates how to create an Amazon EC2 instance.] # snippet-service:[ec2] # snippet-keyword:[Amazon Elastic Compute Cloud (Amazon EC2)] # snippet-keyword:[Python] # snippet-keyword:...
apache-2.0
Python
c94de10cc97a4e948e2cf35f7b29cdf20c11f2ab
Add poisson sphere benchmark
thomasgibson/firedrake-hybridization
convergence_tests/sphere_poisson.py
convergence_tests/sphere_poisson.py
from __future__ import absolute_import, division from firedrake import * import numpy as np def poisson_sphere(MeshClass, refinement, hdiv_space): """Test hybridizing lowest order mixed methods on a sphere.""" mesh = MeshClass(refinement_level=refinement) mesh.init_cell_orientations(Expression(("x[0]", "x...
mit
Python
e36e809699d387368d5c7edb478961c04692787f
Create BlockSelection.py
HeyIamJames/PyGames,HeyIamJames/PyGames
Documents/GitHub/BlockSelection.py
Documents/GitHub/BlockSelection.py
import pygame import random BLACK = ( 0, 0, 0) WHITE = (255, 255, 255) RED = (255, 0, 0) class Block(pygame.sprite.Sprite): def __init__(self, color, width, height): super(Block, self).__init__() self.image = pygame.Surface([width, height]) self.image.fill(color) self...
mit
Python
10c83fbc01dee9d95290466338f262abffc12a3e
Create a folder in a datacenter if not exists
vmware/pyvmomi-community-samples,pfitzer/pyvmomi-community-samples,jm66/pyvmomi-community-samples,ddcrjlalumiere/pyvmomi-community-samples,prziborowski/pyvmomi-community-samples,pathcl/pyvmomi-community-samples
samples/create_folder_in_datacenter.py
samples/create_folder_in_datacenter.py
#!/usr/bin/env python """ Written by Chinmaya Bharadwaj Github: https://github.com/chinmayb/ Email: acbharadwaj@gmail.com Create a folder in a datacenter """ from __future__ import print_function from pyVmomi import vim from pyVim.connect import SmartConnect, Disconnect import argparse import atexit import getpass ...
apache-2.0
Python
7a781a7cb9da6ab585f9b2ea72df991b4def19dd
Write entry/Preparations list test
iCHAIT/whats-fresh-api,osu-cass/whats-fresh-api,osu-cass/whats-fresh-api,iCHAIT/whats-fresh-api,osu-cass/whats-fresh-api,iCHAIT/whats-fresh-api,iCHAIT/whats-fresh-api,osu-cass/whats-fresh-api
whats_fresh/whats_fresh_api/tests/views/entry/test_list_preparations.py
whats_fresh/whats_fresh_api/tests/views/entry/test_list_preparations.py
from django.test import TestCase from django.core.urlresolvers import reverse from whats_fresh_api.models import * from django.contrib.gis.db import models import json class ListPreparationTestCase(TestCase): fixtures = ['test_fixtures'] def test_url_endpoint(self): url = reverse('entry-list-preparat...
apache-2.0
Python
e0344625a6a2b9640481622a12c4dd810f5ca4c5
merge overlapping pairs (set BQ to 0)
brentp/bwa-meth,brentp/bwa-meth,brentp/bwa-meth,dariober/bwa-meth,dariober/bwa-meth,dariober/bwa-meth,PeteHaitch/bwa-parclip,PeteHaitch/bwa-parclip,PeteHaitch/bwa-parclip
bam-merge-pairs.py
bam-merge-pairs.py
""" In order to avoid double counting of bases in overlapping paired end reads, this script accept mapped reads in SAM format, use the position to determine overlap, and set the lower base-quality of pair overlap to 0. It is assumed that the reads are name-sorted as when they come from the aligner. Usage: bwa mem...
mit
Python
6f9f87ec8fe3d19de7b995288fa799e36a5c50d5
add mont test
BarrelfishOS/barrelfish,kishoredbn/barrelfish,BarrelfishOS/barrelfish,BarrelfishOS/barrelfish,BarrelfishOS/barrelfish,BarrelfishOS/barrelfish,kishoredbn/barrelfish,kishoredbn/barrelfish,BarrelfishOS/barrelfish,BarrelfishOS/barrelfish,kishoredbn/barrelfish,kishoredbn/barrelfish,BarrelfishOS/barrelfish,kishoredbn/barrelf...
tools/harness/tests/tommath.py
tools/harness/tests/tommath.py
########################################################################## # Copyright (c) 2016, ETH Zurich. # All rights reserved. # # This file is distributed under the terms in the attached LICENSE file. # If you do not find this file, copies can be found by writing to: # ETH Zurich D-INFK, Universitaetsstrasse 4, C...
mit
Python
a26ba96db8ac3149e457f2eaab0ef55e2b68d4cb
add 114
ufjfeng/leetcode-jf-soln,ufjfeng/leetcode-jf-soln
python/114_flatten_binary_tree_to_linked_list.py
python/114_flatten_binary_tree_to_linked_list.py
""" Given a binary tree, flatten it to a linked list in-place. For example, Given 1 / \ 2 5 / \ \ 3 4 6 The flattened tree should look like: 1 \ 2 \ 3 \ 4 \ 5 \ 6 Hints: If yo...
mit
Python
85f67084f44419bf9d44439133314e6ffdadfea0
Introduce OvnNbctlDaemonContext
openvswitch/ovn-scale-test,openvswitch/ovn-scale-test
rally_ovs/plugins/ovs/context/ovnnbctl_daemon.py
rally_ovs/plugins/ovs/context/ovnnbctl_daemon.py
# Copyright 2020 Red Hat, 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 or agreed to in writing, ...
apache-2.0
Python
ce44189d905f783b3963ac71057fe201f52faf64
Add new sample
msysyamamoto/opencv-samples
detect_face/detect_face_video_swap.py
detect_face/detect_face_video_swap.py
# coding:utf-8 import cv2 cap = cv2.VideoCapture(0) cascade_path = "../opencv/data/haarcascades/haarcascade_frontalface_default.xml" cascade = cv2.CascadeClassifier(cascade_path) _response, frame = cap.read() minsize = (int(frame.shape[0] * 0.08), int(frame.shape[1] * 0.08)) while True: _response, frame = cap.re...
apache-2.0
Python
bbd732720fc25f5c47147c6f4c2c05ad1c180b35
Add api_subscribe_request.py
devicehive/devicehive-python
devicehive/api_subscribe_request.py
devicehive/api_subscribe_request.py
class ApiSubscribeRequest(object): """Api request class.""" def __init__(self, transport): self._transport = transport self._action = None self._request = {} self._params = {'method': 'GET', 'url': None, 'request_delete_keys': [], ...
apache-2.0
Python
f78a485000ef8dacb584db1f03b7157b79bd5fe7
Add module for mocking node.get() with Responses
DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python
d1_libclient_python/src/d1_client/tests/mock_get.py
d1_libclient_python/src/d1_client/tests/mock_get.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # This work was created by participants in the DataONE project, and is # jointly copyrighted by participating institutions in DataONE. For # more information on DataONE, see our web site at http://dataone.org. # # Copyright 2009-2016 DataONE # # Licensed under the Apache...
apache-2.0
Python
ae05372f0a2f4b152fc700593e9a2b99612c9d69
create tag models manager tags via slug
avelino/django-tags
tags/models.py
tags/models.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from django.db import models from django.utils.translation import ugettext_lazy as _ from django.template.defaultfilters import slugify class Tag(models.Model): name = models.CharField(_(u'Name'), max_length=150, unique=True, db_index=True)...
mit
Python
6e1d2ce723fbdf4f37147f1f1cb692c4fb705c12
handle cache file on disk
rlowrance/re-avm
Cache.py
Cache.py
'''maintain a pickled cache file on disk''' import cPickle as pickle import os import pdb import time import unittest if False: # example class Cache(object): pass def read_data(dictionary): 'return the data; it will be pickled and written to the file at path_to_cache' return None ...
bsd-3-clause
Python
0287d807b8b03e5adf30e95c53504378f0bb2f8d
Add basic implementation
boppreh/derivative
derivative.py
derivative.py
from __future__ import division class Dual(object): def __init__(self, a=0.0, b=0.0): self.a = a self.b = b def __add__(self, other): if isinstance(other, Dual): return Dual(self.a + other.a, self.b + other.b) else: return Dual(self.a + other, self.b) def __radd__(self, other): if isinstance(other...
mit
Python
8223e9ffa61a2772a7a6f52244c5f1bbde4956b8
Add py solution for 409. Longest Palindrome
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
py/longest-palindrome.py
py/longest-palindrome.py
from collections import Counter class Solution(object): def longestPalindrome(self, s): """ :type s: str :rtype: int """ counter = Counter(s) odd = 0 ans = 0 for char, cnt in counter.iteritems(): if cnt % 2 == 0: ans += cnt ...
apache-2.0
Python
6b06a383a6a306991a601f2a862e8b2bdfba1615
Add a test to check that advanced filters data is fetched
akvo/akvo-rsr,akvo/akvo-rsr,akvo/akvo-rsr,akvo/akvo-rsr
akvo/rsr/tests/deployed_code_tests.py
akvo/rsr/tests/deployed_code_tests.py
# -*- coding: utf-8 -*- # Akvo RSR is covered by the GNU Affero General Public License. # See more details in the license.txt file located at the root folder of the # Akvo RSR module. For additional details on the GNU license please see < # http://www.gnu.org/licenses/agpl.html >. """Script to run tests using Browse...
agpl-3.0
Python
8223d62c22d4c4f7a66e1e468de53556796a03a9
Write a function that print something n times including relatives spaces
let42/python-course
src/functions/exercise7.py
src/functions/exercise7.py
"""Module docstring. This serves as a long usage message. """ import sys import getopt def main(): # parse command line options try: opts, args = getopt.getopt(sys.argv[1:], "h", ["help"]) except getopt.error, msg: print msg print "for help use --help" sys.exit(2) # pro...
mit
Python
98c07739702fbf3951ccd0359d04be80a303d9ce
Add a fontname to TachyFont Jar file mapper.
bstell/TachyFont,bstell/TachyFont,moyogo/tachyfont,bstell/TachyFont,moyogo/tachyfont,bstell/TachyFont,googlei18n/TachyFont,googlefonts/TachyFont,moyogo/tachyfont,googlefonts/TachyFont,googlei18n/TachyFont,googlefonts/TachyFont,googlei18n/TachyFont,googlefonts/TachyFont,bstell/TachyFont,googlefonts/TachyFont,googlei18n/...
run_time/src/gae_server/font_mapper.py
run_time/src/gae_server/font_mapper.py
""" Copyright 2014 Google Inc. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or ...
apache-2.0
Python
4074c4fae998ac1bb6f49bb47b34f4890dc90532
Add integration tests for pylast.py
knockoutMice/pylast,hugovk/pylast,pylast/pylast,yanggao1119/pylast,knockoutMice/pylast,yanggao1119/pylast
test_pylast.py
test_pylast.py
#!/usr/bin/env python """ Integration (not unit) tests for pylast.py """ import datetime import time import unittest import pylast class TestSequenceFunctions(unittest.TestCase): def setUp(self): self.username = "TODO" password_hash = "TODO" API_KEY = "TODO" API_SECRET = "TODO" ...
apache-2.0
Python
52cf67258e5f1e6378fec2794cc3abb1d5b394e9
copia de serialCom sem a comunicacao serial
ocarneiro/arduino-cidadania
testeLogica.py
testeLogica.py
import serial import time ############################ def num(s): try: retorno = int(s) if retorno > 100 : return 100 if retorno < 0 : return 0 return int(s) except ValueError: return 0 ############################ porta = "COM3" velocidade = 9600 d...
mit
Python
fb5ef2e7bf3b3315ab6491ec46dd97114162b7c6
Add tests directory and dummy objects for use in developing and running unit tests.
magul/pywikibot-core,xZise/pywikibot-core,happy5214/pywikibot-core,darthbhyrava/pywikibot-local,smalyshev/pywikibot-core,wikimedia/pywikibot-core,jayvdb/pywikibot-core,hasteur/g13bot_tools_new,npdoty/pywikibot,hasteur/g13bot_tools_new,h4ck3rm1k3/pywikibot-core,valhallasw/pywikibot-core,happy5214/pywikibot-core,jayvdb/p...
pywikibot/tests/dummy.py
pywikibot/tests/dummy.py
# -*- coding: utf-8 -*- """Dummy objects for use in unit tests.""" # # (C) Pywikipedia bot team, 2007 # # Distributed under the terms of the MIT license. # __version__ = '$Id: $' # add in any other attributes or methods that are needed for testing class TestSite(object): """Mimic a Site object.""" ...
mit
Python
862016c070155fa44ed082a47d969ecacbba8aae
add TagAlias class (broken)
jakeogh/anormbookmarker,jakeogh/anormbookmarker
anormbookmarker/TagAlias.py
anormbookmarker/TagAlias.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # MIT License from sqlalchemy import Column #from sqlalchemy import ForeignKey #from sqlalchemy import UniqueConstraint #from sqlalchemy import CheckConstraint from sqlalchemy import Integer #from sqlalchemy import Unicode from sqlalchemy.orm import relationship #from sql...
mit
Python
0dd2662d3aefe49a6a706461ca9b7a9fd1b380e8
add rotary_encoder.py from http://abyz.co.uk/rpi/pigpio/examples.html#Python code
philipbeber/karaoke,philipbeber/karaoke,philipbeber/karaoke,philipbeber/karaoke
pi/rotary_encoder.py
pi/rotary_encoder.py
#!/usr/bin/env python import pigpio class decoder: """Class to decode mechanical rotary encoder pulses.""" def __init__(self, pi, gpioA, gpioB, callback): """ Instantiate the class with the pi and gpios connected to rotary encoder contacts A and B. The common contact should be connec...
mit
Python
871a49b8d1e18c675cb7b5e6730cf8ebd4c56e36
Create q1.py
matthewelse/british-informatics-olympiad,matthewelse/british-informatics-olympiad,matthewelse/british-informatics-olympiad
2013/q1.py
2013/q1.py
# A solution to the British Informatics Olympiad 2012 Question 1 from time import strftime, gmtime # number of minutes a = -1 # number of minutes b = 0 i = input() fast = [int(x) for x in i.split()] actual = 0 while a != b: if a == -1: a = 0 a = (a + 60 + fast[0]) % 1440 b = (b + 60 + fast[1])...
mit
Python
4785a42d218e75a49f9e5c270f159a17c7e22bcd
add count_clonotypes.py
imminfo/mrd-paper
count_clonotypes.py
count_clonotypes.py
import sys def count_clonotypes_in_files(link_path): def get_sequence(words): tmp = 0 res = '' try: tmp = float(words[2]) res = words[3] except Exception: res = words[2] if not res: print("Empty string in NUC!!!") return res global_sequences = {} local_sequences = {} sample_list = [] wi...
apache-2.0
Python
3def1498495e0abf230a3deb3873f6c502f3c6ad
Add management command for removing content rotation's settings on sections
praekelt/molo,praekelt/molo,praekelt/molo,praekelt/molo
molo/core/management/commands/remove_content_rotation_settings_from_sections.py
molo/core/management/commands/remove_content_rotation_settings_from_sections.py
from __future__ import absolute_import, unicode_literals from django.core.management.base import BaseCommand from molo.core.models import SectionPage class Command(BaseCommand): def handle(self, **options): SectionPage.objects.all().update( content_rotation_start_date=None, conten...
bsd-2-clause
Python
ea67a84c83fb11237383102c4c447f70c4b83e64
Add solution to 114.
bsamseth/project-euler,bsamseth/project-euler
114/114.py
114/114.py
""" A row measuring seven units in length has red blocks with a minimum length of three units placed on it, such that any two red blocks (which are allowed to be different lengths) are separated by at least one black square. There are exactly seventeen ways of doing this. How many ways can a row measuring fifty units ...
mit
Python
d563e6aed8061d4e439bdad9ece1a9383d00cff2
add parse_wadl.py, a first attempt to parse this wadl
annegentle/wadl2rst,annegentle/wadl2rst,annegentle/wadl2rst
parse_wadl.py
parse_wadl.py
#!/usr/bin/env python import os import xml.parsers.expat filename = 'samples/cloud-images/wadl/image-2.0.wadl' def start_resource(name,attrs): print('start resource: ', attrs) def start_resources(name,attrs): print('start resources ', attrs) start_dispatch = { 'resource': start_resource, 'resources'...
apache-2.0
Python
656d65a484cc4319ba67e4e4bb4cee8adb37136a
copy from hadoop
Vaishaal/ckm,Vaishaal/ckm,Vaishaal/ckm,Vaishaal/ckm,Vaishaal/ckm
copy_from_hadoop.py
copy_from_hadoop.py
import subprocess import argparse CMD_BASE = "hadoop fs -copyToLocal" ''' Script to experiment output files from hdfs to dst ''' def copy_from_hadoop(src, dst): p = subprocess.Popen(" ".join([CMD_BASE, src, dst]), shell=True, executable='/bin/bash') p.wait() if p.returncode != 0: ...
apache-2.0
Python
fa60d9857b4412edf5f8f59fa5b65914ee38a279
add d18 (not working, too tired)
f-koehler/adventofcode
d18.py
d18.py
#!/bin/env python3 with open("d18.txt") as f: state1 = f.read().splitlines() for i in range(0, len(state1)): state1[i] = list(state1[i]) new_state = 2 dim_x = len(state1) dim_y = len(state1[0]) state2 = [["."]*(dim_y)]*(dim_x) def light_active(x, y): if new_state == 1: return state2[x][y] == "#...
mit
Python
a610154749d081e613b8bf58acf62af55958de9c
Automate the update of the version number in setup.py.
jeffreydwalter/arlo
rev.py
rev.py
import fileinput import re import sys pattern = re.compile("\s*version='([0-9.]+)',") line = "" maj = "" min = "" ver = "" for line in fileinput.FileInput("setup.py", inplace=1): m = pattern.match(line) if m: version = m.groups()[0] maj, min, rev = version.split('.') line = line.re...
apache-2.0
Python
47a575a69b6a55cc188aa7ccecf9d15719efe405
Include base test class
jstewmon/proselint,amperser/proselint,amperser/proselint,jstewmon/proselint,amperser/proselint,amperser/proselint,amperser/proselint,jstewmon/proselint
tests/check.py
tests/check.py
from unittest import TestCase import os class Check(TestCase): __test__ = False @property def this_check(self): raise NotImplementedError def check(self, lst): if isinstance(lst, basestring): lst = [lst] errors = [] for text in lst: errors.ap...
bsd-3-clause
Python
11c4fedc55a32f27b4aebd44cc03ba1f5d1e6357
add board_build_example
cfelton/rhea,NickShaffner/rhea,NickShaffner/rhea,cfelton/rhea
examples/build/board_build_example.py
examples/build/board_build_example.py
""" This file contains a general function to run the build for various boards. >> python example_build_boards.py --board=<board name> """ import argparse import rhea.build as build from rhea.build.boards import get_board from rhea.build.boards import get_all_board_names #from blink import blinky # some boards...
mit
Python
6138012dc3ce06250684edc641eb26d1beb3fc99
Add controller test code
joel-wright/DDRPi,fraz3alpha/led-disco-dancefloor,fraz3alpha/DDRPi
experiments/python/controller_test.py
experiments/python/controller_test.py
# For getting an unbuffered write import sys # For getting the time import time # For threading import threading class ControllerInputListener(): def new_controller_input(self, controller_input, channel, value): raise NotImplementedError("new_controller_input(channel, value) not implements") class ControllerIn...
mit
Python
4d579e832bb5c6b300ccd77859ea1fc6644f20c7
Create asda.py
kuchaale/work
asda.py
asda.py
sasd=2
mit
Python
0984e3d09e4520870e655b731fea92975884cf30
Add a script to run test.py in the build directory
opencog/link-grammar,linas/link-grammar,opencog/link-grammar,ampli/link-grammar,linas/link-grammar,opencog/link-grammar,ampli/link-grammar,ampli/link-grammar,opencog/link-grammar,linas/link-grammar,ampli/link-grammar,ampli/link-grammar,opencog/link-grammar,opencog/link-grammar,linas/link-grammar,linas/link-grammar,ampl...
msvc14/make-check.py
msvc14/make-check.py
""" Run Link Grammar Python scripts using the build target locations. This program sets PYTHONPATH and PATH, and uses Python2 or Python3 to run the script, as needed. This program is designed to run from this directory It reads Local.props in order to find Python's EXE location. It also generates relative PYT...
lgpl-2.1
Python
4e2172b8bd0953fd706f6c11029f9e4cfeb55407
Add tests for the registry's root object's Component interface
GNOME/at-spi2-core,GNOME/at-spi2-core,GNOME/at-spi2-core
tests/registryd/test_root_component.py
tests/registryd/test_root_component.py
import pytest import dbus COMPONENT_IFACE = 'org.a11y.atspi.Component' COORD_TYPE_WINDOW = 1 LAYER_WIDGET = 3 def test_contains(registry_root, session_manager): assert registry_root.Contains(0, 0, COORD_TYPE_WINDOW, dbus_interface=COMPONENT_IFACE) == False def test_get_accessible_at_point(registry_root, session...
lgpl-2.1
Python
f7a1595e39eeb754290c62e9194868d98d9755f4
Add test for symbol selection
ytanay/thinglang,ytanay/thinglang,ytanay/thinglang,ytanay/thinglang
tests/symbols/test_symbol_selection.py
tests/symbols/test_symbol_selection.py
import pytest from tests.symbols import get_symbols from thinglang.compiler.errors import NoMatchingOverload from thinglang.compiler.references import Reference from thinglang.lexer.values.identifier import Identifier from thinglang.parser.values.named_access import NamedAccess from thinglang.symbols.argument_selector...
mit
Python
1ee1068d0203b591a734837d72f2f8a38c40399a
Add new project String -> MethodAndOperator.py
CaptainMich/Python_Project
StartWithPython/StartWithPython/String/MethodAndOperator.py
StartWithPython/StartWithPython/String/MethodAndOperator.py
#STRING(2) print('\n\t\tSTRING(2)\t\t\n') user = 'Tuna' print(user[0]) # use it if you want a specif letter of a string print(user[1]) # ... print(user[2]) # ... print(user[3]) # ... print('') print(user[-1]) # ...if you want to start from the end print(user[-2]) # ... pri...
mit
Python
e9b2131da038c7e65dde33c04ee7c5888063827c
Add a test suite for json_marshal.bzl.
bazelbuild/rules_typescript,bazelbuild/rules_typescript,bazelbuild/rules_typescript
internal/common/json_marshal_test.bzl
internal/common/json_marshal_test.bzl
"""Unit tests for json marshaling. Note, this cannot live next to the file it tests, because that file is in third_party bazel rules, and bazel doesn't support skylark testing yet. """ load("//third_party/bazel_skylib/lib:unittest.bzl", "asserts", "unittest") load("//third_party/bazel_rules/rules_typescript/internal:...
apache-2.0
Python
698d838ed225f42c7acee40c564e0f15aefa16ef
Add code to support optional debugging
ConPaaS-team/conpaas,ConPaaS-team/conpaas,ConPaaS-team/conpaas,ConPaaS-team/conpaas,ConPaaS-team/conpaas,ConPaaS-team/conpaas,ConPaaS-team/conpaas
conpaas-director/cpsdirector/debug.py
conpaas-director/cpsdirector/debug.py
import sys from common import log class Debug: def __init__(self): self.level = 5; def set_level(self, l): self.level = l def get_level(self): return(self.level) def debug(self, level, txt): if self.get_level() >= level...
bsd-3-clause
Python
5a8c8afee5e50a04f38d91745563842fc548cef8
add favorites to the admin
crateio/crate.io
crate_project/apps/favorites/admin.py
crate_project/apps/favorites/admin.py
from django.contrib import admin from favorites.models import Favorite class FavoriteAdmin(admin.ModelAdmin): list_display = ["user", "package", "created", "modified"] list_filter = ["created", "modified"] search_fields = ["user__username", "package__name"] raw_id_fields = ["user", "package"] admin....
bsd-2-clause
Python
cae06ce3f07cd241431baf792e5e3b9dbec04e6b
Create __init__.py
hatchery/Genepool2,hatchery/genepool
genes/docker/__init__.py
genes/docker/__init__.py
#Add
mit
Python
e5238b616f1a9be3fe5863e0aa9e9c118343df0f
add error wrapper to echo to stderr
amaxwell/datatank_py
DTError.py
DTError.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # This software is under a BSD license. See LICENSE.txt for details. import sys _errors = [] def DTErrorMessage(fcn, msg): err_msg = "%s: %s" % (fcn, msg) _errors.append(err_msg) sys.stderr.write(err_msg + "\n") def DTSaveError(datafile, name): if len(...
bsd-3-clause
Python
0a6de323b3b878ca6e68c66c3a6b97d78aac65c5
Create LoginTest.py
skeldi/animated-robot
LoginTest.py
LoginTest.py
#!/usr/bin/env python import urllib, urllib2 from datetime import datetime from dateutil.relativedelta import relativedelta from BeautifulSoup import BeautifulSoup #useragent = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome_Scrape/33.0.1750.154' accountwww = 'https://account.tfl.g...
mit
Python
bd761bda5c01384870083ad750e59859c4a5b04a
add collector for http://hosts-file.net/
spantons/attacks-pages-collector
collectors/hosts-file.py
collectors/hosts-file.py
#!/usr/bin/python # -*- coding: utf-8 -*- import socket from time import gmtime, strftime import requests import ipwhois from pprint import pprint def get_url(url): try: res = requests.get(url) except requests.exceptions.ConnectionError: raise requests.exceptions.ConnectionError("DNS lookup f...
mit
Python
233090aac7d71a1a8e0caf348b3d785bca15f69c
Create initial image.py file
joshua-stone/DerPyBooru
derpibooru/image.py
derpibooru/image.py
# this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCH...
bsd-2-clause
Python
1eb9d5aff303ff920b4bacbeea0d1de6bab419d9
add bonuses solution SRM 145 DIV 1
cjwfuller/topcoder
Bonuses.py
Bonuses.py
from __future__ import division class Bonuses: def getDivision(self, points): bonuses = [] # calculate bonuses total = sum(points) extra = 0 for p in points: percent = p / total * 100 extra += percent % 1 bonuses.append(int(percent)) # award any extra points extra = round(extra) count = 1 a...
mit
Python
34f2e6066bb44697636f72bb416e200145878a42
Add script for generating TestRun index (#74)
GoogleChrome/wptdashboard,GoogleChrome/wptdashboard,GoogleChrome/wptdashboard
util/generate_testrun_index.py
util/generate_testrun_index.py
#!/usr/bin/python3 # Copyright 2017 Google 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 or ag...
apache-2.0
Python
c15bf8a018265417400b9948e4b36eb48d40582b
Introduce a very simple vim modeline parser.
spencerlyon2/pygments,spencerlyon2/pygments,spencerlyon2/pygments,spencerlyon2/pygments,spencerlyon2/pygments,spencerlyon2/pygments,spencerlyon2/pygments,spencerlyon2/pygments,spencerlyon2/pygments,spencerlyon2/pygments,spencerlyon2/pygments,spencerlyon2/pygments,spencerlyon2/pygments,spencerlyon2/pygments,spencerlyon2...
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
9e5fa749cbf797e8646e72a6b54047a9644c8711
add controller file
ihfazhillah/qaamus-python
qaamus/controller.py
qaamus/controller.py
import view import parsers def idar_controller(soup_object, make_soup): data = parsers.IndAraParser(soup_object).get_idar(make_soup) rendered = view.View().render(data) return rendered def angka_controller(soup_object): data = parsers.AngkaParser(soup_object).get_arti_master() rendered = view.View...
mit
Python
2e60e02e9fd7cb788e15e61329f36e675f14160f
Create PedidoEditar.py
AEDA-Solutions/matweb,AEDA-Solutions/matweb,AEDA-Solutions/matweb,AEDA-Solutions/matweb,AEDA-Solutions/matweb
backend/Models/Sala/PedidoEditar.py
backend/Models/Sala/PedidoEditar.py
from Framework.Pedido import Pedido from Framework.ErroNoHTTP import ErroNoHTTP class PedidoEditar(Pedido): def __init__(self,variaveis_do_ambiente): super(PedidoEditar, self).__init__(variaveis_do_ambiente) try: self.id = self.corpo['id'] self.codigo = self.corpo['codigo'] except: raise ErroNoHTTP(40...
mit
Python