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 |
|---|---|---|---|---|---|---|---|---|
4937366fc88b22f05d40ece8748fabbe53ac876c | Add helper utility | Mause/statistical_atlas_of_au | saau/collect.py | saau/collect.py | import re
from os import walk, makedirs, listdir, unlink
from shutil import copyfile
from os.path import join, basename, dirname
from .__main__ import OUTPUT
FILENAME_RE = re.compile(r'[A-Za-z_]+\.png')
def get_filenames():
filenames = (
join(dirpath, filename)
for dirpath, _, filenames in list(... | mit | Python | |
1a4bd040a39378fff0ba213954f0cf9cda9bf29d | add basic usage example | happyleavesaoc/aoc-mgz | simple_example.py | simple_example.py | import sys
from mgz import header, body
if __name__ == "__main__":
# For each input filename
for arg in sys.argv[1:]:
with open(arg, 'rb') as f:
# Remember end of file
f.seek(0, 2)
eof = f.tell()
f.seek(0, 0)
# Parse the header
... | mit | Python | |
b61d72b0519bdac0af9490c4206195bc89ac6b0a | Add back specs/__init__.py | schulmar/apitrace,PeterLValve/apitrace,schulmar/apitrace,trtt/apitrace,schulmar/apitrace,apitrace/apitrace,tuanthng/apitrace,surround-io/apitrace,PeterLValve/apitrace,swq0553/apitrace,tuanthng/apitrace,EoD/apitrace,EoD/apitrace,surround-io/apitrace,tuanthng/apitrace,trtt/apitrace,swq0553/apitrace,apitrace/apitrace,swq0... | specs/__init__.py | specs/__init__.py | ##########################################################################
#
# Copyright 2012 VMware, Inc.
# All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without res... | mit | Python | |
16bec76e3b5005efad789b80e330fd91942cad46 | Add cube coordinates example | MaxNoe/pyhexgrid | examples/plot_cube_coordinates.py | examples/plot_cube_coordinates.py | from hexgrid import HexPoints, create_spiral
from hexgrid.plotting import plot_hexagons
import matplotlib.pyplot as plt
import numpy as np
points = create_spiral(HexPoints(0, 0, 0), 4)
plot_hexagons(points, edgecolor='k', linewidth=4, facecolor='lightgray')
phis = np.arange(0, 2 * np.pi, np.pi * 2/3)
for i, p in ... | mit | Python | |
6a2f17b8d81da42d693ffcd6a328133a4e77d169 | Add transition relation example | VerifiableRobotics/ReSpeC,team-vigir/ReSpeC | examples/act_out_examples.py | examples/act_out_examples.py | from respec.formula.activation_outcomes import *
ts = {'r1': ['r1', 'r2'],
'r2': ['r2'],
'r3': ['r3', 'r1']}
ts_formula = TransitionRelationFormula(ts)
print 'Transition System:'
print ts
print 'LTL Formulas:'
for formula in ts_formula.formulas:
print formula
| bsd-3-clause | Python | |
4648dbe6964ba4977a1e92b016d672bc18ee3ac5 | add missing file.. | DatapuntAmsterdam/handelsregister,DatapuntAmsterdam/handelsregister,DatapuntAmsterdam/handelsregister | web/handelsregister/search/build_index.py | web/handelsregister/search/build_index.py |
import logging
from django.conf import settings
from datasets.hr import doc as documents
from datasets.hr.models import MaatschappelijkeActiviteit
from datasets.hr.models import Vestiging
from search import index
log = logging.getLogger(__name__)
HR_DOC_TYPES = [
documents.MaatschappelijkeActiviteit,
d... | mpl-2.0 | Python | |
08c1595949ea71adc6f47b27a865c44040a9ce69 | add of Context | mencattini/ideal-pancake,mencattini/ideal-pancake | ADT/types/context.py | ADT/types/context.py | from stew.core import Sort, generator, operation
from ADT.types.bool import Bool
from ADT.types.string import String
''' Context sort represents the list of all substitutions for a specific context'''
class Context(Sort):
@generator
def empty() -> Context:
pass
@generator
def add(my_contex... | apache-2.0 | Python | |
4921ac723875b88e533c2350f208022d2b3657a0 | Create postgres_storage.py (#372) | aio-libs/aiohttp_session | examples/postgres_storage.py | examples/postgres_storage.py | try:
import aiopg
except ImportError: # pragma: no cover
aiopg = None
import json
import uuid
import warnings
import psycopg2.extras
from distutils.version import StrictVersion
from aiohttp_session import AbstractStorage, Session
class PgStorage(AbstractStorage):
"""PG storage"""
def __init__(self... | apache-2.0 | Python | |
cbf5682bde7deb1c6e53b6f218f5bfe11720a8a6 | Add lc017_letter_combinations_of_a_phone_number.py | bowen0701/algorithms_data_structures | lc017_letter_combinations_of_a_phone_number.py | lc017_letter_combinations_of_a_phone_number.py | """Leetcode 17. Letter Combinations of a Phone Number
Medium
URL: https://leetcode.com/problems/letter-combinations-of-a-phone-number/
Given a string containing digits from 2-9 inclusive, return all possible
letter combinations that the number could represent.
A mapping of digit to letters (just like on the telepho... | bsd-2-clause | Python | |
88ac49d8b48484fbc154abb1db46f55445e86a8d | Create UpdateWeather.py | Contextualist/Quip4AHA,Contextualist/Quip4AHA | UpdateWeather.py | UpdateWeather.py | import datetime
import re
import json
import urllib2
import quip4aha
class UpdateWeather(object):
SIMP = {'Mostly Cloudy':'mostly cloudy', 'Partly Cloudy':'partly cloudy', 'Overcast':'cloudy',
'Thunderstorm':'rainy', 'Rain':'rainy'}
def __init__(self):
self.NextNDay = 0
self.C... | apache-2.0 | Python | |
e46c83fa47613c3203aba4375352fadcc2f9f051 | Delete model, leave table | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/motech/dhis2/migrations/0005_delete_jsonapilog.py | corehq/motech/dhis2/migrations/0005_delete_jsonapilog.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.14 on 2018-07-13 11:26
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('dhis2', '0004_auto_20171122_0827'),
('motech', '0001_initial'),
]
state_operations... | bsd-3-clause | Python | |
32bc9ae84dcf43d9ea1a909827ac059cceb09f9f | Add docker base layers | simonhorlick/base | docker_base_repositories.bzl | docker_base_repositories.bzl | def docker_base_repositories():
# Debian base image for docker containers.
native.new_http_archive(
name = "com_github_tianon_docker_brew_debian",
url = "https://codeload.github.com/tianon/docker-brew-debian/zip/e9bafb113f432c48c7e86c616424cb4b2f2c7a51",
build_file = "third_party/debian.BUILD",
... | apache-2.0 | Python | |
969f9c3292d5392a9e70b42324a4c41ef0c580d6 | Add a Windows API-based observer. | edevil/watchdog,gorakhargosh/watchdog,javrasya/watchdog,mconstantin/watchdog,javrasya/watchdog,gorakhargosh/watchdog,edevil/watchdog,edevil/watchdog,teleyinex/watchdog,glorizen/watchdog,glorizen/watchdog,mconstantin/watchdog,glorizen/watchdog,teleyinex/watchdog,edevil/watchdog,mconstantin/watchdog,javrasya/watchdog,yme... | watchdog/win32_observer.py | watchdog/win32_observer.py | # -*- coding: utf-8 -*-
import win32file
import win32con
from os.path import realpath, abspath, sep as path_separator, join as path_join, isdir as path_isdir
from threading import Thread, Event as ThreadedEvent
from Queue import Queue
from decorator_utils import synchronized
from polling_observer import PollingObser... | apache-2.0 | Python | |
f81fea70e34890859ff07cceceffead5a5dd3718 | Add 0001 file | Show-Me-the-Code/python,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Show-Me-the-Code/python,Show-Me-the-Code/python,Show-Me-the-Code/python | Drake-Z/0001/0001.py | Drake-Z/0001/0001.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'第 0001 题:做为 Apple Store App 独立开发者,你要搞限时促销,为你的应用生成激活码(或者优惠券),使用 Python 如何生成 200 个激活码(或者优惠券)'
__author__ = 'Drake-Z'
import random
def rndChar(filename, digit=4, num=200):
f = open(filname, 'a')
a = 0
for i in range(1, 201):
while a < 4:
... | mit | Python | |
2f0145b59be4a251b31223d44fdca7f3fb211fa8 | Create Support Vector Machine vectorizer and classifier pickles | npentella/CuriousCorpus,npentella/CuriousCorpus,npentella/CuriousCorpus | svm_train.py | svm_train.py | from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.linear_model import SGDClassifier
from sklearn.externals import joblib
print "Grabbing data..."
training_text_collection_f = open("training_text_collection.pkl", "rb")
training_text_collection = joblib.load(training_text_collection_f)
training_t... | mit | Python | |
5ca6c6b4f16adbaba816573ed1315492fe7df542 | Gather all BFs | mirams/PyHillFit,mirams/PyHillFit,mirams/PyHillFit | python/assemble_BFs.py | python/assemble_BFs.py | import doseresponse as dr
import numpy as np
import itertools as it
import os
import argparse
import sys
parser = argparse.ArgumentParser()
requiredNamed = parser.add_argument_group('required arguments')
requiredNamed.add_argument("--data-file", type=str, help="csv file from which to read in data, in same format as p... | bsd-3-clause | Python | |
7cd1e6aaa8063cfdcc7a1a69949b2ae163799157 | Add solution to problem 8 | gidj/euler,gidj/euler | python/008_largest_product_in_series/largest_product.py | python/008_largest_product_in_series/largest_product.py | from typing import Generator, Tuple
from operator import mul
from functools import reduce
NUMBER = """73167176531330624919225119674426574742355349194934
96983520312774506326239578318016984801869478851843
85861560789112949495459501737958331952853208805511
12540698747158523863050715693290963295227443043557
6689664895044... | bsd-3-clause | Python | |
e770b05ad598827b7521e599d4e360b5c2614ab6 | Add simple, stupid, pattern-based fuzzer / reducer for modules bugs. I've already used this to find and reduce quite a few bugs, and it works pretty well if you can find the right patterns. | apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/cl... | utils/modfuzz.py | utils/modfuzz.py | #! /usr/bin/env python
# To use:
# 1) Update the 'decls' list below with your fuzzing configuration.
# 2) Run with the clang binary as the command-line argument.
import random
import subprocess
import sys
import os
clang = sys.argv[1]
none_opts = 0.3
class Decl:
def __init__(self, text, depends=[], provides=[],... | apache-2.0 | Python | |
f50b4562dc451b1f338d1bfaeb844592b00ba8ea | add clean_file | Krozark/django-slider,Krozark/django-slider,Krozark/django-slider | slider/utils.py | slider/utils.py | import os, unicodedata
from django.core.files.storage import FileSystemStorage
from django.db.models.fields.files import FileField
from django.core.files.storage import default_storage
def file_cleanup(sender, **kwargs):
"""
File cleanup callback used to emulate the old delete
behavior using signals. Ini... | bsd-2-clause | Python | |
08f96375c089f32703ab526bc4040465f818d163 | Create CubeABC | adrianliaw/PyCuber | pycuber/core/cube/cube_abc.py | pycuber/core/cube/cube_abc.py | import abc
class CubeABC(metaclass=abc.ABCMeta):
@abc.abstractmethod
def do_step(self, step):
return NotImplemented
@abc.abstractmethod
def do_formula(self, formula):
return NotImplemented
def __call__(self, formula):
return self.do_formula(formula)
| mit | Python | |
c0685e9257af79e9ea2393611e7ad00a00a3734e | Add a trivially basic test | storborg/pyweaving | pyweaving/tests/test_draft.py | pyweaving/tests/test_draft.py | from __future__ import (absolute_import, division, print_function,
unicode_literals)
from unittest import TestCase
from .. import Draft, Color
class TestDraft(TestCase):
def test_basic_tabby(self):
draft = Draft(num_shafts=2, num_treadles=2)
black = Color((0, 0, 0))
... | mit | Python | |
6413df642462801a6e1739e17d372b568e7c68c4 | migrate old locations to new locations. | masschallenge/django-accelerator,masschallenge/django-accelerator | accelerator/migrations/0011_migrate_stale_locations.py | accelerator/migrations/0011_migrate_stale_locations.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2018-06-26 09:03
from __future__ import unicode_literals
from django.db import migrations
TLV_LOCATION_OLD = "MassChallenge Israel - Tel Aviv"
TLV_LOCATION_NEW = "Other - see description"
REMOTE_LOCATION_OLD = "Remote"
REMOTE_LOCATION_NEW = "Remote - see descri... | mit | Python | |
ec3726b7ba81eb78ae00edbe72860ff401d5685b | Add missing script | maxrbc/daedalus,maxrbc/daedalus,maxrbc/daedalus | scripts/feature_importance_comparison.py | scripts/feature_importance_comparison.py | #!/usr/bin/env python
## feature importance comparison
#-> the idea is to take a OTU or a group of OTU filter them and compare the results
## [number of otus, otu table path , feature path , score , output path ]
import argparse
import os
def parse_argument():
parser = argparse.ArgumentParser(description = ... | bsd-3-clause | Python | |
3f9c3ed73e249671bdbcbb8f321271f77d8e501f | Add abusehelper.core.rules._domainname | abusesa/abusehelper | abusehelper/core/rules/_domainname.py | abusehelper/core/rules/_domainname.py | from itertools import izip
class Name(object):
def __init__(self, labels):
self._hash = None
self._labels = tuple(labels)
def __hash__(self):
r"""
>>> s = set([Name(["a", "b", "c"])])
>>> Name(["a", "b", "c"]) in s
True
>>> Name(["x", "y", "z"]) in s
... | mit | Python | |
e247b4f5363330dd1e8accdc1d53f7c8598f14dd | Add a support for nsis scripts. | infinit/drake,infinit/drake,mefyl/drake,mefyl/drake,infinit/drake,mefyl/drake | src/drake/nsis.py | src/drake/nsis.py | # Copyright (C) 2013, Quentin "mefyl" Hocquet
#
# This software is provided "as is" without warranty of any kind,
# either expressed or implied, including but not limited to the
# implied warranties of fitness for a particular purpose.
#
# See the LICENSE file for more information.
import drake
class Context:
"""Th... | agpl-3.0 | Python | |
d728872ab5b47775b6e807536c4c0b41e72aa56f | Create 0000.py | reage/pp | 0000.py | 0000.py | from PIL import Image, ImageDraw, ImageFont, ImageEnhance
FONT = 'Arial.ttf'
def addTextWaterMark(imgFile, wmText, fontSize, pos, output='watermarked.jpg', angle=23, opacity=0.25, fg_color=(255,0,0)):
img = Image.open(imgFile).convert('RGB')
mark = Image.new('RGBA', img.size, (0,0,0,0))
n_font = ImageFont... | mit | Python | |
7adde389b23b0231af58cfa6f39e63636acddde3 | Create hashword.py | MrSchism/hashword,MrSchism/hashword,MrSchism/hashword,MrSchism/hashword | hashword-python/hashword.py | hashword-python/hashword.py | #!/usr/bin/env python3
######################################################################################
# hashword written by:
# Joshua "MrSchism" Embrey [mrschism@sdf.org]
# Joseph "Arcarna" Preston [jpreston86@gmail.com]
# Intial commit: November 6, 2013
# Current version: November... | mit | Python | |
fa7cb3eea715d78071975d66fa9364457325c4e3 | Add layout module. | matteoicardi/mpltools,tonysyu/mpltools | mpltools/layout.py | mpltools/layout.py | import numpy as np
import matplotlib.pyplot as plt
def clear_frame(ax=None):
"""Remove the frame (ticks and spines) from an axes.
This differs from turning off the axis (`plt.axis('off')` or
`ax.set_axis_off()`) in that only the ticks and spines are removed. Turning
off the axis also removes the axes... | bsd-3-clause | Python | |
9fe74a6592adc09fb1cc054c1a55155b8d8b31ae | Fix tajima | AndersenLab/cegwas-web,AndersenLab/CeNDR,AndersenLab/cegwas-web,AndersenLab/cegwas-web,AndersenLab/CeNDR,AndersenLab/cegwas-web,AndersenLab/CeNDR,AndersenLab/CeNDR | base/views/api/api_popgen.py | base/views/api/api_popgen.py | from flask import jsonify
from base.application import app
from subprocess import Popen, PIPE
from base.constants import DATASET_RELEASE
from logzero import logger
@app.route('/api/tajima/<string:chrom>/<int:start>/<int:end>')
def tajima(chrom, start, end):
"""
PARAMETERS
chrom
sta... | mit | Python | |
0d0c044a688490eb295ddd305247f406eefc0855 | Add unit tests for the tostring function. | destroy/SleekXMPP-gevent,skinkie/SleekXMPP--XEP-0080-,EnerNOC/smallfoot-sleekxmpp | tests/test_tostring.py | tests/test_tostring.py | from . sleektest import *
from sleekxmpp.stanza import Message
from sleekxmpp.xmlstream.stanzabase import ET
from sleekxmpp.xmlstream.tostring import tostring, xml_escape
class TestToString(SleekTest):
"""
Test the implementation of sleekxmpp.xmlstream.tostring
"""
def tryTostring(self, original='',... | mit | Python | |
cf7f3e54bdcaf8620bbe2e8b5814ddde9af37f77 | Add parse test sketch. | Stryn/citationhunt,guilherme-pg/citationhunt,eggpi/citationhunt,eggpi/citationhunt,eggpi/citationhunt,Stryn/citationhunt,guilherme-pg/citationhunt,jhsoby/citationhunt,Stryn/citationhunt,guilherme-pg/citationhunt,eggpi/citationhunt,jhsoby/citationhunt,Stryn/citationhunt,jhsoby/citationhunt,guilherme-pg/citationhunt,jhso... | sketches/parse_test.py | sketches/parse_test.py | import wikitools
import mwparserfromhell
import urlparse
WIKIPEDIA_BASE_URL = 'https://en.wikipedia.org'
WIKIPEDIA_WIKI_URL = WIKIPEDIA_BASE_URL + '/wiki/'
WIKIPEDIA_API_URL = WIKIPEDIA_BASE_URL + '/w/api.php'
MARKER = '7b94863f3091b449e6ab04d44cb372a0' # unlikely to be in any article
def is_citation_needed(t):
r... | mit | Python | |
287cfb2adb716a6c22e454c78c6af320d5e9c8d1 | Create Program5.py | Mrcomputer1/SimplePythonPrograms | Program5/Program5.py | Program5/Program5.py | number = input("Pick a number? ")
for i in range(5):
number = number + number
print(number)
| mit | Python | |
b2cc83305bf582a4bbd0cb2e0bc357107891a6c6 | add visualize.py | enricobacis/pg-distopt | distopt/visualize.py | distopt/visualize.py | #!/usr/bin/env python2
import matplotlib.pyplot as plt
from argparse import ArgumentParser
from operator import itemgetter
from numpy import arange
from json import load
def generate(outfile):
results = []
for planfile, data in sorted(load(outfile).items(), key=itemgetter(0)):
results.append([max(0, d... | mit | Python | |
fde8951c76b3752c34b8e9c7217fbb9dd61b52e1 | add test-receive-file-and-sender-disconnect.py | freedesktop-unofficial-mirror/telepathy__telepathy-salut,freedesktop-unofficial-mirror/telepathy__telepathy-salut,freedesktop-unofficial-mirror/telepathy__telepathy-salut,freedesktop-unofficial-mirror/telepathy__telepathy-salut | tests/twisted/avahi/test-receive-file-and-sender-disconnect.py | tests/twisted/avahi/test-receive-file-and-sender-disconnect.py | import dbus
from saluttest import exec_test
from file_transfer_helper import ReceiveFileTest, SOCKET_ADDRESS_TYPE_UNIX,\
SOCKET_ACCESS_CONTROL_LOCALHOST
class ReceiveFileAndSenderDisconnectTest(ReceiveFileTest):
def accept_file(self):
# The sender of the file disconnects
self.contact_service.... | lgpl-2.1 | Python | |
28fc89a05ac9e2f41a8f54362da502842b5d2e86 | Set homepage to "http://celeryproject.org" | digimarc/django-celery,celery/django-celery,iris-edu-int/django-celery,planorama/django-celery,ask/django-celery,CloudNcodeInc/django-celery,ask/django-celery,axiom-data-science/django-celery,CloudNcodeInc/django-celery,kanemra/django-celery,Amanit/django-celery,georgewhewell/django-celery,Amanit/django-celery,celery/d... | djcelery/__init__.py | djcelery/__init__.py | """Django Celery Integration."""
import os
# Importing this module enables the Celery Django loader.
os.environ["CELERY_LOADER"] = "djcelery.loaders.DjangoLoader"
VERSION = (1, 1, 2)
__version__ = ".".join(map(str, VERSION[0:3])) + "".join(VERSION[3:])
__author__ = "Ask Solem"
__contact__ = "ask@celeryproject.org"
_... | """Django Celery Integration."""
import os
# Importing this module enables the Celery Django loader.
os.environ["CELERY_LOADER"] = "djcelery.loaders.DjangoLoader"
VERSION = (1, 1, 2)
__version__ = ".".join(map(str, VERSION[0:3])) + "".join(VERSION[3:])
__author__ = "Ask Solem"
__contact__ = "ask@celeryproject.org"
_... | bsd-3-clause | Python |
03e419747dae53301c54a22d8d42196b519c6e9a | Add binding.gyp for node v0.9 | MetaMemoryT/node-libcurl,JCMais/node-libcurl,jiangmiao/node-curl,JCMais/node-libcurl,JCMais/node-libcurl,jiangmiao/node-curl,MetaMemoryT/node-libcurl,JCMais/node-libcurl,jiangmiao/node-curl,MetaMemoryT/node-libcurl,jiangmiao/node-curl,MetaMemoryT/node-libcurl,JCMais/node-libcurl,JCMais/node-libcurl,JCMais/node-libcurl,... | binding.gyp | binding.gyp | {
'targets': [
{
'target_name': 'node-curl',
'cflags': ['-Wall', '-O1', '-fno-inline-functions'],
'cflags_cc': ['-Wall', '-O1', '-fno-inline-functions'],
'sources': ['src/node-curl.cc'],
'libraries': ['-lcurl']
}
]
}
| mit | Python | |
14c3cf92a1f668786fa4e3ce095267365538a12c | add 104 | zeyuanxy/project-euler,EdisonAlgorithms/ProjectEuler,zeyuanxy/project-euler,EdisonAlgorithms/ProjectEuler,EdisonAlgorithms/ProjectEuler,zeyuanxy/project-euler,EdisonAlgorithms/ProjectEuler,zeyuanxy/project-euler | vol3/104.py | vol3/104.py | def top_digits(n):
t = n * 0.20898764024997873 + (-0.3494850021680094)
t = int((pow(10, t - int(t) + 8)))
return t
def is_pandigital(n):
s = set(str(n))
return len(s) == 9 and '0' not in s
if __name__ == "__main__":
f0, f1 = 1, 1
count = 2
while True:
f0, f1 = f1, (f0 + f1) % 1... | mit | Python | |
3611dc63842c1dc3b41cb1ce29e051c38442cc9c | create a model for uploads | rfaulkner/Flickipedia,rfaulkner/Flickipedia,rfaulkner/Flickipedia,rfaulkner/Flickipedia,rfaulkner/Flickipedia | flickipedia/model/uploads.py | flickipedia/model/uploads.py | """
Photo model class
"""
from flickipedia.config import log, schema
from flickipedia.mysqlio import DataIOMySQL
class UploadsModel(object):
def __init__(self):
super(UploadsModel, self).__init__()
self.io = DataIOMySQL()
self.io.connect()
def get_upload(self, user_id, flickr_photo_... | bsd-2-clause | Python | |
fa6f980759e9bf810e922ba715ef6e6a64893860 | Fix missing foreign keys. | idegtiarov/ceilometer,pczerkas/aodh,pczerkas/aodh,sileht/aodh,openstack/aodh,Juniper/ceilometer,r-mibu/ceilometer,tanglei528/ceilometer,JioCloud/ceilometer,NeCTAR-RC/ceilometer,mathslinux/ceilometer,citrix-openstack-build/ceilometer,sileht/aodh,tanglei528/ceilometer,JioCloud/ceilometer,JioCloud/ceilometer,froyobin/ceil... | ceilometer/storage/sqlalchemy/migrate_repo/versions/012_add_missing_foreign_keys.py | ceilometer/storage/sqlalchemy/migrate_repo/versions/012_add_missing_foreign_keys.py | # -*- encoding: utf-8 -*-
#
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | apache-2.0 | Python | |
41fcb60868f0551603cf25c8616f942fcfd008f4 | Add script to restore a deleted node | alexschiller/osf.io,cwisecarver/osf.io,erinspace/osf.io,CenterForOpenScience/osf.io,Nesiehr/osf.io,leb2dg/osf.io,emetsger/osf.io,chrisseto/osf.io,caneruguz/osf.io,binoculars/osf.io,alexschiller/osf.io,Johnetordoff/osf.io,mluo613/osf.io,mfraezz/osf.io,brianjgeiger/osf.io,caneruguz/osf.io,laurenrevere/osf.io,sloria/osf.i... | scripts/restore_node.py | scripts/restore_node.py | """Restores a deleted node.
NOTE: Only use this for nodes that have no addons except for OSFStorage and Wiki.
"""
import logging
import sys
from framework.transactions.context import TokuTransaction
from website.models import Node, NodeLog
from website.app import init_app
from scripts import utils as script_utils
log... | apache-2.0 | Python | |
52846b1e6d892881a19d57adbb823b5d8fdf26c2 | Create ValidPerfectSquare.py from leetcode | jcchuks/MiscCodes,jcchuks/MiscCodes,jcchuks/Hackerrank,jcchuks/MiscCodes,jcchuks/Hackerrank | ValidPerfectSquare.py | ValidPerfectSquare.py | class Solution(object):
def isPerfectSquare(self, num):
"""
:type num: int
:rtype: bool
"""
if num < 1:
return 0
high = num + 1
low = 1
while low < high:
mid = low + (high-low)/2
product = mid ... | mit | Python | |
b9d830b902434d608626f4c0779d05d2e00587a0 | Add a BaseTokenizer | mozilla/spicedham,mozilla/spicedham | spicedham/tokenizer.py | spicedham/tokenizer.py | class BaseTokenizer(object):
def __init__(self, config):
pass
def tokenize(self, text):
return [text]
| mpl-2.0 | Python | |
c538f959482336bc67463ef300b3c62039e67ff6 | add preprocessing script to handle multiple splits | judithfan/graphcomm,judithfan/graphcomm,judithfan/graphcomm | analysis/preprocess_similarities.py | analysis/preprocess_similarities.py | import os
import shutil
import argparse
def str2bool(v):
return v.lower() in ("yes", "true", "t", "1")
def clean_dirlist(x):
return [i for i in x if i != '.DS_Store']
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('--path_to_src_similarities', type=str, help='path t... | mit | Python | |
f642d9b527bf7b342ed63fd7b404b872b3b7c699 | add unittest also as example | NLeSC/pyxenon,NLeSC/pyxenon | examples/hello.py | examples/hello.py | from xenon import Xenon
import time
with Xenon() as xenon:
time.sleep(1)
scheduler = xenon.jobs.newScheduler(
xenon.NewSchedulerRequest(adaptor='local'))
job_description = xenon.JobDescription(
executable='echo',
arguments=['"Hello, World!"'],
stdOut='hello.txt')
job... | apache-2.0 | Python | |
35a2c7c5a03a5a943d73e13502011f73cba045d0 | Add script to document backrefs | indico/indico,pferreir/indico,DirkHoffmann/indico,ThiefMaster/indico,mvidalgarcia/indico,DirkHoffmann/indico,ThiefMaster/indico,ThiefMaster/indico,DirkHoffmann/indico,DirkHoffmann/indico,pferreir/indico,mvidalgarcia/indico,mic4ael/indico,mvidalgarcia/indico,OmeGak/indico,mvidalgarcia/indico,mic4ael/indico,mic4ael/indic... | bin/maintenance/update_backrefs.py | bin/maintenance/update_backrefs.py | # This file is part of Indico.
# Copyright (C) 2002 - 2015 European Organization for Nuclear Research (CERN).
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (a... | mit | Python | |
038b6d447b0fd8ed3ffeea2b3d374c11de409eef | Create var_em_bound.py (#478) | probml/pyprobml,probml/pyprobml,probml/pyprobml,probml/pyprobml | scripts/var_em_bound.py | scripts/var_em_bound.py | # Illustration of possible behaviors of variational EM
# Author : Aleyna Kara
# This file is generated from varEMbound.m
import numpy as np
import matplotlib.pyplot as plt
import pyprobml_utils as pml
def logist(x, k):
return 1 / (1 + np.exp(-k * x))
def logist_gauss(x, k, mu, sigma):
return 1 / (1 + np.exp(-k*x... | mit | Python | |
75f0d17e14327a4824baa817879f6d80403a993a | Create Longest_Substring_with_At_Most_Two_Distinct_Characters.py | UmassJin/Leetcode | Array/Longest_Substring_with_At_Most_Two_Distinct_Characters.py | Array/Longest_Substring_with_At_Most_Two_Distinct_Characters.py | Given a string, find the length of the longest substring T that contains at most 2 distinct characters.
For example, Given s = “eceba”,
T is "ece" which its length is 3.
class Solution:
# @param s, a string
# @return an integer
def lengthOfLongestSubstringTwoDistinct(self, s):
table = {}
l... | mit | Python | |
02f9c14b20b30529f2ab3df75b7ba61000889075 | add json -> xml converter | vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam | js/private-pois/to_osmand.py | js/private-pois/to_osmand.py | #!/usr/bin/env python3
# From
# <https://stackoverflow.com/questions/64558458/how-to-convert-google-maps-geojson-to-gpx-retaining-location-names>.
import argparse
import json
import xml.etree.ElementTree as ET
from xml.dom import minidom
def ingestJson(geoJsonFilepath):
poiList = []
with open(geoJsonFilepat... | mit | Python | |
31f012c4df23bafbecb0b9fba9dcbab54ca9066e | Create luce_credentials.py | wesleycho/saam,wesleycho/saam,wesleycho/saam,wesleycho/saam | cherrypy/luce_credentials.py | cherrypy/luce_credentials.py |
# Change your API credentials for basic auth here
username = ''
password = ''
| mit | Python | |
639d6244e485723907ed523d04d1bf3c3318dbb8 | Add tests for utils | nonamenix/babel-vue-extractor | babelvueextractor/tests/test_utils.py | babelvueextractor/tests/test_utils.py | # -*- coding: utf-8 -*-
import unittest
from babelvueextractor.utils import is_protected_type, force_text, smart_split
import datetime
class TestUtils(unittest.TestCase):
def test_is_protected_type_numeric(self):
assert is_protected_type(5)
assert is_protected_type(5L)
assert is_protecte... | apache-2.0 | Python | |
67c68bbdd20571458de509e2c7e8c2691769af5e | Add Alt29 | adtac/exterminate | exterminate/Alt29.py | exterminate/Alt29.py | import ctypes
def deref(addr, typ):
return ctypes.cast(addr, ctypes.POINTER(typ))
# Remove the meaning of life
deref(id(29), ctypes.c_int)[6] = 100
| mit | Python | |
02eced461f884f037cb13cb2bb337441edb401ea | Add migration to populate broadcasts in flowsteps | tsotetsi/textily-web,pulilab/rapidpro,ewheeler/rapidpro,ewheeler/rapidpro,pulilab/rapidpro,pulilab/rapidpro,tsotetsi/textily-web,ewheeler/rapidpro,pulilab/rapidpro,pulilab/rapidpro,ewheeler/rapidpro,tsotetsi/textily-web,tsotetsi/textily-web,tsotetsi/textily-web | temba/flows/migrations/0055_populate_step_broadcasts.py | temba/flows/migrations/0055_populate_step_broadcasts.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from temba.utils import chunk_list
from redis_cache import get_redis_connection
import time
HIGHPOINT_KEY = 'flowstep_backfill_highpoint'
def populate_flowsteps_for_broadcast(RelatedBroadcast, RelatedMsg, MsgMan... | agpl-3.0 | Python | |
6b4228e470703ace0bf86a4ed757b4ec78630af8 | Create faqs_bot.py | IndicoDataSolutions/SuperCell | faqs_bot/faqs_bot.py | faqs_bot/faqs_bot.py | import math
import os
from random import sample
import cPickle as pickle
from scipy.spatial.distance import cdist
import json
import numpy as np
import indicoio
from texttable import Texttable
indicoio.config.api_key = "YOUR_API_KEY_HERE"
'''
description
'''
faqs = {
'Where can I find my API Key?':'Hi there! You... | mit | Python | |
81ea2c721655f04a9d301a3d0889a1d8530beec3 | create env_check decorator | kissmetrics/km-hipchat-screamer | km_hipchat_screamer/utils.py | km_hipchat_screamer/utils.py |
from flask import jsonify
import os
class env_check(object):
def __init__(self, env_var):
self.env_var = env_var
def __call__(self, f):
def g(*args, **kwargs):
error_message = "Not Implemented, %s not configured" % (self.env_var)
response = jsonify(error=error_message)... | mit | Python | |
e8c204cfa346c2ec3c44dd4a6eff5b405dcaba40 | Copy fifo_scheduler.py from Eric's repository. | cfe-lab/MiCall,cfe-lab/MiCall,cfe-lab/MiCall | fifo_scheduler.py | fifo_scheduler.py | import atexit, subprocess, sys
from Queue import Queue
class Job:
"""
A job is a shell command + optional file paths for stdout/stderr.
If file paths are undefined, outputs default to the console.
"""
def __init__(self, shell_command, standard_output=None, standard_error=None):
self.shell_command = shell_comma... | agpl-3.0 | Python | |
43dbb87123947203f4f22bb3f80762f62ff8edb9 | Test some fortran routines bindings with python. | daskol/nls,daskol/nls | src/nls_test.py | src/nls_test.py | #!/usr/bin/env python2
#
# In this file test glue layer between Fortran 95 code and module generated by f2py from numpy.
# Here and bellow `native solution` means solution that was obtained with native fortran code
# and in opposite `glue solution` means native solution transmitted through glue layer.
#
# (c) D... | mit | Python | |
c473f24508e19c5f42e178df385983054e41ae54 | Add body.py | ShalbafZadeh/body | body.py | body.py | class Person:
def __init__(self,head,tounge):
self.head = head
self.tounge = tounge
def behading(self):
if self.head == "green" and self.tounge == "red":
print ("Person has behaded")
else :
print ("Person remains alive")
person = Person(head="green",tounge="re... | mit | Python | |
595381a6b1e7430326a585e335273d31fbf0d0da | test api TrelloClient requests new cards and read | junqueira/balance | finance/trello.py | finance/trello.py | #!/usr/bin/env python
import argparse
import json
import os
import requests
from colorama import init, Fore
#
API_KEY = '9cebbbee11ec863600da7fdabed04caf'
API_URL = 'https://api.trello.com/1/'
APP_NAME = 'trello-cmd'
CONFIG = os.path.join(os.environ['HOME'], '.trello')
class NoConfigException(Exception):
... | mit | Python | |
512349c5dc56e1a62571573d4e1ef7d18d7dae9b | Add Photobucket | foauth/foauth.org,foauth/foauth.org,foauth/foauth.org | services/photobucket.py | services/photobucket.py | import urlparse
import foauth.providers
from oauthlib.oauth1.rfc5849 import SIGNATURE_TYPE_QUERY
class Photobucket(foauth.providers.OAuth1):
# General info about the provider
provider_url = 'http://www.photobucket.com/'
docs_url = 'http://pic.pbsrc.com/dev_help/WebHelpPublic/PhotobucketPublicHelp.htm'
... | bsd-3-clause | Python | |
2e73497a0f1a417f1b047b3857bd72117c2a33d3 | Use closue default parameter for set arguments correctly in list comprehension. | sjh/python | closure_default_parameter.py | closure_default_parameter.py | #!/usr/bin/env python3
def create_multipliers_late_binding():
""" https://www.toptal.com/python/top-10-mistakes-that-python-programmers-make create closure
with late binding effect. """
return [lambda x: i * x for i in range(5)]
def create_multipliers():
""" https://www.toptal.com/python/top-10-mis... | apache-2.0 | Python | |
dc26ebcd2437f4ade2a0692ebe79af0f4f664097 | Add the GPIO proxy class for the Raspberry Pi | fjacob21/pycon2015 | elpiwear/Rpi/gpio.py | elpiwear/Rpi/gpio.py | # The MIT License (MIT)
#
# Copyright (c) 2015 Frederic Jacob
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, mo... | mit | Python | |
cf03d0a1fbb96af1195b6343bc0d8b31596cc0be | Update setup.py to use recommended method for python-verson specific dependencies (#5266) | googleapis/google-cloud-python,dhermes/gcloud-python,GoogleCloudPlatform/gcloud-python,tseaver/google-cloud-python,dhermes/google-cloud-python,jonparrott/google-cloud-python,tseaver/gcloud-python,tseaver/google-cloud-python,dhermes/google-cloud-python,googleapis/google-cloud-python,dhermes/gcloud-python,jonparrott/gclo... | language/setup.py | language/setup.py | # Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | # Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | apache-2.0 | Python |
19039f7c1467bd7fbc7be8b527d57db1395ff145 | Add a United States ITIN module | arthurdejong/python-stdnum,t0mk/python-stdnum,holvi/python-stdnum,tonyseek/python-stdnum,holvi/python-stdnum,arthurdejong/python-stdnum,holvi/python-stdnum,dchoruzy/python-stdnum,arthurdejong/python-stdnum | stdnum/us/itin.py | stdnum/us/itin.py | # itin.py - functions for handling ITINs
#
# Copyright (C) 2013 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) a... | lgpl-2.1 | Python | |
eb59bec3fb4b24ff89a86054147c32a8fdd822e8 | Update and rename latest/protocol to latest/protocol/ethernet.py | bigplus/Nscan,f0r34chb3t4/Nscan,xujun10110/Nscan,OffensivePython/Nscan | latest/protocol/ethernet.py | latest/protocol/ethernet.py | '''
Ethernet
'''
import struct
class layer():
pass
class ETHER(object):
def __init__(self, src='', dst='', type=''):
self.src = src
self.dst = dst
self.type = type
def pack(self):
ethernet = struct.pack('!6s6sH',
self.dst,
... | apache-2.0 | Python | |
decdbe66d1653eb2c24271879f8c34e43db395e1 | Create cfgs.py | yihui-he/resnet-cifar10-caffe,yihui-he/resnet-cifar10-caffe | cfgs.py | cfgs.py | caffe_path='/home/heyihui-local/caffe'
| mit | Python | |
7313b8ab6326172f5fb941e82a89963f919f56d2 | Add Spiral toy dataset | codeaudit/fuel,orhanf/fuel,rodrigob/fuel,dwf/fuel,janchorowski/fuel,glewis17/fuel,mjwillson/fuel,bouthilx/fuel,EderSantana/fuel,jbornschein/fuel,mila-udem/fuel,rodrigob/fuel,udibr/fuel,glewis17/fuel,aalmah/fuel,laurent-dinh/fuel,vdumoulin/fuel,mila-udem/fuel,lamblin/fuel,lamblin/fuel,rizar/fuel,harmdevries89/fuel,udibr... | fuel/datasets/toy.py | fuel/datasets/toy.py | # -*- coding: utf-8 -*-
import numpy
from collections import OrderedDict
from fuel import config
from fuel.datasets import IndexableDataset
from fuel.utils import do_not_pickle_attributes
class Spiral(IndexableDataset):
u"""Simple toy dataset containing datapoints from a spiral on a 2d plane.
Parameters
... | mit | Python | |
5e38a855e200619618e4e13f05dd1303138cb3a9 | add utils/parser.py | nclab/autoprover,elic-eon/autoprover | utils/parser.py | utils/parser.py | import argparse
def getArgs():
parser = argparse.ArgumentParser(description='Autoprover')
parser.add_argument("-i", "--input", help="your input", default=None)
args = parser.parse_args()
return args
| mit | Python | |
aff608fcd354bad4a2637f6cad6a6f90b1971bf8 | Write tests for socket: short, long and exact. | bm5w/network_tools | test_echo.py | test_echo.py | # -*- coding: utf-8 -*-
import subprocess
import pytest
def test_basic(string="This is a test."):
process = subprocess.Popen(['./echo_client.py', string],
stdout=subprocess.PIPE)
assert string == process.stdout.readline()
def test_unicode():
with pytest.raises(AssertionErr... | mit | Python | |
60e4ebbca808184b12ce087b77ee18104db8a326 | add simple unit test for page find method | jakemcdermott/page_automation | test_page.py | test_page.py | #!/usr/bin/env python
import unittest
from selenium import webdriver
from page import Page
class TestPage(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.driver = webdriver.Firefox()
cls.page = Page(cls.driver)
@classmethod
def tearDownClass(cls):
cls.driver.close... | mit | Python | |
296ff8772f82318c365fdfd6a1d82188ee5ca1fc | add python to make the plots (matplotilib) | LIP-Computing/bench_gpu | analisys/mat-plot.py | analisys/mat-plot.py | #########################################################################
# Developed in the framework of INDIGO project,
#
# Author: Mario David <mariojmdavid@gmail.com>
#########################################################################
import os
import pprint
import numpy as np
import matplotlib.pyplot as plt... | apache-2.0 | Python | |
f48781ef3eba027876a59b33a435261dcc34e701 | Fix typo in file_reporter | jayceyxc/hue,ahmed-mahran/hue,kawamon/hue,xiangel/hue,kawamon/hue,jjmleiro/hue,lumig242/Hue-Integration-with-CDAP,kawamon/hue,MobinRanjbar/hue,GitHublong/hue,hdinsight/hue,MobinRanjbar/hue,vmax-feihu/hue,vmax-feihu/hue,kawamon/hue,lumig242/Hue-Integration-with-CDAP,lumig242/Hue-Integration-with-CDAP,todaychi/hue,lumig2... | desktop/core/src/desktop/lib/metrics/file_reporter.py | desktop/core/src/desktop/lib/metrics/file_reporter.py | # Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file ex... | # Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file ex... | apache-2.0 | Python |
9e3a193a8e3798c73661ea5c5b4235cf5178e354 | Update test location, setup.py and README | pymfony/system | test/test_system.py | test/test_system.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# This file is part of the pymfony package.
#
# (c) Alexandre Quercia <alquerci@email.com>
#
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
"""
"""
from __future__ import absolute_import;
import uni... | mit | Python | |
20525c530efb01854cf3e5e22753be67903d7a2f | Add data helper methods | ghl3/bamboo,ghl3/bamboo | data.py | data.py | from __future__ import division
import pandas as pd
from plotting import NUMERIC_TYPES
def get_numeric_features(df):
float_feature_names = [feature for feature in df.columns
if df[feature].dtype in NUMERIC_TYPES]
return df[float_feature_names]
def arff_to_df(arff):
rows = [... | mit | Python | |
cbd54c2cd4634dbd48e00a99b6851e3419602171 | resolve migration conflict | OpenVolunteeringPlatform/django-ovp-organizations,OpenVolunteeringPlatform/django-ovp-organizations | ovp_organizations/migrations/0015_merge_20170112_2144.py | ovp_organizations/migrations/0015_merge_20170112_2144.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2017-01-12 21:44
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('ovp_organizations', '0014_auto_20170112_1717'),
('ovp_organizations', '0013_auto_20170111_16... | agpl-3.0 | Python | |
070ec0d8ceffb1217e1892a842901e1aa8b22920 | add config module, a handy wrapper of python ConfigParser | ihybrd/pl | pl/config.py | pl/config.py | """Config.py
Created on : Sep 2015
Author: Hu Yongbin
This module simply wrappes ConfigParser module from original Python, so you
can access configure file in a pretty handy way.
Assume you have a configure file called example.ini like this:
(below INI example comes from https://en.wikipedia.org/wiki/INI_file)
----... | mit | Python | |
ad0f9b35391216c64760770b9c438a35810c78ac | Introduce TD3 | ShangtongZhang/DeepRL,ShangtongZhang/DeepRL | deep_rl/agent/TD3_agent.py | deep_rl/agent/TD3_agent.py | #######################################################################
# Copyright (C) 2017 Shangtong Zhang(zhangshangtong.cpp@gmail.com) #
# Permission given to modify the code as long as you keep this #
# declaration at the top #
################################... | mit | Python | |
8ed8e466598a74855582ec0a44ca018a82fcb348 | add a Qt pen | googlefonts/fonttools,fonttools/fonttools | Lib/fontTools/pens/qtPen.py | Lib/fontTools/pens/qtPen.py | from __future__ import print_function, division, absolute_import
from fontTools.misc.py23 import *
from fontTools.pens.basePen import BasePen
__all__ = ["QtPen"]
class QtPen(BasePen):
def __init__(self, glyphSet, path=None):
BasePen.__init__(self, glyphSet)
if path is None:
from PyQt5.QtGui import QPainter... | mit | Python | |
9bce03d89dad6b69a88632d95988fc42af19557a | Add custom uility function which knows how to compare and match complex semver version specifiers. | nzlosh/st2,StackStorm/st2,Plexxi/st2,nzlosh/st2,tonybaloney/st2,StackStorm/st2,Plexxi/st2,peak6/st2,Plexxi/st2,lakshmi-kannan/st2,lakshmi-kannan/st2,tonybaloney/st2,Plexxi/st2,peak6/st2,tonybaloney/st2,peak6/st2,StackStorm/st2,lakshmi-kannan/st2,nzlosh/st2,StackStorm/st2,nzlosh/st2 | st2common/st2common/util/versioning.py | st2common/st2common/util/versioning.py | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | apache-2.0 | Python | |
3473869011afa4e1fe1c61880f2e229c6e2bc09b | Add csv formatter test | openstack/cliff,dtroyer/cliff,dtroyer/cliff,openstack/cliff,idjaw/cliff,idjaw/cliff,enzochiau/cliff,enzochiau/cliff | cliff/tests/test_formatters_csv.py | cliff/tests/test_formatters_csv.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import mock
import six
from cliff.formatters import commaseparated
def test_commaseparated_list_formatter():
sf = commaseparated.CSVLister()
c = ('a', 'b', 'c')
d1 = ('A', 'B', 'C')
d2 = ('D', 'E', 'F')
data = [d1, d2]
expected = 'a,b,c\nA,B,C\nD... | apache-2.0 | Python | |
7903336bf1190814c04f73ade3e19f0ed5fadef4 | Add command to truncate table data in PostgreSQL db dump files | ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/django-icekit | icekit/management/commands/truncate_postgres_dbdump.py | icekit/management/commands/truncate_postgres_dbdump.py | import sys # Needed to output unicode see https://code.djangoproject.com/ticket/21933
import re
from django.core.management.base import BaseCommand, CommandError
COPY_TABLENAME_RE = re.compile(r'^COPY ([^ ]+) .* FROM stdin;$')
class Command(BaseCommand):
help = ("Truncate unwanted table data in PostgreSQL DB ... | mit | Python | |
a75a3c65fa59753f194e74f2dc7f00be3c4d2d3a | Create pos_clear.py | nevmenandr/thai-language | pos_clear.py | pos_clear.py | # скрипт очищает результаты pos_finder.py
import os
import codecs
pos_list = []
text = codecs.open(u'/Users/apple/Desktop/pos_list.txt', 'r', 'utf-8')
for pos in text:
pos = pos.strip()
if ',' in pos:
pos_clear = pos.split(', ')
pos_list.extend(pos_clear)
else:
pos_list.append(pos... | cc0-1.0 | Python | |
e8c630e3ebd90899e2b6e985c2f55dda4298508f | add order benchmark file | aktech/sympy,hargup/sympy,yashsharan/sympy,Curious72/sympy,ChristinaZografou/sympy,kaushik94/sympy,sampadsaha5/sympy,jerli/sympy,rahuldan/sympy,mafiya69/sympy,ChristinaZografou/sympy,chaffra/sympy,souravsingh/sympy,madan96/sympy,souravsingh/sympy,souravsingh/sympy,Curious72/sympy,madan96/sympy,drufat/sympy,skidzo/sympy... | sympy/series/benchmarks/bench_order.py | sympy/series/benchmarks/bench_order.py | from __future__ import print_function, division
from sympy import Symbol, O, Add
x = Symbol('x')
l = list(x**i for i in range(1000))
l.append(O(x**1001))
def timeit_order_1x():
_ = Add(*l)
| bsd-3-clause | Python | |
25ea95cf4a68f1206b553fac92cb59fd51e79972 | Add syffix array | voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts | suffix-array.py | suffix-array.py | def suffixArray(s):
n = len(s)
rkd = {c: i for i, c in enumerate(sorted(set(s)))}
rank = [rkd[c] for c in s]
k = 1
while k <= n:
xy = [(rank[i], (rank[i+k] if i+k < n else -1)) for i in xrange(n)]
rkd = {c: i for i, c in enumerate(sorted(set(xy)))}
rank = [rkd[c] for c in xy]... | mit | Python | |
3287050226cef070db64b8c6f673e7580f26033a | Add new package: dosfstools (#18410) | LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/dosfstools/package.py | var/spack/repos/builtin/packages/dosfstools/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Dosfstools(AutotoolsPackage):
"""dosfstools consists of the programs mkfs.fat, fsck.fat an... | lgpl-2.1 | Python | |
25321e4c2d89ad132a36711590f044e37536276f | Add tools.yandex | maurobaraldi/grab,raybuhr/grab,liorvh/grab,shaunstanislaus/grab,raybuhr/grab,DDShadoww/grab,subeax/grab,subeax/grab,codevlabs/grab,giserh/grab,lorien/grab,liorvh/grab,giserh/grab,pombredanne/grab-1,istinspring/grab,SpaceAppsXploration/grab,lorien/grab,DDShadoww/grab,kevinlondon/grab,shaunstanislaus/grab,alihalabyah/gra... | grab/tools/yandex.py | grab/tools/yandex.py | import urllib
from .encoding import smart_str
class CaptchaError(Exception):
"""
Raised when yandex shows captcha.
"""
def is_banned(grab):
return grab.xpath_exists('//input[@class="b-captcha__input"]')
def build_search_url(query, page=1, per_page=None, lang='en', filter=True,
... | mit | Python | |
7aded435de4a54907b818cea2bcda6ffbc560b3f | add char scaler test | HaveF/pcaspy,tectronics/pcaspy,paulscherrerinstitute/pcaspy,mscheng/pcaspy,HaveF/pcaspy,mscheng/pcaspy,paulscherrerinstitute/pcaspy,tectronics/pcaspy,paulscherrerinstitute/pcaspy | test/gddTest.py | test/gddTest.py | import pcaspy
import numpy
import unittest
class TestGDD(unittest.TestCase):
def setUp(self):
self.s = pcaspy.gdd()
def test_string(self):
self.s.put("sdcsd")
self.assertEqual(self.s.get(), "sdcsd")
def test_numeric(self):
self.s.put(12)
self.assertEqual(self.s.ge... | import pcaspy
import numpy
import unittest
class TestGDD(unittest.TestCase):
def setUp(self):
self.s = pcaspy.gdd()
def test_string(self):
self.s.put("sdcsd")
self.assertEqual(self.s.get(), "sdcsd")
def test_numeric(self):
self.s.put(12)
self.assertEqual(self.s.ge... | bsd-3-clause | Python |
0d50c41de2b6b410946dac8dde319eb4b19e8fce | Add angle support. | kivy/kivy-sdk-packager,kivy/kivy-sdk-packager | win/angle.py | win/angle.py | from __future__ import absolute_import, print_function
import sys
from os.path import join, sep
from os import walk
from .common import *
__version__ = '0.1.1'
batch = '''
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" {}
msbuild .\angle.sln /property:Configuration=Release /property:Platf... | mit | Python | |
a3fb299b0decc0887f5f7a4043463304431aae0d | Create problem-3.py | David0leo/project-euler-python | problem-3.py | problem-3.py | # Project Euler Problem 3
###############################
# Find the largest prime factor
# of the number 600851475143
###############################
#checks if a natural number n is prime
#returns boolean
def prime_check(n):
assert type(n) is int, "Non int passed"
assert n > 0, "No negative values allowed, o... | mit | Python | |
a2971e033ecbc6660e3a6348cfe1af5bc8cab076 | add test_install.py | lokik/sfepy,rc/sfepy,sfepy/sfepy,vlukes/sfepy,lokik/sfepy,vlukes/sfepy,BubuLK/sfepy,vlukes/sfepy,rc/sfepy,lokik/sfepy,RexFuzzle/sfepy,RexFuzzle/sfepy,lokik/sfepy,BubuLK/sfepy,BubuLK/sfepy,rc/sfepy,sfepy/sfepy,RexFuzzle/sfepy,sfepy/sfepy,RexFuzzle/sfepy | test_install.py | test_install.py | #!/usr/bin/env python
"""
Simple script for testing various SfePy functionality, examples not
covered by tests, and running the tests.
The script just runs the commands specified in its main() using the
`subprocess` module, captures the output and compares one or more key
words to the expected ones.
The output of fai... | bsd-3-clause | Python | |
bcf9a576a6cf37c46d81a83bde7c884b90f1f0ea | Add files via upload | T3chn3/HFP,T3chn3/HFP | hfp1.py | hfp1.py | #hfp1
#idle usage Pro-Tips
#Alt-P - recalls the last code statement
#Alt-N - quickly moves to the next code statement
#using a for loop to iterate over each item in a list, better than using a while loop
for i in listX
print(i)
#Identifiers can only start with a letter or _
if condtion:
#the true... | mit | Python | |
9b265e4607386e8848051842c06f49cd35a051ce | add sms/mms example | mattmakai/python-twilio-example-apps | bottle/sms-mms/app.py | bottle/sms-mms/app.py | from bottle import (post, request, response, route, run, )
from twilio import twiml
from twilio.rest import TwilioRestClient
# copy in your Twilio Account SID and Auth Token from Twilio Console
client = TwilioRestClient("your account sid", "your auth token")
# this URL variable can be dynamic or customized later
MMS... | mit | Python | |
a8084300f248c93d1b996682e2baa1a2ba3d3bae | Create __init__.py | 1313e/e13Tools | tests/__init__.py | tests/__init__.py | bsd-3-clause | Python | ||
47d928ca64baf495d9d24d24e756878ed5065c81 | Add Exercise 11.3. | jcrist/pydy,Shekharrajak/pydy,Shekharrajak/pydy,skidzo/pydy,oliverlee/pydy,Shekharrajak/pydy,jcrist/pydy,skidzo/pydy,jcrist/pydy,jcrist/pydy,skidzo/pydy,oliverlee/pydy,jcrist/pydy,jcrist/pydy,oliverlee/pydy,jcrist/pydy,skidzo/pydy,Shekharrajak/pydy | Kane1985/Chapter6/Ex11.3.py | Kane1985/Chapter6/Ex11.3.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Exercise 11.3 from Kane 1985."""
from __future__ import division
from sympy import Matrix, symbols
from sympy.physics.mechanics import ReferenceFrame, Point
from sympy.physics.mechanics import dynamicsymbols
R_SQ, R_QE, R_EM, R_Ee, R_Mm = symbols('R_SQ R_QE R_EM R_Ee ... | bsd-3-clause | Python | |
fce66218e682d80076ef744b9206b9cc042891b2 | Add management command to populate site codes | SEL-Columbia/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,SEL-Columbia/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,puttara... | corehq/apps/commtrack/management/commands/populate_site_code.py | corehq/apps/commtrack/management/commands/populate_site_code.py | from django.core.management.base import BaseCommand
from corehq.apps.locations.models import Location
class Command(BaseCommand):
help = 'Generate missing site codes for locations'
def handle(self, *args, **options):
self.stdout.write("Populating site codes...\n")
relevant_ids = set([r['id']... | bsd-3-clause | Python | |
a5712ad442de5eb9e68e111436049a50fa72505d | Configure betamax for pytest usage | khardix/mccurse | tests/conftest.py | tests/conftest.py | """Global test configuration"""
import os
import betamax
# Ensure cassete dir
CASSETE_DIR = 'tests/cassetes/'
if not os.path.exists(CASSETE_DIR):
os.makedirs(CASSETE_DIR)
with betamax.Betamax.configure() as config:
config.cassette_library_dir = CASSETE_DIR
| agpl-3.0 | Python | |
78708fdd252b287dd6965a8d659dbb1fb1bd85a3 | work in progress | macbre/index-digest,macbre/index-digest | indexdigest/test/linters/test_0020_big_table.py | indexdigest/test/linters/test_0020_big_table.py | from __future__ import print_function
from indexdigest.test import BigTableTest
class TestBigTableLinters(BigTableTest):
def test_filesort(self):
queries = [
# Using where; Using filesort
'SELECT * FROM 0020_big_table WHERE id BETWEEN 10 AND 20 ORDER BY val',
# Using ... | mit | Python | |
f44805d8673bdf1382a48962e46ba4e2a7ec7e79 | Add check for None values in node or node.next | keon/algorithms,amaozhao/algorithms | delete_node.py | delete_node.py | """
Write a function to delete a node (except the tail)
in a singly linked list, given only access to that node.
Supposed the linked list is 1 -> 2 -> 3 -> 4 and
you are given the third node with value 3,
the linked list should become 1 -> 2 -> 4 after calling your function.
"""
def delete_node(node):
if node is... | mit | Python | |
3271d22838b0a4cf311f06bf84921d69b7a4167e | Create __init__.py | tsai-kailin/ConditionalOSDE | tests/__init__.py | tests/__init__.py | mit | Python | ||
4d988c43d7d0e0864f86e09bf53099fd36030a06 | Add tool for comparing performance from logfiles | tomasvdw/bitcrust,tomasvdw/bitcrust,tomasvdw/bitcrust,tomasvdw/bitcrust,tomasvdw/bitcrust | tool/gen_compare.py | tool/gen_compare.py | #!/usr/bin/python3
# Tool that generates comparison data from the core log and the bitcrust log
import tailer
import pprint
import re
import pystache
from dateutil.parser import parse
CORE_LOG = "/home/tomas/.bitcoin/debug.log"
BC_LOG = "/home/tomas/src/bitcrust/cmp1"
RE_CORE_CONNECT = re.compile(r'- Connect b... | mit | Python | |
03f17f595765640d35d1246967ea4d32f50e1d6e | Remove spectacular fail: bug fixed | DMOJ/site,monouno/site,Phoenix1369/site,Phoenix1369/site,Phoenix1369/site,Minkov/site,monouno/site,monouno/site,DMOJ/site,Minkov/site,monouno/site,Minkov/site,monouno/site,Minkov/site,Phoenix1369/site,DMOJ/site,DMOJ/site | judge/bridge/djangohandler.py | judge/bridge/djangohandler.py | import logging
import SocketServer
import json
import struct
logger = logging.getLogger('judge.bridge')
size_pack = struct.Struct('!I')
class DjangoHandler(SocketServer.StreamRequestHandler):
def setup(self):
SocketServer.StreamRequestHandler.setup(self)
self.handlers = {
'submission... | import logging
import SocketServer
import json
import struct
logger = logging.getLogger('judge.bridge')
size_pack = struct.Struct('!I')
class DjangoHandler(SocketServer.StreamRequestHandler):
def setup(self):
SocketServer.StreamRequestHandler.setup(self)
self.handlers = {
'submission... | agpl-3.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.