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 |
|---|---|---|---|---|---|---|---|---|
8c297e4403e840022b8b0db65dc098858acf27d7 | refactor by removing duplication. | pheanex/xpython,smalley/python,exercism/xpython,jmluy/xpython,outkaj/xpython,orozcoadrian/xpython,smalley/python,rootulp/xpython,mweb/python,exercism/python,N-Parsons/exercism-python,mweb/python,jmluy/xpython,outkaj/xpython,oalbe/xpython,N-Parsons/exercism-python,rootulp/xpython,behrtam/xpython,pheanex/xpython,behrtam/... | nucleotide-count/example.py | nucleotide-count/example.py | NUCLEOTIDES = 'ATCG'
def count(strand, abbreviation):
_validate(abbreviation)
return strand.count(abbreviation)
def nucleotide_counts(strand):
return {
abbr: strand.count(abbr)
for abbr in NUCLEOTIDES
}
def _validate(abbreviation):
if abbreviation not in NUCLEOTIDES:
ra... | NUCLEOTIDES = 'ATCGU'
def count(strand, abbreviation):
_validate(abbreviation)
return strand.count(abbreviation)
def nucleotide_counts(strand):
return {
abbr: strand.count(abbr)
for abbr in 'ATGC'
}
def _validate(abbreviation):
if abbreviation not in NUCLEOTIDES:
raise ... | mit | Python |
6bf04c596670bcb7b00c79f9b8f42c9fcd37cc76 | Create hourly_entries.py | disfear86/Data-Analysis | Udacity_Data_Analysis/hourly_entries.py | Udacity_Data_Analysis/hourly_entries.py | import pandas as pd
# Cumulative entries and exits for one station for a few hours.
entries_and_exits = pd.DataFrame({
'ENTRIESn': [3144312, 3144335, 3144353, 3144424, 3144594,
3144808, 3144895, 3144905, 3144941, 3145094],
'EXITSn': [1088151, 1088159, 1088177, 1088231, 1088275,
... | mit | Python | |
6475560c20cc53e8877f246b075a7e432271f694 | Create auth.py | alexiskulash/ia-caucus-sentiment | src/auth.py | src/auth.py | class TwitterAuth:
consumer_key="#"
consumer_secret="#"
access_token="#"
access_token_secret="#"
| mit | Python | |
55689cc63b321803e33da2029f2a1d34467d435d | Add migration | softwaresaved/fat,softwaresaved/fat,softwaresaved/fat,softwaresaved/fat | fellowms/migrations/0052_merge.py | fellowms/migrations/0052_merge.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-08-04 14:37
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('fellowms', '0051_event_required_blog_posts'),
('fellowms', '0051_auto_20160804_1425'),
]
... | bsd-3-clause | Python | |
c0b37b879b2e20ee71663e64be76ad11c1e1794c | Add a script that can be used to compare asyncio.sleep to time.sleep | showa-yojyo/bin,showa-yojyo/bin | async/3.7/basic/compsleep.py | async/3.7/basic/compsleep.py | #!/usr/bin/env python
"""https://docs.python.org/3.7/library/asyncio-task.html 変奏版
Features:
- asyncio.gather()
- asyncio.sleep()
- asyncio.run()
"""
import asyncio
import logging
import time
concurrent = 3
delay = 5
# PYTHONASYNCIODEBUG=1
logging.basicConfig(level=logging.DEBUG)
async def async_pause():
awai... | mit | Python | |
1128ed88d9e92f76629dc7b9881e92ea89024a6b | add one python file | DivadOEC/HStudyDocs | pyStudy/Investment.py | pyStudy/Investment.py | # encoding: utf-8
import datetime,time;
INVS_REPAY_BY_MONTH = 1
INVS_REPAY_BY_DAYS = 2
class RepayMent(object):
def __init__(self,repayDate,repayTerm,repayAmout)
self.repayDate = repayDate
self.repayTerm = repayTerm # when INVS_REPAY_BY_MONTH,set -1
self.repayAmout = repayAmout
class Investment(object... | mit | Python | |
505ee67af2a3c8a9c8725d7506725c3109a0891d | add drivetimer | tigfox/legendary-sniffle | drivetimer/scratch.py | drivetimer/scratch.py | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import requests
stockSymbol = 'NASDAQ:ETSY' #string as MARKET:STOCK see alphavantage API guide for details
alphaVantageAPI = '3R81P8I8EK4HV3ES' #alphavantage API key
#======================================================================... | mit | Python | |
e6dff5f5eac3e5ce93ed925374a27abe53eeb1a7 | Add dictlike: dictionary like object for JSON wrappers | bwesterb/sarah | src/dictlike.py | src/dictlike.py | class DictLike(object):
""" Base class for a dictionary based object.
Think about wrappers around JSON data. """
def __init__(self, data):
object.__setattr__(self, '_data', data)
def __getattr__(self, name):
try:
return self._data[name]
except KeyError:
raise AttributeError
def __setattr__(self, na... | agpl-3.0 | Python | |
cad2f9363e30f13c5f10f56c8cf5d0824c1223ac | Add tests for source to sink simulation, which was originally developed in cycamore repository | gidden/cyclus,rwcarlsen/cyclus,hodger/cyclus,gidden/cyclus,hodger/cyclus,gidden/cyclus,rwcarlsen/cyclus,Baaaaam/cyclus,hodger/cyclus,rwcarlsen/cyclus,mbmcgarry/cyclus,rwcarlsen/cyclus,mbmcgarry/cyclus,mbmcgarry/cyclus,Baaaaam/cyclus,gidden/cyclus,mbmcgarry/cyclus,hodger/cyclus,hodger/cyclus,Baaaaam/cyclus | integration_tests/test_source_to_sink.py | integration_tests/test_source_to_sink.py | #! /usr/bin/python
from nose.tools import assert_equal, assert_true
from numpy.testing import assert_array_equal
import os
import tables
import numpy as np
from tools import check_cmd
""" Tests """
def test_source_to_sink():
""" Tests linear growth of sink inventory """
#Cyclus simulation input for source_to_... | bsd-3-clause | Python | |
eaf5d72ed584e67619100bb7cdb7deebd9506614 | Add `appengine_config.py` | LuizGsa21/p4-conference-central,LuizGsa21/p4-conference-central,LuizGsa21/p4-conference-central | appengine_config.py | appengine_config.py |
def webapp_add_wsgi_middleware(app):
"""" Wrap WSGI application with the appstats middleware. """
from google.appengine.ext.appstats import recording
return recording.appstats_wsgi_middleware(app)
| apache-2.0 | Python | |
ee1df360979ec24fd8233210372eedd3071cee87 | Add test file to check consistent use of default arguments | mgeier/PySoundFile | tests/test_argspec.py | tests/test_argspec.py | """Make sure that arguments of open/read/write don't diverge"""
import pysoundfile as sf
from inspect import getargspec
open = getargspec(sf.open)
init = getargspec(sf.SoundFile.__init__)
read_function = getargspec(sf.read)
read_method = getargspec(sf.SoundFile.read)
write_function = getargspec(sf.write)
def defau... | bsd-3-clause | Python | |
2b99781e67e1e2e0bb3863c08e81b3cf57a5e296 | Add request bouncer test cases | menecio/django-api-bouncer | tests/test_bouncer.py | tests/test_bouncer.py | from rest_framework import status
from rest_framework.test import APITestCase
from django.contrib.auth import get_user_model
from api_bouncer.models import Api
User = get_user_model()
class BouncerTests(APITestCase):
def setUp(self):
self.superuser = User.objects.create_superuser(
'john',
... | apache-2.0 | Python | |
57378cdd87ec76751b7ad6b03fe3e46bad9b29e5 | add process test | ccbrown/needy,bittorrent/needy,bittorrent/needy,vmrob/needy,vmrob/needy,ccbrown/needy | tests/test_process.py | tests/test_process.py | import unittest
import needy.process
class ProcessTest(unittest.TestCase):
def test_list_command_output(self):
self.assertEqual('hello', needy.process.command_output(['printf', 'hello']))
def test_shell_command_output(self):
self.assertEqual('hello', needy.process.command_output('printf `pr... | mit | Python | |
fa176de3145c1b98e31cb210c82b7367842b9b6b | add test_regular.py | rainwoodman/mpi4py_test,nickhand/runtests,nickhand/runtests,rainwoodman/runtests,rainwoodman/runtests,rainwoodman/mpi4py_test | tests/test_regular.py | tests/test_regular.py |
def test_regular():
return 0
| bsd-2-clause | Python | |
28345a0ecb92ef8e7d45fa27d082e21cc1bdd8cd | Add python solution | PlattsSEC/HackerRank,PlattsSEC/HackerRank,PlattsSEC/HackerRank,PlattsSEC/HackerRank,PlattsSEC/HackerRank,PlattsSEC/HackerRank | weighted_uniform_strings/prithaj.py | weighted_uniform_strings/prithaj.py | #!/bin/python
import sys
import string
weights = {string.lowercase[i]:i+1 for i in xrange(len(string.lowercase))}
def return_weights(a):
my_weights, prev, count = set(), '', 1
for i in a:
if i != prev:
prev = i
count = 1
else:
count +=1
my_weights.a... | mit | Python | |
ab1bc996d477c84187df381ec77e7aaab299783b | Add test for calc_md5() function | bpipat/mws,jameshiew/mws,Bobspadger/python-amazon-mws,GriceTurrble/python-amazon-mws | tests/test_utils.py | tests/test_utils.py | from mws.mws import calc_md5
def test_calc_md5():
assert calc_md5(b'mws') == b'mA5nPbh1CSx9M3dbkr3Cyg=='
| unlicense | Python | |
048a9adbe15201ad0011776587e167725b12f624 | Add script copy_dotfiles_to_repo.py | akselsjogren/dotfiles,akselsjogren/dotfiles,akselsjogren/dotfiles | bin/copy_dotfiles_to_repo.py | bin/copy_dotfiles_to_repo.py | #!/usr/bin/env python2
# coding: utf-8
"""
Copy the dotfiles that dotbot control from home directory to repository.
This is used on Windows/msys2, where symlinks aren't supported and I want to
check in possibly local edits to the repository.
"""
from __future__ import absolute_import, print_function, unicode_literals
... | unlicense | Python | |
4ed3a5600222756fce826dbe9fb409730b0174e7 | Add init.py | vivangkumar/uberpy | uber-py/__init__.py | uber-py/__init__.py | __author__ = 'Vivan'
__version__ = '1.0.0'
'''
Specify modules to be imported.
'''
import json
try:
import httplib2
except ImportError:
print "Please ensure that the httplib2 package is installed."
| mit | Python | |
f4462b621b42ae73c9f7853b7e2dac5b730f07d3 | Implement SimProcedure rewind() | f-prettyland/angr,chubbymaggie/simuvex,tyb0807/angr,axt/angr,iamahuman/angr,axt/angr,chubbymaggie/angr,angr/simuvex,schieb/angr,angr/angr,chubbymaggie/angr,tyb0807/angr,chubbymaggie/simuvex,axt/angr,tyb0807/angr,angr/angr,f-prettyland/angr,iamahuman/angr,schieb/angr,schieb/angr,chubbymaggie/simuvex,chubbymaggie/angr,an... | simuvex/procedures/libc___so___6/rewind.py | simuvex/procedures/libc___so___6/rewind.py | import simuvex
from . import _IO_FILE
######################################
# rewind
######################################
class rewind(simuvex.SimProcedure):
#pylint:disable=arguments-differ
def run(self, file_ptr):
fseek = simuvex.SimProcedures['libc.so.6']['fseek']
self.inline_call(fsee... | bsd-2-clause | Python | |
9adcdf5f6ba9a57bf651c5a1845ea64711b5e4a2 | add tests for create_image function | kaiCu/mapproxy,vrsource/mapproxy,camptocamp/mapproxy,geoadmin/mapproxy,procrastinatio/mapproxy,Anderson0026/mapproxy,geoadmin/mapproxy,camptocamp/mapproxy,drnextgis/mapproxy,mapproxy/mapproxy,faegi/mapproxy,olt/mapproxy,procrastinatio/mapproxy,drnextgis/mapproxy,olt/mapproxy,vrsource/mapproxy,faegi/mapproxy,mapproxy/ma... | mapproxy/test/unit/test_image_options.py | mapproxy/test/unit/test_image_options.py | # This file is part of the MapProxy project.
# Copyright (C) 2011 Omniscale <http://omniscale.de>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# ... | apache-2.0 | Python | |
f43a7dbce4e78bd658b01652c63d852aea5fed0e | add copyFilesFromList.py script | CarnegieHall/quality-control,CarnegieHall/quality-control | copyFilesFromList.py | copyFilesFromList.py | # !/usr/local/bin/python3.4.2
# ----Copyright (c) 2016 Carnegie Hall | The MIT License (MIT)----
# ----For the full license terms, please visit https://github.com/CarnegieHall/quality-control/blob/master/LICENSE----
# argument 0 is the script name
# argument 1 is the path to the grandparent directory of all assets
# ar... | mit | Python | |
20c5dee179bcb4a6b153bad04fb400cf16e5e01b | Test for basefixture | Peter-Slump/django-dynamic-fixtures,Peter-Slump/django-factory-boy-fixtures | tests/fixtures/test_basefixture.py | tests/fixtures/test_basefixture.py | from unittest import TestCase
from dynamic_fixtures.fixtures.basefixture import BaseFixture
class BaseFixtureTestCase(TestCase):
def test_load_not_implemented(self):
"""
Case: load is not implemented
Expected: Error get raised
"""
fixture = BaseFixture('Name', 'Module')
... | mit | Python | |
777ddec03e59ceace746dca4e73d39c71400d10e | Initialize P03_combinePdfs | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | books/AutomateTheBoringStuffWithPython/Chapter13/P03_combinePdfs.py | books/AutomateTheBoringStuffWithPython/Chapter13/P03_combinePdfs.py | #! python3
# combinePdfs.py - Combines all the PDFs in the current working directory into
# a single PDF.
import PyPDF4, os
# Get all the PDF filenames.
pdfFiles = []
for filename in os.listdir('.'):
if filename.endswith(".pdf"):
pdfFiles.append(filename)
pdfFiles.sort(key = str.lower)
pdfWriter = PyPDF4... | mit | Python | |
4c473b54ba64e642efb454a309d2027cd902cc17 | add __init__.py | aterrel/blaze,jcrist/blaze,mrocklin/blaze,dwillmer/blaze,ChinaQuants/blaze,cowlicks/blaze,xlhtc007/blaze,maxalbert/blaze,caseyclements/blaze,cpcloud/blaze,cowlicks/blaze,ChinaQuants/blaze,nkhuyu/blaze,LiaoPan/blaze,scls19fr/blaze,cpcloud/blaze,aterrel/blaze,LiaoPan/blaze,maxalbert/blaze,nkhuyu/blaze,scls19fr/blaze,xlht... | blaze/data/__init__.py | blaze/data/__init__.py | from __future__ import absolute_import, division, print_function
from .core import *
from .csv import *
from .sql import *
from .json import *
from .hdf5 import *
from .filesystem import *
from .usability import *
| bsd-3-clause | Python | |
60b629907fe3e880a47825886858c723e41248a5 | add a small script for dumping investigation/incident tags from mozdef | ameihm0912/vmintgr,ameihm0912/vmintgr | misc/mozdef/incinv.py | misc/mozdef/incinv.py | #!/usr/bin/python
import sys
import getopt
from datetime import datetime
from pymongo import MongoClient
import pytz
mclient = None
incident_tagcnt = {}
inves_tagcnt = {}
def tag_summary():
sys.stdout.write('######## tag summary (incidents) ########\n')
for x in incident_tagcnt:
sys.stdout.write('{}... | mpl-2.0 | Python | |
15ccb7ab2b5d51d69c77fc84f4efc634a82a4b18 | Create add_P68wp_P70moe.py | Xi-Plus/Xiplus-Wikipedia-Bot,Xi-Plus/Xiplus-Wikipedia-Bot | my-ACG/import-claims/add_P68wp_P70moe.py | my-ACG/import-claims/add_P68wp_P70moe.py | # -*- coding: utf-8 -*-
import argparse
import json
import os
os.environ['PYWIKIBOT_DIR'] = os.path.dirname(os.path.realpath(__file__))
import pywikibot
from pywikibot.data.api import Request
import requests
from config import API, PASSWORD, USER # pylint: disable=E0611
site = pywikibot.Site()
site.login()
datasite... | mit | Python | |
c0cd91fe44a2ff653cad9f15a5363d9cc97bfa75 | Add a snippet. | jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets | python/astropy/fits/write_binary_table.py | python/astropy/fits/write_binary_table.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Documentation:
# - http://docs.astropy.org/en/stable/io/fits/
# - http://docs.astropy.org/en/stable/io/fits/api/files.html
# - http://www.astropy.org/astropy-tutorials/FITS-tables.html
# - http://www.astropy.org/astropy-tutorials/FITS-images.html
# - http://www.astropy.... | mit | Python | |
e2e5f3ced06bc7c4a603ad5ff73e6df8690aaa0f | Add top_wikipedia_pages.py. | jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools | problem/bench/traffic/top_wikipedia_pages.py | problem/bench/traffic/top_wikipedia_pages.py | #! /usr/bin/env python
# Copyright 2020 John Hanley.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, me... | mit | Python | |
2dee387e43c8d57f7b6f9b291260d8f6dda42bd0 | add measure.py again | lohner/FormalSSA,lohner/FormalSSA,lohner/FormalSSA | measure.py | measure.py | #!/usr/bin/env python3
import sys
import collections
import re
times = collections.defaultdict(lambda: 0.0)
phis = collections.defaultdict(lambda: 0)
for line in sys.stdin:
m = re.match(r'(.*) (\d+\.\d+)', line)
if m:
times[m.group(1)] += float(m.group(2))
m = re.match(r'(.*) (\d+)$', line)
i... | bsd-3-clause | Python | |
3d221a09b383f4a71587c165cf85912cabb253e2 | Test script for some failing Dubins 3d paths while planning | fire-rs-laas/fire-rs-saop,fire-rs-laas/fire-rs-saop,fire-rs-laas/fire-rs-saop,fire-rs-laas/fire-rs-saop | python/fire_rs/planning/test_dubins3dpath.py | python/fire_rs/planning/test_dubins3dpath.py | # Copyright (c) 2017, CNRS-LAAS
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the f... | bsd-2-clause | Python | |
ff7f9a09afaf2057d3f926a56c48ad873f6c16f6 | Add missing migration | KlubJagiellonski/pola-backend,KlubJagiellonski/pola-backend,KlubJagiellonski/pola-backend,KlubJagiellonski/pola-backend | report/migrations/0002_auto_20151013_2305.py | report/migrations/0002_auto_20151013_2305.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('report', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='report',
name='product... | bsd-3-clause | Python | |
6449632df519113c143de282df38cda7798807fa | Add autoencoder that contains a Layer. | mdenil/parameter_prediction,mdenil/parameter_prediction,mdenil/parameter_prediction | parameter_prediction/models/autoencoder.py | parameter_prediction/models/autoencoder.py | import numpy as np
import theano.tensor as T
from pylearn2.base import Block
from pylearn2.models import Model
from pylearn2.space import VectorSpace
def _identity(x):
return x
def _rectified(x):
return x * (x > 0)
# Don't put lambda functions in here or pickle will yell at you when you try to
# save an Autoe... | mit | Python | |
b154a5cd852ecf7f1e27f012a4a42c5ede307561 | Create zadanie2.py | krzyszti/my_projects,krzyszti/my_projects,krzyszti/my_projects,krzyszti/my_projects | exercises/zadanie2.py | exercises/zadanie2.py | '''
PODANA JEST LISTA ZAWIERAJĄCA ELEMENTY O WARTOŚCIACH 1-n. NAPISZ FUNKCJĘ KTÓRA SPRAWDZI JAKICH ELEMENTÓW BRAKUJE
1-n = [1,2,3,4,5,...,10]
np. n=10
wejście: [2,3,7,4,9], 10
wyjście: [1,5,6,8,10]
'''
def n(lst, max):
result = []
i = 1
while i<=max:
if (i in lst) == False:
result.appen... | mit | Python | |
c62711b7cc9e921a3c2eb0e04c81e92ed2c82596 | Add python code to verify doublesha256 calculating. | HashRatio/w5500_test,HashRatio/w5500_test,HashRatio/w5500_test,HashRatio/w5500_test,HashRatio/w5500_test,HashRatio/w5500_test | firmware/work_test.py | firmware/work_test.py | import hashlib
import binascii
import string
prev_hash = "4d16b6f85af6e2198f44ae2a6de67f78487ae5611b77c6c0440b921e00000000"
coinbase1 = "01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff20020862062f503253482f04b8864e5008"
coinbase2 = "072f736c7573682f000000000100f2052a010000001976a... | unlicense | Python | |
544907c4222a7c0aead8d35893956ecca79056ba | Add fish-chips example | mstruijs/neural-demos,mstruijs/neural-demos | fish-chips-ketchup.py | fish-chips-ketchup.py | import numpy as np
import random
from neupy import layers, algorithms,plots, init
from neupy.layers.utils import iter_parameters
#Define network.
network = layers.Input(3) > layers.Linear(1,weight=init.Constant(0),bias=None)
#Toggle some debug printing
verbose = True
if verbose:
#show network details
for layer, a... | mit | Python | |
5fccf078c654b69344ded47c2f4c7abddbd52c4d | Add initial profiles | PyCQA/isort,PyCQA/isort | isort/profiles.py | isort/profiles.py | """Common profiles are defined here to be easily used within a project using --profile {name}"""
black = {
"multi_line_output": 3,
"include_trailing_comma": True,
"force_grid_wrap": 0,
"use_parentheses": True,
}
django = {
"combine_as_imports": True,
"include_trailing_comma": True,
"multi_l... | mit | Python | |
a798b23d8dfbf8b415a85a04666466d1605208b5 | add celery app file | praekelt/molo-tuneme,praekelt/molo-tuneme,praekelt/molo-tuneme,praekelt/molo-tuneme | tuneme/celery.py | tuneme/celery.py | from __future__ import absolute_import
import os
from celery import Celery
from django.conf import settings
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE',
'tuneme.settings.production')
app = Celery('proj')
# Using a string he... | bsd-2-clause | Python | |
192012b57cddec724f73f6ab031b13862db134ef | Create twitterstream.py | jigarkb/Twitter-Sentiment-Analysis | twitterstream.py | twitterstream.py | import oauth2 as oauth
import urllib2 as urllib
access_token_key = "105782391-kfbeApbulMptbrV9w6Bfh5MHrAiUUqqmd1xmD2az"
access_token_secret = "fuIwYDPiqTFvfI4jPJVbCWxZBZaL0ESiq4IMD30c1o"
consumer_key = "1ANfOmOIRa4iaJideGYAg"
consumer_secret = "MmrodYL5xcpjFrFcG8Y4CAR5PTYbRXkKWuQgA1bU"
_debug = 0
oauth_token = o... | apache-2.0 | Python | |
7b0e3c030e9cf4b1792218ad555eaeda40432283 | add a parallel version LR's roughly architecture | jasonwbw/ParallelLR | plr/models/parallel_logistic_regression.py | plr/models/parallel_logistic_regression.py | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
This is a mutil-thread tool to solve common regression problem by logistic regression(hereinafter referred to as LR).
"""
from abc import ABCMeta, abstractmethod
from logistic_regression import LogisticRegression
class MatrixSpliter(object):
# TODO: comment
def ... | apache-2.0 | Python | |
f34887b247352d378cb60ceafadec80a17d342f2 | Add LXDDriver config test | tpouyer/nova-lxd,Saviq/nova-compute-lxd,tpouyer/nova-lxd,Saviq/nova-compute-lxd | nclxd/tests/test_driver_api.py | nclxd/tests/test_driver_api.py | # Copyright 2015 Canonical Ltd
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | # Copyright 2015 Canonical Ltd
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | apache-2.0 | Python |
c4eb8c9c7974335cd19f55c2e923a4aac54b3fe2 | add the init file for experiements | okkhoy/minecraft-rl | experiments/__init__.py | experiments/__init__.py | __all__ = ["episodic"]
| mit | Python | |
d7ac57998cde8b3778aa53b6e4a378d67fb5eccf | Create find-links_emails.py | frainfreeze/studying,frainfreeze/studying,frainfreeze/studying,frainfreeze/studying,frainfreeze/studying,frainfreeze/studying,frainfreeze/studying,frainfreeze/studying | python/find-links_emails.py | python/find-links_emails.py | import requests
import re
# get url
url = input('Enter a URL (include `http://`): ')
# connect to the url
website = requests.get(url)
# read html
html = website.text
# use re.findall to grab all the links
links = re.findall('"((http|ftp)s?://.*?)"', html)
emails = re.findall('([\w\.,]+@[\w\.,]+\.\w+)', html)
# pr... | mit | Python | |
b5e4805d07ad524a9d2c452780f5f360a068ce90 | add linked list cycle | SakiFu/leetcode | python/linked_list_cycle.py | python/linked_list_cycle.py | """
Given a linked list, determine if it has a cycle in it.
Follow up:
Can you solve it without using extra space?
"""
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def hasCycle(self, head):
... | mit | Python | |
13b3320399e51bbbb4018ea5fb3ff6d63c8864c7 | Add quick run script for celex fullscale tests | jacobkrantz/ProbSyllabifier | celexRunScript.py | celexRunScript.py | from celex import Celex
'''
- Allows for a quick run of a desired size pulled from any evolution file.
- Automatically loads the best chromosome from the evolution to test.
- Useful for running large-scale tests of a chromosome that appears
to be performing well.
- For small tests to ensure system functionality, run th... | mit | Python | |
26040edd17b7b1eff3317bbc87aa4548fe27aefa | reset random seed before each scenario | mode89/snn,mode89/snn,mode89/snn | features/environment.py | features/environment.py | import random
def before_scenario(context, scenario):
random.seed(0)
| mit | Python | |
ec6d4042f13a641975bbcd2598e76b0cefef0b54 | add extractor.py | edonyM/toolkitem,edonyM/toolkitem,edonyM/toolkitem | fileparser/extractor.py | fileparser/extractor.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
r"""
# .---. .-----------
# / \ __ / ------
# / / \( )/ ----- (`-') _ _(`-') <-. (`-')_
# ////// '\/ ` --- ( OO).-/( (OO ).-> .-> \( OO) ) .->
# //// / // : : --- (,------.... | mit | Python | |
c839d8ce8fb6a1f7c7ab0acc3a8840bb3569d27d | Add merge migration | swcarpentry/amy,pbanaszkiewicz/amy,vahtras/amy,pbanaszkiewicz/amy,swcarpentry/amy,wking/swc-amy,vahtras/amy,shapiromatron/amy,shapiromatron/amy,pbanaszkiewicz/amy,swcarpentry/amy,wking/swc-amy,shapiromatron/amy,vahtras/amy,wking/swc-amy,wking/swc-amy | workshops/migrations/0015_merge.py | workshops/migrations/0015_merge.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('workshops', '0011_person_badges'),
('workshops', '0014_merge'),
]
operations = [
]
| mit | Python | |
aa7f40c4451fa5816d456012aec94dff83b784b0 | Add Actual Converter | SinisterSoda/simpleconverter | flac_to_alac_convert.py | flac_to_alac_convert.py | import os
import subprocess
#this is the default folder it traverses
default = r'C:\Users\Mikey\Music\The_Strokes'
print ("Default Directory is: " + default)
rootdir = input("Input the Directory (Or leave blank for default directory): ")
#this is the directory where ffmpeg is located
ffmpeg = "C:\\Users\\Mik... | mit | Python | |
25a4c9ba978aef7f648904c654fcc044f429acd4 | Add Subjects model, methods for report and export | qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq | custom/openclinica/models.py | custom/openclinica/models.py | from collections import defaultdict
from corehq.apps.users.models import CouchUser
from custom.openclinica.const import AUDIT_LOGS
from custom.openclinica.utils import (
OpenClinicaIntegrationError,
is_item_group_repeating,
is_study_event_repeating,
get_item_measurement_unit,
get_question_item,
... | bsd-3-clause | Python | |
1068a19af6fc6c5ec7be8d59cc4bb1d76eb40bc7 | add homeassistant-entrypoint.py | tonyldo/home-automation-mqtt-hass,tonyldo/home-automation-mqtt-hass | homeassistant-entrypoint.py | homeassistant-entrypoint.py | import os
import argparse
import homeassistant.config as config_util
from homeassistant.const import (
__version__,
EVENT_HOMEASSISTANT_START,
REQUIRED_PYTHON_VER,
RESTART_EXIT_CODE,
)
def get_arguments() -> argparse.Namespace:
"""Get parsed passed in arguments."""
parser = argparse.ArgumentPa... | mit | Python | |
8ed7c6d43bcef1543cd6e85a147051fde29b7580 | Add new language distance logic | LuminosoInsight/langcodes | langcodes/language_distance.py | langcodes/language_distance.py | from .data_dicts import LANGUAGE_DISTANCES
_DISTANCE_CACHE = {}
DEFAULT_LANGUAGE_DISTANCE = LANGUAGE_DISTANCES['*']['*']
DEFAULT_SCRIPT_DISTANCE = LANGUAGE_DISTANCES['*_*']['*_*']
DEFAULT_TERRITORY_DISTANCE = 4
# Territory clusters used in territory matching:
# Maghreb (the western Arab world)
MAGHREB = {'MA', 'DZ'... | mit | Python | |
9d2a2b0e1f066b2606e62ec019b56d4659ed86b1 | Add cluster evaluation: adjusted rand index | studiawan/pygraphc | pygraphc/clustering/ClusterEvaluation.py | pygraphc/clustering/ClusterEvaluation.py | from sklearn import metrics
class ClusterEvaluation(object):
@staticmethod
def get_evaluated(evaluated_file):
with open(evaluated_file, 'r') as ef:
evaluations = ef.readlines()
evaluation_labels = [evaluation.split(';')[0] for evaluation in evaluations]
return evaluation_l... | mit | Python | |
b4b8f3554ae569ed42ba261de89e2d186418e71e | add html helper. | why2pac/dp-tornado,why2pac/dp-tornado,why2pac/dp-tornado,why2pac/dp-tornado | dp_tornado/helper/html.py | dp_tornado/helper/html.py | # -*- coding: utf-8 -*-
from dp_tornado.engine.helper import Helper as dpHelper
try:
# py 2.x
import HTMLParser
html_parser = HTMLParser.HTMLParser()
except:
# py 3.4-
try:
import html.parser
html_parser = html.parser.HTMLParser()
except:
# py 3.4+
import html... | mit | Python | |
f06e5a8c701f06d40597cd268a6739988c2fff56 | Add functions for parsing log file | dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq | corehq/apps/cleanup/tasks.py | corehq/apps/cleanup/tasks.py | import os
from collections import defaultdict
from django.conf import settings
from django.core.management import call_command
from celery.schedules import crontab
from celery.task import periodic_task
from datetime import datetime
from corehq.apps.cleanup.management.commands.fix_xforms_with_undefined_xmlns import \... | bsd-3-clause | Python | |
095b9cc5f2e9a87220e6f40f88bf6ecd598ca681 | Add abstract box for ComponentSearch so users can drag it into their workflows. | CMUSV-VisTrails/WorkflowRecommendation,CMUSV-VisTrails/WorkflowRecommendation,CMUSV-VisTrails/WorkflowRecommendation | vistrails/packages/componentSearch/init.py | vistrails/packages/componentSearch/init.py | #Copied imports from HTTP package init.py file
from PyQt4 import QtGui
from core.modules.vistrails_module import ModuleError
from core.configuration import get_vistrails_persistent_configuration
from gui.utils import show_warning
import core.modules.vistrails_module
import core.modules
import core.modules.basic_modules... | bsd-3-clause | Python | |
c3a9d78ca3ffbad0e11192e896db8cd0c2758154 | UPDATE - add migration file | mingkim/QuesCheetah,mingkim/QuesCheetah,mingkim/QuesCheetah,mingkim/QuesCheetah | vote/migrations/0002_auto_20160315_0006.py | vote/migrations/0002_auto_20160315_0006.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('vote', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='multiquestion',
name='gr... | mit | Python | |
23ad5049477c272ca1666f90e73246c4de8e5c48 | Add utility functions for processing partitioned objects | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/sql_db/util.py | corehq/sql_db/util.py | from corehq.form_processor.backends.sql.dbaccessors import ShardAccessor
from corehq.sql_db.config import partition_config
from django.conf import settings
def get_object_from_partitioned_database(model_class, partition_value, partitioned_field='pk'):
"""
Determines from which database to retrieve a paritione... | bsd-3-clause | Python | |
b073397008a07e50b79c7cf97d91765de3fa4fed | add daemon example | guixing/opstools | library/daemon.py | library/daemon.py |
import time
import os
import sys
def run():
while True:
print '1time'
time.sleep(1)
def daemon():
try:
pid = os.fork()
if pid > 0:
sys.exit(0)
except OSError, e:
print 'fork #1 fail', e
sys.exit(1)
os.chdir('/')
os.setsid()
os.umask(0... | mit | Python | |
c9cc92c47192132926660efb3416349a5f946a89 | Test for ConversationMessage serializer | yunity/foodsaving-backend,yunity/foodsaving-backend,yunity/yunity-core,yunity/foodsaving-backend,yunity/yunity-core | yunity/tests/unit/test__api_serializers.py | yunity/tests/unit/test__api_serializers.py | from yunity.api import serializers
from yunity.models import Conversation as ConversationModel
from yunity.utils.tests.abc import BaseTestCase, AnyResult
class TestSerializers(BaseTestCase):
def test_chat_with_empty_messages_serializable(self):
self.given_data(ConversationModel.objects.create())
sel... | agpl-3.0 | Python | |
bddea45a0ddf4efa911aae8af74fb1c78b91b152 | Create max2.py | HarendraSingh22/Python-Guide-for-Beginners | Code/max2.py | Code/max2.py | #Program to find maximum of 2 numbers
while 1:
n,m=map(int, raw_input())
k = max(m,n)
print k
print "Do you want to continue(yes/no): "
s=raw_input()
if s=="no":
break
| mit | Python | |
25b19d18c75feeb46139898e9a9c270d909e135e | add L4 quiz - Ember Shortcuts and Aliases | udacity/course-front-end-frameworks,udacity/course-front-end-frameworks,udacity/course-front-end-frameworks | lesson4/quizEmberShortcuts/unit_tests.py | lesson4/quizEmberShortcuts/unit_tests.py | is_correct = False
port_alias = widget_inputs["check1"]
new_alias = widget_inputs["check2"]
help_alias = widget_inputs["check3"]
generate_alias = widget_inputs["check4"]
comments = []
def commentizer(new):
if new not in comments:
comments.append(new)
if not port_alias:
is_correct = is_correct and Fal... | mit | Python | |
9a9ee99129cee92c93fbc9e2cc24b7b933d51aac | Add on_delete in foreign keys. | hackerkid/zulip,dhcrzf/zulip,Galexrt/zulip,showell/zulip,amanharitsh123/zulip,zulip/zulip,vabs22/zulip,vaidap/zulip,jackrzhang/zulip,jrowan/zulip,hackerkid/zulip,zulip/zulip,tommyip/zulip,kou/zulip,jackrzhang/zulip,brockwhittaker/zulip,brockwhittaker/zulip,tommyip/zulip,shubhamdhama/zulip,eeshangarg/zulip,shubhamdhama/... | confirmation/migrations/0001_initial.py | confirmation/migrations/0001_initial.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Confirmation',
fields... | apache-2.0 | Python |
b807fe4e5a2120acb93f8f67ba44fa3c6b7ce92f | Add a benchmark for observation speeds. | deepmind/pysc2 | pysc2/bin/benchmark_observe.py | pysc2/bin/benchmark_observe.py | #!/usr/bin/python
# Copyright 2018 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | apache-2.0 | Python | |
46fdde37823c1c52bd78fc0922ec97a832fc191e | add 031 | ufjfeng/leetcode-jf-soln,ufjfeng/leetcode-jf-soln | python/031_next_permutation.py | python/031_next_permutation.py | """
Implement next permutation, which rearranges numbers into the lexicographically
next greater permutation of numbers.
If such arrangement is not possible, it must rearrange it as the lowest
possible order (ie, sorted in ascending order).
The replacement must be in-place, do not allocate extra memory.
Here are som... | mit | Python | |
548cd2efbb73e39a3e067cb66d5fc466d797cfb9 | add python dir for random test code that I write | fretboardfreak/code,fretboardfreak/code,fretboardfreak/code,fretboardfreak/code,fretboardfreak/code,fretboardfreak/code,fretboardfreak/code,fretboardfreak/code,fretboardfreak/code | python/context_manager_test.py | python/context_manager_test.py | #!/usr/bin/env python3
"""
This script was used to verify the behaviour of nested context managers in
python 3.
"""
import tempfile
from contextlib import contextmanager
@contextmanager
def first_manager():
print('Entering First Manager')
yield
print('Exiting First Manager')
@contextmanager
def second_m... | apache-2.0 | Python | |
a394375911b11d06ad5466f45a5fcda4b970febf | Create get_gene_co-ordinates.py | ElizabethSutton/RNA-seq_analysis_tools | Get_gene_co-ordinates/get_gene_co-ordinates.py | Get_gene_co-ordinates/get_gene_co-ordinates.py | #!/usr/bin/env python
# dealing with command line input
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-genes", type=str)
parser.add_argument("-gtf", type=str)
args = parser.parse_args()
genes_filename = args.genes
gtf_filename = args.gtf
# making list of genes from genes file
file = open(gen... | mit | Python | |
5fc129f83dc68bb005dea34a61e2bbe1751e2ca3 | add custom module: ec2_placement_group | Kitware/gobig,Kitware/gobig,opadron/gobig,opadron/gobig | library/ec2_placement_group.py | library/ec2_placement_group.py | #!/usr/bin/python
import sys
__arg_spec = None
def get_arg_spec():
if __arg_spec is not None: return __arg_spec
strats = ["cluster"]
states = ["present", "absent"]
__ arg_spec = ec2_argument_spec()
arg_spec.update({
"name" : { "required": True, "type": "str" },... | apache-2.0 | Python | |
a182633b03f654f9d8f933aab3c0aa99f8deadd2 | Add alg_bfs.py | bowen0701/algorithms_data_structures | alg_bfs.py | alg_bfs.py | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from ds_queue import Queue
def breadth_first_search():
pass
def main():
pass
if __name__ == '__main__':
main()
| bsd-2-clause | Python | |
2270317a8abbc288cdb757ba583fed5135317e67 | Add embedding example | mindriot101/IPython-Notebook-Tutorial,mindriot101/IPython-Notebook-Tutorial,mindriot101/IPython-Notebook-Tutorial | embedding-example/main.py | embedding-example/main.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import
import argparse
import logging
logging.basicConfig(
level='DEBUG', format='%(asctime)s|%(name)s|%(levelname)s|%(message)s')
logger = logging.getLogger(__name__)
def main(args):
logger.debug(args)
... | unlicense | Python | |
714829cb8ecec9edec07b4fce9a3340ee228e77f | Add encoding benchmark | tomashaber/raiden,tomaaron/raiden,charles-cooper/raiden,tomaaron/raiden,hackaugusto/raiden,tomashaber/raiden,tomaaron/raiden,tomaaron/raiden,tomashaber/raiden,tomashaber/raiden,hackaugusto/raiden,charles-cooper/raiden,tomashaber/raiden | raiden/tests/encoding_speed.py | raiden/tests/encoding_speed.py | import pytest
from timeit import timeit
setup = """
import cPickle
import umsgpack
from raiden.messages import Ping, decode, MediatedTransfer, Lock, Ack
from raiden.utils import privtoaddr, sha3
privkey = 'x' * 32
address = privtoaddr(privkey)
m0 = Ping(nonce=0)
m0.sign(privkey)
m1 = MediatedTransfer(10, address, 1... | mit | Python | |
385c46ec48593cd7d3233e0ab7cfca98c321bcf3 | Create 3dproject.py | danielwilson2017/3DProjectReal | 3dproject.py | 3dproject.py | mit | Python | ||
a97f7931b597a8c4273fb7e47081f5c1224e1441 | add new module | cellnopt/cellnopt,cellnopt/cellnopt | cno/core/standalone.py | cno/core/standalone.py | # -*- python -*-
#
# This file is part of CNO software
#
# Copyright (c) 2014 - EBI-EMBL
#
# File author(s): Thomas Cokelaer <cokelaer@ebi.ac.uk>
#
# Distributed under the GPLv3 License.
# See accompanying file LICENSE.txt or copy at
# http://www.gnu.org/licenses/gpl-3.0.html
#
# website: http://github.com/c... | bsd-2-clause | Python | |
8c6ce0a8b30bd000687eac9593ecbdc07130bd0e | Add lc739_daily_temperatures.py | bowen0701/algorithms_data_structures | lc739_daily_temperatures.py | lc739_daily_temperatures.py | """Leetcode 739. Daily Temperatures
Medium
Given a list of daily temperatures T, return a list such that, for each day
in the input, tells you how many days you would have to wait until a warmer
temperature. If there is no future day for which this is possible, put 0
instead.
For example, given the list of tempera... | bsd-2-clause | Python | |
7ab0cc93703abf6716b353f38a009897ab154ce4 | Add the plugin framework from common; use and test. | n0ano/ganttclient | nova/tests/test_plugin_api_extensions.py | nova/tests/test_plugin_api_extensions.py | # Copyright 2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | apache-2.0 | Python | |
19218b0b1f2198c1b0c01594658a3a4cd4dd0444 | Remove no more needed try import | vheon/JediHTTP,vheon/JediHTTP,micbou/JediHTTP,micbou/JediHTTP | jedihttp/hmac_plugin.py | jedihttp/hmac_plugin.py | # Copyright 2015 Cedraro Andrea <a.cedraro@gmail.com>
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | # Copyright 2015 Cedraro Andrea <a.cedraro@gmail.com>
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | apache-2.0 | Python |
3cdc40906fb055679b0989ee98cb808a741caa12 | Solve challenge 10 | HKuz/PythonChallenge | Challenges/chall_10.py | Challenges/chall_10.py | #!/Applications/anaconda/envs/Python3/bin
# Python challenge - 10
# http://www.pythonchallenge.com/pc/return/bull.html
# http://www.pythonchallenge.com/pc/return/sequence.txt
def main():
'''
Hint: len(a[30]) = ?
a = [1, 11, 21, 1211, 111221,
<area shape="poly" coords="146, ..., 399" href="sequence.txt... | mit | Python | |
7d92ef550b1b1d649fe460959d823248b72f336e | Add staging settings module | Mystopia/fantastic-doodle | service/settings/staging.py | service/settings/staging.py | from service.settings.production import *
ALLOWED_HOSTS = [
'fantastic-doodle--staging.herokuapp.com',
]
| unlicense | Python | |
27db11c0e2887f3d8b5ae5c95fa602f778f872ba | fix widgets safe_import on python 3.2 | kopchik/qtile,rxcomm/qtile,StephenBarnes/qtile,EndPointCorp/qtile,frostidaho/qtile,dequis/qtile,kopchik/qtile,kynikos/qtile,cortesi/qtile,aniruddhkanojia/qtile,soulchainer/qtile,encukou/qtile,aniruddhkanojia/qtile,apinsard/qtile,frostidaho/qtile,de-vri-es/qtile,xplv/qtile,qtile/qtile,zordsdavini/qtile,kiniou/qtile,zord... | libqtile/widget/__init__.py | libqtile/widget/__init__.py | import logging
import traceback
import importlib
logger = logging.getLogger('qtile')
def safe_import(module_name, class_name):
"""
try to import a module, and if it fails because an ImporError
it logs on WARNING, and logs the traceback on DEBUG level
"""
if type(class_name) is list:
for ... | import logging
import traceback
import importlib
logger = logging.getLogger('qtile')
def safe_import(module_name, class_name):
"""
try to import a module, and if it fails because an ImporError
it logs on WARNING, and logs the traceback on DEBUG level
"""
if type(class_name) is list:
for ... | mit | Python |
4ef62836086ea0c6adb0430af78c75614afaacfd | Create reminders.py | JLJTECH/TutorialTesting | Misc/reminders.py | Misc/reminders.py | #Python reminders - those pesky Gotchas!
''.join(list) # Collapse the list
[a,b,c,d,e].count(item) #Count occurrences of item in list
a[0] #put anything in square brackets to search list index
#Strange list rotation
def rotate_left3(nums):
a = nums[0]
nums[0] = nums[1]
nums[1] = nums[2]
nums[2] = a
return... | mit | Python | |
82b06e07348a21d509e2d1865913e2faed864b11 | Add time series analysis | j0h4x0r/ReliabilityLens,j0h4x0r/ReliabilityLens,j0h4x0r/ReliabilityLens | StatusAnalysis.py | StatusAnalysis.py | import math
import collections
def analyze_series(series):
'''
This is a time series analysis. The input is a list of number,
and it returns a score showing how normal the potential pattern is.
We assume the data are normally distributed, and likelihood is
then used as the score.
'''
# This may only works wel... | mit | Python | |
b23b86265dd952a3bfa1684549ab2087682c9733 | add dispatch namespace | quantopian/datashape,cowlicks/datashape,cowlicks/datashape,llllllllll/datashape,ContinuumIO/datashape,aterrel/datashape,llllllllll/datashape,aterrel/datashape,blaze/datashape,quantopian/datashape,cpcloud/datashape,cpcloud/datashape,ContinuumIO/datashape,blaze/datashape | datashape/dispatch.py | datashape/dispatch.py | from multipledispatch import dispatch
from functools import partial
namespace = dict()
dispatch = partial(dispatch, namespace=namespace)
| bsd-2-clause | Python | |
285236e1045915706b0cf2c6137273be7f9eb5d6 | Add generic abstract Module class | ECAM-Brussels/ECAMTV,ECAM-Brussels/ECAMTV,ECAM-Brussels/ECAMTV | modules/module.py | modules/module.py | # module.py
# Author: Sébastien Combéfis
# Version: May 25, 2016
from abc import *
class Module(metaclass=ABCMeta):
'''Abstract class representing a generic module.'''
def __init__(self, name):
self.__name = name
@property
def name(self):
return self.__name
@abstractmetho... | agpl-3.0 | Python | |
fccbc71622299e9987d470bb73ab071f705d98ab | Add module to support Mac OSX's System Profiler utility. | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/modules/systemprofiler.py | salt/modules/systemprofiler.py | # -*- coding: utf-8 -*-
'''
System Profiler Module
Interface with Mac OSX's command-line System Profiler utility to get
information about package receipts and installed applications.
'''
import plistlib
import subprocess
import pprint
import salt.utils.which
PROFILER_BINARY = '/usr/sbin/system_profiler'
def __virt... | apache-2.0 | Python | |
66c5f0d6d44c6bf9e72c52864268cf64dddf4b42 | Add metadata reader script | hadim/fiji_scripts,hadim/fiji_tools,hadim/fiji_scripts,hadim/fiji_scripts,hadim/fiji_tools | src/main/resources/script_templates/Hadim_Scripts/Metadata/Read_Metadata.py | src/main/resources/script_templates/Hadim_Scripts/Metadata/Read_Metadata.py | # @ImageJ ij
from io.scif import FieldPrinter
filePath = "/home/hadim/.data/Test/IM000556.Tif"
format = ij.scifio().format().getFormat(filePath)
metadata = format.createParser().parse(filePath)
#print(FieldPrinter(metadata))
imageMeta = metadata.get(0)
print(imageMeta) | bsd-3-clause | Python | |
8587cfb3f36af6f39f54b072a0518e9b81cac850 | add record_wav | Akagi201/learning-python,Akagi201/learning-python,Akagi201/learning-python,Akagi201/learning-python,Akagi201/learning-python | pyaudio/record_wav.py | pyaudio/record_wav.py | # !/usr/bin/env python
"""PyAudio example: Record a few seconds of audio and save to a WAVE file."""
import pyaudio
import wave
CHUNK = 1024
FORMAT = pyaudio.paInt16
CHANNELS = 2
RATE = 44100
RECORD_SECONDS = 5
WAVE_OUTPUT_FILENAME = "output.wav"
p = pyaudio.PyAudio()
stream = p.open(format=FORMAT,
... | mit | Python | |
245cdcd483f40bbe91e9c9695a73e7ef875d4eb4 | Add harvester for CiteSeerX | CenterForOpenScience/scrapi,erinspace/scrapi,felliott/scrapi,felliott/scrapi,fabianvf/scrapi,erinspace/scrapi,fabianvf/scrapi,CenterForOpenScience/scrapi | scrapi/harvesters/citeseerx.py | scrapi/harvesters/citeseerx.py | '''
Harvester for the "CiteSeerX Scientific Literature Digital Library and Search Engine" for the SHARE project
Example API call: http://citeseerx.ist.psu.edu/oai2?verb=ListRecords&metadataPrefix=oai_dc
'''
from __future__ import unicode_literals
from scrapi.base import OAIHarvester
class CiteseerxHarvester(OAIHarv... | apache-2.0 | Python | |
3b25faf6a2e95e3278cde45c04c4adcb50b3659a | add script find_duplicates | ZTH1970/alcide,ZTH1970/alcide,ZTH1970/alcide,ZTH1970/alcide,ZTH1970/alcide | scripts/find_duplicate_acts.py | scripts/find_duplicate_acts.py | #!/usr/bin/env python
import os
import datetime as dt
from collections import defaultdict
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "calebasse.settings")
from calebasse.actes.validation import get_days_with_acts_not_locked
from calebasse.actes.models import Act
doubles... | agpl-3.0 | Python | |
e110c968ece35e41c467aeb5fceb9274023e7e82 | Create child class for Rainbow bulb | litobro/PyPlaybulb | pyplaybulb/rainbow.py | pyplaybulb/rainbow.py | from pyplaybulb.playbulb import Playbulb
EFFECT_FLASH = '00'
EFFECT_PULSE = '01'
EFFECT_RAINBOW = '02'
EFFECT_RAINBOW_FADE = '03'
class Rainbow(Playbulb):
hexa_set_colour = '0x001b'
hexa_effect = '0x0019'
hexa_get_colour = '0x0019'
def set_colour(self, colour):
self.connection.char_write(self... | mit | Python | |
c2a2bb683df9f86fefadace4a0375e696b8c06d9 | add up2difiles | sevaivanov/various,sevaivanov/various,sevaivanov/various,sevaivanov/various,sevaivanov/various,sevaivanov/various | python/up2diffiles.py | python/up2diffiles.py | #!/usr/bin/python
lines = None
with open('ftp-betterdefaultpasslist.txt', 'r') as f: lines=f.readlines()
for line in lines:
user,pwd = line.split(':')
print(user, pwd)
for line in lines:
user,pwd = line.split(':')
with open('users.txt', 'w') as f:
f.write(user.strip() + '\n')
with... | mit | Python | |
e233352d5016c2b57ec4edbc4366ca4347bc1d98 | Create a single script to run the three demo services | uptane/uptane,awwad/uptane,awwad/uptane,uptane/uptane | demo/start_servers.py | demo/start_servers.py | """
start_servers.py
<Purpose>
A simple script to start the three cloud-side Uptane servers:
the Director (including its per-vehicle repositories)
the Image Repository
the Timeserver
To run the demo services in non-interactive mode, run:
python start_servers.py
To run the demo services in inter... | mit | Python | |
71af3a9b46094d94eb47e662cd30726140213de5 | Read graph. | PauliusLabanauskis/AlgorithmsDataStructures | algo_pathfinding/graph_input.py | algo_pathfinding/graph_input.py | def read_graph(path_file):
graph = {}
with open(path_file, 'r') as f:
data = f.read()
graph_data = eval(data)
return graph_data | unlicense | Python | |
ca9144c68d0c5fe08a109f26f595f3c7f0b6500d | Add errors.py and FontmakeError | googlefonts/fontmake,googlefonts/fontmake,googlei18n/fontmake,googlei18n/fontmake | Lib/fontmake/errors.py | Lib/fontmake/errors.py |
class FontmakeError(Exception):
"""Base class for all fontmake exceptions."""
pass
| apache-2.0 | Python | |
294aee87691857636cb433a800a85f395e359fcb | Add gallery example for grdview (#502) | GenericMappingTools/gmt-python,GenericMappingTools/gmt-python | examples/gallery/grid/grdview_surface.py | examples/gallery/grid/grdview_surface.py | """
Plotting a surface
------------------
The :meth:`pygmt.Figure.grdview()` method can plot 3-D surfaces with ``surftype="s"``. Here,
we supply the data as an :class:`xarray.DataArray` with the coordinate vectors ``x`` and
``y`` defined. Note that the ``perspective`` argument here controls the azimuth and
elevation a... | bsd-3-clause | Python | |
1058ed0847d151246299f73b325004fc04946fa0 | Set 1 - Challenge 2 | Scythe14/Crypto | Basics/challenge_2.py | Basics/challenge_2.py | #!/usr/bin/env python
if __name__ == '__main__':
s1 = 0x1c0111001f010100061a024b53535009181c
s2 = 0x686974207468652062756c6c277320657965
print(hex(s1 ^ s2))
| apache-2.0 | Python | |
2c30746908108aaeea40f5bf8511e0a1f343e1d9 | Create mapoon.py | Lcaracol/ideasbox.lan,ideascube/ideascube,Lcaracol/ideasbox.lan,Lcaracol/ideasbox.lan,ideascube/ideascube,ideascube/ideascube,ideascube/ideascube | ideasbox/conf/mapoon.py | ideasbox/conf/mapoon.py | # -*- coding: utf-8 -*-
"""Mapmoon box in Australia"""
from .base import * # noqa
from django.utils.translation import ugettext_lazy as _
IDEASBOX_NAME = u"Mapoon"
COUNTRIES_FIRST = ['AU']
TIME_ZONE = 'Australia/Darwin'
LANGUAGE_CODE = 'en'
MONITORING_ENTRY_EXPORT_FIELDS = ['serial', 'refugee_id', 'birth_year',
... | agpl-3.0 | Python | |
ea3dca7a2fb203d639b2eba74f21f95b24fecfbc | Create sdfdfdf.py (#13) | sajjadelastica/3G45,sajjadelastica/3G45,sajjadelastica/3G45,sajjadelastica/3G45 | sdfdfdf.py | sdfdfdf.py | efefefdsf
| apache-2.0 | Python | |
a328b1be6b90d2faa5fa717ffd8515115e1775dd | Add unit tests for tenant_usages_client | rakeshmi/tempest,sebrandon1/tempest,Juniper/tempest,vedujoshi/tempest,zsoltdudas/lis-tempest,LIS/lis-tempest,flyingfish007/tempest,dkalashnik/tempest,vedujoshi/tempest,masayukig/tempest,cisco-openstack/tempest,Tesora/tesora-tempest,bigswitch/tempest,tonyli71/tempest,cisco-openstack/tempest,zsoltdudas/lis-tempest,rakesh... | tempest/tests/services/compute/test_tenant_usages_client.py | tempest/tests/services/compute/test_tenant_usages_client.py | # Copyright 2015 NEC Corporation. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | apache-2.0 | Python | |
9f6572a9ea20cdeaeba93c4029b5409966d25535 | add a reboot example | diydrones/dronekit-python,dronekit/dronekit-python,hamishwillee/dronekit-python,diydrones/dronekit-python,dronekit/dronekit-python,hamishwillee/dronekit-python | examples/reboot/reboot.py | examples/reboot/reboot.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
from dronekit import connect
import time
# Set up option parsing to get connection string
import argparse
parser = argparse.ArgumentParser(description='Reboots vehicle')
parser.add_argument('--connect',
help="Vehi... | apache-2.0 | Python | |
902473ff170fffb635cf73e742f94e352994e954 | Create FetchNCBIseq.py | minesh1291/Sequence-Utilities,minesh1291/Sequence-Utilities | Online/FetchNCBIseq.py | Online/FetchNCBIseq.py | ### Fetch Genomics Sequence Using Coordinates In Biopython
from Bio import Entrez, SeqIO
Entrez.email = "A.N.Other@example.com" # Always tell NCBI who you are
handle = Entrez.efetch(db="nucleotide",
id="307603377",
rettype="fasta",
strand=1, ... | apache-2.0 | Python | |
067371d1baeae5f0502480738233c340de5a8033 | Create allAtomNetwork.py | hua372494277/protein-contact-maps | allAtomNetwork.py | allAtomNetwork.py | # calculate the clustering coefficient, characteristic path length, entropy, assortativity coefficient, Diameter and Radius
# of the network based on the coordinate of all atoms
import math
import networkx as nx
def distance(node1, node2):
dist = 0.0
distC = 0.0
for atom1 in node1:
for atom2 in nod... | bsd-3-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.