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 |
|---|---|---|---|---|---|---|---|---|
2dff474fe7723ebc7d7559fc77791924532d58db | reorder imports for pep8 | zeroSteiner/boltons,mgaitan/boltons,kevinastone/boltons,markrwilliams/boltons,siemens/boltons,suranap/boltons,doublereedkurt/boltons,neuropil/boltons | boltons/timeutils.py | boltons/timeutils.py | # -*- coding: utf-8 -*-
import bisect
import datetime
from datetime import timedelta
from strutils import cardinalize
def total_seconds(td):
"""\
A pure-Python implementation of Python 2.7's timedelta.total_seconds().
Accepts a timedelta object, returns number of total seconds.
>>> td = datetime.ti... | # -*- coding: utf-8 -*-
import datetime
from datetime import timedelta
from strutils import cardinalize
def total_seconds(td):
"""\
A pure-Python implementation of Python 2.7's timedelta.total_seconds().
Accepts a timedelta object, returns number of total seconds.
>>> td = datetime.timedelta(days=4... | bsd-3-clause | Python |
c86835059c6fcc657290382e743922b14e7e7656 | add server | kartikanand/kartikanand.github.io,kartikanand/kartikanand.github.io | server.py | server.py | from flask import Flask, request
app = Flask(__name__)
@app.route('/')
def root():
print(request.json)
return "hi"
if __name__ == '__main__':
app.run(debug=True, port=5000)
| mit | Python | |
a4bc16a375dc30e37034993bd07d3014f3b936e1 | Fix corrupt abstract field data | pferreir/indico,mic4ael/indico,ThiefMaster/indico,mvidalgarcia/indico,DirkHoffmann/indico,indico/indico,DirkHoffmann/indico,mvidalgarcia/indico,indico/indico,pferreir/indico,indico/indico,ThiefMaster/indico,OmeGak/indico,DirkHoffmann/indico,indico/indico,mic4ael/indico,mic4ael/indico,mic4ael/indico,ThiefMaster/indico,O... | migrations/versions/201610041721_8b5ab7da2d5_fix_corrupt_abstract_field_data.py | migrations/versions/201610041721_8b5ab7da2d5_fix_corrupt_abstract_field_data.py | """Fix corrupt abstract field data
Revision ID: 8b5ab7da2d5
Revises: 52d970fb6a74
Create Date: 2016-10-04 17:21:19.186125
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = '8b5ab7da2d5'
down_revision = '52d970fb6a74'
def upgrade():
# We don't want any dicts... | mit | Python | |
402911310eee757a0dd238466f11477c98c0748b | Add NARR solar radiation point sampler | akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem | scripts/coop/narr_solarrad.py | scripts/coop/narr_solarrad.py | """
Sample the NARR solar radiation analysis into estimated values for the
COOP point archive
1 langley is 41840.00 J m-2 is 41840.00 W s m-2 is 11.622 W hr m-2
So 1000 W m-2 x 3600 is 3,600,000 W s m-2 is 86 langleys
"""
import netCDF4
import datetime
import pyproj
import numpy
import iemdb
import sys
COOP =... | mit | Python | |
e4e572925e987fba59c3421a80d9bc247e04026d | add scraper of NDBC metadata | akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem | scripts/dbutil/scrape_ndbc.py | scripts/dbutil/scrape_ndbc.py | """See if we can get metadata dynmically from NDBC
var currentstnlat = 29.789;
var currentstnlng = -90.42;
var currentstnname = '8762482 - West Bank 1, Bayou Gauche, LA';
<b>Site elevation:</b> sea level<br />
"""
import requests
import psycopg2
from pyiem.reference import nwsli2country, nwsli2... | mit | Python | |
ef745ed086ebd8e77e158c89b577c77296630320 | Add solution for 118 pascals triangle | comicxmz001/LeetCode,comicxmz001/LeetCode | Python/118_Pascals_Triangle.py | Python/118_Pascals_Triangle.py | class Solution(object):
def generate(self, numRows):
"""
:type numRows: int
:rtype: List[List[int]]
"""
res = [[1],[1,1]]
if numRows == 0:
return []
elif numRows == 1:
return [[1]]
else:
old = [1,1]
for i in xrange(n... | mit | Python | |
af7abc0fc476f7c048790fc8b378ac1af8ae8b33 | Create top-k-frequent-words.py | kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015 | Python/top-k-frequent-words.py | Python/top-k-frequent-words.py | # Time: O(n + klogk) on average
# Space: O(n)
# Given a non-empty list of words, return the k most frequent elements.
#
# Your answer should be sorted by frequency from highest to lowest.
# If two words have the same frequency, then the word with the lower alphabetical order comes first.
#
# Example 1:
# Input: ["i",... | mit | Python | |
60841e5b5a5f7e89c986fa202633ccf1a0f35315 | Add main module | othieno/geotagx-tool-validator | src/validator.py | src/validator.py | # -*- coding: utf-8 -*-
#
# This module is part of the GeoTag-X project validator tool.
#
# Author: Jeremy Othieno (j.othieno@gmail.com)
#
# Copyright (c) 2016 UNITAR/UNOSAT
#
# The MIT License (MIT)
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documen... | mit | Python | |
344ee4f5aafa19271a428d171f14b52d26a3f588 | Create solver.py | ThatClyde/Simple_sudoku_solver | solver.py | solver.py | from models import Table
from utils import sector_counter, clearscreen
#start with blank screen
clearscreen()
# building the blank sudoku table
sudoku = Table()
# Having the user enter the sudoku puzzle
sudoku.get_table()
print("This is your sudoku puzzle:")
print(sudoku)
num = 1
row = 0
col = 0
counter = 0
max_tries... | mit | Python | |
8752c36c89e3b2a6b012761d1b24183391245fea | Create Node.py | MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab | service/Node.py | service/Node.py | #########################################
# Node.py
# description: embedded node js
# categories: [programming]
# possibly more info @: http://myrobotlab.org/service/Node
#########################################
# start the service
node = Runtime.start("node","Node")
| apache-2.0 | Python | |
3874a618fa30787b48578430d8abcdc29549102d | solve problem no.1991 | ruby3141/algo_solve,ruby3141/algo_solve,ruby3141/algo_solve | 01xxx/1991/answer.py | 01xxx/1991/answer.py | from typing import Dict
class Node:
def __init__(self, value):
self.value: str = value
self.left: Node = None
self.right: Node = None
def preorder_traversal(self):
print(self.value, end='')
if self.left:
self.left.preorder_traversal()
if ... | mit | Python | |
f77b45b06f88912d154a5fd5b04d69780618110b | Fix migration [WAL-616] | opennode/nodeconductor-openstack | src/nodeconductor_openstack/openstack_tenant/migrations/0024_add_backup_size.py | src/nodeconductor_openstack/openstack_tenant/migrations/0024_add_backup_size.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from nodeconductor_openstack.openstack_tenant.models import Backup
def add_backup_size_to_metadata(apps, schema_editor):
for backup in Backup.objects.iterator():
backup.metadata['size'] = backup.instance.siz... | mit | Python | |
41d6401780b63a6d835ad48a40df183d6748c99a | add moe plotter utility | bouhlelma/smt,relf/smt,SMTorg/smt,bouhlelma/smt,relf/smt,SMTorg/smt | smt/extensions/moe_plotter.py | smt/extensions/moe_plotter.py | import six
import numpy as np
from matplotlib import colors
import matplotlib.pyplot as plt
class MOEPlotter(object):
def __init__(self, moe, xlimits):
self.moe = moe
self.xlimits = xlimits
################################################################################
def plot_... | bsd-3-clause | Python | |
393735aaf76b6ddf773a06a72f0872334e56557e | add litgtk.py file | mit-dci/lit,mit-dci/lit,mit-dci/lit,mit-dci/lit | cmd/litgtk/litgtk.py | cmd/litgtk/litgtk.py | #!/usr/bin/env python
import websocket # `pip install websocket-client`
import json
import pygtk
pygtk.require('2.0')
import gtk
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # global for socket connection
def getBal():
rpcCmd = {
"method": "LitRPC.Bal",
"params": [{
}]
}
rpcCmd.update({"... | mit | Python | |
398a6d23266e52436e6b8efd9d7ab053f490eb45 | add a lib to support requests with retries | JiscPER/magnificent-octopus,JiscPER/magnificent-octopus,JiscPER/magnificent-octopus | octopus/lib/requests_get_with_retries.py | octopus/lib/requests_get_with_retries.py | import requests
from time import sleep
def http_get_with_backoff_retries(url, max_retries=5, timeout=30):
if not url:
return
attempt = 0
r = None
while attempt <= max_retries:
try:
r = requests.get(url, timeout=timeout)
break
except requests.exceptions.T... | apache-2.0 | Python | |
a8b524318d7f9d4406193d610b2bb3ef8e56e147 | Add frameless drag region example. | r0x0r/pywebview,r0x0r/pywebview,r0x0r/pywebview,r0x0r/pywebview,r0x0r/pywebview | examples/frameless_drag_region.py | examples/frameless_drag_region.py | import webview
'''
This example demonstrates a user-provided "drag region" to move a frameless window
around, whilst maintaining normal mouse down/move events elsewhere. This roughly
replicates `-webkit-drag-region`.
'''
html = '''
<head>
<style type="text/css">
.pywebview-drag-region {
width:... | bsd-3-clause | Python | |
6fde041c3a92f0d0a0b92da55b12c8e60ecc7196 | Create handle_file.py | jadnohra/handle_file,jadnohra/handle_file | handle_file.py | handle_file.py | import os,sys,subprocess
g_dbg = '-dbg' in sys.argv or False
def handle_generic(fp,fn,fe):
print 'Unknown extension for [{}]'.format(fp)
def handle_md(fp,fn,fe):
started = False; exec_cmd = [];
with open(fp, "r") as ifile:
lines = [x.rstrip().strip() for x in ifile.readlines()]
for line in lines:
if started ... | unlicense | Python | |
829dbfe0c13284345e0fa305f71937738a6c8f50 | Create cms-checker.py | agusmakmun/Some-Examples-of-Simple-Python-Script,agusmakmun/Some-Examples-of-Simple-Python-Script | web/cms-checker.py | web/cms-checker.py | #!/usr/bin/env python
# Original source: http://www.blackcoder.info/c/cmschecker.txt
# Usage example: $ python cms-checker.py --addr 192.168.1.1
import urllib2
import argparse
import os
import sys
class neo:
def cmsfinder(self):
url = "http://api.hackertarget.com/reverseiplookup/?q="+args.addr
rever = urllib2.R... | agpl-3.0 | Python | |
85a604a1991b5dc9a017514848645723921247a7 | add missing file | sassoftware/mcp,sassoftware/mcp | mcp/constants.py | mcp/constants.py | #
# Copyright (c) 2007 rPath, Inc.
#
# All rights reserved
#
version = '1.0.0'
| apache-2.0 | Python | |
a857340a2d67a8055b9e3802327800dcdd652df4 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/037eb7657cb3f49c70c18f959421831e6cb9e4ad. | yongtang/tensorflow,gautam1858/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,yongtang/tensorflow,tensorflow/tensorflow-pywrap_saved_model,tensorflow/tensorflow-pywrap_tf_optimizer,Intel-Corporation/tensorflow,yongtang/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer... | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "037eb7657cb3f49c70c18f959421831e6cb9e4ad"
TFRT_SHA256 = "80194df160fb8c91c7fcc84f34a6... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "d6884515d2b821161b35c1375d6ea25fe6811d62"
TFRT_SHA256 = "0771a906d327a92bdc46b02c8ac3... | apache-2.0 | Python |
c563f12bcb8b10daca64e19ade3c373c112cb659 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/8f7619fa042357fa754002104f575a8a72ee69ed. | frreiss/tensorflow-fred,frreiss/tensorflow-fred,tensorflow/tensorflow,frreiss/tensorflow-fred,tensorflow/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,yongtang/tensorflow,Intel-Corporation/tensorflow,karllessard/tensorflow,frreiss/tensorflow-fred,Intel-tensorflow/tensorflow,gautam1858/tensorf... | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "8f7619fa042357fa754002104f575a8a72ee69ed"
TFRT_SHA256 = "2cb8410fb4655d71c099fb9f2d3721d0e485c8db518553... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "584ba7eab84bd45941fabc28fbe8fa43c74673d8"
TFRT_SHA256 = "e2f45638580ba52116f099d52b73c3edcf2ad81736a434... | apache-2.0 | Python |
29e3d6b706a33780b1cb4863200ec7525ff035ce | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/cdf6d36e9a5c07770160ebac25b153481c37a247. | tensorflow/tensorflow-pywrap_tf_optimizer,paolodedios/tensorflow,gautam1858/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow-experimental_link_static_libraries_once,karllessard/tensorflow,yongtang/tensorflow,Intel-tensorflow/tensorflow,tensorflow/tensorflow,paolodedios/tens... | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "cdf6d36e9a5c07770160ebac25b153481c37a247"
TFRT_SHA256 = "c197f9b3584cae2d65fc765f999298ae8b70d9424ec0d4... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "6ca8a6dff0e5d4f3a17b0c0879aa5de622683680"
TFRT_SHA256 = "09779efe84cc84e859e206dd49ae6b993577d7dae41f90... | apache-2.0 | Python |
6276cf142d233db377dc490a47c5ad56d2906c75 | Add version module | jhauberg/cards.py,jhauberg/cards.py,jhauberg/cards.py,jhauberg/cards.py | cards/version.py | cards/version.py | # coding=utf-8
__version__ = '0.4.9'
| mit | Python | |
6c7df140c6dccb4b56500ba25f6b66ab7ea3b605 | solve 1 problem | Shuailong/Leetcode | solutions/reverse-bits.py | solutions/reverse-bits.py | #!/usr/bin/env python
# encoding: utf-8
"""
reverse-bits.py
Created by Shuailong on 2016-03-02.
https://leetcode.com/problems/reverse-bits/.
"""
class Solution(object):
def reverseBits(self, n):
"""
:type n: int
:rtype: int
"""
res = 0
count = 0
while n:... | mit | Python | |
793b273c3fdcef428ffb6aec5dbcbb768989f175 | Add 0004 file | Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Show-Me-the-Code/python,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python | Drake-Z/0004/0004.py | Drake-Z/0004/0004.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'第 0004 题:任一个英文的纯文本文件,统计其中的单词出现的个数。'
__author__ = 'Drake-Z'
import re
def tongji(file_path):
f = open(file_path, 'r').read()
f = re.split(r'[\s\,\;,\n]+', f)
print(len(f))
return 0
if __name__ == '__main__':
file_path = 'English.txt'
tongji(fil... | mit | Python | |
06f66859c305465c3f6f38617ecada4da94d41ff | set up skeleton | BradleyMoore/Algorithms | algorithms/sorting/quicksort.py | algorithms/sorting/quicksort.py | from random import randint
def quicksort(unsorted):
if len(unsorted) <= 1:
return unsorted
start = 0
end = start + 1
pivot = choose_pivot(start, end)
sort(unsorted, start, pivot, end)
def choose_pivot(start, end):
pivot = randint(start, end)
return pivo... | mit | Python | |
0e31b15e4dae95b862fd4777659a9210e5e4ec86 | change of file path | openego/data_processing | preprocessing/python_scripts/renpass_gis/simple_feedin/renpassgis_feedin.py | preprocessing/python_scripts/renpass_gis/simple_feedin/renpassgis_feedin.py | """
ToDO:
* Greate one scaled time series
*
Database table:
* model_draft.ego_weather_measurement_point
* model_draft.ego_simple_feedin_full
Change db.py and add ego_simple_feedin_full
"""
__copyright__ = "ZNES"
__license__ = "GNU Affero General Public License Version 3 (AGPL-3.0)"
__url__ = "https://git... | agpl-3.0 | Python | |
cbd64641f30c1a464528a2ec6d5323d29766830d | Add word embedding | sobhe/hazm,sobhe/hazm,sobhe/hazm | hazm/embedding.py | hazm/embedding.py | from . import word_tokenize
from gensim.models import KeyedVectors
from gensim.scripts.glove2word2vec import glove2word2vec
import fasttext, os
supported_embeddings = ['fasttext', 'keyedvector', 'glove']
class WordEmbedding:
def __init__(self, model_type, model=None):
if model_type not in supported_embed... | mit | Python | |
f34c91a6969567b23ad880dc43a0346cc5a5b513 | Add get_arxiv.py to download PDF from arXiv | liweitianux/atoolbox,liweitianux/atoolbox,liweitianux/atoolbox,liweitianux/atoolbox,liweitianux/atoolbox,liweitianux/atoolbox | cli/get_arxiv.py | cli/get_arxiv.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Get the arxiv abstract data and PDF for a given arxiv id.
#
# Weitian LI <liweitianux@gmail.com>
# 2015/01/23
#
import sys
import re
import urllib
import subprocess
import time
import mimetypes
from bs4 import BeautifulSoup
mirror = "http://jp.arxiv.org/"
def get_u... | mit | Python | |
13851dd6f2101ceea917504bd57540a4e54f0954 | Create __init__.py | de-crypto/Facebook-Chatbot | fb_nsitbot/migrations/__init__.py | fb_nsitbot/migrations/__init__.py | mit | Python | ||
14647b71fec7a81d92f044f6ac88304a4b11e5fd | create http server module | pasaunders/http-server | src/step1.py | src/step1.py | """A simple HTTP server."""
def response_ok():
"""Testing for 200 response code."""
pass
| mit | Python | |
0a97f34b4ae4f7f19bfe00c26f495f399f827fab | Add file_regex | yukihirai0505/tutorial-program,yukihirai0505/tutorial-program,yukihirai0505/tutorial-program,yukihirai0505/tutorial-program,yukihirai0505/tutorial-program,yukihirai0505/tutorial-program,yukihirai0505/tutorial-program,yukihirai0505/tutorial-program,yukihirai0505/tutorial-program | python/file_regex/tmp.py | python/file_regex/tmp.py | # -*- coding: utf-8 -*-
import re
file_name = 'hogehoge'
org_file = open(file_name + '.txt')
lines = org_file.readlines()
org_file.close()
dist_file = open(file_name + '_after.txt', 'w')
pattern = r'title=\".+?\"'
all_title = re.findall(pattern, ''.join(lines))
if all_title:
for title in all_title:
dist_... | mit | Python | |
0297e8b1762d495ffd696106bc6498def0ddf600 | Add membership.utils.monthRange to calculate start and end dates of months easily | SYNHAK/spiff,SYNHAK/spiff,SYNHAK/spiff | spiff/membership/utils.py | spiff/membership/utils.py | import datetime
import calendar
from django.utils.timezone import utc
def monthRange(today=None):
if today is None:
today = datetime.datetime.utcnow().replace(tzinfo=utc)
lastDayOfMonth = calendar.monthrange(today.year, today.month)[1]
startOfMonth = datetime.datetime(today.year, today.month, 1, tzinfo=utc)
... | agpl-3.0 | Python | |
6441ce1bc3132220e2d86bb75eff9169b3675751 | add spiderNormal | Achilles-Z/python-learn | spiderNormal.py | spiderNormal.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
#author zeck.tang 2016.03.03
"""
文件头两行注释是用于避免文件中包含中文导致如下错误
SyntaxError: Non-ASCII character XXX in file xxx.py on line xx, but no encoding declared
see http://python.org/dev/peps/pep-0263/ for details
如果遇到
IndentationError: unexpected indent
这样的错误,请仔细检查每个空格和tab
"""
import url... | apache-2.0 | Python | |
7303672fe9cf98c22afd83ae6c0dd7a136f4e5c8 | Create hyperventilate.py | wherrera10/asus-lighting | hyperventilate.py | hyperventilate.py | # -*- coding: utf-8 -*-
"""
Created on Fri Oct 02 14:39:39 2015
@author: William Herrera
IMPORTANT: run as administrator
Color breathing package for G20aj series PC
"""
import light_acpi as la
from time import sleep
def make_rgb(cred, cgreen, cblue):
"""
make rgb for components
"""
redval = int(ro... | apache-2.0 | Python | |
0ec3fd40c85f2a61eee5960031318c7f5ab06bc5 | Allow whitelisted shell calls in transforms | ox-it/humfrey,ox-it/humfrey,ox-it/humfrey | humfrey/update/transform/shell.py | humfrey/update/transform/shell.py | import logging
import subprocess
import tempfile
from django.conf import settings
from .base import Transform, TransformException
SHELL_TRANSFORMS = getattr(settings, 'SHELL_TRANSFORMS', {})
logger = logging.getLogger(__name__)
class Shell(Transform):
def __init__(self, name, extension, params):
self.s... | bsd-3-clause | Python | |
eae844f96417ce0ec32fada7737a2d4ae8b03497 | Add commandline tool | TronPaul/TwitchHQ | twitch.py | twitch.py | import re
import argparse
import urllib
import json
import os
from twitchapi import TwitchAPI
from twitchapi.twitch import TwitchToken
TOKEN_FILE='.access_token'
AUTH_SETTINGS_FILE='.auth_settings'
args_pattern = re.compile(r'code=(?P<code>.*?)&scope=(?P<scopes>.*?)')
def get_auth_settings(auth_settings_file):
f... | mit | Python | |
2a1b46740c4cf14f7db4f344431aced9bf06d1e7 | Add a little program that calls sync until is is done | paolobolzoni/useful-conf,paolobolzoni/useful-conf,paolobolzoni/useful-conf | scripts/sync_for_real.py | scripts/sync_for_real.py | #!/usr/bin/env python3
import subprocess
import sys
from time import time
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
def main():
nr_fast = 3
while nr_fast > 0:
eprint('syncing... ', end='', flush=True)
start_t = time()
subprocess.Popen('/usr/bin/sync',... | unlicense | Python | |
3e2c4f19d1eb5d66430ea46abe18a6a7022e13ef | Create svg_filter.py | brunommauricio/domusdome | svg_filter.py | svg_filter.py | f = open("domusdomezones.svg", "r")
svg = []
for line in f:
line = line.strip()
svg.append(line)
f.close()
vector_paths = []
for i in range(0, len(svg)):
if svg[i] == "<path":# spot the paths location
i = i+1
svg[i] = svg[i].replace(',', ' ')# remove the first 5 items in each path, replac... | mit | Python | |
353d717c425cca9941d650d715c3ed8caf0aae64 | Reset tooltip timer also when cell editor is closed | HelioGuilherme66/RIDE,caio2k/RIDE,HelioGuilherme66/RIDE,HelioGuilherme66/RIDE,robotframework/RIDE,caio2k/RIDE,fingeronthebutton/RIDE,fingeronthebutton/RIDE,robotframework/RIDE,HelioGuilherme66/RIDE,robotframework/RIDE,fingeronthebutton/RIDE,robotframework/RIDE,caio2k/RIDE | src/robotide/editor/tooltips.py | src/robotide/editor/tooltips.py | # Copyright 2008-2009 Nokia Siemens Networks Oyj
#
# 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... | # Copyright 2008-2009 Nokia Siemens Networks Oyj
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | apache-2.0 | Python |
86434fb902caeea7bb740c35607dc6f9f7766d88 | Fix searching for notes in the django admin | jaredjennings/snowy,GNOME/snowy,GNOME/snowy,widox/snowy,jaredjennings/snowy,leonhandreke/snowy,syskill/snowy,leonhandreke/snowy,nekohayo/snowy,sandyarmstrong/snowy,NoUsername/PrivateNotesExperimental,jaredjennings/snowy,nekohayo/snowy,NoUsername/PrivateNotesExperimental,syskill/snowy,sandyarmstrong/snowy,widox/snowy,ja... | notes/admin.py | notes/admin.py | #
# Copyright (c) 2009 Brad Taylor <brad@getcoded.net>
#
# 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 (at your option) any
# later version.
#
# This... | #
# Copyright (c) 2009 Brad Taylor <brad@getcoded.net>
#
# 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 (at your option) any
# later version.
#
# This... | agpl-3.0 | Python |
75717747ffbc36f306e0f771a65ed101bd3ca9be | Create parser.py | anacoimbrag/information-retrieval,anacoimbrag/information-retrieval | parser.py | parser.py | from HTMLParser import HTMLParser
# create a subclass and override the handler methods
class Parser(HTMLParser):
tag = ""
doc = new Document()
def handle_starttag(self, tag, attrs):
tag = tag
print "Encountered a start tag:", tag
def handle_endtag(self, tag):
tag = ""
... | mit | Python | |
ecde3b823724e612fd4e5cc575eb75f0d3652a4b | add script for running test | lotabout/pymustache | test/run-test.py | test/run-test.py | import imp
import json
import os
mustache = imp.load_source('mustache', '../src/mustache.py')
#test_files = ['comments.json',
#'delimiters.json',
#'interpolation.json',
#'inverted.json',
#'~lambdas.json',
#'partials.json',
#'sections.json']
test_files = ['interpolation.json',
'delimite... | mit | Python | |
0feb8f3ae65fadaf600e7681349cfa537b41a8c3 | Add ParseBigCSV.py | awensaunders/BuSHAX0rZ,awensaunders/BuSHAX0rZ,awensaunders/BuSHAX0rZ | parseBigCSV.py | parseBigCSV.py | import csv
import json
with open("evidata.csv", "r") as bigCSV:
with open("file.json", "w") as outFile:
reader = csv.DictReader(bigCSV)
output = json.dumps(list(reader))
outFile.write(output)
| mit | Python | |
31434ff2f5b208ae1d93b4340e1d28cfe5cb2e42 | Add IMDB Mocked Unit Test (#1579) | pytorch/text,pytorch/text,pytorch/text,pytorch/text | test/datasets/test_imdb.py | test/datasets/test_imdb.py | import os
import random
import string
import tarfile
from collections import defaultdict
from unittest.mock import patch
from parameterized import parameterized
from torchtext.datasets.imdb import IMDB
from ..common.case_utils import TempDirMixin, zip_equal
from ..common.torchtext_test_case import TorchtextTestCase
... | bsd-3-clause | Python | |
3536b98a3adf5087c78b92432585654bec40d64e | add problem 045 | smrmkt/project_euler | problem_045.py | problem_045.py | #!/usr/bin/env python
#-*-coding:utf-8-*-
'''
'''
import math
import timeit
def is_pentagonal(n):
if (1+math.sqrt(1+24*n)) % 6 == 0:
return True
else:
return False
def calc():
i = 143
while True:
i += 1
n = i*(2*i-1)
if is_pentagonal(n):
return n... | mit | Python | |
91bb7506bd20ed22b8787e7a8b9975cc07e97175 | Add owners client to depot_tools. | CoherentLabs/depot_tools,CoherentLabs/depot_tools | owners_client.py | owners_client.py | # Copyright (c) 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
class OwnersClient(object):
"""Interact with OWNERS files in a repository.
This class allows you to interact with OWNERS files in a repository both... | bsd-3-clause | Python | |
beae2bdc47949f78e95e3444d248ce035766e719 | Add ascii table test | KSchopmeyer/smipyping,KSchopmeyer/smipyping,KSchopmeyer/smipyping,KSchopmeyer/smipyping,KSchopmeyer/smipyping | smipyping/_asciitable.py | smipyping/_asciitable.py | # (C) Copyright 2017 Inova Development Inc.
# All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | mit | Python | |
672e4378421d2014644e23195706ef011934ffdb | test for fixes on #55 | wdm0006/categorical_encoding,scikit-learn-contrib/categorical-encoding,wdm0006/categorical_encoding,scikit-learn-contrib/categorical-encoding | category_encoders/tests/test_basen.py | category_encoders/tests/test_basen.py | import category_encoders as ce
import unittest
import pandas as pd
__author__ = 'willmcginnis'
class TestBasen(unittest.TestCase):
"""
"""
def test_basen(self):
df = pd.DataFrame({'col1': ['a', 'b', 'c'], 'col2': ['d', 'e', 'f']})
df_1 = pd.DataFrame({'col1': ['a', 'b', 'd'], 'col2': ['d... | bsd-3-clause | Python | |
a4c8818225941b84e6958dcf839fc78c2adc5cee | Create test_pxssh.py | shipcod3/commandsshbotnet | test_pxssh.py | test_pxssh.py | # commandsshbotnet.py
# author: @shipcod3
#
# >> used for testing the pxssh module
import pxssh
import getpass
try:
s = pxssh.pxssh()
hostname = raw_input('SET HOST: ')
username = raw_input('SET USERNAME: ')
password = getpass.getpass('SET PASSWORD: ')
s.login (hostname, username, password)
s.... | mit | Python | |
1be4e6f97b3d062c4fa07f70b05305bf32593fd4 | Add test cases for smudge | oohlaf/dotsecrets | dotbriefs/tests/test_smudge.py | dotbriefs/tests/test_smudge.py | import unittest
from dotbriefs.smudge import SmudgeTemplate
class TestCleanSecret(unittest.TestCase):
def setUp(self):
self.secrets = {}
self.secrets['password'] = 's3cr3t'
self.secrets['question'] = 'h1dd3n 4g3nd4'
self.template = []
self.template.append(SmudgeTemplate('... | bsd-3-clause | Python | |
aa2d97dfe52628e1bb7ab123890a895f7f630cda | add problem 070 | smrmkt/project_euler | problem_070.py | problem_070.py | #!/usr/bin/env python
#-*-coding:utf-8-*-
'''
'''
from fractions import Fraction
import itertools
import math
import timeit
primes = [2, 3, 5, 7]
def is_prime(n):
for p in primes:
if n % p == 0:
return False
for i in range(max(primes), int(math.sqrt(n))+1):
if n % i == 0:
... | mit | Python | |
16ccb2a670461e8ceb9934fd4ba8823b866c9d8e | Create plot.py | ogasawaraShinnosuke/ds | src/plot.py | src/plot.py | import pandas as pd
from matplotlib import pyplot as plt
from abc import ABCMeta, abstractmethod
class Plot(metaclass=ABCMeta):
@abstractmethod
def show(self):
plt.show()
class CsvPlot(Plot):
def __init__(self, parent_path):
self.parent_path = parent_path
def show(self, is_execute=F... | mit | Python | |
254239102955bb8916aab98530251b5cdd79ce50 | Add script to write base signatures | jdkato/codetype,jdkato/codetype | cypher/siggen.py | cypher/siggen.py | #!/usr/bin/env python
import argparse
import subprocess
import os
import shutil
import sys
from util import write_signature
parser = argparse.ArgumentParser()
parser.add_argument(
"-l",
"--language",
help="Source code language.",
required=True
)
TEMP_DIR = os.path.join(os.getcwd(), "cypher", "temp")
... | mit | Python | |
fe8d131a3cb9484cfe3f1b96102c0333077ffe89 | Add some basic tests | msanders/cider | tests/test_basic.py | tests/test_basic.py | from cider import Cider
from mock import MagicMock, call
import pytest
import random
@pytest.mark.randomize(formulas=[str], cask=bool, force=bool)
def test_install(tmpdir, formulas, cask, force):
cider = Cider(cider_dir=str(tmpdir), cask=cask)
cider.brew = MagicMock()
cider.install(*formulas, force=force... | mit | Python | |
19b13f0fb9b86ec99025bd1baf2c4d5fe757f809 | Add a test to make sure exception is raised | alphagov/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin | tests/test_tests.py | tests/test_tests.py | import pytest
def test_BeautifulSoup_methods_are_overridden(
client_request,
mock_get_service_and_organisation_counts,
):
client_request.logout()
page = client_request.get("main.index", _test_page_title=False)
with pytest.raises(AttributeError) as exception:
page.find("h1")
assert st... | mit | Python | |
1f4190a6d4ef002e75a8ac5ef80d326c712c749c | add test to verify the trace assignment | uber/tchannel-python,uber/tchannel-python | tests/test_trace.py | tests/test_trace.py | from __future__ import absolute_import
import pytest
from tchannel import TChannel, schemes
from tchannel.errors import BadRequestError
from tchannel.event import EventHook
@pytest.mark.gen_test
def test_error_trace():
tchannel = TChannel('test')
class ErrorEventHook(EventHook):
def __init__(self):... | mit | Python | |
7fa8417cb7635e238f1e95971fa0a86a95b64dca | Migrate deleted_at fields away | pudo/aleph,alephdata/aleph,alephdata/aleph,pudo/aleph,alephdata/aleph,alephdata/aleph,pudo/aleph,alephdata/aleph | aleph/migrate/versions/aa486b9e627e_hard_deletes.py | aleph/migrate/versions/aa486b9e627e_hard_deletes.py | """Hard delete various model types.
Revision ID: aa486b9e627e
Revises: 9dcef7592cea
Create Date: 2020-07-31 08:56:43.679019
"""
from alembic import op
import sqlalchemy as sa
revision = "aa486b9e627e"
down_revision = "9dcef7592cea"
def upgrade():
meta = sa.MetaData()
meta.bind = op.get_bind()
meta.refl... | mit | Python | |
c61d3d5b4b31912c48e86425fe7e4861fc2f8c28 | test for read_be_array that fails in Python 2.x (see GH-6) | mitni455/psd-tools,vgatto/psd-tools,makielab/psd-tools,vgatto/psd-tools,a-e-m/psd-tools,ssh-odoo/psd-tools,psd-tools/psd-tools,a-e-m/psd-tools,mitni455/psd-tools,EvgenKo423/psd-tools,kmike/psd-tools,codercarl/psd-tools,makielab/psd-tools,codercarl/psd-tools,ssh-odoo/psd-tools,a-e-m/psd-tools,EvgenKo423/psd-tools,kmike/... | tests/test_utils.py | tests/test_utils.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from io import BytesIO
from psd_tools.utils import read_be_array
def test_read_be_array_from_file_like_objects():
fp = BytesIO(b"\x00\x01\x00\x05")
res = read_be_array("H", 2, fp)
assert list(res) == [1, 5]
| mit | Python | |
eb82e816e4dece07aeebd7b9112156dacdb2d9bc | Add set_global_setting.py, not sure how this file dissapeared | rwols/CMakeBuilder | commands/set_global_setting.py | commands/set_global_setting.py | from .command import CmakeCommand
class CmakeSetGlobalSettingCommand(CmakeCommand):
def run(self):
self.server.global_settings()
| mit | Python | |
96bea6812919067c28e0c28883226434d81f6e8d | add locusattrs class | LinkageIO/LocusPocus | locuspocus/locusattrs.py | locuspocus/locusattrs.py |
class LocusAttrs():
# a restricted dict interface to attributes
def __init__(self,attrs=None):
self._attrs = attrs
def __len__(self):
if self.empty:
return 0
else:
return len(self._attrs)
def __eq__(self, other):
if self.empty and other.empty:
... | mit | Python | |
cebb3a9cdbdee7c02b0c86e1879d0c20d36b4276 | add example | UWSEDS-aut17/uwseds-group-city-fynders | examples/example_cityfynder.py | examples/example_cityfynder.py | # Which city would like to live?
# Created by City Fynders - University of Washington
import pandas as pd
import numpy as np
import geopy as gy
from geopy.geocoders import Nominatim
import data_processing as dp
from plotly_usmap import usmap
# import data
(natural, human, economy, tertiary) = dp.read_data()
# Ad... | mit | Python | |
9269afee9099ef172ac2ef55ea0af85b0c77587a | Add databases.py | ollien/Timpani,ollien/Timpani,ollien/Timpani | py/database.py | py/database.py | import sqlalchemy
import sqlalchemy.orm
import uuid
import configmanager
class ConnectionManager():
_connections = {}
@staticmethod
def addConnection(self, connection, connectionName = uuid.uuid4().hex):
if type(connectionName) == str:
if type(connection) == DatabaseConnection:
_connections[connectionName... | mit | Python | |
5dfb7ad67216b31544c5f4dc785930ef0d9ffd56 | add faceAssigned tester | sol-ansano-kim/medic,sol-ansano-kim/medic,sol-ansano-kim/medic | python/medic/plugins/Tester/faceAssigned.py | python/medic/plugins/Tester/faceAssigned.py | from medic.core import testerBase
from maya import OpenMaya
class FaceAssigned(testerBase.TesterBase):
Name = "FaceAssigned"
def __init__(self):
super(FaceAssigned, self).__init__()
def Match(self, node):
return node.object().hasFn(OpenMaya.MFn.kDagNode)
def Test(self, node):
... | mit | Python | |
971570b4288c9ac7131a1756e17574acbe6d1b9a | Add script for converting a solarized dark file to solarized dark high contrast | bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile | python/misc/solarized-dark-high-contrast.py | python/misc/solarized-dark-high-contrast.py | #!/usr/bin/env python
import sys
if sys.version_info < (3, 4):
sys.exit('ERROR: Requires Python 3.4')
from enum import Enum
def main():
Cases = Enum('Cases', 'lower upper')
infile_case = None
if len(sys.argv) < 2:
sys.stderr.write('ERROR: Must provide a file to modify\n')
sys.ex... | mit | Python | |
b72c421696b5714d256b7ac461833bc692ca5354 | Add an autonomous mode to strafe and shoot. Doesn't work | frc1418/2014 | robot/robot/src/autonomous/hot_aim_shoot.py | robot/robot/src/autonomous/hot_aim_shoot.py |
try:
import wpilib
except ImportError:
from pyfrc import wpilib
import timed_shoot
class HotShootAutonomous(timed_shoot.TimedShootAutonomous):
'''
Based on the TimedShootAutonomous mode. Modified to allow
shooting based on whether the hot goal is enabled or not.
'''
... | bsd-3-clause | Python | |
3c046062af376603145545f37b917a5c927b3aba | Create mergesort_recursive.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... | recursive_algorithms/mergesort_recursive.py | recursive_algorithms/mergesort_recursive.py | def merge_sort(array):
temp = []
if( len(array) == 1):
return array;
half = len(array) / 2
lower = merge_sort(array[:half])
upper = merge_sort(array[half:])
lower_len = len(lower)
upper_len = len(upper)
i = 0
j = 0
while i != lower_len or j != upper_len:
i... | cc0-1.0 | Python | |
06b0f93ecd5fac8eda02fce96c1e4ec0306a7989 | Increase coverage | proyectos-analizo-info/pybossa-analizo-info,stefanhahmann/pybossa,inteligencia-coletiva-lsd/pybossa,jean/pybossa,OpenNewsLabs/pybossa,PyBossa/pybossa,proyectos-analizo-info/pybossa-analizo-info,harihpr/tweetclickers,Scifabric/pybossa,PyBossa/pybossa,geotagx/pybossa,jean/pybossa,harihpr/tweetclickers,OpenNewsLabs/pyboss... | test/test_google.py | test/test_google.py | # -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2013 SF Isle of Man Limited
#
# PyBossa 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
# (at... | agpl-3.0 | Python | |
17e2b9ecb67c8b1f3a6f71b752bc70b21584092e | Add initial tests for scriptserver. | cnelsonsic/SimpleMMO,cnelsonsic/SimpleMMO,cnelsonsic/SimpleMMO | tests/test_scriptserver.py | tests/test_scriptserver.py | import unittest
from mock import patch, Mock
import sys
sys.path.append(".")
from scriptserver import ZoneScriptRunner
class TestZoneScriptRunner(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.mongoengine_patch = patch('scriptserver.me')
cls.mongoengine_patch.start()
@classmeth... | agpl-3.0 | Python | |
e5243d0fb792e82825633f1afdd6e799238a90f3 | Add portable buildtools update script (#46) | flutter/buildroot,flutter/buildroot,flutter/buildroot,flutter/buildroot | tools/buildtools/update.py | tools/buildtools/update.py | #!/usr/bin/python
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Pulls down tools required to build flutter."""
import os
import subprocess
import sys
SRC_ROOT = (os.path.dirname(os.path.d... | bsd-3-clause | Python | |
d1f02226fe805fb80a17f1d22b84b748b65b4e7f | add sam2fq.py | likit/BioUtils,likit/BioUtils | sam2fq.py | sam2fq.py | import sys
from collections import namedtuple
Read = namedtuple('Read', ['name','qual','seq'])
read1 = None
left = open('pe_1.fq', 'w')
right = open('pe_2.fq', 'w')
unpaired = open('unpaired.fq', 'w')
for line in sys.stdin:
items = line.split('\t')
name, qual, seq = items[0], items[10], items[9]
if not re... | bsd-2-clause | Python | |
dbdfb1b5a703e0392ca67a03113e607678015a66 | add kattis/settlers2 | mjenrungrot/competitive_programming,mjenrungrot/algorithm,mjenrungrot/competitive_programming,mjenrungrot/competitive_programming,mjenrungrot/competitive_programming | Kattis/settlers2.py | Kattis/settlers2.py | """
Problem: settlers2
Link: https://open.kattis.com/problems/settlers2
Source: NWERC 2009
"""
from collections import defaultdict
import math
MAXN = 10000
currentPosition = (0,0)
currentNum = 1
counter = defaultdict()
layers = 1
direction = 0
directionCounter = 0
limitDirectionCounter = [layers, layers-1, layers, la... | mit | Python | |
48443f8a8f5a15b3116ba7b4a842189f5e659f26 | test script for pymatbridge | srvanrell/libsvm-weka-python | test_pymatbridge.py | test_pymatbridge.py | #!/usr/bin/python
from pymatbridge import Matlab
mlab = Matlab()
mlab.start()
print "Matlab started?", mlab.started
print "Matlab is connected?", mlab.is_connected()
mlab.run_code("conteo = 1:10")
mlab.run_code("magica = magic(5)")
mlab.stop()
| mit | Python | |
4d08d50d73e8d3d3a954c9ef8ddffc23444d7d28 | Create script.py | caecilius/CocoToPy | script.py | script.py | #!/usr/bin/env python3
# première tentative de documenter l'API de coco.fr
import random
import requests
pseudo = "caecilius" # doit être en minuscule et de plus de 4 caractères
age = "22" # minimum "18"
sexe = "1" # "1" pour homme, "2" pour femme
codeville = "30929" # à récuperer ici http://co... | mit | Python | |
cc0d6a3b782c5646b9742ebe7308b42507ed2714 | Add python API draft interface | pf-aics-riken/kmr,pf-aics-riken/kmr,pf-aics-riken/kmr,pf-aics-riken/kmr,pf-aics-riken/kmr,pf-aics-riken/kmr | python/kmr4py.py | python/kmr4py.py | class MapReduce(object):
def reply_to_spawner(self):
pass
def get_spawner_communicator(self, index):
pass
def send_kvs_to_spawner(self, kvs):
pass
def concatenate_kvs(self, kvss):
pass
def map_once(self, mapfn, kvo_key_type=None,
rank_zero_only=Fa... | bsd-2-clause | Python | |
dbacf8cd0c2bae394b6c67a810836668d510787d | test for index (re)generation | sciyoshi/CheesePrism,sciyoshi/CheesePrism,whitmo/CheesePrism,SMFOSS/CheesePrism,whitmo/CheesePrism,SMFOSS/CheesePrism,whitmo/CheesePrism | tests/test_index.py | tests/test_index.py | from cheeseprism.utils import resource_spec
from itertools import count
from path import path
from pprint import pprint
import unittest
class IndexTestCase(unittest.TestCase):
counter = count()
base = "egg:CheesePrism#tests/test-indexes"
def make_one(self, index_name='test-index'):
from chees... | bsd-2-clause | Python | |
554c6490330760690fbbd1cd5ece3da563e342eb | update queen4.py | skywind3000/language,skywind3000/language,skywind3000/language | python/queen4.py | python/queen4.py | f = lambda A, x, y: y < 0 or (not (A[y] in (A[x], A[x] + (x - y), A[x] - (x - y))))
g = lambda A, x, y: (not x) or (f(A, x, y) and ((y < 0) or g(A, x, y - 1)))
h = lambda A, x: sum([ g(A, x, x - 1) and 1 or 0 for A[x] in range(len(A)) ])
q = lambda A, x: h(A, x) if (x == 7) else sum([ q(A, x + 1) for A[x] in range(8... | mit | Python | |
7d2c728cb121a0aefef11fd3c8ab7b7f700516e8 | read grove pi sensors | vdbg/ST,vdbg/ST | readSensors.py | readSensors.py | import time
import decimal
import grovepi
import math
from grovepi import *
from grove_rgb_lcd import *
sound_sensor = 0 # port A0
light_sensor = 1 # port A1
temperature_sensor = 2 # port D2
led = 4 # port D3
lastTemp = 0.1 # initialize a floating point temp variable
lastHum =... | mit | Python | |
076fcbb4876bd76887f7d64b533fec66f8366b70 | Add tests for cancellation | openprocurement/openprocurement.tender.esco,Scandie/openprocurement.tender.esco | openprocurement/tender/esco/tests/cancellation.py | openprocurement/tender/esco/tests/cancellation.py | # -*- coding: utf-8 -*-
import unittest
from openprocurement.api.tests.base import snitch
from openprocurement.tender.belowthreshold.tests.cancellation import (
TenderCancellationResourceTestMixin,
TenderCancellationDocumentResourceTestMixin
)
from openprocurement.tender.belowthreshold.tests.cancellation_blan... | apache-2.0 | Python | |
77c582939734866eee09b55e9db02437b42c5451 | Create stemming.py | Semen52/GIBDD | stemming.py | stemming.py | # -*- coding: utf-8 -*-
# Портирован с Java по мотивам http://www.algorithmist.ru/2010/12/porter-stemmer-russian.html
import re
class Porter:
PERFECTIVEGROUND = re.compile(u"((ив|ивши|ившись|ыв|ывши|ывшись)|((?<=[ая])(в|вши|вшись)))$")
REFLEXIVE = re.compile(u"(с[яь])$")
ADJECTIVE = re.compile(u"(ее|ие|ые|ое|ими|ы... | apache-2.0 | Python | |
abe586ac1275901fc9d9cf1bde05b225a9046ab7 | add admin tests | archlinux/arch-security-tracker,jelly/arch-security-tracker,jelly/arch-security-tracker,anthraxx/arch-security-tracker,archlinux/arch-security-tracker,anthraxx/arch-security-tracker,anthraxx/arch-security-tracker | test/test_admin.py | test/test_admin.py | from werkzeug.exceptions import Unauthorized
from flask import url_for
from flask_login import current_user
from .conftest import logged_in, assert_logged_in, assert_not_logged_in, create_user
from app.user import random_string
from app.form.login import ERROR_ACCOUNT_DISABLED
USERNAME = 'cyberwehr87654321'
PASSWORD... | mit | Python | |
b63e65b1a41f809caf1c2dcd689955df76add20f | Add a plot just of backscatter phase vs. diameter. | dopplershift/Scattering | test/test_delta.py | test/test_delta.py | import matplotlib.pyplot as plt
import numpy as np
import scattering
import scipy.constants as consts
def plot_csec(scatterer, d, var, name):
plt.plot(d / consts.centi, var,
label='%.1f cm' % (scatterer.wavelength / consts.centi))
plt.xlabel('Diameter (cm)')
plt.ylabel(name)
def plot_csecs(d, ... | bsd-2-clause | Python | |
e1d8c17746497a46c864f352823cd86b2216781c | Add commit ID milestone helper script (#7100) | michaelschiff/druid,druid-io/druid,himanshug/druid,monetate/druid,gianm/druid,gianm/druid,monetate/druid,knoguchi/druid,implydata/druid,implydata/druid,mghosh4/druid,michaelschiff/druid,implydata/druid,deltaprojects/druid,pjain1/druid,leventov/druid,druid-io/druid,leventov/druid,druid-io/druid,jon-wei/druid,Fokko/druid... | docs/_bin/get-milestone-prs.py | docs/_bin/get-milestone-prs.py | #!/usr/bin/env python3
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "Lic... | apache-2.0 | Python | |
55768b5133d8155b16e798a335cc0f46930aab12 | create my own .py for question 5 | pythonzhichan/DailyQuestion,pythonzhichan/DailyQuestion | totaljfb/Q5.py | totaljfb/Q5.py | #-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: Jason Zhang
#
# Created: 15/11/2017
# Copyright: (c) Jason Zhang 2017
# Licence: <your licence>
#-------------------------------------------------------------------------------
... | mit | Python | |
3cb42b54fa8ed2cac6e05aa521a3a61a037a35ee | add rest cliant on python | temichus/cop | rest/client.py | rest/client.py | # pip install requests
import requests
resp = requests.post("http://127.0.0.1:8008/api/v1/addrecord/3", json='{"id":"name"}')
print resp.status_code
print resp.text
resp = requests.get("http://127.0.0.1:8008/api/v1/getrecord/3")
print resp.status_code
print resp.json()
resp = requests.get("http://127.0.0.1:8008/api/v... | mit | Python | |
d0f6167cb7e95c17997bc42af6cd1766b1ac7864 | add related_name migration | hacklabr/paralapraca,hacklabr/paralapraca,hacklabr/paralapraca | paralapraca/migrations/0005_auto_20171204_1006.py | paralapraca/migrations/0005_auto_20171204_1006.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('paralapraca', '0004_contract_classes'),
]
operations = [
migrations.AlterField(
model_name='contract',
... | agpl-3.0 | Python | |
e84d19bdc580f4d392f5b7abdc4eb8eb30919cf5 | add example: negative binomial maximum likelihood via newton's method | kcarnold/autograd,hips/autograd,HIPS/autograd,barak/autograd,HIPS/autograd,hips/autograd | examples/negative_binomial_maxlike.py | examples/negative_binomial_maxlike.py | from __future__ import division, print_function
import autograd.numpy as np
import autograd.numpy.random as npr
from autograd.scipy.special import gammaln
from autograd import grad
import scipy.optimize
# The code in this example implements a method for finding a stationary point of
# the negative binomial likelihoo... | mit | Python | |
6d96e9d67e50d7806be175577968ec8fed8393d7 | Create libBase.py | Soncrates/stock-study,Soncrates/stock-study | test/libBase.py | test/libBase.py | # ./test/testCommon.py
''' There are some assumptions made by this unittest
the directory structure
+ ./
| files -> lib*.py
+----./local/*
| | files -> *.ini
| | files -> *.json
| | files ->*.csv
+----./log/*
| | files -> *.log
+----./test/*
| files -> test*.py
+----./test_input... | lgpl-2.1 | Python | |
b209c45fe32ee7b73bddff5419c1931a16da0bbd | Test file request.py | bacchilu/pyweb | test/request.py | test/request.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import urllib2
import threading
def worker():
urllib2.urlopen('http://localhost:8080').read()
if __name__ == '__main__':
for i in xrange(1024):
threading.Thread(target=worker).start()
print 'Partiti...'
| mit | Python | |
be544817908ba3f9377d24a61047496c3dbf4f7a | Add test | SciTechStrategies/rlev-model-py3 | test_rlev_model.py | test_rlev_model.py | import os
import unittest
from click.testing import CliRunner
from rlev_model import cli
class TestCli(unittest.TestCase):
def test_cli(self):
runner = CliRunner()
sample_filename = os.path.join('data', 'sample-data.txt')
result = runner.invoke(cli, [sample_filename])
assert resu... | mit | Python | |
f211fc4b0467c2d12d0ee60caed4c76910684f65 | Create game.py | elailai94/Bingo-3X3 | Source-Code/game.py | Source-Code/game.py | # ******************************************************************************
# Bingo
#
# @author: Elisha Lai
# @desciption: Program that allows a player to play Bingo
# @version: 1.3 12/03/2014
# ******************************************************************************
# negate_mini_bingo_card: (listof... | mit | Python | |
da2a4fa9e618b212ddbb2fcbc079fa37970ae596 | Add handler for concurrently logging to a file | todddeluca/tfd | tfd/loggingutil.py | tfd/loggingutil.py |
'''
Utilities to assist with logging in python
'''
import logging
class ConcurrentFileHandler(logging.Handler):
"""
A handler class which writes logging records to a file. Every time it
writes a record it opens the file, writes to it, flushes the buffer, and
closes the file. Perhaps this could cre... | mit | Python | |
ba599deb23c75a6dbcbc0de897afedc287c2ea94 | Create 02str_format.py | MurphyWan/Python-first-Practice | 02str_format.py | 02str_format.py | age = 38
name = 'Murphy Wan'
print('{0} is {1} yeaers old'.format(name, age))
print('why is {0} playing with that python?'.format(name))
| mit | Python | |
700db5c742be8a893b1c362ae0955a934b88c39b | Add test_learning_journal.py with test_app() for configuring the app for testing | sazlin/learning_journal | test_journal.py | test_journal.py | # -*- coding: utf-8 -*-
from contextlib import closing
import pytest
from journal import app
from journal import connect_db
from journal import get_database_connection
from journal import init_db
TEST_DSN = 'dbname=test_learning_journal'
def clear_db():
with closing(connect_db()) as db:
db.cursor().exec... | mit | Python | |
59d51e90203a20f9e0b01eda43afc268311009e7 | Comment about JSON | HtmlUnit/selenium,JosephCastro/selenium,kalyanjvn1/selenium,gregerrag/selenium,carlosroh/selenium,lrowe/selenium,Appdynamics/selenium,telefonicaid/selenium,gregerrag/selenium,sebady/selenium,yukaReal/selenium,stupidnetizen/selenium,oddui/selenium,carlosroh/selenium,BlackSmith/selenium,rrussell39/selenium,dandv/selenium... | firefox/src/py/extensionconnection.py | firefox/src/py/extensionconnection.py | # Copyright 2008-2009 WebDriver committers
# Copyright 2008-2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | # Copyright 2008-2009 WebDriver committers
# Copyright 2008-2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | apache-2.0 | Python |
1f3c1af308be68393ac8f7caab17d04cdd632d2b | Add the get_arguments function in include | softwaresaved/international-survey | survey_creation/include/get_arguments.py | survey_creation/include/get_arguments.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import getopt
"""
Short script to parse
the argments from the command line
"""
def get_arguments(argv):
"""
"""
country = None
year = None
try:
opts, args = getopt.getopt(argv, 'hc:y:', ['country=', 'year='])
except getopt.Geto... | bsd-3-clause | Python | |
fc103544a7fcd8506e4d1612f70ff4b5d3eb6dfe | add command to set prices and commissions of teacher levels | malaonline/iOS,malaonline/Server,malaonline/Server,malaonline/Android,malaonline/Android,malaonline/iOS,malaonline/Android,malaonline/Server,malaonline/iOS,malaonline/Server | server/app/management/commands/set_level_price.py | server/app/management/commands/set_level_price.py | from django.core.management.base import BaseCommand
from app.models import Region, Grade, Subject, Ability, Level, Price
class Command(BaseCommand):
help = "设置教师级别的价格和佣金比例\n" \
"例如: \n" \
" python manage.py set_level_price 郑州市 --percentages '20,20,20,20,20,20,20,20,20,20' --prices '2000,30... | mit | Python | |
d7945d85dcce968d6430e079662b1ef9fc464c97 | update ukvi org branding spelling | alphagov/notifications-api,alphagov/notifications-api | migrations/versions/0047_ukvi_spelling.py | migrations/versions/0047_ukvi_spelling.py | """empty message
Revision ID: 0047_ukvi_spelling
Revises: 0046_organisations_and_branding
Create Date: 2016-08-22 16:06:32.981723
"""
# revision identifiers, used by Alembic.
revision = '0047_ukvi_spelling'
down_revision = '0046_organisations_and_branding'
from alembic import op
def upgrade():
op.execute("""
... | mit | Python | |
a2463270e6850b0e7df210c03946bfba449f29d7 | Add a test for simultaneous device access | matthewelse/pyOCD,0xc0170/pyOCD,matthewelse/pyOCD,0xc0170/pyOCD,matthewelse/pyOCD,wjzhang/pyOCD,pyocd/pyOCD,mbedmicro/pyOCD,wjzhang/pyOCD,flit/pyOCD,wjzhang/pyOCD,mesheven/pyOCD,0xc0170/pyOCD,flit/pyOCD,mbedmicro/pyOCD,pyocd/pyOCD,mesheven/pyOCD,mesheven/pyOCD,mbedmicro/pyOCD | test/parallel_test.py | test/parallel_test.py | """
mbed CMSIS-DAP debugger
Copyright (c) 2016 ARM Limited
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 o... | apache-2.0 | Python | |
be3acc4a869c9e45e4d1fdd563571da0d12ae85f | Add modify code Hello World code | KuChanTung/Python | HelloWorld.py | HelloWorld.py | print("HelloWorld")
text="HelloWorld_Text"
print(text) | epl-1.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.