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 |
|---|---|---|---|---|---|---|---|---|
19fc36b494fe6422df6d3b87e1d34ff334660588 | add a simple monkeyrunner test | nikclayton/klaxon,nikclayton/klaxon,nikclayton/klaxon | scripts/monkey_tests.py | scripts/monkey_tests.py | # monkeyrunner script to install current klaxon, and run its tests.
# Author: Marc Dougherty <muncus@gmail.com>
from com.android.monkeyrunner import MonkeyDevice, MonkeyRunner
INSTRUMENTATION_RUNNER = 'android.test.InstrumentationTestRunner'
device = MonkeyRunner.waitForConnection()
device.installPackage('bin/Klaxo... | apache-2.0 | Python | |
3bcfcc4717014227de3775a2870e65d157862852 | Read ics, explore data structure. | louy2/Calenssist,asm-products/calenssist | unioncal.py | unioncal.py | import os.path
import pytz
import icalendar
import datetime
from urllib.request import urlopen
url1 = 'https://www.google.com/calendar/ical/loganlyf%40gmail.com/private-d45c0973da1e18ebc6394c484ac5bbfb/basic.ics'
url2 = 'https://www.google.com/calendar/ical/6v928aad58pqdh360ruh1t9dps%40group.calendar.google.com/priva... | agpl-3.0 | Python | |
ded6fbf4cf7a4d1bd93bcf7cee2cd43e21af82e0 | fix syntax error | zdw/xos,wathsalav/xos,cboling/xos,cboling/xos,cboling/xos,cboling/xos,opencord/xos,xmaruto/mcord,jermowery/xos,zdw/xos,xmaruto/mcord,wathsalav/xos,cboling/xos,opencord/xos,open-cloud/xos,opencord/xos,zdw/xos,jermowery/xos,zdw/xos,open-cloud/xos,wathsalav/xos,xmaruto/mcord,jermowery/xos,jermowery/xos,wathsalav/xos,open-... | plstackapi/planetstack/api/roles.py | plstackapi/planetstack/api/roles.py | from plstackapi.openstack.client import OpenStackClient
from plstackapi.openstack.driver import OpenStackDriver
from plstackapi.planetstack.models import *
def auth_check(auth):
client = OpenStackShell(username=auth['Username'],
password=auth['AuthMethod]',
... | from plstackapi.openstack.client import OpenStackClient
from plstackapi.openstack.driver import OpenStackDriver
from plstackapi.planetstack.models import *
def auth_check(auth):
client = OpenStackShell(username=auth['Username'],
password=auth['AuthMethod',
... | apache-2.0 | Python |
771426828db8b04c2b221b09aa92e1a5dc14d5c5 | add new analyic | snowleung/mywunder | mywunder/analytic_tags.py | mywunder/analytic_tags.py | # coding:utf-8
'''
Tags Analysis
~~~~~~~~~~~~~
'''
from functools import partial
import requests
import json
import re
X_CLIENT_ID = 'c017577997806d905149'
X_ACCESS_TOKEN = '101c5050ba558bdea41f08aa26923b9fb74adb72ee831aa43c216e80f357'
_cached = {}
def cached(func):
def _ccached(*args, **kwargs):
... | mit | Python | |
423cf7f2ea41594770be17b69f6108f237c8f39d | add infer speed script (#102) | TuSimple/simpledet,TuSimple/simpledet,TuSimple/simpledet | detection_infer_speed.py | detection_infer_speed.py | import time
from core.detection_module import DetModule
import argparse
import importlib
import mxnet as mx
def parse_args():
parser = argparse.ArgumentParser(description='Test detector inference speed')
# general
parser.add_argument('--config', help='config file path', type=str, required=True)
pars... | apache-2.0 | Python | |
c8941dd79bcf15f0d27b1b115a3be9316890a2ee | Add odt output | mknz/furiganasan,mknz/furiganasan,mknz/furiganasan | write2odt.py | write2odt.py | # -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import, unicode_literals
from odf.opendocument import OpenDocumentText
from odf.style import (Style, RubyProperties)
from odf.text import (P, Ruby, RubyBase, RubyText)
from odf import teletype
import re
TOKENS_KANJI = re.compile(u'[一-龠]+... | mit | Python | |
f71c24d60d20e36aa838ec931e7a4ea79398c445 | Create yget/yget.py | mahdikh92/youtube-downloader | yget/yget.py | yget/yget.py | #!/usr/bin/env python
import sys
import os
import json
import urllib
def main():
# Variable
LEN = len(sys.argv)
Q = "mp4_360"
# Get arguments
if LEN == 1:
os.system("clear")
print "NO YOUTUBE LINK FOUND!"
exit(0)
elif LEN == 2:
LINK = sys.argv[1]
elif LEN == 3:
LINK = sys.argv[1]
QUALITY = sys.a... | mit | Python | |
a230000ece2354681fb835739d9d625d6cf82032 | Create print.py | JsWatt/Free-Parking,JsWatt/Free-Parking,JsWatt/Free-Parking,JsWatt/Free-Parking,JsWatt/Free-Parking,JsWatt/Free-Parking,JsWatt/Free-Parking,JsWatt/Free-Parking | hacker_rank/python/introduction/print.py | hacker_rank/python/introduction/print.py | if __name__ == '__main__':
n = int(input())
out = ""
for x in range (n):
out += str(x+1)
print(out)
| mit | Python | |
0f50bcddeeb0f7c63e7885b2bd306509654460f1 | Create functions for date and recurrence parsing | rwstauner/dear_astrid,rwstauner/dear_astrid | dear_astrid/parser.py | dear_astrid/parser.py | """Parse Astrid xml backup file into simple data structures."""
from datetime import datetime
import re
# TODO: ArgumentError?
class AstridValueError(Exception):
"""Value does not match expected format and cannot be parsed"""
def __init__(self, key, val):
Exception.__init__(self,
'Unknown format for Ast... | mit | Python | |
fc89e505e4b897ff49bae505da0f0454b1199c8b | Add pyenchant backend for autocomplete | brainbots/assistant | assisstant/keyboard/autocomplete/backends/pyenchant.py | assisstant/keyboard/autocomplete/backends/pyenchant.py | import enchant
import re
class Enchant:
def __init__(self):
self.d = enchant.Dict("en")
def correct(self, word):
words = []
len_word = len(word)
for w in self.d.suggest(word):
w = re.sub(r"[ -]+", "", w)
if w != word:
words.append(w)
#words = sorted(words, key = lambda w: a... | apache-2.0 | Python | |
36882c550b02711c2fd0e42f72d8955e4bcf67cf | Add class helpers for unit testing | ganemone/ontheside,ganemone/ontheside,ganemone/ontheside | server/tests/helpers.py | server/tests/helpers.py | import wtforms_json
from app_factory import create_app, create_api, db
from api import api_config
from flask.ext.fixtures import Fixtures
fixtures = Fixtures(create_app(), db, True)
class SimpleTestCase:
def setup(self):
wtforms_json.init()
class FlaskTestCase(SimpleTestCase):
def setup(self):
... | mit | Python | |
beb8692e2950c415e079ac2d50df3f84e1223c61 | Create model.py | autumind/blog.python,autumind/blog.python,autumind/blog.python | www/model.py | www/model.py | import web, datetime
db = web.database(dbn='mysql', db='blog', user='shen')
def get_posts():
return db.select('entries', order='id DESC')
def get_post(id):
try:
return db.select('entries', where='id=$id', vars=locals())[0]
except IndexError:
return None
def new_post(title, text):
db.... | apache-2.0 | Python | |
0286020b202591a2f7958f8df9f9340d5127aacd | Add phosphorene to material repository | dean0x7d/pybinding,dean0x7d/pybinding,dean0x7d/pybinding,MAndelkovic/pybinding,MAndelkovic/pybinding,MAndelkovic/pybinding | pybinding/repository/phosphorene.py | pybinding/repository/phosphorene.py | """Phosphorene: a single layer of black phosphorus"""
from math import pi, sin, cos
import pybinding as pb
def monolayer_four_band():
"""Monolayer phosphorene lattice using the four-band model"""
a = 0.222
ax = 0.438
ay = 0.332
theta = 96.79 * (pi / 180)
phi = 103.69 * (pi / 180)
lat = pb... | bsd-2-clause | Python | |
14024b256f3957e7c579ebef5051882a584779d4 | add a unit test | pyreaclib/pyreaclib | pyreaclib/amemass/tests/test_ame.py | pyreaclib/amemass/tests/test_ame.py | # unit tests for AME database
import os
import pyreaclib.amemass as amemass
class TestAME(object):
@classmethod
def setup_class(cls):
""" this is run once for each class before any tests """
pass
@classmethod
def teardown_class(cls):
""" this is run once for each class after ... | bsd-3-clause | Python | |
f40d7dc569e2c92f291d178ade82e3c422f92b13 | test GLOBAL_ACK_EINTR | p/pycurl-archived,p/pycurl-archived,pycurl/pycurl,pycurl/pycurl,p/pycurl-archived,pycurl/pycurl | tests/global_init_ack_eintr.py | tests/global_init_ack_eintr.py | #! /usr/bin/env python
# -*- coding: iso-8859-1 -*-
# vi:ts=4:et
import pycurl
import unittest
from . import util
class GlobalInitAckEintrTest(unittest.TestCase):
def test_global_init_default(self):
# initialize libcurl with DEFAULT flags
pycurl.global_init(pycurl.GLOBAL_DEFAULT)
pycurl.g... | lgpl-2.1 | Python | |
1020e8e240598f4c213677d23e6fe593f7c1ceed | add initial working script | techgaun/gh-top-repos | gh-top-repos.py | gh-top-repos.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
gh-top-repos
Author: https://github.com/techgaun
"""
import github3 as github
import os
import argparse
import json
from datetime import datetime, timedelta
gh_user = os.getenv('GH_USER', None)
gh_pass = os.getenv('GH_PWD', None)
gh_token = os.getenv('GH_TOKEN', ... | apache-2.0 | Python | |
8526bd883d59d1064c73473b85e5ebd489f52334 | Add basic test expectations | namaggarwal/splitwise | tests/test_getNotifications.py | tests/test_getNotifications.py | from splitwise import Splitwise
import unittest
try:
from unittest.mock import patch
except ImportError: # Python 2
from mock import patch
@patch('splitwise.Splitwise._Splitwise__makeRequest')
class GetNotifications(unittest.TestCase):
def setUp(self):
self.sObj = Splitwise('consumerkey', 'consu... | mit | Python | |
f3260f4a0b9e4eb45d765415a389070b3cb21e6b | test for open_orgmodefile() started | tpltnt/orgmode2json | tests/test_open_orgmodefile.py | tests/test_open_orgmodefile.py | import sys
sys.path.append('../orgmode2json')
import pytest
from orgmode2json import *
def test_filename1():
"""
Test to handle non-string (int) as filename. This should fail with a
TypeError.
"""
o2j = Orgmode2json()
with pytest.raises(TypeError):
o2j.open_orgmodefile(23)
| agpl-3.0 | Python | |
644e9c3088c945edbf67c493869aac681c456967 | Add example jobs | georgeyk/loafer | loafer/jobs.py | loafer/jobs.py | # -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
import logging
logger = logging.getLogger(__name__)
# Job examples
# Jobs are the units where the messages are sent as parameters
# The regular function will be executed in the threadpool
def example_job(*args, **kwargs):
logger.info('Got message: example_job ... | mit | Python | |
23cf7d74ca6321ef35784645a2eb8b2354ca0d7b | Add bricks.py | rizar/attention-lvcsr,nke001/attention-lvcsr,rizar/attention-lvcsr,rizar/attention-lvcsr,rizar/attention-lvcsr,nke001/attention-lvcsr,nke001/attention-lvcsr,rizar/attention-lvcsr,nke001/attention-lvcsr,nke001/attention-lvcsr | lvsr/bricks.py | lvsr/bricks.py | from blocks.bricks import Initializable, Linear
from blocks.bricks.base import lazy, application
from blocks.bricks.parallel import Fork
from blocks.utils import dict_union
class RecurrentWithFork(Initializable):
@lazy(allocation=['input_dim'])
def __init__(self, recurrent, input_dim, **kwargs):
super... | mit | Python | |
5ffc9ef8e95bbcd6f72ad4d9adea42577f80dc5e | Create __init__.py | phdsbr/VCFlow,phdsbr/VCFlow | spc/__init__.py | spc/__init__.py | apache-2.0 | Python | ||
7de18a1aa6cfdea638fcec8ea054a2ea5714f5de | Add pipeline command | cmc333333/regulations-parser,eregs/regulations-parser,cmc333333/regulations-parser,tadhg-ohiggins/regulations-parser,tadhg-ohiggins/regulations-parser,eregs/regulations-parser | regparser/commands/pipeline.py | regparser/commands/pipeline.py | import click
from regparser.commands.versions import versions
from regparser.commands.annual_editions import annual_editions
from regparser.commands.fill_with_rules import fill_with_rules
from regparser.commands.layers import layers
from regparser.commands.diffs import diffs
from regparser.commands.write_to import wri... | cc0-1.0 | Python | |
beb8ff833825a8967a9ae61534e9a1da2aeec8db | Add admin for forum models | maur1th/naxos,maur1th/naxos,maur1th/naxos,maur1th/naxos | app/forum/forum/admin.py | app/forum/forum/admin.py | from django.contrib import admin
from .models import Category, Thread, Post
admin.site.register(Category)
admin.site.register(Thread)
admin.site.register(Post)
| apache-2.0 | Python | |
49cd77e0f098fc68c5d09ef5c0f16cf608e846fb | add bootstrap script | judithfan/graphcomm,judithfan/graphcomm,judithfan/graphcomm | analysis/bootstrap_model_predictions.py | analysis/bootstrap_model_predictions.py | from __future__ import division
import os
import numpy as np
import pandas as pd
import analysis_helpers as h
'''
Estimate uncertainty in estimates of key variables of interest that are derived from model predictions,
e.g., target rank, sketch cost. Estimate sampling uncertainty by resampling trials with replacement f... | mit | Python | |
b2f2a38fe14af359758db4b5020c3d9bb5efffb4 | add analysis script revealing the relation | KEHANG/autoQM,KEHANG/autoQM | analysis/freq_time_mol_size_relation.py | analysis/freq_time_mol_size_relation.py |
# parse log file of success jobs
# 1. grab molecule formula
# 2. grab time for opt
# 3. grab time for opt and freq
# 4. get freq time
# 5. get number of heavy atoms in mol
# 6. plot
import os
import re
import matplotlib.pyplot as plt
def select_targets(registration_table,
success_data_path):
"""
This method ... | mit | Python | |
29f9a317b5a8c2846ea602da4912eb6fcf027a4f | Update merge person tool | dbinetti/barberscore,barberscore/barberscore-api,barberscore/barberscore-api,barberscore/barberscore-api,dbinetti/barberscore-django,dbinetti/barberscore-django,dbinetti/barberscore,barberscore/barberscore-api | project/apps/api/management/commands/merge_persons.py | project/apps/api/management/commands/merge_persons.py | from optparse import make_option
from django.core.management.base import (
BaseCommand,
CommandError,
)
from apps.api.models import (
Person,
Singer,
Director,
Arranger,
)
class Command(BaseCommand):
help = "Merge selected singers by name"
option_list = BaseCommand.option_list + (
... | bsd-2-clause | Python | |
73fd98aee14ff800ec53bd4296a5ea97c6b754b8 | Add test cases for adding / removing fallbacks | MycroftAI/mycroft-core,MycroftAI/mycroft-core,forslund/mycroft-core,forslund/mycroft-core | test/unittests/skills/test_fallback_skill.py | test/unittests/skills/test_fallback_skill.py | from unittest import TestCase, mock
from mycroft.skills import FallbackSkill
def setup_fallback(fb_class):
fb_skill = fb_class()
fb_skill.bind(mock.Mock(name='bus'))
fb_skill.initialize()
return fb_skill
class TestFallbackSkill(TestCase):
def test_life_cycle(self):
"""Test startup and s... | apache-2.0 | Python | |
43ecf3f61feef5d046770c2ff816ba98ef88aad4 | Add tests for leetcode exercise (771) | vilisimo/ads,vilisimo/ads | python/leetcode/test/test_ex771.py | python/leetcode/test/test_ex771.py | from nose.tools import raises, assert_raises
import unittest
from ex771 import Solution
class TestClass:
def setup(self):
self.solution = Solution()
def test_empty_jewels(self):
result = self.solution.numJewelsInStones("", "ABC")
assert result == 0
def test_non_empty_jewels(sel... | mit | Python | |
34626c1d9d96026774c1cda739bef290efddcd5c | Add NetworkInfoPopup | ThomasHangstoerfer/pyHomeCtrl | popup_networkinfo.py | popup_networkinfo.py | # -*- coding: utf-8 -*-
from kivy.uix.popup import Popup
from kivy.uix.label import Label
from kivy.uix.button import Button
from kivy.uix.widget import Widget
from kivy.uix.boxlayout import BoxLayout
from kivy.clock import Clock
from utils import get_ip_address, get_network_info
from fhem_connect import FhemConnect... | apache-2.0 | Python | |
86d70a06c911bde4f8c225fea574c51a141de072 | add closing slash in aegis manifest file generator | outofbits/tracker,hoheinzollern/tracker,hoheinzollern/tracker,outofbits/tracker,outofbits/tracker,hoheinzollern/tracker,outofbits/tracker,outofbits/tracker,hoheinzollern/tracker,hoheinzollern/tracker,hoheinzollern/tracker,hoheinzollern/tracker,outofbits/tracker,outofbits/tracker | tests/functional-tests/create-tests-aegis.py | tests/functional-tests/create-tests-aegis.py | #!/usr/bin/python2.6
import os
import sys
import inspect
import imp
from common.utils import configuration as cfg
### This function comes from pydoc. Cool!
def importfile(path):
"""Import a Python source file or compiled file given its path."""
magic = imp.get_magic()
file = open(path, 'r')
if file.re... | #!/usr/bin/python2.6
import os
import sys
import inspect
import imp
from common.utils import configuration as cfg
### This function comes from pydoc. Cool!
def importfile(path):
"""Import a Python source file or compiled file given its path."""
magic = imp.get_magic()
file = open(path, 'r')
if file.re... | lgpl-2.1 | Python |
6a668a11999b60bd02a3cf853ba1e808d9fcf1c0 | Add pyinstaller hook which pulls in all of salt and the standard library | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/utils/pyinstaller/hook-salt.py | salt/utils/pyinstaller/hook-salt.py | # pylint: disable=3rd-party-module-not-gated
import logging
import pathlib
import sys
from PyInstaller.utils import hooks
log = logging.getLogger(__name__)
def _filter_stdlib_tests(name):
"""
Filter out non useful modules from the stdlib
"""
if ".test." in name:
return False
if ".tests.... | apache-2.0 | Python | |
052e917825dd40b89ed102a5ebf68fc29a4bb923 | Create find_the_missing_letter.py | Kunalpod/codewars,Kunalpod/codewars | find_the_missing_letter.py | find_the_missing_letter.py | #Kunal Gautam
#Codewars : @Kunalpod
#Problem name: Find the missing letter
#Problem level: 6 kyu
def find_missing_letter(chars):
for i in range(1,len(chars)):
if ord(chars[i])!=ord(chars[i-1])+1:
return chr(ord(chars[i])-1)
| mit | Python | |
2c85400323e924afc50bc1087f367dfa466942b2 | Initialize dovboringen module | DOV-Vlaanderen/pydov | pydov/dovboringen.py | pydov/dovboringen.py | """
This module handles the selection of borehole data from the DOV webservice.
It's development was made possible by the financing of Vlaio (Flanders, Belgium) and AGT n.v (www.agt.be).
"""
__author__ = ['Pieter Jan Haest', "Johan Van De Wauw"]
__copyright__ = 'Copyright 2017, DOV-Vlaanderen'
__credits__ = ["Stijn Va... | mit | Python | |
b0d329034d54a6d2a74213821a87a5f5611671aa | add the code | benben159/unbound-trustpositive | process-trust+domains.py | process-trust+domains.py | #!/usr/bin/env python3
## this script process trust+ domain blacklist file into configuration files for unbound
## TODO: multithreading, checking if unbound is installed, erase temporary file
import sys, subprocess, shlex, tempfile, os
import tldextract
import ipaddress
ip_addrs = []
unique_domains = []
subdomain_grou... | bsd-2-clause | Python | |
d9a701d4057db68517f16e09a8ce45a5caa2f2ed | add botevent plugin | melmothx/jsonbot,melmothx/jsonbot,melmothx/jsonbot | gozerlib/plugs/botevent.py | gozerlib/plugs/botevent.py | # gozerlib/plugs/botevent.py
#
#
""" provide handling of host/tasks/botevent tasks. """
## gozerlib imports
from gozerlib.utils.exception import handle_exception
from gozerlib.tasks import taskmanager
from gozerlib.botbase import BotBase
from gozerlib.eventbase import EventBase
from gozerlib.utils.lazydict import La... | mit | Python | |
c8d1e9a1ababa4ae529d36637ea12605764dff94 | add boost_python | tuttleofx/sconsProject | autoconf/boost_python.py | autoconf/boost_python.py | from _external import *
from boost import *
from python import *
boost_python = LibWithHeaderChecker( 'boost_python',
'boost/python.hpp',
'c++',
dependencies=[boost, python] )
| mit | Python | |
dd4aa0e3c036280066daf7eb791c9f750b04c6f9 | add ProjectStatus for each Build missing one | terceiro/squad,terceiro/squad,terceiro/squad,terceiro/squad | squad/core/migrations/0103_populate_project_status.py | squad/core/migrations/0103_populate_project_status.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-11-30 13:17
from __future__ import unicode_literals
from django.db import migrations
def create_missing_project_status(apps, schema_editor):
ProjectStatus = apps.get_model('core', 'ProjectStatus')
Build = apps.get_model('core', 'Build')
for bu... | agpl-3.0 | Python | |
620a10195f1f6fefcf1a4a3e2545fc6f8220374e | Create src/task_1_0.py | askras/pythonintask,fitifit/pythonintask | src/task_1_0.py | src/task_1_0.py | # Раздел 1. Задача 1. Вариант 0.
# Напишите программу, которая будет сообщать род деятельности и псевдоним под которым скрывается Эдсон Арантис ду Насименту. После вывода информации программа должна дожидаться пока пользователь нажмет Enter для выхода.
print("Эдсон Арантис ду Насименту более известен, как бразильский ... | apache-2.0 | Python | |
140efbfab724604a10854feb25c1262835181feb | add tests for MultiplexedPath | python/importlib_resources | importlib_resources/tests/test_reader.py | importlib_resources/tests/test_reader.py | import os.path
import unittest
from importlib_resources.readers import MultiplexedPath
from .._compat import FileNotFoundError, NotADirectoryError
class MultiplexedPathTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.folder = os.path.abspath(
os.path.join(__file__, '..', 'n... | apache-2.0 | Python | |
1a831b79b85fcae9a26f101f8bfbfca285662156 | Add test | pytest-dev/pytest-bdd | tests/steps/test_common.py | tests/steps/test_common.py | import textwrap
from pytest_bdd.utils import collect_dumped_objects
def test_step_function_multiple_target_fixtures(testdir):
testdir.makefile(
".feature",
target_fixture=textwrap.dedent(
"""\
Feature: Multiple target fixtures for step function
Scenario: A ... | mit | Python | |
6ad9395de430fedbabf79ec4bb136e5f5e2da7f7 | Add basic testing script for groups | locke105/pyics | tests/test_group_create.py | tests/test_group_create.py | import argparse
import getpass
import logging
import pyics
try:
import httplib
except ImportError:
import http.client as httplib
# super debug mode - print all HTTP requests/responses
#httplib.HTTPConnection.debuglevel = 1
TEST_GROUP_NAME = 'pyics-test-group'
def parse_args():
p = argparse.ArgumentPa... | apache-2.0 | Python | |
7724f307be9ec4503c931406af79f7ba9684e9c3 | Add conntrack_count.py | git-harry/rpc-openstack,sigmavirus24/rpc-openstack,cfarquhar/rpc-openstack,mattt416/rpc-openstack,rcbops/rpc-openstack,miguelgrinberg/rpc-openstack,busterswt/rpc-openstack,rcbops/rpc-openstack,claco/rpc-openstack,galstrom21/rpc-openstack,darrenchan/rpc-openstack,major/rpc-openstack,xeregin/rpc-openstack,xeregin/rpc-ope... | conntrack_count.py | conntrack_count.py | #!/usr/bin/env python
import maas_common
def get_value(path):
with open(path) as f:
value = f.read()
return value.strip()
def get_metrics():
metrics = {
'nf_conntrack_count': {
'path': '/proc/sys/net/netfilter/nf_conntrack_count'},
'nf_conntrack_max': {
'p... | apache-2.0 | Python | |
da4c2b23c071d681ed706e0b3803628c418ae762 | add convenience functions (#172) | jaygoldfinch/OWSLib,tomkralidis/OWSLib,datagovuk/OWSLib,bird-house/OWSLib,daf/OWSLib,ocefpaf/OWSLib,robmcmullen/OWSLib,jaygoldfinch/OWSLib,datagovuk/OWSLib,Jenselme/OWSLib,datagovuk/OWSLib,QuLogic/OWSLib,daf/OWSLib,kwilcox/OWSLib,dblodgett-usgs/OWSLib,menegon/OWSLib,geographika/OWSLib,kalxas/OWSLib,geopython/OWSLib,daf... | owslib/util.py | owslib/util.py | #!/usr/bin/python
# -*- coding: ISO-8859-15 -*-
# =============================================================================
# Copyright (c) 2008 Tom Kralidis
#
# Authors : Tom Kralidis <tomkralidis@hotmail.com>
#
# Contact email: tomkralidis@hotmail.com
# ============================================================... | bsd-3-clause | Python | |
1d700630142271a685c5dc9fdec41620e1cc83b9 | Add a script to generate the Buildkite pipeline | firecracker-microvm/firecracker,firecracker-microvm/firecracker,firecracker-microvm/firecracker,firecracker-microvm/firecracker,firecracker-microvm/firecracker | .buildkite/pipeline_pr.py | .buildkite/pipeline_pr.py | #!/usr/bin/env python3
# Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""Generate Buildkite pipelines dynamically"""
import json
INSTANCES = [
"m5d.metal",
"m6i.metal",
"m6a.metal",
"m6gd.metal",
]
KERNELS = ["4.14", "5.10"]
def grou... | apache-2.0 | Python | |
4071a4d9e0c6b060a0a0c40e33122fe9d872259a | add inspection of H(K) elements | tflovorn/tmd,tflovorn/tmd | tmd/bilayer/Hk_symmetry.py | tmd/bilayer/Hk_symmetry.py | import os
from tmd.wannier.bands import Hk_recip
from tmd.bilayer.bilayer_util import global_config
from tmd.bilayer.plot_ds import ds_from_prefixes, sorted_d_group, wrap_cell, get_atom_order, orbital_index
from tmd.bilayer.dgrid import get_prefixes
from tmd.bilayer.wannier import get_Hr
def find_d_val(dps, d_val):
... | mit | Python | |
ec68023f24ba71e73ab7ac779135c0e9ac19e6b7 | add mayavi2 plugin module | simphony/simphony-mayavi | simphony_mayavi/user_mayavi.py | simphony_mayavi/user_mayavi.py | from mayavi.core.registry import registry
from mayavi.core.pipeline_info import PipelineInfo
from mayavi.core.metadata import SourceMetadata
cuds_reader_info = SourceMetadata(
id="CUDSReader",
class_name="simphony_mayavi.sources.cuds_file_source.CUDSFileSource",
tooltip="Load a CUDS file",
desc="Load a... | bsd-2-clause | Python | |
2ba5096d736c9e5c544607317fa18b67439b804d | add discrete PoissonDiagnostic | statsmodels/statsmodels,statsmodels/statsmodels,josef-pkt/statsmodels,bashtage/statsmodels,statsmodels/statsmodels,statsmodels/statsmodels,statsmodels/statsmodels,bashtage/statsmodels,josef-pkt/statsmodels,bashtage/statsmodels,bashtage/statsmodels,statsmodels/statsmodels,bashtage/statsmodels,josef-pkt/statsmodels,josef... | statsmodels/discrete/diagnostic.py | statsmodels/discrete/diagnostic.py | # -*- coding: utf-8 -*-
"""
Created on Wed Nov 18 15:17:58 2020
Author: Josef Perktold
License: BSD-3
"""
import numpy as np
from statsmodels.tools.decorators import cache_readonly
from statsmodels.stats._diagnostic_other import (
dispersion_poisson, dispersion_poisson_generic)
from statsmodels.stats.diagn... | bsd-3-clause | Python | |
5ddae2d11361e262c6cb082fc6bb71c92e3f3b9a | Add for loop | nightmarebadger/tutorials-python-basic | 1_very_basic/loops/for.py | 1_very_basic/loops/for.py | # -*- coding: utf-8 -*-
"""
Created on 2014-09-16
:author: Natan Žabkar (nightmarebadger)
A for loop is usually used when we want to repeat a piece of code 'n' number of
times, or when we want to iterate through the elements of a list (or something
similar).
In this example our program will 'sing' out the 99 bottles... | mit | Python | |
e023f8786765d8a57f45a77f0acfe70b90c2e098 | Add utility module to load puzzle input | robjwells/adventofcode-solutions,robjwells/adventofcode-solutions,robjwells/adventofcode-solutions,robjwells/adventofcode-solutions,robjwells/adventofcode-solutions,robjwells/adventofcode-solutions | 2018/python/aoc_common.py | 2018/python/aoc_common.py | """aoc_common
Common utility functions for Advent of Code solutions
"""
import pathlib
def load_puzzle_input(day):
"""Return the puzzle input for the day’s puzzle"""
input_directory = pathlib.Path(__file__).parent.with_name('input')
year = input_directory.parent.name
input_filename = f'{year}-{day:0... | mit | Python | |
2d5f39bd68481c81ecf676eb99d1d0e88e9540f7 | Add test cases for ‘VersionInfoWriter’. | wting/python-daemon,eaufavor/python-daemon | test_version.py | test_version.py | # -*- coding: utf-8 -*-
#
# test_version.py
# Part of ‘python-daemon’, an implementation of PEP 3143.
#
# Copyright © 2008–2014 Ben Finney <ben+python@benfinney.id.au>
#
# This is free software: you may copy, modify, and/or distribute this work
# under the terms of the GNU General Public License as published by the
# F... | apache-2.0 | Python | |
6020b67c4f7dd67f08e28348e04786a9f7d24153 | Create python-sdk-for-big-ip.py | joelwking/f5toolkit | python-sdk-for-big-ip.py | python-sdk-for-big-ip.py | #!/usr/bin/env python
#
# F5 Friday: Python SDK for BIG-IP
# https://devcentral.f5.com/articles/f5-friday-python-sdk-for-big-ip-18233
#
import sys
from f5.bigip import BigIP
# Connect to the BigIP
# bigip = BigIP("bigip.example.com", "admin", "somepassword")
bigip = BigIP("sys.argv[1]", sys.argv[2], sys.arg... | mit | Python | |
301a7ff10f4a630ca403571aee8624bf98329b16 | Update zipfsong with unit test refactor and python3 | josenava/spotify_puzzle | zipfsong_old.py | zipfsong_old.py | #!/usr/bin/python2
""""
Zipf's song problem
v1.0 without using any class structure like creating a Song class
Jose Antonio Navarrete
@joseanavarrete
"""
import sys
def process_info(n_played, song_name, song_number, songs_array):
"""
Inserts into songs_array song_name processed with its zipf coeficient
"... | mit | Python | |
e39187779b0bd2a10290ef019a331a8a64a57a25 | Add script to generate nodes.py module for AST | pdarragh/Viper | generate_nodes_module.py | generate_nodes_module.py | #!/usr/bin/env python3
from viper.parser.ast.generate_nodes_module import generate_text_from_parsed_rules
from viper.parser.grammar import GRAMMAR_FILE
from viper.parser.grammar_parsing.parse_grammar import parse_grammar_file
from os.path import dirname, join
basedir = dirname(__file__)
output = join(basedir, 'vipe... | apache-2.0 | Python | |
8d5c594b8ba0245537e50491472277f3e76841d0 | Gather client ipaddr infomation | henry-zhang/Cmdb_Puppet,sdgdsffdsfff/Cmdb_Puppet | gethostinfo/ipaddress.py | gethostinfo/ipaddress.py | #!/home/python/bin/python
#-*- coding:utf-8 -*-
from subprocess import PIPE,Popen
import re
def getIpaddr():
p = Popen(['ifconfig'],shell=False,stdout=PIPE)
stdout, stderr = p.communicate()
return stdout.strip()
def parserIpaddr(ipdata):
device = re.compile(r'(eth\d)')
ipaddr = re.compile(r'(in... | epl-1.0 | Python | |
74cf0ba2d329475870d72574da32cd134c5bef97 | Add an example which generates DHCP configuration | jkinred/psphere,graphite-server/psphere | examples/gen_dhcpconf.py | examples/gen_dhcpconf.py | #!/usr/bin/python
"""A script which generates DHCP configuration for hosts matching a regex.
Usage:
gen_dhcpconf.py <regex> <compute_resource>
e.g.
gen_dhcpconf.py 'ssi2+' 'Online Engineering'
"""
import re
import sys
from psphere.client import Client
client = Client()
host_regex = sys.argv[1]
p = re.compil... | apache-2.0 | Python | |
10fe0f84be100c33c39fda2d3b5f4eacd9dcc9bf | Add YahooAnswers Mocked Unit Test #1574 (#1577) | pytorch/text,pytorch/text,pytorch/text,pytorch/text | test/datasets/test_yahooanswers.py | test/datasets/test_yahooanswers.py | import os
import random
import string
import tarfile
from collections import defaultdict
from unittest.mock import patch
from parameterized import parameterized
from torchtext.datasets.yahooanswers import YahooAnswers
from ..common.case_utils import TempDirMixin, zip_equal
from ..common.torchtext_test_case import Tor... | bsd-3-clause | Python | |
d1c3774f9d496c86947692a3d8e79149a2ae118f | Add QtNetwork module to Qt API selector. | enthought/etsproxy | enthought/qt/QtNetwork.py | enthought/qt/QtNetwork.py | # proxy module
from pyface.qt.QtNetwork import *
| bsd-3-clause | Python | |
4e47ec1da6421f83ff90402c5b0c57a55c8bcda5 | Create dt.py | DynaLite/DynaLite_1.0,DynaLite/DynaLite_1.0,DynaLite/DynaLite_1.0,DynaLite/DynaLite_1.0 | Sources/dt.py | Sources/dt.py | import numpy as np
import pandas as pd
import scipy as sp
import sklearn as sk
import sklearn.cross_validation as skcv
import sklearn.ensemble as skens
import sklearn.metrics as skmetric
import sklearn.naive_bayes as sknb
import sklearn.tree as sktree
import matplotlib.pyplot as plt
import pydot_ng as pydot
import skle... | mit | Python | |
f3fe9296ca251977604454a092b974c93d70e13b | Implement tests for `Post` | gebn/chandl,gebn/chandl | chandl/tests/model/test_post.py | chandl/tests/model/test_post.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from unittest import TestCase
from datetime import datetime
from chandl.model.post import Post
class TestPost(TestCase):
_BOARD = 'wg'
_POST = {
'no': 1978935,
'now': '11/23/16(Wed)03:54:11',
'name': 'Anonymous',
... | mit | Python | |
2cf600e09db369e95242d8d2915cedccaeb3e67f | Add api | jiasir/playback,nofdev/playback | playback/api.py | playback/api.py | from fabric.tasks import execute
from playback.keystone import Keystone
from playback.cinder import Cinder
from playback.glance import Glance
from playback.haproxy_install import HaproxyInstall
from playback.haproxy_config import HaproxyConfig
from playback.horizon import Horizon
from playback.mysql_installation... | mit | Python | |
decb6b71685cf82d80da56298a86a44dbed01ea5 | add build script for newer versions of sbt | lift-project/lift,lift-project/lift,lift-project/lift,lift-project/lift,lift-project/lift | scripts/buildRunScripts-SBT-13.13.py | scripts/buildRunScripts-SBT-13.13.py | #!/usr/bin/env python
import os
import subprocess
import re
import sys
scriptRoot=os.path.dirname(os.path.realpath(__file__))
projectRoot=os.path.dirname(scriptRoot)
os.chdir(projectRoot)
classpath = subprocess.check_output(["sbt", "show runtime:fullClasspath"])
mainClasses = subprocess.check_output(["sbt", "show di... | mit | Python | |
61d0c604e7ae9840b0c0a237459975f7f3ddbd43 | Add encode tagger example | explosion/thinc,explosion/thinc,explosion/thinc,spacy-io/thinc,spacy-io/thinc,explosion/thinc,spacy-io/thinc | examples/encode_tagger.py | examples/encode_tagger.py | from thinc.neural.id2vec import Embed
from thinc.neural.ids2vecs import MaxoutWindowEncode
from thinc.neural.vec2vec import Model, ReLu, Softmax
from thinc.neural.vecs2vecs import ExtractWindow
from thinc.neural.util import score_model
from thinc.neural.optimizers import linear_decay
from thinc.neural.ops import Numpy... | mit | Python | |
7f2f7cabe97f344d812f86a48ccddec102879e92 | Add example usages of themes | has2k1/plotnine,has2k1/plotnine | examples/themes.py | examples/themes.py | from ggplot import *
p = ggplot(mtcars, aes('cyl')) + geom_bar()
print(p)
print(p +theme_bw())
print(p + theme_xkcd())
print(p + theme_matplotlib())
plt.show(1)
| mit | Python | |
d6beeae7c2565f9a1b1ad54727a64a1705818335 | Create DeadArchiveSimulator.py | PaulEG/Various-Projects | DeadArchiveSimulator.py | DeadArchiveSimulator.py | from graphics import *
from random import randint
from random import random
class Tablet:
def __init__(self, p):
self.survives = True
self.p = p
def oneYearPasses(self):
if random() < self.p:
self.survives = False
def survives(self):
return self.survives
... | artistic-2.0 | Python | |
50c2eb0ec2cf8da185805b1ac292f6e83ba8496a | Add tracer implementation | PaddlePaddle/Paddle,luotao1/Paddle,tensor-tang/Paddle,tensor-tang/Paddle,chengduoZH/Paddle,chengduoZH/Paddle,chengduoZH/Paddle,tensor-tang/Paddle,baidu/Paddle,PaddlePaddle/Paddle,PaddlePaddle/Paddle,baidu/Paddle,luotao1/Paddle,tensor-tang/Paddle,luotao1/Paddle,chengduoZH/Paddle,PaddlePaddle/Paddle,chengduoZH/Paddle,bai... | python/paddle/fluid/imperative/tracer.py | python/paddle/fluid/imperative/tracer.py | # Copyright (c) 2018 PaddlePaddle Authors. 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 appli... | apache-2.0 | Python | |
8c608c8ddb4eb4f64e8317317b32c64b48d06d78 | Create lcp_mac.py | Points/Loyalty-Commerce-Platform,Points/Loyalty-Commerce-Platform,gordontang/Loyalty-Commerce-Platform,gordontang/Loyalty-Commerce-Platform | libraries/lcp_mac.py | libraries/lcp_mac.py | import base64
import hashlib
import hmac
import httplib
import os
import time
import urlparse
def generate_ext(content_type, body):
"""Implements the notion of the ext as described in
http://tools.ietf.org/html/draft-ietf-oauth-v2-http-mac-02#section-3.1"""
if content_type is not None and body is not Non... | bsd-3-clause | Python | |
b6003817e7b7d78feac8c304a827b876767cc31c | add upstartdbus to manager rest | geokala/cloudify-manager,codilime/cloudify-manager,konradxyz/dev_fileserver,codilime/cloudify-manager,isaac-s/cloudify-manager,cloudify-cosmo/cloudify-manager,codilime/cloudify-manager,isaac-s/cloudify-manager,konradxyz/dev_fileserver,cloudify-cosmo/cloudify-manager,cloudify-cosmo/cloudify-manager,konradxyz/cloudify-ma... | rest-service/manager_rest/upstartdbus.py | rest-service/manager_rest/upstartdbus.py | import dbus
BUS_NAME = 'com.ubuntu.Upstart'
BASE_PATH = '/com/ubuntu/Upstart'
UPSTART_IFACE = 'com.ubuntu.Upstart0_6'
UPSTARTJOB_IFACE = 'com.ubuntu.Upstart0_6.Job'
UPSTARTINST_IFACE = 'com.ubuntu.Upstart0_6.Instance'
UNKNOWNJOB_EXCEPT = 'com.ubuntu.Upstart0_6.Error.UnknownJob'
_sysbus = dbus.SystemBus()
_upstart_pro... | apache-2.0 | Python | |
08ca434b018270c9b1a88831b63da3cd1c9c97dc | Add tests for apply_transform | analysiscenter/dataset | batchflow/tests/apply_transform_test.py | batchflow/tests/apply_transform_test.py | """ Tests for Batch apply_transform method. """
# pylint: disable=import-error, no-name-in-module
# pylint: disable=missing-docstring, redefined-outer-name
from contextlib import ExitStack as does_not_raise
import numpy as np
import pytest
from batchflow import Batch, Dataset, P, R
BATCH_SIZE = 2
DATA = np.arange(3... | apache-2.0 | Python | |
86045e5f195f9510dbdfd1f5858d78067d27a57a | Add bridgedb.interfaces module which simply collects all interfaces. | pagea/bridgedb,pagea/bridgedb | lib/bridgedb/interfaces.py | lib/bridgedb/interfaces.py | # -*- coding: utf-8 -*-
#_____________________________________________________________________________
#
# This file is part of BridgeDB, a Tor bridge distribution system.
#
# :authors: Isis Lovecruft 0xA3ADB67A2CDB8B35 <isis@torproject.org>
# please also see AUTHORS file
# :copyright: (c) 2007-2014, The Tor ... | bsd-3-clause | Python | |
4e01f20b1d5f060a3fc31bac1ea53181297482b6 | add GrowYouIC.py to act as the main python file. | MarineLasbleis/GrowYourIC | GrowYourIC.py | GrowYourIC.py | #!/usr/local/bin/python
# Project : From geodynamic to Seismic observations in the Earth's inner core
# Author : Marine Lasbleis
import numpy as np
import matplotlib.pyplot as plt #for figures
from mpl_toolkits.basemap import Basemap #to render maps
import math
import positions
import geodynamic
import plot_data
impo... | mit | Python | |
3c3d96f69ecd528b82f3c0e33f173da4689f22e8 | add tests for mnemonics | asfin/electrum,FairCoinTeam/electrum-fair,lbryio/lbryum,aasiutin/electrum,FairCoinTeam/electrum-fair,imrehg/electrum,imrehg/electrum,argentumproject/electrum-arg,cryptapus/electrum-uno,protonn/Electrum-Cash,digitalbitbox/electrum,cryptapus/electrum,molecular/electrum,cryptapus/electrum-uno,fyookball/electrum,wakiyamap/... | lib/tests/test_mnemonic.py | lib/tests/test_mnemonic.py | import unittest
from lib import mnemonic
from lib import old_mnemonic
class Test_NewMnemonic(unittest.TestCase):
def test_prepare_seed(self):
seed = 'foo BAR Baz'
self.assertEquals(mnemonic.prepare_seed(seed), 'foo bar baz')
def test_to_seed(self):
seed = mnemonic.Mnemonic.mnemonic_to... | mit | Python | |
df83660248e39c51fd035aa212f06f9542b01620 | Remove Gallery model | matus-stehlik/roots,matus-stehlik/glowing-batman,matus-stehlik/roots,tbabej/roots,tbabej/roots,matus-stehlik/roots,tbabej/roots,rtrembecky/roots,matus-stehlik/glowing-batman,rtrembecky/roots,rtrembecky/roots | posts/models.py | posts/models.py | from django.db import models
from django.contrib import admin
from base.util import with_author, with_timestamp
# Content-related models
@with_author
@with_timestamp
class Post(models.Model):
'''
Represents a post on the wall. This can be restricted to certain competition
or can be general.
'''
t... | from django.db import models
from django.contrib import admin
from base.util import with_author, with_timestamp
# Content-related models
@with_author
@with_timestamp
class Post(models.Model):
'''
Represents a post on the wall. This can be restricted to certain competition
or can be general.
'''
t... | mit | Python |
6166447aaca58080a86b87148aafbaa732f3237f | Add general "util" lib | MurphyMc/pox,VamsikrishnaNallabothu/pox,carlye566/IoT-POX,kulawczukmarcin/mypox,carlye566/IoT-POX,waltznetworks/pox,kulawczukmarcin/mypox,xAKLx/pox,denovogroup/pox,jacobq/csci5221-viro-project,kavitshah8/SDNDeveloper,jacobq/csci5221-viro-project,waltznetworks/pox,PrincetonUniversity/pox,noxrepo/pox,waltznetworks/pox,ch... | pox/lib/util.py | pox/lib/util.py | import struct
import sys
def dpidToStr (dpid):
""" In flux. """
if type(dpid) is long or type(dpid) is int:
# Not sure if this is right
dpid = struct.pack('!Q', dpid)
assert len(dpid) == 8
r = '-'.join(['%02x' % (x,) for x in dpid[2:]])
r += '/' + str(struct.unpack('!H', dpid[0:2]))
return r
de... | apache-2.0 | Python | |
47e1b1e2a023c0298f56b61159e76b27135b09ba | Add unittest for concurrent redirect target create | nuagenetworks/nuage-openstack-neutron,nuagenetworks/nuage-openstack-neutron | nuage_neutron/tests/unit/test_nuage_redirect_target.py | nuage_neutron/tests/unit/test_nuage_redirect_target.py | # Copyright 2020 NOKIA
#
# 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... | apache-2.0 | Python | |
f2e382e1157257e928e9b58eff80eba572a0fbf6 | Add Google's sharded counter utility. | kkinder/GAEStarterKit,kkinder/GAEStarterKit,kkinder/GAEStarterKit | util/counters.py | util/counters.py | """
Based on https://github.com/GoogleCloudPlatform/appengine-sharded-counters-python
Sharded counters for data
"""
import random
from google.appengine.api import memcache
from google.appengine.ext import ndb
SHARD_KEY_TEMPLATE = 'shard-{}-{:d}'
class GeneralCounterShardConfig(ndb.Model):
"""Tracks the number... | apache-2.0 | Python | |
4afabfb4a9176b1c4b4a0cfb9222d068ac47b41c | Create plummer.py | kostassabulis/nbody-workshop-2015 | plummer.py | plummer.py | __author__ = 'Tomas'
## plummer(N, r_pl) N - number of stars; r_pl - cluster scale radius
## plummer() grazina x,y,z koordinates ir zvaigzdiu mases(isvardyta tvarka)
## zvaigzdziu mases grazinamos saules masemis
## koordinates r_pl vienetais
import numpy as np
def plummer(N, r_pl):
M_min = 0.8 # min zvaigzdes ... | mit | Python | |
2c3f77e84fd0fa7e6c061ed948dad6852bcbc706 | add twitter bot | yukop/geeklatte,yukop/geeklatte,yukop/geeklatte | py/tweet.py | py/tweet.py | # -*- coding: utf-8 -*-
import tweepy
import ConfigParser
import urllib2
import json
import random
import re
config = ConfigParser.ConfigParser()
config.readfp(open('geeklatte.conf'))
apikey = config.get('Flickr', 'apikey')
config.readfp(open('twitter.conf'))
consumer_token = config.get('Twitter', 'consumer_token')
c... | bsd-3-clause | Python | |
13bf0a0e15555986426ecf69d4f8ce4f9af759df | ADD pickle-stan program | dieterich-lab/riboseq-utils | riboutils/pickle_stan.py | riboutils/pickle_stan.py | #! /usr/bin/env python3
import argparse
import pickle
from pystan import StanModel
def main():
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter,
description="This script compiles a stan model and pickles it to disc")
parser.add_argument("stan", help="The stan mod... | mit | Python | |
a74ea4a52449e43b99cfe181b335692f70173f1c | Add tests. | machinelearningdeveloper/aoc_2016 | 06/test_message.py | 06/test_message.py | import unittest
from message import recover_message, load_messages
class TestMessage(unittest.TestCase):
def setUp(self):
self.messages = ['eedadn', 'drvtee', 'eandsr',
'raavrd', 'atevrs', 'tsrnev',
'sdttsa', 'rasrtv', 'nssdts',
'... | mit | Python | |
5b8435271e28d3bd86dd231bcc17788e41377112 | create result reader | pp86/mutual_exclusive | explore_results.py | explore_results.py | import pandas as pd
import sys
input_file = sys.argv[1]
results = pd.read_csv(input_file, sep="\t")
results.head() | apache-2.0 | Python | |
e3e5f1862651e2809e0178bc19f79d67f30a86f6 | Add CPy diff-test for using dict.keys() as a set. | pfalcon/micropython,pfalcon/micropython,pfalcon/micropython,pfalcon/micropython,pfalcon/micropython | tests/cpydiff/types_dict_keys_set.py | tests/cpydiff/types_dict_keys_set.py | """
categories: Types,dict
description: Dictionary keys view does not behave as a set.
cause: Not implemented.
workaround: Explicitly convert keys to a set before using set operations.
"""
print({1:2, 3:4}.keys() & {1})
| mit | Python | |
4f76361e150af6b5a1ece7c8b69e843e3fc82a0f | Create Run_exphydro_lumped_mc.py | sopanpatil/exp-hydro | Run_exphydro_lumped_mc.py | Run_exphydro_lumped_mc.py | #!/usr/bin/env python
# Programmer(s): Sopan Patil.
""" MAIN PROGRAM FILE
Run this file to optimise the EXP-HYDRO model parameters
using Monte Carlo optimisation algorithm.
Please note that this is a slow optimisation method compared to
Particle Swarm Optimisation (PSO), and requires a very large number
of iteration... | mit | Python | |
95b3a0235e19b74901336439f138c1665006cdf5 | Add deep_dream_test.py microbenchmark. | crowsonkb/deep_dream,crowsonkb/deep_dream | deep_dream_test.py | deep_dream_test.py | """Test/benchmark deep_dream.py."""
import argparse
from pathlib import Path
import time
from PIL import Image
import deep_dream
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--gpu', type=int, help='the CUDA device ID to use')
parser.add_argument('--max-tile-siz... | mit | Python | |
d90a7df0b83137becaa7e4c137be6e154e89d56c | Add 5.x example | TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets | quickstart/python/sms/example-8/reply_to_message.5x.py | quickstart/python/sms/example-8/reply_to_message.5x.py | # /usr/bin/env python
# Download the twilio-python library from twilio.com/docs/libraries/python
from flask import Flask, request, redirect
from twilio import twiml
app = Flask(__name__)
@app.route("/sms", methods=['GET', 'POST'])
def sms_ahoy_reply():
"""Respond to incoming messages with a friendly SMS."""
#... | mit | Python | |
29f4eca04bfe71f9089af21270a9f78a5eaad006 | add functions to open files directly from zip archive | SKIRT/PTS,SKIRT/PTS,SKIRT/PTS | pts/zip.py | pts/zip.py | #!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# *****************************************************************
##... | agpl-3.0 | Python | |
6bd6203813bc4ca377baed842d7934a50f86f37e | Test -- Encrypted File Transfer Server | mrahman1122/Team4CS3240 | Server/encryptedServer.py | Server/encryptedServer.py | __author__ = 'masudurrahman'
import sys
from twisted.protocols import ftp
from twisted.protocols.ftp import FTPFactory, FTPAnonymousShell, FTPRealm, FTP, FTPShell, IFTPShell
from twisted.cred.portal import Portal
from twisted.cred import checkers
from twisted.cred.checkers import AllowAnonymousAccess, FilePasswordDB
f... | apache-2.0 | Python | |
7a8ff8bf85d87fc89139eac42023b8c818df843e | Add auth.py | ollien/Timpani,ollien/Timpani,ollien/Timpani | py/auth.py | py/auth.py | import bcrypt
import database
def createUser(username, password, can_change_settings, can_write_posts):
username = username.lower()
passwordAsBytes = bytes(password, "utf-8")
passwordHash = bcrypt.hashpw(passwordAsBytes, bcrypt.gensalt()).decode("utf-8")
databaseConnection = database.ConnectionManager.getConnectio... | mit | Python | |
86d93e2943aa3da2a0f9446055dc5e946f48b85e | Create pixelArt.py | d0m00re/pixelArtWithPythonExcel | pixelArt.py | pixelArt.py | # -*- coding: utf-8 -*-
import xlwt
import sys
#tranforme le format en entree en liste
def parseData(str):
size = len(str)
#print size
data = list()
i = 0
while i < size:
if str[i] == 'l':
data.append(2)
elif str[i] == '*':
data.append(1)
elif s... | mit | Python | |
b3d4ceb6011901d838c231532b126c519bacd10b | Add info | devicehive/devicehive-python | devicehive/info.py | devicehive/info.py | from devicehive.api_object import ApiObject
class Info(ApiObject):
"""Info class."""
def get(self):
url = 'info'
action = 'server/info'
request = {}
params = {'response_key': 'info'}
response = self._request(url, action, request, **params)
self._ensure_success_... | apache-2.0 | Python | |
f40774412c88cecdc115bf0c2b3013a153c13942 | add indentby templatetag | marctc/django-extensions,levic/django-extensions,ctrl-alt-d/django-extensions,gvangool/django-extensions,joeyespo/django-extensions,gvangool/django-extensions,lamby/django-extensions,bionikspoon/django-extensions,zefciu/django-extensions,haakenlid/django-extensions,dpetzold/django-extensions,django-extensions/django-ex... | django_extensions/templatetags/indent_text.py | django_extensions/templatetags/indent_text.py | from django import template
register = template.Library()
class IndentByNode(template.Node):
def __init__(self, nodelist, indent_level, if_statement):
self.nodelist = nodelist
self.indent_level = template.Variable(indent_level)
if if_statement:
self.if_statement = template.Var... | mit | Python | |
4e638edfc8d6872374fdf696a35933e9592da6c0 | Add small logging sample | e4r7hbug/cli-fun | cli_fun/commands/logs.py | cli_fun/commands/logs.py | """Test out some logging concepts."""
import logging
import click
LOG = logging.getLogger(__name__)
@click.group()
def cli():
"""Demonstrate logging concepts."""
root_log = logging.root
root_log.setLevel(logging.DEBUG)
root_handler = logging.StreamHandler()
root_formatter = logging.Formatter(
... | mit | Python | |
4574347644eb6f36796784b5583bf2f651e15625 | add Button class just basic methods for drawing and click handle | lipk/pyzertz | pyzertz/button.py | pyzertz/button.py | import pygame
from pygame.locals import *
pygame.init()
class Button:
# rect: (int,int,int,int) : (x,y,length,height)
# text: ""
# action : func
# color: (int, int, int)
def __init__(self , x : int, y : int, length : int, height : int, color: (int,int,int), text : str, action : 'function' = No... | apache-2.0 | Python | |
29f8cc38a03f773726cfb1bce83eb3aaa34607fe | Add a TINA philosophers (Python) generator. | ahamez/caesar.sdd | samples/tina/genPhilos.py | samples/tina/genPhilos.py | #!/usr/bin/env python
import sys
#####################################################
one_philo_places = \
"""
pl P%(id)dThink (1)
pl P%(id)dHasLeft (0)
pl P%(id)dHasRight (0)
pl P%(id)dEat (0)
pl P%(id)dFork (1)
"""
#####################################################
one_philo_arcs = \
"""
# ... | bsd-2-clause | Python | |
efe39455fe6256a2a884f1740b93b0e9ab67c3a1 | Add async execution script | voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts | async-task.py | async-task.py | def run_seq(cmd):
"""Run `cmd` and yield its output lazily"""
p = subprocess.Popen(
cmd, shell=True,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
# make STDIN and STDOUT non-blocking
fcntl.fcntl(p.stdin, fcntl.F_SETFL, os.O_NONBLOCK)
fcntl... | mit | Python | |
82a54a33654eca6d8e760a5d77fe33d21da4a864 | Add scripts/update-version.py | tekezo/Karabiner-Elements,tekezo/Karabiner-Elements,tekezo/Karabiner-Elements,tekezo/Karabiner-Elements | scripts/update-version.py | scripts/update-version.py | #!/usr/bin/python3
import os
import re
import sys
from pathlib import Path
from itertools import chain
topDirectory = Path(__file__).resolve(True).parents[1]
with topDirectory.joinpath('version').open() as versionFile:
version = versionFile.readline().strip()
for templateFilePath in chain(topDirectory.rglob... | unlicense | Python | |
14e9a604ae9e8bba7723eababb8c0392aebb3b44 | Add archive | kate-v-stepanova/scilifelab,jun-wan/scilifelab,senthil10/scilifelab,jun-wan/scilifelab,kate-v-stepanova/scilifelab,senthil10/scilifelab,SciLifeLab/scilifelab,kate-v-stepanova/scilifelab,senthil10/scilifelab,senthil10/scilifelab,kate-v-stepanova/scilifelab,jun-wan/scilifelab,SciLifeLab/scilifelab,jun-wan/scilifelab,SciL... | scilifelab/lib/archive.py | scilifelab/lib/archive.py | """scilifelab lib module"""
import os
import re
import subprocess
from cStringIO import StringIO
from scilifelab.utils.misc import filtered_walk
import scilifelab.log
LOG = scilifelab.log.minimal_logger(__name__)
def flowcell_remove_status(archive_dir, swestore_dir, to_remove="to_remove"):
"""This function lo... | mit | Python | |
d8ee9154e2fba152fc83c910f728de0806ebb2f6 | update designexp module to handle MiSeq and HiSeq sample sheet | sequana/sequana,sequana/sequana,sequana/sequana,sequana/sequana,sequana/sequana | sequana/designexp.py | sequana/designexp.py | # -*- coding: utf-8 -*-
#
# This file is part of Sequana software
#
# Copyright (c) 2016 - Sequana Development Team
#
# File author(s):
# Thomas Cokelaer <thomas.cokelaer@pasteur.fr>
# Dimitri Desvillechabrol <dimitri.desvillechabrol@pasteur.fr>,
# <d.desvillechabrol@gmail.com>
#
# Distributed un... | bsd-3-clause | Python | |
0c1fe9fcb5bce2b7d3fb236de5d068c193cd539f | ADD algorithms | byung-u/ProjectEuler | algorithms.py | algorithms.py | #!/usr/bin/env python3
import operator
from math import sqrt
from functools import reduce
# p ∣ a (a divides b)
# p ∤ a (a does not divides b)
# 확장 유클리드 호제법을 이용한 부정방적식의 해 구하기
# https://en.wikibooks.org/wiki/Algorithm_Implementation/Mathematics/Extended_Euclidean_algorithm
# ax + by = g = gcd(a, b).
def xgcd(... | mit | Python | |
6085d7420577c9ea4f3a44fa1646b70807130952 | add top-level api module | jakevdp/altair,altair-viz/altair,ellisonbg/altair | altair/api.py | altair/api.py | from .v1.api import *
| bsd-3-clause | Python | |
789b2dd79ad022962133aec3a3fdea0e37eda693 | Add CircularQueue | xliiauo/leetcode,xiao0720/leetcode,xiao0720/leetcode,xliiauo/leetcode,xliiauo/leetcode | CircularQueue.py | CircularQueue.py | class CircularQueue:
class _Node:
__slots__ = '_element', '_next'
def __init__(self, element):
self._element = element
self._next = next
def __init__(self):
self._tail = None
self._size = 0
def __len__(self):
return self._size
def is_em... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.