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 |
|---|---|---|---|---|---|---|---|---|
7aabf3383b8386602ed77500ad3b4914028c97a4 | add tuple | bg1bgst333/Sample,bg1bgst333/Sample,bg1bgst333/Sample,bg1bgst333/Sample,bg1bgst333/Sample,bg1bgst333/Sample,bg1bgst333/Sample,bg1bgst333/Sample,bg1bgst333/Sample,bg1bgst333/Sample,bg1bgst333/Sample,bg1bgst333/Sample,bg1bgst333/Sample,bg1bgst333/Sample | python/tuple/tuple/src/tuple/tuple.py | python/tuple/tuple/src/tuple/tuple.py | #!/usr/bin/python
lst = [10, 20, 30]
print "lst = %s" % lst
lst[1] = 15
print "lst = %s" % lst
tpl = (100, 200, 300)
print tpl[0]
print tpl[1]
print tpl[2]
#tpl[1] = 150
| mit | Python | |
9ca2291f49188b5ecd6df09fd5230e321eb91b2d | Add FileHandler tests. | dvarrazzo/logbook,RazerM/logbook,maykinmedia/logbook,fayazkhan/logbook,Rafiot/logbook,DasIch/logbook,Rafiot/logbook,alonho/logbook,FintanH/logbook,Rafiot/logbook,maykinmedia/logbook,pombredanne/logbook,fayazkhan/logbook,mbr/logbook,alex/logbook,alex/logbook,alonho/logbook,redtoad/logbook,DasIch/logbook,mbr/logbook,DasI... | test_logbook.py | test_logbook.py | import logbook
import os
import shutil
import unittest
import tempfile
class LogbookTestCase(unittest.TestCase):
def setUp(self):
self.log = logbook.Logger('testlogger')
class BasicAPITestCase(LogbookTestCase):
def test_basic_logging(self):
handler = logbook.TestHandler()
with hand... | import unittest
import logbook
class BasicAPITestCase(unittest.TestCase):
def test_basic_logging(self):
logger = logbook.Logger('Test Logger')
handler = logbook.TestHandler()
with handler.contextbound(bubble=False):
logger.warn('This is a warning. Nice hah?')
assert ... | bsd-3-clause | Python |
f3522fedb75b72476419779850e7bbc5fa277c70 | Add generator | jmigual/IA2016,jmigual/IA2016 | Planificador/gamesCreator.py | Planificador/gamesCreator.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import random;
class Exercice:
def __init__(self, num, level):
self.preparator = []
self.precursor = []
self.num = num
self.level = level
def __cmp__(self, other):
if not isinstance(other, Exercice):
return NotImplemented
return self.num == other.num
def _... | mit | Python | |
0a501aca74224581228cf695d8d7d46d845ef8df | Create BPLY.py | icfaust/TRIPPy,icfaust/TRIPPy | BPLY.py | BPLY.py | import AXUV20
import surface
import geometry
| mit | Python | |
d1e6f060edd7b09f84892df95611fc3f52a6fb5a | Rename results file | chengsoonong/crowdastro,chengsoonong/crowdastro | crowdastro/experiment/results.py | crowdastro/experiment/results.py | """Object for storing experimental results.
Matthew Alger
The Australian National University
2016
"""
import h5py
import numpy
class Results(object):
"""Stores experimental results."""
def __init__(self, path, methods, n_splits, n_examples):
"""
path: Path to the results file (h5). File wil... | mit | Python | |
52f5eb3e39d7cc01d2d149d87eb63086028ca265 | add integration tests for settings | gentoo/identity.gentoo.org,dastergon/identity.gentoo.org,dastergon/identity.gentoo.org,gentoo/identity.gentoo.org | okupy/tests/integration/test_settings.py | okupy/tests/integration/test_settings.py | # vim:fileencoding=utf8:et:ts=4:sts=4:sw=4:ft=python
from django.conf import settings
from django.test import TestCase
from django.test.client import Client
from mockldap import MockLdap
from okupy.tests import vars
class SettingsIntegrationTests(TestCase):
@classmethod
def setUpClass(cls):
cls.mock... | agpl-3.0 | Python | |
fd540540fa269279502b89ef83f1daaf38210162 | move only module to __init__.py | bobpoekert/trulia_fetcher | __init__.py | __init__.py | import requests, re, json
import lxml.etree
import lxml.html.soupparser
user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/536.26.14 (KHTML, like Gecko) Version/6.0.1 Safari/536.26.14'
json_getter = re.compile(r'trulia\.propertyData\.set\((.*?)\);')
def get(url):
return requests.get(url, he... | mit | Python | |
b1b9d1c9e46bcc92c9046450d92ae8e89f2d2998 | Create __init__.py | Strain88/VKapi2 | __init__.py | __init__.py | __version__ = '0.9.5'
from VKapi2.exceptions import ApiException
from VKapi2.api import Api
from VKapi2.api import ApiHelper
import sys
import logging
import requests
logger = logging.getLogger('VK_api_2')
formatter = logging.Formatter(
'%(asctime)s (%(filename)s:%(lineno)d %(threadName)s) %(levelname)s - %(nam... | mit | Python | |
5f80b313c436bdac9eb8db4e9f835a210833c106 | Add __init__.py. | DiscoViking/pyicemon,DiscoViking/pyicemon | __init__.py | __init__.py | import messages
from connection import Connection
from monitor import Monitor
from publisher import Publisher
| mit | Python | |
c5f16d5d8c85383a3735b871962f70509109ebd7 | Create __init__.py | deepak223098/Data_Science_Python | __init__.py | __init__.py | bsd-3-clause | Python | ||
a3e3b5f0964d700732d623a3dcafb0056f4eb1eb | Update __version__ | jleclanche/dj-stripe,mthornhill/dj-stripe,jleclanche/dj-stripe,kavdev/dj-stripe,doctorwidget/dj-stripe,cjrh/dj-stripe,pydanny/dj-stripe,doctorwidget/dj-stripe,photocrowd/dj-stripe,cjrh/dj-stripe,dj-stripe/dj-stripe,mthornhill/dj-stripe,jameshiew/dj-stripe,jameshiew/dj-stripe,pydanny/dj-stripe,tkwon/dj-stripe,dj-stripe/... | djstripe/__init__.py | djstripe/__init__.py | from __future__ import unicode_literals
import warnings
from django import get_version as get_django_version
__title__ = "dj-stripe"
__summary__ = "Django + Stripe Made Easy"
__uri__ = "https://github.com/pydanny/dj-stripe/"
__version__ = "0.7.0-dev"
__author__ = "Daniel Greenfeld"
__email__ = "pydanny@gmail.com"
... | from __future__ import unicode_literals
import warnings
from django import get_version as get_django_version
__title__ = "dj-stripe"
__summary__ = "Django + Stripe Made Easy"
__uri__ = "https://github.com/pydanny/dj-stripe/"
__version__ = "0.5.0"
__author__ = "Daniel Greenfeld"
__email__ = "pydanny@gmail.com"
__li... | mit | Python |
57bd45f13a091dd6fe40ecd960dc7e6b00d60def | support for epics ioc to host XRF scan plans. | NSLS-II-SRX/ipython_ophyd,NSLS-II-SRX/ipython_ophyd,NSLS-II-SRX/ipython_ophyd | profile_xf05id1/startup/30-scanutils.py | profile_xf05id1/startup/30-scanutils.py | from ophyd import EpicsSignal,EpicsSignalRO,Device
from ophyd import Component as Cpt
class SRXScanRecord(Device):
class OneScan(Device):
p1s = Cpt(EpicsSignal, 'P1-S')
p2s = Cpt(EpicsSignal, 'P2-S')
p1i = Cpt(EpicsSignal, 'P1-I')
p2i = Cpt(EpicsSignal, 'P2-I')
p1stp = Cpt(... | bsd-2-clause | Python | |
71c8e8e3d6395b51a453e591bee882cd3e024d26 | Create solve-the-equation.py | kamyu104/LeetCode,kamyu104/LeetCode,yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,yiwen-luo/LeetCode,yiwen-luo/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-2... | Python/solve-the-equation.py | Python/solve-the-equation.py | # Time: O(n)
# Space: O(n)
# Solve a given equation and return the value of x in the form of string "x=#value".
# The equation contains only '+', '-' operation, the variable x and its coefficient.
#
# If there is no solution for the equation, return "No solution".
#
# If there are infinite solutions for the equation,... | mit | Python | |
97bf042815dff04a87b3321d1c269036ab9e7794 | Create __init__.py | ninjawil/weather-station,ninjawil/weather-station,ninjawil/weather-station,ninjawil/weather-station,ninjawil/weather-station,ninjawil/weather-station,ninjawil/weather-station | __init__.py | __init__.py | mit | Python | ||
73ce4aafc7eed616adb36a9b9f7268b696fbd489 | Create __init__.py | sanmik/brain_network_viz,sanmik/brain_network_viz | __init__.py | __init__.py | from source import networkviz as networkviz
| mit | Python | |
4dc7c6be7b3f6741e787731801b4d853c1f24f1f | Add mkerefuse.__main__ module | tomislacker/python-mke-trash-pickup,tomislacker/python-mke-trash-pickup | mkerefuse/__main__.py | mkerefuse/__main__.py | #!/usr/bin/env python3
"""
Looks up addresses to discover future garbage and/or recycle pickup dates
within the city of Milwaukee, WI
Usage:
mkerefuse --help
mkerefuse [options]
Options:
-a, --address STRING House number
-d, --direction STRING Address direction (N, S, E, W)
-s, --stre... | unlicense | Python | |
bf05dd9c1b39c8752aae60997fe5aca6e5572584 | Create gae_pylint_plugin.py | tianhuil/gae_pylint_plugin | gae_pylint_plugin.py | gae_pylint_plugin.py | from astroid import MANAGER
from astroid import scoped_nodes
NDB_PROPERTIES = [
'DateTimeProperty',
'StringProperty',
'KeyProperty',
'StructuredProperty'
]
def register(linter):
pass
def transform(modu):
if modu.name == 'google.appengine.ext.ndb':
for f in NDB_PROPERTIES:
... | apache-2.0 | Python | |
e0ae0c605fd30f4f303abf390aaa6cbfa18cee39 | Bump version 1.22.3 | akittas/geocoder,DenisCarriere/geocoder | geocoder/__init__.py | geocoder/__init__.py | #!/usr/bin/python
# coding: utf8
from __future__ import absolute_import
"""
Geocoder
~~~~~~~~
Simple and consistent geocoding library written in Python.
Many online providers such as Google & Bing have geocoding services,
these providers do not include Python libraries and have different
JSON responses between each... | #!/usr/bin/python
# coding: utf8
from __future__ import absolute_import
"""
Geocoder
~~~~~~~~
Simple and consistent geocoding library written in Python.
Many online providers such as Google & Bing have geocoding services,
these providers do not include Python libraries and have different
JSON responses between each... | mit | Python |
463de112add0178b6e3aa13b75bc7ae8dc26b612 | Create __openerp__.py | Therp/message_box_wizard | __openerp__.py | __openerp__.py | # -*- encoding: utf-8 -*-
{
'name': 'Message box dialog',
'application': False,
'version': '8.0.r1.0',
'category': 'General',
'description': '''
Allows to ask a question through a dialog.
Via a wizard your question is asked.
Buttons can be hidden or their labels can be set
* Creates a record in m... | agpl-3.0 | Python | |
cf060a473bb2412f97301ab72f96a57d370bc79f | Add IncrementalModel | bgyori/indra,johnbachman/indra,sorgerlab/indra,johnbachman/belpy,sorgerlab/belpy,pvtodorov/indra,sorgerlab/belpy,pvtodorov/indra,sorgerlab/belpy,johnbachman/belpy,jmuhlich/indra,pvtodorov/indra,pvtodorov/indra,bgyori/indra,bgyori/indra,sorgerlab/indra,johnbachman/indra,johnbachman/belpy,sorgerlab/indra,jmuhlich/indra,j... | models/rasmachine/incremental_model.py | models/rasmachine/incremental_model.py | import pickle
from indra.assemblers import PysbAssembler
class IncrementalModel(object):
def __init__(self, fname=None):
if fname is None:
self.stmts = {}
else:
try:
self.stmts = pickle.load(open(fname, 'rb'))
except:
print 'Could ... | bsd-2-clause | Python | |
12e7e7b29a91e67755c5d9b9e29b4a8614def1bc | Add module disable framework | Motoko11/MotoBot | motobot/core_plugins/disable_module.py | motobot/core_plugins/disable_module.py | from motobot import command, request, IRCLevel, Priority, Notice, split_response
@request('GET_PLUGINS')
def disabled_request(bot, context, channel):
disabled = context.database.get({}).get(channel.lower(), set())
return filter_plugins(bot.plugins, disabled)
def filter_plugins(plugins, disabled):
return... | mit | Python | |
7c4e265808440c8e670651660909e61498c496a0 | add dijkstrashortreach | EdisonAlgorithms/HackerRank,EdisonAlgorithms/HackerRank,EdisonCodeKeeper/hacker-rank,EdisonAlgorithms/HackerRank,EdisonCodeKeeper/hacker-rank,EdisonAlgorithms/HackerRank,zeyuanxy/hacker-rank,EdisonCodeKeeper/hacker-rank,EdisonCodeKeeper/hacker-rank,EdisonCodeKeeper/hacker-rank,zeyuanxy/hacker-rank,zeyuanxy/hacker-rank,... | algorithms/graph-theory/dijkstrashortreach/dijkstrashortreach.py | algorithms/graph-theory/dijkstrashortreach/dijkstrashortreach.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Zeyuan Shang
# @Date: 2015-12-26 16:28:23
# @Last Modified by: Zeyuan Shang
# @Last Modified time: 2015-12-26 16:28:36
import sys
import queue
class Vertex:
def __init__(self):
self.edges = {}
def get_edges(self):
return self.edges
... | mit | Python | |
8ee4cef9689ee8a73e3952d46dc93908208b84ea | Add second passing test | DoWhileGeek/google_foobar | maximum_equality.py | maximum_equality.py | '''
Maximum equality
================
Your colleague Beta Rabbit, top notch spy and saboteur, has been working tirelessly to discover a way to break into Professor Boolean's lab and rescue the rabbits being held inside. He has just excitedly informed you of a breakthrough - a secret bridge that leads over a moat (like... | unlicense | Python | |
cd325c15dd23d1047dc0ca8fc5108ee93e38568d | Create บวกลบธรรมดา.py | wannaphongcom/code-python3-blog | บวกลบธรรมดา.py | บวกลบธรรมดา.py | __author__ = 'วรรณพงษ์'
#import re
print("Text")
a = input("Text")
if a.find("+"):
s = a.split("+")
in1 = int(s[0])
in2 = int(s[1])
cal = in1 + in2
elif a.find("-"):
s = a.split("-")
in1 = int(s[0])
in2 = int(s[1])
cal = in1 - in2
elif a.find("*"):
s = a.split("*")
in1 = int(s[0]... | mit | Python | |
0f1003cf17acdb3ee9b9614131f7e8d7c9cebb41 | add list of events | ciappi/Yaranullin | yaranullin/events.py | yaranullin/events.py | # yaranullin/events.py
#
# Copyright (c) 2012 Marco Scopesi <marco.scopesi@gmail.com>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS... | isc | Python | |
1c09bfb7c999fba548730a5a9249455f709d7f16 | Convert contribution zip codes to county names | srwareham/CampaignAdvisor,srwareham/CampaignAdvisor,srwareham/CampaignAdvisor,srwareham/CampaignAdvisor | data_cleanup/data_cleanup.py | data_cleanup/data_cleanup.py | import os
import pandas as pd
import csv
# Directory path constants
ROOT_PATH = os.path.abspath(__file__ + "/../../")
DATA_DIR_PATH = os.path.join(ROOT_PATH, "data_files")
# File path constants
CONTRIBUTIONS_PATH = os.path.join(DATA_DIR_PATH, "contributions.csv")
ZIP_CODES_PATH = os.path.join(DATA_DIR_PATH, "zip_code... | mit | Python | |
39f2b145aebbc68ce8e07bc38ff553d5414393bb | add handcontrolmacros.py, not used for now | openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro | software/ddapp/src/python/ddapp/handcontrolmacros.py | software/ddapp/src/python/ddapp/handcontrolmacros.py |
class HandControlMacros(object):
@staticmethod
def openLeft():
handcontrolpanel.panel.ui.leftButton.click()
handcontrolpanel.panel.ui.openButton.animateClick()
@staticmethod
def openRight():
handcontrolpanel.panel.ui.rightButton.click()
handcontrolpanel.panel.ui.openB... | bsd-3-clause | Python | |
fe25d61a64d81a5958ab4e2f099ffde3f19d94c9 | Add simple oscillator animation | kpj/OsciPy | animator.py | animator.py | """
Animate evolution of system of oscillators
"""
import numpy as np
import networkx as nx
import matplotlib as mpl
mpl.use('Agg', force=True)
import matplotlib.pylab as plt
import matplotlib.animation as animation
from tqdm import tqdm
from scarce_information import System
class Animator(object):
"""
Ge... | mit | Python | |
252e81efb687fecc1961a908444d0f096e9587b5 | rename pieChart example | pignacio/python-nvd3,Coxious/python-nvd3,liang42hao/python-nvd3,oz123/python-nvd3,liang42hao/python-nvd3,oz123/python-nvd3,vdloo/python-nvd3,yelster/python-nvd3,mgx2/python-nvd3,vdloo/python-nvd3,pignacio/python-nvd3,Coxious/python-nvd3,BibMartin/python-nvd3,oz123/python-nvd3,yelster/python-nvd3,Coxious/python-nvd3,Bib... | examples/pieChart.py | examples/pieChart.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Examples for Python-nvd3 is a Python wrapper for NVD3 graph library.
NVD3 is an attempt to build re-usable charts and chart components
for d3.js without taking away the power that d3.js gives you.
Project location : https://github.com/areski/python-nvd3
"""
from nvd3 imp... | mit | Python | |
e8e8a07ba70ff3defbc529b6619054001cb692b0 | Add RemoveOutliers python example | jaehyuk/learning-spark,databricks/learning-spark,diogoaurelio/learning-spark,jindalcastle/learning-spark,qingkaikong/learning-spark-examples,coursera4ashok/learning-spark,coursera4ashok/learning-spark,tengteng/learning-spark,junwucs/learning-spark,huydx/learning-spark,GatsbyNewton/learning-spark,kpraveen420/learning-sp... | src/python/RemoveOutliers.py | src/python/RemoveOutliers.py | """
>>> from pyspark.context import SparkContext
>>> sc = SparkContext('local', 'test')
>>> b = sc.parallelize([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1000])
>>> sorted(removeOutliers(b).collect()
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
"""
import sys
import math
from pyspark import SparkContext
def removeOutliers(nums):
"""Rem... | mit | Python | |
9ab0ead47220d704a3c80cae25ddd05afac55271 | Add example plugin to solve with angr | Vector35/binaryninja-api,joshwatson/binaryninja-api,Vector35/binaryninja-api,joshwatson/binaryninja-api,Vector35/binaryninja-api,Vector35/binaryninja-api,Vector35/binaryninja-api,Vector35/binaryninja-api,joshwatson/binaryninja-api,joshwatson/binaryninja-api,joshwatson/binaryninja-api,Vector35/binaryninja-api | python/examples/angr_plugin.py | python/examples/angr_plugin.py | # This plugin assumes angr is already installed and available on the system. See the angr documentation
# for information about installing angr. It should be installed using the virtualenv method.
#
# This plugin is currently only known to work on Linux using virtualenv. Switch to the virtual environment
# (using a com... | mit | Python | |
2c651b7083ec368ebf226364a1a1aba5f5ec147e | Add migration for datetime change. | hoosteeno/fjord,DESHRAJ/fjord,staranjeet/fjord,hoosteeno/fjord,lgp171188/fjord,DESHRAJ/fjord,hoosteeno/fjord,Ritsyy/fjord,staranjeet/fjord,lgp171188/fjord,rlr/fjord,rlr/fjord,staranjeet/fjord,hoosteeno/fjord,lgp171188/fjord,staranjeet/fjord,rlr/fjord,mozilla/fjord,mozilla/fjord,lgp171188/fjord,Ritsyy/fjord,Ritsyy/fjord... | fjord/feedback/migrations/0003_auto__chg_field_simple_created.py | fjord/feedback/migrations/0003_auto__chg_field_simple_created.py | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Simple.created'
db.alter_column('feedback_simple', 'created', self.gf('django.db.models.f... | bsd-3-clause | Python | |
b4fe0a903e5a7bff2dca0c6c7c66613d27d14ef9 | add defalt tests | shtalinberg/django-actions-logger,shtalinberg/django-actions-logger | actionslog/tests/__init__.py | actionslog/tests/__init__.py | """Test model definitions."""
from __future__ import unicode_literals
from django.core.management import call_command
call_command('makemigrations', verbosity=0)
call_command('migrate', verbosity=0) | mit | Python | |
6e77dbbad4cde687ab112c7c0a5da2a958a3ea42 | Add synthtool scripts (#3765) | googleapis/google-cloud-java,googleapis/google-cloud-java,googleapis/google-cloud-java | java-websecurityscanner/google-cloud-websecurityscanner/synth.py | java-websecurityscanner/google-cloud-websecurityscanner/synth.py | # Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | apache-2.0 | Python | |
4677085404e41dac88b92418bbc46c6a1dea30df | Add snapshot function. | fuziontech/pgshovel,fuziontech/pgshovel,fuziontech/pgshovel,disqus/pgshovel,disqus/pgshovel | src/main/python/pgshovel/snapshot.py | src/main/python/pgshovel/snapshot.py | import collections
from contextlib import contextmanager
from psycopg2.extensions import ISOLATION_LEVEL_REPEATABLE_READ
@contextmanager
def prepare(connection, table):
"""
Prepares a function that can be used to take a consistent snapshot of a set
of capture groups by their primary keys.
"""
con... | apache-2.0 | Python | |
3e5abf8d7a265e5b873336db04945fca591afb80 | add Read_xls.py file | wyblzu/Python_GDAL | Read_xls.py | Read_xls.py | __author__ = 'wyb'
# -*- coding:utf-8 -*-
# testing gdal-lib
import gdal
import numpy
import struct
from gdalconst import *
dataset = gdal.Open('/home/wyb/data/SPOT.img', GA_ReadOnly)
if dataset is None:
print 'Nodata'
else:
print 'Driver:', dataset.GetDriver().ShortName, '/', \
dataset.GetDriver().Long... | mit | Python | |
e80b1f81152313947b1a94efe78279b575186731 | Create autoexec.py | matbor/mqtt2xbmc-notifications | autoexec.py | autoexec.py | #!/usr/bin/python
#
# XBMC MQTT Subscriber and custom popup
# october 2013 v1.0
#
# by Matthew Bordignon @bordignon
#
# Format mqtt message using json
# {"lvl":"1","sub":"xxxxxx","txt":"xxxxxx","img":"xxx","del":"10000"}
# {"lvl":"level either 1 or 2","sub":"subject text","txt":"main text 150 characters m... | mit | Python | |
635ed78543b3e3e8fe7c52fa91ee8516d617249d | Add client sample for test - Connect to server - Receive data from server - Strip the data and print | peitaosu/motion-tools | data-travel/test_client.py | data-travel/test_client.py | from socket import *
host = '127.0.0.1'
port = 1234
bufsize = 1024
addr = (host, port)
client = socket(AF_INET, SOCK_STREAM)
client.connect(addr)
while True:
data = client.recv(bufsize)
if not data:
break
print data.strip()
client.close() | apache-2.0 | Python | |
40c19953e55e11a8b7e48e9894d8dd2322d6bd11 | Add engine zoom functions | shivnshu/AMR-System,shivnshu/AMR-System,shivnshu/AMR-System,shivnshu/AMR-System | temp_volume.py | temp_volume.py | #!/usr/bin/env python
from __future__ import print_function
from OCC.STEPControl import STEPControl_Reader
from OCC.IFSelect import IFSelect_RetDone, IFSelect_ItemsByEntity
from OCC.Display.SimpleGui import init_display
from OCC.gp import gp_Ax1, gp_Pnt, gp_Dir, gp_Trsf
from OCC.BRepPrimAPI import BRepPrimAPI_MakeBox... | mit | Python | |
e9979dc54b884c8a300cc3d663e44c793b7afd57 | Add script term-weight.py, computting term-weight for query/bidword. | SnakeHunt2012/word2vec,SnakeHunt2012/word2vec,SnakeHunt2012/word2vec,SnakeHunt2012/word2vec,SnakeHunt2012/word2vec | term-weight.py | term-weight.py | #!/usr/bin/env python
# -*- coding: utf-8
from codecs import open
from argparse import ArgumentParser
def load_entropy_dict(entropy_file):
entropy_dict = {}
with open(entropy_file, 'r') as fd:
for line in fd:
splited_line = line.strip().split("\t")
if len(splited_line) != 2:
... | apache-2.0 | Python | |
769a255fbcaf1b657f1a76ff89d3ffa6998e4ada | Support unix socket connections in redis pool | BuildingLink/sentry,alexm92/sentry,daevaorn/sentry,fotinakis/sentry,daevaorn/sentry,gencer/sentry,ifduyue/sentry,jean/sentry,mvaled/sentry,ifduyue/sentry,zenefits/sentry,ifduyue/sentry,JamesMura/sentry,gencer/sentry,mvaled/sentry,JackDanger/sentry,zenefits/sentry,fotinakis/sentry,nicholasserra/sentry,zenefits/sentry,al... | src/sentry/utils/redis.py | src/sentry/utils/redis.py | from __future__ import absolute_import
from threading import Lock
import rb
from redis.connection import ConnectionPool
from sentry.exceptions import InvalidConfiguration
from sentry.utils.versioning import (
Version,
check_versions,
)
_pool_cache = {}
_pool_lock = Lock()
def _shared_pool(**opts):
if... | from __future__ import absolute_import
from threading import Lock
import rb
from redis.connection import ConnectionPool
from sentry.exceptions import InvalidConfiguration
from sentry.utils.versioning import (
Version,
check_versions,
)
_pool_cache = {}
_pool_lock = Lock()
def _shared_pool(**opts):
ke... | bsd-3-clause | Python |
8dcda61421af49320aa7865d9a51847a94dc1904 | Create retrieve_lowest_fares_to_db.py | jebstone/datascience | retrieve_lowest_fares_to_db.py | retrieve_lowest_fares_to_db.py | # -*- coding: utf-8 -*-
"""
Retrieve airfare pricing data, for a list of routekeys, from an internal API. Load to a database.
"""
from __future__ import print_function, division, absolute_import, unicode_literals
import requests
import json
import datetime
import pyodbc as db
import datetime
import time
# Database C... | unlicense | Python | |
3222504bd076368c7a3069f9accf2627ad1dab86 | Add __init__ to repo root for subclassing | Dinh-Hung-Tu/rivescript-python,Dinh-Hung-Tu/rivescript-python,plasmashadow/rivescript-python,aichaos/rivescript-python,aichaos/rivescript-python,plasmashadow/rivescript-python,aichaos/rivescript-python,FujiMakoto/makoto-rivescript,FujiMakoto/makoto-rivescript,plasmashadow/rivescript-python,Dinh-Hung-Tu/rivescript-pytho... | __init__.py | __init__.py | from rivescript import RiveScript
| mit | Python | |
849adb1ea4c6ff46145e18dbe4fd949b5d5a4d7d | Create __init__.py | TryCatchHCF/DumpsterFire | __init__.py | __init__.py | mit | Python | ||
4d8aaca73a8dbe8895ca4a523828fbb7ecd3fc7f | Add __init__ file | snapbill/snapbill-pyapi | __init__.py | __init__.py | from snapbill import *
| mit | Python | |
b64e7af67161fecb7aec8797497e1d3a4f3e91fe | complete 35 circular primes | dawran6/project-euler | 35-circular-primes.py | 35-circular-primes.py | from utils import prime_gen
def rotate(l):
for x in range(len(l)):
yield l[-x:] + l[:-x]
def circular_primes():
p = prime_gen()
while True:
prime = next(p)
if prime > 1_000_000:
break
else:
s.add(str(prime))
for prime in s:
if all((''.joi... | mit | Python | |
313e9cae068192fe11ad10ea0b5c05061b0e5c60 | Add unit test for _validate_key_file_permissions in ec2 module | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | tests/unit/cloud/clouds/ec2_test.py | tests/unit/cloud/clouds/ec2_test.py | # -*- coding: utf-8 -*-
# Import Python libs
from __future__ import absolute_import
import os
import tempfile
# Import Salt Libs
from salt.cloud.clouds import ec2
from salt.exceptions import SaltCloudSystemExit
# Import Salt Testing Libs
from salttesting import TestCase, skipIf
from salttesting.mock import MagicMock... | apache-2.0 | Python | |
22f57f6490826b99e35b80d85837c95921cd6c97 | add test to reproduce keyerror | zestyr/lbry,zestyr/lbry,lbryio/lbry,lbryio/lbry,zestyr/lbry,lbryio/lbry | tests/unit/dht/test_routingtable.py | tests/unit/dht/test_routingtable.py | import unittest
from lbrynet.dht import contact, routingtable, constants
class KeyErrorFixedTest(unittest.TestCase):
""" Basic tests case for boolean operators on the Contact class """
def setUp(self):
own_id = (2 ** constants.key_bits) - 1
# carefully chosen own_id. here's the logic
... | mit | Python | |
0202f0bd4358d68917af19910bb4e1f0a3dda602 | Add usb bridge test(CDC & HID) | archangdcc/avalon-extras,archangdcc/avalon-extras,Canaan-Creative/Avalon-extras,archangdcc/avalon-extras,Canaan-Creative/Avalon-extras,qinfengling/Avalon-extras,qinfengling/Avalon-extras,qinfengling/Avalon-extras,Canaan-Creative/Avalon-extras,archangdcc/avalon-extras,Canaan-Creative/Avalon-extras,qinfengling/Avalon-ext... | scripts/avalon-usb2iic-test.py | scripts/avalon-usb2iic-test.py | #!/usr/bin/env python2.7
# This script aim to make a loopback test on cdc or hid.
# The statics is used for comparison, it is not accurate.
from serial import Serial
from optparse import OptionParser
import time
import binascii
import usb.core
import usb.util
import sys
parser = OptionParser()
parser.add_option("-M"... | unlicense | Python | |
33028c8955e8d1b65416e52169a53b40d9a0dbe4 | add new package : rt-tests (#14174) | LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack | var/spack/repos/builtin/packages/rt-tests/package.py | var/spack/repos/builtin/packages/rt-tests/package.py | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RtTests(Package):
"""
Suite of real-time tests - cyclictest, hwlatdetect, pip_stress,
... | lgpl-2.1 | Python | |
058380775fcfed77373512946c4a32b9df4aac87 | add benchmark for signal.lfilter. Follow-up of gh-4628. | niknow/scipy,e-q/scipy,aeklant/scipy,anielsen001/scipy,bkendzior/scipy,surhudm/scipy,bkendzior/scipy,grlee77/scipy,jjhelmus/scipy,e-q/scipy,jamestwebber/scipy,ilayn/scipy,Gillu13/scipy,josephcslater/scipy,Eric89GXL/scipy,gdooper/scipy,mikebenfield/scipy,mdhaber/scipy,anntzer/scipy,niknow/scipy,ilayn/scipy,befelix/scipy... | benchmarks/benchmarks/signal_filtering.py | benchmarks/benchmarks/signal_filtering.py | from __future__ import division, absolute_import, print_function
import numpy as np
try:
from scipy.signal import lfilter, firwin
except ImportError:
pass
from .common import Benchmark
class Lfilter(Benchmark):
param_names = ['n_samples', 'numtaps']
params = [
[1e3, 50e3, 1e6],
[9, ... | bsd-3-clause | Python | |
fd838bdb57d126464042e074a80148beb8a3cd01 | Create rob_client.py | carlfsmith/LunaBot,carlfsmith/LunaBot,carlfsmith/LunaBot,carlfsmith/LunaBot,carlfsmith/LunaBot | Control/rob_client.py | Control/rob_client.py | # -----------------------
# Author: Alex Anderson
# Purpose: Send commands to server on robot
# with IP address of self.HOST based
# on the activity of the hat/D-pad of
# a joystick/gamepad
# Date: 11/20/13
# ---------------------------
import socket
from gamepad_manager import * #gampad_manager must be in the... | apache-2.0 | Python | |
4c925c6134e705dd5f304a983c66ad60ce6bf901 | add diagnostic | akrherz/idep,akrherz/idep,akrherz/dep,akrherz/dep,akrherz/idep,akrherz/idep,akrherz/dep,akrherz/dep,akrherz/idep,akrherz/dep,akrherz/idep | scripts/plots/huc12_flowpath_counts.py | scripts/plots/huc12_flowpath_counts.py | """Diagnostic on HUC12 flowpath counts."""
import numpy as np
import cartopy.crs as ccrs
from matplotlib.patches import Polygon
import matplotlib.colors as mpcolors
from geopandas import read_postgis
from pyiem.util import get_dbconn
from pyiem.plot.use_agg import plt
from pyiem.plot.geoplot import MapPlot
def main(... | mit | Python | |
3a285bcb6bf06df1d0e8f60a8e754280a9f05dd9 | Copy arp_request.py to arp_fake.py. | bluhm/arp-regress | arp_fake.py | arp_fake.py | #!/usr/local/bin/python2.7
# send Address Resolution Protocol Request
# expect Address Resolution Protocol response and check all fields
# RFC 826 An Ethernet Address Resolution Protocol
# Packet Generation
import os
from addr import *
from scapy.all import *
arp=ARP(op='who-has', hwsrc=LOCAL_MAC, psrc=LOCAL_ADDR,
... | isc | Python | |
05635750a53a5a6f72a90eecea74a08e11a11ca8 | Add 37signals products | foauth/foauth.org,foauth/foauth.org,foauth/foauth.org,foauth/oauth-proxy | services/thirtysevensignals.py | services/thirtysevensignals.py | from werkzeug.urls import url_decode
import foauth.providers
class ThirtySevenSignals(foauth.providers.OAuth2):
# General info about the provider
alias = '37signals'
name = '37signals'
provider_url = 'https://37signals.com/'
docs_url = 'https://github.com/37signals/api'
category = 'Productivit... | bsd-3-clause | Python | |
470085c992a393522a13a5b6d8243f30fff57a80 | add activate_this.py | N4NU/mn-darts,N4NU/mn-darts | env/Scripts/activate_this.py | env/Scripts/activate_this.py | """By using execfile(this_file, dict(__file__=this_file)) you will
activate this virtualenv environment.
This can be used when you must use an existing Python interpreter, not
the virtualenv bin/python
"""
try:
__file__
except NameError:
raise AssertionError(
"You must run this like execfile('path/to/... | mit | Python | |
7e3fb49043503dc6aa5375c4e27ea770052e615c | Add audiofile_source example | kivy/audiostream,kivy/audiostream,kivy/audiostream | examples/audiofile_source.py | examples/audiofile_source.py | import sys
from time import sleep
import librosa
import numpy as np
from audiostream import get_output
from audiostream.sources.thread import ThreadSource
class MonoAmplitudeSource(ThreadSource):
"""A data source for float32 mono binary data, as loaded by libROSA/soundfile."""
def __init__(self, stream, data,... | mit | Python | |
9dbd9d7b409afe18677a69d72339d040043a9087 | add urls to the audio appl | armstrong/armstrong.apps.audio | armstrong/apps/audio/urls.py | armstrong/apps/audio/urls.py | from django.conf.urls.defaults import *
from armstrong.apps.audio import views as AudioViews
urlpatterns = patterns('',
url(r'^$', AudioViews.AudioPublicationList.as_view(),
name='audio_list'),
url(r'^upload/$', AudioViews.AudioPublicationCreateView.as_view(),
name='audio_uplo... | apache-2.0 | Python | |
914f06c999f5c540c2feb6ab8825c1ced4246ed2 | Support sessions | drgarcia1986/muffin,klen/muffin | muffin/plugins/session.py | muffin/plugins/session.py | import base64
import hashlib
import hmac
import time
import asyncio
import ujson as json
from . import BasePlugin
class SessionPlugin(BasePlugin):
""" Support sessions. """
name = 'session'
defaults = {
'secret': 'InsecureSecret',
}
def setup(self, app):
""" Initialize the app... | mit | Python | |
977ec87292c10e21b22f9fe77b248ee83a87147d | Add basic tests | ijks/textinator | tests/tests.py | tests/tests.py | import unittest
from textinator import calculate_size
class CalculateSizeTestCase(unittest.TestCase):
"""Tests for calculate_size()"""
def test_width_no_height(self):
self.assertEqual(calculate_size((1920, 1080), (20, None)),
(20, 11))
self.assertEqual(calculate_size((500, ... | mit | Python | |
a36606beffbd65dc5e09e89aea312e6be2552be0 | Create sort_date.py | jeonghoonkang/BerePi,jeonghoonkang/BerePi,jeonghoonkang/BerePi,jeonghoonkang/BerePi,jeonghoonkang/BerePi,jeonghoonkang/BerePi,jeonghoonkang/BerePi | apps/camera/file_sweeper/sort_date.py | apps/camera/file_sweeper/sort_date.py |
#-*-coding:utf8-*-
#!/usr/bin/python
# Author : Jeonghoonkang, github.com/jeonghoonkang
| bsd-2-clause | Python | |
2fa7048351f249b3731d15e04cfb917083074eca | add arabic morphological analysis demo | motazsaad/comparable-text-miner | arabic-morphological-analysis-demo.py | arabic-morphological-analysis-demo.py | # coding: utf-8
import sys
##################################################################
def usage():
print 'Usage: ', sys.argv[0], '<inputfile> <outputfile>'
##################################################################
if len(sys.argv) < 3: usage(); sys.exit(2)
'''
Demo of Arabic morphological analysis... | apache-2.0 | Python | |
46200af23e98aefbde2140cd63d850d7ae5c5632 | Create EuclideanAlgorithm.py | Chuck8521/LunchtimeBoredom,Chuck8521/LunchtimeBoredom,Chuck8521/LunchtimeBoredom | EuclideanAlgorithm.py | EuclideanAlgorithm.py | trueA = input('Larger number: ')
trueB = input('Smaller number: ')
a = trueA
b = trueB
while a % b != 0:
oldA = a
equation = str(a) + ' = ' + str(a/b) + ' * ' + str(b) + ' + ' + str(a%b)
print(equation)
a = b
b = oldA % b
gcf = b
print('The GCF is: ' + str(gcf))
| mit | Python | |
e9ed96d606e2fc8db1e9e36978b48d725f925bb0 | Add octogit.__main__ for testing | myusuf3/octogit | octogit/__main__.py | octogit/__main__.py | from . import cli
cli.begin()
| mit | Python | |
c10d60911d870910d389668f6c99df694e9d914c | add registry test | dannygoldstein/sncosmo,sncosmo/sncosmo,dannygoldstein/sncosmo,kbarbary/sncosmo,sncosmo/sncosmo,kbarbary/sncosmo,sncosmo/sncosmo,dannygoldstein/sncosmo,kbarbary/sncosmo | sncosmo/tests/test_registry.py | sncosmo/tests/test_registry.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Test registry functions."""
import numpy as np
import sncosmo
def test_register():
disp = np.array([4000., 4200., 4400., 4600., 4800., 5000.])
trans = np.array([0., 1., 1., 1., 1., 0.])
band = sncosmo.Bandpass(disp, trans, name='tophatg')
... | bsd-3-clause | Python | |
872dcfd02b9c136d781abf15df38c71a234f82c0 | remove unneeded sleep | Hutspace/odekro,mysociety/pombola,hzj123/56th,ken-muturi/pombola,ken-muturi/pombola,mysociety/pombola,Hutspace/odekro,hzj123/56th,Hutspace/odekro,geoffkilpin/pombola,mysociety/pombola,patricmutwiri/pombola,ken-muturi/pombola,Hutspace/odekro,Hutspace/odekro,mysociety/pombola,hzj123/56th,ken-muturi/pombola,ken-muturi/pom... | mzalendo/hansard/tests.py | mzalendo/hansard/tests.py | import os
import datetime
import time
from django.test import TestCase
from hansard.models import Source
class HansardTest(TestCase):
def setUp(self):
source = Source(
name = 'Test Source',
url = 'http://www.mysociety.org/robots.txt',
date = datetime.date( 2001, 11, 1... | import os
import datetime
import time
from django.test import TestCase
from hansard.models import Source
class HansardTest(TestCase):
def setUp(self):
source = Source(
name = 'Test Source',
url = 'http://www.mysociety.org/robots.txt',
date = datetime.date( 2001, 11, 1... | agpl-3.0 | Python |
910358e7cf3d8b996593c5d8eedf5c97bd0c6b67 | Test template for Monitor | Azure/azure-sdk-for-python,Azure/azure-sdk-for-python,AutorestCI/azure-sdk-for-python,rjschwei/azure-sdk-for-python,SUSE/azure-sdk-for-python,v-iam/azure-sdk-for-python,Azure/azure-sdk-for-python,Azure/azure-sdk-for-python,lmazuel/azure-sdk-for-python | azure-mgmt/tests/test_mgmt_monitor.py | azure-mgmt/tests/test_mgmt_monitor.py | # coding: utf-8
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#---------------------------------------------------------------------... | mit | Python | |
cf4829ae46ef994c9f558dcc2f08743833b8a6fb | Add mineTweets.py | traxex33/Twitter-Analysis | mineTweets.py | mineTweets.py | import json
import tweepy
from tweepy import OAuthHandler
from tweepy import Stream
from tweepy.streaming import StreamListener
#App credentials
consumer_key = ""
consumer_secret = ""
access_token = ""
access_secret = ""
auth = OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_sec... | mit | Python | |
0d56fb071628dc3f33c90d7f806371c076303551 | add autoGonk -- hopefully our self-determining "brain" to automate this | sodaphish/break,sodaphish/break | autoGonk.py | autoGonk.py | """
autoGonk -- testing out auto-determining which interfaces serve which function
"""
class ArpTable():
arpTable = {}
pass
class RouteTable():
routeTable = {}
pass
class IP():
pass | mit | Python | |
9d7d043a36f6e5a2fc599287a087eb806a58d73a | test to_xml survey | nukru/Swarm-Surveys,nukru/projectQ,nukru/projectQ,nukru/projectQ,nukru/Swarm-Surveys,nukru/Swarm-Surveys,nukru/projectQ | testXml.py | testXml.py | from xml.etree import ElementTree
from xml.etree.ElementTree import Element
from xml.etree.ElementTree import SubElement
import xml.etree.cElementTree as ET
from app import db, models
from app.models import Section, Survey, Consent, Question, QuestionText, QuestionLikertScale
def surveyXml(surveyData):
survey = El... | apache-2.0 | Python | |
3d35a84d92123fcf530cb366d60de0f2c45d1c18 | test python interpreter | shujunqiao/cocos2d-python,shujunqiao/cocos2d-python,dangillet/cocos,shujunqiao/cocos2d-python,vyscond/cocos | test/test_interpreter_layer.py | test/test_interpreter_layer.py | # This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
import cocos
from cocos.director import director
import pyglet
if __name__ == "__main__":
director.init()
interpreter_layer = cocos.layer.... | bsd-3-clause | Python | |
1d089833b47fe740d6dfaea89f94b1c9d1946c1e | enable evented based on socket | laslabs/odoo,Elico-Corp/odoo_OCB,hip-odoo/odoo,ygol/odoo,laslabs/odoo,dfang/odoo,laslabs/odoo,bplancher/odoo,dfang/odoo,hip-odoo/odoo,Elico-Corp/odoo_OCB,laslabs/odoo,Elico-Corp/odoo_OCB,ygol/odoo,hip-odoo/odoo,laslabs/odoo,bplancher/odoo,bplancher/odoo,hip-odoo/odoo,ygol/odoo,ygol/odoo,Elico-Corp/odoo_OCB,dfang/odoo,b... | openerp/__init__.py | openerp/__init__.py | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
""" OpenERP core library."""
#----------------------------------------------------------
# Running mode flags (gevent, prefork)
#----------------------------------------------------------
def is_server_running_with_geve... | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
""" OpenERP core library."""
#----------------------------------------------------------
# Running mode flags (gevent, prefork)
#----------------------------------------------------------
# Is the server running with ge... | agpl-3.0 | Python |
74a22516a368d98c8c71818c39d84208c9ecca66 | add buildbot.py | steinwurf/hex,steinwurf/hex | buildbot.py | buildbot.py | #!/usr/bin/env python
# encodingsak: utf-8
import os
import sys
import json
import subprocess
project_name = 'hex'
def run_command(args):
print("Running: {}".format(args))
sys.stdout.flush()
subprocess.check_call(args)
def get_tool_options(properties):
options = []
if 'tool_options' in proper... | bsd-3-clause | Python | |
0bc48dc1dd66178bec8d9bb3dc86a26baad240ee | use module-level function instead of a factory class | tumluliu/rap | rap/servicefactory.py | rap/servicefactory.py | """ Factory of RoutingService classes """
import json
from .mb import MapboxRouter
from .graphhopper import GraphHopperRouter
# from . import mapzen
# from . import google
# from . import here
# from . import tomtom
""" Factory method of creating concrete routing service instances
"""
VALID_ROUTING_SERVICES = [
'... | mit | Python | |
162e7dd6595b0d9303ecb1da66893ee353ba413b | Add a first small file watcher that counts words | Kadrian/paper-gamification | tracker.py | tracker.py | import os
import sys
import time
import logging
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
from watchdog.events import FileModifiedEvent
class GamificationHandler(FileSystemEventHandler):
def __init__(self, filename):
FileSystemEventHandler.__init__(self)
self.fi... | mit | Python | |
6c10f4d98443b23424a01659afd5194c3edff141 | Add conflict inspector script | danmichaelo/wikidata_labels_nb_no,danmichaelo/wikidata_labels_nb_no | inspect_conflicts.py | inspect_conflicts.py | import oursql
import sys
import simplejson as json
from wikidataeditor import Site
config = json.load(open('config.json', 'r'))
db = oursql.connect(host="wikidatawiki.labsdb", db="wikidatawiki_p", read_default_file="~/replica.my.cnf")
cur = db.cursor()
wd = Site('DanmicholoBot (+http://tools.wmflabs.org/danmicholob... | unlicense | Python | |
c4c52c98f4c8596b4f19c88fb64e1b0af4f9c4cd | Add New Test Which Monitors Output | WoLpH/python-progressbar | tests/test_monitor_progress.py | tests/test_monitor_progress.py | pytest_plugins = "pytester"
def test_simple_example(testdir):
""" Run the simple example code in a python subprocess and then compare its
stderr to what we expect to see from it. We run it in a subprocess to
best capture its stderr. We expect to see match_lines in order in the
output. Th... | bsd-3-clause | Python | |
2a47a563d5cc16f14edc0fb56a1af2848eccde57 | Add simple wrapper for a heap. | jorik041/txrudp,OpenBazaar/txrudp,Renelvon/txrudp | txrudp/heap.py | txrudp/heap.py | """Simple heap used as reorder buffer for received messages."""
import collections
import heapq
class EmptyHeap(Exception):
"""Raised when popping from empty heap."""
class Heap(collections.Sequence):
"""
A min-heap for objects implementing total ordering.
The object with the minium order number... | mit | Python | |
06c3086401e8cb221a1a665598fe75a1886d7f37 | test python script for test-NN added. | ryokbys/nap,ryokbys/nap,ryokbys/nap,ryokbys/nap | example/test-NN/test_nn.py | example/test-NN/test_nn.py | #!/usr/bin/env python
"""
Test pmd run about NN potential.
Usage:
test_nn.py [options]
Options:
-h, --help Show this message and exit.
"""
from __future__ import print_function
import os
from docopt import docopt
import unittest
__author__ = "RYO KOBAYASHI"
__version__ = "170122"
def get_init_epot(fname='out.... | mit | Python | |
bc356875eaf52bca2b1c04548a51e0372e7948aa | Create tcpServer_SocketServer.py | thedarkcoder/SPSE,ahhh/SPSE | tcpServer_SocketServer.py | tcpServer_SocketServer.py | #/bin/python
import SocketServer
import socket
SERVER_ADDRESS = ("0.0.0.0", 8888)
class EchoHandler(SocketServer.BaseRequestHandler):
def handle(self):
print "Received a connection from: ", self.client_address
data = "start"
while len(data):
data = self.request.recv(1024)
self.request.s... | mit | Python | |
d680d6a20890d3bbce96792fa1e86df28956a859 | Add a thread helper module | finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is | helpers/threading.py | helpers/threading.py | from threading import Thread, Lock
list_lock = Lock()
def run_in_thread(app):
def wrapper(fn):
def run(*args, **kwargs):
app.logger.info('Starting thread: {}'.format(fn.__name__))
t = Thread(target=fn,
args=args,
kwargs=kwargs)
t.start()
return t
r... | mit | Python | |
0d22cad3e34e7834e96e37b0268f624b45e7296f | add tests for outdoor shops | mapzen/vector-datasource,mapzen/vector-datasource,mapzen/vector-datasource | test/674-outdoor-shops.py | test/674-outdoor-shops.py | #http://www.openstreetmap.org/node/3056897308
assert_has_feature(
16, 11111, 25360, 'pois',
{ 'kind': 'fishing', 'min_zoom': 16 })
#http://www.openstreetmap.org/node/1467729495
assert_has_feature(
16, 10165, 24618, 'pois',
{ 'kind': 'hunting', 'min_zoom': 16 })
#http://www.openstreetmap.org/node/76620... | mit | Python | |
3a9960849d1c9c7b519c9eb88aa3dc58c60b1eb3 | Create 3-blink.py | CamJam-EduKit/EduKit1 | Code/3-blink.py | Code/3-blink.py | #Import Libraries
import time #A collection of time related commands
import RPi.GPIO as GPIO #The GPIO commands
#Set the GPIO pin naming mode
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
#Set pins 18, 23 and 24 to be output
GPIO.setup(18,GPIO.OUT)
GPIO.setup(23,GPIO.OUT)
GPIO.setup(24,GPIO.OUT)
#Turn L... | mit | Python | |
0ec1a3f3760b5977c036bc092b8b88647b3d4674 | Allow LogDevice to build without Submodules (#71) | phoad/rsocket-cpp,ReactiveSocket/reactivesocket-cpp,rsocket/rsocket-cpp,rsocket/rsocket-cpp,phoad/rsocket-cpp,rsocket/rsocket-cpp,ReactiveSocket/reactivesocket-cpp,rsocket/rsocket-cpp,phoad/rsocket-cpp,ReactiveSocket/reactivesocket-cpp,phoad/rsocket-cpp,phoad/rsocket-cpp | build/fbcode_builder/specs/rocksdb.py | build/fbcode_builder/specs/rocksdb.py | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
def fbcode_builder_spec(builder):
builder.add_option("rocksdb/_build:cmake_defines", {
... | unknown | Python | |
26fa3f083468acb2155d811ce65d4d4d6aafe53b | Integrate LLVM at llvm/llvm-project@4b33ea052ab7 | tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow-pywrap_saved_model,tensorflow/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow-pywrap_saved_model,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow-pywrap_saved_model,tensorflo... | third_party/llvm/workspace.bzl | third_party/llvm/workspace.bzl | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "4b33ea052ab7fbceed4c62debf1145f80d66b0d7"
LLVM_SHA256 = "b6c61a6c81b1910cc34ccd9800fd18afc2dc1b9d76c640dd767f9e550f94c8d6"
tf_http_archive(
... | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "58a47508f03546b4fce668fad751102b94feacfd"
LLVM_SHA256 = "b3106ecc8ad56ecf9cd72c8a47117342e7641ef5889acb1d9093bcd0f2920d59"
tf_http_archive(
... | apache-2.0 | Python |
0cf2ce2331120c20de0cab384c5fdec763c25c68 | Add a simple markov chain to compare output with RNN | eliben/deep-learning-samples,eliben/deep-learning-samples | min-char-rnn/markov-model.py | min-char-rnn/markov-model.py | # Simple Markov chain model for character-based text generation.
#
# Only tested with Python 3.6+
#
# Eli Bendersky (http://eli.thegreenplace.net)
# This code is in the public domain
from __future__ import print_function
from collections import defaultdict, Counter
import random
import sys
STATE_LEN = 4
def weight... | unlicense | Python | |
80c749e8b8395f20305c04c480fbf39400f1b5a4 | Add failing test for index route | wkevina/feature-requests-app,wkevina/feature-requests-app,wkevina/feature-requests-app | features/tests/test_index.py | features/tests/test_index.py | from django.test import TestCase
class TestIndex(TestCase):
"""Verify the index page is served properly"""
def test_root(self):
# Fetch page from '/'
reponse = self.client.get('/')
# Should respond OK
self.assertEqual(reponse.status_code, 200)
# Should be rendered from ... | mit | Python | |
3f7b54496826f496863de545a601c23c2c06427a | Add first-party JavaScript build rule library | clchiou/garage,clchiou/garage,clchiou/garage,clchiou/garage | shipyard2/shipyard2/rules/javascripts.py | shipyard2/shipyard2/rules/javascripts.py | """Helpers for writing rules for first-party JavaScript packages."""
__all__ = [
'define_package',
'find_package',
]
import dataclasses
import logging
import foreman
from g1 import scripts
from g1.bases.assertions import ASSERT
from shipyard2 import rules
LOG = logging.getLogger(__name__)
@dataclasses.d... | mit | Python | |
18b98aff76c0b69748b5dd4b8ca27bd8d8b8aec8 | Add PassiveAggressiveClassifier to benchmark | rhiever/sklearn-benchmarks | model_code/PassiveAggressiveClassifier.py | model_code/PassiveAggressiveClassifier.py | import sys
import pandas as pd
from sklearn.linear_model import PassiveAggressiveClassifier
from sklearn.cross_validation import StratifiedShuffleSplit
from sklearn.preprocessing import StandardScaler
import itertools
dataset = sys.argv[1]
# Read the data set into memory
input_data = pd.read_csv(dataset, compression=... | mit | Python | |
6a74915c3f197ef197a34514c7ff313ac0a68d2f | Add migration to delete existing cache values | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/fixtures/migrations/0002_rm_blobdb_domain_fixtures.py | corehq/apps/fixtures/migrations/0002_rm_blobdb_domain_fixtures.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-09-08 10:23
from __future__ import unicode_literals
from django.db import migrations
from corehq.blobs import get_blob_db
from corehq.sql_db.operations import HqRunPython
FIXTURE_BUCKET = 'domain-fixtures'
def rm_blobdb_domain_fixtures(apps, schema_edito... | bsd-3-clause | Python | |
e184b806c6170aad2bdee87c051ea6400e1d954e | Add unit tests for the Document class | samueldg/clippings | tests/parser_test.py | tests/parser_test.py | import unittest
from clippings.parser import Document
class DocumentTest(unittest.TestCase):
def test_create_document(self):
title = 'Haunted'
authors = ['Chuck Palahniuk']
document = Document(title, authors)
self.assertEqual(title, document.title)
self.assertEqual(autho... | mit | Python | |
98006f7b27195153c1eb5d19b5902b60b0ffd963 | add unit tests for events.py | jait/tupelo | tests/test_events.py | tests/test_events.py | #!/usr/bin/env python
# vim: set sts=4 sw=4 et:
import unittest
import events
import rpc
class TestEventsRPC(unittest.TestCase):
def testEvent(self, cls=None):
cls = events.Event
e = cls()
e2 = rpc.rpc_decode(cls, rpc.rpc_encode(e))
self.assert_(isinstance(e2, cls))
self.assertE... | bsd-3-clause | Python | |
e9cfb095ac4261c8bf959d1c9b904256c267178f | Add basic unit test about /variables endpoint | openfisca/openfisca-web-api,openfisca/openfisca-web-api | openfisca_web_api/tests/test_variables.py | openfisca_web_api/tests/test_variables.py | # -*- coding: utf-8 -*-
import json
from nose.tools import assert_equal, assert_greater, assert_in, assert_is_instance
from webob import Request
from . import common
def setup_module(module):
common.get_or_load_app()
def test_basic_call():
req = Request.blank('/api/1/variables', method = 'GET')
res ... | agpl-3.0 | Python | |
bcfccc8d7b19895f793e63289dcbbf9bf1ed834b | add unittest for home view | DimaWittmann/commute-together,DimaWittmann/commute-together,DimaWittmann/commute-together | commute_together/commute_together/tests/test_views.py | commute_together/commute_together/tests/test_views.py | from datetime import timedelta, datetime
from django.test import TestCase
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from commute_together.models import MeetingModel, StationModel
class HomePageTest(TestCase):
fixtures = ['StationModel.json']
def test_home_page_rende... | mit | Python | |
ff673561c87bd16938a7c3f4d7609f91afbe9078 | add a script to perform the event averaging for the HBT correlation function | chunshen1987/HBT_correlation,chunshen1987/HBT_correlation,chunshen1987/HBT_correlation | ebe_scripts/average_event_HBT_correlation_function.py | ebe_scripts/average_event_HBT_correlation_function.py | #! /usr/bin/env python
"""
This script performs event averaging for the HBT correlation function
calculated from event-by-event simulations
"""
from sys import argv, exit
from os import path
from glob import glob
from numpy import *
# define colors
purple = "\033[95m"
green = "\033[92m"
blue = "\033[94m"
ye... | mit | Python | |
c23d2711757a68f1348f8353aba7b3ec2d17a1d6 | Structure prediction boilerplate | WMD-group/SMACT | smact/structure_prediction/prediction.py | smact/structure_prediction/prediction.py | """Structure prediction implementation."""
from typing import Generator, List, Tuple, Optional
from .database import StructureDB
from .mutation import CationMutator
from .structure import SmactStructure
class StructurePredictor:
"""Provides structure prediction functionality.
Implements a statistically-bas... | mit | Python | |
f49b6ad21ed9c8646c402a37015a80258fb79a68 | ADD EVALUATE PROCESS | taiducvu/VNG-NSFW-DETECTION | evaluate_model.py | evaluate_model.py | import tensorflow as tf
import os
import glob
import vng_model as md
import numpy as np
import csv
FLAGS = tf.app.flags.FLAGS
tf.app.flags.DEFINE_string('checkpoint_dir', '',
"""Direction where the trained weights of model is save""")
tf.app.flags.DEFINE_string('eval_data_path', '',
... | mit | Python | |
3d5955767d81f45e796ab2af0707533375681774 | add runtests-windows.py script | sfeltman/pygobject,Distrotech/pygobject,davidmalcolm/pygobject,davidmalcolm/pygobject,thiblahute/pygobject,choeger/pygobject-cmake,jdahlin/pygobject,MathieuDuponchelle/pygobject,GNOME/pygobject,sfeltman/pygobject,Distrotech/pygobject,nzjrs/pygobject,Distrotech/pygobject,alexef/pygobject,alexef/pygobject,thiblahute/pygo... | tests/runtests-windows.py | tests/runtests-windows.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import glob
import unittest
os.environ['PYGTK_USE_GIL_STATE_API'] = ''
sys.path.insert(0, os.path.dirname(__file__))
sys.argv.append('--g-fatal-warnings')
import gobject
gobject.threads_init()
SKIP_FILES = ['runtests',
'test_gio', ... | lgpl-2.1 | Python | |
fffb2a38870afd0c9a6d1ab5efd36b75f98c9a9a | test the deprecation class. | douban/brownant | tests/test_deprecation.py | tests/test_deprecation.py | from brownant import Brownant, BrownAnt
def test_deprecation(recwarn):
app = BrownAnt()
warning = recwarn.pop(DeprecationWarning)
assert isinstance(app, Brownant)
assert issubclass(warning.category, DeprecationWarning)
assert "Brownant" in str(warning.message)
assert "app.py" in warning.filen... | bsd-3-clause | Python | |
404c9b70cf9b6c27e0fb16be1556d01b5077a4f4 | Add test cases for 500 error with slow responses | alisaifee/flask-limiter,joshfriend/flask-limiter,alisaifee/limits,alisaifee/limits,joshfriend/flask-limiter,alisaifee/flask-limiter | tests/test_regressions.py | tests/test_regressions.py | """
"""
import time
import logging
import unittest
from flask import Flask
import mock
from flask.ext.limiter.extension import C, Limiter
class RegressionTests(unittest.TestCase):
def build_app(self, config={}, **limiter_args):
app = Flask(__name__)
for k,v in config.items():
app.c... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.