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
06fd10d6715e00f82737242f7d059bc1e76e2882
Add ign_loop to run ignition delay analysis in a loop
bryanwweber/UConnRCMPy
ign_loop.py
ign_loop.py
import numpy as np import matplotlib.pyplot as plt from pressure_traces import smoothing, derivative, file_loader, filename_parse, copy, pressure_to_temperature, compress import os # os.chdir('Y:\\RCM Data\\propane-dme\\phi=1.0\\75DME-25C3H8\\30-bar\\00-in-02-mm-311K') print(os.getcwd()) pth = os.listdir('.') result =...
bsd-3-clause
Python
30350cefead7511c4ea89a167de9513f4c0cf9f8
Create urls.py
dfurtado/generator-djangospa,dfurtado/generator-djangospa,dfurtado/generator-djangospa
templates/root/main/urls.py
templates/root/main/urls.py
from django.conf.urls import url, include from <%= appName %> import views from rest_framework.routers import DefaultRouter # Creat a router and register our viewsets with it. router = DefaultRouter() router.register(r'sample', views.SampleViewSet) router.register(r'users', views.UserViewSet) # The API URLs are now d...
mit
Python
2ddf573e87c3c1a1ca6ab5f2336e85ca54013863
Add helpers to convert date strings and Binance intervals to milliseconds
sammchardy/python-binance
binance/helpers.py
binance/helpers.py
import time import dateparser import pytz from datetime import datetime def date_to_milliseconds(date_str): """Convert UTC date to milliseconds If using offset strings add "UTC" to date string e.g. "now UTC", "11 hours ago UTC" See dateparse docs for formats http://dateparser.readthedocs.io/en/latest/ ...
mit
Python
b95bd34c9e5ebcf8dc4ccb00225135d0a11e1771
Add regression test for pull request 114, issue 111
cwacek/python-jsonschema-objects
test/test_regression_114.py
test/test_regression_114.py
import pytest import python_jsonschema_objects as pjo def test_114(): schema = { "title": "Example", "type": "object", "properties": { "test_regression_114_anon_array": { "type": "array", "items": [ { "...
mit
Python
7a51f5a4e4effee4891cddbb867f873ec15c5fab
Sort an array of strings so that the anagrams are grouped
amitsaha/learning,amitsaha/learning,amitsaha/learning,amitsaha/learning,amitsaha/learning,amitsaha/learning,amitsaha/learning,amitsaha/learning,amitsaha/learning,amitsaha/learning,amitsaha/learning
Python/strings/sort_anagrams.py
Python/strings/sort_anagrams.py
''' Sort an array of strings so that the anagrams are next to one another Ex. 'abba', 'foo', 'bar', 'aabb' becomes: 'abba', 'aabb', 'foo', 'bar' ''' from __future__ import print_function from collections import OrderedDict def collect_anagrams(str_arr): d = OrderedDict() for i, s in enumerate(str_arr): ...
unlicense
Python
ed10ed7fa93515cf0984cbd02a287b4229235626
add image server
sassoftware/jobslave,sassoftware/jobslave,sassoftware/jobslave
jobslave/imgserver.py
jobslave/imgserver.py
import os import SocketServer import BaseHTTPServer import SimpleHTTPServer import threading import posixpath import urllib import socket class ServerStopped(Exception): pass class ImageHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): basePath = None def translate_path(self, path): """Code cop...
apache-2.0
Python
bbaae98d36e95df2335b054d69c54cee4428df15
add progber
briney/abtools
abtools/utils/progbar.py
abtools/utils/progbar.py
#!/usr/bin/env python # filename: progbar.py # # Copyright (c) 2015 Bryan Briney # License: The MIT license (http://opensource.org/licenses/MIT) # # 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 Softw...
mit
Python
8f8f66d792b0d208b060071e44c5ce127bddffa3
add a unittest file for Layout testing
pylayers/pylayers,pylayers/pylayers
pylayers/gis/test/test_layout_u.py
pylayers/gis/test/test_layout_u.py
import unittest from pylayers.gis.layout import * L1 = Layout('defstr.lay') class TestLayout(unittest.TestCase): def test_load(self): self.assertEqual(L1.Np,12) self.assertEqual(L1.Ns,15) def test_check(self): bc,ds = L1.check() self.assertTrue(bc) def test_have_subseg(se...
mit
Python
a2e719f82d0707bf2c79cc44628470f1ca7759ec
Add an example config.
Yelp/fullerite,baris/fullerite,venkey-ariv/fullerite,mikepea/fullerite,baris/fullerite,baris/fullerite,Yelp/fullerite,Yelp/fullerite,mikepea/fullerite,venkey-ariv/fullerite,mikepea/fullerite,venkey-ariv/fullerite,baris/fullerite,venkey-ariv/fullerite,mikepea/fullerite,Yelp/fullerite
src/diamond/collectors/jolokia/kafka_jolokia.py
src/diamond/collectors/jolokia/kafka_jolokia.py
# -*- coding: utf-8 -*- """ Collect Kafka metrics using jolokia agent ### Example Configuration ``` host = localhost port = 8778 ``` """ from jolokia import JolokiaCollector class KafkaJolokiaCollector(JolokiaCollector): def collect_bean(self, prefix, obj): for k, v in obj.iteritems(): ...
# -*- coding: utf-8 -*- """ Collectors Kafka metrics from jolokia agent. ### Example Configuration """ from diamond.collector import str_to_bool from jolokia import JolokiaCollector class KafkaJolokiaCollector(JolokiaCollector): def collect_bean(self, prefix, obj): for k, v in obj.iteritems(): ...
apache-2.0
Python
598bbd2262159602f2b1a778f1a34025a1203f53
Create tutorial1.py
NatSimon/empty-app
tutorial1.py
tutorial1.py
from ggame import App myapp = App() myapp.run()
mit
Python
7c2fb2e877a11c508f70816bcb7ec26c5b65a1d9
Add base type class.
SunDwarf/asyncqlio
katagawa/sql/types.py
katagawa/sql/types.py
""" Contains specific types for columns in Katagawa. These types are specified in the Column constructor. .. code:: python class MyModel(Base): __tablename__ = "my_model" id = katagawa.Column(katagawa.Integer) username = katagawa.Column(katagawa.String) """ import abc import typing cl...
mit
Python
1d6f7470b9722218b6dc1e4604b965e2d9abb717
add wsgi.py : deploy with wsgi
buildbuild/buildbuild,buildbuild/buildbuild,buildbuild/buildbuild
buildbuild/wsgi.py
buildbuild/wsgi.py
from buildbuild import wsgi application = wsgi.application
bsd-3-clause
Python
81d48dacd38b2b7ee9fcae589ddda459ba24e470
remove hack
alephdata/aleph,smmbllsm/aleph,alephdata/aleph,gazeti/aleph,pudo/aleph,OpenGazettes/aleph,OpenGazettes/aleph,alephdata/aleph,alephdata/aleph,pudo/aleph,gazeti/aleph,OpenGazettes/aleph,gazeti/aleph,smmbllsm/aleph,smmbllsm/aleph,gazeti/aleph,pudo/aleph,alephdata/aleph,OpenGazettes/aleph
aleph/ingest/__init__.py
aleph/ingest/__init__.py
import os import logging import requests from tempfile import mkstemp from aleph.core import get_archive, celery from aleph.metadata import Metadata from aleph.ingest.ingestor import Ingestor, IngestorException log = logging.getLogger(__name__) # https://bugzilla.redhat.com/show_bug.cgi?id=191060#c1 # https://github...
import os import logging import requests from tempfile import mkstemp from aleph.core import get_archive, celery from aleph.metadata import Metadata from aleph.ingest.ingestor import Ingestor, IngestorException log = logging.getLogger(__name__) # https://bugzilla.redhat.com/show_bug.cgi?id=191060#c1 # https://github...
mit
Python
7068d85055fcac2f8af0139fbd7db1f1f4362708
add handler for application v43 with preliminary fields
funginstitute/patentprocessor,nikken1/patentprocessor,yngcan/patentprocessor,yngcan/patentprocessor,yngcan/patentprocessor,nikken1/patentprocessor,funginstitute/patentprocessor,funginstitute/patentprocessor,nikken1/patentprocessor
lib/handlers/application_handler_v43.py
lib/handlers/application_handler_v43.py
#!/usr/bin/env python """ Uses the extended ContentHandler from xml_driver to extract the needed fields from patent grant documents """ from cStringIO import StringIO from datetime import datetime from unidecode import unidecode from handler import Patobj, PatentHandler import re import uuid import xml.sax import xml...
bsd-2-clause
Python
06378ab2cbfabf45cd71233afd8bdfd6df399df6
enumerate bits of UnicodeRange and CodePageRange
derwind/fontUtils,derwind/fontUtils,derwind/otfparser,derwind/fontUtils,derwind/otfparser,derwind/fontUtils
misc_scripts/investigateUnicodeRange.py
misc_scripts/investigateUnicodeRange.py
#! /usr/bin/env python # -*- coding: utf-8 -*- import sys from fontTools.ttLib import TTFont if __name__ == "__main__": font_path = sys.argv[1] font = TTFont(font_path) OS_2 = font["OS/2"] ulUnicodeRange = set() if hasattr(OS_2, "ulUnicodeRange1"): for i in range(32): if (OS_2...
apache-2.0
Python
14c59e15072f7fbc71f6a36f7bb867cbff67e32d
Create Koda.py
kujc/PR17NKSE
Koda.py
Koda.py
from csv import DictReader import pandas as ps def fileReaderSmucNesrece(): fp = open("evidencanesrecnasmuciscihV1.csv", "rt", encoding=" utf -8 ") reader = DictReader(fp) return [line for line in reader] #branje SmucNes = fileReaderSmucNesrece() SmucNes = ps.DataFrame(SmucNes) # uporaba pandas prin...
mit
Python
2f7cf5c1f3cca15415e2cc1fbe45f017eb89a80d
Create PyKo.py
edsoncudjoe/PyKo
PyKo.py
PyKo.py
from bs4 import BeautifulSoup import requests import pafy from prettytable import PrettyTable from pytube import YouTube from pprint import pprint import os, sys # Written by Daniel Koifman(A.K.A HeliosHype) and Alex Putilin # You are allowed to freely use, edit, modify and distribute this script, just make sure to g...
mit
Python
548565b0b0084bc2cacd0f8b73747185c7c4b4c2
ADD (29) nic.py file to manage network interface
fastconnect/cloudify-azure-plugin
plugin/nic.py
plugin/nic.py
from cloudify.exceptions import NonRecoverableError import connection def _get_vm_public_ip(ctx, azure_connection, subscription_id, resource_group, vm_name=None, nic=None): ''' Get the public IP from a machine or a network interface. ''' if nic is not None: response = azure_connection.azure_get( ...
apache-2.0
Python
907c57b7f35dbbfc12abc81de262174d4c2118ad
create serializer of Form class
tassolom/twq-app,teamworkquality/twq-app,tassolom/twq-app,teamworkquality/twq-app,teamworkquality/twq-app,teamworkquality/twq-app,tassolom/twq-app,tassolom/twq-app
api/forms/serializers.py
api/forms/serializers.py
from rest_framework import serializers from forms.models import Form class Form(serializers.ModelSerializer): class Meta: model = Form fields = ('id', 'name', 'is_admin', 'email') read_only_fields = ('full_name', 'is_admin', 'email')
mit
Python
4effce1c31c63fb2a44f4c56bdb3ef881ba1eba3
use node["conf_path"] instead of hardcoding the path in tests
albertomurillo/ceph-ansible,WingkaiHo/ceph-ansible,fgal/ceph-ansible,WingkaiHo/ceph-ansible,albertomurillo/ceph-ansible,font/ceph-ansible,font/ceph-ansible,travmi/ceph-ansible,jtaleric/ceph-ansible,bengland2/ceph-ansible,travmi/ceph-ansible,fgal/ceph-ansible,ceph/ceph-ansible,albertomurillo/ceph-ansible,WingkaiHo/ceph-...
tests/functional/tests/test_install.py
tests/functional/tests/test_install.py
class TestInstall(object): def test_ceph_dir_exists(self, File): assert File('/etc/ceph').exists def test_ceph_dir_is_a_directory(self, File): assert File('/etc/ceph').is_directory def test_ceph_conf_exists(self, File, node): assert File(node["conf_path"]).exists def test_ce...
class TestInstall(object): def test_ceph_dir_exists(self, File): assert File('/etc/ceph').exists def test_ceph_dir_is_a_directory(self, File): assert File('/etc/ceph').is_directory def test_ceph_conf_exists(self, File): assert File('/etc/ceph/ceph.conf').exists def test_ceph...
apache-2.0
Python
2cabd08abcf7b2ffd18a3294166f44b2b14a4570
Add simple powerset implementations
all3fox/algos-py
src/powerset.py
src/powerset.py
def build_powerset_0(xs): powerset = [[]] for x in xs: powerset.extend([subset + [x] for subset in powerset]) return powerset def build_powerset_1(xs): powerset = [] for i in range(pow(2, len(xs))): j, subset = 0, [] while i: if i % 2: sub...
mit
Python
951513230fb8da0be17758957784ee86740dfca4
Create Polynomial class
jackromo/mathLibPy
polynomial.py
polynomial.py
class Polynomial(object): def __init__(self): pass
mit
Python
1de8c157a55904389029f30ec7a7c46ac0997c54
add inf ctrl test
vangj/py-bbn,vangj/py-bbn
tests/pptc/test_inferencecontroller.py
tests/pptc/test_inferencecontroller.py
from pybbn.graph.dag import BbnUtil from pybbn.graph.jointree import EvidenceBuilder from pybbn.pptc.inferencecontroller import InferenceController from nose import with_setup def setup(): pass def teardown(): pass @with_setup(setup, teardown) def test_inference_controller(): bbn = BbnUtil.get_huang_g...
apache-2.0
Python
4560839eb5c2d9e67d4a15b7ccd3861417d4284c
Create customExceptions.py
VIkramx89/Flights-and-Hotels,vkmguy/Flights-and-Hotels
customExceptions.py
customExceptions.py
''' ''' class InvalidFlightIdException(Exception): def __init__(self): super().__init__("The flight is invalid") class InvalidAdultsException(Exception): def __init__(self): super().__init__("Number of adults should be between 1 and 4") class InvalidChildrenException(Exception): def __init__...
epl-1.0
Python
ebd7e0ad91458f635ba02b7ea06f42c0f7ea8145
Add graphics definition for easier standardized graph printing.
lucasdavid/edge
edge/graphics.py
edge/graphics.py
default_style = { 'alpha': .6, 'width': 1, 'node_size': 100, 'node_color': '#2EB1E6', 'edge_color': '#cccccc', } solution_style = default_style.copy() solution_style.update(node_color='#ff0000')
mit
Python
13378e6aa011f314ee201a991a4d92ef29c6d885
Make fb_native work with oss
janicduplessis/react-native,pandiaraj44/react-native,myntra/react-native,javache/react-native,myntra/react-native,hoangpham95/react-native,janicduplessis/react-native,hammerandchisel/react-native,hoangpham95/react-native,arthuralee/react-native,exponentjs/react-native,exponent/react-native,myntra/react-native,pandiaraj...
tools/build_defs/fb_native_wrapper.bzl
tools/build_defs/fb_native_wrapper.bzl
fb_native = struct( android_aar = native.android_aar, android_app_modularity = native.android_app_modularity, android_binary = native.android_binary, android_build_config = native.android_build_config, android_bundle = native.android_bundle, android_instrumentation_apk = native.android_instrumen...
mit
Python
cb159032856c4409187154cc0ec3d6ffae1fc4db
Add py solution for 692. Top K Frequent Words
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
py/top-k-frequent-words.py
py/top-k-frequent-words.py
from collections import Counter import heapq class Neg(): def __init__(self, x): self.x = x def __cmp__(self, other): return -cmp(self.x, other.x) class Solution(object): def topKFrequent_nlogk(self, words, k): """ :type words: List[str] :type k: int :rtype:...
apache-2.0
Python
54d3443b514814484645dee2836c9b0a591d0c19
update on stabu search
2easy/ctsp,2easy/ctsp
stabu_search.py
stabu_search.py
#!/usr/bin/env python from greedy import greedy_solution from random import randint def mix(t1, t2, solution): # TODO mix 6 elements excluding current ones def neighbourhood(solution): t1,t2 = sample(range(0,len(solution))) return mix(t1, t2, solution)
mit
Python
8849f3b79ac36fd92f01ab310722bef1bd65fed9
Add a myfedora.config.app_cfg module.
fedora-infra/fedora-packages,Fale/fedora-packages,fedora-infra/fedora-packages,fedora-infra/fedora-packages,fedora-infra/fedora-packages,Fale/fedora-packages,Fale/fedora-packages
myfedora/config/app_cfg.py
myfedora/config/app_cfg.py
from routes import Mapper from tg.configuration import AppConfig, Bunch, config import myfedora from myfedora import model from myfedora.lib import app_globals, helpers class MyFedoraConfig(AppConfig): def setup_routes(self): """ Setup our custom routes """ map = Mapper(directory=config['pylons.p...
agpl-3.0
Python
014818404e7a761eb9ee71637e02aed0cce668f5
add map
KingPixil/ice,KingPixil/ice
src/art/map/__init__.py
src/art/map/__init__.py
import math from ...loader import load from ...color import generateColors from ...seed import generateSeed from ...random import random, randomNoise2DOctaves from ...graphics import generateData, generatePoints, putColor, clearMargins, writeImage # Generate def generate(): # Initialize seedText = generateSeed...
mit
Python
75ab7f763217e4f6d546bdb3c181b989ab71dd65
Create customer_orders.py
rupertsmall/food_coop
customer_orders.py
customer_orders.py
from smtplib import SMTP as smtp from os import listdir from os import remove def is_listed(email): is_a_member = False fp = open('/foodcoop/members', 'r') for eachline in fp: if email == eachline.strip(): is_a_member = True fp.close() return is_a_member def email_re(list_of_wo...
mit
Python
bf4cc916888f0d997ef1eb8729889a6829dc6b77
Add lc0282_expression_add_operators.py
bowen0701/algorithms_data_structures
lc0282_expression_add_operators.py
lc0282_expression_add_operators.py
"""Leetcode 282. Expression Add Operators Hard URL: https://leetcode.com/problems/expression-add-operators/ Given a string that contains only digits 0-9 and a target value, return all possibilities to add binary operators (not unary) +, -, or * between the digits so they evaluate to the target value. Example 1: Inpu...
bsd-2-clause
Python
e311590d281eba27974f915602a1b3e701d0208b
cut out heads-bodies and save files
nateGeorge/IDmyDog,nateGeorge/IDmyDog,nateGeorge/IDmyDog
process_ims/cut_out_heads_and_bodies.py
process_ims/cut_out_heads_and_bodies.py
# takes dog images and pandas dataframe # cuts out images of heads and bodies # using bounding boxes from pandas DF import pandas as pd import pickle as pk import cv2 import os import imutils import re mainImPath = '/media/nate/Windows/github/IDmyDog/scrape-ims/images/' bb = pk.load(open('pickle_files/pDogs-bounding...
mit
Python
1a75c38f43f0857fcc1c0dfe594f719870ad3553
Add an utility to assign unique ids to files.
xanxys/shogi_recognizer,xanxys/shogi_recognizer
issue_id.py
issue_id.py
#!/bin/python from __future__ import print_function, division import argparse import os import os.path import random import string import shutil if __name__ == '__main__': parser = argparse.ArgumentParser( description=""" Merge new content into existing dataset, assigining safe unique keys. File extensions...
mit
Python
4fae632c55f2b74cc29dd443bc6c017b666b46f5
Add another demo program, one that spits out messages at regular intervals.
jonahbull/py-amqp,newvem/py-amqplib,yetone/py-amqp,smurfix/aio-py-amqp,smurfix/aio-py-amqp,dallasmarlow/py-amqp,dims/py-amqp,jonahbull/py-amqp,dallasmarlow/py-amqp,yetone/py-amqp,dims/py-amqp
demo/amqp_clock.py
demo/amqp_clock.py
#!/usr/bin/env python """ AMQP Clock Fires off simple messages at one-minute intervals to a topic exchange named 'clock', with the topic of the message being the local time as 'year.month.date.dow.hour.minute', for example: '2007.11.26.1.12.33', where the dow (day of week) is 0 for Sunday, 1 for Monday, and so on (sim...
lgpl-2.1
Python
6e20dd61c025ceab9bedf0f6fb05d53294244bfd
add version 2.18 (#5445)
mfherbst/spack,TheTimmy/spack,lgarren/spack,krafczyk/spack,lgarren/spack,iulian787/spack,tmerrick1/spack,tmerrick1/spack,matthiasdiener/spack,krafczyk/spack,iulian787/spack,EmreAtes/spack,skosukhin/spack,tmerrick1/spack,matthiasdiener/spack,LLNL/spack,iulian787/spack,lgarren/spack,LLNL/spack,krafczyk/spack,matthiasdien...
var/spack/repos/builtin/packages/ack/package.py
var/spack/repos/builtin/packages/ack/package.py
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
lgpl-2.1
Python
72f2f845e7247530c76926f9ad27bcdbece83c31
Update lz4 to 1.7.5 (#2878)
iulian787/spack,matthiasdiener/spack,EmreAtes/spack,krafczyk/spack,matthiasdiener/spack,tmerrick1/spack,skosukhin/spack,iulian787/spack,mfherbst/spack,krafczyk/spack,matthiasdiener/spack,TheTimmy/spack,tmerrick1/spack,mfherbst/spack,LLNL/spack,LLNL/spack,skosukhin/spack,EmreAtes/spack,krafczyk/spack,lgarren/spack,iulia...
var/spack/repos/builtin/packages/lz4/package.py
var/spack/repos/builtin/packages/lz4/package.py
############################################################################## # Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
############################################################################## # Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
lgpl-2.1
Python
b89a503817041b6c61a8877ec4a39b40c9046119
Add `cross-obscure.py`
ExpHP/cross-obscure
cross-obscure.py
cross-obscure.py
import puz import sys import argparse import os from functools import partial from itertools import groupby DEFAULT_SUFFIX = ' (obscured).txt' def main(): parser = argparse.ArgumentParser() parser.add_argument('PUZFILE', type=str, help='Across lite .puz file') parser.add_argument('--output', '-o', type=str, help='O...
mit
Python
e8435141790b99ffb0d62eefcb03b2237d67b2c1
Implement generate_init_config.py
peertracksinc/muse,peertracksinc/muse,peertracksinc/muse,peertracksinc/muse
programs/genesis_util/generate_init_config.py
programs/genesis_util/generate_init_config.py
#!/usr/bin/env python3 import argparse import json import subprocess import sys def dump_json(obj, out, pretty): if pretty: json.dump(obj, out, indent=2, sort_keys=True) else: json.dump(obj, out, separators=(",", ":"), sort_keys=True) return def main(): parser = argparse.ArgumentParse...
mit
Python
8286664294fd45b7aefe9fad43df6457e614f5bd
Fix import of module Pillow.Image
cooperhewitt/py-cooperhewitt-roboteyes-atkinson
cooperhewitt/roboteyes/atkinson/__init__.py
cooperhewitt/roboteyes/atkinson/__init__.py
from PIL import Image import logging def dither(src_path, dest_path, mime_type='GIF'): # Dithering in C because it is faster # https://github.com/migurski/atkinson try: try: return dither_atk(src_path, dest_path, mime_type) except Exception, e: logging.debug("d...
import Image import logging def dither(src_path, dest_path, mime_type='GIF'): # Dithering in C because it is faster # https://github.com/migurski/atkinson try: try: return dither_atk(src_path, dest_path, mime_type) except Exception, e: logging.debug("dither usi...
bsd-3-clause
Python
0996f1c59dfca9c22d0e3d78598bd3edbce62696
Add file copy utility script
danielharada/fileCopyUtility
dailyFileCopy.py
dailyFileCopy.py
import os import time import shutil import glob def reviewAndCopy(copy_from_directory, copy_to_directory): review_window_in_hours = 24 _review_window_in_sec = review_window_in_hours*3600 os.chdir(copy_from_directory) text_files = getAllTxtFilesFromCurrentDirectory() files_with_age = createFileAgeD...
mit
Python
1d4960adcc307504ecd62e45cac21c69c3ac85a1
Add updated migration with vat_conditions
hobarrera/django-afip,hobarrera/django-afip
django_afip/migrations/0026_vat_conditions.py
django_afip/migrations/0026_vat_conditions.py
from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('afip', '0025_receipt__default_currency'), ] operations = [ migrations.AlterField( model_name='receiptpdf', name='vat_condition', field=models.CharField(c...
isc
Python
4aaa11c048e54fbafe8a5bc30dc569e1bd39d9ea
add deque01.py
devlights/try-python
trypython/stdlib/deque01.py
trypython/stdlib/deque01.py
# coding: utf-8 """ collections.dequeについてのサンプルです。 """ import collections from trypython.common.commoncls import SampleBase from trypython.common.commonfunc import pr class Sample(SampleBase): def exec(self): # # collections.deque() は 両端キューの事。 # deque は 「Double-Ended-Queue」の略。 # 左...
mit
Python
67a50aeafe1891b3352895c32d799dfa825d14d4
Create predict.py
cadrev/Titanic-Prediction
predict.py
predict.py
# # Title : Basic Random Forest Prediction # Author : Felan Carlo C. Garcia # import numpy as np import pandas as pd from sklearn.ensemble import RandomForestClassifier # Load the fina data set. data = pd.read_csv('final-data.csv' , header=0) # We initialize a Random Forest with 1000 trees as are classifier fore...
mit
Python
97e7b62b6c6977c30ede819e5563f5ad32970dcb
Make util a package
umbc-hackafe/idiotic,idiotic/idiotic
idiotic/util/blocks/__init__.py
idiotic/util/blocks/__init__.py
from . import *
mit
Python
0248778c18dc7b9bb3eef4b4e9cc7ec076072367
Add reviewTime.py
matthiasvegh/util,matthiasvegh/util
reviewTime.py
reviewTime.py
#!/usr/bin/env python import datetime from git import Repo def main(): repo = Repo('.') commits = list(repo.iter_commits()) differences = [] for commit in commits: authordate = commit.authored_date commitdate = commit.committed_date differences.append( dateti...
mit
Python
873c362e88222f9b4c6fd560d557c6a39fc235dc
Update setup.py
omicsnut/bioconda-recipes,Luobiny/bioconda-recipes,peterjc/bioconda-recipes,npavlovikj/bioconda-recipes,CGATOxford/bioconda-recipes,lpantano/recipes,rvalieris/bioconda-recipes,jasper1918/bioconda-recipes,gvlproject/bioconda-recipes,BIMSBbioinfo/bioconda-recipes,phac-nml/bioconda-recipes,instituteofpathologyheidelberg/b...
recipes/python-omero/setup.py
recipes/python-omero/setup.py
from distutils.core import setup import os setup(name='Omero Python', version=os.environ['OMERO_VERSION'], description='OME (Open Microscopy Environment) develops open-source software and data format standards for the storage and manipulation of biological light microscopy data.', url='http://www.openmicroscopy.org...
from distutils.core import setup import os setup(name='Omero Python', version=os.environ['OMERO_VERSION'], description='OME (Open Microscopy Environment) develops open-source software and data format standards for the storage and manipulation of biological light microscopy data.', url='http://www.openmicro...
mit
Python
f337b96067c6a65b03cf07c0be4468d300ccd4a6
add file
CamDavidsonPilon/lifelines
lifelines/fitters/spline_fitter.py
lifelines/fitters/spline_fitter.py
# -*- coding: utf-8 -*- from lifelines.fitters import KnownModelParametricUnivariateFitter import autograd.numpy as np from lifelines.utils.safe_exp import safe_exp from lifelines import utils class SplineFitter: _scipy_fit_method = "SLSQP" _scipy_fit_options = {"ftol": 1e-10} @staticmethod def relu(...
mit
Python
54c0ac466d51fdc3c921fa90c5bd60011ff7e0dd
Add test for layering violations
prophile/jacquard,prophile/jacquard
jacquard/tests/test_layering.py
jacquard/tests/test_layering.py
import re import dis import pytest import pathlib import jacquard try: import networkx except ImportError: networkx = None DEPENDENCIES = ( ('__main__', 'cli'), ('buckets', 'commands'), ('buckets', 'experiments'), ('buckets', 'odm'), ('buckets', 'storage'), ('cli', 'commands'), ...
mit
Python
82662de00a2b7234b01eafd931a16c03fb034f3b
Create permissions.py
05remla/permissions-repair
permissions.py
permissions.py
#!/usr/bin/python from os import path, listdir from os import lstat, walk from os import system import sqlite3, sys def Gather(): print('Building database...') ExclusionList = ['media', 'dev', 'tmp', 'cdrom', 'rofs', 'mnt', 'proc', 'sys'] conn = sqlite3.connect('/permissions.db') ...
cc0-1.0
Python
9bf3e5d826785d0c56d5a295767c64168b6df11c
Create match_start_end.py
costincaraivan/hackerrank,costincaraivan/hackerrank
regex/introduction/python3/match_start_end.py
regex/introduction/python3/match_start_end.py
Regex_Pattern = r"^\d\w{4}\.$" # Do not delete 'r'.
mit
Python
bc2d1a83aac2dd73db7c10b697d316a51527c372
add pavement script for doc building
unicefuganda/edtrac,unicefuganda/edtrac,unicefuganda/edtrac
pavement.py
pavement.py
# -*- Import: -*- from paver.easy import * from paver.setuputils import setup from setuptools import find_packages try: # Optional tasks, only needed for development # -*- Optional import: -*- from github.tools.task import * import paver.doctools import paver.virtual import paver.misctasks ...
bsd-3-clause
Python
b1b6b48eebcaf1e41066aa0217ff50539bd5172b
Create MagicTrick.py
laichunpongben/CodeJam
MagicTrick.py
MagicTrick.py
# Google Code Jam # Google Code Jam 2014 # Qualification Round 2014 # Problem A. Magic Trick class TestCase: def __init__(self): self.answer1 = 0 self.order1 = [[0 for x in range(4)] for x in range(4)] self.answer2 = 0 self.order2 = [[0 for x in range(4)] for x in range(4)] ...
apache-2.0
Python
b93604090080ba45f57b254200f30caae83e1742
add example for a custom matplotlib backend #582
mozman/ezdxf,mozman/ezdxf,mozman/ezdxf,mozman/ezdxf,mozman/ezdxf
examples/addons/drawing/custom_mpl_backend.py
examples/addons/drawing/custom_mpl_backend.py
# Copyright (c) 2021, Matthew Broadway # License: MIT License import argparse import matplotlib.pyplot as plt from matplotlib.font_manager import FontProperties import ezdxf from ezdxf.addons.drawing import Properties, RenderContext, Frontend from ezdxf.addons.drawing.backend import prepare_string_for_rendering fro...
mit
Python
5e4f892b4f89757021cdec7e92bd48b4db4787b7
add ex32
YYMaker/PythonStarter
LPTHW/ex32.py
LPTHW/ex32.py
the_count = [1, 2, 3, 4, 5] fruits = ['apples', 'oranges', 'pears', 'apricots'] change = [1, 'pennies', 2, 'dimes', 3, 'quarters']
cc0-1.0
Python
0b632aecaca7471427710abfd9abaf102fb8d072
remove spaces
typesupply/ufo2fdk,moyogo/ufo2fdk,typemytype/ufo2fdk
Lib/ufo2fdk/pens/__init__.py
Lib/ufo2fdk/pens/__init__.py
from fontTools.pens.basePen import BasePen def roundInt(v): return int(round(v)) def roundIntPoint((x, y)): return roundInt(x), roundInt(y) class RelativeCoordinatePen(BasePen): def __init__(self, glyphSet): BasePen.__init__(self, glyphSet) self._lastX = None self._lastY = None...
from fontTools.pens.basePen import BasePen def roundInt(v): return int(round(v)) def roundIntPoint((x, y)): return roundInt(x), roundInt(y) class RelativeCoordinatePen(BasePen): def __init__(self, glyphSet): BasePen.__init__(self, glyphSet) self._lastX = None self._lastY = None ...
mit
Python
77a8aa4d779214ad973828033dba4fb7db746703
Remove python packages from Automation account
azureautomation/runbooks
Utility/Python/remove_python2package.py
Utility/Python/remove_python2package.py
#!/usr/bin/env python2 """ Imports python packages from pypi.org This Azure Automation runbook runs in Azure to remove a package from Azure Automation. It requires the subscription id, resource group of the Automation account, Automation name, and package name as arguments. Passing in * for the package name will remov...
mit
Python
55773676c790ca2f5322eef3cf31151bd8bc8697
Move KT and hilbert to separate file.
BBN-Q/Auspex,BBN-Q/Auspex,BBN-Q/Auspex,BBN-Q/Auspex
src/auspex/analysis/signal_analysis.py
src/auspex/analysis/signal_analysis.py
# Copyright 2019 Raytheon BBN Technologies # # 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 import numpy as np from numpy.fft import fft from...
apache-2.0
Python
7cefea9b288b777395d7de0d9674be161a49e1e6
add upgrade script
ClinGen/clincoded,ClinGen/clincoded,ClinGen/clincoded,ClinGen/clincoded,ClinGen/clincoded
src/clincoded/upgrade/computational.py
src/clincoded/upgrade/computational.py
from contentbase.upgrader import upgrade_step # for use in computational_1_2 step # converts value to to float or int based on presence of decimal def cast_to_intfloat(value): if '.' in str(value): return float(value) else: return int(value) @upgrade_step('computational', '1', '2') def compu...
mit
Python
e9e7622cf43de2552e107477746e58fc58160f2f
Create test_if_food.py
schollz/extract_recipe,schollz/extract_recipe,schollz/extract_recipe,schollz/extract_recipe
test_if_food.py
test_if_food.py
from nltk.corpus import wordnet import sys synsets = wordnet.synsets(sys.argv[1]) for synset in synsets: print "-" * 10 print "Name:", synset.name print "Lexical Type:", synset.lexname print "Lemmas:", synset.lemma_names print "Definition:", synset.definition for example in synset.examples: print "Exa...
apache-2.0
Python
f40ea2940e8927ea31847b1d66a119d98dc9c642
add a converter to the CSV format for everypolitician.org
alizizohaker/congress-legislators,unitedstates/congress-legislators,alizizohaker/congress-legislators,iamLucia/congress-legislators,mrumsky/congress-legislators,YOTOV-LIMITED/congress-legislators,hugovk/congress-legislators,Ukazziha/congress-legislators,Ukazziha/congress-legislators,iamLucia/congress-legislators,YOTOV-...
scripts/everypolitician.py
scripts/everypolitician.py
# Converts our data into CSV files for everypolitician.org, # one file for the House and one file for the Senate. # # Usage: # python everypolitician.py outputbasename/ # # Which will write: # outputbasename/house.csv # outputbasename/senate.csv import sys, csv from utils import yaml_load, CURRENT_CONGRESS, states d...
cc0-1.0
Python
536363b153affb7985a04d3e72b919ece2ba0a77
add TollModule.py
256481788jianghao/share_test
ToolModule.py
ToolModule.py
import matplotlib.pyplot as plxy class PlotTool: colors = ['red','blue','yellow','green','black'] def plotxy(self,XYs,xlabal='x',ylabal='y',title='(x,y)'): line_count = len(XYs); for i in range(line_count): xy = XYs[i] x = xy[0] y = xy[1] plx...
apache-2.0
Python
210bfb9b0d13bf1356768222a4db38c4a93b0273
Add demo 22
CERN/TIGRE,CERN/TIGRE,CERN/TIGRE,CERN/TIGRE
Python/demos/d22_ListGPUs.py
Python/demos/d22_ListGPUs.py
from tigre.utilities import gpu # List the names of installed GPUs print("Querying installed GPU names") listDeviceNames = gpu.getGpuNames() # noqa: N816 print("\tDeviceCount: {}".format(len(listDeviceNames))) print("\tNames : {}".format(listDeviceNames)) print("===================") # Choose one of them # targ...
bsd-3-clause
Python
da514b74cce0e605e7fb6f98ff2280a1ba87323f
Add script for creating SQA docs in a module
permcody/moose,jessecarterMOOSE/moose,jessecarterMOOSE/moose,jessecarterMOOSE/moose,lindsayad/moose,dschwen/moose,jessecarterMOOSE/moose,sapitts/moose,harterj/moose,laagesen/moose,andrsd/moose,idaholab/moose,bwspenc/moose,lindsayad/moose,harterj/moose,permcody/moose,lindsayad/moose,SudiptaBiswas/moose,harterj/moose,dsc...
scripts/sqa_module_init.py
scripts/sqa_module_init.py
#!/usr/bin/env python from __future__ import print_function import os import shutil import argparse parser = argparse.ArgumentParser(description='Setup SQA documentation for a MOOSE module.') parser.add_argument('module', type=str, help='The module folder name') args = parser.parse_args() folder = args.module title ...
lgpl-2.1
Python
adf7234437c75d1a7c0b121f4b14676356df20e5
Add solution 100. Same Tree.
wangyangkobe/leetcode,wangyangkobe/leetcode,wangyangkobe/leetcode,wangyangkobe/leetcode
100_Same_Tree.py
100_Same_Tree.py
/* * https://leetcode.com/problems/same-tree/ * * Given two binary trees, write a function to check if they are equal or not. * Two binary trees are considered equal if they are structurally identical and the nodes have the same value. * */ # Definition for a binary tree node. # class TreeNode(object): # def...
mit
Python
4424959dd8bef2dfe709319bdf55b860ccc4971e
Add a client test on the users list view
hbuyse/VBTournaments,hbuyse/VBTournaments,hbuyse/VBTournaments
accounts/tests/tests_vbuserlist_page.py
accounts/tests/tests_vbuserlist_page.py
#! /usr/bin/env python __author__ = 'Henri Buyse' import pytest import datetime from django.contrib.auth.handlers.modwsgi import check_password from django.contrib.auth.models import User from django.test import Client from accounts.models import VBUserProfile key_expires = datetime.datetime.strftime(datetime.da...
mit
Python
274464804c069f3b148b35a35e7987e8eb2663bd
Add an __about__.py template
robhudson/warehouse,mattrobenolt/warehouse,mattrobenolt/warehouse,techtonik/warehouse,robhudson/warehouse,mattrobenolt/warehouse,techtonik/warehouse
warehouse/__about__.tmpl.py
warehouse/__about__.tmpl.py
# Copyright 2013 Donald Stufft # # 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, so...
apache-2.0
Python
5a397c27b98d66d2d8399e849cabb6d176267c14
Add hash functionality
kbeckmann/Annalog
hash.py
hash.py
import re import time import hashlib import binascii import collections import sys class Hash(): def __init__(self, mucbot): self.mucbot = mucbot def handle(self, msg): body = "" if msg['body'][:4] == "!md5": param = msg['body'][5:] body = "md5(\"%s\") = %s" % (...
mit
Python
3041dcfd6419da116364bb6843ef2423ba831ccf
Add artstation support
kupiakos/LapisMirror,Shugabuga/LapisMirror
plugins/artstation.py
plugins/artstation.py
# The MIT License (MIT) # Copyright (c) 2015 kupiakos # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, me...
mit
Python
72ca20f34b9ef70cee930271fa698de187f97857
Add example for simple table within a flask app
plumdog/flask_table,plumdog/flask_table,plumdog/flask_table
examples/simple_app.py
examples/simple_app.py
from flask_table import Table, Col, LinkCol from flask import Flask """A example for creating a simple table within a working Flask app. Our table has just two columns, one of which shows the name and is a link to the item's page. The other shows the description. """ app = Flask(__name__) class ItemTable(Table): ...
bsd-3-clause
Python
ffdf4524b348f9db35e7e1f9f00b9c633781e049
add assignment
ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study
compiler/eLisp/eLisp/expr/assignment.py
compiler/eLisp/eLisp/expr/assignment.py
#!/usr/bin/env python # -*- encoding: utf-8 -*- # # Copyright (c) 2015 ASMlover. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyrig...
bsd-2-clause
Python
37e08d76ba47c6af4a0aff34816a604266df5058
add hamtor main code
locatw/autonek-hamtor
hamtor/hamtor.py
hamtor/hamtor.py
#! /usr/bin/env python import httplib import json import os import time import urllib import wiringpi2 class Config(object): def __init__(self, filepath): self._filepath = filepath self.light_switch_server = None self._load() def _load(self): f = open(self._filepath, 'r') ...
mit
Python
a38c4a42dfccefecda22d28c88266bcfde9aca28
Create index-loc-authors.py
freme-project/freme-ner,freme-project/freme-ner,freme-project/freme-ner
index-loc-authors.py
index-loc-authors.py
import requests, sys firstDone = False headers = { 'X-Auth-Token': 'YOUR TOKEN HERE', 'Content-Type': 'text/n3' } payload = "" count = 1 for line in sys.stdin: if count % 10000 == 0: if firstDone: r = requests.put("http://api-dev.freme-project.eu/current/e-entity/freme-ner/datasets/loc-authors?infor...
apache-2.0
Python
1e5ac4ee608ec4bd8261dd66ce37012b7eb34d42
Add missing file.
ProjetPP/PPP-Logger,ProjetPP/PPP-Logger
tests/test_logging.py
tests/test_logging.py
"""Test HTTP capabilities of the logger.""" import json import sqlite3 from ppp_logger.logger import make_responses_forest, freeze from ppp_logger.tests import PPPLoggerTestCase R = lambda x:{'type': 'resource', 'value': x} def to_trace(x): # Copy object and remove trace y = x.copy() # Shallow copy y['module...
mit
Python
d8df985f4d5009e8b3fd2f7c0cc818ded909258f
Create is_a_number_prime.py
Kunalpod/codewars,Kunalpod/codewars
is_a_number_prime.py
is_a_number_prime.py
#Kunal Gautam #Codewars : @Kunalpod #Problem name: Is a number prime? #Problem level: 6 kyu from math import sqrt def is_prime(num): if num==0 or abs(num)==1: return False for i in range(2,int(sqrt(num))+1): if num%i==0: return False return True
mit
Python
6219b28be6737844141e2817c86adb67d9fb75d7
add test for Updater
dataversioncontrol/dvc,dmpetrov/dataversioncontrol,efiop/dvc,efiop/dvc,dmpetrov/dataversioncontrol,dataversioncontrol/dvc
tests/test_updater.py
tests/test_updater.py
import os from dvc.updater import Updater from tests.basic_env import TestDvc class TestDvcUpdater(TestDvc): def test(self): # NOTE: need to temporarily unset CI env to allow updater to work env = os.environ.copy() os.environ['CI'] = 'False' self.dvc.updater.check() self...
apache-2.0
Python
e7974b2593cf6ee5796751c28262e1ca4262aa66
Create RespostaCadastrar.py
AEDA-Solutions/matweb,AEDA-Solutions/matweb,AEDA-Solutions/matweb,AEDA-Solutions/matweb,AEDA-Solutions/matweb
backend/Models/Sala/RespostaCadastrar.py
backend/Models/Sala/RespostaCadastrar.py
from Framework.Resposta import Resposta from Models.Sala.Sala import Sala as ModelSala class RespostaCadastrar(Resposta): def __init__(self,sala): self.corpo = ModelSala(sala)
mit
Python
97ce2291151bcee09ee638f681b16b85aabd2d20
add geo info
cloudaice/simple-data,cloudaice/simple-data,cloudaice/simple-data
libs/geo.py
libs/geo.py
#-*-coding: utf-8-*- from tornado.httpclient import AsyncHTTPClient, HTTPError from tornado.options import options import workers from tornado import gen from tornado import escape AsyncHTTPClient.configure("tornado.curl_httpclient.CurlAsyncHTTPClient") @gen.coroutine def GeoFetch(keyword): client = AsyncHTTPC...
mit
Python
382b39ff705fd40d9f2faf1a17450d6118949f7d
add annotation function
COL-IU/XLSearch
annotation.py
annotation.py
""" Small demonstration of the hlines and vlines plots. """ import matplotlib.pyplot as plt import matplotlib.text import numpy as np from os.path import basename from io import StringIO from sys import argv file = argv[1] base = basename(file) seqs = base.split('_') mz = {'alpha':[],'beta':[],'q':[]} intensity = {'a...
mit
Python
944c139833c8245982760049f0cdddf1215963e5
Add pwnchecker module
L1ghtn1ng/usaf,L1ghtn1ng/usaf
modules/pwnchecker.py
modules/pwnchecker.py
#!/usr/bin/python3 import requests import pprint import argparse parser = argparse.ArgumentParser(description='A tool to check if your email account has been in a breach By Jay Townsend') parser.add_argument('-e', '--email-account', help='Email account to lookup', required=True) args = parser.parse_args() headers = ...
bsd-3-clause
Python
91bc6a57893e982553f2fc480a451664553798c5
Fix comment notification downgrade migration
NejcZupec/ggrc-core,edofic/ggrc-core,josthkko/ggrc-core,kr41/ggrc-core,prasannav7/ggrc-core,NejcZupec/ggrc-core,NejcZupec/ggrc-core,plamut/ggrc-core,kr41/ggrc-core,andrei-karalionak/ggrc-core,kr41/ggrc-core,prasannav7/ggrc-core,AleksNeStu/ggrc-core,AleksNeStu/ggrc-core,josthkko/ggrc-core,josthkko/ggrc-core,AleksNeStu/g...
src/ggrc/migrations/versions/20160321011353_3914dbf78dc1_add_comment_notification_type.py
src/ggrc/migrations/versions/20160321011353_3914dbf78dc1_add_comment_notification_type.py
# Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: miha@reciprocitylabs.com # Maintained By: miha@reciprocitylabs.com """ Add comment notification type Create Date: 2016-03-21 01:13:53.293580 """ #...
# Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: miha@reciprocitylabs.com # Maintained By: miha@reciprocitylabs.com """ Add comment notification type Create Date: 2016-03-21 01:13:53.293580 """ #...
apache-2.0
Python
33b0f294efd497ffbb8225b5e8f119265db1cd75
Fix nodes loading
TheKysek/MiNode,TheKysek/MiNode
src/main.py
src/main.py
# -*- coding: utf-8 -*- import csv import logging import os import pickle import socket from advertiser import Advertiser from manager import Manager from listener import Listener import shared def main(): logging.basicConfig(level=shared.log_level, format='[%(asctime)s] [%(levelname)s] %(message)s') logging...
# -*- coding: utf-8 -*- import csv import logging import os import pickle import socket from advertiser import Advertiser from manager import Manager from listener import Listener import shared def main(): logging.basicConfig(level=shared.log_level, format='[%(asctime)s] [%(levelname)s] %(message)s') logging...
mit
Python
4364eadd9d775e262b00e4b7b1fa8171b3726e30
Add grab.work.make_work utility which allows to run execute tasks in limited set of concurrent threads
maurobaraldi/grab,codevlabs/grab,kevinlondon/grab,huiyi1990/grab,istinspring/grab,DDShadoww/grab,DDShadoww/grab,subeax/grab,SpaceAppsXploration/grab,raybuhr/grab,SpaceAppsXploration/grab,kevinlondon/grab,pombredanne/grab-1,giserh/grab,alihalabyah/grab,lorien/grab,giserh/grab,subeax/grab,codevlabs/grab,liorvh/grab,istin...
grab/work.py
grab/work.py
from threading import Thread, currentThread import time from Queue import Queue, Empty import logging STOP = object() class Worker(Thread): def __init__(self, callback, taskq, resultq, ignore_exceptions, *args, **kwargs): self.callback = callback self.taskq = taskq self.resultq = resultq ...
mit
Python
b7111a30ed5864d352ab6ba7df046ceda7e9c96a
Implementa metaclasse Singleton
amdowell/python-brasil-2016
samples/rabbitmq/singleton.py
samples/rabbitmq/singleton.py
# encoding: utf-8 class Singleton(type): _instances = {} def __call__(cls, *args, **kwargs): if cls not in cls._instances: cls._instances[cls] = super( Singleton, cls).__call__(*args, **kwargs) return cls._instances[cls]
mit
Python
805e487207d77846adc9a35aa30d9766a8e77dc4
add tests
faph/MRU,faph/MRU
mru/tests/test_mru.py
mru/tests/test_mru.py
import unittest import mru import os import appdirs import tempfile from unittest.mock import MagicMock class TestMRU(unittest.TestCase): APP = 'testapp' ORG = 'testorg' @classmethod def setUpClass(cls): cls.temp_folder = tempfile.TemporaryDirectory() print("Testing in folder {.name}....
mit
Python
90c4c7258ebe54b69d0ef4bdee3999d826e9aca7
add file to create file
marc-moreaux/text_classification
rewriteFile.py
rewriteFile.py
import csv train = '/media/marc/MYLINUXLIVE/data/train.csv' # path to training file train_valid = '/media/marc/MYLINUXLIVE/data/train_valid.csv' train_test = '/media/marc/MYLINUXLIVE/data/train_test.csv' label = '/media/marc/MYLINUXLIVE/data/trainLabels.csv' # path to label file of training data label...
mit
Python
0f91b22ef846a7918d1d304d575d10f80f114262
Create pyez_update_prefix-list.py
sshutdownow/junos-pyez-prefix-list
pyez_update_prefix-list.py
pyez_update_prefix-list.py
#!/usr/bin/env python from jinja2 import Template from jnpr.junos import Device from jnpr.junos.utils.config import Config from jnpr.junos.exception import * from jnpr.junos.op.routes import RouteTable import yaml # prepare the Jinja2-template pl_template = Template(''' policy-options { replace: prefix-list {...
apache-2.0
Python
ae0ae736244b15653a78a36774093aaa43484192
Convert subSuperGaussPlot to python (#491)
probml/pyprobml,probml/pyprobml,probml/pyprobml,probml/pyprobml
scripts/sub_super_gaussian.py
scripts/sub_super_gaussian.py
import pyprobml_utils as pml import numpy as np from scipy.stats import uniform, laplace, norm import matplotlib.pyplot as plt n = 2000 x = np.arange(-4, 4, 0.01) y1 = norm.pdf(x, 0, 1) y2 = uniform.pdf(x, -2, 4) y3 = laplace.pdf(x, 0, 1) plt.plot(x, y1, color='blue') plt.plot(x, y2, color='green') plt.plot(x, y3, co...
mit
Python
b7801a1347654dcb204cb4387d849a529d64bd2b
Add milipede program
moul/millipede-python,EasonYi/millipede-python,getmillipede/millipede-python,getmillipede/millipede-python,evadot/millipede-python,EasonYi/millipede-python,moul/millipede-python,evadot/millipede-python
milipede.py
milipede.py
#!/usr/bin/env python3 import argparse parser = argparse.ArgumentParser(description='Millipede generator') parser.add_argument('size', metavar='s', type=int, help='the size of the millipede') parser.add_argument('comment', metavar='c', type=str, help='the comment', nargs="?") args = parser.parse_args() if args.comme...
bsd-3-clause
Python
b77b284c1ecbd599fec218d10068e419e0070994
Add Roman To Integer solution
chancyWu/leetcode
src/roman_to_integer.py
src/roman_to_integer.py
class Solution(object): def romanToInt(self, s): """ :type s: str :rtype: int """ if not s: return 0 amount = 0 for i, c in enumerate(s): cur = self.romanTable(c) if i < len(s)-1: nex = self.romanTable(s[i+1]...
mit
Python
474cb25b8fe1bff301f66df70cb4e63c660cf4b2
Create neo_conn.py
Senmumu/usual_script_template
neo_conn.py
neo_conn.py
# coding:utf-8 """connect neo4j""" from py2neo import Graph, Node, Relationship import settings from pandas import DataFrame class NeoConn(object): """Connect neo4j""" def __init__(self): self._graph = Graph(host=settings.NEO4J_HOST, http_port=settings.NEO4J_PORT, user=set...
mit
Python
67a0ad1855493d7cc6b6f8693d1b094f29a2c189
Create dpof_photo_move.py
trolleway/dpof_photo_move
dpof_photo_move.py
dpof_photo_move.py
#Move your photos in two folders by DPOF file. #Usage: Copy photos from camera and /MICS/AUTPRINT.MRK file and this python file in one folder. Then python dpof_photo_move.py import os import fileinput import re import shutil AUTPRINT_PATH='' filelist=[] AUTPRINT = open( AUTPRINT_PATH+'AUTPRINT.MRK', 'r' ) for line i...
cc0-1.0
Python
165ba7bc5b004d3ab49f17a69f4d34c024553f54
Remove call to undefined install.post_process()
JioCloud/python-cinderclient,scottdangelo/cinderclient-api-microversions,eayunstack/python-cinderclient,JioCloud/python-cinderclient,scottdangelo/cinderclient-api-microversions,varunarya10/python-cinderclient,swamireddy/python-cinderclient,swamireddy/python-cinderclient,metacloud/python-cinderclient,eayunstack/python-c...
tools/install_venv.py
tools/install_venv.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 OpenStack Foundation # Copyright 2013 IBM Corp. # Copyright (c) 2013 Hewlett-Packard Development Co...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2010 OpenStack Foundation # Copyright 2013 IBM Corp. # Copyright (c) 2013 Hewlett-Packard Development Co...
apache-2.0
Python
81a4b898914106c17976793867c38b9435def9a5
add n queens
luozhaoyu/leetcode,luozhaoyu/leetcode
n_queens.py
n_queens.py
import copy class Board(object): def __init__(self, horizontal, vertical, left_oblique, right_oblique, queens, n): self.horizontal = horizontal self.vertical = vertical self.left_oblique = left_oblique self.right_oblique = right_oblique self.queens = queens self.n = ...
mit
Python
97bd8c469669d57905e3b58bdb29b869cd76fc11
Solve Knowit2017/dec16
matslindh/codingchallenges,matslindh/codingchallenges
knowit2017/16.py
knowit2017/16.py
visitors = [int(x) for x in open("prisoners.txt").readlines()] has_visited = {} lamp = False c = 0 visits = 0 for visitor in visitors: visits += 1 if visitor in has_visited: continue if visitor == 1: if lamp: lamp = False c += 1 if c == 99: break elif lamp is False: lamp = True has_visited[vi...
mit
Python
e94097e232ae6f40ae56649c6aa28cfbbd4e5c15
Add start of legislator tests, closes #76
jamesturk/tot,jamesturk/tot,jamesturk/tot,jamesturk/tot,jamesturk/tot
legislators/tests.py
legislators/tests.py
from django.test import override_settings from django.contrib.auth.models import User from django.core.urlresolvers import reverse from django.contrib.staticfiles.testing import StaticLiveServerTestCase from preferences.models import Preferences @override_settings(STATICFILES_STORAGE='django.contrib.staticfiles.stor...
mit
Python
3f2d03cab855f3c3684513edca04014383aec9da
Create blockchain.py
bluewitch/Code-Blue-Python
blockchain.py
blockchain.py
# blockchain.py # Demonstration of a blockchain; 3 of 3 components import time from . import block from . import block_params class BlockChain(): def __init__(self): self.blockchain_store = self.fetch_blockchain() def latest_block(self): return self.blockchain_store[-1] def generate_ne...
mit
Python
be0d2c564a4f22b53f8efba9b3498ae84c5f86bf
Create SummaryRanges.py
lingcheng99/LeetCode
SummaryRanges.py
SummaryRanges.py
""" Given a sorted integer array without duplicates, return the summary of its ranges. For example, given [0,1,2,4,5,7], return ["0->2","4->5","7"]. """ class Solution(object): def summaryRanges(self, nums): """ :type nums: List[int] :rtype: List[str] """ if len(nums)==1: ...
mit
Python
6a8ce237beecf07f16568f455cacfb9db0ccff42
Add an easy way to activate virtualenvs
prabhuramachandran/pymetabiosis,rguillebert/pymetabiosis
pymetabiosis/utils.py
pymetabiosis/utils.py
from pymetabiosis import import_module builtin = import_module("__builtin__") def activate_virtualenv(path): builtin.execfile(path, {"__file__" : path})
mit
Python
d7f8c28613790b622ab52f108e1a2302b0ba958c
Add rust lint
maralla/vim-fixup,maralla/vim-fixup,maralla/vim-linter,maralla/vim-linter,maralla/validator.vim
pythonx/lints/rust.py
pythonx/lints/rust.py
#! /usr/bin/env python from __future__ import absolute_import import json import re import os import logging from validator import Validator from validator.utils import find_file PAT = re.compile('\s+-->\s(?P<fname>.*?):(?P<lnum>\d+):(?P<col>\d+)') logger = logging.getLogger('validator') class Cargo(Validator): ...
mit
Python