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 |
|---|---|---|---|---|---|---|---|
98b85a9fd8d5082e40996dfba0359b0ec32a9267 | Add solution for "Cakes" kata https://www.codewars.com/kata/525c65e51bf619685c000059 | codewars/cakes.py | codewars/cakes.py | # Cakes
# https://www.codewars.com/kata/525c65e51bf619685c000059
import math
import unittest
from typing import Dict
def cakes_1(recipe, available):
# type: (Dict[str, int], Dict[str, int]) -> int
lowest_available = math.inf
for i, a in recipe.items():
if i in available.keys():
av = ... | Python | 0.000191 | |
5b97e6fc0446912d5b9b8da65e60d06165ed1b8b | Add profile tests | budgetsupervisor/users/tests/test_models.py | budgetsupervisor/users/tests/test_models.py | from users.models import Profile
def test_profile_is_created_when_user_is_created(user_foo):
assert len(Profile.objects.all()) == 1
assert hasattr(user_foo, "profile")
def test_profile_is_not_created_when_user_is_updated(user_foo):
assert len(Profile.objects.all()) == 1
user_foo.username = "abc"
... | Python | 0.000001 | |
275adbea5477bbc6938e59edab23e1df182435ea | Create split-array-with-equal-sum.py | Python/split-array-with-equal-sum.py | Python/split-array-with-equal-sum.py | # Time: O(n^2)
# Space: O(n)
class Solution(object):
def splitArray(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""
if len(nums) < 7:
return False
accumulated_sum = [0] * len(nums)
accumulated_sum[0] = nums[0]
for i in xr... | Python | 0.009008 | |
5e427315f46c026dd3b72b49349d3dcdbf04d138 | add financial_insights | financial_insights.py | financial_insights.py | '''
Created on Apr, 2017
@author: hugo
'''
import numpy as np
def calc_ranks(x):
"""Given a list of items, return a list(in ndarray type) of ranks.
"""
n = len(x)
index = list(zip(*sorted(list(enumerate(x)), key=lambda d:d[1], reverse=True))[0])
rank = np.zeros(n)
rank[index] = range(1, n + ... | Python | 0.000242 | |
6c133d4de6a79eab6bfc2da9ff9a0045e0a0994d | add problem hanckerrank 009 | hackerrank/009_sherlock_and_the_beast.py | hackerrank/009_sherlock_and_the_beast.py | #!/bin/python3
"""
https://www.hackerrank.com/challenges/sherlock-and-the-beast?h_r=next-challenge&h_v=zen
Sherlock Holmes suspects his archenemy, Professor Moriarty, is once again plotting something diabolical. Sherlock's companion, Dr. Watson, suggests Moriarty may be responsible for MI6's recent issues with t... | Python | 0.999803 | |
ef1fa03d753f5d8a0b32831320a1b3e076ace363 | Add a test runner for our jqplot demo too | moksha/apps/demo/MokshaJQPlotDemo/run_tests.py | moksha/apps/demo/MokshaJQPlotDemo/run_tests.py | #!/usr/bin/env python
"""
nose runner script.
"""
__requires__ = 'moksha'
import pkg_resources
import nose
if __name__ == '__main__':
nose.main()
| Python | 0 | |
bd87286dccc22c6e7ac1470882550c2515df4882 | Add support for eve-central | modules/evecentral.py | modules/evecentral.py | from core.Uusipuu import UusipuuModule
from twisted.internet import defer
from twisted.internet.defer import inlineCallbacks
from twisted.web import client
from xml.dom import minidom
import locale
class Module(UusipuuModule):
def startup(self):
self.db_open('evedb', 'data/db/evedb.sqlite')
def shutd... | Python | 0 | |
3623b058670f19dc7a6aa3372a04b61bc96a8678 | Create SenderNode.py | examples/SenderNode.py | examples/SenderNode.py | '''
This is the Sender Node.
It sends the start spike train and then simply receives and sends spikes using Brian NeuronGroups. At the end of
the simulation the data collected is plotted.
'''
from brian import *
import argparse
from brian_multiprocess_udp import BrianConnectUDP
def main_NeuronGroup(input_Neuron... | Python | 0 | |
b261704bc0ada9cfae773eaf1e40b18dc49d6ceb | add outline of backgrond job processor and task interface | portality/background.py | portality/background.py | from portality import models
from portality.core import app
class BackgroundApi(object):
@classmethod
def execute(self, background_task):
job = background_task.background_job
ctx = None
if job.user is not None:
ctx = app.test_request_context("/")
ctx.push()
... | Python | 0 | |
c8ec0689950a5fea0aff98afe54b172bd84e2ce9 | Add example using Tom's registration code in scipy. | examples/coregister.py | examples/coregister.py | """Example using Tom's registration code from scipy.
"""
from os import path
from glob import glob
import scipy.ndimage._registration as reg
# Data files
basedir = '/Users/cburns/data/twaite'
anatfile = path.join(basedir, 'ANAT1_V0001.img')
funcdir = path.join(basedir, 'fMRIData')
fileglob = path.join(funcdir, 'FUN... | Python | 0 | |
114f8012a7faec4fe107c1d68c2ead10cdd88fbe | update zero.1flow.io settings for sparks 2.x. | oneflow/settings/zero_1flow_io.py | oneflow/settings/zero_1flow_io.py | # -*- coding: utf-8 -*-
# Settings for zero.1flow.io, a master clone used to validate migrations.
from sparks.django.settings import include_snippets
include_snippets(
(
'000_nobother',
'00_production',
'1flow_io',
'common',
'db_common',
'db_production',
'ca... | # -*- coding: utf-8 -*-
# Settings for zero.1flow.io, a master clone used to validate migrations.
import os
from sparks.django.settings import include_snippets
include_snippets(
os.path.dirname(__file__), (
'000_nobother',
'00_production',
'1flow_io',
'common',
'db_common',... | Python | 0 |
db60219a1446bb75dd98bfbb12ee6ec4eda6d6bb | add structure for the pcaptotal API | web/api.py | web/api.py | from flask import jsonify, abort, make_response
from flask.ext.httpauth import HTTPBasicAuth
auth = HTTPBasicAuth()
from app import app
tasks = [
{
'id': 1,
'title': u'Buy groceries',
'description': u'Milk, Cheese, Pizza, Fruit, Tylenol',
'done': False
},
{
'id': 2,
... | Python | 0 | |
2a386106dfaa90fc09ab5478711d203249c79691 | Add script scripts/make_package.py to generate a file with extension brython.js that can be included in a page and add importable modules. | scripts/make_package.py | scripts/make_package.py | import json
import os
import re
import ast
import python_minifier
class Visitor(ast.NodeVisitor):
"""Used to list all the modules imported by a script."""
def __init__(self, lib_path, package):
self.imports = set()
self.lib_path = lib_path
self.package = package
def visit_Import(... | Python | 0 | |
62b01c3c1614d5719cc69be951b2f6c660e40faa | Add generic function for iterating arrays. | pyldap/libldap/tools.py | pyldap/libldap/tools.py | def iterate_array(arr, f=None):
i = 0
while True:
if not arr[i]:
break
yield arr[i] if f is None else f(arr[i])
i += 1 | Python | 0 | |
d8cd42940df8c1d2fc9ae28e9c5caa21995ca68c | Add word-counter.py | python3/word-counter.py | python3/word-counter.py | #!/usr/bin/env python3
from collections import Counter
import argparse
import re
from itertools import islice
import operator
parser = argparse.ArgumentParser()
parser.add_argument('--numWords',type=int,default=10)
parser.add_argument('--maxTuples',type=int,default=4)
parser.add_argument('--minWordLength',type=int,de... | Python | 0.002063 | |
377a8be7c0b1e77f0e9c2dfd55f603e199727907 | make pairs | files/v8/make_pairs.py | files/v8/make_pairs.py | import fileinput
pops=[]
for line in fileinput.input():
pops.append(line[:-1])
for i in range(len(pops)-1):
for j in range(i+1, len(pops)):
print pops[i]+","+pops[j]
| Python | 0.999365 | |
9c0ddb1c4fff5fb3f44ad77192a7f435bc7a22fe | Create AdafruitMotorHat4Pi.py | service/AdafruitMotorHat4Pi.py | service/AdafruitMotorHat4Pi.py | # Start the services needed
raspi = Runtime.start("raspi","RasPi")
hat = Runtime.start("hat","AdafruitMotorHat4Pi")
m1 = Runtime.start("m1","MotorHat4Pi")
# Attach the HAT to i2c bus 1 and address 0x60
hat.attach("raspi","1","0x60")
# Use the M1 motor port and attach the motor to the hat
m1.setMotor("M1")
m1.attach("ha... | Python | 0 | |
b376b0dca7ec73451ff36ebae1718fa11ec159f0 | Add utils.py for general purpose functions | manyfaced/common/utils.py | manyfaced/common/utils.py | import time
import pickle
from socket import error as socket_error
from common.status import CLIENT_TIMEOUT
def dump_file(data):
try:
with file('temp.db') as f:
string_file = f.read()
db = pickle.loads(string_file)
except:
db = list()
db.append(data)
with open('tem... | Python | 0.000003 | |
a3cbfeca2828ac3d210921524d850091dc775db7 | Revert "Revert "New VMware Module to support configuring a VMware vmkernel IP…" | lib/ansible/modules/extras/cloud/vmware/vmware_vmkernel_ip_config.py | lib/ansible/modules/extras/cloud/vmware/vmware_vmkernel_ip_config.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Joseph Callen <jcallen () csc.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Li... | Python | 0 | |
b9759f60c9f107c3d2c319f53ed2985ee58dc319 | Write test for mock_pose generator. | src/tests/test_mock_pose.py | src/tests/test_mock_pose.py | try:
from unittest.mock import patch, MagicMock
except ImportError:
from mock import patch, MagicMock
import pytest
import rospy
MockTf2 = MagicMock()
modules = {"tf2_ros": MockTf2}
patcher = patch.dict("sys.modules", modules)
patcher.start()
try:
rospy.init_node("pytest", anonymous=True)
except rospy.... | Python | 0 | |
1ce12ab6eb2a3b5578eba253929275bb3b394b76 | Create line_follow.py | line_follow.py | line_follow.py | from Myro import *
init("/dev/tty.scribbler")
# To stop the Scribbler, wave your hand/something in front of the fluke
while getObstacle('center') < 6300:
# Get the reading from the line sensors on the bottom of Scribbler
left, right = getLine()
# If both left and right sensors are on track
if left... | Python | 0.000005 | |
5fa39bb65f88fa3596cc3831890cd258cc5768e1 | Add the module file | lantz/drivers/ni/__init__.py | lantz/drivers/ni/__init__.py | # -*- coding: utf-8 -*-
"""
lantz.drivers.ni
~~~~~~~~~~~~~~~~
:company: National Instruments
:description:
:website: http://www.ni.com/
----
:copyright: 2012 by Lantz Authors, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from .daqe import NI6052E
... | Python | 0.000002 | |
b3dcbe95d766d902d22a0c4c171cbbe5ce207571 | Add test for longitivity-testing: both LED-s ON at the same time for extended periods of time | python/tests/stress_test.py | python/tests/stress_test.py | #!/usr/bin/env python
import time
import sys
import os
from random import randint
# Hack to import from a parent dir
# http://stackoverflow.com/a/11158224/401554
parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, parentdir)
from octo import Octo
octo = Octo('/dev/ttyACM0')
oct... | Python | 0.000001 | |
772d05f25f3ba6ffe1ea4341401df90803b63715 | add generic payload executor | pilot/control/payloads/generic.py | pilot/control/payloads/generic.py | #!/usr/bin/env python
# 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
#
# Authors:
# - Mario Lassnig, mario.lassnig@cern.ch, 2016-2017
# - Daniel Dr... | Python | 0.000006 | |
d2a9f0cfd34f6a58c647d32b9a32fc517a210fd5 | Create tests for ChartBasedAnnotationsAccumulator | projects/DensePose/tests/test_chart_based_annotations_accumulator.py | projects/DensePose/tests/test_chart_based_annotations_accumulator.py | # Copyright (c) Facebook, Inc. and its affiliates.
import unittest
import torch
from detectron2.structures import Boxes, BoxMode, Instances
from densepose.modeling.losses.utils import ChartBasedAnnotationsAccumulator
from densepose.structures import DensePoseDataRelative, DensePoseList
image_shape = (100, 100)
inst... | Python | 0 | |
ddfbdb9f5eea0cac448add25c61c5de3bb583a4d | Add the "github_add_upstream" script | github_add_upstream.py | github_add_upstream.py | #!/usr/bin/env python
"""
Add the GitHub "parent" repository to the current local repostory as the
"upstream" remote.
The "parent" GitHub repository is the repository from which the GitHub repo has
been forked from.
E.g. if your local repository contains this:
# Output from `git remote -v`
origin g... | Python | 0.000073 | |
9bc154d662464a0073b8b7cd3bcf39312a4ac1d7 | add ifttt notification | ifttt_notification.py | ifttt_notification.py | import requests
def Air_alert():
report = {}
report["value1"] = "test"
report["value2"] = "second"
report["value3"] = "third"
requests.post(
"https://maker.ifttt.com/trigger/Air_Test/with/key/{user_key}".format(user_key=""), data=report)
if __name__ == "__main__":
Air_alert()
| Python | 0 | |
407c08899eccea60a2ae534ab0c1b000c58708ab | Implement some tests for AgentAPI | tests/test_agent_api.py | tests/test_agent_api.py | # No shebang line, this module is meant to be imported
#
# Copyright 2013 Oliver Palmer
# Copyright 2013 Ambient Entertainment GmbH & Co. KG
#
# 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
#
... | Python | 0.000002 | |
369676cfacd35c7b3321edaef97bf64f063e7d50 | Add nephrectomy model | radar/radar/models/nephrectomy.py | radar/radar/models/nephrectomy.py | from sqlalchemy import Column, Integer, ForeignKey, Date, Index
from sqlalchemy.orm import relationship
from radar.database import db
from radar.models.common import MetaModelMixin, IntegerLookupTable
NEPHRECTOMY_SIDES = OrderedDict([
('LEFT', 'Left'),
('RIGHT', 'Right'),
('BILATERAL', 'Bilateral'),
])
N... | Python | 0.000007 | |
0378a225c5519ad39fee6a132c455e1848151a44 | Create run_test.py | recipes/django-braces/run_test.py | recipes/django-braces/run_test.py | import django
from django.conf import settings
settings.configure(INSTALLED_APPS=['braces', 'django.contrib.contenttypes', 'django.contrib.auth'])
django.setup()
import braces
| Python | 0.000004 | |
7e9c90c179df8666a75eef1610dbda764add1408 | Create elec_temp_join.py | elec_temp_join.py | elec_temp_join.py | import numpy as np
import pandas as pd
import geopandas as gpd
from geopandas import tools
utility = '/home/akagi/Desktop/electricity_data/Electric_Retail_Service_Ter.shp'
util = gpd.read_file(utility)
urbarea = '/home/akagi/GIS/census/cb_2013_us_ua10_500k/cb_2013_us_ua10_500k.shp'
ua = gpd.read_file(urbarea)
ua = ... | Python | 0.000001 | |
e9135583af7a862bd426b4a068743765c4604da3 | add test for dials.convert_to_cbf (only works on dls computers) | test/command_line/test_convert_to_cbf.py | test/command_line/test_convert_to_cbf.py | from __future__ import absolute_import, division, print_function
import glob
import os
import pytest
import procrunner
pytestmark = pytest.mark.skipif(
not os.access("/dls/i04/data/2019/cm23004-1/20190109/Eiger", os.R_OK),
reason="Test images not available",
)
@pytest.mark.parametrize(
"master_h5",
... | Python | 0 | |
03e9a75d69538649df3e05d40a1c8e7d870fd807 | Add gaussian_elimination.py for solving linear systems (#1448) | arithmetic_analysis/gaussian_elimination.py | arithmetic_analysis/gaussian_elimination.py | """
Gaussian elimination method for solving a system of linear equations.
Gaussian elimination - https://en.wikipedia.org/wiki/Gaussian_elimination
"""
import numpy as np
def retroactive_resolution(coefficients: np.matrix, vector: np.array) -> np.array:
"""
This function performs a retroactive linear system... | Python | 0.000001 | |
12731a74be889eff48e0e505de666ef3180794fe | add missing file | rmake/plugins/plugin.py | rmake/plugins/plugin.py | #
# Copyright (c) 2006 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.opensource.org/licen... | Python | 0.000003 | |
3e0e898d0d3ab494edc5dbc65ccde4020f427be8 | Create quiz-eliecer.py | laboratorios/quiz-eliecer.py | laboratorios/quiz-eliecer.py |
base=5
altura=7
perimetro=2*5+2*7
print ("mi perimetro es" + str(perimetro))
area=5*7
print ("mi area es" + str (area))
metrop=perimetro/100
print ("mi perimetro en metro es" + str(metrop))
pulgadap=perimetro/2.54
print ("mi perimetro en pulgada es" + str(pulgadap))
metroa=area/100
print ("mi area en metro es" +... | Python | 0.000001 | |
ee554d89d1c822537345ce4d03d2bff8783d7f1b | Disable nacl_integration due to #261724. | chrome/test/nacl_test_injection/buildbot_nacl_integration.py | chrome/test/nacl_test_injection/buildbot_nacl_integration.py | #!/usr/bin/env python
# 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.
import os
import subprocess
import sys
def Main(args):
if sys.platform == 'darwin':
print >> sys.stderr, "SKIPPING NACL INT... | #!/usr/bin/env python
# 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.
import os
import subprocess
import sys
def Main(args):
pwd = os.environ.get('PWD', '')
is_integration_bot = 'nacl-chrome' in ... | Python | 0.000002 |
33448340d278da7e0653701d78cbab317893279d | Add a simple analysis tool to get some structural properties about an AG's specfile. | AG/datasets/analyze.py | AG/datasets/analyze.py | #!/usr/bin/python
import os
import sys
import lxml
from lxml import etree
import math
class StatsCounter(object):
prefixes = {}
cur_tag = None
def start( self, tag, attrib ):
self.cur_tag = tag
def end( self, tag ):
pass
#self.cur_tag = None
def data( self, _data ):
... | Python | 0 | |
684779d818f27aa28d6068fa7998e65807fe7ac6 | add a class that will group images on a file system by day, month or year | photomanip/grouper.py | photomanip/grouper.py | from collections import defaultdict, OrderedDict
from datetime import datetime
from pathlib import Path
from photomanip import PAD, CROP
from photomanip.metadata import ImageExif
DATETIME_FMT = "%Y:%m:%d %H:%M:%S"
DAILY_DATETIME_FMT = "%Y%m%d"
MONTHLY_DATETIME_FMT = "%Y%m"
YEARLY_DATETIME_FMT = "%Y"
class Grouper:
... | Python | 0.000001 | |
cc8e38b46ee79b08c76b31d173301549722693b9 | add examples of deployment object | examples/deployment_examples.py | examples/deployment_examples.py | # Copyright 2016 The Kubernetes 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 law or agreed to ... | Python | 0 | |
16165a9387807d54b91873e95a677bfe5d251aba | Add healthcheck module to contrib | kitnirc/contrib/healthcheck.py | kitnirc/contrib/healthcheck.py | import logging
import sys
import threading
import time
from kitnirc.modular import Module
_log = logging.getLogger(__name__)
class HealthcheckModule(Module):
"""A KitnIRC module which checks connection health.
By default, this module will request a PONG response from the server
if it hasn't seen any t... | Python | 0 | |
a533cf1eeea7f0126df86b84f54208154685ab32 | Implement color brightness and contrast ratio calculations in preparation for improving label handling of text colors | kivymd/theming_dynamic_text.py | kivymd/theming_dynamic_text.py | # -*- coding: utf-8 -*-
# Two implementations. The first is based on color brightness obtained from:-
# https://www.w3.org/TR/AERT#color-contrast
# The second is based on relative luminance calculation for sRGB obtained from:-
# https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
# and contrast ratio c... | Python | 0 | |
cad7db237c68139d3f4f7dd691205b207edb0b79 | Refactor plugin api code into its own module | confluent/pluginapi.py | confluent/pluginapi.py | # concept here that mapping from the resource tree and arguments go to
# specific python class signatures. The intent is to require
# plugin authors to come here if they *really* think they need new 'commands'
# and hopefully curtail deviation by each plugin author
# have to specify a standard place for cfg selection... | Python | 0 | |
2cef2ff2eb9c415f374de0a2f8a7174fddca8836 | add missing session.py file | lib/exabgp/configuration/bgp/session.py | lib/exabgp/configuration/bgp/session.py | # encoding: utf-8
"""
session.py
Created by Thomas Mangin on 2014-06-22.
Copyright (c) 2014-2014 Exa Networks. All rights reserved.
"""
from exabgp.configuration.engine.registry import Raised
from exabgp.configuration.engine.section import Section
from exabgp.configuration.engine.parser import asn
from exabgp.configu... | Python | 0.000001 | |
5c8caad82cd43044152171973e2386d655a1fa3a | Add tests for the way "between" works if no limits are set up | tests/test_recurrences_without_limits.py | tests/test_recurrences_without_limits.py | from datetime import datetime
from recurrence import Recurrence, Rule
import recurrence
RULE = Rule(
recurrence.DAILY
)
PATTERN = Recurrence(
rrules=[RULE]
)
def test_between_without_dtend_and_dtstart():
occurrences = [
instance for instance in
PATTERN.between(
datetime(2014... | Python | 0.000004 | |
ad7cdd6bdd0e364b1c270d26e102e791b6ea1f4b | Add tests for new dimensionality finder | pymatgen/analysis/tests/test_dimensionality.py | pymatgen/analysis/tests/test_dimensionality.py |
from pymatgen.core.structure import Structure
from pymatgen.analysis.local_env import CrystalNN
from pymatgen.analysis.dimensionality import (
get_dimensionality_gorai, get_dimensionality_cheon,
get_dimensionality_larsen, calculate_dimensionality_of_site,
get_structure_component_info)
from pymatgen.util.te... | Python | 0 | |
a9ca7f2f22551256213ecd32047022048c72db5c | Add Python 3 Script for Converting Image Types | scripts/convert_svgs.py | scripts/convert_svgs.py | import cairosvg
import os
# MUST RUN IN PYTHON 3 and pip install cairosvg
file_dir = '../data/hough_test/Test_Set_1/'
svgs = os.listdir(os.path.join(file_dir, 'SVGs'))
for svg in svgs:
name = svg.split('.svg')[0]
cairosvg.svg2png(url=os.path.join(file_dir, 'SVGs', svg),
write_to=os.path... | Python | 0 | |
392be3310efc812686c0d43f7ca884d9c730a879 | Add stop-by-time script to end simulation after a specified amount of simulated time | scripts/stop-by-time.py | scripts/stop-by-time.py | # End ROI after x nanoseconds
# Usage: -s stop-by-time:1000000 # End after 1 ms of simulated time
import sim
class StopByTime:
def setup(self, args):
args = dict(enumerate((args or '').split(':')))
self.time = long(args.get(0, 1e6))
self.done = False
sim.util.Every(self.time * sim.ut... | Python | 0 | |
df7155dad442d079d792b69206a9760f980454fd | Add tests for prob.continuous | metabench/tests/test_prob_continuous.py | metabench/tests/test_prob_continuous.py | import pytest
import metabench as mb
def _perform_continuous_problem_test(cp):
s = cp.generate_solution()
cp.evaluate(s)
for n, m in cp.get_neighbors(s, 0.5):
cp.evaluate(n, m)
def test_ackleys():
cp = mb.prob.Ackleys(10)
_perform_continuous_problem_test(cp)
def test_bukin6():
cp ... | Python | 0.000004 | |
d195d67fe3e9c3e12bb978bfaa98276e8f9f7140 | allow loading ctx from expression | script_runner/ctx_server.py | script_runner/ctx_server.py | #########
# Copyright (c) 2014 GigaSpaces Technologies Ltd. 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... | #########
# Copyright (c) 2014 GigaSpaces Technologies Ltd. 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... | Python | 0 |
30a0b17d028f279a9877150ac4eb60b1ce135fa2 | Add check script for MultiplyHueAndSaturation | checks/check_multiply_hue_and_saturation.py | checks/check_multiply_hue_and_saturation.py | from __future__ import print_function, division
import numpy as np
import imgaug as ia
from imgaug import augmenters as iaa
def main():
image = ia.quokka_square((128, 128))
images_aug = []
for mul in np.linspace(0.0, 2.0, 10):
aug = iaa.MultiplyHueAndSaturation(mul)
image_aug = aug.augm... | Python | 0 | |
45ec6d5451062c8e3310332c0246eebb231233ef | Add script | scripts/migrate_duplicate_external_accounts.py | scripts/migrate_duplicate_external_accounts.py | from __future__ import absolute_import
import logging
import sys
from dropbox.rest import ErrorResponse
from dropbox.client import DropboxClient
from framework.mongo import database as db
from framework.transactions.context import TokuTransaction
from website.app import init_app
from website.addons.github.api import... | Python | 0.000002 | |
fb18da6685948de4e66c310af8b850739034c1e9 | Add move.py | move.py | move.py | import Tkinter as tk
import os
class Application(tk.Frame):
""" The Application class manages the GUI.
The create_widgets() method creates the widgets to be inserted in the frame.
A button triggers an event that calls the perform_move() method.
This function calls the recursive method move_directories(). """
de... | Python | 0.000003 | |
769036ffd7a21477a9133c58b352711d85c7a7a0 | add regression test for monkey patching of Queue | test/test_queue_monkeypatch.py | test/test_queue_monkeypatch.py | from __future__ import absolute_import
import unittest
import urllib3
from urllib3.exceptions import EmptyPoolError
import Queue
class BadError(Exception):
"""
This should not be raised.
"""
pass
Queue.Empty = BadError
class TestConnectionPool(unittest.TestCase):
"""
"""
def test_queue... | Python | 0 | |
338559737e34ca395cec895ac8e822fc3147c7aa | Add basic code | tule.py | tule.py | def calcLength(x,y,z=0):
return (x**2 + y**2 + z**2)**0.5
#lengths are in feet
L = 92; W=68; H=22; MidXY=(W/2,L/2)
def feetToYards(inFeet):
return inFeet/3.0
def yardsToFeet(inYards):
return inYards * 3.0
#widthOfStrand is how wide the tule piece (in feet)
def findTotal(widthOfStrand,z=0,printTotal=Fals... | Python | 0 | |
242479ace03928b20dc86806f7592ec1148b615b | Add integration test for DraftService. | service/test/integration/test_draft_service.py | service/test/integration/test_draft_service.py | #
# Copyright (c) 2014 ThoughtWorks, Inc.
#
# Pixelated 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.
#
# Pixelated is distrib... | Python | 0 | |
c58be8c77fdad5ec8b6c9da9ba6cfc45ae0f6d07 | fix typo in fuzz_addresses.py | fuzz-addresses.py | fuzz-addresses.py | import sys
import csv
from dateutil.parser import parse
from datetime import datetime
#Take a csv with datetime stamps and addresses split across remaing cells and output
#a fuzzed csv that contains two columns. A datetime stamp of the first day of the year
#in which the location occured, and the country.
#call it wi... | Python | 0.998582 | |
0ff705b6bbe2d2844d6b947ca2aa8fc9cc9ead66 | Create PedidoDeletar.py | backend/Models/Grau/PedidoDeletar.py | backend/Models/Grau/PedidoDeletar.py | from Framework.Pedido import Pedido
from Framework.ErroNoHTTP import ErroNoHTTP
class PedidoDeletar(Pedido):
def __init__(self,variaveis_do_ambiente):
super(PedidoDeletar, self).__init__(variaveis_do_ambiente)
try:
self.id = self.corpo['id']
except:
raise ErroNoHTTP(400)
def getId(self):
return ... | Python | 0 | |
d85442d5961602ae91c385a65e9503c409316b3f | Scrub stale data from redis | bin/scrub_stale_lists.py | bin/scrub_stale_lists.py | #!/usr/bin/env python
import sys
import os
import time
import redis
import requests
import logging
from urlparse import urlparse
from datetime import timedelta
def main(rds):
pf = "coalesce.v1."
tasks_removed = 0
lists_removed = 0
list_keys = rds.smembers(pf + "list_keys")
for key in list_keys:... | Python | 0.000001 | |
b2b81ac5222a5be7a310c8ef7774f9e2887b412e | optimise lags implemented | optimiseLDA.py | optimiseLDA.py | import cPickle, string, numpy, getopt, sys, random, time, re, pprint
import numpy as np
import glob
from gensim import corpora, models
import pickle
import nltk
from nltk.stem.wordnet import WordNetLemmatizer
from nltk.corpus import wordnet as wn
import logging
import matplotlib.pyplot as plt
import copy
from matplotli... | Python | 0 | |
28100da7b41d8617ef240179acfce7b25f698efc | add selenium web driver | snippets/create-Selenium-python-wd-unittest.py | snippets/create-Selenium-python-wd-unittest.py | # -*- coding: utf-8 -*-
import unittest
from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
def every_downloads_chrome(driver):
if not driver.current_url.startswith("chrome://downloads"):
driver.get("chrome://downloads/")
return driver.execute_script("""
v... | Python | 0.000001 | |
9870fdd4b0996254216ff85a4dc0f9706843ca50 | Add test for nested while with exc and break. | tests/basics/while_nest_exc.py | tests/basics/while_nest_exc.py | # test nested whiles within a try-except
while 1:
print(1)
try:
print(2)
while 1:
print(3)
break
except:
print(4)
print(5)
break
| Python | 0 | |
6a541b8d5b7c2c742420bbbe758866daef804e90 | Add a unit test to verify controller objects do not persist across classes. (#483) | tests/mobly/test_suite_test.py | tests/mobly/test_suite_test.py | # Copyright 2018 Google Inc.
#
# 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, ... | Python | 0 | |
56cb3c6c046c403e186a5191e30b8b982900c57c | Add cli project tests | tests/test_cli/test_project.py | tests/test_cli/test_project.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from mock import patch
from tests.test_cli.utils import BaseCommandTestCase
from polyaxon_cli.cli.project import project
class TestProject(BaseCommandTestCase):
@patch('polyaxon_client.api.project.ProjectApi.create_project... | Python | 0 | |
bf28aa8fbe9aa735d017f935aefb89c5ed48f836 | Add bubble sort implementation | aids/sorting_and_searching/bubble_sort.py | aids/sorting_and_searching/bubble_sort.py | '''
In this module, we implement bubble sort
Time complexity: O(n ^ 2)
'''
def bubble_sort(arr):
'''
Sort array using bubble sort
'''
for index_x in xrange(len(arr)):
for index_y in xrange(len(arr) - 1, index_x, -1):
if arr[index_y] < arr[index_y - 1]:
arr[index_... | Python | 0 | |
73cab4c1e0a591504176011b53b9774c8782238e | test kalman | tests/tsdb/test_tsdb_kalman.py | tests/tsdb/test_tsdb_kalman.py | from tsdb import TSDBClient, TSDB_REST_Client
import timeseries as ts
import numpy as np
import subprocess
import unittest
import asyncio
import asynctest
import time
class Test_TSDB_Kalman(asynctest.TestCase):
def setUp(self):
#############
### SETUP ###
#############
# We'll... | Python | 0.000006 | |
763581798b89b5105e55b692a0c4f1fd0890e459 | Add unit tests to ensure a valid provider | tests/unit/utils/gitfs_test.py | tests/unit/utils/gitfs_test.py | # -*- coding: utf-8 -*-
'''
These only test the provider selection and verification logic, they do not init
any remotes.
'''
# Import python libs
from __future__ import absolute_import
# Import Salt Testing libs
from salttesting import skipIf, TestCase
from salttesting.mock import MagicMock, patch, NO_MOCK, NO_MOCK_R... | Python | 0 | |
faef1804e1781365fc027ecf08d61fbab56a4679 | Add migratioss I forgot to commit out of saltyness | magic/migrations/0003_auto_20170929_0229.py | magic/migrations/0003_auto_20170929_0229.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-09-29 05:29
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('magic', '0002_auto_20170929_0159'),
]
operations = [
migrations.AlterField(... | Python | 0 | |
e61dcb055fb4767e6e662648c89cbdfda4422c97 | Update expected error message in this test | docs/source/examples/test_no_depends_fails.py | docs/source/examples/test_no_depends_fails.py | from pych.extern import Chapel
@Chapel(sfile="users.onlyonce.chpl")
def useTwoModules(x=int, y=int):
return int
if __name__ == "__main__":
print(useTwoModules(2, 4))
import testcase
# contains the general testing method, which allows us to gather output
import os.path
def test_using_multiple_modules():
... | from pych.extern import Chapel
@Chapel(sfile="users.onlyonce.chpl")
def useTwoModules(x=int, y=int):
return int
if __name__ == "__main__":
print(useTwoModules(2, 4))
import testcase
# contains the general testing method, which allows us to gather output
import os.path
def test_using_multiple_modules():
... | Python | 0 |
2e7048d8feae5ed2c244e617077235b5b771f326 | Add deleted selenium runner | test/selenium/src/run_selenium.py | test/selenium/src/run_selenium.py | #!/usr/bin/env python2.7
# 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: miha@reciprocitylabs.com
# Maintained By: miha@reciprocitylabs.com
""" Basic selenium test runner
This script is used for... | Python | 0 | |
3bb65466d40c1b59faebe0db40eced260ff60010 | Create SampleFunction.py | src/Python/ImplicitFunctions/SampleFunction.py | src/Python/ImplicitFunctions/SampleFunction.py | #!/usr/bin/env python
import vtk
def main():
value = 2.0
colors = vtk.vtkNamedColors()
implicitFunction = vtk.vtkSuperquadric()
implicitFunction.SetPhiRoundness(2.5)
implicitFunction.SetThetaRoundness(.5)
# Sample the function.
sample = vtk.vtkSampleFunction()
sample.SetSampleDimensions(50,50,50)
sample.... | Python | 0.000001 | |
95a890b988435fb019083026572ddb7042dc1379 | Create generate.py | PrettyBits/generate.py | PrettyBits/generate.py | # coding=UTF-8
#
# generate a list of all 8 bit binary strings,
# sort them by how "pretty" they will be in
# Core Rope Memory
#
# mmcgaley@gmail.com
# 2015.04.19
#
WORDLEN = 7
import math
def addLeadingZeros(binaryString) :
return ((WORDLEN - len(binaryString)) * "0") + binaryString
def maxZeros(binaryStri... | Python | 0.000002 | |
524f47a4d4e0db5b76dfb7ebf9447b6199e48b6d | Add data utils tests. | tests/test_data_utils_filetree.py | tests/test_data_utils_filetree.py | from uuid import uuid1
import json
import pytest
from flask_jsondash.data_utils import filetree
def test_path_hierarchy(tmpdir):
uid = uuid1()
tmpfile = tmpdir.mkdir('{}'.format(uid))
data = filetree.path_hierarchy(tmpfile.strpath)
assert json.dumps(data)
for key in ['type', 'name', 'path']:
... | Python | 0 | |
8d6959a6d950e243ebd2c930ae176a3debf4cc9c | Add package-updates-metric.py | plugins/system/package-updates-metric.py | plugins/system/package-updates-metric.py | #!/usr/bin/env python
#coding=utf-8
import apt
import apt_pkg
import json
import os
import subprocess
import sys
"""
security-updates-metric is used to check avaliable package updates
for Debian or Ubuntu system.
The program is inspired by /usr/lib/update-notifier/apt_check.py
"""
SYNAPTIC_PINFILE = "/var/lib/synap... | Python | 0.000001 | |
37d0843c76b558d6d7a1892963a30e9a56d73f24 | Document typical Stylesheet attributes | praw/models/stylesheet.py | praw/models/stylesheet.py | """Provide the Stylesheet class."""
from .base import PRAWBase
class Stylesheet(PRAWBase):
"""Represent a stylesheet.
**Typical Attributes**
This table describes attributes that typically belong to objects of this
class. Since attributes are dynamically provided (see
:ref:`determine-available-a... | """Provide the Stylesheet class."""
from .base import PRAWBase
class Stylesheet(PRAWBase):
"""Represent a stylesheet."""
| Python | 0 |
4cde1f2fcc21ff83daabdb5221c462f44991c73f | Create remove-boxes.py | Python/remove-boxes.py | Python/remove-boxes.py | # Time: O(n^3) ~ O(n^4)
# Space: O(n^3)
# Given several boxes with different colors represented by different positive numbers.
# You may experience several rounds to remove boxes until there is no box left.
# Each time you can choose some continuous boxes with the same color (composed of k boxes, k >= 1),
# remove t... | Python | 0.000002 | |
06fb2c0371b9cfb5980351d45665d41fdcfae3b5 | Add MemoryMetric to Memory measurement | tools/perf/measurements/memory.py | tools/perf/measurements/memory.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.
from metrics import histogram
from metrics import memory
from telemetry.page import page_measurement
MEMORY_HISTOGRAMS = [
{'name': 'V8.MemoryExtern... | # 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.
from metrics import histogram
from telemetry.page import page_measurement
MEMORY_HISTOGRAMS = [
{'name': 'V8.MemoryExternalFragmentationTotal', 'uni... | Python | 0.000001 |
9a5bfb7f5bf114bb4bcf2dd4c88ddd8924a97ed9 | add menu function to menu.py | menu.py | menu.py | #!/usr/bin/end python
# Text-based menu for use in pyWype.py
def menu():
""" Menu prompt for user to select program option """
while True:
print 'I'
print 'II'
print 'III'
print 'IV'
print 'V'
choice = raw_input('Select an option (I, II, III, IV, V): ')
... | Python | 0.000003 | |
fb61398b6a0cdd4f40d16729ab2ff0ca47730526 | Add the main file | relay_api/__main__.py | relay_api/__main__.py | from relay_api.api.server import server
from relay_api.conf.config import relays
import relay_api.api.server as api
@server.route("/relay-api/relays", methods=["GET"])
def get_relays():
return api.get_relays(relays)
@server.route("/relay-api/relays/<int:relay_id>", methods=["GET"])
def get_relay(relay_id):
... | Python | 0.000004 | |
72a0d635e497f0f4c6c58d84f7001ec04063ea90 | Add mfnd.py that prints todays date | mfnd.py | mfnd.py | #!/usr/bin/env python3
"""
MFND - A simple to-do list application
"""
import datetime
today = datetime.date.today()
print( today.strftime('MFND - %B %d, %Y') )
| Python | 0 | |
d3469fd3ab39eeee381457588931636bf0987ea9 | Create impossible_bet.py | impossible_bet.py | impossible_bet.py | import random
def play_bet(participants=100, times=1000, checks=50):
"""Simulate the bet x times with x participants."""
wins = 0
losses = 0
for time in range(times):
boxes = list(range(1, participants + 1))
random.shuffle(boxes)
for participant in range(1, participants + 1):
... | Python | 0.000821 | |
aeabe6bb89a359e644c5adcb4c6456fd3428f6de | Stop using intersphinx | doc/source/conf.py | doc/source/conf.py | # -*- coding: utf-8 -*-
#
# -- General configuration ----------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.view... | # -*- coding: utf-8 -*-
#
# -- General configuration ----------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.inte... | Python | 0.000001 |
e8c2406cbcff96196d2404e9df167cc96f468779 | add sources api | mcp/interface/sources.py | mcp/interface/sources.py | import json
from mcp import sources
from mcp.interface import common
class SourcesHandler(common.AuthorizedHandler):
def forbidden(self):
return True
def do_get(self):
return 200, json.dumps(list(iter(sources.source_db)))
class SourceHandler(common.AuthorizedHandler):
def __init__(self, request, response, gr... | Python | 0 | |
5dabba3941f870f3f365e186fdf852e834649595 | Move config to docs | homeassistant/components/sensor/eliqonline.py | homeassistant/components/sensor/eliqonline.py | """
homeassistant.components.sensor.eliqonline
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Monitors home energy use for the eliq online service.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.eliqonline/
"""
import logging
from homeassistant.helper... | """
homeassistant.components.sensor.eliqonline
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
monitors home energy use for the eliq online service
api documentation:
https://my.eliq.se/knowledge/sv-SE/49-eliq-online/299-eliq-online-api
access to api access token:
https://my.eliq.se/user/settings/api
current energy u... | Python | 0.000001 |
b2aa91648fe3ae915381e68cac95e5c3f6e5a182 | add zhihu_login.py | spider/login/zhihu_login.py | spider/login/zhihu_login.py | # coding:utf-8
# 模拟账户登录 | Python | 0 | |
c505927ae756fe1740e8603aadf23dae0ad12ff5 | Create 01.CenturiesToMinutes.py | TechnologiesFundamentals/ProgrammingFundamentals/DataTypesAndVariables-Lab/01.CenturiesToMinutes.py | TechnologiesFundamentals/ProgrammingFundamentals/DataTypesAndVariables-Lab/01.CenturiesToMinutes.py | centuries = int(input())
years = centuries * 100
days = int(years * 365.2422)
hours = days * 24
minutes = hours * 60
print("%d centuries = %d years = %d days = %d hours %d = minutes" %
(centuries, years, days, hours, minutes))
| Python | 0 | |
dca52ab05af01b96610e5044c45bd7c0655c17ec | introduce an Exporter API | pynodegl-utils/pynodegl_utils/export.py | pynodegl-utils/pynodegl_utils/export.py | import os
import platform
import subprocess
import pynodegl as ngl
from PyQt5 import QtGui, QtCore
class _PipeThread(QtCore.QThread):
def __init__(self, fd, unused_fd, w, h, fps):
super(_PipeThread, self).__init__()
self.fd = fd
self.unused_fd = unused_fd
self.w, self.h, self.fps... | Python | 0 | |
ab9800183b3ab229782016aa3f88e6825467d01b | Add forgot username tests | api/radar_api/tests/test_forgot_username.py | api/radar_api/tests/test_forgot_username.py | def test_forgot_username(app):
client = app.test_client()
response = client.post('/forgot-username', data={
'email': 'foo@example.org'
})
assert response.status_code == 200
def test_email_missing(app):
client = app.test_client()
response = client.post('/forgot-username', data={})
... | Python | 0 | |
9b9fb4df30a8183c4de9f157200c5ff225d11d67 | Add the plot script | src/scripts/prepare_gnuplot.py | src/scripts/prepare_gnuplot.py | #!/usr/bin/python
import sys
import argparse
import csv
from string import Template
parser = argparse.ArgumentParser(description='Prepare gnuplot script from the supplied data files.')
parser.add_argument('files', nargs='+', help='The data files.')
MIN_Y_RANGE = 0.000001
GNUPLOT_SCRIPT_TEMPLATE = Template("""
rese... | Python | 0.999689 | |
6f1729a96e1fe0f4e8d00813b6c2829519cdc15f | Handle the case where we encounter a snap shot correctly. | nova/tests/test_image_utils.py | nova/tests/test_image_utils.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2012 Yahoo! Inc. 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.or... | Python | 0.000006 | |
d08f9cd114329a3ea66f84421b5abbfcf73c1f69 | Add timeout test | odo/backends/tests/test_url.py | odo/backends/tests/test_url.py | from __future__ import print_function
import pytest
from functools import partial
import codecs
import os
from odo import odo, resource, URL, discover, CSV, TextFile, convert
from odo.backends.url import sample
from odo.temp import _Temp, Temp
from odo.utils import tmpfile, raises
import datashape
try:
from ur... | from __future__ import print_function
import pytest
from functools import partial
import codecs
import os
from odo import odo, resource, URL, discover, CSV, TextFile, convert
from odo.backends.url import sample
from odo.temp import _Temp, Temp
from odo.utils import tmpfile, raises
import datashape
try:
from ur... | Python | 0.000004 |
27a3ca8d746890c7404845d18b8031763ec6b6a7 | add netcat-nonblock.py | python/netcat-nonblock.py | python/netcat-nonblock.py | #!/usr/bin/python
import errno
import fcntl
import os
import select
import socket
import sys
def setNonBlocking(fd):
flags = fcntl.fcntl(fd, fcntl.F_GETFL)
fcntl.fcntl(fd, fcntl.F_SETFL, flags | os.O_NONBLOCK)
def nonBlockingWrite(fd, data):
try:
nw = os.write(fd, data)
return nw
exc... | Python | 0.000001 | |
34fd215d73d87c017cdae299aebd6484e6541991 | Revert 176254 > Android: upgrade sandbox_linux_unitests to a stable test > > > BUG=166704 > NOTRY=true > > Review URL: https://chromiumcodereview.appspot.com/11783106 | build/android/pylib/gtest/gtest_config.py | build/android/pylib/gtest/gtest_config.py | # Copyright (c) 2013 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.
"""Configuration file for android gtest suites."""
# Add new suites here before upgrading them to the stable list below.
EXPERIMENTAL_TEST_SUITES = [
... | # Copyright (c) 2013 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.
"""Configuration file for android gtest suites."""
# Add new suites here before upgrading them to the stable list below.
EXPERIMENTAL_TEST_SUITES = [
]
... | Python | 0 |
4783f68cb2fc3eb25b611b4662d1ca3a2fddd7b3 | Fix issue #51: added throttled_ftpd.py script in the demo directory. | demo/throttled_ftpd.py | demo/throttled_ftpd.py | #!/usr/bin/env python
# throttled_ftpd.py
"""ftpd supporting bandwidth throttling capabilities for data transfer.
"""
import os
import time
import asyncore
from pyftpdlib import ftpserver
class ThrottledDTPHandler(ftpserver.DTPHandler):
"""A DTPHandler which wraps sending and receiving in a data ... | Python | 0 | |
732fd24d06f49570c24016b7adfb3ad511e2e6af | Add test for ValidationResultIdentifier.to_tuple() | tests/data_context/test_data_context_resource_identifiers.py | tests/data_context/test_data_context_resource_identifiers.py | from great_expectations.data_context.types.resource_identifiers import (
ValidationResultIdentifier
)
def test_ValidationResultIdentifier_to_tuple(expectation_suite_identifier):
validation_result_identifier = ValidationResultIdentifier(
expectation_suite_identifier,
"my_run_id",
"my_ba... | Python | 0.000004 | |
b3ef51e93b090451718ed4c1240b63b8e99cd085 | rename example | miepython/02_glass.py | miepython/02_glass.py | #!/usr/bin/env python3
"""
Plot the scattering efficiency as a function of wavelength for 4micron glass spheres
"""
import numpy as np
import matplotlib.pyplot as plt
import miepython
num = 100
radius = 2 # in microns
lam = np.linspace(0.2,1.2,num) # also in microns
x = 2*np.pi*radius/lam
# fr... | Python | 0.000515 | |
d1fe5a06f5e082fd8196f510e2eba7daa3468ef8 | Add duplicate_nodes.py file | duplicate_nodes.py | duplicate_nodes.py | from shutil import copytree, ignore_patterns
import glob
import os
import sys
if __name__ == '__main__':
data_dir = './parsedData/'
use_symlink = True
orig_nodes = os.listdir(data_dir)
orig_nodes = [os.path.basename(i) for i in glob.glob(os.path.join(data_dir, '1*'))]
for dup_cnt in range(100):
... | Python | 0.000003 | |
77f812f76966b90c27131fd65968f548afcdcace | Add loader for basic csv layers without geoms | svir/dialogs/load_basic_csv_as_layer_dialog.py | svir/dialogs/load_basic_csv_as_layer_dialog.py | # -*- coding: utf-8 -*-
# /***************************************************************************
# Irmt
# A QGIS plugin
# OpenQuake Integrated Risk Modelling Toolkit
# -------------------
# begin : 2013-10-24
# copyright ... | Python | 0 | |
f2a359664bf69a6c8e883d460a49c986b511b80e | add file | eptools/gspread.py | eptools/gspread.py | """
Functions to access the data in google drive spreadsheets
"""
import pandas as pd
from docstamp.gdrive import (get_spreadsheet,
worksheet_to_dict)
def get_ws_data(api_key_file, doc_key, ws_tab_idx, header=None, start_row=1):
""" Return the content of the spreadsheet in the w... | Python | 0 | |
e8d05226f2a8cabf0f38bae6c2e218bd81efa6a1 | Add a utility script for encoding packet traces | util/encode_packet_trace.py | util/encode_packet_trace.py | #!/usr/bin/env python
# Copyright (c) 2013 ARM Limited
# All rights reserved
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation... | Python | 0 | |
04876b4bea96f983c722cb9bf7845c7cc3b0ecef | add oauth2 example | examples/oauth2.py | examples/oauth2.py | from imap_tools import MailBox
# Authenticate to account using OAuth 2.0 mechanism
with MailBox('imap.my.ru').xoauth2('user', 'token123', 'INBOX') as mailbox:
for msg in mailbox.fetch():
print(msg.date_str, msg.subject)
| Python | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.