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 |
|---|---|---|---|---|---|---|---|
9b3e0c7eb28a67e2383cad6cbfa97fc4fd575756 | Add error classification | classify_logs.py | classify_logs.py | import re
import yaml
error_types = ["no package found",
"unclassified"]
def classify_build_log(log_file):
"""
Takes a build log file object as an input and returns
a tupe `(category, sub-category, sub-category)`
- missing dependency:
- Build Dependency
- Test Dependen... | Python | 0.000002 | |
aafa99714eff3c5021594ae5021bdd47b41c9c6b | save tpl environs after invoke shell constructor | assets/save_tpl_envs.py | assets/save_tpl_envs.py | # -*- coding:utf-8 -*-
import os
import sys
import json
def save_tpl_envs(path):
envs = {}
for key, value in os.environ.items():
if key.startswith('TPL_'):
envs[key[4:]] = value
with open(path, 'w') as fd:
fd.write(json.dumps(envs))
if __name__ == '__main__':
path = sys.... | Python | 0 | |
af9b0ee39d18ca174b19143bdda0d478c4d5a834 | add a driver for hourly reporting | scripts/iemre/rerun_hourly.py | scripts/iemre/rerun_hourly.py | import mx.DateTime
import stage4_hourlyre
sts = mx.DateTime.DateTime(2010,5,1)
ets = mx.DateTime.DateTime(2010,5,13)
interval = mx.DateTime.RelativeDateTime(hours=1)
now = sts
while now < ets:
print now
stage4_hourlyre.merge( now )
now += interval
| Python | 0 | |
0920a23a72e1e14179b75b4d2a50e956ee9deec0 | add skeleton generation file | disaggregator/generate.py | disaggregator/generate.py | from appliance import ApplianceTrace
from appliance import ApplianceInstance
from appliance import ApplianceSet
from appliance import ApplianceType
import fhmm
| Python | 0.000005 | |
8ccab210054c2776a36b7e3648fa1e27eb49a27b | add deeplearning cross-validation NOPASS. PUBDEV-1696. | h2o-py/tests/testdir_algos/deeplearning/pyunit_NOPASS_cv_carsDeepLearning.py | h2o-py/tests/testdir_algos/deeplearning/pyunit_NOPASS_cv_carsDeepLearning.py | import sys
sys.path.insert(1, "../../../")
import h2o
import random
def cv_carsDL(ip,port):
# Connect to h2o
h2o.init(ip,port)
# read in the dataset and construct training set (and validation set)
cars = h2o.import_frame(path=h2o.locate("smalldata/junit/cars_20mpg.csv"))
# choose the type model-... | Python | 0 | |
1483f6cece70cb5de115ea1edc630e98292a8170 | Add Sorting/Selection.py & Selection() | Sorting/Selection.py | Sorting/Selection.py | # @auther Besir Kurtulmus
# coding: utf-8
'''
The MIT License (MIT)
Copyright (c) 2014 Ahmet Besir Kurtulmus
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without... | Python | 0 | |
973696b0c50f235cfcef9e0cb30c6fc2f1028058 | add an index for the story_storytags table | storyboard/db/migration/alembic_migrations/versions/063_index_story_storytags.py | storyboard/db/migration/alembic_migrations/versions/063_index_story_storytags.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.000006 | |
bd4153ff3c0824f7e901dd25e77cdaaeea2072c0 | add tests for basic outdoor pois | test/662-basic-outdoor-pois.py | test/662-basic-outdoor-pois.py | #http://www.openstreetmap.org/node/1387024181
assert_has_feature(
16, 10550, 25297, 'pois',
{ 'kind': 'bbq', 'min_zoom': 18 })
#http://www.openstreetmap.org/node/3497698404
assert_has_feature(
16, 10471, 25343, 'pois',
{ 'kind': 'bicycle_repair_station', 'min_zoom': 18 })
#http://www.openstreetmap.org... | Python | 0 | |
3c4fd0477c7d6f9d0f30654271e73466d192d1e1 | Add data type for vectors | drudge/vec.py | drudge/vec.py | """Vectors and utilities."""
import collections.abc
from sympy import sympify
class Vec:
"""Vectors.
Vectors are the basic non-commutative quantities. Its objects consist of
an base and some indices. The base is allowed to be any Python object,
although small hashable objects, like string, are ad... | Python | 0 | |
d0d4688a8768dceeeb5d609a05de72fc24ac6b75 | Create pwned.py | pwned/src/pwned.py | pwned/src/pwned.py | import hashlib, sys, urllib.request
def main():
hash = hashlib.sha1(bytes(sys.argv[1], "utf-8"))
digest = hash.hexdigest().upper()
url = f"https://api.pwnedpasswords.com/range/{digest[:5]}"
request = urllib.request.Request(url, headers={"User-Agent":"API-Programming-Exercise"})
page = urllib.request.urlopen(requ... | Python | 0.000001 | |
aca14378e6f7091abed8f25183b36a36170caa76 | Fix State ID number to 8 chars limit | users/models.py | users/models.py | from django.db import models
from django.contrib import admin
from django.contrib.auth.models import User as AuthUser
# User-related models
class User(models.Model):
'''
Represents an user. Both organizers and participants are considered as
users. This allows usage of the same accounts for the users that ... | from django.db import models
from django.contrib import admin
from django.contrib.auth.models import User as AuthUser
# User-related models
class User(models.Model):
'''
Represents an user. Both organizers and participants are considered as
users. This allows usage of the same accounts for the users that ... | Python | 0.001402 |
a81e65eaabb0f3e99721854d2dcaa7dd1f8b0a21 | Create SVM.py | 02.Algorithms/SVM.py | 02.Algorithms/SVM.py | # -*- coding: utf-8 -*-
"""
Created on Thu Jan 19 13:23:12 2017
@author: rmatam
"""
# -*- coding: utf-8 -*-
# 2015/01/11
# Script passed in py2 & py3 with Ubuntu 14.04 env.
# Prerequirement: pip install numpy scipy scikit-learn
# furthermore info http://scikit-learn.org/stable/modules/generated/sklearn.feature_extra... | Python | 0.000007 | |
806594afc5468d3cee183defba24501516b791f0 | add cities borders | belarus_city_borders.py | belarus_city_borders.py | from _helpers import cursor_wrap, dump
@cursor_wrap
def main(cursor):
sql = """
SELECT ct.osm_id, c.name AS country, '' AS region, '' AS subregion, ct.name AS city, ST_AsGeoJSON(ct.way)
FROM osm_polygon c
LEFT JOIN osm_polygon ct ON ST_Contains(c.way, ct.way)
WHERE c.osm_id = -5906... | Python | 0.999998 | |
fdb901a59e8dd61892f5033efe49e3bbbdae097f | Create CNlab1.py | CNlab1.py | CNlab1.py | #To check the validity of ip address
import sys
import textwrap
def valid(ip):
if ip.count('.')!=3:
print("Invalid")
sys.exit(0)
ipl=[]
ipl=ip.split('.')
for i in ipl:
if not i.isdigit():
print("Invalid")
sys.exit(0)
if int(i)>255:
print("Inval... | Python | 0.000002 | |
f16dcf6fe2d53be0444faad9f265781282201d95 | Use consistent quotes | colorama/ansi.py | colorama/ansi.py | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
'''
This module generates ANSI character codes to printing colors to terminals.
See: http://en.wikipedia.org/wiki/ANSI_escape_code
'''
CSI = '\033['
OSC = '\033]'
BEL = '\007'
def code_to_chars(code):
return CSI + str(code) + 'm'
def set... | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
'''
This module generates ANSI character codes to printing colors to terminals.
See: http://en.wikipedia.org/wiki/ANSI_escape_code
'''
CSI = '\033['
OSC = '\033]'
BEL = '\007'
def code_to_chars(code):
return CSI + str(code) + 'm'
def set... | Python | 0 |
4a261bd97de5868ff6065ac69345d3bef38563f1 | Check history_object in historical records | simple_history/tests/tests.py | simple_history/tests/tests.py | from datetime import datetime, timedelta
from django.test import TestCase
from .models import Poll, Choice
today = datetime(2021, 1, 1, 10, 0)
tomorrow = today + timedelta(days=1)
class HistoricalRecordsTest(TestCase):
def assertDatetimesEqual(self, time1, time2):
self.assertAlmostEqual(time1, time2, ... | from datetime import datetime, timedelta
from django.test import TestCase
from .models import Poll, Choice
today = datetime(2021, 1, 1, 10, 0)
tomorrow = today + timedelta(days=1)
class HistoricalRecordsTest(TestCase):
def assertDatetimesEqual(self, time1, time2):
self.assertAlmostEqual(time1, time2, ... | Python | 0 |
bf6f58d5958275070c1018174217873ea08db904 | Add test pull task | nodeconductor/structure/tests/tasks.py | nodeconductor/structure/tests/tasks.py | from celery import shared_task
from nodeconductor.core import utils as core_utils
@shared_task
def pull_instance(serialized_instance, pulled_disk):
""" Test-only task that allows to emulate pull operation """
instance = core_utils.deserialize_instance(serialized_instance)
instance.disk = pulled_disk
... | Python | 0.000074 | |
7ce8c06c5447d89f941d482c84693e432384def6 | rename `file` to `filename` for clarity. | pysellus/loader.py | pysellus/loader.py | import os
import sys
from inspect import isfunction
from importlib import import_module
def load(path):
if _is_python_file(path):
sys.path.insert(0, os.path.dirname(path))
module = import_module(_get_module_name_from_path(path))
return _get_checks_from_module(module)
functions = []
... | import os
import sys
from inspect import isfunction
from importlib import import_module
def load(path):
if _is_python_file(path):
sys.path.insert(0, os.path.dirname(path))
module = import_module(_get_module_name_from_path(path))
return _get_checks_from_module(module)
functions = []
... | Python | 0 |
cc5f55fa6eb6d0ecaaef1c1e269fb40c2731fef5 | Add test helpers | src/lib/test_helpers.py | src/lib/test_helpers.py | # Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: jernej@reciprocitylabs.com
# Maintained By: jernej@reciprocitylabs.com
"""
Utility classes for page objects used in tests.
Details:
Most of the te... | Python | 0.000001 | |
8e7350cbfc96541d9a3ddc970309c60793bb4126 | fix TermsFacet | corehq/apps/es/facets.py | corehq/apps/es/facets.py | class FacetResult(object):
def __init__(self, raw, facet):
self.facet = facet
self.raw = raw
self.result = raw.get(self.facet.name, {}).get(self.facet.type, {})
class Facet(object):
name = None
type = None
params = None
result_class = FacetResult
def __init__(self):
... | class FacetResult(object):
def __init__(self, raw, facet):
self.facet = facet
self.raw = raw
self.result = raw.get(self.facet.name, {}).get(self.facet.type, {})
class Facet(object):
name = None
type = None
params = None
result_class = FacetResult
def __init__(self):
... | Python | 0.000001 |
04ded12c05b20fc3a25956712f8e0fb1723c3edb | Add a snippet (python/warnings). | python/warnings.py | python/warnings.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012 Jérémie DECOCK (http://www.jdhp.org)
import warnings
def custom_formatwarning(message, category, filename, lineno, line=""):
"""Ignore everything except the message."""
return "Warning: " + str(message) + "\n"
def main():
"""Main functio... | Python | 0.000004 | |
630413b6bdc385095fe8da549b691d54fc6a4504 | Add ITWeek.py | ITWeek.py | ITWeek.py | import requests
from bs4 import BeautifulSoup
def main():
url = 'https://ex-portal3.reed.jp/list/SODECS2017_ja.html'
res = requests.get(url)
soup = BeautifulSoup(res.content, 'html.parser')
companies = soup.find_all('tr')
for company in companies:
print(company.text)
if __name__... | Python | 0 | |
1f71153cf814f7d34835cea6eafe44683035d874 | Add compare_files.py | compare_files.py | compare_files.py | import difflib
def compare_files(filename1, filename2):
f = open(filename1, "r")
filelines1 = f.readlines()
f.close()
f = open(filename2, "r")
filelines2 = f.readlines()
f.close()
diffs = difflib.context_diff(filelines1,
filelines2,
... | Python | 0.000002 | |
3ce2e0b8825c7abc219a812c5abda45184fbfdec | add wot wikia plugin | plugins/wotwikia.py | plugins/wotwikia.py | """ WoT Wikia Plugin (botwot plugins.wiki) """
# Copyright 2015 Ray Schulz <https://rascul.io>
#
# 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
... | Python | 0 | |
46818f540d48bd967e8e0e5d846f0757f2ca6c1c | Add test for set_shard() | deepchem/data/tests/test_setshard.py | deepchem/data/tests/test_setshard.py | import deepchem as dc
import numpy as np
def test_setshard_with_X_y():
"""Test setharding on a simple example"""
X = np.random.rand(10, 3)
y = np.random.rand(10,)
dataset = dc.data.DiskDataset.from_numpy(X, y)
assert dataset.get_shape()[0][0] == 10
assert dataset.get_shape()[1][0] == 10
for i, (X, y, w,... | Python | 0.000001 | |
a8bbbb77e2036b66a5083bd2a1393b0de588af0c | Rename to alg_count_changes.py & count_changes() | alg_count_changes.py | alg_count_changes.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
"""Count Changes.
Count how many distinct ways you can make change that amount.
Assume that you have an infinite number of each kind of coin.
"""
def count_changes_recur(amount, coins, n):
"""Count chan... | Python | 0.000015 | |
6ad081e91e337e1627b70674109f45ba35248f8c | Add missing migration file to the repo | zou/migrations/versions/e839d6603c09_add_person_id_to_shot_history.py | zou/migrations/versions/e839d6603c09_add_person_id_to_shot_history.py | """add person id to shot history
Revision ID: e839d6603c09
Revises: 346250b5304c
Create Date: 2020-12-14 12:00:19.045783
"""
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils
import sqlalchemy_utils
import uuid
# revision identifiers, used by Alembic.
revision = 'e839d6603c09'
down_revision = '3... | Python | 0 | |
0538523f617ec1d410861b52a647c788c06c267a | Fix llg tests. | pyoommf/test_llg.py | pyoommf/test_llg.py | from llg import LLG
def test_llg_mif():
t = 1.5e-9
m_init = (0, 1, 0)
Ms = 1e6
alpha = 0.01
gamma = 2.21e5
name = 'llgtest'
llg = LLG(t, m_init, Ms, alpha, gamma, name)
mif_string = llg.get_mif()
lines = mif_string.split('\n')
assert 'Specify Oxs_RungeKuttaEvolve {' in lines... | from llg import LLG
def test_llg_mif():
t = 1.5e-9
m_init = (0, 1, 0)
Ms = 1e6
alpha = 0.01
gamma = 2.21e5
llg = LLG(t, m_init, Ms, alpha, gamma)
mif_string = llg.get_mif()
lines = mif_string.split('\n')
assert 'Specify Oxs_RungeKuttaEvolve {' in lines[0]
line2 = lines[1... | Python | 0.000001 |
22252d6978f237a2a46415dcf54d4adbed92b1ce | Add LLG tests. | pyoommf/test_llg.py | pyoommf/test_llg.py | from llg import LLG
def test_llg_mif():
t = 1.5e-9
m_init = (0, 1, 0)
Ms = 1e6
alpha = 0.01
gamma = 2.21e5
llg = LLG(t, m_init, Ms, alpha, gamma)
mif_string = llg.get_mif()
lines = mif_string.split('\n')
assert 'Specify Oxs_RungeKuttaEvolve {' in lines[0]
line2 = lines[1... | Python | 0 | |
b21fbb09b33e40a33ad3ea33b0394fed421c8a6e | add num02 | pythonTest/num02.py | pythonTest/num02.py | def reverse(x):
changeTuple=tuple(x)
reverseTuple=changeTuple[::-1]
print(''.join(reverseTuple))
test = "this is test string"
reverse(test)
| Python | 0.999971 | |
edc35e4aefe336eb1bf02dbf7104925389276fa6 | Add shellcheck for sh filetype | pythonx/lints/sh.py | pythonx/lints/sh.py | # -*- coding: utf-8 -*-
from validator import Validator
class Sh(Validator):
__filetype__ = "sh"
checker = "shellcheck"
args = "-x -f gcc"
regex = r"""
.+:
(?P<lnum>\d+):
(?P<col>\d+):
.*
\s
(
(?P<error>error)
... | Python | 0 | |
c25cebf31648466111cb3d576e0a398bb4220ccf | Add test for sabnzbd cleanupfilename.py | sabnzbd/test_cleanupfilename.py | sabnzbd/test_cleanupfilename.py | import unittest
from cleanupfilename import rename
class TestRename(unittest.TestCase):
files = []
dirs = []
def setUp(self):
self.files = [('filename-sample.x264.mp4', 'filename.mp4'),
('filename.mp4', 'filename.mp4')]
self.dirs = [('filename sample mp4', 'filename'... | Python | 0.000001 | |
9dbc755a17fbea3fbec52191d1e7bac60e5995e9 | test links in the docs | test_links.py | test_links.py | #!/usr/bin/env python
import os
import time
import yaml
import requests
from urllib.parse import urljoin
from bs4 import BeautifulSoup
current = os.path.split(os.path.realpath(__file__))[0]
yaml_file = "{0}/mkdocs.yml".format(current)
mkdocs = yaml.load(open(yaml_file))['pages']
host='http://127.0.0.1:8000'
page_filte... | Python | 0 | |
d56b1623a278d61ff8b113b95534ce4dd6682e25 | fix bug 1018349 - migration | alembic/versions/1baef149e5d1_bug_1018349_add_coalesce_to_max_sort_.py | alembic/versions/1baef149e5d1_bug_1018349_add_coalesce_to_max_sort_.py | """bug 1018349 - add COALESCE to max(sort) when adding a new product
Revision ID: 1baef149e5d1
Revises: 26521f842be2
Create Date: 2014-06-25 15:04:37.934064
"""
# revision identifiers, used by Alembic.
revision = '1baef149e5d1'
down_revision = '26521f842be2'
from alembic import op
from socorro.lib import citexttype... | Python | 0 | |
32420b44500caf48ade628bc4799fe91ad39e2b8 | add unit test for integer arithmetic | tests/core.py | tests/core.py | #! /usr/bin/env python3
#
# Copyright (c) 2015 Joost van Zwieten
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy,... | Python | 0.000508 | |
d836571a8dff59371d156dffea7290228305ca17 | add tests for reading shapefiles via ogr | tests/python_tests/ogr_test.py | tests/python_tests/ogr_test.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from nose.tools import *
from utilities import execution_path
import os, mapnik
def setup():
# All of the paths used are relative, if we run the tests
# from another directory we need to chdir()
os.chdir(execution_path('.'))
if 'ogr' in mapnik.DatasourceCach... | Python | 0 | |
bf8b19d19ea2a5f39cba90ca815560a89e476c6c | Create Output.py | Output.py | Output.py | import os, time, sys
from threading import Thread
pipe_name = '/Users/stevenrelin/Documents/pipe_eye.txt'
def child( ):
pipeout = os.open(pipe_name, os.O_WRONLY)
counter = 0
while True:
time.sleep(1)
os.write(pipeout, 'Number %03d\n' % counter)
counter = (counter+1) % 5
if ... | Python | 0.000108 | |
319d2115ad1130247caa5734572b7676e5bb0a6d | add offline plot of nexrad climo | scripts/feature/nexrad/climo.py | scripts/feature/nexrad/climo.py | import matplotlib.pyplot as plt
from pyiem.plot import maue
import datetime
import numpy as np
avgs = np.zeros((24, 53), 'f')
cnts = np.zeros((24, 53), 'f')
def make_y(ts):
if ts.hour >= 5:
return ts.hour - 5
return ts.hour + 19
maxv = 0
for line in open('nexrad35.txt'):
tokens = line.split(",")... | Python | 0 | |
5f20962d300850200ed796f941bf98662736d4da | Add server.py to serve files in the user's specified share dir | sandwich/server.py | sandwich/server.py | from os import curdir, sep, path
import time
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
import config
class StaticServeHandler(BaseHTTPRequestHandler):
def do_GET(self):
if not config.shared_directory:
self.send_error(404, 'User not sharing files')
return
... | Python | 0 | |
d774bb7caa9637e4d453e19fcc43ee7b9b17702c | add script for computing WWA % times | scripts/sbw/wfo_time_percent.py | scripts/sbw/wfo_time_percent.py | import iemdb
import numpy
import network
nt = network.Table("WFO")
POSTGIS = iemdb.connect('postgis', bypass=True)
pcursor = POSTGIS.cursor()
import mx.DateTime
sts = mx.DateTime.DateTime(2005,10,1)
ets = mx.DateTime.DateTime(2013,1,1)
interval = mx.DateTime.RelativeDateTime(hours=3)
bins = (ets - sts).minutes
fo... | Python | 0 | |
bcb65eb61c711b184114910c8d8c641278db5130 | Add frozen/equilibrium wake model helpers | bem/models.py | bem/models.py | import numpy as np
class FrozenWakeAerodynamics:
"""Calculate induced flows once in given initial conditions"""
def __init__(self, bem_model, initial_wind_speed,
initial_rotor_speed, initial_pitch_angle):
self.bem_model = bem_model
# Find the frozen wake state
self.wa... | Python | 0 | |
e56c3be6dc3ab8bf31b7ce9a3d3db275b18207f0 | Create sql-all.py | Django/sql-all.py | Django/sql-all.py | $ ./manage.py sqlall name-app
'''
CommandError: App 'name-app' has migrations.
Only the sqlmigrate and sqlflush commands can be used when an app has migrations.
'''
So there before migrate to see it.
| Python | 0.000706 | |
a8ee7f46ffd4611a153538e05749bd99b4a98cbc | add checkPID | check-pid.py | check-pid.py | # โค้ดเซ็คความถูกต้องของบัตรประชาชน
# เขียนโดย วรรณพงษ์ ภัททิยไพบูลย์
# wannaphong@yahoo.com
# https://python3.wannaphong.com
def checkPID(pid):
if(len(pid) != 13): # ถ้า pid ไม่ใช่ 13 ให้คืนค่า False
return False
num=0 # ค่าสำหรับอ้างอิง index list ข้อมูลบัตรประชาชน
num2=13 # ค่าประจำหลัก
listdata=list(pid) # l... | Python | 0 | |
43841114f4403b46e0ef077be6e0832ce690dfb2 | add ipy_workdir | IPython/Extensions/ipy_workdir.py | IPython/Extensions/ipy_workdir.py | #!/usr/bin/env python
import IPython.ipapi
ip = IPython.ipapi.get()
import os
workdir = None
def workdir_f(line):
global workdir
dummy,cmd = line.split(None,1)
if os.path.isdir(cmd):
workdir = cmd
print "Set workdir",workdir
elif workdir is None:
print "Please ... | Python | 0.000001 | |
b78ba3220a64e9b01b3fc8c61ada0e85dc1157fc | Implement data dumper | oeplatform/dumper.py | oeplatform/dumper.py | import oeplatform.securitysettings as sec
import sqlalchemy as sqla
from subprocess import call
import os
excluded_schemas = [
"information_schema",
"public",
"topology",
"reference",
]
def connect():
engine = _get_engine()
return sqla.inspect(engine)
def _get_engine():
engine = sqla.c... | Python | 0.000016 | |
0254fbea5218e332dc0c54af198aa2b29381878b | Composite two smiley on top of the famous Michael jordan crying face | python/composite.py | python/composite.py | import requests
import json
# Composite two smiley on top of the famous Michael jordan crying face.
# A more sophisticated approach would be to extract the face landmarks using facelandmarks and composite something on the different regions.
# https://pixlab.io/#/cmd?id=merge for more info.
req = requests.post('https:... | Python | 0.999822 | |
8ce580d1f0890f72ab60efa4219de26b64ece897 | Add example skeleton script | example/example.py | example/example.py | #!/usr/bin/env python
import sys
from argparse import ArgumentParser
from getpass import getpass
class BigFixArgParser(ArgumentParser):
name = "hodor.py [options]"
def __init__(self):
description = "A tool for creating a smarter planet"
usage = """Options:
-h, --help Print this help me... | Python | 0.000001 | |
30a4cb3794d52d1743dc482f2c2a83ced1dcbd90 | Make a clean report along with BLEU scores | session2/report.py | session2/report.py | import argparse, codecs, logging
import unicodecsv as csv
from nltk.align.bleu_score import bleu
import numpy as np
def setup_args():
parser = argparse.ArgumentParser()
parser.add_argument('src', 'Source file')
parser.add_argument('target', 'Translated data')
parser.add_argument('gold', 'Gold output fi... | Python | 0.000001 | |
31bb487a2f75268cb0b60ef4539935df83b68a84 | Add auto solver for "W3-Radix Sorts". | quiz/3-radixsort.py | quiz/3-radixsort.py | #!/usr/bin/env python3
def make_arr(text):
return text.strip().split(' ')
def print_arr(arr):
for t in arr:
print(t, end=' ')
print()
def solve_q1(arr, time):
for t in range(len(arr[0]) - 1, time - 1, -1):
arr = sorted(arr, key=lambda x: x[t])
return arr
def msd_radix_sort(ar... | Python | 0 | |
85e7d3b4f69919b274e597b7e8f73377e7d28698 | Add another script for testing purposes | process_datasets.py | process_datasets.py | """
For testing purposes: Process a specific page on the Solr index.
"""
import os
import sys
import datetime
import json
import uuid
import pandas
import xml.etree.ElementTree as ET
import urllib
from d1graphservice.people import processing
from d1graphservice import settings
from d1graphservice import dataone
from... | Python | 0 | |
d959587c168424ed0d8e91a4a20ea36076a646b7 | add forgotten __init__.py | dhcpcanon/__init__.py | dhcpcanon/__init__.py | __version__ = "0.1"
__author__ = "juga"
| Python | 0.00035 | |
98fe743217ebd7868d11d8518f25430539eae5a0 | add regrresion example | example/simple_regression_example.py | example/simple_regression_example.py | from sklearn import datasets, metrics, preprocessing
from stacked_generalization.lib.stacking import StackedRegressor
from sklearn.ensemble import RandomForestRegressor
from sklearn.ensemble import GradientBoostingRegressor
from sklearn.ensemble import ExtraTreesRegressor
from sklearn.linear_model import LogisticRegres... | Python | 0 | |
896270bcd99b26e4128fd35dd3821a59807ae850 | Add the model.py file declarative generated from mysql. | doc/model/model_decla.py | doc/model/model_decla.py | #autogenerated by sqlautocode
from sqlalchemy import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relation
engine = create_engine('mysql://monty:passwd@localhost/test_dia')
DeclarativeBase = declarative_base()
metadata = DeclarativeBase.metadata
metadata.bind = engine
class Me... | Python | 0 | |
7aab44f006a6412d8f169c3f9a801f41a6ea0a95 | Remove start dates for the second time from draft dos2 briefs | migrations/versions/880_remove_invalid_draft_dos2_brief_dates_again.py | migrations/versions/880_remove_invalid_draft_dos2_brief_dates_again.py | """Remove dates from draft dos2 briefs.
This is identical to the previous migration but will be run again to cover any draft briefs with invalid
dates that could have appeared during the previous API rollout process (after the previous migration but before
the code propogated fully to the ec2 instances).
Revision ID: ... | Python | 0.000002 | |
77ccb8db873c31ad2bd8318118410abab3141312 | add __version__.py | europilot/__version__.py | europilot/__version__.py | __title__ = 'europilot'
__description__ = 'End to end driving simulation inside Euro Truck Simulator 2'
__version__ = '0.0.1'
| Python | 0.001013 | |
8c82465a08f5a601e6a43a8eb675136fc3678954 | Create lc960.py | LeetCode/lc960.py | LeetCode/lc960.py | def createArray(dims) :
if len(dims) == 1:
return [0 for _ in range(dims[0])]
return [createArray(dims[1:]) for _ in range(dims[0])]
def f(A, x, y):
m = len(A)
for i in range(m):
if A[i][x] > A[i][y]:
return 0
return 1
class Solution(object):
def minDeletionSize(self, A):
... | Python | 0.000001 | |
3ebae0f57ae3396213eb28b6fc7a23ff3e3c4980 | Create file and add pseudocode | uml-to-cpp.py | uml-to-cpp.py | # Copyright (C) 2017 Bran Seals. All rights reserved.
# Created: 2017-06-05
print("== UML to CPP ==")
print("Create or modify C++ header and implementation files by plaintext UML.")
#print("Enter a UML filename: ") # file import currently disabled
# check if file isn't too bonkers
#uml = [] # pull UML into memory as s... | Python | 0.000001 | |
068b33dc89350615a96e9d3856df4b6ca30ca6c5 | add distributed training | sres_multi_gpu_train.py | sres_multi_gpu_train.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from datetime import datetime
import os.path
import re
import time
import numpy as np
from six.moves import xrange # pylint: disable=redefined-builtin
import tensorflow as tf
import sres
FLAGS = tf.app.flags... | Python | 0 | |
66e707a280c193a88ddd472758c5adf6d09d9e94 | Update to clean_tenants.py to speed up tenant deletion | utils/clean_tenants.py | utils/clean_tenants.py | #!/usr/bin/env python
from __future__ import (print_function, unicode_literals, division,
absolute_import)
import sys
import threading
from builtins import input
try:
import Queue as queue
except ImportError:
import queue
import dfs_sdk
from dfs_sdk import scaffold
def _deleter(args... | #!/usr/bin/env python
from __future__ import (print_function, unicode_literals, division,
absolute_import)
import sys
from builtins import input
from dfs_sdk import scaffold
def main(args):
api = scaffold.get_api()
to_delete = []
for tenant in api.tenants.list():
if tena... | Python | 0 |
e2ed635fb3289a5b45f5f15cd1eb543d87fb93d7 | Add test for posting a review through the view | wafer/talks/tests/test_review_views.py | wafer/talks/tests/test_review_views.py | """Tests for wafer.talk review form behaviour."""
from django.test import Client, TestCase
from django.urls import reverse
from reversion import revisions
from reversion.models import Version
from wafer.talks.models import (SUBMITTED, UNDER_CONSIDERATION,
ReviewAspect, Review)
from wa... | Python | 0 | |
466410249867b3eadbe5e2b59c46c95ecd288c6c | Add script for word counts | python_scripts/solr_query_fetch_all.py | python_scripts/solr_query_fetch_all.py | #!/usr/bin/python
import requests
import ipdb
import time
import csv
import sys
import pysolr
def fetch_all( solr, query ) :
documents = []
num_matching_documents = solr.search( query ).hits
start = 0
rows = num_matching_documents
sys.stderr.write( ' starting fetch for ' + query )
while ( le... | Python | 0.000001 | |
3f69fae4f15efff515b82f216de36dd6d57807e9 | add ci_test.py file for ci | settings/ci_test.py | settings/ci_test.py | __author__ = 'quxl'
from base import *
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
| Python | 0.000001 | |
50f0e040f363e52a390efc6acd1bc0bc0ddcabcc | Add test funcs in report_reader for DB reading | report_reader.py | report_reader.py | import pymongo as pm
def connectDB():
conn = pm.MongoClient('localhost', 27017)
db = conn.get_database('report_db')
return db
def getColList(db):
return db.collection_names()
def getDocNum(col):
return col.find().count()
def match(col, matchDict):
return list(col.find(matchDict))
def main():
db = connectDB(... | Python | 0.000001 | |
1c9d398be7f99f15fb550adca31f3366870930e3 | Set debug to false in prod, otherwise true | wazimap_np/settings.py | wazimap_np/settings.py | # pull in the default wazimap settings
from wazimap.settings import * # noqa
DEBUG = False if (os.environ.get('APP_ENV', 'dev') == 'prod') else True
# install this app before Wazimap
INSTALLED_APPS = ['wazimap_np'] + INSTALLED_APPS
DATABASE_URL = os.environ.get('DATABASE_URL', 'postgresql://wazimap_np:wazimap_np@lo... | # pull in the default wazimap settings
from wazimap.settings import * # noqa
# install this app before Wazimap
INSTALLED_APPS = ['wazimap_np'] + INSTALLED_APPS
DATABASE_URL = os.environ.get('DATABASE_URL', 'postgresql://wazimap_np:wazimap_np@localhost/wazimap_np')
DATABASES['default'] = dj_database_url.parse(DATABA... | Python | 0.004374 |
22578771d9812a21361ec959d16e3eaacba998e3 | Add APData Info collector | APData/APInfo.py | APData/APInfo.py | #
#
#
#
class APInfo:
"""..."""
# Protected members
__IPAddress = ""
__MACAddress = ""
__Channel = 0
__Region = 0
__Localization = ""
__TxPowerList = []
__CurrentPowerIndex = -1
__UnderloadLimit = -1
__OverloadLimit = -1
__Reachable = False
__Enabled = False
__EMailSent = False
__SupportedOS = ""
# ... | Python | 0 | |
bd1e135a6ffd9186451ec02fcbcaab7f9066e40f | Add breakpad fetch recipe. | recipes/breakpad.py | recipes/breakpad.py | # Copyright (c) 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import sys
import recipe_util # pylint: disable=F0401
# This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232... | Python | 0.001108 | |
4996ddddc14ad0d20759abbcf4d54e6132b7b028 | Add the dj_redis_url file | dj_redis_url.py | dj_redis_url.py | # -*- coding: utf-8 -*-
import os
try:
import urlparse
except ImportError:
import urllib.parse as urlparse
# Register database schemes in URLs.
urlparse.uses_netloc.append("redis")
DEFAULT_ENV = "REDIS_URL"
def config(env=DEFAULT_ENV, default=None, **overrides):
"""Returns configured REDIS dictionary... | Python | 0.000001 | |
1487722c0431fce19d54b1b020c3af0ab411cc8a | Add sample config.py file | rename_to_config.py | rename_to_config.py | account_sid = "ACXXXXXXXXXXXXXXXXX"
auth_token = "XXXXXXXXXXXXXXXX"
from_number = "+441111222333"
to_number = "+447777222333"
| Python | 0.000001 | |
74dcd072efabe20137e32fcfa0560a41a532a2ba | reverse Integer | python/math/reverseInteger.py | python/math/reverseInteger.py | class Solution:
# @return an integer
def reverse(self, x):
INT_MAX = 2147483647
INT_MIN = -2147483648
result = 0
negative = 1
if x < 0:
negative = -1
x = 0 - x
temp = x / 10
ten = 1
while temp > 0:
... | Python | 0.99998 | |
0cc3aafced65d2f128a8036aad62edb5ee19f566 | Add brume main script | scripts/brume.py | scripts/brume.py | #!/usr/bin/env python
import os
import click
import yaml
from glob import glob
from subprocess import check_output
from brume.template import CfnTemplate
from brume.stack import Stack
def load_configuration(config_file='brume.yml'):
"""Return the YAML configuration for a project based on the `config_file` templ... | Python | 0 | |
03bfd2059cfaa7043cbcd941465df6b790f84726 | add `branch.py` script for initial email burst | branch.py | branch.py | """
This is a one-off script to populate the new `emails` table using the addresses
we have in `participants` and `elsewhere`.
"""
from __future__ import division, print_function, unicode_literals
import uuid
from aspen.utils import utcnow
import gratipay.wireup
env = gratipay.wireup.env()
db = gratipay.wireup.db(en... | Python | 0.000001 | |
bf02019c8b97d8dc35e3e186b31cb57adac6a8ec | Create a measurement | shrugd-create.py | shrugd-create.py | import ripe.atlas.cousteau
from atlaskeys import create_key
# DNS query properties
query_argument = "wide.ad.jp"
query_type = "AAAA"
dnssec_ok = True
set_nsid_bit = True
# IP addresses to start from
dns_server_ips = [
"199.7.91.13", "2001:500:2d::d", # D.ROOT-SERVERS.NET
"192.203.230.10", # E.... | Python | 0.998877 | |
69d358fa08652e44dc37974bb735cfdc40ccf1db | increase UPDATE_INTERVAL (#18429) | homeassistant/components/edp_redy.py | homeassistant/components/edp_redy.py | """
Support for EDP re:dy.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/edp_redy/
"""
import logging
from datetime import timedelta
import voluptuous as vol
from homeassistant.const import (CONF_USERNAME, CONF_PASSWORD,
... | """
Support for EDP re:dy.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/edp_redy/
"""
import logging
from datetime import timedelta
import voluptuous as vol
from homeassistant.const import (CONF_USERNAME, CONF_PASSWORD,
... | Python | 0 |
bbdc1961271acf0dd0ad8818d41b84eea4a5aec4 | Use entity_id attribute | homeassistant/components/influxdb.py | homeassistant/components/influxdb.py | """
homeassistant.components.influxdb
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
InfluxDB component which allows you to send data to an Influx database.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/influxdb/
"""
import logging
import homeassistant.util as util... | """
homeassistant.components.influxdb
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
InfluxDB component which allows you to send data to an Influx database.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/influxdb/
"""
import logging
import homeassistant.util as util... | Python | 0.000002 |
323176a9749d37d05e87339fe34b50b90cc6b663 | add solution for Maximum Product Subarray | src/maximumProductSubarray.py | src/maximumProductSubarray.py | class Solution:
# @param A, a list of integers
# @return an integer
def maxProduct(self, A):
if not A:
return 0
if len(A) == 1:
return A[0]
maxV, minV = A[0], A[0]
res = maxV
for val in A[1:]:
if val > 0:
maxV, min... | Python | 0 | |
abd23cbc80149d4f2985eb8aef5d893714cca717 | add a script to reset the db | scripts/reset_db.py | scripts/reset_db.py | from scraper import clean
def run():
if raw_input("Are you sure? Then write 'yes'") == "yes":
clean()
| Python | 0 | |
43e5727d4091e0b6cb11e0e13ea9f7daf69628fc | Add corpusPreProcess. | corpusPreProcess.py | corpusPreProcess.py | #! /usr/share/env python
# -*- coding=utf-8 -*-
resultFile = open('corpus/BigCorpusPre.txt', 'w')
with open('corpus/BigCorpus.txt', 'r') as f:
for line in f:
line = line[line.find(':')+1:]
resultFile.write(line.strip()+'\n')
resultFile.close()
| Python | 0 | |
82089ad5e5c0d597cfdd16575b4fa5a9a09415ff | introduce plumbery from the command line -- no python coding, yeah! | plumbery/__main__.py | plumbery/__main__.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
# (the "License"); you may not use ... | Python | 0 | |
7182af317116db7eb3f7a278b3487ad91a3b3331 | Add example for a clunky 3D high resolution loupe for napari | high-res-slider.py | high-res-slider.py | import functools
import numpy as np
import dask.array as da
from magicgui.widgets import Slider, Container
import napari
# stack = ... # your dask array
# stack2 = stack[::2, ::2, ::2]
# stack4 = stack2[::2, ::2, ::2]
# 👆 quick and easy multiscale pyramid, don't do this really
# see https://github.com/dask/dask-imag... | Python | 0.000001 | |
1e104af5dc1ef5cbec4bfad62a1691bd0c784caf | Add lstm with zoneout (slow to converge). | rhn/lstm_zoneout.py | rhn/lstm_zoneout.py | # LSTM implementation using zoneout as described in
# Zoneout: Regularizing RNNs by Randomly Preserving Hidden Activations
# https://arxiv.org/abs/1606.01305
from keras import backend as K
from keras.layers import LSTM, time_distributed_dense
from keras import initializations, activations, regularizers
from keras.engin... | Python | 0 | |
72f32099411644a3fed6103430f7dd78fb0929a5 | Add new content parser class (based upon code in Konstruktuer) | konstrukteur/ContentParser.py | konstrukteur/ContentParser.py | #
# Konstrukteur - Static website generator
# Copyright 2013 Sebastian Fastner
#
import glob, os
from jasy.core import Console
import konstrukteur.Language
import konstrukteur.Util
class ContentParser:
""" Content parser class for Konstrukteur """
def __init__(self, extensions, fixJasyCommands, defaultLanguage):
... | Python | 0 | |
010028c9170e153d3bc9e3618e02feb2d5e0fb7a | Add stress tester for testing glbackend | scripts/stresser.py | scripts/stresser.py | #!/usr/bin/env python
import json
from twisted.internet import protocol, defer, reactor
from twisted.web.iweb import IBodyProducer
from zope.interface import implements
from twisted.web.client import Agent
from twisted.web.http_headers import Headers
base_url = 'http://127.0.0.1:8082'
class StringProducer(object)... | Python | 0 | |
1d20bec9306904a6d676c4e1e34a07a842a7a600 | Add the IGMP file which got left out. | pcs/packets/igmp.py | pcs/packets/igmp.py | import pcs
from socket import AF_INET, inet_ntop
import struct
import inspect
import time
import igmpv2
import igmpv3
#import dvmrp
#import mtrace
IGMP_HOST_MEMBERSHIP_QUERY = 0x11
IGMP_v1_HOST_MEMBERSHIP_REPORT = 0x12
IGMP_DVMRP = 0x13
IGMP_v2_HOST_MEMBERSHIP_REPORT = 0x16
IGMP_HOST_LEAVE_MESSAGE = 0x17
IGMP_v3_HOS... | Python | 0 | |
2cadad76c2756852b94948088e92b9191abebbb7 | make one pickle file with all metadata (for faster loading) | generate_metadata_pkl.py | generate_metadata_pkl.py | import argparse
from dicom.sequence import Sequence
import glob
import re
from log import print_to_file
import cPickle as pickle
def read_slice(path):
return pickle.load(open(path))['data']
def convert_to_number(value):
value = str(value)
try:
if "." in value:
return float(value)
... | Python | 0 | |
8939e873f4ea61169f9384eded5b8c603cfde988 | Add crypto pre-submit that will add the openssl builder to the default try-bot list. | crypto/PRESUBMIT.py | crypto/PRESUBMIT.py | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Chromium presubmit script for src/net.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details on the presubmit ... | Python | 0.000006 | |
27ed31c7a21c4468bc86aaf220e30315e366c425 | add message to SearxParameterException - fixes #1722 | searx/exceptions.py | searx/exceptions.py | '''
searx 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 version.
searx is distributed in the hope that it will be useful,
but WITHOUT ANY WA... | '''
searx 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 version.
searx is distributed in the hope that it will be useful,
but WITHOUT ANY WA... | Python | 0 |
a230bb1b2f1c96c7f9764ee2bf759ea9fe39e801 | add populations tests | isochrones/tests/test_populations.py | isochrones/tests/test_populations.py | import unittest
from pandas.testing import assert_frame_equal
from scipy.stats import uniform, norm
from isochrones import get_ichrone
from isochrones.priors import ChabrierPrior, FehPrior, GaussianPrior, SalpeterPrior, DistancePrior, AVPrior
from isochrones.populations import StarFormationHistory, StarPopulation, Bin... | Python | 0 | |
6ebed7a2a6488a857fc6878c2d39d26ce9bc72f5 | Add release 9.1.0 recognition to the Dyninst API package file. | var/spack/repos/builtin/packages/dyninst/package.py | var/spack/repos/builtin/packages/dyninst/package.py | ##############################################################################
# Copyright (c) 2013, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
... | ##############################################################################
# Copyright (c) 2013, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
... | Python | 0 |
06df583e3821470856852b10f0703fccce81e2d6 | Add planex-pin command | planex/pin.py | planex/pin.py | """
planex-pin: Generate a new override spec file for a given package
"""
import argparse
import os
import sys
import re
import logging
from planex.util import run
def describe(repo, treeish="HEAD"):
dotgitdir = os.path.join(repo, ".git")
if not os.path.exists(dotgitdir):
raise Exception("Pin target... | Python | 0 | |
d98d45ec500c2850a507ddd248abff62a9253add | Add Albany package. (#8332) | var/spack/repos/builtin/packages/albany/package.py | var/spack/repos/builtin/packages/albany/package.py | ##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | Python | 0 | |
f982cd78ae79f77c2ca59440de20de37002d6658 | Add a pcakge: libzip. (#3656) | var/spack/repos/builtin/packages/libzip/package.py | var/spack/repos/builtin/packages/libzip/package.py | ##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | Python | 0.001174 | |
9877c21c502b27460f70e6687ed3fd6a2d3fd0d5 | add new package at v8.3.0 (#27446) | var/spack/repos/builtin/packages/racket/package.py | var/spack/repos/builtin/packages/racket/package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Racket(Package):
"""The Racket programming language."""
homepage = "https://www.racke... | Python | 0 | |
bd49a4c82e011d7c5025abc15324220b1496f8c8 | add deepspeech.py to support DeepSpeech | deepspeech.py | deepspeech.py | import subprocess
class DeepSpeechRecognizer():
def __init__(self, model=None, alphabet=None, lm=None, trie=None):
self.model = model
self.alphabet = alphabet
self.lm = lm
self.trie = trie
def recognize(self, audio_file):
"""recognize audio file
args:
... | Python | 0.000001 | |
ca09dc0b9d555f10aafb17380a9a8592727d0a0f | Add dp/SPOJ-ROCK.py | dp/SPOJ-ROCK.py | dp/SPOJ-ROCK.py | def compute_zero_counts(rock_desc):
zero_counts = [0 for i in xrange(N+1)]
for i in xrange(1, N+1):
zero_counts[i] = zero_counts[i-1]
if rock_desc[i-1] == '0':
zero_counts[i] += 1
return zero_counts
def score(zero_counts, start, end):
length = end - start + 1
zeroes = z... | Python | 0.000001 | |
50d05aabc2eb1d5bcb20d457dd05d2882b983afa | Add installation script for profiler. | install_and_run.py | install_and_run.py | # Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | Python | 0 | |
734967196c8f0577b218802c16d9eab31c9e9054 | Add problem 36, palindrome binaries | problem_36.py | problem_36.py | from time import time
def is_palindrome(s):
for idx in range(len(s)/2):
if s[idx] != s[-1*idx - 1]:
return False
return True
def main():
palindrom_nums = [num for num in range(int(1e6)) if is_palindrome(str(num)) and is_palindrome(str(bin(num))[2:])]
print 'Palindroms:', palindro... | Python | 0.999978 | |
ad9a9df8e144c41456aeded591081a3a339853f3 | Create RLU_forward_backward.py | Neural-Networks/RLU_forward_backward.py | Neural-Networks/RLU_forward_backward.py |
from numpy import *
from RLU_neural_forward import *
from RLU_back_propagation import *
def forwardBackward(xi, x, y, MT, time_queue, good_queue, DELTA_queue):
A = neural_forward(xi, x, MT)
check = argmax(A[-xi[-1]:])
# send back some progress statistic
if y[check]-1 == 0:
good = good_queue.get()
good += 1
... | Python | 0.000019 | |
1ecb4a0711304af13f41ae1aae67792057783334 | Create ScaperUtils.py | data/ScaperUtils.py | data/ScaperUtils.py | class ScraperUtil (object) :
class Base :
def __init__(self,data_get,data_parse, data_formatter=None) :
self.get_data = data_get
self.parse_data = data_parse
self.data_formatter = data_formatter
class Yahoo(Base) :
def __init__(self,data_get,data_format,data_parse) :
... | Python | 0 | |
6d33ed73adeea4808ed4b3b9bd8642ad83910dfc | add ridgeline example (#1519) | altair/examples/ridgeline_plot.py | altair/examples/ridgeline_plot.py | """
Ridgeline plot (Joyplot) Example
--------------------------------
A `Ridgeline plot <https://serialmentor.com/blog/2017/9/15/goodbye-joyplots>`_
chart is a chart that lets you visualize distribution of a numeric value for
several groups.
Such a chart can be created in Altair by first transforming the data into a
... | Python | 0 | |
dfe65e6839a4347c7acfc011f052db6ec4ee1d9d | test Task | tests/unit/test_task.py | tests/unit/test_task.py | import sys
from zorn import tasks
from io import StringIO
def test_task():
task = tasks.Task()
assert task.verbosity == 1
def test_parse_verbosity_standard():
silent = False
verbose = False
verbosity = tasks.Task.parse_verbosity(verbose, silent)
assert verbosity == 1
def test_parse_verbosity_... | Python | 0.999998 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.