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
24d1162740aa9a9948665d97dc082a555a1ccf13
Rename initial_args to standard argv.
ssundarraj/grip,mgoddard-pivotal/grip,mgoddard-pivotal/grip,ssundarraj/grip,joeyespo/grip,jbarreras/grip,jbarreras/grip,joeyespo/grip
grip/command.py
grip/command.py
"""\ grip.command ~~~~~~~~~~~~ Implements the command-line interface for Grip. Usage: grip [options] [<path>] [<address>] grip -h | --help grip --version Where: <path> is a file to render or a directory containing a README.md file <address> is what to listen on, of the form <host>[:<port>], or just <port>...
"""\ grip.command ~~~~~~~~~~~~ Implements the command-line interface for Grip. Usage: grip [options] [<path>] [<address>] grip -h | --help grip --version Where: <path> is a file to render or a directory containing a README.md file <address> is what to listen on, of the form <host>[:<port>], or just <port>...
mit
Python
cf357e46b3d9664325ca69f3b7c0393c89ad44a7
Add some function tests.
sapir/tinywhat,sapir/tinywhat,sapir/tinywhat
tests/test_func.py
tests/test_func.py
from .utils import assert_eval def test_simple_func(): assert_eval('(def @a $a 8) (@a)', 1, 8) def test_simple_func_args(): assert_eval( '(def @a $a $a)' '(@a 1)' '(@a 2)' '(@a 5)', 1, 1, 2, 5) def test_func_args_overwrite_globals(): asse...
bsd-3-clause
Python
2628bfa261c9bb76f4d3742bbb36f1179d961c83
add Pool and OrderedPool tests
teepark/greenhouse
tests/test_pool.py
tests/test_pool.py
import unittest import greenhouse import greenhouse.poller from test_base import TESTING_TIMEOUT, StateClearingTestCase class PoolTestCase(StateClearingTestCase): POOL = greenhouse.Pool def test_basic(self): def f(x): return x ** 2 pool = self.POOL(f) pool.start() ...
bsd-3-clause
Python
ec6dff24e3049ddaab392f0bc5b8d8b724e41e20
Print the trending Python repos on GitHub
cclauss/Ten-lines-or-less
trending_python.py
trending_python.py
#!/usr/bin/env python3 import bs4 import requests url = 'https://github.com/trending?l=Python' soup = bs4.BeautifulSoup(requests.get(url).content, 'lxml') # or 'html5lib' repos = soup.find('ol', class_="repo-list").find_all('a', href=True) repos = (r.text.strip().replace(' ', '') for r in repos if '/' in r.text) pri...
apache-2.0
Python
37691851b6e21a6a51140f512fd9802e964b0785
Create beta_pythons_dynamic_classes_3.py
Orange9000/Codewars,Orange9000/Codewars
Solutions/beta/beta_pythons_dynamic_classes_3.py
Solutions/beta/beta_pythons_dynamic_classes_3.py
def create_class(class_name, secrets = None): if not class_name: return None class NewClass(object): pass NewClass.__name__ = class_name if not secrets: return NewClass for i in secrets: if 'function' in str(type(secrets[i])): setattr(NewC...
mit
Python
32d9a97336c786660a838dc69cfab2ebe3436343
update viafReconciliationPeople.py
jhu-archives-and-manuscripts/MARAC_API_Workshop
viafReconciliationPeople.py
viafReconciliationPeople.py
import requests import csv from fuzzywuzzy import fuzz import json import urllib baseURL = 'http://viaf.org/viaf/search/viaf?query=local.personalNames+%3D+%22' f=csv.writer(open('viafPeopleResults.csv', 'wb')) f.writerow(['search']+['result']+['viaf']+['lc']+['isni']+['ratio']+['partialRatio']+['tokenSort']+['tokenSet...
mit
Python
2934f80f294759ec202e0305025da2d7e71d3ae3
Add plot_throughput.py.
jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools
problem/net_file_xfer_tput_174608/plot_throughput.py
problem/net_file_xfer_tput_174608/plot_throughput.py
#! /usr/bin/env python3 # Copyright 2017 John Hanley. # # 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, m...
mit
Python
3ea69c783393b6c62f3428c6ec83a24fe7634b6c
add grader in Python
irakli-janiashvili/codewars,irakli-janiashvili/codewars,irakli-janiashvili/codewars
8-kyu/grader.py
8-kyu/grader.py
def grader(score): if score < 0.6 or score > 1: return 'F' elif score < 0.7: return 'D' elif score < 0.8: return 'C' elif score < 0.9: return 'B' else: return 'A'
mit
Python
37dda1d235017bebb9bb0f6eff150dd12222762f
remove organisation from db
alphagov/notifications-api,alphagov/notifications-api
migrations/versions/0162_remove_org.py
migrations/versions/0162_remove_org.py
""" Revision ID: 0162_remove_org Revises: 0161_email_branding Create Date: 2018-02-06 17:08:11.879844 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql revision = '0162_remove_org' down_revision = '0161_email_branding' def upgrade(): # ### commands auto generated by ...
mit
Python
d1e8a8bb6ffc852bf07c40968029c5def7dc0a96
Correct the dict
Saviq/nova-compute-lxd,tpouyer/nova-lxd,mmasaki/nova-compute-lxd,Saviq/nova-compute-lxd,mmasaki/nova-compute-lxd,tpouyer/nova-lxd
nclxd/nova/virt/lxd/host_utils.py
nclxd/nova/virt/lxd/host_utils.py
# Copyright (c) 2015 Canonical Ltd # # 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 ...
# Copyright (c) 2015 Canonical Ltd # # 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
85060c7653a04f18e6f5cd016e113327ba3a2878
Add support for Sercomm IP camera discovery. (#238)
balloob/netdisco
netdisco/discoverables/sercomm.py
netdisco/discoverables/sercomm.py
""" Discover Sercomm network cameras. These are rebranded as iControl and many others, and are usually distributed as part of an ADT or Comcast/Xfinity monitoring package. https://github.com/edent/Sercomm-API """ from . import SSDPDiscoverable class Discoverable(SSDPDiscoverable): """Add support for discovering c...
mit
Python
1295f2867eb7348959d86618b8e80c001cc41ff7
Add 'lib' init module.
Pylons/akhet,hlwsmith/akhet,hlwsmith/akhet,hlwsmith/akhet,Pylons/akhet
akhet/paster_templates/akhet/+package+/lib/__init__.py
akhet/paster_templates/akhet/+package+/lib/__init__.py
"""Miscellaneous support packages for {{project}}. """
mit
Python
8fe99eedd4e1a1604277c42ed8f2ea0dc2e622de
add simple csv utility module
berkmancenter/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud
mediacloud/mediawords/util/csv.py
mediacloud/mediawords/util/csv.py
"""Utility functions for dealing with csvs.""" import csv import io def get_csv_string_from_dicts(dicts: list) -> str: """Given a list of dicts, return a representative csv string.""" if len(dicts) < 1: return '' csvio = io.StringIO() csvwriter = csv.DictWriter(csvio, fieldnames=dicts[0].ke...
agpl-3.0
Python
f6c2d5e37685b149cfd447545c58ce1fc4d836b9
Add function to create view for Span candidate subclasses
jasontlam/snorkel,HazyResearch/snorkel,HazyResearch/snorkel,jasontlam/snorkel,jasontlam/snorkel,HazyResearch/snorkel
snorkel/models/views.py
snorkel/models/views.py
def create_serialized_candidate_view(session, C, verbose=True): """Creates a view in the database for a Candidate sub-class C defined over Span contexts, which are direct children of a single sentence. Creates VIEW with schema: candidate.id, candidate.split, span0.*, ..., spanK.*, sentence.* ...
apache-2.0
Python
135324dd3346f7830abbe64cb5eadf82d1ca963c
add - module for generating data sets.
rfaulkner/easyML,rfaulkner/easyML,rfaulkner/easyML,rfaulkner/easyML
versus/src/data.py
versus/src/data.py
""" Module for loading datasets """ import gzip import theano.tensor as T import theano import numpy import cPickle import os def load_MNIST(dataset): ''' Loads the dataset :type dataset: string :param dataset: the path to the dataset (here MNIST) ''' ############# # LOAD DATA # #######...
bsd-3-clause
Python
9732c401fb51ae0b757be5108835b71e7c389850
Add tests
danirus/django-comments-xtd,danirus/django-comments-xtd,danirus/django-comments-xtd,danirus/django-comments-xtd
django_comments_xtd/tests/test_get_version.py
django_comments_xtd/tests/test_get_version.py
try: from unittest.mock import patch except ImportError: from mock import patch from django.test import TestCase class GetVersionTestCase(TestCase): @patch('django_comments_xtd.VERSION', (2, 8, 0, 'f', 0)) def test_get_version_when_patch_equal_to_zero(self): from django_comments_xtd import g...
bsd-2-clause
Python
2eb163c5dd675c2e7a9cedb5d6868545833cbf34
Add lemma rules
oroszgy/spaCy.hu,raphael0202/spaCy,oroszgy/spaCy.hu,Gregory-Howard/spaCy,honnibal/spaCy,banglakit/spaCy,explosion/spaCy,spacy-io/spaCy,honnibal/spaCy,oroszgy/spaCy.hu,raphael0202/spaCy,raphael0202/spaCy,banglakit/spaCy,aikramer2/spaCy,banglakit/spaCy,recognai/spaCy,explosion/spaCy,recognai/spaCy,spacy-io/spaCy,aikramer...
spacy/en/lemma_rules.py
spacy/en/lemma_rules.py
# encoding: utf8 from __future__ import unicode_literals LEMMA_RULES = { "noun": [ ["s", ""], ["ses", "s"], ["ves", "f"], ["xes", "x"], ["zes", "z"], ["ches", "ch"], ["shes", "sh"], ["men", "man"], ["ies", "y"] ], "verb": [ [...
mit
Python
45628f2abd6ec66ad48679732d600174a3a7de26
add a script
odf/gavrog,odf/gavrog,odf/gavrog,odf/gavrog,odf/gavrog
jython/surfaceMapToDs.py
jython/surfaceMapToDs.py
#!/bin/env jython import sys import java.io import org.gavrog def dsymbolFromCyclicAdjacencies(adjs): vertexToChamber = {} edgeToChamber = {} chamberToVertex = {} size = 0 for v in adjs: vertexToChamber[v] = size for w in adjs[v]: if w == v: raise Run...
apache-2.0
Python
4ca336ee7b29609e5cc87dccf1a66c233038aa94
Create cpp_header_merger.py
ZhreShold/PyGists,ZhreShold/PyGists
cpp_header_merger.py
cpp_header_merger.py
__author__ = 'Joshua Zhang' """A C/C++ header merging tool """ import os import re import argparse # matching c/c++ #include patterns pattern_include = r"#.*include.+(\.hpp|\.h)+" pattern_squote = r"<.+>" pattern_quote = r'".+"' pattern_pragma = r"#pragma.+once" regex_include = re.compile(pattern_include, re.IGNORECA...
mit
Python
e212ad90a8fedb8e29abe3683b99a28d4030b544
Add process module for Popen compat handling
scorphus/passpie,eiginn/passpie,scorphus/passpie,eiginn/passpie,marcwebbie/passpie,marcwebbie/passpie
passpie/process.py
passpie/process.py
from subprocess import Popen, PIPE from ._compat import * class Proc(Popen): def communicate(self, **kwargs): if kwargs.get('input') and isinstance(kwargs['input'], basestring): kwargs['input'] = kwargs['input'].encode('utf-8') return super(Proc, self).communicate(**kwargs) def ...
mit
Python
53038aea2b439acdc265f81b9f031336ea1f27f3
Add lc480_sliding_window_median.py
bowen0701/algorithms_data_structures
lc480_sliding_window_median.py
lc480_sliding_window_median.py
"""Leetcode 480. Sliding Window Median URL: https://leetcode.com/problems/sliding-window-median/ Hard 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. Examples: [2,3,4] , the median is 3 [2,3], the...
bsd-2-clause
Python
9a6bf30ecfa7b843d8588a8a7b052f87089e44c7
convert csv to excel
BlackBox-CSP/nmap-tor-scanner,BlackBox-CSP/nmap-tor-scanner
write_excel.py
write_excel.py
def Excel2CSV(ExcelFile, SheetName, CSVFile): workbook = xlrd.open_workbook(ExcelFile) try: worksheet = workbook.sheet_by_name(SheetName) except xlrd.biffh.XLRDError: print "Missing portmap for switch " + str(SheetName) print "Exiting program. Check spelling of Sheet name" ...
mit
Python
a5ec49a658de23263802c7ddad02a4e34073a2a4
add example of a go block returning value through a channel
ubolonton/twisted-csp
example/go_block.py
example/go_block.py
import csp def lazy_echo(x): yield csp.wait(0.5) print "I'm done" yield csp.stop(x) def main(): chan = csp.go(lazy_echo(1)) print (yield csp.take(chan)) chan = csp.go(lazy_echo(2)) yield csp.wait(2) print (yield csp.take(chan))
epl-1.0
Python
5007a2910f54c339c50667993c11fd4586412524
add letter code
Mechazawa/WordOn-HD-Bot
wordonhd/Letter.py
wordonhd/Letter.py
class Letter(object): _values = { 'ENIOA': 1, 'SDTR': 2, 'MLKPBG': 3, 'ZVUFJH': 4, 'CW': 5, 'XY': 8, 'Q': 10 } def __init__(self, letter): self.letter = letter[-1] self.wordon = letter[0] == '!' @property def value(self): ...
bsd-2-clause
Python
3ef7175814cd76621eeee00a26cff786ea032727
Add flood it example
lawsie/guizero,lawsie/guizero,lawsie/guizero
examples/floodit.py
examples/floodit.py
from guizero import App, Waffle, Text, PushButton, info import random # Set up the game - colours, width and height of board and no of moves allowed colours = ["red", "blue", "green", "yellow", "fuchsia", "purple"] b_width = 14 b_height = 14 moves_limit = 25 # Set up the palette def init_palette(): [palette.set...
bsd-3-clause
Python
2e44b753a071aeba95b51bd03c5635a1eb4d7f28
Create gcd.py
Pouf/CodingCompetition,Pouf/CodingCompetition
CiO/gcd.py
CiO/gcd.py
from fractions import gcd def greatest_common_divisor(*args): result, *args = args for n in args: result = gcd(result, n) return result
mit
Python
239488d33f94b0262e642fbf751878894fb7510e
add test for post form admin in articles
jeanmask/opps,opps/opps,opps/opps,williamroot/opps,williamroot/opps,jeanmask/opps,opps/opps,YACOWS/opps,jeanmask/opps,YACOWS/opps,williamroot/opps,YACOWS/opps,jeanmask/opps,opps/opps,williamroot/opps,YACOWS/opps
opps/articles/tests/test_forms.py
opps/articles/tests/test_forms.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from django.test import TestCase from django.contrib.sites.models import Site from django.contrib.auth import get_user_model from opps.channels.models import Channel from opps.core.widgets import OppsEditor from ..models import Post from ..forms import PostAdminForm cl...
mit
Python
94dbda64d07838a7408b94251972d81897536380
Add listener example file
mysticuno/MEETY12015MiniProject
listeners_example.py
listeners_example.py
import turtle turtle.penup() turtle.ht() def up(): print("You pressed Up!") def down(): print("You pressed Down!") def left(): print("You pressed Left!") def right(): print("You pressed Right!") turtle.onkey(up, 'Up') turtle.onkey(down, 'Down') turtle.onkey(left, 'Left') turtle.onkey(right, 'R...
mit
Python
1d0aff329c5adb836e7b055c042990de219debe0
Add rough first implementation of widgets.py
Khan/wtforms
wtforms/widgets.py
wtforms/widgets.py
""" wtforms.widgets ~~~~~~~~~~~~~~~ The WTForms widget system. :copyright: 2009 by James Crasta, Thomas Johansson. :license: MIT, see LICENSE.txt for details. """ from cgi import escape __all__ = ( 'ListWidget', 'TextInput', 'PasswordInput', 'HiddenInput', 'CheckboxInput', 'RadioI...
bsd-3-clause
Python
8062aa6dcb20e3b1294ce62d6d0cce1841fd21e1
Add cartan_wvecs.py
hershsingh/thesis-iitm-code
cartan_wvecs.py
cartan_wvecs.py
# Author: Hersh Singh [hershdeep@gmail.com] # Date: August 05, 2013 # Description: # Given the cartan matrix and the dynkin coefficients of the highest weight, return all the weight vectors, their weights # Todo: dimensionality of each weight space using freudenthal's formula # Reference: Cahn Chapter 10 from scipy im...
mit
Python
be81dbc33e932e870a66ad0663c23e5d05b01ffa
Create Counter.py
ambonilla/Python-Cocos-Counter
Counter.py
Counter.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @_ambonilla 2014 Using cocos & piglet libraries, is a small counter program where when you push the up key it will add a number to the displayed value, and the down key will substract one """ import cocos import sys from cocos.actions import * import pyglet from...
mit
Python
c80baf708c956a9814ef81213a66da8d443de12a
add migration
liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin
apps/bplan/migrations/0002_auto_20170509_1358.py
apps/bplan/migrations/0002_auto_20170509_1358.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('meinberlin_bplan', '0001_initial'), ] operations = [ migrations.AlterField( model_name='statement', ...
agpl-3.0
Python
2c78290cc569eb70b5b7098d154da3fb7a2247a9
Add db_mktag.py, command line tag creator.
drougge/wellpapp-pyclient
db_mktag.py
db_mktag.py
#!/usr/bin/env python # -*- coding: iso-8859-1 -*- from sys import argv, exit from dbclient import dbclient if len(argv) not in (2, 3): print "Usage:", argv[0], "tagname [tagtype]" exit(1) client = dbclient() client.add_tag(*argv[1:])
mit
Python
3609c5842b33ca4146ad14b74c76f8954545aaa8
Add commands for cases and variants
moonso/loqusdb
loqusdb/commands/view.py
loqusdb/commands/view.py
# -*- coding: utf-8 -*- import logging import click from . import base_command logger = logging.getLogger(__name__) @base_command.command() @click.option('-c' ,'--case-id', help='Search for case' ) @click.pass_context def cases(ctx, case_id): """Display all cases in the database.""" ada...
mit
Python
dd2f332dd1b7a215d5a6aa81819e3d66d46c1b91
add python solution for 20
lunixbochs/project-euler,lunixbochs/project-euler,lunixbochs/project-euler,lunixbochs/project-euler,lunixbochs/project-euler,lunixbochs/project-euler,lunixbochs/project-euler,lunixbochs/project-euler,lunixbochs/project-euler,lunixbochs/project-euler,lunixbochs/project-euler,lunixbochs/project-euler,lunixbochs/project-e...
01-50/20/20.py
01-50/20/20.py
import math print sum(int(c) for c in str(math.factorial(100)).rstrip('L'))
mit
Python
7f661e24388e82ae2e2872ab11ee6a84d487aac7
Create py-mysql-select.py
ganmk/python-prctice
py-mysql-select.py
py-mysql-select.py
#!/usr/bin/env python # --*-- coding:utf-8 --*-- import MySQLdb #操作mysql,需要加载MySQLdb模块 #创建连接 conn = MySQLdb.connect(host = '127.0.0.1',user = 'root',passwd = '123',db = 'mydb') #使用connect方法对数据库进行连接,相当于一个门 cur = conn.cursor() #使用conn.cursor方法,相当于操作的一双手 #操作数据库 reCount = cur.execute('select * from students') ...
mit
Python
48b2b234377d8e66ccb274e4845a835486228166
Create test_utils.py
jottenlips/aima-python,phaller0513/aima-python,JoeLaMartina/AlphametricProject,Fruit-Snacks/aima-python,chandlercr/aima-python,abbeymiles/aima-python,JoeLaMartina/aima-python,jo-tez/aima-python,MircoT/aima-python,sofmonk/aima-python,WhittKinley/aima-python,JoeLaMartina/AlphametricProject,JamesDickenson/aima-python,phal...
utils_test.py
utils_test.py
import pytest from utils import * def test_struct_initialization(): s = Struct(a=1, b=2) assert s.a == 1 assert s.b == 2 def test_struct_assignment(): s = Struct(a=1) s.a = 3 assert s.a == 3 def test_removeall_list(): assert removeall(4, []) == [] assert removeall(4, [1,2,3,4]) == [...
mit
Python
7581fbc397915c1ad72714203fee2349a84e14e9
add notifiaction push script - pushNotif.py
jakdor/SSCAndroidApp,jakdor/SSCAndroidApp,jakdor/SSCAndroidApp
API/ssc/SscData/pushNotif.py
API/ssc/SscData/pushNotif.py
from urllib2 import * import urllib import json import sys MY_API_KEY="AIzaSyCgSjnjxtYBGMOq7jNgnE_tbhpOJjU5nOo" messageTitle = sys.argv[1] messageBody = sys.argv[2] data={ "to" : "/topics/sscapp", "notification" : { "body" : messageBody, "title" : messageTitle, "icon" : "notif_icon" ...
mit
Python
8d5f3136fb737c8058d8b0bb4d866d1fe5bb3af8
Add main function for specchio
brickgao/specchio
specchio/main.py
specchio/main.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import time from watchdog.observers import Observer from specchio.handlers import SpecchioEventHandler from specchio.utils import logger def main(): """Main function for specchio Example: specchio test/ user@host:test/ :return: None """ ...
mit
Python
e487ca21da9e7b62a860b91aadfecdf36df005a2
add public templates module
paolodragone/PyMzn
pymzn/templates.py
pymzn/templates.py
from .mzn import templates as _templates from .mzn.templates import * __all__ = _templates.__all__
mit
Python
1019f866fc0e9c16ccbe726b4b21265dbfc1ac68
Add search_rotated_sorted_array.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...
data_structures/sorting/search_rotated_sorted_array.py
data_structures/sorting/search_rotated_sorted_array.py
# Search in a Rotated Sorted Array # You are given a sorted array which is rotated at some random pivot point. # # Example: [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2] # # You are given a target value to search. If found in the array return its index, otherwise return -1. # # You can assume there are no duplicates in ...
cc0-1.0
Python
ffc1b443f13672d0a4002a38f5273b5f72cdb627
Solve Even Fibonacci numbers
rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank
python/euler002.py
python/euler002.py
#!/bin/python3 # Project Euler #2: Even Fibonacci numbers def fibonacci_sequence(n): sequence = [1, 2] while sequence[-1] + sequence[-2] < n: sequence.append(sequence[-1] + sequence[-2]) return sequence def evens(array): return list(filter(lambda x: x % 2 == 0, array)) test_cases = int(input...
mit
Python
dc5aad16e63ff210aa3770f6eae18f215f78f8ce
Create 03.py
ezralalonde/cloaked-octo-sansa
01/hw/03.py
01/hw/03.py
# Given the variables s and t defined as: s = 'udacity' t = 'bodacious' # write Python code that prints out udacious # without using any quote characters in # your code. print s[:3] + t[4:]
bsd-2-clause
Python
616e656cb9390321cb36d8f1b067d0bddaff11c2
Add cli argument parser
frigg/frigg-worker
frigg/worker/cli.py
frigg/worker/cli.py
# -*- coding: utf8 -*- from fabric import colors from frigg.worker.fetcher import fetcher class Commands(object): @staticmethod def start(): print(colors.green("Starting frigg worker")) fetcher() @staticmethod def unknown_command(): print(colors.red("Unknown command")) if __...
mit
Python
80caf160aba107f539d18287a09fc30d6cf3d0a1
add demo plotting the available 1D demo signals
PyWavelets/pywt,rgommers/pywt,rgommers/pywt,rgommers/pywt,rgommers/pywt,grlee77/pywt,grlee77/pywt,PyWavelets/pywt
demo/plot_demo_signals.py
demo/plot_demo_signals.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Plot the set of 1D demo signals available in `pywt.data.demo_signal`.""" import numpy as np import matplotlib.pyplot as plt import pywt # use 'list' to get a list of all available 1d demo signals signals = pywt.data.demo_signal('list') subplots_per_fig = 5 signal_...
mit
Python
4a30d30b82fbdccbb0f15ebb5c094b13ce791f7f
Add a utility class to normalize input
davidmogar/genderator
genderator/utils.py
genderator/utils.py
from unidecode import unidecode class Normalizer: def normalize(text): text = Normalizer.remove_extra_whitespaces(text) text = Normalizer.replace_hyphens(text) # text = Normalizer.remove_accent_marks(text) return text.lower() @staticmethod def replace_hyphens(text): ...
mit
Python
8b828e9c9daacd8bd6b5719e0ee50fc93f3c612d
add line-invoker, allows pipeline to be changed on the fly
aliclark/irctail,aliclark/irctail
line-invoker.py
line-invoker.py
#!/usr/bin/python from __future__ import print_function import sys import subprocess # A normal(ish) pipeline looks like the following: # tailf input | grep -v foo | grep bar | cat >>output # If we want to change the valu "foo", "bar" or otherwise change the # pipeline, we have to kill the old pipeline and start a ...
isc
Python
917708a749e2c9519cbb9841004a18eeff788af4
Concatenate Final
Rahulsharma0810/M3u8Parser
Concatenate.py
Concatenate.py
# Copyright (c) 2017 Rahul V Sharma # AUTHORS = Rahul Vinod Shaarma # Website = www.rahul-sharma.com # Email = sharmaR0810@gmail.com # Don't Message Me unless Serios Help or you are not a hot girl. # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documen...
mit
Python
80cb11187894870ba9fe40e09834522d7ea2ee10
Create middleware.py
mpetyx/psymbiosys-rapidapps-middleware-workersTool,mpetyx/psymbiosys-rapidapps-middleware-workersTool
middleware.py
middleware.py
mit
Python
aadd5b5d60e1fa2939482790baa893d9624ad33b
Create mnist_lstm.py
EderSantana/TwistedFate
mnist_lstm.py
mnist_lstm.py
from tensorflow.models.rnn import rnn_cell, rnn import tensorflow as tf import numpy as np import input_data sess = tf.Session() ''' Classify MNIST using LSTM running row by row. Good: * No compilation time at all, which is cool. Bad: * Problem is that has all dimensions hard coded, which sucks. Inspired by: htt...
mit
Python
940c4f4238eac31f926e520dba473819abb44033
Add a moksha.hub module with an initial OrbitedWidget
pombredanne/moksha,mokshaproject/moksha,lmacken/moksha,mokshaproject/moksha,pombredanne/moksha,mokshaproject/moksha,pombredanne/moksha,ralphbean/moksha,mokshaproject/moksha,ralphbean/moksha,pombredanne/moksha,lmacken/moksha,lmacken/moksha,ralphbean/moksha
moksha/hub.py
moksha/hub.py
# This file is part of Moksha. # # Moksha is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Moksha is distributed in the hope that i...
apache-2.0
Python
7780c235f0f357ab918f0c031e7dc51f6ca072a9
Solve problem 20
mazayus/ProjectEuler
problem020.py
problem020.py
#!/usr/bin/env python3 from functools import * import operator def factorial(number): assert number >= 1 return reduce(operator.mul, range(1, number+1)) def digits(number): yield from (int(digit) for digit in str(number)) print(sum(digits(factorial(100))))
mit
Python
6fcb3adbcf85aa8039274f59d2b26401b5927fc4
Create PowerofFour_001.py
cc13ny/algo,Chasego/codirit,Chasego/codi,cc13ny/algo,Chasego/cod,Chasego/codirit,Chasego/codirit,Chasego/codi,Chasego/codirit,Chasego/cod,Chasego/codi,cc13ny/Allin,cc13ny/algo,Chasego/codi,Chasego/cod,Chasego/codi,cc13ny/Allin,cc13ny/Allin,cc13ny/Allin,cc13ny/Allin,Chasego/codirit,cc13ny/algo,Chasego/cod,Chasego/cod,cc...
kargtom/twodim/PowerofFour/PowerofFour_001.py
kargtom/twodim/PowerofFour/PowerofFour_001.py
def isPowerOfFour(n): return n > 0 and n & n - 1 is 0 and n & 0x5555555555555555 != 0
mit
Python
8a7fda2acf57c135e7f401ebdd8f71c3609c0eca
Create tries.py
saru95/DSA,saru95/DSA,saru95/DSA,saru95/DSA,saru95/DSA
Python/tries.py
Python/tries.py
def make_trie(*args): trie={} for word in args: if type(word)!= str: raise TypeError("Trie work only on strings") # temp_trie and trie refer to the same dictionary object. temp_trie=trie for letter in word: # here setdefault sets the letter to {}({'y':{}}) and then returns {} to temp_trie. # So now t...
mit
Python
23cf747a3ff24f75d3300547f4bfdecf10c4a325
Add next traversal util function
scrappleapp/scrapple,AlexMathew/scrapple,AlexMathew/scrapple,scrappleapp/scrapple,AlexMathew/scrapple
scrapple/utils/config.py
scrapple/utils/config.py
""" scrapple.utils.config ~~~~~~~~~~~~~~~~~~~~~ Functions related to traversing the configuration file """ from __future__ import print_function def traverse_next(page, next, results): for link in page.extract_links(next['follow_link']): print("Loading page", link.url) r = results for at...
mit
Python
56b3cf07fff4d3794dcdbf99f6d7faa629fa243e
fix string manipulation in render_templatefile()
cleydson/scrapy,hansenDise/scrapy,tliber/scrapy,rolando/scrapy,eliasdorneles/scrapy,kmike/scrapy,tagatac/scrapy,starrify/scrapy,jdemaeyer/scrapy,mlyundin/scrapy,carlosp420/scrapy,finfish/scrapy,barraponto/scrapy,Zephor5/scrapy,Zephor5/scrapy,hectoruelo/scrapy,taito/scrapy,redapple/scrapy,rootAvish/scrapy,shaform/scrapy...
scrapy/utils/template.py
scrapy/utils/template.py
"""Helper functions for working with templates""" import os import re import string def render_templatefile(path, **kwargs): with open(path, 'rb') as file: raw = file.read() content = string.Template(raw).substitute(**kwargs) render_path = path[:-len('.tmpl')] if path.endswith('.tmpl') else path...
"""Helper functions for working with templates""" import os import re import string def render_templatefile(path, **kwargs): with open(path, 'rb') as file: raw = file.read() content = string.Template(raw).substitute(**kwargs) with open(path.rstrip('.tmpl'), 'wb') as file: file.write(cont...
bsd-3-clause
Python
cefdd80e7cd9e4ce007e60c08114e89a46b15de7
Truncate a protein sequence to remove signal peptide.
tdangkhoa/calford
RemoveSignal.py
RemoveSignal.py
#!/usr/bin/python # Copyright (c) 2014 Khoa Tran. All rights reserved. from CalFord import * import argparse import sys,os import re signalFile = None configPath = "calford.conf" noSignalOutputFile = None removedSignalOutputFile = None def argsSanityCheck(): isOk = True if not os.path.isfile(signalFile): ...
mit
Python
fd8b325bb6423c2f56d84006763ec8f6696a2745
Test basic paths
Kozea/WeasyPrint,Kozea/WeasyPrint
tests/test_draw/svg/test_paths.py
tests/test_draw/svg/test_paths.py
""" weasyprint.tests.test_draw.svg.test_paths ------------------------------------------ Test how SVG simple paths are drawn. """ from ...testing_utils import assert_no_logs from .. import assert_pixels @assert_no_logs def test_path_Hh(): assert_pixels('path_Hh', 10, 10, ''' BBBBBBBB__ ...
bsd-3-clause
Python
cc0ef22d0fb122b2c28e6004843978a0ee9e255f
Create Pinject.py
OffensivePython/Pinject,0x0mar/Pinject,xujun10110/Pinject,saydulk/Pinject
Pinject.py
Pinject.py
import socket import struct import sys from optparse import OptionParser def checksum(data): s = 0 n = len(data) % 2 for i in range(0, len(data)-n, 2): s+= ord(data[i]) + (ord(data[i+1]) << 8) if n: s+= ord(data[i+1]) while (s >> 16): s = (s & 0xFFFF) + (s >> 16) s = ~s & 0xffff return s class ip(...
mit
Python
ec484a404752c60a7c88ae84f79b4792c777dfd4
Define ESCO ua and eu tender models
Scandie/openprocurement.tender.esco,openprocurement/openprocurement.tender.esco
openprocurement/tender/esco/models.py
openprocurement/tender/esco/models.py
from zope.interface import implementer from schematics.types import StringType from openprocurement.api.models import ITender from openprocurement.tender.openua.models import ( Tender as BaseTenderUA, ) from openprocurement.tender.openeu.models import ( Tender as BaseTenderEU, ) @implementer(ITender) class...
apache-2.0
Python
82b9a66ea826b4463d82c69ba1703eab213efe83
Add test for stack outputs
cwolferh/heat-scratch,noironetworks/heat,jasondunsmore/heat,jasondunsmore/heat,noironetworks/heat,openstack/heat,steveb/heat,dims/heat,steveb/heat,dims/heat,openstack/heat,cwolferh/heat-scratch
heat_integrationtests/functional/test_stack_outputs.py
heat_integrationtests/functional/test_stack_outputs.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...
apache-2.0
Python
78df4f45ea4b8c04ba8f34d8fc356345998c616b
Add TelnetServer.py under version control.
niucheng/TelnetServer
TelnetServer.py
TelnetServer.py
#!/usr/bin/env python # coding: utf-8 import socket import threading welcome_slogan = '''Welcome novice!\r\n\ Type something and hit enter to see what happens.\r\n\ Be bold!\r\n\r\n''' help_message = '''Command Description\r\n\ =============================================================\r\n\ HELP ...
mit
Python
0d8f3f3d1386236a084bdeb66e27ffa64fcd81a8
Sort numbers by quick sort
Pyronia/cvut.zal
06/sort.py
06/sort.py
# Machiavelli: "Divide and rule", Quick sort def sortNumbersBeforeRefactoring(weights, condition): left = [] center = [] right = [] if condition == 'ASC': if len(weights) > 1: pivot = weights[0] for element in weights: if pivot > element: ...
apache-2.0
Python
eaeb02839913136909cccc9a99612a1eb7145b97
support state hash in ota restore if specified
puttarajubr/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,SEL-Columbia/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,gmimano/commcaretest,dimagi/commcare-hq,dimagi/commcare-hq,gmimano/commcaretest,gmimano/commcaretest,dimagi/commcare-hq,SEL-Columbia...
corehq/apps/ota/views.py
corehq/apps/ota/views.py
from corehq.apps.users.models import CouchUser from django_digest.decorators import * from casexml.apps.phone.restore import generate_restore_response @httpdigest def restore(request, domain): """ We override restore because we have to supply our own user model (and have the domain in the url) """ ...
from corehq.apps.users.models import CouchUser from django_digest.decorators import * from casexml.apps.phone.restore import generate_restore_payload @httpdigest def restore(request, domain): """ We override restore because we have to supply our own user model (and have the domain in the url) """ ...
bsd-3-clause
Python
dca0404e6f14194be3a5926e522bbeea375e8456
add net spider rokic's version
KIDJourney/sbeamhub,KIDJourney/sbeamhub
crawler/discount_info.py
crawler/discount_info.py
import json import requests from bs4 import BeautifulSoup DOMAIN = "" API = "http://%s/api/" % (DOMAIN) STEAMDB_SALE_URL = "https://steamdb.info/sales/?merged=true&cc=cn" headers = { 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Charset': 'UTF-8,*;q=0.5', 'Accept-Enc...
mit
Python
1602513f2ee508ed70ec08af90a94cf150d14189
Add grep_token_logs.py
google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot
skolo/grep_token_logs.py
skolo/grep_token_logs.py
#!/usr/bin/env python # Copyright 2018 Google LLC. # # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Search the syslog on a jumphost to determine when auth tokens changed.""" import sys SYSLOG = '/var/log/syslog' WHITELIST_LINES = [ # (process-name, ...
bsd-3-clause
Python
04270ab58f88302f7b0fcd314ae29258c1c9a043
create mi matrix
googleinterns/e2e-convrec
data/build_probe_data.py
data/build_probe_data.py
import tensorflow.compat.v1 as tf from tqdm import tqdm from collections import defaultdict import sklearn import numpy as np import json with tf.io.gfile.GFile("gs://e2e_central/data/ml-sequences-train.tsv", 'r') as f: sequence_list = list(f) data = [] for sequence_str in tqdm(sequence_list): data.append([x...
apache-2.0
Python
417ff63118c967205ee630c5183b19a949a6c157
Add migrations for indicadores.
erikiado/jp2_online,erikiado/jp2_online,erikiado/jp2_online
indicadores/migrations/0002_auto_20170224_1535.py
indicadores/migrations/0002_auto_20170224_1535.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.2 on 2017-02-24 15:35 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('indicadores', '0001_initial'), ] operations = [ migrations.AlterField( ...
mit
Python
b7bf4586fea207453225a87fb85df59ccfc94e80
Add missing migration related to django-simple-history update
datasciencebr/jarbas,datasciencebr/jarbas,marcusrehm/serenata-de-amor,marcusrehm/serenata-de-amor,datasciencebr/jarbas,datasciencebr/serenata-de-amor,datasciencebr/serenata-de-amor,marcusrehm/serenata-de-amor,datasciencebr/jarbas,marcusrehm/serenata-de-amor
jarbas/core/migrations/0032_auto_20170613_0641.py
jarbas/core/migrations/0032_auto_20170613_0641.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.2 on 2017-06-13 09:41 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0031_add_index_together_for_reimbursement'), ] operations = [ migra...
mit
Python
60f051590a61ec4435f9bc5d46e430c5feb36f16
Add agent
eaufavor/chrome-webpage-profiler-webui,eaufavor/chrome-webpage-profiler-webui,eaufavor/chrome-webpage-profiler-webui,eaufavor/chrome-webpage-profiler-webui
agent/agent.py
agent/agent.py
#!/usr/bin/env python #http://www.acmesystems.it/python_httpd from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer import json, subprocess, os, time HELLO_MESSAGE = {'message':'hello, please use JSON via POST!'} ERROR_JSON_MESSAGE = {'message':'POST content type must be application/json!'} ERROR_BADJSON_MESSA...
apache-2.0
Python
7082f80d5be56073d9d2a66653188b2cee248a8e
add basic tests of search and matrix views
hms-dbmi/fourfront,hms-dbmi/fourfront,ENCODE-DCC/snovault,ENCODE-DCC/snovault,ENCODE-DCC/snovault,ENCODE-DCC/encoded,T2DREAM/t2dream-portal,hms-dbmi/fourfront,4dn-dcic/fourfront,ENCODE-DCC/encoded,ENCODE-DCC/snovault,ENCODE-DCC/snovault,4dn-dcic/fourfront,hms-dbmi/fourfront,4dn-dcic/fourfront,ENCODE-DCC/encoded,T2DREAM...
src/encoded/tests/test_search.py
src/encoded/tests/test_search.py
# Use workbook fixture from BDD tests (including elasticsearch) from .features.conftest import app_settings, app, workbook def test_search_view(workbook, testapp): res = testapp.get('/search/').json assert res['@type'] == ['Search'] assert res['@id'] == '/search/' assert res['@context'] == '/terms/' ...
mit
Python
2cd1da31b099cbf37552b2a049c3df6619e0e64f
Add helper enums for type encodings
gamenet/redis-memory-analyzer
rma/redis_types.py
rma/redis_types.py
REDIS_ENCODING_ID_RAW = 0 REDIS_ENCODING_ID_INT = 1 REDIS_ENCODING_ID_EMBSTR = 2 REDIS_ENCODING_ID_HASHTABLE = 3 REDIS_ENCODING_ID_ZIPLIST = 4 REDIS_ENCODING_ID_LINKEDLIST = 5 REDIS_ENCODING_ID_QUICKLIST =6 REDIS_ENCODING_ID_INTSET = 7 REDIS_ENCODING_ID_SKIPLIST = 8 REDIS_ENCODING_STR_TO_ID_LIB = { b'raw': REDIS_E...
mit
Python
6e577ecf55c107254816055ea810183b66e734b6
Add management command to tag older icds sms with indicator metadata
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
custom/icds/management/commands/tag_icds_sms.py
custom/icds/management/commands/tag_icds_sms.py
from corehq.apps.sms.models import SMS from corehq.messaging.smsbackends.icds_nic.models import SQLICDSBackend from datetime import datetime from django.core.management.base import BaseCommand SUBSTRINGS = { 'hin': { 'aww_1': u'\u0906\u0901\u0917\u0928\u0935\u093e\u095c\u0940 \u0915\u0947\u0902\u0926\u094d...
bsd-3-clause
Python
ea522fc3cdcec3d7e774cdaa93a36ef22c221432
Add file for parsing eyelink data
mwaskom/moss,mwaskom/moss
moss/eyelink.py
moss/eyelink.py
import os import subprocess import tempfile import shutil import numpy as np import pandas as pd class EyeData(object): def __init__(self, edf_file=None, asc_file=None): if edf_file is None and asc_file is None: raise ValueError("Must pass either EDF or ASCII file") self.settings =...
bsd-3-clause
Python
901046879338b1bc19de59675c7eb513bbc2c517
add problem 19
branning/euler,branning/euler
euler019.py
euler019.py
#!/usr/bin/env python firsts = [1] jan = 31 mar_dec = [31, 30, 31, 30, 31, 31, 30, 31, 30, 31] for year in range(1901,2001): firsts.append(firsts[-1] + jan) if year % 4 == 0 and year % 100 != 0 or year % 400 == 0: feb = 29 else: feb = 28 firsts.append(firsts[-1] + feb) for mon in mar_dec: firsts...
mit
Python
dfa5bee0720f8d4b5f3ac2309915090239780045
Test Flask file
btlee215/bme590hrm
flaskweb.py
flaskweb.py
from flask import Flask, request, jsonify app = Flask(__name__) @app.route("/hello/<name>") def hello(name): return "Hello World! %s" % name @app.route("/data/") def temptime(): arr = {"temp": [20, 21, 21],"time":[10,20,30],"unit":"s"} return jsonify(arr) @app.route("/add", methods = ['POST']) def sum():...
mit
Python
02f84b8cf3c3dd77b6d84d9ccea979c8de23eaa5
Add Awesome renderers
elastic7327/django-tdd-restful-api,elastic7327/django-tdd-restful-api
src/common/renderers.py
src/common/renderers.py
import time from rest_framework.renderers import JSONRenderer from django.shortcuts import resolve_url from django.template.loader import render_to_string from django.utils.encoding import force_str from django.utils.functional import Promise from rest_framework.renderers import BaseRenderer, JSONRenderer, TemplateHTML...
mit
Python
80a435e3e382791b5615755d05c5353114650ecc
test only
yaqintang/yaqintang.github.io
hello.py
hello.py
#!/usr/bin/python print "Content-type:text/html\r\n\r\n" print '<html>' print '<head>' print '<title>Hello Word - First CGI Program</title>' print '</head>' print '<body>' print '<h2>Hello Word! This is my first CGI program</h2>' print '</body>' print '</html>'
mit
Python
101f378fb536cdaf8f2c681f5b1fba669bf70631
Add hex xor
lttviet/randomPy
hexor.py
hexor.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- # xor 2 hex strings import string def isHex(s): '''Check if it is a hex string''' if (len(s) == 0 or len(s) % 2 != 0 or not all(c in string.hexdigits for c in s)): return False return True def hexor(s1, s2): '''xor 2 hex stri...
mit
Python
6a9d60a6e48b3231675e465c1a837c909a9e652a
Add forward2
LemonAniLabs/tensorflow-resnet
forward2.py
forward2.py
from convert import print_prob, load_image, checkpoint_fn, meta_fn import tensorflow as tf import resnet import os layers = 50 img = load_image("data/cat.jpg") sess = tf.Session() filename = checkpoint_fn(layers) filename = os.path.realpath(filename) if layers == 50: num_blocks = [3, 4, 6, 3] elif layers == ...
mit
Python
c794fbf00c5ba5b661f01fcbd0652105ed4c3904
Add missing migration.
praekelt/mc2,praekelt/mc2,praekelt/mc2,praekelt/mc2,praekelt/mc2
mc2/controllers/base/migrations/0005_field_defaults.py
mc2/controllers/base/migrations/0005_field_defaults.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('base', '0004_marathonlabel'), ] operations = [ migrations.AlterField( model_name='envvariable', name...
bsd-2-clause
Python
46a9c3789b86631258d881dacf6ae529ec277d70
Add stats262.py
lingdb/CoBL-public,lingdb/CoBL-public,lingdb/CoBL-public,lingdb/CoBL-public
ielex/lexicon/management/commands/stats262.py
ielex/lexicon/management/commands/stats262.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.core.management import BaseCommand from ielex.lexicon.models import Language, \ Meaning, \ Lexeme, \ CognateJudgementCitation class Command(B...
bsd-2-clause
Python
6f27af536f9421c2b73def505648a039d4f0ad1f
Manage Rackes Code
najla88/SaedRobot
ManageRacks.py
ManageRacks.py
import sqlite3 import gi import json gi.require_version('Gtk', '3.0') from gi.repository import Gtk con = sqlite3.connect('SaedRobot.db') cur = con.cursor() cur.execute("SELECT VOLSER from inventory") software_list = cur.fetchall() class ManageRack(Gtk.Window): builder =None window= None box = None def __...
mit
Python
a7728b466f5cacb662566e9e71ebc661ae40271a
Create max_end3.py
dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey
Python/CodingBat/max_end3.py
Python/CodingBat/max_end3.py
# http://codingbat.com/prob/p135290 def max_end3(nums): max = nums[0] if (nums[0] > nums[-1]) else nums[-1] # or use max(arg1, arg2) for i in range(3): nums[i] = max return nums
mit
Python
6ae82ecdd749b936289b496a10faa2caf1aa94c6
Add first version of the code
derherrg/pybibsort
bibsort.py
bibsort.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import re from collections import OrderedDict import codecs class BibEntry: def __init__(self, **kwargs): self.data = {} for key, value in kwargs.iteritems(): self.data[key] = value def entry(self): data = OrderedDict(...
mit
Python
2428467d8c0d9c70a4931e1bd1b5971c9f45a0b7
add function
BhaskarNaidu/python
function.py
function.py
def foo(x,y): print(x+y) foo(3,4)
apache-2.0
Python
9873891a9f26edc51a22e51b5910615a7e08d410
Create WaterLevel.py
Python-IoT/Smart-IoT-Planting-System,Python-IoT/Smart-IoT-Planting-System
device/src/WaterLevel.py
device/src/WaterLevel.py
#Water level sensor. #VCC #GND #AO <--> ADC Port(A7) Analog data #AO is the specific value. import pyb adc = pyb.ADC(Pin('A7')) # create an analog object from a pin adc = pyb.ADC(pyb.Pin.board.A7) # read an analog value def getWaterLevel(): print('WaterLevel Ao') return adc.read()
mit
Python
d43d4f29752bfae8a4d2e337f5523cd5fc7888d8
add Trimplementation of Kadane's algorithm
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...
dp/kadane-_algorithm/py/TrieToSucceed_kadane.py
dp/kadane-_algorithm/py/TrieToSucceed_kadane.py
#!/usr/bin/python3 """ This module contains an implementation of Kadane's algorithm to determine the maximum sum of a subarray. """ def kadane(list_obj=None): """ Find maximum sum of a subarray :param list list_int: list of objs :return: maximum sum of subarray :rtype: int DOCTESTS ------...
cc0-1.0
Python
08e43e8bfd150252b3e05ff62ee25cdf0e519f20
Revert #830 because it broke the case when the main script is not in path.
jpakkane/meson,becm/meson,pexip/meson,centricular/meson,ernestask/meson,aaronp24/meson,aaronp24/meson,QuLogic/meson,trhd/meson,jpakkane/meson,QuLogic/meson,jpakkane/meson,QuLogic/meson,jeandet/meson,mesonbuild/meson,rhd/meson,trhd/meson,ernestask/meson,becm/meson,fmuellner/meson,becm/meson,fmuellner/meson,ernestask/mes...
meson.py
meson.py
#!/usr/bin/env python3 # Copyright 2016 The Meson development team # 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 appl...
#!/usr/bin/env python3 # Copyright 2016 The Meson development team # 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 appl...
apache-2.0
Python
27b2e87a8653961fbba45962e9e6ec1d20904a03
Create demo_lcd.py
bradgillap/I2C-LCD-Display
20x4LCD/demo_lcd.py
20x4LCD/demo_lcd.py
import lcddriver from time import * lcd = lcddriver.lcd() lcd.lcd_display_string("Hello world", 1) lcd.lcd_display_string("My name is", 2) lcd.lcd_display_string("picorder", 3) lcd.lcd_display_string("I am a Raspberry Pi", 4)
apache-2.0
Python
2c345f2927cba033908020b97c33064bbfce5fbd
Add 38-count-and-say.py
mvj3/leetcode
38-count-and-say.py
38-count-and-say.py
""" Count and Say The count-and-say sequence is the sequence of integers beginning as follows: 1, 11, 21, 1211, 111221, ... 1 is read off as "one 1" or 11. 11 is read off as "two 1s" or 21. 21 is read off as "one 2, then one 1" or 1211. Given an integer n, generate the nth sequence. N...
mit
Python
e4a4e8d43c1b4c63ac32467a8e49a5b81f8f2fa3
Create roundrobin.py
LassiAutio/scheduler
roundrobin.py
roundrobin.py
import string from game import Game class RoundRobin(object): def __init__(self, teams_count): self.teams = generateTeams(teams_count) self.current_round = 0 def getRound(self): games = [] teams_count = len(self.teams) home_away_index = self.current_round // (t...
mit
Python
d1eac9803adbf9b91b22ce62a4bdf5db790b6265
Create ShodanToCSV.py
JeroenSlobbe/Scripts,JeroenSlobbe/Scripts,JeroenSlobbe/Scripts
ShodanToCSV.py
ShodanToCSV.py
#!/usr/bin/env python # # Search shodan, output to CSV # To ensure comma as seperator, all comma's in os and header field (if any) are replaced for ;;; # To ensure row integrity all newlines (\n) are replaced by #NWLN # Author: Jeroen import shodan import sys import os from optparse import OptionParser #Initialize us...
mit
Python
9be177007ce95f2b9e47225a46effe7b7682ba38
Create StockReader.py
econogee/FinanceScripts
StockReader.py
StockReader.py
#econogee, 1/28/2016 #Stock Data Retrieval Script import os import numpy as np import urllib2 startday = str(0) startmonth = str(1) startyear = str(2005) endday = str(30) endmonth = str(1) endyear = str(2016) symbols = [] with open('stocklist.csv') as f: content = f.readlines() for l in content: sy...
mit
Python
706da9008e8101c03bb2c7754b709209897cd952
Add Organization Administrator model.
MatthewWilkes/mw4068-packaging,MatthewWilkes/mw4068-packaging,MatthewWilkes/mw4068-packaging,MatthewWilkes/mw4068-packaging
app/soc/models/org_admin.py
app/soc/models/org_admin.py
#!/usr/bin/python2.5 # # Copyright 2008 the Melange authors. # # 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 applicab...
apache-2.0
Python
2e3349b75fffb9a9f3906d065bc8f141eef02d38
Add run_wsgi
aitoralmeida/intellidata,aitoralmeida/intellidata
run_wsgi.wsgi
run_wsgi.wsgi
#!/usr/bin/env python import os import sys sys.stdout = sys.stderr INTELLIDATA_DIR = os.path.dirname(__file__) sys.path.insert(0, INTELLIDATA_DIR) os.chdir(INTELLIDATA_DIR) import config from intellidata import app as application application.config.from_object('config')
apache-2.0
Python
a086e7328ca920f269812a87be095ce638467f95
Add youtube-dl library sample of operation
daineseh/python_code
crawler/youtube_dl_op_sample.py
crawler/youtube_dl_op_sample.py
#!/usr/bin/env python2 #-*- coding: utf-8 -*- import sys import youtube_dl def main(): if len(sys.argv) < 2: print("Usage: youtube_dl_op_sample.py URL") return opts = { 'forceurl': True, 'quiet': True, 'simulate': True, } url = sys.argv[1...
mit
Python
70927650139a94b1c7be5557e47340ccda609d36
Create UnicommWlan.py
xiaoyao9933/ChinaUnicomWlan-AutoLogin
UnicommWlan.py
UnicommWlan.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Auto login the unicomm wlan # By Lu CHAO(me@chao.lu) ,2013 10 12. from urllib2 import build_opener,HTTPCookieProcessor from urllib import urlencode from cookielib import CookieJar import time,sys from random import random global loop global count loop=True count=0 de...
apache-2.0
Python
a083baddd853514a5697e3a98eea4251c2ce5487
Create __openerp__.py
elmonitor/workshop-td
__openerp__.py
__openerp__.py
{ "name": "Product price based on margin with formula sale_price=cost_price/margin", "version": "8.0.0.1", "author": "3nodus", 'category': 'Product', "website": "http://www.3nodus.com/", "license": "AGPL-3", "depends": [ "product", ], "demo": [ ], "data": [ ...
agpl-3.0
Python
ca83457b4a003527cad9c9d57402c53e4571299c
add python opt and logging boilerplate code
yunfeiguo/bioinfo_toolbox,yunfeiguo/bioinfo_toolbox,yunfeiguo/bioinfo_toolbox
sandbox/python/boilerplate_code/python_opt_log.py
sandbox/python/boilerplate_code/python_opt_log.py
#!/usr/bin/env python import argparse import logging import os import sys import re logger = None def my_function(blah): return if __name__ == "__main__": FORMAT = '%(levelname)s %(asctime)-15s %(name)-20s %(message)s' parser = argparse.ArgumentParser(description="program name", formatter_class=argparse....
mit
Python