commit
stringlengths
40
40
subject
stringlengths
1
1.49k
old_file
stringlengths
4
311
new_file
stringlengths
4
311
new_contents
stringlengths
1
29.8k
old_contents
stringlengths
0
9.9k
lang
stringclasses
3 values
proba
float64
0
1
5466616a12d6044f7fcba95d0d513e51b4c4a23b
add silab_default_producer to examples which should run out-of-the-box for most SiLab DAQ systems
online_monitor/examples/producer_sim/silab_default_producer.py
online_monitor/examples/producer_sim/silab_default_producer.py
import time import tables as tb import zmq from online_monitor.utils.producer_sim import ProducerSim from online_monitor.utils import utils class SiLabDefaultProducerSim(ProducerSim): """ Producer simulator reading standard SiLab DAQ system HDF5 data and replying it """ def setup_producer_device(se...
Python
0
ca25a4e2aedd657a10c7bfa2849f9f3d16f5ee9f
Add Eq demo
demo/eq.py
demo/eq.py
# typeclasses, an educational implementation of Haskell-style type # classes, in Python # # Copyright (C) 2010 Nicolas Trangez <eikke eikke com> # # This library 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 Fou...
Python
0.000001
176ab29c5f0506d5ba94a2676b81f34f7e2a6b3b
Add migration for expiration_date change (#28)
groups_manager/migrations/0005_auto_20181001_1009.py
groups_manager/migrations/0005_auto_20181001_1009.py
# -*- coding: utf-8 -*- # Generated by Django 1.9 on 2018-10-01 10:09 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('groups_manager', '0004_0_6_0_groupmember_expiration_date'), ] operations = [ m...
Python
0.000002
7043c46624df6f1899df9fc58e1a8631fc67f43d
add log.py
pprof/log.py
pprof/log.py
#!/usr/bin/env python # encoding: utf-8 """ Analyze the PPROF database. """ from plumbum import cli from pprof.driver import PollyProfiling def print_runs(query): """ Print all rows in this result query. """ if query is None: return for tup in query: print("{} @ {} - {} id: {} group: {...
Python
0.000024
caa92a302f3dcc6ed084ebc9f20db28c63d48d29
Add missing file
irrigator_pro/uga/aggregates.py
irrigator_pro/uga/aggregates.py
from django.db import connections from django.db.models.aggregates import Aggregate from django.db.models.sql.aggregates import Aggregate as SQLAggregate from uga.models import UGAProbeData __initialized__ = False class SimpleAggregate(Aggregate): def add_to_query(se...
Python
0.000006
253cda3fc9d377dc64fe4b67b5fe55f911c8693f
Add startsliver script.
protogeni/test/startsliver.py
protogeni/test/startsliver.py
#! /usr/bin/env python # # GENIPUBLIC-COPYRIGHT # Copyright (c) 2008-2009 University of Utah and the Flux Group. # All rights reserved. # # Permission to use, copy, modify and distribute this software is hereby # granted provided that (1) source code retains these copyright, permission, # and disclaimer notices, and (...
Python
0
aa88f2b64c8c2837022ee020862ec2c0a9a6e7ad
Add fabfile for generating docs in gh-pages branch.
fabfile.py
fabfile.py
from __future__ import with_statement import os from fabric.api import abort, local, task, lcd @task(default=True) def docs(clean='no', browse_='no'): with lcd('docs'): local('make clean html') temp_path = "/tmp/openxc-python-docs" docs_path = "%s/docs/_build/html" % local("pwd", capture=True) ...
Python
0
1e4f86f3184d0ae09d2a14690257ba9d4c44edb1
remove dups (local sequence alignments)
repertoire/collapse_reads.py
repertoire/collapse_reads.py
#!/usr/bin/env python # encoding: utf-8 """ matches = pairwise2.align.localms(target, query, 1, -1, -3, -2) try: # highest scoring match first return int(matches[0][3]) except IndexError: """ import sys from toolshed import nopen from parsers import read_fastx from Bio import pairwise2 from collections import O...
Python
0
736093f945ff53c4fe6d9d8d2e0c4afc28d9ace3
Add answer to leetcode rotate list
chimera/py/leetcode_rotate_list.py
chimera/py/leetcode_rotate_list.py
# coding=utf-8 """ chimera.leetcode_rotate_list ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Given a list, rotate the list to the right by k places, where k is non-negative. For example: Given 1->2->3->4->5->NULL and k = 2, return 4->5->1->2->3->NULL. """ # Definition for singly-linked list. # class ListNode(object): # def __...
Python
0.000002
22bb91cfc1b1dc637e33625dcbaf3e8499b384ec
Add LinearRegression.py
1-LinearRegression/LinearRegression.py
1-LinearRegression/LinearRegression.py
import tensorflow as tf # TensorFlow Example (1) - Linear Regression # # (model) y = ax + b # By giving some pairs of (x, y) that satisfies the given model, # TensorFlow can compute the value of 'a' and 'b' # by using very simple Machine Learning(ML) algorithm. # 1. implementing our model. # TensorFlow has an eleme...
Python
0.000295
08d7e10d74297f16e4bcb5cfb7de0749d9d101bc
add missing fiel
codeskel/localcommands/__init__.py
codeskel/localcommands/__init__.py
Python
0.000006
0c289af5ef7f26796bdc4b4183f456074f7440f7
Create dijkstra.py
3-AlgorithmsOnGraphs/Week4/dijkstra/dijkstra.py
3-AlgorithmsOnGraphs/Week4/dijkstra/dijkstra.py
#Uses python3 import sys import queue def Dijkstra(adj, s, cost, t): dist = list() prev = list() inf = 0 for c in cost: inf += sum(c) inf += 1 for u in range(0, len(adj)): dist.append(inf) prev.append(None) dist[s] = 0 H = queue.PriorityQueue() for i, d in...
Python
0.000001
26ae4b857780ba8d5ecfbd8c8cab39452f086e58
add conf.py for docs (test)
docs/conf.py
docs/conf.py
# -*- coding: utf-8 -*- # # bazooka documentation build configuration file, created by # sphinx-quickstart on Tue Mar 3 13:34:12 2015. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # A...
Python
0
18e8cee5c19329dac7e931cb00e67f8d19e3f89d
add script `compare_win_set`
examples/bunny/compare_win_set.py
examples/bunny/compare_win_set.py
from dd import cudd b = cudd.BDD() u_gr1x = cudd.load('winning_set', b) u_slugs = b.load('winning_set_bdd.txt') env_action_slugs = b.load('env_action_slugs.txt') sys_action_slugs = b.load('sys_action_slugs.txt') assumption_0_slugs = b.load('assumption_0_slugs.txt') goal_0_slugs = b.load('goal_0_slugs.txt') env_acti...
Python
0
46bcea5a4c1a46cd7e458fa5fd7b761bbea25b4f
add a RAI radio player
rai_radio.py
rai_radio.py
#!/usr/bin/env python import sys from PySide.QtCore import * from PySide.QtGui import * from pprint import pprint import subprocess import argparse # URL list taken from http://www.rai.it/dl/portale/info_radio.html STATIONS = [ ['Radio 1', 'http://mediapolis.rai.it/relinker/relinkerServlet.htm?cont=162834'], ...
Python
0.000001
f4e4d2781662f7f8c38b12aacc5ad0fca6e1b4da
add comparison with svm^struct on multiclass data
examples/multiclass_comparision_svm_struct.py
examples/multiclass_comparision_svm_struct.py
""" ================================================================== Comparing PyStruct and SVM-Struct for multi-class classification ================================================================== This example compares the performance of pystruct and SVM^struct on a multi-class problem. For the example to work, y...
Python
0
cc19cdc3430df018e3a8fa63abaf796a897a475b
Add naive bayes SQL test.
Orange/tests/sql/test_naive_bayes.py
Orange/tests/sql/test_naive_bayes.py
import unittest from numpy import array import Orange.classification.naive_bayes as nb from Orange.data.discretization import DiscretizeTable from Orange.data.sql.table import SqlTable from Orange.data.variable import DiscreteVariable class NaiveBayesTest(unittest.TestCase): def test_NaiveBayes(self): t...
Python
0.000001
0ed71f8c580e8eb80c55b817c3f971b946016f02
update docstring for Postman.connection
mailthon/postman.py
mailthon/postman.py
""" mailthon.postman ~~~~~~~~~~~~~~~~ This module implements the central Postman object. :copyright: (c) 2015 by Eeo Jun :license: MIT, see LICENSE for details. """ from contextlib import contextmanager from smtplib import SMTP from .response import SendmailResponse from .helpers import encode_ad...
""" mailthon.postman ~~~~~~~~~~~~~~~~ This module implements the central Postman object. :copyright: (c) 2015 by Eeo Jun :license: MIT, see LICENSE for details. """ from contextlib import contextmanager from smtplib import SMTP from .response import SendmailResponse from .helpers import encode_ad...
Python
0
78f89e96adedd1045f900d5f9f95c3eb35c12ca3
Create routine module with Tool class
performance/routine.py
performance/routine.py
class Tool: def __init__(self, config): pass
Python
0
8a841da19dee2aed6838737aad5485d25b4c8e74
add DetectPlates.py
DetectPlates.py
DetectPlates.py
# DetectPlates.py import cv2 import numpy as np import math import Main import random import Preprocess import DetectChars import PossiblePlate import PossibleChar # module level variables ########################################################################## PLATE_WIDTH_PADDING_FACTOR = 1.1 PLATE_HEIGHT_PADDING...
Python
0
6c0aab6c14539b1cd4eedcd1280bcc4eb35ff7ea
Create poly_talker.py
poly_talker.py
poly_talker.py
#! /usr/bin/env python import rospy from std_msgs.msg import String from random import randint def talker(): # List of names to be printed words = ["Dr. Bushey", "Vamsi", "Jon"] # Registers with roscore a node called "talker". # ROS programs are called nodes. rospy.init_node('talker') # Publisher object get...
Python
0.000001
7b3753428f04c86b95191e76ca2c50b54577411a
add problem 27
problem_027.py
problem_027.py
#!/usr/bin/env python #-*-coding:utf-8-*- ''' Euler discovered the remarkable quadratic formula: n² + n + 41 It turns out that the formula will produce 40 primes for the consecutive values n = 0 to 39. However, when n = 40, 402 + 40 + 41 = 40(40 + 1) + 41 is divisible by 41, and certainly when n = 41, 41² + 41 + 41 ...
Python
0.019702
f530fb3ebe5639d7d6dfe013c5abc70769009a04
add script
collapse.py
collapse.py
#!/usr/bin/env python import json import sys import argparse import xmldict f='bla.json' ref=2 out=[] with open(f) as data_file: pages = json.load(data_file) for page in pages: data = page['data'] lineIter = iter(data) oldline = None for line in lineIter: ref_line = line[ref]['text'] if...
Python
0.000001
e9451a8b2d196353e393d265482e37faa651eb1e
Tue Nov 4 20:46:16 PKT 2014 Init
chromepass.py
chromepass.py
from os import getenv import sqlite3 import win32crypt appdata = getenv("APPDATA") connection = sqlite3.connect(appdata + "\..\Local\Google\Chrome\User Data\Default\Login Data") cursor = connection.cursor() cursor.execute('SELECT action_url, username_value, password_value FROM logins') for information in cursor.fetch...
Python
0
0c38c72ef0bc337677f80f0b087ffa374f211e37
Create saxparser.py
saxparser.py
saxparser.py
#!/usr/bin/python import sys import xml.sax import io import MySQLdb class MyHandler(xml.sax.ContentHandler): def __init__(self): xml.sax.ContentHandler.__init__(self) self.db = MySQLdb.connect(host="localhost", user="root", passwd="", db="registerdb2011") self.cursor = self.db.cursor() ...
Python
0.000002
cf9b6b477e6d044e4065086f98906a0eb4504ff3
Add slack_nagios script
slack_nagios.py
slack_nagios.py
#!/bin/python import argparse import requests """ A simple script to post nagios notifications to slack Similar to https://raw.github.com/tinyspeck/services-examples/master/nagios.pl But adds proxy support Note: If your internal proxy only exposes an http interface, you will need to be running a modern version of u...
Python
0
f437b7875aa4bed06dcf3884bb81c009b7e473f0
Add 290-word-pattern.py
290-word-pattern.py
290-word-pattern.py
""" Question: Word Pattern Given a pattern and a string str, find if str follows the same pattern. Examples: pattern = "abba", str = "dog cat cat dog" should return true. pattern = "abba", str = "dog cat cat fish" should return false. pattern = "aaaa", str = "dog cat cat dog" should return fal...
Python
0.999973
f39a640a8d5bf7d4a5d80f94235d1fa7461bd4dc
Add code for stashing a single nuxeo image on s3.
s3stash/stash_single_image.py
s3stash/stash_single_image.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys, os import argparse import logging import json from s3stash.nxstashref_image import NuxeoStashImage def main(argv=None): parser = argparse.ArgumentParser(description='Produce jp2 version of Nuxeo image file and stash in S3.') parser.add_argument('path',...
Python
0
12821e2859151e8f949f55b8c363ff95d296a7d0
add setup.py for python interface
python/setup.py
python/setup.py
#!/usr/bin/env python from distutils.core import setup, Extension setup(name = "LIBSVM", version = "2.87", author="Chih-Chung Chang and Chih-Jen Lin", maintainer="Chih-Jen Lin", maintainer_email="cjlin@csie.ntu.edu.tw", url="http://www.csie.ntu.edu.tw/~cjlin/libsvm/", description =...
Python
0.000001
794b8c32dd0c5bd45bb580a75f6f4da63b689eb6
Add `find_contentitem_urls` management command to index URL usage
fluent_contents/management/commands/find_contentitem_urls.py
fluent_contents/management/commands/find_contentitem_urls.py
import operator from functools import reduce import sys from django.core.management.base import BaseCommand from django.db import models from django.db.models import Q from django.utils.encoding import force_text from django.utils import six from fluent_contents.extensions import PluginHtmlField, PluginImageField, Plu...
Python
0
836459d4858c4892bdada9b970d73eadb43ad51b
Add settings
problemotd/settings.py
problemotd/settings.py
''' Django settings for problemotd project. For more information on this file, see https://docs.djangoproject.com/en/1.6/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.6/ref/settings/ ''' # Build paths inside the project like this: os.path.join(BASE_DIR, ...)...
Python
0.000002
fc911a4952a46ea372e1a42cff78351b4f8b42ef
complete 15 lattice paths
15-lattice-paths.py
15-lattice-paths.py
from collections import defaultdict from math import factorial as fac if __name__ == '__main__': # Dynamic programming method paths = defaultdict(dict) for i in range(21): paths[0][i] = 1 paths[i][0] = 1 for i in range(1, 21): for j in range(1, 21): paths[i][j] = pat...
Python
0
7b9ba5b6f692c6f0e4408364c275abda05518c2b
add expect_column_values_to_be_valid_west_virginia_zip (#4802)
contrib/experimental/great_expectations_experimental/expectations/expect_column_values_to_be_valid_west_virginia_zip.py
contrib/experimental/great_expectations_experimental/expectations/expect_column_values_to_be_valid_west_virginia_zip.py
import json from typing import Optional import zipcodes from great_expectations.core.expectation_configuration import ExpectationConfiguration from great_expectations.exceptions import InvalidExpectationConfigurationError from great_expectations.execution_engine import ( PandasExecutionEngine, SparkD...
Python
0
684387315025bc7789aa75def757894cb8d92154
add quickie Python JSON-filtering script
dev/filter_json.py
dev/filter_json.py
# == BSD2 LICENSE == # Copyright (c) 2014, Tidepool Project # # This program is free software; you can redistribute it and/or modify it under # the terms of the associated License, which is identical to the BSD 2-Clause # License as published by the Open Source Initiative at opensource.org. # # This program is distri...
Python
0.000001
7d20f9bcbfda514c216fb7faaa08325f21c0e119
add 01 code
01-two-snum.py
01-two-snum.py
class Solution(object): def twoSum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ for i in range(len(nums)): last = nums[i] # print last for j, num in enumerate(nums[i+1:]): # ...
Python
0
dd2422293e403a9f664fe887d3fd0950ba540fc0
the inverse returns an int
044_pentagon_numbers.py
044_pentagon_numbers.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # A Solution to "Pentagon numbers" – Project Euler Problem No. 44 # by Florian Buetow # # Sourcecode: https://github.com/fbcom/project-euler # Problem statement: https://projecteuler.net/problem=44 def get_pentagonal_number(n): return int(n*(3*n-1)/2) def is_penta...
Python
0.99996
b699a18f8928a6e859ebc34a843e4c8a64a22b26
add script to grid-search model parameters — script from scikit-learn: http://scikit-learn.org/stable/modules/generated/sklearn.model_selection.GridSearchCV.html#sklearn.model_selection.GridSearchCV
scripts/grid_search_digits.py
scripts/grid_search_digits.py
""" ============================================================ Parameter estimation using grid search with cross-validation ============================================================ This examples shows how a classifier is optimized by cross-validation, which is done using the :class:`sklearn.model_selection.GridS...
Python
0
3c2316b69fcee9db820937c2814a9872e27f95a9
Implement frequent direction sketch
fd_sketch.py
fd_sketch.py
# -*- coding: utf-8 -*- #!/usr/bin/env python import numpy as np import numpy.linalg as ln import math import sys """ This is a simple and deterministic method for matrix sketch. The original method has been introduced in [Liberty2013]_ . [Liberty2013] Edo Liberty, "Simple and Deterministic Matrix Sketching", ACM SI...
Python
0.000037
fe86df913b79fdf8c3627fe31b87c6dfa3da4f46
implement QEngine
engines/QEngine.py
engines/QEngine.py
#!/usr/bin/env python3 from ChessEngine import ChessEngine import chess import sys sys.path.append('.') import data class QEngine(ChessEngine): def __init__(self, picklefile): super().__init__() with open(picklefile, "rb") as f: self.Q = pickle.load(Q, f) def search(self): ...
Python
0.000007
e782e519012c4734f591388114fc954fdc014acf
add thousands_separator in Python to format folder
src/Python/format/thousands_separator.py
src/Python/format/thousands_separator.py
#!/usr/bin/env python print " Formated number:", "{:,}".format(102403)
Python
0
3e8c18b32058d9d33ae0d12744355bb65c2b96ed
add alembic migration for orders table
migrations/versions/187cf9175cee_add_orders_table.py
migrations/versions/187cf9175cee_add_orders_table.py
"""add orders table Revision ID: 187cf9175cee Revises: 3d8cf74c2de4 Create Date: 2015-10-23 23:43:31.769594 """ # revision identifiers, used by Alembic. revision = '187cf9175cee' down_revision = '3d8cf74c2de4' from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto generated by Alembic...
Python
0
64dede2c9a3d489eb8c93200ea8788c26db6da31
Create 6kyu_divisor_harmony.py
Solutions/6kyu/6kyu_divisor_harmony.py
Solutions/6kyu/6kyu_divisor_harmony.py
def solve(a,b): pairs={} for i in range(a,b): ratio=div_sum(i)/i try: pairs[ratio]=pairs[ratio]+[i] except: pairs[ratio]=[i] return sum(min(i) for i in pairs.values() if len(i)>=2) def div_sum(n): return sum(i for i in range(1,n+1) if n%i==0)
Python
0.000014
de7b7d10e5776d631c15660255cf8ad2b85f3d25
Create Beginner 10-A.py
Beginner/10/10-A.py
Beginner/10/10-A.py
#AtCoder Beginner 10 A name = raw_input() print name + "pp"
Python
0.000084
d65e9246256709f2cec0fa863515cca0dc4acb0b
add config for sphinx documentation
doc/source/conf.py
doc/source/conf.py
# -*- coding: utf-8 -*- # # lilik_playbook documentation build configuration file, created by # sphinx-quickstart on Fri Apr 7 14:02:37 2017. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file...
Python
0
871e9e4bdca027e577bdcde38f483e2de32c8528
Add simple example
examples/simple.py
examples/simple.py
# -*- coding: utf-8 -*- import time from apns_proxy_client import APNSProxyClient valid_token = "YOUR VALID TOKEN" def main(): client = APNSProxyClient(host="localhost", port=5556, application_id="14") i = 0 with client: token = valid_token client.send(token, 'Alert with default sound...
Python
0.000375
9ec5e3f57a64e6242b5d91eb0bf66e238fa48ec2
call superclass __init__() in constructor
smartcard/pyro/PyroReader.py
smartcard/pyro/PyroReader.py
"""PyroReaderClient: concrete reader class for Remote Readers __author__ = "gemalto http://www.gemalto.com" Copyright 2001-2012 gemalto Author: Jean-Daniel Aussel, mailto:jean-daniel.aussel@gemalto.com This file is part of pyscard. pyscard is free software; you can redistribute it and/or modify it under the terms o...
"""PyroReaderClient: concrete reader class for Remote Readers __author__ = "gemalto http://www.gemalto.com" Copyright 2001-2012 gemalto Author: Jean-Daniel Aussel, mailto:jean-daniel.aussel@gemalto.com This file is part of pyscard. pyscard is free software; you can redistribute it and/or modify it under the terms o...
Python
0.000024
9f7bd49350b0d1b8a8986b28db75a5b369bf7bb5
Add py solution for 393. UTF-8 Validation
py/utf-8-validation.py
py/utf-8-validation.py
class Solution(object): def validUtf8(self, data): """ :type data: List[int] :rtype: bool """ it = iter(data) while True: try: c = it.next() & 0xff try: t = 0x80 n = 0 ...
Python
0.000002
fb70822079c47962f0f713bcea43af80fe58d93e
add example using the VTKMesh class
examples/mesh_vtk_example.py
examples/mesh_vtk_example.py
from numpy import array from simphony.cuds.mesh import Point, Cell, Edge, Face from simphony.core.data_container import DataContainer from simphony_mayavi.cuds.api import VTKMesh points = array([ [0, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 1], [2, 0, 0], [3, 0, 0], [3, 1, 0], [2, 1, 0], [2, 0, 1], [3, 0, 1],...
Python
0
bdc062830a943a312dc6b56002f5ca6ae3990b80
add example
examples/peer/peer_matrix.py
examples/peer/peer_matrix.py
import cupy def main(): gpus = cupy.cuda.runtime.getDeviceCount() for peerDevice in range(gpus): for device in range(gpus): if peerDevice == device: continue flag = cupy.cuda.runtime.deviceCanAccessPeer(device, peerDevice) print( f'Ca...
Python
0.000002
51530297a561fa9630f69c70810c1b4bbeb7ecf0
Create testmessage table
migrations/versions/187eade64ef0_create_testmessage_table.py
migrations/versions/187eade64ef0_create_testmessage_table.py
"""Create testmessage table Revision ID: 187eade64ef0 Revises: 016f138b2da8 Create Date: 2016-06-21 16:11:47.905481 """ # revision identifiers, used by Alembic. revision = '187eade64ef0' down_revision = '016f138b2da8' from alembic import op import sqlalchemy as sa def upgrade(): op.create_table( 'test...
Python
0
cc84a5c71f84596af61b2de4a16cd62ff0209b16
Add migration file
migrations/versions/fd02d1c7d64_add_hail_migration_fields.py
migrations/versions/fd02d1c7d64_add_hail_migration_fields.py
"""Add hail migration fields Revision ID: fd02d1c7d64 Revises: 59e5faf237f8 Create Date: 2015-04-15 12:04:43.286358 """ # revision identifiers, used by Alembic. revision = 'fd02d1c7d64' down_revision = '59e5faf237f8' from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql def upgr...
Python
0.000001
dde52eb2bb035644e1147bbe21fcf9b1200a2e6b
Add example of section tree from SWC data block.
examples/section_tree_swc.py
examples/section_tree_swc.py
'''Example showing how to extract section information from SWC block''' import numpy as np from neurom import ezy from neurom.io import swc from neurom.core.tree import Tree from neurom.core import section_neuron as sn from neurom.core.dataformat import COLS from neurom.core.dataformat import POINT_TYPE class Section...
Python
0
c560be326c10c1e90b17ba5c6562f55c44dea9f3
Create main.py
GCP_deploy/main.py
GCP_deploy/main.py
# Copyright 2020 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
Python
0.000001
730c7e0e36f0466172c050dd791915938c648953
summarize git-shortlog by mail
gist/git_shortlog_mail.py
gist/git_shortlog_mail.py
""" Background: git shortlog -nse User may use different nick name in git-shortlog, but always use same mail. This command cannot map user by mail. I have to use complex .mailmap file. Write this script to summarize commit number by mail instead of by user name. How to use: git shortlog -nse > git_shortlog.lis...
Python
0.999844
b15bea24cce110619615138c91df0fe79dd04be3
Add spider for Buy Buy Baby
locations/spiders/buybuybaby.py
locations/spiders/buybuybaby.py
# -*- coding: utf-8 -*- import json import scrapy import re from locations.items import GeojsonPointItem class BuyBuyBabySpider(scrapy.Spider): name = "buybuybaby" allowed_domains = ["buybuybaby.com"] start_urls = ( 'https://stores.buybuybaby.com/', ) def store_hours(self, store_hours): ...
Python
0
fc84c19cdbbe86b1a57efb3468cdfc26785ca4a6
add utility helper to format table for console output
rawdisk/util/output.py
rawdisk/util/output.py
import numpy as np def format_table(headers, columns, values, ruler='-'): printable_rows = [] table = np.empty((len(values), len(columns)), dtype=object) for row, value in enumerate(values): table[row] = [str(getattr(value, column)) for column in columns] column_widths = [ max(len(he...
Python
0
100a03003adf3f425d59b69e95078bd0f1e82193
Add test script for segfault bug reported by Jeremy Hill.
test/reopen_screen.py
test/reopen_screen.py
#!/usr/bin/env python # Test for bug reported by Jeremy Hill in which re-opening the screen # would cause a segfault. import VisionEgg VisionEgg.start_default_logging(); VisionEgg.watch_exceptions() from VisionEgg.Core import Screen, Viewport, swap_buffers import pygame from pygame.locals import QUIT,KEYDOWN,MOUSEBU...
Python
0.000011
35849cf3650c5815c0124f90fad3d3fa2ef9abc6
Create InsertationSort2.py
InsertationSort2.py
InsertationSort2.py
def compareAndRep(numbers , a , b): temp = numbers[a] numbers[a] = numbers[b] numbers[b] = temp return numbers def printList(numbers): strp = "" for i in range(0 , len(numbers)): strp += str(numbers[i]) if(i+1 < len(numbers)): strp += " " print strp N = int(raw_input()) numbers = map(int , raw_input()...
Python
0
45136a5757ed362818216acdb390bb0c43bf35f7
Create photos2geojson.py
photos2map/photos2geojson.py
photos2map/photos2geojson.py
# -*- coding: UTF-8 -*- import os, sys import exiftool import json from fractions import Fraction def progress(count, total, status=''): bar_len = 60 filled_len = int(round(bar_len * count / float(total))) percents = round(100.0 * count / float(total), 1) bar = '=' * filled_len + '-' * (bar_len -...
Python
0.000016
97e46b93124758bec85d2e81a6843c22a265bce3
Add entry point for GC repo importer
ForgeImporters/setup.py
ForgeImporters/setup.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (t...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (t...
Python
0
76f473cd5d5a8ed1c6c5deb173587ce01e5b8f29
add a proxmox inventory plugin
plugins/inventory/proxmox.py
plugins/inventory/proxmox.py
#!/usr/bin/env python # Copyright (C) 2014 Mathieu GAUTHIER-LAFAYE <gauthierl@lapth.cnrs.fr> # # 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 Foundation, either version 3 of the License, or # (at your op...
Python
0
1e7421878e90949abc4f6fac5835bd27b472d2b6
Add example script for the newly added mixed_diffusivity
example_Knudsen.py
example_Knudsen.py
import openpnm as op import numpy as np import matplotlib.pyplot as plt # Get Deff w/o including Knudsen effect spacing = 1.0 net = op.network.Cubic(shape=[10, 10, 10], spacing=spacing) geom = op.geometry.StickAndBall(network=net) air = op.phases.Air(network=net) phys = op.physics.Standard(network=net, geometry=geom,...
Python
0
a6bbcc46765fee52eba9c31b95d456977fbeeefe
add beautify for print beautify words
Scripts/beautify.py
Scripts/beautify.py
#!/usr/bin/env python import sys def beautify(line, bold=False): k = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' v = '𝒜ℬ𝒞𝒟ℰℱ𝒢ℋℐ𝒥𝒦ℒℳ𝒩𝒪𝒫𝒬ℛ𝒮𝒯𝒰𝒱𝒲𝒳𝒴𝒵𝒶𝒷𝒸𝒹ℯ𝒻ℊ𝒽𝒾𝒿𝓀𝓁𝓂𝓃ℴ𝓅𝓆𝓇𝓈𝓉𝓊𝓋𝓌𝓍𝓎𝓏' bv = '𝓐𝓑𝓒𝓓𝓔𝓕𝓖𝓗𝓘𝓙𝓚𝓛𝓜𝓝𝓞𝓟𝓠𝓡𝓢𝓣𝓤𝓥𝓦𝓧𝓨𝓩𝓪𝓫𝓬𝓭𝓮𝓯𝓰𝓱𝓲𝓳𝓴�...
Python
0.000007
cbafc49d098ee1166aae32eae79a808e576a1afa
Hello world
Simple/hello.py
Simple/hello.py
print("Hello, world")
Python
0.999979
ef9b099b1a0f6abe4bde3d74f79d0daa31c38dbd
Add interactive flash size (energy) spectrum plot that can sync to points in 4-panel view
LMA/analysis.py
LMA/analysis.py
""" Get a plot of the flash energy spectrum for flashes in the current brawl4d view. lma_ctrl is an instance of brawl4d.LMA.controller.LMAController that >>> from brawl4d.brawl4d import B4D_startup >>> from datetime import datetime >>> panels = B4D_startup(basedate=datetime(2012,5,29), ctr_lat=35.2791257, ctr_lon=-97...
Python
0
e1772c008d607a2545ddaa05508b1a74473be0ec
Add TaskInstance index on job_id
airflow/migrations/versions/7171349d4c73_add_ti_job_id_index.py
airflow/migrations/versions/7171349d4c73_add_ti_job_id_index.py
# -*- coding: utf-8 -*- # # 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, software ...
Python
0
74dee1d09fdc09f93af3d15286336d7face4ba08
add test file for proper_parens.
test_proper_parens.py
test_proper_parens.py
from __future__ import unicode_literals from proper_parens import check_statement def test_check_statement(): # Edge cases of strings of length one value = ")" assert check_statement(value) == -1 value = "(" assert check_statement(value) == 1 # Edge cases of strings of length two value ...
Python
0
77637c0eca6ba5cd00e8f1fbe863a1fd293c980f
Create __init__.py
tests/CAN/__init__.py
tests/CAN/__init__.py
Python
0.000429
b936fe0b01a29f8638f662a4a779226fe93cd6fa
Create 5kyu_faulty_odometer.py
Solutions/5kyu/5kyu_faulty_odometer.py
Solutions/5kyu/5kyu_faulty_odometer.py
BASE = '012356789' def faulty_odometer(num): result = 0 for i, n in enumerate(str(num)[::-1]): result += BASE.index(n) * len(BASE) ** i return result
Python
0.000344
ab753bc09d27cc00780d48769d8c12a9015fae18
Create 0062_siteoption_copyright_notice.py
radio/migrations/0062_siteoption_copyright_notice.py
radio/migrations/0062_siteoption_copyright_notice.py
# -*- coding: utf-8 -*- # Save default html text for index and about page from __future__ import unicode_literals from django.db import migrations, models def set_default_html(apps, schema_editor): SiteOption = apps.get_model('radio', 'SiteOption') SiteOption(name='COPYRIGHT_NOTICE', value = ...
Python
0
fa7b12066fd81ed97bb0ecbd13690f850021915f
Create crossover.py
cea/optimization/master/crossover.py
cea/optimization/master/crossover.py
""" Crossover routines """ from __future__ import division from deap import tools from cea.optimization.master.validation import validation_main def crossover_main(individual, indpb, column_names, heating_unit_names_share, cooling_unit_names_share, ...
Python
0.000001
c2509a25eaf3522a55d061f940931447bbf023f1
test pyCharm
lp3thw/ex41.py
lp3thw/ex41.py
import random from urllib.request import urlopen import sys WORD_URL = "http://learncodethehardway.org/words.txt" WORDS = [] PHRASES = { "class %%%(%%%):": "Make a class named %%% that is-a %%%.", "class %%%(object):\n\tdef __init__(self, ***)": "class %%% has-a __init__ that takes self and **...
Python
0.000002
c50f1bd892f5bc17bb77cd9d09ae5d0d1db8d75c
vowel count Day 5
submissions/j-nordell/Day5/vowelcount.py
submissions/j-nordell/Day5/vowelcount.py
vowel_dict = {'a': 0, 'e': 0, 'i': 0, 'o': 0, 'u': 0} vowels = ['a', 'e', 'i', 'o', 'u'] user_text = input("Please enter some text: ") user_text = list(user_text) for letter in user_text: if letter in vowels: vowel_dict[letter] += 1 print("Here are the results: ") for key, value in vowel_dict.items(): ...
Python
0.99922
24cfe61a9e1d8ed5a78b2338e652085fc5b3f4e1
Add example delete
examples/delete.py
examples/delete.py
# 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, software # distributed under t...
Python
0.99966
0cb6b839509d3f5ecf0e2196c53decbf6fdac65e
add renameDate.py
renameDates.py
renameDates.py
#! Python3 # renameDate.py - rename file name that include date in US format (MM-DD-YYYY) # to EU format (DD-MM-YYYY) import shutil, os, re #Regex for US dates datePattern = re.compile(r"""^(.*?) # All text before date ((0|1)?\d)- # one or two month digits ((0|1|2|3)?\d)- ...
Python
0.000008
b920103c5aef9fa38d91e2fe0eafaeb8fd18d27b
Create FileEncryptor.py
FileEncryptor.py
FileEncryptor.py
import os from Crypto.Cipher import AES from Crypto.Hash import SHA256 from Crypto import Random def encrypt(key, filename): chunksize = 64 * 1024 outputFile = "(encrypted)" + filename filesize = str(os.path.getsize(filename)).zfill(16) IV = Random.new().read(16) encryptor = AES.new(key, AES.MODE_...
Python
0.000001
06e0f140c517e467445a59be989ba3b9ddd76503
add tests for stdlib xpath
python/ql/test/library-tests/frameworks/stdlib/XPathExecution.py
python/ql/test/library-tests/frameworks/stdlib/XPathExecution.py
match = "dc:title" ns = {'dc': 'http://purl.org/dc/elements/1.1/'} import xml.etree.ElementTree as ET tree = ET.parse('country_data.xml') root = tree.getroot() root.find(match, namespaces=ns) # $ MISSING: getXPath=match root.findall(match, namespaces=ns) # $ MISSING: getXPath=match root.findtext(match, default=None...
Python
0.000002
70f7096d353ee3edccf6e52e21c6a74db158d906
Configure settings for py.test
conftest.py
conftest.py
import os from django.conf import settings def pytest_configure(): if not settings.configured: os.environ['DJANGO_SETTINGS_MODULE'] = 'multimedia.tests.settings'
Python
0.000001
4863696bbfb46a836b4febc3397e51dd20214414
add repoquery-recursive.py for downloading rpm packages and their dependencies exceluding which comes from install media
repoquery-recursive.py
repoquery-recursive.py
#!/usr/bin/python3 import sys import subprocess repoquery = ['repoquery', '--plugins', '--resolve', '--qf', '%{name}.%{arch} %{repoid} %{location}', '--plugins', '-R'] package_info = dict() def check_dep(packages): #print(packages) if len(packages) == 0: return cmd = repoquery + packages output = subprocess....
Python
0
eefe2a1f4dc7482f75a2cd3cfd94c1048ba688c6
Add back $0.25 tip amount; #180
gittip/__init__.py
gittip/__init__.py
import datetime import locale import os from decimal import Decimal try: # XXX This can't be right. locale.setlocale(locale.LC_ALL, "en_US.utf8") except locale.Error: locale.setlocale(locale.LC_ALL, "en_US.UTF-8") BIRTHDAY = datetime.date(2012, 6, 1) CARDINALS = ['zero', 'one', 'two', 'three', 'four', 'fiv...
import datetime import locale import os from decimal import Decimal try: # XXX This can't be right. locale.setlocale(locale.LC_ALL, "en_US.utf8") except locale.Error: locale.setlocale(locale.LC_ALL, "en_US.UTF-8") BIRTHDAY = datetime.date(2012, 6, 1) CARDINALS = ['zero', 'one', 'two', 'three', 'four', 'fiv...
Python
0.000008
0e2504171dc5679b5cdd1cb219ad1cd1e9f29262
add a test case for performance benchmarking.
tests/perf_unicorn.py
tests/perf_unicorn.py
import sys import os import time import angr import simuvex.s_options as so import nose.tools test_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../')) def perf_unicorn_0(): p = angr.Project(os.path.join(test_location, 'binaries', 'tests', 'x86_64', 'perf_unicorn_0')) s_unico...
Python
0.000003
a2059d9c93553843094345ca857508e8cd7325c4
Create mnist-keras.py
mnist-keras.py
mnist-keras.py
# Author: Hussein Al-barazanchi # reading and saving the data are based on the code # from the following link # http://www.kaggle.com/users/9028/danb/digit-recognizer/convolutional-nn-in-python # import numpy and pandas for array manipulationa and csv files import numpy as np import pandas as pd # import keras nece...
Python
0.000001
e3b7b9e5f8ca1be061c71c764fd62d6aeed3fd43
Add test suite for bqlmath.
tests/test_bqlmath.py
tests/test_bqlmath.py
# -*- coding: utf-8 -*- # Copyright (c) 2010-2016, MIT Probabilistic Computing Project # # 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/LICENS...
Python
0
2014f326eb73f7b30fe9cad8f30df80e7b8b3f26
add first test
tests/test_ipcheck.py
tests/test_ipcheck.py
class TestBoundaryValue: def test_WeakNomral(self): pass
Python
0.000003
d95a7d6017dd6a08d9c8df5af9c61ee2cb23d217
add test code for wrapper.py
tests/test_wrapper.py
tests/test_wrapper.py
import sys sys.path.append('..') import unittest from wrapper import xp from chainer import cuda from chainer import Variable class WrapperTestCase(unittest.TestCase): def test_xp(self): try: cuda.check_cuda_available() module = 'cupy' except: module = 'numpy' ...
Python
0.000002
c9a1f5416e62a0d5311a9e692c08ad0fe49b9b18
Add visualize_vgg16.py
dream/visualize_vgg16.py
dream/visualize_vgg16.py
from keras.applications.vgg16 import VGG16 from keras.layers import Input from keras import backend as K import numpy as np import matplotlib.pyplot as plt img_width, img_height, num_channels = 224, 224, 3 input_tensor = Input(shape=(img_height, img_width, num_channels)) model = VGG16(include_top=True, weights='image...
Python
0.000012
6733cc00015458c307272a3124857bf686b06fbb
Create h.py
h.py
h.py
print "Hello, World!"
Python
0.000002
553009b8f0cb0396f266d10dc5b6010ad60e7a25
Solve task #21
21.py
21.py
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def mergeTwoLists(self, l1, l2): """ :type l1: ListNode :type l2: ListNode :rtype: ListNode """ def s...
Python
0.999999
7b949393c0cf20b9f21ff3e743a6ad35b3cccb49
Create 22.py
22.py
22.py
import copy import math # [ 0 | 1 | 2 | 3 | 4 | 5 ] #spell = [spell id | mana | damage | armor | mana | timer] spells = [(0, 53, 4, 0, 0, 0), (1, 73, 2, 2, 0, 0), (2, 113, 0, 0, 0, 6), (3, 173, 3, 0, 0, 6), (4, 229, 0, 0, 101, 5)] #2 = Shield #timer = [spell id, turns left] bossDamage ...
Python
0.000004
62237000f3ae92638214d96f323a81d6a492d9cd
Update existing FAs with current tier programs (#4829)
financialaid/management/commands/migrate_finaid_program_tiers.py
financialaid/management/commands/migrate_finaid_program_tiers.py
""" Update FinancialAid objects with current tier program """ from django.core.management import BaseCommand, CommandError from financialaid.models import FinancialAid, TierProgram class Command(BaseCommand): """ Updates the existing financial aid objects to current tier programs """ help = "Updates ...
Python
0
57af6d6d8b4c67f7b437f512e4d8eb4ea66a20f9
Add morse script
morse/morse.py
morse/morse.py
# Import modules from microbit import * # define morse code dictionary morse = { "a": ".-", "b": "-...", "c": "-.-.", "d": "-..", "e": ".", "f": "..-.", "s": "...", "o": "---", "m": "--", "1": ".----", "2": "..---", "3": "....
Python
0.000001
9609529e3a5c25c37be342d2bd1efe33e25128ff
Add IO file
IO.py
IO.py
import RPi.GPIO as GPIO def gettemp(): return 80 def setfan(state): pass def setac(state): if state: # Always turn on the fan when the ac is on setfan(True)
Python
0.000001
47fffb67871325f1b12d6150f12b2d9c44984837
implement top contributors functionality in gitguard
gitguard.py
gitguard.py
import re import subprocess import github """ gitguard_extractor.py Extracts data for the visualizer. repo_link is in the format USER/REPO_NAME or ORGANIZATION/REPO_NAME """ REGEX_REPO_LINK_DELIMITER = '\s*/\s*' def process_repo_link(repo_link): #returns owner, repo_name return re.compile(REGEX_REPO_LINK_D...
Python
0
a9fa88d11f5338f8662d4d6e7dc2103a80144be0
Revert "Remove model"
table/models.py
table/models.py
from django.db import models # Create your models here.
Python
0
c821be39a3853bf8a14e8c4089904dfe633ad276
Solve task #412
412.py
412.py
class Solution(object): def fizzBuzz(self, n): """ :type n: int :rtype: List[str] """ def fizzBuzz(i, x): return {1: str(i), 3: "Fizz", 5: "Buzz", 15: "FizzBuzz"}[x] ans = [] x = 1 for i in range(1, n + 1): if i % 3 == ...
Python
0.999999
e51322e7ee4afabee8b98137bc5e56b0a0f803ec
Solve #461
461.py
461.py
class Solution(object): def hammingDistance(self, x, y): """ :type x: int :type y: int :rtype: int """ x, y = list(bin(x)[2:]), list(bin(y)[2:]) s1 = list('0' * max(len(x), len(y))) s2 = list('0' * max(len(x), len(y))) s1[len(s1) - len(x):] = x...
Python
0.999797
2206f2dac5cb15c10fa59f14597133b6a0d3a314
Create ALE.py
ALE.py
ALE.py
""" Asynchronous Learning Engine (ALE) Supports PWS standard desktop (studio) Mentor Queues Load Balancing / Air Traffic Control Courses / Flights A mentor queue is a worker queue with tasks pending, in process, complete. The many subclasses of Task are only hinted at in this overview. Example Tasks (Transactions ar...
Python
0.000001
2e2a8f24cc8fc7e1614bf12a0d6d42c70d1efcf8
Create GUI.py
GUI.py
GUI.py
#!/usr/bin/python from Tkinter import * root = Tk() root.title("Elentirmo Observatory Controller v0.1") dust_cover_text = StringVar() dust_cover_text.set('Cover Closed') flat_box_text = StringVar() flat_box_text.set('Flat Box Off') def dust_cover_open(): print "Opening" ## Open a serial connection with Ardu...
Python
0
6be70d01bdf58389db2a6adc4035f82669d02a61
Allow use of GoogleMaps plugin without Multilingual support
cms/plugins/googlemap/cms_plugins.py
cms/plugins/googlemap/cms_plugins.py
from django.conf import settings from cms.plugin_pool import plugin_pool from cms.plugin_base import CMSPluginBase from django.utils.translation import ugettext_lazy as _ from cms.plugins.googlemap.models import GoogleMap from cms.plugins.googlemap.settings import GOOGLE_MAPS_API_KEY from django.forms.widgets import Me...
from cms.plugin_pool import plugin_pool from cms.plugin_base import CMSPluginBase from django.utils.translation import ugettext_lazy as _ from cms.plugins.googlemap.models import GoogleMap from cms.plugins.googlemap.settings import GOOGLE_MAPS_API_KEY from cms.plugins.googlemap import settings from django.forms.widgets...
Python
0
5c952e7a54bcff7bcdbd3b2a2d85f1f93ce95242
add first test: config+store
test/test_1100_conf_store.py
test/test_1100_conf_store.py
# test mod_md basic configurations import os.path import pytest import re import subprocess import sys import time from ConfigParser import SafeConfigParser from datetime import datetime from httplib import HTTPConnection from testbase import TestEnv config = SafeConfigParser() config.read('test.ini') PREFIX = confi...
Python
0.000029