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 |
|---|---|---|---|---|---|---|---|
450557e0bfb902de862e5fe42868d3fbf7165600 | Add lc0983_minimum_cost_for_tickets.py from Hotel Schulz Berlin | lc0983_minimum_cost_for_tickets.py | lc0983_minimum_cost_for_tickets.py | """Leetcode 983. Minimum Cost For Tickets
Medium
URL: https://leetcode.com/problems/minimum-cost-for-tickets/
In a country popular for train travel, you have planned some train travelling
one year in advance. The days of the year that you will travel is given as
an array days. Each day is an integer from 1 to 365.... | Python | 0.000001 | |
a737126f8f8bcac1a00999f9e5c2a23bca9efd0d | Create hamming.py | hamming.py | hamming.py | #Python Problem 2
#hamming.py
#Introduction to Bioinformatics Assignment 2
#Purpose:Calculate Hamming Distance
#Your Name: Michael Thomas
#Date: 10/10/15
#stores 3 database sequences
seqList = ["AGGATACAGCGGCTTCTGCGCGACAAATAAGAGCTCCTTGTAAAGCGCCAAAAAAAGCCTCTCGGTCTGTGGCAGCAGCGTTGGCCCGGCCCCGGGAGCGGAGAGCGAGGGGAGGCAGATTCGG... | Python | 0.000001 | |
290239e45b5a4eae88a5c92304b46bf74a04b616 | update Enclosure.mime docstring [skip ci] | mailthon/enclosure.py | mailthon/enclosure.py | """
mailthon.enclosure
~~~~~~~~~~~~~~~~~~
Implements Enclosure objects- parts that collectively
make up body of the email.
:copyright: (c) 2015 by Eeo Jun
:license: MIT, see LICENSE for details.
"""
from email.encoders import encode_base64
from email.message import Message
from email.mime.bas... | """
mailthon.enclosure
~~~~~~~~~~~~~~~~~~
Implements Enclosure objects- parts that collectively
make up body of the email.
:copyright: (c) 2015 by Eeo Jun
:license: MIT, see LICENSE for details.
"""
from email.encoders import encode_base64
from email.message import Message
from email.mime.bas... | Python | 0 |
fad2e9d7b05c072b4d25f9f6c51e25c87428f41d | add PyPI publisher, for pushing to packages.python.org | hyde/ext/publishers/pypi.py | hyde/ext/publishers/pypi.py | """
Contains classes and utilities that help publishing a hyde website to
the documentation hosting on http://packages.python.org/.
"""
import os
import getpass
import zipfile
import tempfile
import httplib
import urlparse
from base64 import standard_b64encode
import ConfigParser
from hyde.fs import File, Folder
fro... | Python | 0 | |
7b73c957ad52f9b846955b96b7cc6d0938587bb3 | Add 3rd order covariance | src/conventional/cum3est.py | src/conventional/cum3est.py | #!/usr/bin/env python
from __future__ import division
import numpy as np
from scipy.linalg import hankel
import scipy.io as sio
import matplotlib.pyplot as plt
from tools import *
def cum3est(y, maxlag, nsamp, overlap, flag, k1):
"""
UM3EST Third-order cumulants.
Should be invoked via "CUMEST" for proper para... | Python | 0.999372 | |
ded893c34db0c6de521e6d735d6fce30f16f3a51 | Add WSGI file. | noodleamp.wsgi | noodleamp.wsgi | import os
import pwd
import sys
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
def path(*paths):
return os.path.join(BASE_DIR, *paths)
os.environ['NOODLEAMP_CONFIG'] = path('settings_local.py')
# http://code.google.com/p/modwsgi/wiki/ApplicationIssues#User_HOME_Environment_Variable
os.environ['HOME'] =... | Python | 0 | |
33393fcfcca30edafcf06df53550f4985033c459 | Add numba error module | numba/error.py | numba/error.py | class NumbaError(Exception):
"Some error happened during compilation" | Python | 0 | |
5784158855eba090c24bb93ece991fba3b1e1a67 | Add never_cache to views | radmin/views.py | radmin/views.py | from django.http import HttpResponse
from django.contrib.admin.views.decorators import staff_member_required
from django.utils import simplejson as json
from django.views.decorators.cache import never_cache
from radmin.console import REGISTERED_NAMED_ITEMS, REGISTERED_TO_ALL
from radmin.utils import *
@never_cache
@st... | from django.http import HttpResponse
from django.contrib.admin.views.decorators import staff_member_required
from django.utils import simplejson as json
from radmin.console import REGISTERED_NAMED_ITEMS, REGISTERED_TO_ALL
from radmin.utils import *
@staff_member_required
def entry_point(request):
""" This is the e... | Python | 0 |
e8a5720c6959a3166c1c8a373ef00a390b89ac22 | Add rasp2geotiff script | rasp2geotiff.py | rasp2geotiff.py | #!/usr/bin/env python
import xcsoar
import osr
import gdal
import numpy as np
import os, sys
import math
idx_min_x = idx_max_x = idx_min_y = idx_max_y = 0
spa_x = spa_y = 0
lat_0 = lat_1 = lon_0 = 0
lat_c = lon_c = 0
raster_data = None
def get_parameters(line):
global idx_min_x, idx_max_x, idx_min_y, idx_max_y, s... | Python | 0 | |
c1e801798d3b7e8d4c9ba8a11f79ffa92bf182f5 | Add test cases for the logger | test/test_logger.py | test/test_logger.py | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from __future__ import print_function
from __future__ import unicode_literals
import logbook
from pingparsing import (
set_logger,
set_log_level,
)
import pytest
class Test_set_logger(object):
@pytest.mark.parame... | Python | 0.000002 | |
c559cdd34a2dc8f3129c1fed5235291f22329368 | install crontab | install_crontab.py | install_crontab.py | #!/usr/bin/python2
from crontab import CronTab
import sys
CRONTAB_TAG = "ubuntu-cleanup-annoifier"
def install_cron():
my_cron = CronTab(user=True)
# job = my_cron.new(command=executable_path(args))
job = my_cron.new(command="dummy123")
job.minute.on(0)
job.hour.on(0)
job.enable()
jo... | Python | 0.000001 | |
ca8a7320cbec1d4fa71ec5a7f909908b8765f573 | Allow underscores for release tags (#4976) | test_utils/scripts/circleci/get_tagged_package.py | test_utils/scripts/circleci/get_tagged_package.py | # Copyright 2016 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | # Copyright 2016 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | Python | 0 |
ee679b745e955e3d555b49500ae2d09aa3336abb | Add a util function for SNMP | confluent_server/confluent/snmputil.py | confluent_server/confluent/snmputil.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2016 Lenovo
#
# 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 ... | Python | 0 | |
7f09311b2f7825bf1446a6e476f8d1909d501699 | Add threshold helper | driver_station/src/targeting/threshold_helper.py | driver_station/src/targeting/threshold_helper.py | #
# This file is part of KwarqsDashboard.
#
# KwarqsDashboard 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, version 3.
#
# KwarqsDashboard is distributed in the hope that it will be useful,
# but... | Python | 0.000009 | |
74e24debf55b003f1d56d35f4b040d91a0698e0a | Add example for cluster centroids method | example/under-sampling/plot_cluster_centroids.py | example/under-sampling/plot_cluster_centroids.py | """
=================
Cluster centroids
=================
An illustration of the cluster centroids method.
"""
print(__doc__)
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
# Define some color for the plotting
almost_black = '#262626'
palette = sns.color_palette()
from sklearn.datasets import mak... | Python | 0.000001 | |
25cd25dab4de9e6963ffa622474b3f0bdcdc1e48 | Create preprocessor.py | interpreter/preprocessor.py | interpreter/preprocessor.py | Python | 0.000006 | ||
0c1ccd5180601d3ed3f5dc98b3330d40c014f7c0 | Add simul. (#3300) | var/spack/repos/builtin/packages/simul/package.py | var/spack/repos/builtin/packages/simul/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.000027 | |
a4bd7e17d02f83e377287564788a3eda1000029a | add adp tests | pyiid/tests/test_scatter_adp.py | pyiid/tests/test_scatter_adp.py | from pyiid.tests import *
from pyiid.experiments.elasticscatter import ElasticScatter
__author__ = 'christopher'
# rtol = 4e-4
# atol = 4e-4
rtol = 5e-4
atol = 5e-5
# Actual Tests
def check_meta(value):
value[0](value[1:])
def check_scatter_fq(value):
"""
Check two processor, algorithm pairs against e... | Python | 0 | |
6cb953dc01a77bc549c53cc325a741d1952ed6b6 | Bump FIDO version to 1.3.12 | fpr/migrations/0025_update_fido_1312.py | fpr/migrations/0025_update_fido_1312.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def data_migration_up(apps, schema_editor):
"""
Update identification tool FIDO to 1.3.12, correcting a
character-spacing issue bug identified in PRONOM94 (again)
"""
idtool = apps.get_model('fpr', ... | Python | 0 | |
8fa9a54c9a5ee683fc9e9d361a4eb7affe5e83ed | Add functions to paint game of life to screen | game_of_life.py | game_of_life.py | #!/usr/bin/env python
from curses import wrapper
from time import sleep
def enumerate_lines(matrix):
on = '*'
off = ' '
for i, row in enumerate(matrix):
yield i, ''.join(on if v else off for v in row)
def paint(stdscr, matrix):
stdscr.clear()
for i, line in enumerate_lines(matrix):
... | Python | 0 | |
ff8cee4f98dde0533751dfd15308c5fdfdec3982 | test file for rapid iteration | tests/quick_test.py | tests/quick_test.py | """
nosetests -sv --nologcapture tests/quick_test.py
"""
import datetime
import os
import random
import sys
sys.path = [os.path.abspath(os.path.dirname(__file__))] + sys.path
os.environ['is_test_suite'] = 'True'
os.environ['KERAS_BACKEND'] = 'theano'
from auto_ml import Predictor
from auto_ml.utils_models import load... | Python | 0 | |
34709ee5d69e59fe87bebb51d522e05abaf6ed8d | Add unit test for helper functions | test/unit/test_parser.py | test/unit/test_parser.py | # :coding: utf-8
import pytest
import sphinxcontrib.parser
def test_parse_repository_error():
"""Raise an error if the path is incorrect."""
with pytest.raises(OSError):
sphinxcontrib.parser.parse_repository("")
def test_parse_repository_empty(temporary_directory):
"""Raise an empty environmen... | Python | 0.000001 | |
c98a744f5f436ae2c6266a7bb5d32173cfd0e4a9 | Add a script that scrapes the Socrata catalog, just in case we need that in another format | scripts/socrata_scraper.py | scripts/socrata_scraper.py | #!/usr/bin/python3
"""
This is a basic script that downloads the catalog data from the smcgov.org
website and pulls out information about all the datasets.
This is in python3
There is an optional download_all argument that will allow you to download
all of the datasets individually and in their entirety. I have incl... | Python | 0 | |
0c11d2740e561586bb4f9d2b67bda2ccc87e146e | Add new command to notify New Relic of deployment | ixdjango/management/commands/newrelic_notify_deploy.py | ixdjango/management/commands/newrelic_notify_deploy.py | """
Management command to enable New Relic notification of deployments
.. moduleauthor:: Infoxchange Development Team <development@infoxchange.net.au>
"""
import pwd
import os
from subprocess import Popen, PIPE
from urllib import urlencode
from httplib2 import Http
from django.conf import settings
from django.core... | Python | 0 | |
c0ea919305bcedf080a2213f4c549c68fa4efa2d | test tools | tests/test_tools.py | tests/test_tools.py | import unittest2 as unittest
from fabric.api import run
import tempfile
from mixins import WebServerMixin
from parcel.tools import dl, rpull, rpush
def tempname():
return tempfile.mkstemp()[1]
import zlib, os
def crc32(filename):
CHUNKSIZE = 8192
checksum = 0
with open(filename, 'rb') as fh:
... | Python | 0.000002 | |
9de5728e5fdb0f7dc606681df685eb084477d8d0 | Add exercise | multiplyTwoNumbers.py | multiplyTwoNumbers.py | #!/usr/bin/env python
def main():
a = input("Enter a number: ")
b = input("Enter another number: ")
print "The product of %d and %d is %d" % (a, b, a * b)
main()
| Python | 0.000196 | |
f883edc209928494c45693c5ecfd279bfbb09c97 | Add partfrac1 | timing/partfrac1.py | timing/partfrac1.py | import time
from lcapy import *
funcs = [1 / s, 1 / s**2, 1 / (s + 3), 1 / (s + 3)**2, (s + 3) / (s + 4),
1 / (s + 3)**2 / (s + 4), 1 / (s + 3)**3 / (s + 4),
1 / (s + 3) / (s + 4) / (s + 5), (s + 6) / (s + 3) / (s + 4) / (s + 5),
1 / (s + 3)**2 / (s + 4)**2, 1 / (s + 3)**3 / (s + 4)**2,
... | Python | 0.999998 | |
e71c232660a7480c2b56f6e76e83fad4c7e9da8a | Add ctm_test.py test for testing CRTC's CTM color matrix property. | py/tests/ctm_test.py | py/tests/ctm_test.py | #!/usr/bin/python3
import sys
import pykms
def ctm_to_blob(ctm, card):
len=9
arr = bytearray(len*8)
view = memoryview(arr).cast("I")
for x in range(len):
i, d = divmod(ctm[x], 1)
if i < 0:
i = -i
sign = 1 << 31
else:
sign = 0
view[x ... | Python | 0 | |
04477b11bbe7efa1720829691b7d1c3fe2a7a492 | Add __init__ | h2/__init__.py | h2/__init__.py | # -*- coding: utf-8 -*-
"""
h2
~~
A HTTP/2 implementation.
"""
__version__ = '0.1.0'
| Python | 0.000917 | |
95a40b92256374878c7fc6528fcaabf1939d9fce | Add a python script to parse DisplayList benchmarking output (#31266) | testing/benchmark/displaylist_benchmark_parser.py | testing/benchmark/displaylist_benchmark_parser.py | #!/usr/bin/env python3
#
# Copyright 2013 The Flutter 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 argparse
import json
import sys
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages as pdfp
... | Python | 0 | |
2e2ad49c7ada145b5a4a81bd8941cf5e72d2d81b | Test case for wordaxe bug | rst2pdf/tests/input/test_180.py | rst2pdf/tests/input/test_180.py | # -*- coding: utf-8 -*-
from reportlab.platypus import SimpleDocTemplate
from reportlab.platypus.paragraph import Paragraph
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.colors import Color
from reportlab.platypus.flowables import _listWrapOn, _FUZZ
from wordaxe.rl.NewParagraph... | Python | 0 | |
698eee3db238189ba066670c4fe4a1193e6a942a | add flask-login | app/user/loginmanager.py | app/user/loginmanager.py | from flask.ext.login import LoginManager
from models import User
login_manager = LoginManager()
@login_manager.user_loader
def user_loader(user_id):
return User.query.get(user_id)
login_manager.login_view = '.login'
| Python | 0.000001 | |
d5d8e16b5ccbbb65398ce015f020db3839fac409 | add test_rotate.py | tests/transforms_tests/image_tests/test_rotate.py | tests/transforms_tests/image_tests/test_rotate.py | import random
import unittest
import numpy as np
from chainer import testing
from chainercv.transforms import flip
from chainercv.transforms import rotate
class TestRotate(unittest.TestCase):
def test_rotate(self):
img = np.random.uniform(size=(3, 32, 24))
angle = random.uniform(0, 180)
... | Python | 0.000003 | |
de74c933b74d9066984fe040edf026b7d9f87711 | Split problem statement 2 | 69_split_problem_statement_2.py | 69_split_problem_statement_2.py | '''
Open the file sample.txt and read it line by line.
When you find a line that starts with 'From:' like the following line:
From stephen.marquard@uct.ac.za Sat Jan 5 09:14:16 2008
You will parse the From line using split() and print out the second word in the line
(i.e. the entire address of the person who sent ... | Python | 0.99994 | |
01029805a6fb3484cf803f0c0abd18232b4ad810 | Add database tools | egoio/tools/db.py | egoio/tools/db.py | def grant_db_access(conn, schema, table, role):
r"""Gives access to database users/ groups
Parameters
----------
conn : sqlalchemy connection object
A valid connection to a database
schema : str
The database schema
table : str
The database table
role : str
da... | Python | 0.000001 | |
bc9072cee7ce880c30af83ee4c239ae9cf1ddbfe | Create NumberofIslandsII_001.py | lintcode/Number-of-Islands-II/NumberofIslandsII_001.py | lintcode/Number-of-Islands-II/NumberofIslandsII_001.py | # Definition for a point.
# class Point:
# def __init__(self, a=0, b=0):
# self.x = a
# self.y = b
class UnionFind:
def __init__(self, n, m):
self.fathers = {}
self.nsets = 0
self.grid = [[0 for _ in range(m)] for _ in range(n)]
self.n = n
self.m = m
... | Python | 0.000215 | |
bc3f4575c7267db8f7841a82e8f6866c59d15237 | Add some example function tests that use gaeftest | tests/test_functional.py | tests/test_functional.py | #!/usr/bin/python2.5
#
# Copyright 2009 the Melange authors.
#
# 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... | Python | 0.000001 | |
1ced3a967742783ef649f7c7defecf333050d547 | Update http_endpoint to use convert_xml() | jenkins_jobs/modules/notifications.py | jenkins_jobs/modules/notifications.py | # Copyright 2012 Hewlett-Packard Development Company, L.P.
#
# 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... | # Copyright 2012 Hewlett-Packard Development Company, L.P.
#
# 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... | Python | 0.000001 |
4856b426b380d4d46cccc2f5b8ab2212956a96c2 | test of time module. not terribly fancy, but it does touch every function and variable in the module, verifies a few return values and even tests a couple of known error conditions. | Lib/test/test_time.py | Lib/test/test_time.py | import time
time.altzone
time.clock()
t = time.time()
time.asctime(time.gmtime(t))
if time.ctime(t) <> time.asctime(time.localtime(t)):
print 'time.ctime(t) <> time.asctime(time.localtime(t))'
time.daylight
if int(time.mktime(time.localtime(t))) <> int(t):
print 'time.mktime(time.localtime(t)) <> t'
time.sle... | Python | 0 | |
c851501cc8149685a9e9c023aa200b92c17a9078 | Add decoder ida fields name | pida_fields.py | pida_fields.py | def decode_name_fields(ida_fields):
i = -1
stop = len(ida_fields)
while True:
i += 1
if i == stop:
break
count = ord(ida_fields[i]) - 1
if count == 0:
continue
i += 1
yield ida_fields[i:i + count]
i += count - 1
| Python | 0.000001 | |
fab0b43c2f2c60ac9cf701fb275650f05ac0dfa2 | add wrapper class for basic binary gpio | raspi_binary_gpio.py | raspi_binary_gpio.py | """
Author: Nate Levesque <public@thenaterhood.com>
Language: Python3
Filename: raspi_binary_gpio.py
Description:
contains a class for reading/writing from the raspberry pi
GPIO pins as two 8-bit arrays, like in assembly. Note that
this is designed (originally) for writing/reading 8-bit arrays
of switc... | Python | 0 | |
015c7f7fbab200084cf08bd1f7e35cbcd61b369e | Axonical hello world. | Sketches/PT/helloworld.py | Sketches/PT/helloworld.py | #!/usr/bin/env python
import time
from Axon.Component import component
from Axon.Scheduler import scheduler
class HelloPusher(component):
def main(self):
while True:
time.sleep(0.5) # normally this would be a bad idea, since the entire scheduler will halt inside this component.
sel... | Python | 0.999999 | |
e869c7ef9e3d19da4c98cda57b5e22fb5a35cba5 | Add first basic unittests using py.test | tests/test_validators.py | tests/test_validators.py | """
test_validators
~~~~~~~~~~~~~~
Unittests for bundled validators.
:copyright: 2007-2008 by James Crasta, Thomas Johansson.
:license: MIT, see LICENSE.txt for details.
"""
from py.test import raises
from wtforms.validators import ValidationError, length, url, not_empty, email, ip_addres... | Python | 0 | |
54c358a296733d2a5236a9a776830f1b78682b73 | Add lc040_combination_sum_ii.py | lc040_combination_sum_ii.py | lc040_combination_sum_ii.py | """Leetcode 40. Combination Sum II
Medium
URL: https://leetcode.com/problems/combination-sum-ii/
Given a collection of candidate numbers (candidates) and a target number (target),
find all unique combinations in candidates where the candidate numbers sums to target.
Each number in candidates may only be used once in... | Python | 0.004345 | |
7fab8c2d014f013131bd4d6301f5f8e5268d6037 | add leetcode Pow(x, n) | leetcode/powx-n/solution.py | leetcode/powx-n/solution.py | # -*- coding:utf-8 -*-
class Solution:
# @param x, a float
# @param n, a integer
# @return a float
def pow(self, x, n):
if n == 0:
return 1
if n < 0:
neg_flag = True
n = -n
else:
neg_flag = False
ret = 1
while n > 0... | Python | 0.000908 | |
736103ea495c89defcae9bf6ab72aa7b89768026 | add start of advisory module | updatebot/advise.py | updatebot/advise.py | #
# Copyright (c) 2008 rPath, Inc.
#
# This program is distributed under the terms of the Common Public License,
# version 1.0. A copy of this license should have been distributed with this
# source file in a file called LICENSE. If it is not present, the license
# is always available at http://www.rpath.com/permanent/... | Python | 0 | |
27b9727926139ae2cfde6d3cdcdf5746ed28e03d | Add new package arbor (#11914) | var/spack/repos/builtin/packages/arbor/package.py | var/spack/repos/builtin/packages/arbor/package.py | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Arbor(CMakePackage):
"""Arbor is a high-performance library for computational neuroscience... | Python | 0 | |
ac851c402952cf44b24dfdf5277765ff286dd994 | convert embeddingns to js-friendly format | src/convert_embeddings_to_js.py | src/convert_embeddings_to_js.py | import h5py
import json
import numpy as np
def load_embeddings(path):
f = h5py.File(path, 'r')
nemb = f['nemb'][:]
f.close()
return nemb
def load_vocab(path):
vocab = []
with open(path, 'rb') as f:
for line in f.readlines():
split = line.split(' ')
vocab.append((split[0], int(split[1].rstr... | Python | 0.999997 | |
11efa5583bbeeee7c7823264f6f73715ea81edc0 | Add trivial test for ECO fetching | luigi/tests/ontologies/eco_test.py | luigi/tests/ontologies/eco_test.py | # -*- coding: utf-8 -*-
"""
Copyright [2009-2017] EMBL-European Bioinformatics Institute
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... | Python | 0.000002 | |
ec3b080b2f1922f4989b853db45475d185e314de | add all | examples/gcharttestapp/TestGChart00.py | examples/gcharttestapp/TestGChart00.py |
import GChartTestAppUtil
from pyjamas.chart.GChart import GChart
"""* Empty chart without anything on it except a title and footnotes """
class TestGChart00 (GChart):
def __init__(self):
GChart.__init__(self, 150,150)
self.setChartTitle(GChartTestAppUtil.getTitle(self))
self.setChartFootn... | Python | 0.000308 | |
4fdba8a1a5a2123843cc9eefd8949fb8996f59b2 | Add a wrapper for ChromeOS to call into telemetry. | telemetry/telemetry/unittest/run_chromeos_tests.py | telemetry/telemetry/unittest/run_chromeos_tests.py | # Copyright 2014 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 logging
import os
import sys
from telemetry.unittest import gtest_progress_reporter
from telemetry.unittest import run_tests
from telemetry.core impor... | Python | 0.000003 | |
fcce65daf40bb1c198be7ddadee8769bf6feea9b | Create k-order-test.py | k-order-test.py | k-order-test.py | # -*- coding: utf-8 -*-
"""
Created on Thu Mar 6 16:41:40 2014
@author: xiao
"""
from k_order import *
#number of items to recommand
p=2
fadress = "/home/xiao/ProjetLibre/matrix/matrixInfo"
readDataFromFile(fadress)
getDu()
recommendationListe = zeros((m,p))
############################################
#### We ... | Python | 0.000032 | |
d73235dd994d3705178d0cff142293444977d764 | Remove bad imports | odo/backends/tests/conftest.py | odo/backends/tests/conftest.py | import os
import shutil
import pytest
@pytest.fixture(scope='session')
def sc():
pyspark = pytest.importorskip('pyspark')
return pyspark.SparkContext('local[*]', 'odo')
@pytest.yield_fixture(scope='session')
def sqlctx(sc):
pyspark = pytest.importorskip('pyspark')
try:
yield pyspark.HiveCon... | import os
import shutil
import pytest
@pytest.fixture(scope='session')
def sc():
pytest.importorskip('pyspark')
from pyspark import SparkContext
return SparkContext('local[*]', 'odo')
@pytest.yield_fixture(scope='session')
def sqlctx(sc):
pytest.importorskip('pyspark')
from odo.backends.sparksql... | Python | 0.000015 |
4c5a8f018af4377ce3f9367b0c66a51a6cad671b | add __init__.py | eatable/__init__.py | eatable/__init__.py |
from .table import Table
from .row import Row
| Python | 0.00212 | |
2b15d2df8333db5f5cd6fcefaf56f5400baba95e | add test_results_table.py | metaseq/test/test_results_table.py | metaseq/test/test_results_table.py | from metaseq import results_table
import metaseq
import numpy as np
fn = metaseq.example_filename('ex.deseq')
d = results_table.ResultsTable(fn)
def test_dataframe_access():
# different ways of accessing get the same data in memory
assert d.id is d.data.id
assert d['id'] is d.data.id
def test_dataframe... | Python | 0.000104 | |
2382c1c9daf2b17799ceb03f42a6917966b3162c | add kattis/cold | Kattis/cold.py | Kattis/cold.py | """
Problem: cold
Link: https://open.kattis.com/problems/cold
Source: Kattis
"""
N = int(input())
A = list(map(int, input().split()))
answer = 0
for i in range(len(A)):
answer += (A[i] < 0)
print(answer)
| Python | 0.999545 | |
dd93b450eb0cc92debd8b5cec82f3127c454d77f | put this back... | TheCannon/infer_labels.py | TheCannon/infer_labels.py | from __future__ import (absolute_import, division, print_function, unicode_literals)
from scipy import optimize as opt
import numpy as np
LARGE = 200.
SMALL = 1. / LARGE
def _get_lvec(labels):
"""
Constructs a label vector for an arbitrary number of labels
Assumes that our model is quadratic in the label... | Python | 0 | |
652a03d96cbc5c06850fa62fa3507fb74ee3deab | Create python_ciphertext.py | Encryption/python_ciphertext.py | Encryption/python_ciphertext.py | #Simply how to make a ciphertext only with 1 line.
>>> #hex_encode = 'summonagus'.encode('hex')
>>> hex_encode = '73756d6d6f6e61677573'
>>> chip = ''.join([ str(int(a)*2) if a.isdigit() and int(a) == 3 else str(int(a)/2) if a.isdigit() and int(a) == 6 else a for a in hex_encode ])
>>>
>>> hex_encode
'73756d6d6f6e616... | Python | 0.999975 | |
8add0d44139b527d40aaa9da43d023ddde52c410 | Add string python solution | HackerRank/PYTHON/Strings/alphabet_rangoli.py | HackerRank/PYTHON/Strings/alphabet_rangoli.py | #!/usr/bin/env python3
import sys
from string import ascii_lowercase
def print_rangoli(size):
width = size * 4 - 3
alphabet = (ascii_lowercase[0:size])[::-1]
res = []
for i in range(size):
s = ''
for a in alphabet[0:i+1]:
s = '%s-%s' % (s, a)
temp = s + s[::-1][1:]
... | Python | 0.999999 | |
eac74d731b01f732d23ce21e8132fa0785aa1ab2 | Create visible_elements.py | visible_elements.py | visible_elements.py | # -*- coding: utf-8 -*-
import unittest
from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.by import By
class visible_elements(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Chrome("C://chromedriver/chromedriver.exe")
... | Python | 0.000003 | |
eaa45d8a9a8cd26379ea7bd3bcee99cbab08d9e7 | Remove hdf5 ~cxx constraint on netcdf | var/spack/repos/builtin/packages/netcdf/package.py | var/spack/repos/builtin/packages/netcdf/package.py | from spack import *
class Netcdf(Package):
"""NetCDF is a set of software libraries and self-describing, machine-independent
data formats that support the creation, access, and sharing of array-oriented
scientific data."""
homepage = "http://www.unidata.ucar.edu/software/netcdf"
url = "ftp:/... | from spack import *
class Netcdf(Package):
"""NetCDF is a set of software libraries and self-describing, machine-independent
data formats that support the creation, access, and sharing of array-oriented
scientific data."""
homepage = "http://www.unidata.ucar.edu/software/netcdf"
url = "ftp:/... | Python | 0.000001 |
5343c89686fd05cf251388e1f28bfd4343d4c277 | Add python-based CPU implementation | src/CPU/color_histogram.py | src/CPU/color_histogram.py | from PIL import Image
from collections import defaultdict
import sys
im = Image.open(sys.argv[1])
colors = defaultdict(int)
for pixel in im.getdata():
colors[pixel] += 1
print colors
| Python | 0.000074 | |
f408465521484032631adfe9dced21119ad2bf82 | Revert "Delete old MultiServer implementation" | MultiServer.py | MultiServer.py | from multiprocessing import Process
import subprocess
import GlobalVars
def botInstance(server, channels):
args = ["python", "hubbebot.py"]
args.append(server)
for chan in channels:
args.append(chan)
subprocess.call(args)
if __name__ == "__main__":
for (server,channels) in GlobalVars.con... | Python | 0 | |
2ef9618e705bb293641674ca5e7cc1f14daf3483 | Set default branding for all organisations | migrations/versions/0285_default_org_branding.py | migrations/versions/0285_default_org_branding.py | """empty message
Revision ID: 0285_default_org_branding
Revises: 0284_0283_retry
Create Date: 2016-10-25 17:37:27.660723
"""
# revision identifiers, used by Alembic.
revision = '0285_default_org_branding'
down_revision = '0284_0283_retry'
from alembic import op
import sqlalchemy as sa
BRANDING_TABLES = ('email_br... | Python | 0 | |
52b870d36370f46fdc33de2948504c2aec8db1a1 | fix field names in network object | planetstack/core/migrations/0002_network_field_case.py | planetstack/core/migrations/0002_network_field_case.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import timezones.fields
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='networktemp... | Python | 0.000003 | |
9b584c6d23ad93fd497fb2e71d2343a954cea4e5 | Create PaulFinalproject.py | PaulFinalproject.py | PaulFinalproject.py | Python | 0 | ||
8462466f8a21f25f85b8a06076877361b2545a12 | Add initialize script | PyResis/__init__.py | PyResis/__init__.py | __author__ = 'Yu Cao'
| Python | 0.000002 | |
8fcc727f9a7fbd886bc900f9c24cf2711a0c5b99 | Create Record.py | Record.py | Record.py | """
The MIT License (MIT)
Copyright (c) <2016> <Larry McCaig (aka: Larz60+ aka: Larz60p)>
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 rig... | Python | 0.000001 | |
1708eb17fb9c232414b0e162754ca31b6fd9366c | Add tests for plagiarism filter command | services/comprehension/main-api/comprehension/tests/management/commands/test_pre_filter_responses.py | services/comprehension/main-api/comprehension/tests/management/commands/test_pre_filter_responses.py | import csv
from io import StringIO
from unittest.mock import call, MagicMock, patch
from django.test import TestCase
from ....views.plagiarism import PlagiarismFeedbackView
from ....management.commands import pre_filter_responses
Command = pre_filter_responses.Command
class TestCommandBase(TestCase):
def setU... | Python | 0 | |
06ced5abe2226a234c2e2887fbf84f18dfa7ddc4 | Update timer for new label. Clean up a bit and use more pyglet 1.1 features. | examples/timer.py | examples/timer.py | '''A full-screen minute:second timer. Leave it in charge of your conference
lighting talks.
After 5 minutes, the timer goes red. This limit is easily adjustable by
hacking the source code.
Press spacebar to start, stop and reset the timer.
'''
import pyglet
window = pyglet.window.Window(fullscreen=True)
class Ti... | from pyglet import window
from pyglet import text
from pyglet import clock
from pyglet import font
w = window.Window(fullscreen=True)
class Timer(text.Label):
def stop(self):
self.__time = 0
def reset(self):
self.__time = 0
self.__running = False
self.text = '00:00'
def ani... | Python | 0 |
064c1a5bd8790c9ea407f62de0428657354e979f | Create jcolor.py | jcolor.py | jcolor.py | # colors
HEADER = '\033[95m'
FAIL = '\033[91m'
FGBLUE2 = '\033[94m'
FGGREEN2 = '\033[92m'
FGORANGE = '\033[93m'
FGGRAY = '\033[30m'
FGRED = '\033[31m'
FGGREEN = '\033[32m'
FGYELLOW = '\033[33m'
FGBLUE = '\033[34m'
FGMAG = '\033[35m'
FGCYAN = '\033[36m'
FGWHITE = '\033[37m'
# FGGRAY = '\033[61m'
BGBLACK = '\033[40m'
B... | Python | 0.000001 | |
040911e2343ec6753c767eff44be2cf54eb33ff8 | add file name to fasta sequence headers | add_file_name_to_reads.py | add_file_name_to_reads.py | import os
import sys
from Bio import SeqIO
out = open(sys.argv[2], 'w')
for records in SeqIO.parse(open(sys.argv[1], 'rU'), "fasta"):
records.id = records.id.strip() + '%s' % sys.argv[1].split('.')[0]
records.name = records.id
records.description = records.id
SeqIO.write(records, out, 'fasta')
| Python | 0 | |
c420f6bf996c53fa8958956626c136ac0e9e55f6 | Add sonos updater plugin. | beetsplug/sonosupdate.py | beetsplug/sonosupdate.py | # -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2018, Tobias Sauerwein.
#
# 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... | Python | 0 | |
797114781ed4f31c265c58a76e39aa8ff6a16443 | Add missing file from last commit | tensorpack/utils/compatible_serialize.py | tensorpack/utils/compatible_serialize.py | #!/usr/bin/env python
import os
from .serialize import loads_msgpack, loads_pyarrow, dumps_msgpack, dumps_pyarrow
"""
Serialization that has compatibility guarantee (therefore is safe to store to disk).
"""
__all__ = ['loads', 'dumps']
# pyarrow has no compatibility guarantee
# use msgpack for persistent serializa... | Python | 0.000001 | |
2f155e1dafd5302dfbf4607af81bfa979046be8e | add test file | junk/t.py | junk/t.py | def f():
print "hi"
f() | Python | 0.000001 | |
cfb39d7389d63a293dc075d420f80276a34df193 | Add minimal pygstc example to play a video | examples/pygstc/simple_pipeline.py | examples/pygstc/simple_pipeline.py | import time
import sys
from pygstc.gstc import *
from pygstc.logger import *
#Create a custom logger with loglevel=DEBUG
gstd_logger = CustomLogger('simple_pipeline', loglevel='DEBUG')
#Create the client with the logger
gstd_client = GstdClient(logger=gstd_logger)
def printError():
print("To play run: python3 si... | Python | 0 | |
f8d06f85e896c1098f58667c161d920f6d255d7b | Add utility for sent mail | sendmail/log_mail.py | sendmail/log_mail.py | # -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License a... | Python | 0 | |
ddac657da2743c7435e8408677406d37eaea5836 | Add migration. | instance/migrations/0041_auto_20160420_1409.py | instance/migrations/0041_auto_20160420_1409.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('instance', '0040_auto_20160420_0754'),
]
operations = [
migrations.AlterField(
model_name='openstackserver',
... | Python | 0 | |
4c6964a6043c6c5bb3df7ad184e2c6a5537ca6da | Create __init__.py | intelmq/tests/bots/experts/fqdn2ip/__init__.py | intelmq/tests/bots/experts/fqdn2ip/__init__.py | Python | 0.000429 | ||
ce5ca3ac3268af331150f66865072a049869b3b2 | add abstraction magics | abstraction.py | abstraction.py | """
abstraction magics
let's you turn a cell into a function
In [1]: plot(x, f(y))
...: xlabel('x')
...: ylabel('y')
In [2]: %functionize 1
"""
from IPython.utils.text import indent
def parse_ranges(s):
blocks = s.split(',')
ranges = []
for block in blocks:
if '-' in block:
sta... | Python | 0.000088 | |
9af5c4e79234a47ac26e5d1890e70f741363b18a | Create factorise_test.py | factorise_test.py | factorise_test.py | Python | 0.000001 | ||
425a8e26d371038f6ebf7c80dd7faea0f1dd906e | Add base test for admin endpoints [WAL-883] | nodeconductor/core/tests/unittests/test_admin.py | nodeconductor/core/tests/unittests/test_admin.py | from django.contrib import admin
from django.contrib.auth import get_user_model
from django.test import TestCase
from django.urls import reverse
User = get_user_model()
class TestAdminEndpoints(TestCase):
def setUp(self):
user, _ = User.objects.get_or_create(username='username', is_staff=True)
... | Python | 0 | |
90a30ae1b3165c03f6de5458c92f8ecb9d3f948a | Add homework min_three | domaci-zadaci/05/test_min_three.py | domaci-zadaci/05/test_min_three.py | from solutions import min_three
import unittest
import random
class TestMinThree(unittest.TestCase):
def test_1000_cases(self):
for _ in range(1000):
first = (random.random() - 0.5) * 2000
second = (random.random() - 0.5) * 2000
third = (random.random() - 0.5) * 2000
... | Python | 0.00046 | |
aad51679cc2e4e719ed12e3983b54dcf15a2c06f | Update slack.py | graphite_beacon/handlers/slack.py | graphite_beacon/handlers/slack.py | import json
from tornado import gen, httpclient as hc
from graphite_beacon.handlers import AbstractHandler, LOGGER
from graphite_beacon.template import TEMPLATES
class SlackHandler(AbstractHandler):
name = 'slack'
# Default options
defaults = {
'webhook': None,
'channel': None,
... | import json
from tornado import gen, httpclient as hc
from graphite_beacon.handlers import AbstractHandler, LOGGER
from graphite_beacon.template import TEMPLATES
class SlackHandler(AbstractHandler):
name = 'slack'
# Default options
defaults = {
'webhook': None,
'channel': None,
... | Python | 0 |
34908071bd11470806a84d9f76c630fd3fcc2d4b | test file :-) | tests/gsim/abrahamson_silva_2008_test.py | tests/gsim/abrahamson_silva_2008_test.py | # nhlib: A New Hazard Library
# Copyright (C) 2012 GEM Foundation
#
# 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 versio... | Python | 0 | |
9fc373bbfa606aeb23c237df9c8d9143e14b60a1 | structure of preprocessing module for lea to fill in | code/python/seizures/preprocessing/preprocessing.py | code/python/seizures/preprocessing/preprocessing.py | import scipy.signal
def preprocess_multichannel_data(matrix):
n_channel,m= matrix.shape
for i in range(n_channel):
preprocess_single_channel(matrix[i,:])
def preprocess_single_channel(x):
x = remove_elec_noise(x)
x = hp_filter(x)
x = remove_dc(x)
return x
def remove_dc():
"""
... | Python | 0 | |
3e7429a36532e7c731d5d254b853dd72bdd94c82 | Create test.py | home/crap0101/test/500fup/test.py | home/crap0101/test/500fup/test.py | import operator
import re
import sys
import time
import urlparse
import fhp.api.five_hundred_px as _fh
import fhp.helpers.authentication as _a
from fhp.models.user import User
_TREG = re.compile('^(\d+)-(\d+)-(\d+).*?(\d+):(\d+):(\d+).*')
_URL = 'http://500px.com/'
_HTML_BEGIN = '''<!DOCTYPE HTML PUBLIC "-//W3C//DTD H... | Python | 0 | |
42c82bc865d69b904ec688aa152caf3a247df1c6 | Create frontdoor.py | home/pi/PirFrontDoor/frontdoor.py | home/pi/PirFrontDoor/frontdoor.py | #!/usr/bin/python
import RPi.GPIO as GPIO
import time
import requests
GPIO.setmode(GPIO.BCM)
PIR_PIN = 22
GPIO.setup(PIR_PIN, GPIO.IN)
def MOTION(PIR_PIN):
print "Motion Detected!"
payload = { 'value1' : 'Someone at Front Door'}
r = requests.post("https://maker.ifttt.com/trigger/{Event}/wit... | Python | 0.000024 | |
1d7451fd6eca8a68832b676ef0a696e8de801533 | Update services_and_index_sync.py | tendrl/node_agent/node_sync/services_and_index_sync.py | tendrl/node_agent/node_sync/services_and_index_sync.py | import json
import etcd
from tendrl.commons.event import Event
from tendrl.commons.message import ExceptionMessage
from tendrl.commons.message import Message
from tendrl.commons.utils import etcd_utils
# TODO(darshan) this has to be moved to Definition file
TENDRL_SERVICES = [
"tendrl-node-agent",
"etcd",
... | import json
import etcd
from tendrl.commons.event import Event
from tendrl.commons.message import ExceptionMessage
from tendrl.commons.message import Message
from tendrl.commons.utils import etcd_utils
# TODO(darshan) this has to be moved to Definition file
TENDRL_SERVICES = [
"tendrl-node-agent",
"etcd",
... | Python | 0.000001 |
bcb89187a398000d80c7c0b0ac5152e76edd2666 | Remove TRT 4.0 restrictions on int32 test. | tensorflow/python/compiler/tensorrt/test/int32_test.py | tensorflow/python/compiler/tensorrt/test/int32_test.py | # Copyright 2018 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... | # Copyright 2018 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 |
f94f1f698c8e9473b7c96ec7b1244e84fc4ebe5d | update unittest for MonoMixer | test/src/unittest/standard/test_monomixer_streaming.py | test/src/unittest/standard/test_monomixer_streaming.py | #!/usr/bin/env python
# Copyright (C) 2006-2013 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Essentia
#
# Essentia 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 (FSF), e... | #!/usr/bin/env python
# Copyright (C) 2006-2013 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Essentia
#
# Essentia 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 (FSF), e... | Python | 0 |
1307070cfe27ca605bfcc279644b735ee941f627 | Add work for ex21.py. | lpthw/ex31.py | lpthw/ex31.py | print "You enter a dark room with two doors. Do you go through door #1 or #2?"
door = raw_input("> ")
if door == "1":
print "Ther's a giant bear here eating a cheese cake. What do you do?"
print "1. Take the cake."
print "2. Scream at the bear."
bear = raw_input("> ")
if bear == "1":
pri... | Python | 0 | |
d3c6c91bc4b6214053b9a1d1d2291a402c164b86 | add file | GridPixelPlot.py | GridPixelPlot.py | import kplr
import numpy as np
import matplotlib.pyplot as plt
qua = 5
client = kplr.API()
# Find the target KOI.
koi = client.koi(282.02)
originStar = koi.star
# Find potential targets by Kepler magnitude
koisOver = client.kois(where="koi_kepmag between %f and %f"%(originStar.kic_kepmag, originStar.kic_kepmag+0.1... | Python | 0.000001 | |
8515155d9d0df940eea758121124995320fce6bb | add experimental C/clang plugin | languages/c.py | languages/c.py | import os
from lint.linter import Linter
from lint.util import find
class C(Linter):
language = 'c'
cmd = ('clang', '-xc', '-fsyntax-only', '-std=c99', '-Werror',
'-pedantic')
regex = (
r'^<stdin>:(?P<line>\d+):(?P<col>\d+):'
r'(?:(?P<ranges>[{}0-9:\-]+):)?\s+'
r'(?P<error>... | Python | 0 | |
0026beea95ec26b8763feae270e79872f86de8a5 | Add run_sample_tests for executing sample tests in Travis | stress_test/sample_test_confs/run_sample_tests.py | stress_test/sample_test_confs/run_sample_tests.py | #! /usr/bin/env python3.4
# Copyright (c) 2015 Intracom S.A. Telecom Solutions. All rights reserved.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v1.0 which accompanies this distribution,
# and is available at http://www.eclipse.org/legal/epl-v10.ht... | Python | 0 | |
352b17d8139fb0d269e4c17c01fe8ee488961c3a | Create HR_miniMaxSum.py | HR_miniMaxSum.py | HR_miniMaxSum.py | #!/bin/python3
import math
import os
import random
import re
import sys
# Complete the miniMaxSum function below.
def miniMaxSum(arr):
maxx = max(arr)
minn = min(arr)
mini = arr.copy()
mini.remove(maxx)
maxi = arr.copy()
maxi.remove(minn)
sum_min = sum(mini)
sum_max = sum(ma... | Python | 0.000003 | |
b8fe92674773c7470c3b47899a8832bbb94771b4 | Add path module | lib/oelite/path.py | lib/oelite/path.py | import os
TOPDIR = os.getcwd()
def init(topdir):
global TOPDIR
TOPDIR = topdir
def relpath(path):
"""Return a relative version of paths compared to TOPDIR."""
global TOPDIR
if path.startswith(TOPDIR):
return path[len(TOPDIR):].lstrip("/")
return path
def which(path, filename, path... | Python | 0 | |
8ce2da2ed2e445480ee2e10483a5fae1c7c677a0 | Include self contained method for output to a view | lib/output_view.py | lib/output_view.py | import sublime
import sublime_plugin
###-----------------------------------------------------------------------------
def output_to_view(window,
title,
content,
reuse=True,
syntax=None,
clear=True,
settin... | Python | 0 | |
0d35b502515a9775166e775c3462ca9300fe4517 | add examples | examples/helpers.py | examples/helpers.py | # -*- coding: utf-8 -*-
#
from dolfin import as_backend_type
import matplotlib.pyplot as plt
import scipy.linalg
def show_matrix(A):
A = as_backend_type(A)
A_matrix = A.sparray()
# colormap
cmap = plt.cm.gray_r
A_dense = A_matrix.todense()
# A_r = A_dense[0::2][0::2]
# A_i = A_dense[1::2]... | Python | 0 | |
e333bc7b23a69a39392899a1d1c8e0bdf3523c3f | remove unused import [ci skip] | corehq/apps/app_manager/management/commands/build_apps.py | corehq/apps/app_manager/management/commands/build_apps.py | import contextlib
import json
from django.core.management.base import BaseCommand
from lxml import etree
import os
from corehq.apps.app_manager.models import Application, RemoteApp
_parser = etree.XMLParser(remove_blank_text=True)
def normalize_xml(xml):
xml = etree.fromstring(xml, parser=_parser)
return etree... | import contextlib
from functools import wraps
import json
from django.core.management.base import BaseCommand
from lxml import etree
import os
from corehq.apps.app_manager.models import Application, RemoteApp
_parser = etree.XMLParser(remove_blank_text=True)
def normalize_xml(xml):
xml = etree.fromstring(xml, pars... | Python | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.