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 |
|---|---|---|---|---|---|---|---|---|
623115b7cb26c6402479845dd96e69c613ad4b98 | Create easy_23_DashInsert.py | GabrielGhe/CoderbyteChallenges,GabrielGhe/CoderbyteChallenges | easy_23_DashInsert.py | easy_23_DashInsert.py | def odd(ch):
return ch in '13579'
##############################
# Inserts dashes between odd #
# digits #
##############################
def DashInsert(num):
result = []
prev = ' '
for curr in str(num):
if odd(prev) and odd(curr):
result.append('-')
result.append(curr)
p... | mit | Python | |
bfe073671910efdd932b92c2bb40dc24c230733a | fix migrations | DMPwerkzeug/DMPwerkzeug,DMPwerkzeug/DMPwerkzeug,rdmorganiser/rdmo,rdmorganiser/rdmo,rdmorganiser/rdmo,DMPwerkzeug/DMPwerkzeug | apps/domain/migrations/0024_meta.py | apps/domain/migrations/0024_meta.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-11-14 12:11
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('domain', '0023_fix_label'),
]
operations = [
migrations.AlterModelManagers(
... | apache-2.0 | Python | |
b35dc73429d8625b298017625b4521a2f3a00eea | Add testing module | tommyogden/maxwellbloch,tommyogden/maxwellbloch | maxwellbloch/testing.py | maxwellbloch/testing.py | # -*- coding: utf-8 -*-
import nose
def run():
"""
Run all tests with nose.
"""
# runs tests in maxwellbloch.tests module
nose.run(defaultTest="maxwellbloch.tests", argv=['nosetests', '-v'])
| mit | Python | |
cc04592ea5ea15944f668928d5b8e6f7d8e257a1 | Update prefix-and-suffix-search.py | kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015 | Python/prefix-and-suffix-search.py | Python/prefix-and-suffix-search.py | # Time: ctor: O(w * l), w is the number of words, l is the word length on average
# search: O(m + n), m is the number of prefix match, n is the number of suffix match
# Space: O(w * l)
class Trie(object):
def __init__(self):
_trie = lambda: collections.defaultdict(_trie)
self.__trie ... | # Time: ctor: O(w * l), l is the word length on average
# search: O(m + n), m is the number of prefix match, n is the number of suffix match
# Space: O(w * l), w is the number of words
class Trie(object):
def __init__(self):
_trie = lambda: collections.defaultdict(_trie)
self.__trie ... | mit | Python |
6718e97b23d67dda6e67cda8226030edd90f7fbd | add env.py for the migrations | hypebeast/etapi,hypebeast/etapi,hypebeast/etapi,hypebeast/etapi | migrations/env.py | migrations/env.py | from __future__ import with_statement
from alembic import context
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
# Interpret the config file for Python... | bsd-3-clause | Python | |
cc3b29aaa2c0ffa3cde6b901bf4bdf3ce3fb4345 | Add code for pulling pitcher stats for specified date range | jldbc/pybaseball | pybaseball/league_pitching_stats.py | pybaseball/league_pitching_stats.py | import requests
import pandas as pd
from bs4 import BeautifulSoup
def get_soup(start_dt, end_dt):
# get most recent standings if date not specified
if((start_dt is None) or (end_dt is None)):
print('Error: a date range needs to be specified')
return None
url = "http://www.baseball-reference.com/leagues/daily.cg... | mit | Python | |
bd60a99d832d839d7535a5232453afa807d6e3ee | Create __init__.py | llamafarmer/Pi_Weather_Station,llamafarmer/Pi_Weather_Station,llamafarmer/Pi_Weather_Station | Pi_Weather_Station/__init__.py | Pi_Weather_Station/__init__.py | mit | Python | ||
f60123ea933cba6b57214ad335b244b48cc65fdf | Create valid-tic-tac-toe-state.py | tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015 | Python/valid-tic-tac-toe-state.py | Python/valid-tic-tac-toe-state.py | # Time: O(1)
# Space: O(1)
# A Tic-Tac-Toe board is given as a string array board. Return True
# if and only if it is possible to reach this board position
# during the course of a valid tic-tac-toe game.
#
# The board is a 3 x 3 array, and consists of characters " ", "X",
# and "O". The " " character represents an... | mit | Python | |
ee7a48da3ef6486c3650f9bcc1f4b59c59642adc | Add unittest-based PyDbLite test | dkkline/PyLiterDB | PyDbLite/test/test_pydblite.py | PyDbLite/test/test_pydblite.py | # -*- coding: iso-8859-1 -*-
import datetime
import unittest
import random
import os
import sys
sys.path.insert(0,os.path.dirname(os.getcwd()))
import PyDbLite
db = None
vals1 = [('simon',datetime.date(1984,8,17),26)]
vals2 = [('camille',datetime.date(1986,12,12),24),
('jean',datetime.date(1989,6,1... | bsd-3-clause | Python | |
403c724ffd9dab4ebdf3a58e02406969ed7a9fcb | Create front_back.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/front_back.py | Python/CodingBat/front_back.py | # http://codingbat.com/prob/p153599
def front_back(str):
if len(str) <= 1:
return str
return str[len(str)-1] + str[1:-1] + str[0]
| mit | Python | |
4a48b9998961be268cbfe64726ea78f68cedce39 | Create not_string.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/not_string.py | Python/CodingBat/not_string.py | # http://codingbat.com/prob/p189441
def not_string(str):
if str.startswith("not"):
return str
else:
return "not " + str
| mit | Python | |
2fc62908b2f0074a0e82a120809b80cb3e009999 | add __init__.py for distro | sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint | mint/distro/__init__.py | mint/distro/__init__.py | #
# Copyright (c) 2005 Specifix, Inc.
#
# All rights reserved
#
| apache-2.0 | Python | |
976f7b4239a1ff21d0748f43e8224017084118b7 | make neuroimaging.visualization.tests into a package | alexis-roche/niseg,arokem/nipy,nipy/nireg,alexis-roche/nipy,arokem/nipy,arokem/nipy,alexis-roche/register,bthirion/nipy,bthirion/nipy,alexis-roche/niseg,alexis-roche/nipy,bthirion/nipy,alexis-roche/nipy,nipy/nipy-labs,nipy/nireg,bthirion/nipy,nipy/nipy-labs,alexis-roche/nireg,alexis-roche/register,alexis-roche/nireg,al... | lib/visualization/tests/__init__.py | lib/visualization/tests/__init__.py | import test_visualization
import unittest
def suite():
return unittest.TestSuite([test_visualization.suite()])
| bsd-3-clause | Python | |
62987e89e08818749a40c18fa329562146b4f761 | Watch trigger added | Uname-a/knife_scraper,Uname-a/knife_scraper,Uname-a/knife_scraper | wow_watches.py | wow_watches.py | #!/usr/bin/env python
# bhq_query.py - module for sopel to query blade head quarters site for knife data
#
# Copyright (c) 2015 Casey Bartlett <caseytb@bu.edu>
#
# See LICENSE for terms of usage, modification and redistribution.
from sopel import *
@module.commands('wtc')
def knife(bot, trigger):
bot.reply("Lo... | mit | Python | |
11d42f7789ae3f0a020087b52389af9c98d07901 | add barebones mapper module | cizra/pycat,cizra/pycat | modules/mapper.py | modules/mapper.py | from modules.basemodule import BaseModule
import mapper.libmapper
import pprint
import re
import time
class Mapper(BaseModule):
def __init__(self, mud, mapfname='default.map'):
self.mapfname = mapfname
try:
with open(self.mapfname, 'r') as f:
ser = f.read()
... | unlicense | Python | |
b58d7ae6b9887b326ba485ce885deb9c03054801 | Create Factorial_of_a_number.py | Jeevan-J/Python_Funcode | Python3-5/Factorial_of_a_number.py | Python3-5/Factorial_of_a_number.py | #Write a program which can compute the factorial of a given numbers.
#We will first define a function
def fact(x): #Define a function named 'fact()'
if x == 0: #We directly return 1 if input number is 0.
return 1 ;
return x * fact(x - 1); # We return 'number * fact(number ... | bsd-2-clause | Python | |
a9f6caf863b5c3156c3200d33a6cdc29f0c2ad23 | Add new py-hacking package (#14027) | iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack | var/spack/repos/builtin/packages/py-hacking/package.py | var/spack/repos/builtin/packages/py-hacking/package.py | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyHacking(PythonPackage):
"""OpenStack Hacking Guideline Enforcement."""
homepage = "... | lgpl-2.1 | Python | |
e6641065af9078e2e50e99f657aa605d837d3976 | add new package (#20112) | LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-vcstool/package.py | var/spack/repos/builtin/packages/py-vcstool/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class PyVcstool(PythonPackage):
"""vcstool enables batch commands on multiple different vcs repositories.
Curren... | lgpl-2.1 | Python | |
701f6a06b8405620905a67b47c5702c100a1447a | Check to make sure the input file is sorted | hms-dbmi/clodius,hms-dbmi/clodius | scripts/check_sorted.py | scripts/check_sorted.py | import sys
prev_val = 0
prev_val2 = 0
counter = 0
for line in sys.stdin:
parts = line.split()
curr_val = int(parts[0])
curr_val2 = int(parts[1])
val1 = int(parts[0])
val2 = int(parts[1])
if val1 > val2:
print >>sys.stderr, "Not triangular:", counter
sys.exit(1)
if curr_v... | mit | Python | |
0aa5466be1ba678f0428e825def010a5007059c7 | Modify tests to show Unicode handling regression | hashamali/pyScss,Kronuz/pyScss,hashamali/pyScss,cpfair/pyScss,Kronuz/pyScss,hashamali/pyScss,Kronuz/pyScss,Kronuz/pyScss,cpfair/pyScss,cpfair/pyScss | scss/tests/test_misc.py | scss/tests/test_misc.py | # -*- encoding: utf-8 -*-
"""Tests for miscellaneous features that should maybe be broken out into their
own files, maybe.
"""
from scss import Scss
def test_super_selector():
compiler = Scss(scss_opts=dict(style='expanded'))
input = """\
foo, bar {
a: b;
}
baz {
c: d;
}
"""
expected = """\
super foo... | # -*- encoding: utf-8 -*-
"""Tests for miscellaneous features that should maybe be broken out into their
own files, maybe.
"""
from scss import Scss
def test_super_selector():
compiler = Scss(scss_opts=dict(style='expanded'))
input = """\
foo, bar {
a: b;
}
baz {
c: d;
}
"""
expected = """\
super foo... | mit | Python |
b2532cfeb3541a64143ded6d86b635e2c9049080 | Clean up some pylint warnings | linas/link-grammar,opencog/link-grammar,ampli/link-grammar,ampli/link-grammar,ampli/link-grammar,MadBomber/link-grammar,opencog/link-grammar,opencog/link-grammar,opencog/link-grammar,MadBomber/link-grammar,opencog/link-grammar,ampli/link-grammar,ampli/link-grammar,linas/link-grammar,opencog/link-grammar,MadBomber/link-... | bindings/python-examples/example.py | bindings/python-examples/example.py | #! /usr/bin/env python
# -*- coding: utf8 -*-
#
# Link Grammar example usage
#
import locale
from linkgrammar import Sentence, ParseOptions, Dictionary
# from linkgrammar import _clinkgrammar as clg
locale.setlocale(locale.LC_ALL, "en_US.UTF-8")
po = ParseOptions()
def desc(lkg):
print lkg.diagram()
print ... | #! /usr/bin/env python
# -*- coding: utf8 -*-
#
# Link Grammar example usage
#
import locale
from linkgrammar import Sentence, ParseOptions, Dictionary
# from linkgrammar import _clinkgrammar as clg
locale.setlocale(locale.LC_ALL, "en_US.UTF-8")
po = ParseOptions()
def desc(linkage):
print linkage.diagram()
... | lgpl-2.1 | Python |
39473b1aa0d8c54b0fb43b5e97545596ed087d59 | Create set-intersection-size-at-least-two.py | tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015 | Python/set-intersection-size-at-least-two.py | Python/set-intersection-size-at-least-two.py | # Time: O(nlogn)
# Space: O(n)
# An integer interval [a, b] (for integers a < b) is a set of all consecutive integers from a to b,
# including a and b.
#
# Find the minimum size of a set S such that for every integer interval A in intervals,
# the intersection of S with A has size at least 2.
#
# Example 1:
# Input: ... | mit | Python | |
208fed6d1e162dd0fcfa10c2b79d0d35ea813478 | Create intermediate-171.py | MaximeKjaer/dailyprogrammer-challenges | Challenge-171/Intermediate/intermediate-171.py | Challenge-171/Intermediate/intermediate-171.py | #Challenge 171 Intermediate
hexvalue = 'FF 81 BD A5 A5 BD 81 FF'.split(' ')
binary = [bin(int(line, 16))[2:].zfill(8) for line in hexvalue] #Convert it to a list of binary lines
image = [pixel.replace('1', '*').replace('0', ' ') for pixel in binary] #Convert it to a list of lines
print 'ORIGINAL IMAGE'
print '\n'.join... | mit | Python | |
752b5b43aa807e5431615219d40eafd38cacadeb | Increase length of report name on Report model | knowledge4life/django-onmydesk,alissonperez/django-onmydesk,alissonperez/django-onmydesk,knowledge4life/django-onmydesk,knowledge4life/django-onmydesk,alissonperez/django-onmydesk | onmydesk/models.py | onmydesk/models.py | """
Required models to handle and store generated reports.
"""
from django.db import models
from django.conf import settings
from onmydesk.utils import my_import
ONMYDESK_FILE_HANDLER = getattr(settings, 'ONMYDESK_FILE_HANDLER', None)
def output_file_handler(filepath):
"""
Returns the output filepath (hand... | """
Required models to handle and store generated reports.
"""
from django.db import models
from django.conf import settings
from onmydesk.utils import my_import
ONMYDESK_FILE_HANDLER = getattr(settings, 'ONMYDESK_FILE_HANDLER', None)
def output_file_handler(filepath):
"""
Returns the output filepath (hand... | mit | Python |
bdf5cfb2a7b716d897dabd62e591caad8144a029 | Add election funding parsing script | kansanmuisti/kamu,kansanmuisti/kamu,kansanmuisti/kamu,kansanmuisti/kamu,kansanmuisti/kamu | utils/populate-funding.py | utils/populate-funding.py | #!/usr/bin/python
import os
import sys
import csv
from optparse import OptionParser
from django.core.management import setup_environ
my_path = os.path.abspath(os.path.dirname(__file__))
app_path = os.path.normpath(my_path + '/..')
app_base = app_path + '/'
# We need a path like '<app_path>/utils:<app_path>:<app_pat... | agpl-3.0 | Python | |
30b53c525b2319cc664d26d083c84bba1b63ff7c | add unit test for s3 cache | camptocamp/mapproxy,vrsource/mapproxy,mapproxy/mapproxy,olt/mapproxy,olt/mapproxy,mapproxy/mapproxy,vrsource/mapproxy,camptocamp/mapproxy,drnextgis/mapproxy,drnextgis/mapproxy | mapproxy/test/unit/test_cache_s3.py | mapproxy/test/unit/test_cache_s3.py | # This file is part of the MapProxy project.
# Copyright (C) 2011 Omniscale <http://omniscale.de>
#
# 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... | apache-2.0 | Python | |
a332a057292e701e197b5ac2250e608ef953d631 | Add example config | diath/pyfsw,diath/pyfsw,diath/pyfsw | pyfsw/config.example.py | pyfsw/config.example.py | # Database URI Scheme (Refer to the SQLAlchemy documentation for variations)
DB_URI = ''
# Secret Key
SECRET_KEY = 'pyfsw'
# Network Host
NET_HOST = '127.0.0.1'
# Network Port
NET_PORT = 5000
# Debug Mode
DEBUG = False
# Debug Profiler
DEBUG_PROFILER = False
# Date Format
DATE_FORMAT = '%m/%d/%y %I:%M %p'
# Cach... | mit | Python | |
9bed52b93061fea7381492ffe0ce55c6929eab78 | Add tests.py to app skeleton. | lsgunth/rapidsms,peterayeni/rapidsms,dimagi/rapidsms,lsgunth/rapidsms,dimagi/rapidsms,catalpainternational/rapidsms,catalpainternational/rapidsms,eHealthAfrica/rapidsms,rapidsms/rapidsms-core-dev,ken-muturi/rapidsms,ehealthafrica-ci/rapidsms,eHealthAfrica/rapidsms,peterayeni/rapidsms,caktus/rapidsms,rapidsms/rapidsms-c... | lib/rapidsms/skeleton/app/tests.py | lib/rapidsms/skeleton/app/tests.py | from rapidsms.tests.scripted import TestScript
from app import App
class TestApp (TestScript):
apps = (App,)
# define your test scripts here.
# e.g.:
#
# testRegister = """
# 8005551212 > register as someuser
# 8005551212 < Registered new user 'someuser' for 8005551212!
# 8005551... | bsd-3-clause | Python | |
4c78124a434d4f953d5811ee2708eaf051bd591e | Create setup_data_libraries.py | bgruening/galaxy-rna-workbench,mwolfien/galaxy-rna-workbench,mwolfien/galaxy-rna-workbench,bgruening/galaxy-rna-workbench,mwolfien/galaxy-rna-workbench,bgruening/galaxy-rna-workbench | setup_data_libraries.py | setup_data_libraries.py | #!/usr/bin/env python
import argparse
import logging as log
import sys
import time
import yaml
from bioblend import galaxy
def setup_data_libraries(gi, data):
"""
Load files into a Galaxy data library.
By default all test-data tools from all installed tools
will be linked into a data library.
""... | mit | Python | |
d78872da09bc67435a2662cce0b253ab149b2bad | Create 03.py | ezralalonde/cloaked-octo-sansa | 02.5/03.py | 02.5/03.py | # By Websten from forums
#
# Given your birthday and the current date, calculate your age in days.
# Compensate for leap days.
# Assume that the birthday and current date are correct dates (and no time travel).
# Simply put, if you were born 1 Jan 2012 and todays date is 2 Jan 2012
# you are 1 day old.
#
# Hint
# A... | bsd-2-clause | Python | |
d2b3996edc1af3f7f491354a762b8bd34c8345a1 | Create remove_string_spaces.py | Kunalpod/codewars,Kunalpod/codewars | remove_string_spaces.py | remove_string_spaces.py | #Kunal Gautam
#Codewars : @Kunalpod
#Problem name: Remove String Spaces
#Problem level: 8 kyu
def no_space(x):
return ''.join(x.split())
| mit | Python | |
8ea44bc5daa099ccc2e48c606f38a424235b9f3d | Create a.py | y-sira/atcoder,y-sira/atcoder | abc001/a.py | abc001/a.py | h1 = int(input())
h2 = int(input())
print(h1 - h2)
| mit | Python | |
947570fcc24458c4d7d6e44db0849abdf8055ccb | Add script for generating manifests | arcticfoxnv/coldbrew,arcticfoxnv/coldbrew,arcticfoxnv/coldbrew | packer/manifest.py | packer/manifest.py | #!/usr/bin/env python
import argparse
import hashlib
import json
class Manifest(object):
def __init__(self, name=None, description=None, versions=None):
self.name = name
self.description = description
self.versions = versions
def load(self, filename):
with open(filename, 'rb') as f:
data = ... | mit | Python | |
730b11a45696b4d4b8b0e56c0028ec6eeca7da4f | Create a.py | y-sira/atcoder,y-sira/atcoder | agc017/a.py | agc017/a.py | import math
def comb(n, r):
return math.factorial(n) / math.factorial(r) / math.factorial(n - r)
def main():
n, p = map(int, input().split())
a = tuple(map(lambda x: int(x) % 2, input().split()))
if n == 1 and a[0] % 2 != p:
print(0)
return 0
t = len(tuple(filter(lambda x... | mit | Python | |
15b1779475c7744a85e948c419de34be038fba94 | Add lc0314_binary_tree_vertical_order_traversal.py | bowen0701/algorithms_data_structures | lc0314_binary_tree_vertical_order_traversal.py | lc0314_binary_tree_vertical_order_traversal.py | """Leetcode 314. Binary Tree Vertical Order Traversal
Medium
URL: https://leetcode.com/problems/binary-tree-vertical-order-traversal/
Given a binary tree, return the vertical order traversal of its nodes' values.
(ie, from top to bottom, column by column).
If two nodes are in the same row and column, the order shoul... | bsd-2-clause | Python | |
934e907180645e3dc618ff5c75a4982656310673 | Add the arrayfns compatibility library -- not finished. | moreati/numpy,bmorris3/numpy,rajathkumarmp/numpy,mwiebe/numpy,nbeaver/numpy,gfyoung/numpy,tynn/numpy,ESSS/numpy,astrofrog/numpy,jonathanunderwood/numpy,pdebuyl/numpy,cowlicks/numpy,moreati/numpy,ahaldane/numpy,mattip/numpy,cjermain/numpy,Srisai85/numpy,Anwesh43/numpy,gfyoung/numpy,charris/numpy,seberg/numpy,ogrisel/num... | numpy/oldnumeric/arrayfns.py | numpy/oldnumeric/arrayfns.py | """Backward compatible with arrayfns from Numeric
"""
__all__ = ['array_set', 'construct3', 'digitize', 'error', 'find_mask', 'histogram', 'index_sort',
'interp', 'nz', 'reverse', 'span', 'to_corners', 'zmin_zmax']
import numpy as nx
from numpy import asarray
class error(Exception):
pass
def array_se... | bsd-3-clause | Python | |
d5daa2376fadae0d6715b606a0c355b572efdd0c | Add Python benchmark | stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib | lib/node_modules/@stdlib/math/base/dist/beta/kurtosis/benchmark/python/benchmark.scipy.py | lib/node_modules/@stdlib/math/base/dist/beta/kurtosis/benchmark/python/benchmark.scipy.py | #!/usr/bin/env python
"""Benchmark scipy.stats.beta.stats."""
import timeit
name = "beta:kurtosis"
repeats = 3
iterations = 1000
def print_version():
"""Print the TAP version."""
print("TAP version 13")
def print_summary(total, passing):
"""Print the benchmark summary.
# Arguments
* `total`... | apache-2.0 | Python | |
03de607d14805779ed9653b65a5bd5cee3525903 | Add the IFTTT campaign success server plugin | securestate/king-phisher-plugins,zeroSteiner/king-phisher-plugins,securestate/king-phisher-plugins,wolfthefallen/king-phisher-plugins,zeroSteiner/king-phisher-plugins,wolfthefallen/king-phisher-plugins | server/ifttt_on_campaign_success.py | server/ifttt_on_campaign_success.py | import collections
import king_phisher.plugins as plugin_opts
import king_phisher.server.plugins as plugins
import king_phisher.server.signals as signals
import requests
class Plugin(plugins.ServerPlugin):
authors = ['Spencer McIntyre']
title = 'IFTTT Campaign Success Notification'
description = """
A plugin tha... | bsd-3-clause | Python | |
7e7879eb5c0d547a56a082a9b3a444fea59e9156 | Create revEncry.py | NendoTaka/CodeForReference,NendoTaka/CodeForReference,NendoTaka/CodeForReference | Codingame/Python/Clash/revEncry.py | Codingame/Python/Clash/revEncry.py | import sys
import math
# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.
word = input()
for x in word:
o = ord(x)
k = 122-o
print(chr(97+k),end='')
| mit | Python | |
0d8fe16a3d2c70c24fe9743d8c2d2ac721a1435e | Test case for the previous commit. | apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb | test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py | test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py | """
Test that you can set breakpoint commands successfully with the Python API's:
"""
import os
import re
import unittest2
import lldb, lldbutil
import sys
from lldbtest import *
class PythonBreakpointCommandSettingTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
my_var = 10
@unittest2.skipU... | apache-2.0 | Python | |
625548dfc54a7f0620a83f62435c6e246dc58d12 | Solve 18. | klen/euler | 018/solution.py | 018/solution.py | """ Project Euler problem #18. """
def problem():
""" Solve the problem.
Find the maximum total from top to bottom of the triangle below.
Answer:
"""
triangle = """
75
95 64
17 47 82
18 35 87 10
20 04 82 47 65
19 01 23 75 03 34
88 02 77 73... | mit | Python | |
b647416b719c9f0b2534c13a67d3396fefaada47 | Add problem 1 sum muliples of 3 or 5 python solution | ChrisFreeman/project-euler | p001_multiples_of_3_and_5.py | p001_multiples_of_3_and_5.py | #
'''
Project Euler - Problem 1 - Multiples of 3 and 5
https://projecteuler.net/problem=1
If we list all the natural numbers below 10 that are multiples of 3 or 5, we
get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
'''
import sys
def main():
'''Sum t... | mit | Python | |
6c806f12129d132db17cf601335f638b82a814d6 | Create form.py | MateusJFabricio/ProjVeiculoMapeamentoAutomatico,MateusJFabricio/ProjVeiculoMapeamentoAutomatico | AutoMap/form.py | AutoMap/form.py | import turtle
import Tkinter as tk
def desenha(distancia, angulo, lousa):
lousa.penup()
lousa.home()
lousa.left(angulo)
lousa.pendown()
lousa.forward(distancia)
def main():
app = tk.Tk()
app.title("Mapeamento 2D de ambiente ")
app.fontePadrao = ("Arial", "10", "bold")
... | unlicense | Python | |
0c2f07fabb94698b8cf1b42a4f671ad0cd5e365f | Add migration for comment notification type | edofic/ggrc-core,plamut/ggrc-core,AleksNeStu/ggrc-core,andrei-karalionak/ggrc-core,andrei-karalionak/ggrc-core,kr41/ggrc-core,josthkko/ggrc-core,NejcZupec/ggrc-core,prasannav7/ggrc-core,josthkko/ggrc-core,VinnieJohns/ggrc-core,kr41/ggrc-core,selahssea/ggrc-core,VinnieJohns/ggrc-core,NejcZupec/ggrc-core,j0gurt/ggrc-core... | src/ggrc/migrations/versions/20160321011353_3914dbf78dc1_add_comment_notification_type.py | src/ggrc/migrations/versions/20160321011353_3914dbf78dc1_add_comment_notification_type.py | # Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: miha@reciprocitylabs.com
# Maintained By: miha@reciprocitylabs.com
"""
Add comment notification type
Create Date: 2016-03-21 01:13:53.293580
"""
#... | apache-2.0 | Python | |
32e6a86f3e7cef04c67e1ae61db1959264d084bb | Add script for deep harvesting a nuxeo folder | barbarahui/nuxeo-calisphere,barbarahui/nuxeo-calisphere | s3stash/stash_folder.py | s3stash/stash_folder.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import argparse
import logging
from s3stash.stash_collection import Stash
_loglevel_ = 'INFO'
def main(nxpath, pynuxrc="~/.pynuxrc", replace=True, loglevel=_loglevel_):
# set up logging
logfile = 'logs/stash_folder'
numeric_level = getattr(logging,... | bsd-3-clause | Python | |
2a6f3eca3187f8e4ca078cb592bb324a735cc246 | Create solution.py | lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges | hackerrank/algorithms/sorting/easy/find_the_median/py/solution.py | hackerrank/algorithms/sorting/easy/find_the_median/py/solution.py | #!/bin/python
def partition(L, lo, hi):
# Lomuto partitioning.
#
i = j = lo
v = hi - 1
while i < hi:
if L[i] < L[v]:
L[i], L[j] = L[j], L[i]
j += 1
i += 1
L[v], L[j] = L[j], L[v]
return j
def median(L):
# Hoare's quick select.
#
if len(L)... | mit | Python | |
6f7ed6f3b082c7f6399ab456a6f6b291219c910f | ADD migration scripts for uom prices | ingadhoc/product,ingadhoc/product | product_uom_prices/migrations/8.0.0.5.0/pre-migration.py | product_uom_prices/migrations/8.0.0.5.0/pre-migration.py | # -*- encoding: utf-8 -*-
from openerp import SUPERUSER_ID
from openerp.modules.registry import RegistryManager
def set_value(cr, model, table, field, value, condition):
print 'Set value %s on field %s on table %s' % (
value, field, table)
cr.execute('SELECT id '
'FROM %(table)s '
... | agpl-3.0 | Python | |
0f072c8d9cc5dd89d375bf96ed9436f70de8c9cb | Create chivey.py | th36r1m/Chivey | chivey.py | chivey.py | #!/usr/bin/python
import urllib2
import os
pic = 1
_path = []
currentDir = os.getcwd()
error = 0
year = 2013
month = 7
_time = 6
MAX_ERROR = 10
MIN_MONTH = 01
pathCount = 0
def menu():
print 'Select a category to copy:'
print
print '[0] Fit Girls [6] Girls lingerie'
print '[1] Sexy Bikinis [7]... | mit | Python | |
121a80669b4b50665a7baafd3434cb3e574087f4 | Adjust phases to make campaign non-editable | jfterpstra/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle | bluebottle/bb_projects/migrations/0004_adjust_phases.py | bluebottle/bb_projects/migrations/0004_adjust_phases.py | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from bluebottle.utils.model_dispatcher import get_model_mapping
MODEL_MAP = get_model_mapping()
class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards me... | bsd-3-clause | Python | |
9b6f86cb2f4763625127a3d9d236238a4dd998ba | Create fileExamples.py | ReginaExMachina/royaltea-word-app,ReginaExMachina/royaltea-word-app | Bits/fileExamples.py | Bits/fileExamples.py | #!/usr/bin/env python
# CREATING A NEW FILE
file = open("newfile.txt", "w")
file.write("hello world in the new file\n")
file.write("and another line\n")
file.close()
# READING A FILE
file = open('newfile.txt', 'r')
print file.read() #Put n for the first n chars
# LOOPING OVER FILE
file = open('newfile.txt', 'r')
... | mit | Python | |
ae1839cbb521be5cb7e76d87bdd65f1e736ccf8d | Add python version of register-result with more robust json serialisation | panubo/docker-monitor,panubo/docker-monitor,panubo/docker-monitor | register-result.py | register-result.py | #!/usr/bin/env python
import json
import socket
import sys
if len(sys.argv) < 4:
print("Error: Usage <register-result> <client> <name> <output> <status> <ttl>")
sys.exit(128)
check_client = sys.argv[1]
check_name = sys.argv[2]
check_output = sys.argv[3]
check_status = int(sys.argv[4])
check_ttl = int(sys.arg... | mit | Python | |
1b36f7e837f6c15cab838edfaf6464bef0c88c6d | Add migration for request notification types | NejcZupec/ggrc-core,prasannav7/ggrc-core,VinnieJohns/ggrc-core,andrei-karalionak/ggrc-core,selahssea/ggrc-core,edofic/ggrc-core,NejcZupec/ggrc-core,kr41/ggrc-core,NejcZupec/ggrc-core,edofic/ggrc-core,prasannav7/ggrc-core,selahssea/ggrc-core,prasannav7/ggrc-core,plamut/ggrc-core,j0gurt/ggrc-core,kr41/ggrc-core,prasannav... | src/ggrc/migrations/versions/20160304124523_50c374901d42_add_request_notification_types.py | src/ggrc/migrations/versions/20160304124523_50c374901d42_add_request_notification_types.py |
"""Add request notification types
Revision ID: 50c374901d42
Revises: 4e989ef86619
Create Date: 2016-03-04 12:45:23.024224
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.sql import column
from sqlalchemy.sql import table
# revision identifiers, used by Alembic.
revision = '50c374901d42'
down_rev... | apache-2.0 | Python | |
9665113ef9a6f7fae89b8a0b7b15289ac41996f4 | Create mySolution.py | CptDemocracy/Python | Puzzles/checkio/Home/Min-and-Max/mySolution.py | Puzzles/checkio/Home/Min-and-Max/mySolution.py | def minMaxArgs(key, operator, *args):
if key == None:
key = lambda x : x
minMaxVal = args[0]
for arg in args:
cmpKey = key(arg)
if operator(cmpKey, key(minMaxVal)):
minMaxVal = arg
return minMaxVal
def minMaxIter(iterable, operator, key):
if key == Non... | mit | Python | |
2a21ee4b263692872f11ebae18663119c5041d5e | Add test for requirements | openstack/bareon,openstack/bareon | fuel_agent/tests/test_requirements.py | fuel_agent/tests/test_requirements.py | # -*- coding: utf-8 -*-
# Copyright 2015 Mirantis, 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 requi... | apache-2.0 | Python | |
39c64ddf7bddb7110d6c85a5ad3c54bf95c334a2 | Create client.py | jasonblanks/pyCWStats | client.py | client.py | import sys, stat, os, re, time, base64, getpass, socket, smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
#Email settings
mail_user = "email@email.com"
mail_pwd = "password"
FROM = 'email@email.com'
TO = ['email@email.com'] #must be a list
SUBJECT = "BETA TEST: GLSA Clearwell... | apache-2.0 | Python | |
1bd9013c925cfbbebcff33bf7796fde729d26b34 | add cardify script | district10/blog,district10/blog,district10/blog,district10/blog | cardify.py | cardify.py | import os
import re
import sys
import glob
import errno
import shutil
from typing import Dict, Tuple, Union, Any, List, Optional
from pprint import pprint
def mkdir_p(path: str):
try:
path = os.path.abspath(path)
os.makedirs(path)
except OSError as e:
if e.errno == errno.EEXIST and os.... | mit | Python | |
fddbbc536ad5097769d924d49420e7d5d2e5999f | Update app/extensions/minify/__init__.py | apipanda/openssl,apipanda/openssl,apipanda/openssl,apipanda/openssl | app/extensions/minify/__init__.py | app/extensions/minify/__init__.py | from htmlmin import Minifier
class HTMLMIN(object):
def __init__(self, app=None, **kwargs):
self.app = app
if app is not None:
self.init_app(app)
default_options = {
'remove_comments': True,
'reduce_empty_attributes': True,
'remove_optional_... | mit | Python | |
118a4af7fbc2455d1dcde54e7041a3919f760d69 | Create switch_controls_snmp.py | kylehogan/hil,apoorvemohan/haas,meng-sun/hil,SahilTikale/haas,apoorvemohan/haas,henn/hil_sahil,henn/hil,lokI8/haas,CCI-MOC/haas,SahilTikale/switchHaaS,henn/hil_sahil,meng-sun/hil,kylehogan/hil,kylehogan/haas,henn/hil,henn/haas | python-mocutils/mocutils/switch_controls_snmp.py | python-mocutils/mocutils/switch_controls_snmp.py | #! /usr/bin/python
import os
def make_remove_vlans(vlan_ids,add,switch_ip='192.168.0.1',community='admin'):
# Expects that you send a string which is a comma separated list of vlan_ids and a bool for adding or removing
OID_portVlanId='1.3.6.1.4.1.11863.1.1.4.3.1.1.2.1.1'
OID_portVlanStatus='1.3.6.1.4.1.11863.1.1.4.... | apache-2.0 | Python | |
f009f42c168e396e437e08914dc28eb1e08fb7fe | test of c++ wavefront code on big donut | aaronroodman/Donut,aaronroodman/Donut,aaronroodman/Donut | test/test-bigdonut-cpp.py | test/test-bigdonut-cpp.py | ###
### Script for fitting a BIG donut
###
import numpy as np
from donutlib.donutfit import donutfit
fitinitDict = {"nZernikeTerms":15,"fixedParamArray1":[0,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],"fixedParamArray2":[0,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1... | mit | Python | |
2f2e7605d87ef06c547df660805abb99835dee18 | Add a snippet. | jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets | python/pyqt/pyqt5/widget_QAction.py | python/pyqt/pyqt5/widget_QAction.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QApplication, QMainWindow, QLabel, QAction, QSizePolicy
app = QApplication(sys.argv)
# The default constructor has no parent.
# A widget with no parent is a window.
window = QMainWindow()
window.setWind... | mit | Python | |
75a9584cc859d60c598582b382f41bd685579072 | add a new config file at the project root | heprom/pymicro | config.py | config.py | import os
PYMICRO_ROOT_DIR = os.path.abspath(os.curdir)
PYMICRO_EXAMPLES_DATA_DIR = os.path.join(PYMICRO_ROOT_DIR, 'examples', 'data')
PYMICRO_XRAY_DATA_DIR = os.path.join(PYMICRO_ROOT_DIR, 'pymicro', 'xray', 'data') | mit | Python | |
8212faa90328daabb85c7e877942a667aa200119 | add config.py | sljeff/JBlog,sljeff/JBlog,sljeff/JBlog | config.py | config.py | import configparser
import datetime
__all__ = ['blog_name', 'categories', 'dates', 'article_num']
config = configparser.ConfigParser()
config.read('blog.ini', encoding='utf-8')
DEFAULT = config['DEFAULT']
blog_name = DEFAULT.get('blog_name', "No Name Here")
pre_category_name = DEFAULT.get('category_name', ... | mit | Python | |
5259453165cca4767743469b5e77c6eabe444839 | add config.py | samtx/whatsmyrankine,samtx/whatsmyrankine,samtx/whatsmyrankine,samtx/whatsmyrankine,samtx/whatsmyrankine | config.py | config.py | class Config(object):
DEBUG = False
TESTING = False
CSRF_ENABLED = True
SECRET_KEY = 'this-really-needs-to-be-changed'
class ProductionConfig(Config):
DEBUG = False
class StagingConfig(Config):
DEVELOPMENT = True
DEBUG = True
class DevelopmentConfig(Config):
DEVELOPMENT = True
... | mit | Python | |
979d0906ba1bc7f3ec3e77a6e09ec8a1a2449323 | add clean config.py | will-iam/Variant,will-iam/Variant,will-iam/Variant | config.py | config.py | import os
workspace = os.getcwd()
gnu_CC = 'gcc'
gnu_CXX = 'g++'
clang_CC = 'clang'
clang_CXX = 'clang++'
intel_CC = 'icc'
intel_CXX = 'icpc'
mpi_CC = 'mpicc'
mpi_CXX = 'mpic++'
# keywords are: $mpi_nprocs, $ncores
mpi_RUN = 'mpirun -hostfile hostfile -np $mpi_nprocs'
core_per_node = 2
# tmp dir to launch a run.... | mit | Python | |
47b88e59781cf2aeb1a4bb3b6b97ceaf6b883820 | Add prime count | sitdh/com-prog | cpp_10.py | cpp_10.py | first_number = int(input())
if 0 == int(first_number):
print('none')
exit()
prime_count = ''
while True:
if 2 == first_number:
prime_count = '2'
break
running_number = first_number
divider = first_number // 2 if ( 0 == first_number % 2 ) else ( first_number // 2 ) + 1;
coun... | mit | Python | |
ccac9cddfad2b883fc8e2c7c8ab27607ba8c4c63 | Create config.py | ThisIsAmir/TweenRoBot,ThisIsAmir/TweenRoBot | config.py | config.py | token = '252128496:AAHUDCZJlHpd21b722S4B_n6prn8RUjy4'
is_sudo = '223404066' #@This_Is_Amir
relam = '-133494595'
# ___ __ __ _ _ _ _____
# / _ \ / _|/ _| | (_) \ | | __|_ _|__ __ _ _ ... | mit | Python | |
9fae2d4c7ecc35bde8079f5a71a2b369690cd9a3 | add config.py | MinnPost/salesforce-stripe,texastribune/salesforce-stripe,texastribune/salesforce-stripe,MinnPost/salesforce-stripe,texastribune/salesforce-stripe,MinnPost/salesforce-stripe | config.py | config.py | import os
import stripe
stripe_keys = {
'secret_key': os.environ['SECRET_KEY'],
'publishable_key': os.environ['PUBLISHABLE_KEY']
}
SALESFORCE = {
"CLIENT_ID": os.environ[ 'SALESFORCE_CLIENT_ID' ],
"CLIENT_SECRET": os.environ[ 'SALESFORCE_CLIENT_SECRET' ],
"USERNAME": os.environ[ 'SALESFORCE_USERNA... | mit | Python | |
298f7d65ba29a0524ff2a3f8eb4b564ed91ad057 | Document find_by_name so I remember what to do with it. | brantai/python-rightscale,diranged/python-rightscale-1 | rightscale/util.py | rightscale/util.py | import os.path
import ConfigParser
CFG_USER_RC = '.rightscalerc'
CFG_SECTION_OAUTH = 'OAuth'
CFG_OPTION_ENDPOINT = 'api_endpoint'
CFG_OPTION_REF_TOKEN = 'refresh_token'
_config = None
class HookList(list):
pass
class HookDict(dict):
pass
def get_config():
global _config
if not _config:
_... | import os.path
import ConfigParser
CFG_USER_RC = '.rightscalerc'
CFG_SECTION_OAUTH = 'OAuth'
CFG_OPTION_ENDPOINT = 'api_endpoint'
CFG_OPTION_REF_TOKEN = 'refresh_token'
_config = None
class HookList(list):
pass
class HookDict(dict):
pass
def get_config():
global _config
if not _config:
_... | mit | Python |
fc7da8e039c38140f3855e8c58d1db9a4e8ed133 | add demo about using ftplib.FTP | ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study | reading-notes/CorePython/src/ftp.py | reading-notes/CorePython/src/ftp.py | # Copyright (c) 2014 ASMlover. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list ofconditions and the fol... | bsd-2-clause | Python | |
d059fa531f46fe063e7811a17478fab6c913acb4 | add migration file | sigmapi-gammaiota/sigmapi-web,sigmapi-gammaiota/sigmapi-web,sigmapi-gammaiota/sigmapi-web,sigmapi-gammaiota/sigmapi-web | sigmapiweb/apps/Scholarship/migrations/0006_course_coursesection_review.py | sigmapiweb/apps/Scholarship/migrations/0006_course_coursesection_review.py | # Generated by Django 3.1.6 on 2021-11-18 13:53
import apps.Scholarship.models
import common.mixins
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.... | mit | Python | |
2085083fc842c03efae72bbf288804ddd67605b1 | add list_comprehension | Akagi201/learning-python,Akagi201/learning-python,Akagi201/learning-python,Akagi201/learning-python,Akagi201/learning-python | misc/list_comprehension.py | misc/list_comprehension.py | #!/usr/bin/env python
s = [2*x for x in range(101) if x ** 2 > 3]
print s
| mit | Python | |
9e60fd94ef801bab0e8e9a5956b5c00c911bd6ca | Create tesseract_example.py | MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab | home/kyleclinton/tesseract_example.py | home/kyleclinton/tesseract_example.py | ################################################################
#
# tesseract_example.py
# Kyle J Clinton
#
# This is an example of the use of TesseractOcr to read text from an image
# it is using many of the services that are common to the InMoov project or
# MRL in general
#
###################################... | apache-2.0 | Python | |
058de6743532340611ac304c99bc7dd4ea474350 | Create NSEPA-Bypass.py | Lucky0x0D/NetScalerEPABypass | NSEPA-Bypass.py | NSEPA-Bypass.py | import sys
import base64
import hashlib
## Requires pyCrypto --> run 'pip install pycrypto'
from Crypto.Cipher import AES
## Check that theres is enough info
if (len(sys.argv) < 5):
print("You're not giving me enough to work with here:\n\n");
print("Usage:\n");
print("python NSEPA-Bypass.py \"NSC_EPAC Cook... | unlicense | Python | |
b3a1f84fb6f28598595f00bdb01d789051999cb9 | Update 2016-09-19 11h20 | HuuHoangNguyen/Python_learning | GUI_Tkinter_Demo.py | GUI_Tkinter_Demo.py | #!/usr/bin/python
import Tkinter
import tkMessageBox
top = Tkinter.Tk()
def helloCallBack():
tkMessageBox.showinfo("Hello Python", "Hello World")
B = Tkinter.Button(top, text="Hello", command = helloCallBack)
B.pack()
top.mainloop() | mit | Python | |
e397d400a81466b22ae735f60f5a239ca4b7d653 | create domain lookup module | jasonaowen/irc | domain.py | domain.py | # domain.py
# Look up a domain's availability
# Copyright 2015 Jason Owen <jason.a.owen@gmail.com>
#
# 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, or
#... | agpl-3.0 | Python | |
dda3ce9c56967dc6069b61f16feed2932e24ea14 | test = input ("CPF: ") cpf = test[:3] + "." + test[3:6] + "." + test[6:9] + "-" + test[9:] print(cpf) | bigown/SOpt,maniero/SOpt,maniero/SOpt,bigown/SOpt,maniero/SOpt,maniero/SOpt,maniero/SOpt,bigown/SOpt,maniero/SOpt,bigown/SOpt,maniero/SOpt,bigown/SOpt,bigown/SOpt,maniero/SOpt,maniero/SOpt,bigown/SOpt,bigown/SOpt,maniero/SOpt,bigown/SOpt,maniero/SOpt,bigown/SOpt,maniero/SOpt,maniero/SOpt,maniero/SOpt,maniero/SOpt,manie... | Python/FormatCpf.py | Python/FormatCpf.py | test = input ("CPF: ")
cpf = test[:3] + "." + test[3:6] + "." + test[6:9] + "-" + test[9:]
print(cpf)
#https://pt.stackoverflow.com/q/237371/101
| mit | Python | |
f27241b5409ec00568efa1752d5eeb71516b16bd | Add cellular.py | joseph346/cellular | cellular.py | cellular.py | import random
class TotalisticCellularAutomaton:
def __init__(self):
self.n_cells = 200
self.n_states = 5
self.symbols = ' .oO0'
self.radius = 1
self.cells = [random.randrange(0, self.n_states) for _ in range(self.n_cells)]
n_rules = (2*self.radius + 1) * (self.n_st... | unlicense | Python | |
03d5fb46c877d176ed710a8d27b5ad7af699dc52 | add Lubebbers example | pylayers/pylayers,pylayers/pylayers,dialounke/pylayers,dialounke/pylayers | pylayers/antprop/tests/Diffraction-Luebbers.py | pylayers/antprop/tests/Diffraction-Luebbers.py |
# coding: utf-8
# In[1]:
from pylayers.simul.link import *
# In[2]:
DL=DLink(L=Layout('Luebbers.ini'),graph='tvi')
# In[3]:
# get_ipython().magic(u'matplotlib inline')
# DL.L.showG('i')
# In[7]:
DL.a = np.array(([37.5,6.2,2.]))
DL.b = np.array(([13,30,2.]))
DL.fGHz=np.array(([0.9,1.0]))
# In[8]:
plt.ion(... | mit | Python | |
1137a5ffa3481a224649dc2321b17fe227a7553d | Create glitch.py | Loreleix64/aradiabot | glitch.py | glitch.py | # Aradiabot image glitching functions.
# Transcribed over from my 'fastglitch' repository.
from io import BytesIO, StringIO
import random, sys, PIL.Image, PIL.ImageChops, PIL.ImageDraw, os
chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'
import asyncio
def genImg(fname):
img = PIL.Image.open(f... | mit | Python | |
471d1d4ae197c7643eeac374a0353adbce54fd44 | add scheme to grabber api url if not present | gravyboat/streamlink,streamlink/streamlink,streamlink/streamlink,wlerin/streamlink,back-to/streamlink,mmetak/streamlink,chhe/streamlink,melmorabity/streamlink,bastimeyer/streamlink,gravyboat/streamlink,chhe/streamlink,wlerin/streamlink,beardypig/streamlink,melmorabity/streamlink,bastimeyer/streamlink,mmetak/streamlink,... | src/streamlink/plugins/nineanime.py | src/streamlink/plugins/nineanime.py | import re
from streamlink.plugin import Plugin
from streamlink.plugin.api import http
from streamlink.plugin.api import useragents
from streamlink.plugin.api import validate
from streamlink.stream import HTTPStream
from streamlink.compat import urlparse
class NineAnime(Plugin):
_episode_info_url = "//9anime.to/aj... | import re
from streamlink.plugin import Plugin
from streamlink.plugin.api import http
from streamlink.plugin.api import validate
from streamlink.stream import HTTPStream
class NineAnime(Plugin):
_episode_info_url = "http://9anime.to/ajax/episode/info"
_info_schema = validate.Schema({
"grabber": valid... | bsd-2-clause | Python |
566e3e9140ef96d58aaa4bfc0f89d9429a978485 | add a script to get connections between the minima | js850/nested_sampling,js850/nested_sampling | get_connections.py | get_connections.py | from lj_run import LJClusterNew
import sys
from pygmin.landscape import Graph
natoms = int(sys.argv[1])
dbname = sys.argv[2]
system = LJClusterNew(natoms)
db = system.create_database(dbname)
while True:
min1 = db.minima()[0]
graph = Graph(db)
all_connected = True
for m2 in db.minima()[1:]:
... | bsd-2-clause | Python | |
d362847f0eb895dd3661a636f94b2216b6497ec6 | Add tests for Model. | jhckragh/magetool | magetool/tests/commands/model_test.py | magetool/tests/commands/model_test.py | import os
import unittest
from magetool.commands.model import Model
from magetool.commands.module import Module
from magetool.tests.util import remove_module, TEST_DIR
reference_reg_config = """<?xml version="1.0"?>
<config>
<modules>
<Foo_Quux>
<version>0.1.0</version>
</Foo_Quux>
</modules>
<glo... | bsd-2-clause | Python | |
72b701652271178e08d9cccd088d24177d4a2fc6 | Add functions for storing/getting blogs and posts | jamalmoir/pyblogit | pyblogit/database_handler.py | pyblogit/database_handler.py | """
pyblogit.database_handler
~~~~~~~~~~~~~~~~~~~~~~~~~
This module handles the connection and manipulation of the local database.
"""
import sqlite3
def get_cursor(blog_id):
"""Connects to a local sqlite database"""
conn = sqlite3.connect(blog_id)
c = conn.cursor()
return c
def add_blog(blog_id, ... | mit | Python | |
726316b50209dfc5f6a8f6373cd7e3f53e267bb3 | Implement a genre string parser | 6/GeoDJ,6/GeoDJ | geodj/genre_parser.py | geodj/genre_parser.py | import re
from django.utils.encoding import smart_str
class GenreParser:
@staticmethod
def parse(genre):
genre = smart_str(genre).lower()
if re.search(r"\b(jazz|blues)\b", genre):
return "jazz"
if re.search(r"\b(ska|reggae|ragga|dub)\b", genre):
return "ska"
... | mit | Python | |
23402487a2b12aca391bb5958b4ba3e9424a6801 | Add a new management command 'olccperiodic' to update the 'on_sale' property for all products. | twaddington/django-olcc,twaddington/django-olcc,twaddington/django-olcc | django_olcc/olcc/management/commands/olccperiodic.py | django_olcc/olcc/management/commands/olccperiodic.py | import datetime
from django.core.management.base import BaseCommand
from django.db import IntegrityError, transaction
from olcc.models import Product, ProductPrice
from optparse import make_option
class Command(BaseCommand):
help = """\
A command to be run periodically to calculate Product status
from upd... | mit | Python | |
860d81ec5f0b9ae4c28a1996773c06240c31b67a | Update names | zbwrnz/tkinter-practice | canvas.py | canvas.py | #!/usr/bin/env python3
from tkinter import *
from tkinter import ttk
import math
class App:
def __init__(self):
self.lastx = 0
self.lasty = 0
self.fill = 'red'
self.width = 2
root = Tk()
root.columnconfigure(0, weight=1)
root.rowconfigure(0, weight=1)
... | unlicense | Python | |
d5c7d429be93a2b2de4a1c09bd73f72c02664499 | Move win32 audio experiment to trunk. | adamlwgriffiths/Pyglet,adamlwgriffiths/Pyglet,seeminglee/pyglet64,niklaskorz/pyglet,niklaskorz/pyglet,niklaskorz/pyglet,adamlwgriffiths/Pyglet,seeminglee/pyglet64,adamlwgriffiths/Pyglet,seeminglee/pyglet64,niklaskorz/pyglet | experimental/directshow.py | experimental/directshow.py | #!/usr/bin/python
# $Id:$
# Play an audio file with DirectShow. Tested ok with MP3, WMA, MID, WAV, AU.
# Caveats:
# - Requires a filename (not from memory or stream yet). Looks like we need
# to manually implement a filter which provides an output IPin. Lot of
# work.
# - Theoretically can traverse the ... | bsd-3-clause | Python | |
285c852bb246042a4f882ab9ca2948e4f0241dac | add GTC.meshgrid Core | shmilee/gdpy3,shmilee/gdpy3,shmilee/gdpy3,shmilee/gdpy3 | src/processors/GTC/meshgrid.py | src/processors/GTC/meshgrid.py | # -*- coding: utf-8 -*-
# Copyright (c) 2018 shmilee
'''
Source fortran code:
v110922
-------
diagnosis.F90, subroutine diagnosis:37-50
!!diagnosis xy
if(mype==1)then
open(341,file='meshgrid.out',status='replace')
do i=0,mpsi
write(341,*)psimesh(i)
write(341,*)sprpsi(psimesh(i))
... | mit | Python | |
e731bfdabbf42b636b02e93ccd3b67c55a28d213 | add unit test | kathryncrouch/Axelrod,bootandy/Axelrod,bootandy/Axelrod,risicle/Axelrod,uglyfruitcake/Axelrod,drvinceknight/Axelrod,uglyfruitcake/Axelrod,kathryncrouch/Axelrod,risicle/Axelrod,emmagordon/Axelrod,mojones/Axelrod,emmagordon/Axelrod,mojones/Axelrod | axelrod/tests/test_appeaser.py | axelrod/tests/test_appeaser.py | """
Test for the appeaser strategy
"""
import unittest
import axelrod
class TestAppeaser(unittest.TestCase):
def test_strategy(self):
P1 = axelrod.Appeaser()
P2 = axelrod.Player()
P1.str = 'C';
self.assertEqual(P1.strategy(P2), 'C')
P1.history = ['C']
P1.history = ['C']
self.assertEqua... | mit | Python | |
0a0d31077746e69bf5acc7d90fa388e121544339 | Add skeleton for new python scripts. | lweasel/misc_bioinf,lweasel/misc_bioinf,lweasel/misc_bioinf | script_skeleton.py | script_skeleton.py | #!/usr/bin/python
"""Usage:
<SCRIPT_NAME> [--log-level=<log-level>]
-h --help
Show this message.
-v --version
Show version.
--log-level=<log-level>
Set logging level (one of {log_level_vals}) [default: info].
"""
import docopt
import ordutils.log as log
import ordutils.options as opt
import schema
im... | mit | Python | |
63b954c952dda9d123e6fa1e348babae97523e21 | Create securitygroup.py | pathakvaidehi2391/WorkSpace,pathakvaidehi2391/WorkSpace | azurecloudify/securitygroup.py | azurecloudify/securitygroup.py | apache-2.0 | Python | ||
01f7ef27825baf76b3dd9afaa2f4c12e05272d9d | Add Commodity Futures Trading Commission. | lukerosiak/inspectors-general,divergentdave/inspectors-general | inspectors/cftc.py | inspectors/cftc.py | #!/usr/bin/env python
import datetime
import logging
import os
import re
from urllib.parse import urljoin
from bs4 import BeautifulSoup
from utils import utils, inspector
# http://www.cftc.gov/About/OfficeoftheInspectorGeneral/index.htm
# Oldest report: 2000
# options:
# standard since/year options for a year ran... | cc0-1.0 | Python | |
24c6ede2c7950e36516f0611811ff922d7a5b86f | Create grayl_g-throughput.py | dschutterop/Graphite-graylog | grayl_g-throughput.py | grayl_g-throughput.py | #!/usr/bin/python
#
# == Synopsis
#
# Script to get Graylog throughput data pushed
# to Graphite
#
#
# === Workflow
# This script grabs JSON from your Graylog
# cluster, transforms data into
# valid Carbon metrics and delivers it into carbon
#
# Carbon only needs three things:
# <metric> <value> <timestamp>
#
# So what... | apache-2.0 | Python | |
ac78f3f774dbfda4e2c96786ddebf74066a56f54 | add mtbf_job_runner | ShakoHo/mtbf_operation,Mozilla-TWQA/mtbf_operation,ypwalter/mtbf_operation,zapion/mtbf_operation | mtbf_job_runner.py | mtbf_job_runner.py | #!/usr/bin/env python
import combo_runner.action_decorator
from combo_runner.base_action_runner import BaseActionRunner
from utils.zip_utils import modify_zipfile
import os
class MtbfJobRunner(BaseActionRunner):
action = combo_runner.action_decorator.action
def pre_flash(self):
pass
def flash(s... | mpl-2.0 | Python | |
f5bb497960f9f9256cc9794baf0c53c4ba5d734f | Add Spider class for web crawling. | SaltusVita/ReoGrab | Spider.py | Spider.py | '''
Created on 7/07/2016
@author: garet
'''
class Spider():
def __init__(self):
pass | bsd-3-clause | Python | |
8c8d28e95cf99f8aff4ba45819b08995ef63ea44 | add hubble | ashumeow/random-space-images | hubble.py | hubble.py | import urllib
import os
def fetchImages(start, stop):
counter = 0
imgIndex = start
for i in range(start, start+stop+1):
urllib.urlretrieve(""+str(imgIndex)+".jpg", str(imgIndex)+".jpg")
print("Image# "+str(counter)+" of "+str(stop)+" captured.")
counter += 1
imgIndex += 1
... | mit | Python | |
62296474a389f684dbc1b66fb5256d494111b7c9 | Add a script to reproduce ezio issue #4 | kingsamchen/Eureka,kingsamchen/Eureka,kingsamchen/Eureka,kingsamchen/Eureka,kingsamchen/Eureka,kingsamchen/Eureka,kingsamchen/Eureka,kingsamchen/Eureka | SocketABC/ezio_issue4_reproduce.py | SocketABC/ezio_issue4_reproduce.py | # -*- coding: utf-8 -*-
import hashlib
import socket
import struct
SERVER_NAME = 'localhost'
SERVER_PORT = 9876
def main():
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client_socket.connect((SERVER_NAME, SERVER_PORT))
msg_len = 1600
payload = 'a' * msg_len
msg = struct.pack... | mit | Python | |
6d93e603cd45544e296b8cd90853377688af6376 | Add median/LoG filter fcn | mfaytak/image-pca | imgphon/ultrasound.py | imgphon/ultrasound.py | import numpy as np
from scipy.ndimage import median_filter
from scipy.ndimage.filters import gaussian_laplace
def clean_frame(frame, median_radius=5, log_sigma=4):
"""
Input: ndarray image, filter kernel settings
Output: cleaned ndarray image
A median filter is used to remove speckle noise,
... | bsd-2-clause | Python | |
ca3add180e8dc124e9ebec35682215a6de0ae9b1 | Add test_poly_divide script. | pearu/sympycore,pearu/sympycore | research/test_poly_divide.py | research/test_poly_divide.py |
# use time() instead on unix
import sys
if sys.platform=='win32':
from time import clock
else:
from time import time as clock
from sympycore import profile_expr
def time1(n=500):
import sympycore as sympy
w = sympy.Fraction(3,4)
x = sympy.polynomials.poly([0, 1, 1])
a = (x-1)*(x-2)*(x-3)*(x-4... | bsd-3-clause | Python | |
8adbbc365042d49c1304610b3425e0974b1c6451 | Switch a little of the html generation to jinja2 | cowlicks/blaze,ChinaQuants/blaze,cpcloud/blaze,jcrist/blaze,AbhiAgarwal/blaze,cowlicks/blaze,LiaoPan/blaze,mwiebe/blaze,nkhuyu/blaze,FrancescAlted/blaze,mwiebe/blaze,dwillmer/blaze,FrancescAlted/blaze,LiaoPan/blaze,cpcloud/blaze,mwiebe/blaze,jdmcbr/blaze,maxalbert/blaze,FrancescAlted/blaze,mrocklin/blaze,aterrel/blaze,... | blaze/server/datashape_html.py | blaze/server/datashape_html.py | from ..datashape import DataShape, Record, Fixed, Var, CType, String, JSON
#from blaze_server_config import jinja_env
from jinja2 import Template
json_comment_templ = Template("""<font style="font-size:x-small"> # <a href="{{base_url}}?r=data.json">JSON</a></font>
""")
datashape_outer_templ = Template("""
<pre>
type... | from ..datashape import DataShape, Record, Fixed, Var, CType, String, JSON
#from blaze_server_config import jinja_env
#from jinja2 import Template
def json_comment(array_url):
return '<font style="font-size:x-small"> # <a href="' + \
array_url + '?r=data.json">JSON</a></font>\n'
def render_datashape_recur... | bsd-3-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.