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 |
|---|---|---|---|---|---|---|---|---|
213d0bad78544abe5f3b3f74c9608de365c561e1 | test for django forms | carthage-college/django-djequis,carthage-college/django-djequis | djequis/core/trustcommerce/summaries.py | djequis/core/trustcommerce/summaries.py |
from django.db import models
from django.conf import settings
from django.db.models import CharField, Case, Value, When
from django.db.models import IntegerField, Sum
# class Transaction(models.Model):
# 2063 = 'Prk'
# PRDV = 'Enr'
# SOCCER = 'Scr'
# CODE_CHOICES = (
# (2063, 'Parki... | mit | Python | |
5a04df9b88cda0fd8ab0d6c6a6aa01ad3af7329c | add script to simplify run of multiple DotsBoxes instances | asavonic/DotsBoxes,asavonic/DotsBoxes | scripts/run_multiple_clients.py | scripts/run_multiple_clients.py | import os
import argparse
import subprocess as proc
parser = argparse.ArgumentParser(description="Launches multiple DotsBoxes instances")
parser.add_argument("ports", metavar="PORT", type=int, nargs="+", help="TCP ports to use")
script_dir = os.path.dirname(os.path.realpath(__file__))
classpath = os.path.join(script_... | mit | Python | |
ca5755d404115183236356a04d55357a26f48fb7 | Return 404s when schemas are not found | qvazzler/Flexget,gazpachoking/Flexget,offbyone/Flexget,thalamus/Flexget,qvazzler/Flexget,malkavi/Flexget,vfrc2/Flexget,ianstalk/Flexget,ianstalk/Flexget,gazpachoking/Flexget,asm0dey/Flexget,oxc/Flexget,Danfocus/Flexget,Pretagonist/Flexget,antivirtel/Flexget,drwyrm/Flexget,tsnoam/Flexget,drwyrm/Flexget,v17al/Flexget,off... | flexget/ui/plugins/schema/schema.py | flexget/ui/plugins/schema/schema.py | from __future__ import unicode_literals, division, absolute_import
from flask import Module, jsonify, request
from jsonschema import RefResolutionError
from flexget.config_schema import resolve_local
from flexget.ui.webui import register_plugin
schema = Module(__name__)
@schema.route('/', defaults={'path': ''})
@s... | from __future__ import unicode_literals, division, absolute_import
from flask import Module, jsonify, request
from flexget.config_schema import resolve_local
from flexget.ui.webui import register_plugin
schema = Module(__name__)
@schema.route('/', defaults={'path': ''})
@schema.route('/<path:path>')
def get_schema... | mit | Python |
c965a62567620a65ee972e8ce6a6cd0f257dcbc3 | Add tempdirs | thelinuxkid/tempdirs | tempdirs.py | tempdirs.py | import functools
import tempfile
import shutil
class makedirs(object):
def __init__(self, num):
self._num = num
def __call__(self, fn):
@functools.wraps(fn)
def wrapper(*args, **kwargs):
def manager():
try:
dirs = [
... | mit | Python | |
8851571ba71b1377152f1d8c68022d7ebac9050d | add integration tests for aiohttp | graingert/vcrpy,poussik/vcrpy,ByteInternet/vcrpy,kevin1024/vcrpy,poussik/vcrpy,graingert/vcrpy,kevin1024/vcrpy,ByteInternet/vcrpy | tests/integration/test_aiohttp.py | tests/integration/test_aiohttp.py | import asyncio
import aiohttp
import pytest
import vcr
@asyncio.coroutine
def request(session, method, url, as_text, **kwargs):
response = yield from session.request(method, url, **kwargs)
return response, (yield from response.text()) if as_text else (yield from response.json())
def get(url, as_text=True, ... | mit | Python | |
7b4350af4830cdcdcb27f7a81df19e81a937855b | add rankd tests | pdamodaran/yellowbrick,DistrictDataLabs/yellowbrick | tests/test_features/test_rankd.py | tests/test_features/test_rankd.py | # tests.test_features.test_rankd
# Test the rankd feature analysis visualizers
#
# Author: Benjamin Bengfort <bbengfort@districtdatalabs.com>
# Created: Fri Oct 07 12:19:19 2016 -0400
#
# Copyright (C) 2016 District Data Labs
# For license information, see LICENSE.txt
#
# ID: test_rankd.py [01d5996] benjamin@bengfor... | apache-2.0 | Python | |
e87864986d8ce97d0c684fa06d30ea9cf108222d | Add Zypper unit test: test_list_products and test_refresh_db | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | tests/unit/modules/zypper_test.py | tests/unit/modules/zypper_test.py | # -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Bo Maryniuk <bo@suse.de>`
'''
# Import Python Libs
from __future__ import absolute_import
# Import Salt Testing Libs
from salttesting import TestCase, skipIf
from salttesting.mock import (
MagicMock,
patch,
NO_MOCK,
NO_MOCK_REASON
)
import os
from ... | apache-2.0 | Python | |
266b595519fdd055ab2a936bf22092c9af099dbe | Create csv_summary.py | Jim-Rod/csv_summary | csv_summary.py | csv_summary.py | '''
20140213
Import CSV Data - Dict
Save as JASON?
Basic Stats
Save to file
Find Key Words
Generate Reports...
Generate Plots
'''
import csv
import numpy as np
import matplotlib as mpl
from scipy.stats import nanmean
filename = '20140211_ING.csv'
###____________ Helper ___________###
def number_fields(data):
... | mit | Python | |
dc8dc700aa8ed8332f044360f6a30b201d987c7f | add new option "simple" for LoadAverageCollector to enable simple output | zoidbergwill/Diamond,datafiniti/Diamond,hamelg/Diamond,skbkontur/Diamond,Ormod/Diamond,Ensighten/Diamond,hamelg/Diamond,Slach/Diamond,MichaelDoyle/Diamond,russss/Diamond,CYBERBUGJR/Diamond,jriguera/Diamond,works-mobile/Diamond,jumping/Diamond,saucelabs/Diamond,mzupan/Diamond,Nihn/Diamond-1,zoidbergwill/Diamond,Clever/D... | src/collectors/loadavg/loadavg.py | src/collectors/loadavg/loadavg.py | # coding=utf-8
"""
Uses /proc/loadavg to collect data on load average
#### Dependencies
* /proc/loadavg
"""
import diamond.collector
import re
import os
_RE = re.compile(r'([\d.]+) ([\d.]+) ([\d.]+) (\d+)/(\d+)')
class LoadAverageCollector(diamond.collector.Collector):
PROC = '/proc/loadavg'
def get_... | # coding=utf-8
"""
Uses /proc/loadavg to collect data on load average
#### Dependencies
* /proc/loadavg
"""
import diamond.collector
import re
import os
_RE = re.compile(r'([\d.]+) ([\d.]+) ([\d.]+) (\d+)/(\d+)')
class LoadAverageCollector(diamond.collector.Collector):
PROC = '/proc/loadavg'
def get_... | mit | Python |
fd1cf50714cf082c302a0ff8410373bbea1bbf78 | Add a python-based bouncer. | UIKit0/HyperDex,rescrv/HyperDex,rescrv/HyperDex,vashstorm/HyperDex,UIKit0/HyperDex,jtk54/HyperDex,cactorium/HyperDex,hyc/HyperDex,hyc/HyperDex,tempbottle/HyperDex,pombredanne/HyperDex,jtk54/HyperDex,rescrv/HyperDex,pombredanne/HyperDex,jtk54/HyperDex,rescrv/HyperDex,tempbottle/HyperDex,hyc/HyperDex,UIKit0/HyperDex,pomb... | bouncer.py | bouncer.py | #!/usr/bin/env python
# Copyright (c) 2011, Cornell University
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# ... | bsd-3-clause | Python | |
a12e8284c8dc2a8895308fbd32e9c97c1ce42311 | add script to visualise netcdf output | kampe004/compaction,kampe004/compaction,kampe004/compaction | scripts/plot_netcdf_output.py | scripts/plot_netcdf_output.py | #!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
from mpl_toolkits.axes_grid1 import make_axes_locatable
import math
from netCDF4 import Dataset, default_fillvals
fid = Dataset('../build_dbg/daily.nc', mode='r') # CLM one year test
# =========================
# Open and prin... | mit | Python | |
123601a1d63f317d7593ace12870e6cc4ad5d4c4 | Add a subscriber example | ivoire/ReactOBus,ivoire/ReactOBus | share/examples/sub.py | share/examples/sub.py | import sys
import zmq
def main():
# Get the arguments
if len(sys.argv) != 2:
print("Usage: sub.py url")
sys.exit(1)
url = sys.argv[1]
context = zmq.Context()
sock = context.socket(zmq.SUB)
sock.setsockopt(zmq.SUBSCRIBE, b"")
sock.connect(url)
while True:
msg ... | agpl-3.0 | Python | |
774d42bbb5af4a057e8efe98347cc724bda0c243 | Create forms.py | matheusho/dj-cpfcnpj | forms.py | forms.py | # coding: utf-8
import re
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import CharField
from django.utils.translation import ugettext_lazy as _
def DV_maker(v):
if v >= 2:
return 11 - v
return 0
class BRCPFCNPJField(CharField):
... | mit | Python | |
0d94212a3d6bf31bc95f623f25de21250bd34cc7 | automate format | SalocinDotTEN/MYDD16-project,SalocinDotTEN/MYDD16-project,SalocinDotTEN/MYDD16-project,SalocinDotTEN/MYDD16-project | formating.py | formating.py | import os
def list_dir(path):
list_file=[]
list_file=os.listdir(path)
return list_file
def change_dir(path):
os.chdir(path)
change_dir("/home/mancube/Downloads/data/a10/p1")
list_file= list(list_dir("/home/mancube/Downloads/data/a10/p1"))
print list_file
def write_file(inputfile,outputfile):
list_column =... | mit | Python | |
70520416bdf811401f709cd7a8e649f967c1b999 | Add sceleton of word classes | kodki/cortext | cortext/word_classes.py | cortext/word_classes.py | ORGANIZATION,
POLITICIAN,
MUSICIAN,
ACTOR,
MOTION_VERB = range(5)
| mit | Python | |
47e6c7edb3047d32a6c7749ad3bc36df1e9ab0b1 | Create graph.py | kilbyjmichael/pi_temp | graph.py | graph.py | import sqlite3
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
from datetime import datetime
from matplotlib import style
style.use(['seaborn-poster'])
conn = sqlite3.connect(r"temp.db")
c = conn.cursor()
def graph_all_data():
c.execute('SELECT time, temp FROM office')
data = c.fetchall()
... | mit | Python | |
6fe25e3908f638e1d093dd2e70aaf559364c83b3 | add test case to make sure SwaggerSecurity == SwaggerAuth | mission-liao/pyopenapi | pyopenapi/tests/test_core.py | pyopenapi/tests/test_core.py | import pyopenapi
import unittest
class SwaggerCoreTestCase(unittest.TestCase):
""" test core part """
def test_auth_security(self):
""" make sure alias works """
self.assertEqual(pyopenapi.SwaggerAuth, pyopenapi.SwaggerSecurity)
| mit | Python | |
7382fea5180ea02387bfcfd1a1fdcc51fd2c725e | create browser | huhu-project/huhu_browser | browser.py | browser.py | #!/usr/bin/env python
from gi.repository import Gtk, GLib, WebKit
class HuhuBrowser:
def __init__(self):
window = Gtk.Window(type=Gtk.WindowType.TOPLEVEL)
window.connect('delete-event', Gtk.main_quit)
window.set_title("HuhuBrowser")
window.show_all()
self.view = WebKit.Web... | mpl-2.0 | Python | |
1cdc38742e6fc09595a45c28d179125d3771521c | Add solutions for problem 10 | cifvts/PyEuler | euler010.py | euler010.py | #!/usr/bin/python
from math import sqrt, ceil, floor
LIMIT = 2000000
"""
This is the first, brute force method, we search for primes,
and put them into an array, so we can use as test later.
This is not fast, and do millons mod test
"""
def isPrime(x):
i = 0
while primeList[i] <= sqrt(x):
if x % pr... | mit | Python | |
06ad6340a1d6ec0adc6faf280b9030946efe2c7f | Add back a compatibility UserArray. | MichaelAquilina/numpy,b-carter/numpy,hainm/numpy,cjermain/numpy,numpy/numpy,pyparallel/numpy,BMJHayward/numpy,abalkin/numpy,gmcastil/numpy,jonathanunderwood/numpy,immerrr/numpy,GaZ3ll3/numpy,pdebuyl/numpy,jorisvandenbossche/numpy,ViralLeadership/numpy,ogrisel/numpy,stuarteberg/numpy,kirillzhuravlev/numpy,NextThought/py... | numpy/lib/UserArray.py | numpy/lib/UserArray.py | from user_array import container as UserArray
import warnings
warnings.warn('UserArray.UserArray is deprecated use user_array.container')
| bsd-3-clause | Python | |
abd1442a6ec1a0a97c13c81d3c3f25dbd435a352 | add listener port creation file | infinite-Joy/websphere | create_listener_port.py | create_listener_port.py | import sys
import java
global AdminConfig
# Common Variables
cellName = ""
nodeName = ""
serverName =- ""
listenerName1 = ""
listenerName2 = ""
queueName = "jms/samplequeue"
connFactory1 = "jms/connFactory1"
connFactory2 = "jms/connFactory2"
def createMessageListener(nodeName, serverName, name, destination, connF... | mit | Python | |
aabe61922e964c05a8a856d7765beea42d2f34ab | Create Python file | caromedellin/starting_git | hello.py | hello.py | print("Hello World")
| mit | Python | |
0e7302e86ae71e89950360822b824e6690276c73 | add a few basic unit tests for WindowProperties class | chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d,chandler14362/panda3d | tests/display/test_winprops.py | tests/display/test_winprops.py | from panda3d.core import WindowProperties
import pytest
def test_winprops_ctor():
props = WindowProperties()
assert not props.is_any_specified()
def test_winprops_copy_ctor():
props = WindowProperties()
props.set_size(1, 2)
props2 = WindowProperties(props)
assert props == props2
assert... | bsd-3-clause | Python | |
3daf9d6aa66298d01b7eb1ff374fb4df9ebcb573 | Add lc_perform_string_shifts.py | bowen0701/algorithms_data_structures | lc_perform_string_shifts.py | lc_perform_string_shifts.py | """Leetcode: Perform String Shifts
URL: https://leetcode.com/explore/challenge/card/30-day-leetcoding-challenge/529/week-2/3299/
You are given a string s containing lowercase English letters, and a matrix
shift, where shift[i] = [direction, amount]:
- direction can be 0 (for left shift) or 1 (for right shift).
- amo... | bsd-2-clause | Python | |
7ebf668f92ab0428935dc333ca1e4054eaa4d732 | Fix typo | hoangt/tpzsimul.gem5,hoangt/tpzsimul.gem5,hoangt/tpzsimul.gem5,pombredanne/http-repo.gem5.org-gem5-,pombredanne/http-repo.gem5.org-gem5-,hoangt/tpzsimul.gem5,vovojh/gem5,vovojh/gem5,hoangt/tpzsimul.gem5,vovojh/gem5,vovojh/gem5,pombredanne/http-repo.gem5.org-gem5-,vovojh/gem5,vovojh/gem5,vovojh/gem5,pombredanne/http-rep... | src/sim/System.py | src/sim/System.py | # Copyright (c) 2005-2007 The Regents of The University of Michigan
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this ... | # Copyright (c) 2005-2007 The Regents of The University of Michigan
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this ... | bsd-3-clause | Python |
b654ac155f9ea4a481acf28b2a8b061e4bd163a0 | add simple font comparison tool in examples | google-code-export/pyglet,gdkar/pyglet,cledio66/pyglet,gdkar/pyglet,Alwnikrotikz/pyglet,xshotD/pyglet,Austin503/pyglet,xshotD/pyglet,kmonsoor/pyglet,odyaka341/pyglet,google-code-export/pyglet,cledio66/pyglet,kmonsoor/pyglet,odyaka341/pyglet,shaileshgoogler/pyglet,arifgursel/pyglet,gdkar/pyglet,qbektrix/pyglet,odyaka341... | examples/font_comparison.py | examples/font_comparison.py | #!/usr/bin/env python
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are me... | bsd-3-clause | Python | |
5245a65aef01dc649d7b68bb25b22c5905b694e2 | Add DBFS scratch | fsspec/filesystem_spec,fsspec/filesystem_spec,intake/filesystem_spec | fsspec/implementations/dbfs.py | fsspec/implementations/dbfs.py | import base64
from fsspec import AbstractFileSystem
from fsspec.spec import AbstractBufferedFile
import requests
class DatabricksFileSystem(AbstractFileSystem):
def __init__(self, token, instance, **kwargs):
self.token = token
self.instance = instance
self.session = requests.Session()
... | bsd-3-clause | Python | |
071470ca90b485f142280ff52fd6fd7bc9dec13c | Create describe_supscription_filters.py | awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,a... | python/example_code/cloudwatch/describe_supscription_filters.py | python/example_code/cloudwatch/describe_supscription_filters.py | # Copyright 2010-2018 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file ac... | apache-2.0 | Python | |
34d271d84b6a11e416545673ef5f54de204bcef1 | add simulation of Gambler's Fallacy | NickQian/pyWager | coin_tossing.py | coin_tossing.py | #!/usr/bin/env python
""" play method: coin tossing
# ---
# License: BSD
# ---
# 0.1: init version - 2019.12 - by Nick Qian
"""
import random
from cfg import *
def GenRedGreen(len):
tradres = []
i = 0;
while (i < len):
i += 1
float0_1 = random.random() # 0 ~ 1
tradres.append(float("%.2f" %(float0_1 - 0... | bsd-2-clause | Python | |
96897c161681ac68ecafb3d1e5f513c1287d7587 | add import script for Eilean Siar | chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_eilean_siar.py | polling_stations/apps/data_collection/management/commands/import_eilean_siar.py | from data_collection.management.commands import BaseScotlandSpatialHubImporter
"""
Note:
This importer provides coverage for 45/47 districts
due to incomplete/poor quality data
"""
class Command(BaseScotlandSpatialHubImporter):
council_id = 'S12000013'
council_name = 'Eilean Siar'
elections = ['local.eilea... | bsd-3-clause | Python | |
cbf9b7605a31cd67b1c94b8157cb6ae55fd36c69 | Add test that all functions defined in urls.py actually exist. | sharmaeklavya2/zulip,AZtheAsian/zulip,rishig/zulip,shubhamdhama/zulip,sup95/zulip,shubhamdhama/zulip,jphilipsen05/zulip,samatdav/zulip,Jianchun1/zulip,zulip/zulip,blaze225/zulip,PhilSk/zulip,vaidap/zulip,dattatreya303/zulip,eeshangarg/zulip,shubhamdhama/zulip,TigorC/zulip,verma-varsha/zulip,mahim97/zulip,hackerkid/zuli... | zerver/test_urls.py | zerver/test_urls.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
import django.core.urlresolvers
from django.test import TestCase
import importlib
from zproject import urls
class URLResolutionTest(TestCase):
def check_function_exists(self, module_name, view):
module = i... | apache-2.0 | Python | |
753a43964bdd5fcce80bede448e0701bf42036d0 | Add loader script. | dmkent/cattrack,dmkent/cattrack | load_data.py | load_data.py | #!/bin/env python
"""
Script to load CSV dump of data.
Run from django shell with "%run".
Expects the followin columns:
1. date
2. description
3. category
4. amount
5. accountname
"""
import argparse
import pandas as pd
from ctrack.models import Transaction, Category, Account
def load_data(dat... | mit | Python | |
fc35730074f5af647579012b706e531e84da5ab6 | Add tool for converting in-line notes metadata to .csv | PovertyAction/github-download | src/main/python/json_to_csv.py | src/main/python/json_to_csv.py | # Adapted from http://stackoverflow.com/questions/1871524/convert-from-json-to-csv-using-python
import csv
import json
with open("comments.txt") as file:
data = json.load(file)
with open("comments.csv", "wb") as file:
csv_file = csv.writer(file)
csv_file.writerow(['user:login', 'path', 'commit_id', 'url', 'line',
... | mit | Python | |
0b80a3db4fe13e678fd0b5d174d94643a4028feb | Add gtk-sharp3 2.99.3.99 | BansheeMediaPlayer/bockbuild,BansheeMediaPlayer/bockbuild,BansheeMediaPlayer/bockbuild | packages/gtk-sharp3.py | packages/gtk-sharp3.py | class GtkSharp3Package (GitHubPackage):
def __init__ (self):
GitHubPackage.__init__ (self, 'mono', 'gtk-sharp', '2.99.3.99',
revision = 'a3db272fee017518779344293fb802cc8d1f813b')
if Package.profile.name == 'darwin':
self.sources.extend ([
# Fix compilation on OS X
# https://github.com/mono/gtk-sh... | mit | Python | |
e621070de78796a77c48317a0923328076a1bcff | Add OrderedSet.py | JasonGross/coq-tools,JasonGross/coq-tools | OrderedSet.py | OrderedSet.py | import collections
# from http://code.activestate.com/recipes/576694/
class OrderedSet(collections.MutableSet):
def __init__(self, iterable=None):
self.end = end = []
end += [None, end, end] # sentinel node for doubly linked list
self.map = {} # key --> [key, prev... | mit | Python | |
6e144d6c1ec0a55a382a1f2156b68d1bea05a93c | Create ipo.py | githubutilities/LeetCode,githubutilities/LeetCode,githubutilities/LeetCode,githubutilities/LeetCode,githubutilities/LeetCode | Python/ipo.py | Python/ipo.py | # Time: O(nlogn)
# Space: O(n)
# Suppose LeetCode will start its IPO soon. In order to sell a good price of its shares to Venture Capital,
# LeetCode would like to work on some projects to increase its capital before the IPO.
# Since it has limited resources, it can only finish at most k distinct projects before the ... | mit | Python | |
733dcd3415268be91da30b848e9516acc3137a66 | Add broken fdpass tests. | kirkeby/sheared | src/sheared/python/fdpass_test.py | src/sheared/python/fdpass_test.py | #!/usr/bin/env python
#
# Sheared -- non-blocking network programming library for Python
# Copyright (C) 2003 Sune Kirkeby <sune@mel.interspace.dk>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Founda... | mit | Python | |
c7495e789b61481a951aaaaa3ca50448a98397d6 | add simple grid example | michaelaye/vispy,ghisvail/vispy,drufat/vispy,Eric89GXL/vispy,Eric89GXL/vispy,drufat/vispy,drufat/vispy,Eric89GXL/vispy,ghisvail/vispy,michaelaye/vispy,michaelaye/vispy,ghisvail/vispy | examples/basics/plotting/grid-basic.py | examples/basics/plotting/grid-basic.py | # -*- coding: utf-8 -*-
# vispy: gallery 30
# -----------------------------------------------------------------------------
# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# -----------------------------------------------------... | bsd-3-clause | Python | |
06635cb860ae968d25c9d5c4b4904a9cacce8ee0 | add convert_gc_device.py | gotling/PyTach,gotling/PyTach,gotling/PyTach | pytach/convert_gc_device.py | pytach/convert_gc_device.py | #!/usr/bin/env python
import argparse
import struct
import csv
import json
import os
import sys
def convert_gc (filename, name, description):
debug = False
commands = []
root, ext = os.path.splitext(filename)
root, basename = os.path.split(root)
if name == None:
name = basename
if descriptio... | mit | Python | |
8888e292d917f4e3792e67b894e23a0b5e3b7c4f | package init file | oren88/vasputil,jabl/vasputil,jabl/vasputil,oren88/vasputil | python/vasputil/__init__.py | python/vasputil/__init__.py | __all__ = ["dosplot"]
| lgpl-2.1 | Python | |
169e51c5aaad887f90952b784f019bc198e79203 | Add an initialsetup library with functions for setting common values in config files, such as user passwords, SSH keys etc., for use in first boot and installation scripts. | vyos/vyos-1x,vyos/vyos-1x,vyos/vyos-1x,vyos/vyos-1x | python/vyos/initialsetup.py | python/vyos/initialsetup.py | # initialsetup -- functions for setting common values in config file,
# for use in installation and first boot scripts
#
# Copyright (C) 2018 VyOS maintainers and contributors
#
# This library is free software; you can redistribute it and/or modify it under the terms of
# the GNU Lesser General Public License as publis... | lgpl-2.1 | Python | |
522c6c6b55c3c896f8e5ee75107ce6337cfc3033 | add missing test | navcoindev/navcoin-core,navcoindev/navcoin-core,navcoindev/navcoin-core,navcoindev/navcoin-core,navcoindev/navcoin-core,navcoindev/navcoin-core | qa/rpc-tests/cfund-reorg.py | qa/rpc-tests/cfund-reorg.py | #!/usr/bin/env python3
# Copyright (c) 2019 The Navcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import NavCoinTestFramework
from test_framework.cfund_util import *
import... | mit | Python | |
c580953bd87132df09867e169d1662a9d778bf7e | Fix MQTT sensor | kyvinh/home-assistant,jabesq/home-assistant,ct-23/home-assistant,florianholzapfel/home-assistant,Duoxilian/home-assistant,mikaelboman/home-assistant,mikaelboman/home-assistant,Julian/home-assistant,jamespcole/home-assistant,tboyce1/home-assistant,MungoRae/home-assistant,DavidLP/home-assistant,jaharkes/home-assistant,sh... | homeassistant/components/sensor/mqtt.py | homeassistant/components/sensor/mqtt.py | """
homeassistant.components.sensor.mqtt
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Allows to configure a MQTT sensor.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.mqtt/
"""
import logging
from homeassistant.const import CONF_VALUE_TEMPLATE, STATE_UNK... | """
homeassistant.components.sensor.mqtt
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Allows to configure a MQTT sensor.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.mqtt/
"""
import logging
from homeassistant.const import CONF_VALUE_TEMPLATE
from homea... | apache-2.0 | Python |
3bd35228c61d73d8a43ffcda70386b194c9123b2 | Automate comparison to best known solutions. | VROOM-Project/vroom-scripts,VROOM-Project/vroom-scripts | benchmark/TSP/TSPLIB/compare_to_BKS.py | benchmark/TSP/TSPLIB/compare_to_BKS.py | # -*- coding: utf-8 -*-
import json, sys, os
import numpy as np
# Compare a set of computed solutions to best known solutions on the
# same problems.
def s_round(v, d):
return str(round(v, d))
def log_comparisons(BKS, files):
print ','.join(["Instance", "Jobs", "Vehicles", "Optimal cost", "Solution cost", "Gap (... | bsd-2-clause | Python | |
dc20c3fff8b83da04dc53f16c9f025a82b13fe63 | rename hmc class | madhav-datt/kgp-hms,madhav-datt/kgp-hms | src/actors/hall_management.py | src/actors/hall_management.py | #
# Software Engineering Lab - Assignment 5
# IIT Kharagpur - Hall Management System
#
"""
@ authors: Madhav Datt (14CS30015), Avikalp Srivastava (14CS10008)
"""
from __future__ import division
import warnings
class HallManagement(object):
"""Contains details of HallManagement
Attributes:
password: ... | mit | Python | |
a56aed02eb5c09075478a14890bdd7565ec83d6a | Update requests table | VinnieJohns/ggrc-core,NejcZupec/ggrc-core,andrei-karalionak/ggrc-core,kr41/ggrc-core,j0gurt/ggrc-core,j0gurt/ggrc-core,selahssea/ggrc-core,j0gurt/ggrc-core,VinnieJohns/ggrc-core,NejcZupec/ggrc-core,j0gurt/ggrc-core,prasannav7/ggrc-core,josthkko/ggrc-core,edofic/ggrc-core,plamut/ggrc-core,plamut/ggrc-core,NejcZupec/ggrc... | src/ggrc/migrations/versions/20160321110707_33459bd8b70d_request_comment_notifications.py | src/ggrc/migrations/versions/20160321110707_33459bd8b70d_request_comment_notifications.py | # Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: dan@reciprocitylabs.com
# Maintained By: peter@reciprocitylabs.com
"""Request comment notifications.
Create Date: 2016-03-21 11:07:07.327760
"""
#... | apache-2.0 | Python | |
d6a3d85c51bbdd290f88be0fe6129c0c64f92dde | Create implied_properties.py | tommorris/mf2py,tommorris/mf2py,kylewm/mf2py,kylewm/mf2py | mf2py/implied_properties.py | mf2py/implied_properties.py | from bs4 import BeautifulSoup
## function to find an implied name property
def name(el):
# if image use alt text if not empty
if el.name == 'img' and "alt" in el.attrs and not el["alt"] == "":
return [el["alt"]]
# if abbreviation use the title if not empty
if el.name == 'abbr' and "title" in el... | mit | Python | |
cb971a2ddeafafc3d77ac5d03f2cbdb5d06b4b23 | Add @stephentu's test utils | datamicroscopes/lda,datamicroscopes/lda,datamicroscopes/lda | microscopes/lda/testutil.py | microscopes/lda/testutil.py | """Test helpers specific to LDA
"""
import numpy as np
import itertools as it
from microscopes.common.testutil import permutation_iter
def toy_dataset(defn):
"""Generate a toy variadic dataset for HDP-LDA
"""
lengths = 1 + np.random.poisson(lam=1.0, size=defn.n())
def mkrow(nwords):
retur... | bsd-3-clause | Python | |
f6f022a4eb6af051becd5564c1b0de6943918968 | Add example of solving sudoku puzzle. | urska19/LVR-sat | sudoku_example.py | sudoku_example.py | #!/usr/bin/env python
import sys
sys.path.append("./src")
from sat import SAT_solver
from sudoku import sudoku, printSudoku, processResult
print "================================================="
print "SUDOKU"
print "================================================="
solver = SAT_solver()
# define bord as follows... | bsd-3-clause | Python | |
5af887858615ef99cf80468107f5082aaf01806e | Create initial high level abstraction | thatch45/table | table/__init__.py | table/__init__.py | '''
Bring the cryptography to the table. This package aims to make a single very
high level cryptographic interface which abstracts many underlying algorithms.
'''
# Import python libs
import os
import json
# Try to import serialization libs
try:
import msgpack
HAS_MSGPACK = True
except ImportError:
HAS_M... | apache-2.0 | Python | |
4e223603a0216a667acc888268f845b41d16ab03 | Add two unit-tests for LibraryInfo. | illume/numpy3k,jasonmccampbell/numpy-refactor-sprint,chadnetzer/numpy-gaurdro,chadnetzer/numpy-gaurdro,teoliphant/numpy-refactor,jasonmccampbell/numpy-refactor-sprint,Ademan/NumPy-GSoC,jasonmccampbell/numpy-refactor-sprint,illume/numpy3k,teoliphant/numpy-refactor,teoliphant/numpy-refactor,illume/numpy3k,Ademan/NumPy-GS... | numpy/distutils/tests/test_npy_pkg_config.py | numpy/distutils/tests/test_npy_pkg_config.py | import os
from tempfile import mkstemp
from numpy.testing import *
from numpy.distutils.npy_pkg_config import read_config
simple = """\
[meta]
Name = foo
Description = foo lib
Version = 0.1
[default]
cflags = -I/usr/include
libs = -L/usr/lib
"""
simple_d = {'cflags': '-I/usr/include', 'libflags': '-L/usr/lib',
... | bsd-3-clause | Python | |
d8a6d652a007c36d4742c3d9368181749e26f45f | Add the to-be default renderer, yaml_jinja | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/renderers/yaml_jinja.py | salt/renderers/yaml_jinja.py | '''
The default rendering engine, yaml_jinja, this renderer will take a yaml file
with the jinja template and render it to a high data format for salt states.
'''
# Import python libs
import os
# Import Third Party libs
import yaml
from jinja2 import Template
def render(template, functions, grains):
'''
Rend... | apache-2.0 | Python | |
177abe60620378f0a2651530bd13d5ebeeaabb33 | add debug info for an exception | openstack/vitrage,openstack/vitrage,openstack/vitrage | vitrage/api_handler/apis/event.py | vitrage/api_handler/apis/event.py | # Copyright 2017 - Nokia Corporation
#
# 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 ... | # Copyright 2017 - Nokia Corporation
#
# 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 |
a76ccdc38bb3363b28fd0ff3f55c37104241fca0 | Modify GoByMajority to have soft kwarg | bootandy/Axelrod,emmagordon/Axelrod,bootandy/Axelrod,kathryncrouch/Axelrod,mojones/Axelrod,risicle/Axelrod,risicle/Axelrod,uglyfruitcake/Axelrod,emmagordon/Axelrod,mojones/Axelrod,kathryncrouch/Axelrod,uglyfruitcake/Axelrod | axelrod/strategies/gobymajority.py | axelrod/strategies/gobymajority.py | from axelrod import Player
class GoByMajority(Player):
"""A player examines the history of the opponent: if the opponent has more
defections than cooperations then the player defects.
An optional memory attribute will limit the number of turns remembered (by
default this is 0)
"""
# memory_d... | from axelrod import Player
class GoByMajority(Player):
"""A player examines the history of the opponent: if the opponent has more
defections than cooperations then the player defects.
An optional memory attribute will limit the number of turns remembered (by
default this is 0)
"""
# memory_d... | mit | Python |
fc9798c22f56a50233a40cff30ddd60fbecf471b | Add management command to update Item fields that gets updated after save() | Parisson/TimeSide,Parisson/TimeSide,Parisson/TimeSide,Parisson/TimeSide,Parisson/TimeSide | timeside/server/management/commands/timeside-items-post-save.py | timeside/server/management/commands/timeside-items-post-save.py | from django.core.management.base import BaseCommand
from timeside.server.models import Item
class Command(BaseCommand):
help = "This command will generate all post_save callback and will thus create audio_duration, mime_type and sha1 field if missing"
def handle(self, *args, **options):
for item in ... | agpl-3.0 | Python | |
2b4ed8cc91ef4f5cd56dae7fbfa9e1a8f5dabcb8 | Add tests for the graphql_schema command | patrick91/pycon,patrick91/pycon | backend/tests/api/test_commands.py | backend/tests/api/test_commands.py | import io
from unittest.mock import Mock, mock_open, patch
import strawberry
from django.core.management import call_command
def test_generate_graphql_schema():
out = io.StringIO()
m_open = mock_open()
@strawberry.type
class TestSchema:
a: int
with patch("api.management.commands.graphq... | mit | Python | |
6e15254e879367fc40d8c7f6e06a6d85ae991ad1 | Add assignment_groups_sat.py | or-tools/or-tools,google/or-tools,or-tools/or-tools,or-tools/or-tools,google/or-tools,or-tools/or-tools,or-tools/or-tools,google/or-tools,or-tools/or-tools,google/or-tools,google/or-tools,google/or-tools | ortools/sat/samples/assignment_groups_sat.py | ortools/sat/samples/assignment_groups_sat.py | #!/usr/bin/env python3
# Copyright 2010-2021 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 ... | apache-2.0 | Python | |
daa70ec53fd6dfd32d8faaab77586aeca7b02e0f | Add script to kick idle bridged users from a room | matrix-org/matrix-appservice-irc,matrix-org/matrix-appservice-irc,matrix-org/matrix-appservice-irc | scripts/remove-idle-users.py | scripts/remove-idle-users.py | #!/usr/bin/env python
from __future__ import print_function
import argparse
import sys
import json
import urllib
import requests
import re
## debug request
import httplib as http_client
http_client.HTTPConnection.debuglevel = 1
def get_room_id(homeserver, alias, token):
res = requests.get(homeserver + "/_matrix/c... | apache-2.0 | Python | |
e6f79956c7863e0cd7de28efc2fdea923bfd8d1f | add base for library organizer script | DreadfulDeveloper/src-helpers,DreadfulDeveloper/src-helpers,DreadfulDeveloper/src-helpers | koda/main.py | koda/main.py | import os
import sys
from mutagen.easyid3 import EasyID3
def listDirectory(directory):
"get list of file info objects for files of particular extensions"
workdir = os.path.join(os.path.dirname(os.path.realpath(__file__)), directory)
fileList = [os.path.normcase(f) for f in os.listdir(workdir)]
return ... | mit | Python | |
31c7ed89e66c32c46650ee93bfa8c8b2b8fbfad1 | Add test for command compilation | Vnet-as/cisco-olt-client | cisco_olt_client/tests/test_command.py | cisco_olt_client/tests/test_command.py | from cisco_olt_client.command import Command
def test_simple_compile():
cmd_str = 'cmd --arg1=val1 --arg2=val2'
cmd = Command('cmd', (('arg1', 'val1'), ('arg2', 'val2')))
assert cmd.compile() == cmd_str
cmd = Command('cmd', {'arg1': 'val1', 'arg2': 'val2'})
# order is not guaranteed
assert '-... | mit | Python | |
9402b184dad739ae026ad2185148d6785dcb7e47 | FIX l10n_it_account, missing dependency | odoo-isa/l10n-italy,linkitspa/l10n-italy,ApuliaSoftware/l10n-italy,alessandrocamilli/l10n-italy,linkitspa/l10n-italy,linkitspa/l10n-italy,abstract-open-solutions/l10n-italy,andrea4ever/l10n-italy,hurrinico/l10n-italy,yvaucher/l10n-italy,luca-vercelli/l10n-italy,OpenCode/l10n-italy,maxhome1/l10n-italy,scigghia/l10n-ital... | l10n_it_account/__openerp__.py | l10n_it_account/__openerp__.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2010 OpenERP Italian Community (<http://www.openerp-italia.org>).
# All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# it unde... | # -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2010 OpenERP Italian Community (<http://www.openerp-italia.org>).
# All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# it unde... | agpl-3.0 | Python |
9f067eae31b706cded3cbada4175e9b8eb059b9a | add web API client that mirrors anyvcs *Repo objects | ClemsonSoCUnix/django-anyvcs,ClemsonSoCUnix/django-anyvcs | django_anyvcs/remote.py | django_anyvcs/remote.py | # Copyright 2013 Scott Duckworth
#
# This file is part of django-anyvcs.
#
# django-anyvcs is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any late... | bsd-3-clause | Python | |
62c55e6698a7b5e51a6acdd6ba303ddb4789a75b | Fix atag slow tests (#64567) | w1ll1am23/home-assistant,w1ll1am23/home-assistant,rohitranjan1991/home-assistant,rohitranjan1991/home-assistant,GenericStudent/home-assistant,toddeye/home-assistant,mezz64/home-assistant,mezz64/home-assistant,nkgilley/home-assistant,toddeye/home-assistant,nkgilley/home-assistant,GenericStudent/home-assistant,rohitranja... | tests/components/atag/conftest.py | tests/components/atag/conftest.py | """Provide common Atag fixtures."""
import asyncio
from unittest.mock import patch
import pytest
@pytest.fixture(autouse=True)
async def mock_pyatag_sleep():
"""Mock out pyatag sleeps."""
asyncio_sleep = asyncio.sleep
async def sleep(duration, loop=None):
await asyncio_sleep(0)
with patch("... | apache-2.0 | Python | |
f42dba095219ea95637a80be48fa746b688821c7 | Add weather alerts job | sevazhidkov/leonard | jobs/send_weather_alerts.py | jobs/send_weather_alerts.py | import json
import logging
import os
import requests
import telegram
from leonard import Leonard
telegram_client = telegram.Bot(os.environ['BOT_TOKEN'])
bot = Leonard(telegram_client)
bot.collect_plugins()
ENDPOINT_URL = 'https://api.darksky.net/forecast/{}'.format(os.environ['DARKSKY_TOKEN'])
def main():
for... | mit | Python | |
2f450c0cb3d4c440b695696f88b72202c2f7d788 | Test acquisition optimizer and multi source acquisition optimizer | EmuKit/emukit | tests/emukit/core/test_optimization.py | tests/emukit/core/test_optimization.py | import numpy as np
from emukit.core import ParameterSpace
from emukit.core import ContinuousParameter, InformationSourceParameter
from emukit.core.acquisition import Acquisition
from emukit.core.optimization import AcquisitionOptimizer
from emukit.core.optimization import MultiSourceAcquisitionOptimizer
class Simple... | apache-2.0 | Python | |
5bdb61409f139b393f17c9d40edc73c5874a4c38 | Add script to blacklist sequences from a fastq file | maubarsom/biotico-tools,maubarsom/biotico-tools,maubarsom/biotico-tools,maubarsom/biotico-tools,maubarsom/biotico-tools | python/fastq_filter.py | python/fastq_filter.py | #!/usr/bin/env python
import sys
import argparse
import os.path
import time
import logging
from signal import signal, SIGPIPE, SIG_DFL
signal(SIGPIPE, SIG_DFL)
def main(args):
with open(args.fastq_input,"r") as input_f:
total_reads = 0
match_count = 0
header_set = createHeaderSet(args.header_file)
include... | apache-2.0 | Python | |
e8549d72539715cdad03b7bde8e59d1c4f3afeb7 | Add merge_potree script (to be finished) | NLeSC/ahn-pointcloud-viewer,NLeSC/ahn-pointcloud-viewer-ws,NLeSC/Massive-PotreeConverter,NLeSC/ahn-pointcloud-viewer-ws,NLeSC/ahn-pointcloud-viewer | python/merge_potree.py | python/merge_potree.py | #!/usr/bin/env python
"""Merge the Potree OctTrees of each tile into a single one."""
import argparse, traceback, time, os, multiprocessing, struct, filecmp, json
def argument_parser():
""" Define the arguments and return the parser object"""
parser = argparse.ArgumentParser(
description="Merge the Potree... | apache-2.0 | Python | |
e505413ae74acbc4783d9eaaa6f0326093f274a9 | Move aside, idiot coming through | Inboxen/website,Inboxen/Inboxen,Inboxen/Inboxen,Inboxen/Inboxen,Inboxen/Inboxen | inboxen/inboxen/views/inbox/view.py | inboxen/inboxen/views/inbox/view.py | ##
# Copyright (C) 2013 Jessica Tallon & Matt Molyneaux
#
# This file is part of Inboxen front-end.
#
# Inboxen front-end is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version... | ##
# Copyright (C) 2013 Jessica Tallon & Matt Molyneaux
#
# This file is part of Inboxen front-end.
#
# Inboxen front-end is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version... | agpl-3.0 | Python |
f3c9689a78995fb739e73f4afb0c19cf7fb7ad44 | add a test file | charliezon/stock,charliezon/stock,charliezon/stock,charliezon/stock | www/test.py | www/test.py | import orm
from models import User
from orm import create_pool,destory_pool
import asyncio
loop = asyncio.get_event_loop()
@asyncio.coroutine
async def test():
await orm.create_pool(loop, user='root', password='rootroot', db='stock')
u = User(name='Test', email='test@example.com', passwd='1234567890', image='... | mit | Python | |
2e2c038c2408a06d99b0419da796b7ba24f00785 | Add lc0161_one_edit_distance.py | bowen0701/algorithms_data_structures | lc0161_one_edit_distance.py | lc0161_one_edit_distance.py | """Leetcode 161. One Edit Distance (Premium)
Medium
URL: https://leetcode.com/problems/one-edit-distance
Given two strings s and t, determine if they are both one edit distance apart.
Note:
There are 3 possiblities to satisify one edit distance apart:
- Insert a character into s to get t
- Delete a character from s ... | bsd-2-clause | Python | |
1e8c92dee80235b31a6774654e26b87f08a15b9b | Create anti_vowel.py | SpAiNiOr/mystudy,SpAiNiOr/mystudy,SpAiNiOr/mystudy | learning/test/anti_vowel.py | learning/test/anti_vowel.py | def anti_vowel(text):
result = ""
vowel = ['a','e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']
for k in range(len(text)):
if text[k] not in vowel:
result = result + text[k]
return result
| apache-2.0 | Python | |
77423e89298144bdafd73db2a1569787d18c6337 | implement redis | jamesmarlowe/Python-Data-Readers | datareaders/redisreader.py | datareaders/redisreader.py | import redis
class RedisReader:
def __init__(self, *args, **kwargs):
if 'host' in kwargs:
self.host = kwargs['host']
else:
print 'missing host argument, using 127.0.0.1'
self.host = '127.0.0.1'
if 'port' in kwargs:
self.port = kwargs['port']
... | bsd-2-clause | Python | |
31b998dee15f7fa4f2f8ad4510bfa9f99bc1ac90 | Add graph loader that builds a networkx graph from centerline and intersection data | LemonPi/Pathtreker,LemonPi/Pathtreker,LemonPi/Pathtreker | loadgraph.py | loadgraph.py | import shapefile
import networkx
import util
import math
# ap_sf = shapefile.Reader("address/ADDRESS_POINT_WGS84")
tcl_sf = shapefile.Reader("centerline/CENTRELINE_WGS84")
intersect_sf = shapefile.Reader("centerline-intersection/CENTRELINE_INTERSECTION_WGS84")
"""Feature codes that are considered in the centreline da... | bsd-3-clause | Python | |
2a4f977f49d3de8cef049d04477910f6a97c4a77 | add unittest to millipede function | evadot/millipede-python,EasonYi/millipede-python,moul/millipede-python,moul/millipede-python,getmillipede/millipede-python,EasonYi/millipede-python,evadot/millipede-python,getmillipede/millipede-python | tests/__init__.py | tests/__init__.py | # -*- coding: utf-8 -*-
"""
UnitTest for Millipede
"""
import unittest
import millipede
class TestMillipedeSize(unittest.TestCase):
"Test size parameter on millipede function"
def test_negative(self):
"Test with negative integer value"
self.assertEqual(
millipede.millipede(-1),
... | bsd-3-clause | Python | |
0ac8a5a564782f97e840ddce865c473c1235bcf6 | Create __init__.py | cmccomb/truss-me | tests/__init__.py | tests/__init__.py | mit | Python | ||
4fd7bea6f053f9a88f54eb5fea3ec1b8b6794cae | Add test file | tpeek/Answer-Prediction,tpeek/Answer-Prediction | tests/test_app.py | tests/test_app.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
| mit | Python | |
f574a74f99d1b8aa0fa107ba2416699104d1f36d | Add filter that gets items with the same .name from a list. | abhijo89/django-cbv-inspector,refreshoxford/django-cbv-inspector,abhijo89/django-cbv-inspector,abhijo89/django-cbv-inspector,refreshoxford/django-cbv-inspector,refreshoxford/django-cbv-inspector,refreshoxford/django-cbv-inspector,abhijo89/django-cbv-inspector | inspector/cbv/templatetags/cbv_tags.py | inspector/cbv/templatetags/cbv_tags.py | from django import template
from django.conf import settings
register = template.Library()
@register.filter
def called_same(qs, name):
return [item for item in qs if item.name==name]
| bsd-2-clause | Python | |
75abc0cbc8aa92e3bb65441546eea515d214193b | Integrate LLVM at llvm/llvm-project@bc1819389fb4 | paolodedios/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,yongtang/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,paolodedios/tensorflow,tensorflow/tensorflow-pywrap_saved_model,paolodedios/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,karllessard/tensorflow,t... | 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 = "bc1819389fb4701cdeba5e093278e32dd668d6d5"
LLVM_SHA256 = "5b0fd39810ceedb79207f6851c8122281637317732af848d442dc58effe53ade"
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 = "82c820b95cf7ec284baf182cf838ca9e26758098"
LLVM_SHA256 = "0e348b84926afae1913d44f2106122736585fd914b143f4b47fa23b48c52cdf8"
tf_http_archive(
... | apache-2.0 | Python |
019288dd65ea27656961a9e8f89ad6ed49f4b3a2 | Add policy description for fping | Juniper/nova,rahulunair/nova,gooddata/openstack-nova,rahulunair/nova,mikalstill/nova,mahak/nova,gooddata/openstack-nova,openstack/nova,jianghuaw/nova,rajalokan/nova,mikalstill/nova,klmitch/nova,phenoxim/nova,vmturbo/nova,Juniper/nova,mahak/nova,mahak/nova,Juniper/nova,vmturbo/nova,vmturbo/nova,rajalokan/nova,klmitch/no... | nova/policies/fping.py | nova/policies/fping.py | # Copyright 2016 Cloudbase Solutions Srl
# 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 r... | # Copyright 2016 Cloudbase Solutions Srl
# 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 r... | apache-2.0 | Python |
d5830f160764ef20d868fee866225f4d8b5e0dce | Integrate LLVM at llvm/llvm-project@90babc86c3fe | tensorflow/tensorflow-pywrap_saved_model,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow-pywrap_saved_model,tensorflow/tensorflow-experimental_link_static_libraries_once,Intel-Corporation/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow... | 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 = "90babc86c3feda7f9395b36ccfe72ca61bbc39e2"
LLVM_SHA256 = "00afe295779bfb068021f366c6cddbd1ada2a018ae0bb6adf433f51911c2cfb7"
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 = "f7e82e4fa849376ea9226220847a098dc92d74a0"
LLVM_SHA256 = "b8772661e4888770a2d8fa6bbb71fc5f8186a537f61e7d90a2177baadc1556d8"
tf_http_archive(
... | apache-2.0 | Python |
99e949050bacc39690f71e0fb65a85410d5383fe | Integrate LLVM at llvm/llvm-project@27712243ab26 | tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow-pywrap_saved_model,Intel-tensorflow/tensorflow,yongtang/tensorflow,paolodedios/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once... | 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 = "27712243ab2680fa87b2de52ca4245d7c22f81f8"
LLVM_SHA256 = "36bf23458699217e08a1998eb69683f595f2e4fd01eb0b117490963da5864d74"
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 = "56eaf869be27585bff7320505dfad32b5b3b6189"
LLVM_SHA256 = "5771d0bec7a63d6d9a1585435f89c185a24f80617077ef39e32604e72e857150"
tf_http_archive(
... | apache-2.0 | Python |
5bf06abf7a48266a78d16ef946260bb5d6397dfb | Integrate LLVM at llvm/llvm-project@c90cbb2d3455 | Intel-tensorflow/tensorflow,yongtang/tensorflow,gautam1858/tensorflow,paolodedios/tensorflow,yongtang/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,paolodedios/tensorflow,Intel-tensorflow/tensorflow,tensorflow/tensorflow,paolodedios/tensorflow,gautam1858/tensorflow,Intel-tensorflow/tensorflow... | 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 = "c90cbb2d3455a6e1421cc7e703d2043a399ef7aa"
LLVM_SHA256 = "f79a790414107224ebbfe07ce3b519479c73a53c8a887bf081a6640792e235ab"
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 = "9111635cb78e4a134364319e2728ff8dd69d36a8"
LLVM_SHA256 = "18ebb8069ebf0f909b311175a23c3d7fb3ec3f667993c72a70d84d0561ecb173"
tf_http_archive(
... | apache-2.0 | Python |
832b5314354271bf16cd162d0d24707714767718 | normalize data by time length | PKU-Dragon-Team/Datalab-Utilities | mobile_cluster/reshape_normalize.py | mobile_cluster/reshape_normalize.py | import pandas as pd
import pymysql
import os
import json
__location__ = os.path.join(os.getcwd(), os.path.dirname(os.path.realpath(__file__)))
with open(os.path.join(__location__, "config.json"), 'r') as config:
conf = json.load(config)
HOST = conf['host']
USER = conf['user']
PASS = conf['pass']
... | mit | Python | |
5dcb77b0f7358b68b8525a0948c333ed972f82ab | Create triple_trouble.py | Kunalpod/codewars,Kunalpod/codewars | triple_trouble.py | triple_trouble.py | #Kunal Gautam
#Codewars : @Kunalpod
#Problem name: Triple trouble
#Problem level: 6 kyu
def triple_double(num1, num2):
for i in range(10):
if str(i)*3 in str(num1) and str(i)*2 in str(num2):
return 1
return 0
| mit | Python | |
96f8f7417b1a8f0471ef7e8aff933fc36ab17fc5 | Add operations.py to categories module | OmeGak/indico,OmeGak/indico,DirkHoffmann/indico,mvidalgarcia/indico,pferreir/indico,ThiefMaster/indico,ThiefMaster/indico,DirkHoffmann/indico,ThiefMaster/indico,mvidalgarcia/indico,indico/indico,pferreir/indico,indico/indico,pferreir/indico,OmeGak/indico,mvidalgarcia/indico,mic4ael/indico,mic4ael/indico,mic4ael/indico,... | indico/modules/categories/operations.py | indico/modules/categories/operations.py | # This file is part of Indico.
# Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN).
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (a... | mit | Python | |
1a65b417129e0a32a079509c3e3868ced275b4b6 | Add a little validation utility. | DocNow/twarc,miku/twarc,kevinbgunn/twarc,edsu/twarc,remagio/twarc,hugovk/twarc,ericscartier/twarc,kevinbgunn/twarc,ericscartier/twarc,miku/twarc,remagio/twarc | utils/validate.py | utils/validate.py | #!/usr/bin/env python
import sys
import json
import fileinput
import dateutil.parser
line_number = 0
for line in fileinput.input():
... | mit | Python | |
4a450bdbc89fad136a90fa0812d417c253ac47b7 | Create UglyNum_001.py | cc13ny/Allin,Chasego/cod,cc13ny/Allin,Chasego/codirit,cc13ny/algo,Chasego/codirit,Chasego/codirit,cc13ny/algo,cc13ny/Allin,Chasego/codi,Chasego/cod,cc13ny/algo,Chasego/codi,cc13ny/algo,Chasego/codi,cc13ny/Allin,Chasego/codi,Chasego/codi,cc13ny/algo,Chasego/cod,Chasego/cod,cc13ny/Allin,Chasego/codirit,Chasego/codirit,Ch... | leetcode/263-Ugly-Number/UglyNum_001.py | leetcode/263-Ugly-Number/UglyNum_001.py | from math import sqrt
class Solution(object):
def isUgly(self, num):
"""
:type num: int
:rtype: bool
"""
if num < 1:
return False
while not num % 2:
num /= 2
while not num % 3:
num /= 3
while not num % 5:
... | mit | Python | |
e872f249590244814e67894fc48b97d63ccad2c2 | Add script to convert DET window file to VID window file. | myfavouritekk/TPN | tools/data/window_file_select_vid_classes.py | tools/data/window_file_select_vid_classes.py | #!/usr/bin/env python
import argparse
import scipy.io as sio
import os
import os.path as osp
import numpy as np
from vdetlib.vdet.dataset import index_det_to_vdet
if __name__ == '__main__':
parser = argparse.ArgumentParser('Convert a window file for DET for VID.')
parser.add_argument('window_file')
parser.... | mit | Python | |
cbd8a68d0f3d4b1074916bb0b540d8df6b37e549 | print actual json | lbryio/lbry,DaveA50/lbry,lbryio/lbry,zestyr/lbry,lbryio/lbry,zestyr/lbry,zestyr/lbry,DaveA50/lbry | lbrynet/lbrynet_daemon/LBRYDaemonCLI.py | lbrynet/lbrynet_daemon/LBRYDaemonCLI.py | import sys
import json
from lbrynet.conf import API_CONNECTION_STRING
from jsonrpc.proxy import JSONRPCProxy
help_msg = "Usage: lbrynet-cli method json-args\n" \
+ "Examples: " \
+ "lbrynet-cli resolve_name '{\"name\": \"what\"}'\n" \
+ "lbrynet-cli get_balance\n" \
... | import sys
import json
from lbrynet.conf import API_CONNECTION_STRING
from jsonrpc.proxy import JSONRPCProxy
help_msg = "Usage: lbrynet-cli method json-args\n" \
+ "Examples: " \
+ "lbrynet-cli resolve_name '{\"name\": \"what\"}'\n" \
+ "lbrynet-cli get_balance\n" \
... | mit | Python |
ce8c8fb23b9058e7fccbbd19d4ac22152df74221 | Add first unit tests for the state-space class | mp4096/controlboros | controlboros/tests/test_state_space.py | controlboros/tests/test_state_space.py | import controlboros
import numpy as np
def test_dynamics_single_input():
"""Test dynamics equation with single input."""
a = np.array([[1.0, 2.0], [0.0, 1.0]])
b = np.array([[1.0], [3.0]])
c = np.zeros((1, 2))
s = controlboros.StateSpace(a, b, c)
assert np.all(s.dynamics([1.0, 1.0], [1.0]) ... | bsd-3-clause | Python | |
268d67b3b6e81ba3b01a3e106dbabd5f03f42a50 | Add deprecation warning and backward compatibility | developersociety/django-glitter,developersociety/django-glitter,blancltd/django-glitter,blancltd/django-glitter,developersociety/django-glitter,blancltd/django-glitter | glitter/block_admin.py | glitter/block_admin.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import warnings
from glitter.blockadmin.blocks import BlockAdmin, site
from .models import BaseBlock # noqa
BlockModelAdmin = BlockAdmin
__all__ = ['site', 'BlockModelAdmin']
warnings.warn(
"BlockModelAdmin has been moved to blockadmin.blocks... | bsd-3-clause | Python | |
a0cbd0e419186060c13419f403785be8c496486f | add import script for Aylesbury Vale | DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_aylesbury_vale.py | polling_stations/apps/data_collection/management/commands/import_aylesbury_vale.py | from django.contrib.gis.geos import Point
from data_collection.management.commands import BaseCsvStationsCsvAddressesImporter
from data_finder.helpers import geocode_point_only, PostcodeError
class Command(BaseCsvStationsCsvAddressesImporter):
council_id = 'E07000004'
addresses_name = 'Aylesbury Vale PropertyP... | bsd-3-clause | Python | |
5a1c3e52f1b07d827ff8afd333a1421ba63ca542 | Create __init__.py | shnizzedy/SM_openSMILE,shnizzedy/SM_openSMILE,shnizzedy/SM_openSMILE,shnizzedy/SM_openSMILE,shnizzedy/SM_openSMILE | openSMILE_preprocessing/__init__.py | openSMILE_preprocessing/__init__.py | apache-2.0 | Python | ||
40b911898cc100baf62473788112721f7e5e92ae | add get_pkg_version command | daniel-yavorovich/cpan2repo,daniel-yavorovich/cpan2repo,daniel-yavorovich/cpan2repo,daniel-yavorovich/cpan2repo | webui/management/commands/get_pkg_version.py | webui/management/commands/get_pkg_version.py | from django.core.management.base import BaseCommand, CommandError
from webui.models import BuildConfiguration
class Command(BaseCommand):
help = 'Get debian package version by build_conf id'
def handle(self, *args, **options):
self.stdout.write("{0}\n".format(BuildConfiguration.objects.get(pk=args[0]... | apache-2.0 | Python | |
81771f60b00d605dfe1bc07f1af6660cd3c1e0f2 | Improve unit test coverage for cmd/conductor.py | ArchiFleKs/magnum,ArchiFleKs/magnum,openstack/magnum,openstack/magnum | magnum/tests/unit/cmd/test_conductor.py | magnum/tests/unit/cmd/test_conductor.py | # Copyright 2016 - Fujitsu, Ltd.
#
# 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 agr... | apache-2.0 | Python | |
232aef0417fc10ecc73820b73d4b104498ff3bd3 | Add simple script for parsing meeting doc dirs | tuomasjjrasanen/klupu,tuomasjjrasanen/klupu | parse.py | parse.py | # KlupuNG
# Copyright (C) 2013 Koodilehto Osk <http://koodilehto.fi>.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later ve... | agpl-3.0 | Python | |
258b4931f0f27ee698abb702243789d40a21e8d4 | Add dummy BaseCurrentPlaylistController | swak/mopidy,dbrgn/mopidy,ZenithDK/mopidy,bencevans/mopidy,vrs01/mopidy,jmarsik/mopidy,tkem/mopidy,SuperStarPL/mopidy,jodal/mopidy,ali/mopidy,mopidy/mopidy,woutervanwijk/mopidy,rawdlite/mopidy,diandiankan/mopidy,hkariti/mopidy,bacontext/mopidy,diandiankan/mopidy,ZenithDK/mopidy,SuperStarPL/mopidy,glogiotatidis/mopidy,be... | mopidy/backends/__init__.py | mopidy/backends/__init__.py | import logging
import time
from mopidy.exceptions import MpdNotImplemented
from mopidy.models import Playlist
logger = logging.getLogger('backends.base')
class BaseBackend(object):
current_playlist = None
library = None
playback = None
stored_playlists = None
uri_handlers = []
class BaseCurrentP... | import logging
import time
from mopidy.exceptions import MpdNotImplemented
from mopidy.models import Playlist
logger = logging.getLogger('backends.base')
class BaseBackend(object):
current_playlist = None
library = None
playback = None
stored_playlists = None
uri_handlers = []
class BasePlayback... | apache-2.0 | Python |
c864c6f3ec8c30f0a9c5902e8f0ce8e1abd06565 | add views | ktbyers/pynet_ons,ktbyers/pynet_ons | django/views.py | django/views.py | from django.shortcuts import render
from django.http import HttpResponse
from django.template import loader, RequestContext
from net_system.models import NetworkDevice
# Create your views here.
def index(request):
return HttpResponse("Hello, world!")
def test(request):
c = RequestContext(request, {})
t ... | apache-2.0 | Python | |
5f4580cdc2f46ef9294057372609e1b9a48f7041 | Add a test for the cardxml databases | HearthSim/python-hearthstone | tests/test_cardxml.py | tests/test_cardxml.py | from hearthstone import cardxml
def test_cardxml_load():
cardid_db, _ = cardxml.load()
dbf_db, _ = cardxml.load_dbf()
assert cardid_db
assert dbf_db
for card_id, card in cardid_db.items():
assert dbf_db[card.dbf_id].id == card_id
for dbf_id, card in dbf_db.items():
assert cardid_db[card.id].dbf_id == dbf... | mit | Python | |
1d66feb87537aa37aabcd0bf88d8e0fa7899834a | test for document clustering | vanatteveldt/xtas,vanatteveldt/xtas,vanatteveldt/xtas | tests/test_cluster.py | tests/test_cluster.py | from celery import chain
from xtas.tasks import kmeans
# The clusters in these should be obvious.
DOCS = [
"apple pear banana fruit",
"apple apple cherry banana",
"pear fruit banana pineapple",
"beer pizza pizza beer",
"pizza pineapple coke",
"beer coke sugar"
]
def test_kmeans():
cluster... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.