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 |
|---|---|---|---|---|---|---|---|
84c5bfa0252814c5797cf7f20b04808dafa9e1fa | Create MergeIntervals_001.py | leetcode/056-Merge-Intervals/MergeIntervals_001.py | leetcode/056-Merge-Intervals/MergeIntervals_001.py | # Definition for an interval.
# class Interval:
# def __init__(self, s=0, e=0):
# self.start = s
# self.end = e
class Solution:
# @param {Interval[]} intervals
# @return {Interval[]}
def sortmeg(self, intervals):
ls = []
for i in intervals:
ls.append(i.s... | Python | 0 | |
8471516294d5b28a81cae73db591ae712f44bc01 | Add failing cairo test | tests/pygobject/test_structs.py | tests/pygobject/test_structs.py | # Copyright 2013 Christoph Reiter
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
import unittest
from gi.r... | Python | 0.000002 | |
c46e6d170f4d641c3bb5045a701c7810d77f28a6 | add update-version script | update-version.py | update-version.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import os
import xml.etree.ElementTree as et
NS = "http://maven.apache.org/POM/4.0.0"
POM_NS = "{http://maven.apache.org/POM/4.0.0}"
def getModuleNames(mainPom):
pom = et.parse(mainPom)
modules = pom.findall("./{ns}modules/{ns}module".format(ns=... | Python | 0 | |
0bc4d105bd649ed9e174b26b5017572f08fd5c2f | Write unit tests for physics library | src/server/test_physics.py | src/server/test_physics.py | #!/usr/bin/env python
import unittest
from physics import *
class TestNVectors(unittest.TestCase):
def setUp(self):
self.v11 = NVector(1, 1)
self.v34 = NVector(3, 4)
self.v10 = NVector(10, 0)
self.vneg = NVector(-2, -2)
def test_dimensionality(self):
"""Test counting of number of dimension... | Python | 0.000001 | |
b9cf46407eea6df9bb3fef5eb3103c7353b249a9 | solve problem 11 | problem11.py | problem11.py | def largest_grid_product(grid):
max = float("-inf")
for i in xrange(0, len(grid)):
for j in xrange(0, len(grid[i]) - 3):
productx = grid[i][j] * grid[i][j+1] * grid[i][j+2] * grid[i][j+3]
producty = grid[j][i] * grid[j+1][i] * grid[j+2][i] * grid[j+3][i]
if productx > max:
max = produc... | Python | 0.000436 | |
1d3719bcd03b92d04efae10933928f953d95c7a4 | Add a simple basicmap python example | src/python/BasicMap.py | src/python/BasicMap.py | """
>>> from pyspark.context import SparkContext
>>> sc = SparkContext('local', 'test')
>>> b = sc.parallelize([1, 2, 3, 4])
>>> sorted(basicSquare(b).collect())
[1, 4, 9, 12]
"""
import sys
from pyspark import SparkContext
def basicSquare(nums):
"""Square the numbers"""
return nums.map(lambda x: x * x)
if ... | Python | 0.000014 | |
41220718d0e9a32fc9e95d55acdb989b2f87563f | Add @job tasks | smsish/tasks.py | smsish/tasks.py | import django_rq
from rq.decorators import job
DEFAULT_QUEUE_NAME = "default"
DEFAULT_REDIS_CONNECTION = django_rq.get_connection()
@job(DEFAULT_QUEUE_NAME, connection=DEFAULT_REDIS_CONNECTION)
def send_sms(*args, **kwargs):
from smsish.sms import send_sms as _send_sms
return _send_sms(*args, **kwargs)
@job(DEFA... | Python | 0.000791 | |
6ee145c7af7084f228ee48754ef2a0bfc37c5946 | Add missing hooks.py module | pyqt_distutils/hooks.py | pyqt_distutils/hooks.py | """
A pyqt-distutils hook is a python function that is called after the
compilation of a ui script to let you customise its content. E.g. you
might want to write a hook to change the translate function used or replace
the PyQt imports by your owns if you're using a shim,...
The hook function is a simple python functio... | Python | 0.000003 | |
92af6cafc6ef297464b1ae3f3556e2b815504bbb | add nfs datastore to all hosts in all clusters | add_nfs_ds.py | add_nfs_ds.py | #!/usr/bin/env python
try:
import json
except ImportError:
import simplejson as json
import re
import os
import time
import atexit
import urllib2
import datetime
import ast
import ssl
if hasattr(ssl, '_create_default_https_context') and hasattr(ssl, '_create_unverified_context'):
ssl._create_default_htt... | Python | 0.000002 | |
ff79343cb1feda5259244199b4f0d503da401f24 | Create quick_sort_iterativo.py | quick_sort_iterativo.py | quick_sort_iterativo.py | import unittest
def _quick_recursivo(seq, inicio, final):
if inicio >= final:
return seq
indice_pivot = final
pivot = seq[indice_pivot]
i_esquerda = inicio
i_direita = final - 1
while i_esquerda<=i_direita:
while i_esquerda<=i_direita and seq[i_esquerda]<=pivot:
i_... | Python | 0.000004 | |
ae2f6b1d6a3d19ab183442db0760dd5453ebefab | Add new dci_remoteci module | modules/dci_remoteci.py | modules/dci_remoteci.py | #!/usr/bin/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
#
# Unless required by applicable law or agreed to in writing, software
# dist... | Python | 0.000003 | |
8543b2bf12c25163be62a8d44b48d32396f3ac9b | Add source. | solver.py | solver.py | #!usr/bin/env python3
import sys, time
from tkinter import messagebox, Tk
game_w, game_h = 50, 30 # total width and height of the game board in game coordinates
formula_mode = "axis"
from pymouse import PyMouse, PyMouseEvent
from pykeyboard import PyKeyboard, PyKeyboardEvent
m = PyMouse()
k = PyKeyboard()
class Poin... | Python | 0 | |
4324eaf427731db3943cf130e42e29509bdbd4df | Fix for Python 3 | asv/config.py | asv/config.py | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import os
import sys
from . import util
class Config(object):
"""
Manages the configuration for a benchmark pr... | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import os
import sys
from . import util
class Config(object):
"""
Manages the configuration for a benchmark pr... | Python | 0.000054 |
0eb579b00c7e42813d45aa841df3f42607db0a7e | add thermoengineTest | rmgpy/thermo/thermoengineTest.py | rmgpy/thermo/thermoengineTest.py | #!/usr/bin/env python
# encoding: utf-8 -*-
"""
This module contains unit tests of the rmgpy.parallel module.
"""
import os
import sys
import unittest
import random
from external.wip import work_in_progress
from rmgpy import settings
from rmgpy.data.rmg import RMGDatabase
from rmgpy.rmg.main import RMG
from rmgpy.sc... | Python | 0.000001 | |
6a47c684012b98679c9274ca4087958c725a1fa7 | support extensions in tests | test/unit/dockerstache_tests.py | test/unit/dockerstache_tests.py | #!/usr/bin/env python
"""
dockerstache module test coverage for API calls
"""
import os
import tempfile
import json
import unittest
import mock
from dockerstache.dockerstache import run
class RunAPITests(unittest.TestCase):
"""tests for run API call"""
def setUp(self):
self.tempdir = tempfile.mkdtem... | Python | 0 | |
3618ce5749517c7757a04f0c08a74275e8e82b69 | Create fasttext.py | fasttext.py | fasttext.py | from __future__ import print_function
import numpy as np
from keras.preprocessing import sequence
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import Embedding
from keras.layers import GlobalAveragePooling1D
from keras.datasets import imdb
class FastText:
'''
Takes... | Python | 0.000031 | |
eb96fc1d59108a429ea2a03ee07d94a1a143139f | Manage the creation and launching of a cluster | multifil/aws/cluster.py | multifil/aws/cluster.py | #!/usr/bin/env python
# encoding: utf-8
"""
cluster.py - manage the behaviour and start up of a cluster
Created by Dave Williams on 2016-07-19
"""
import os
import sys
import time
import string
import copy
import subprocess as subp
import configparser
import boto
## Defaults
BASE_PATH = os.path.expanduser('~/code/m... | Python | 0.000001 | |
d23b83f8052f1ca5a988b05c3893b884eb3be6cc | Add link.py | misc/link.py | misc/link.py | #!/usr/bin/env python
from signal import signal, SIGPIPE, SIG_DFL
signal(SIGPIPE, SIG_DFL)
import argparse
import csv
import sys
import itertools
from collections import defaultdict, Counter
from math import log
from sklearn.feature_extraction import DictVectorizer
from sklearn.metrics.pairwise import cosine_similari... | Python | 0.000001 | |
7655e376696a04aa1c3596274861515953f592e8 | Add profiling script for savings code | openprescribing/frontend/price_per_unit/profile.py | openprescribing/frontend/price_per_unit/profile.py | """
Basic profiling code for working out where we're spending our time
Invoke with:
./manage.py shell -c 'from frontend.price_per_unit.profile import profile; profile()'
"""
from cProfile import Profile
import datetime
import time
from .savings import get_all_savings_for_orgs
def test():
get_all_savings_for_org... | Python | 0 | |
40caa4c9b720388207e338ffde3cd7f2d85cdf0d | add a single script to perform formatting of base log files | base-format.py | base-format.py | #!/usr/bin/python
from __future__ import print_function
import sys
import re
import datetime
import ircformatlib as il
timeformat_format = '%H:%M:%S'
timeformat_formatlen = 8
timeformat_filler = ' ' * timeformat_formatlen
def timeformat(time):
try:
x = int(time)
dt = datetime.datetime.from... | Python | 0 | |
2766e8797515497e5569b31696416db68641c9b4 | Extend MediaRemovalMixin to move media files on updates | base/models.py | base/models.py | import os
from django.conf import settings
class MediaRemovalMixin(object):
"""
Removes all files associated with the model, as returned by the
get_media_files() method.
"""
# Models that use this mixin need to override this method
def get_media_files(self):
return
def delete(se... | import os
from django.conf import settings
class MediaRemovalMixin(object):
"""
Removes all files associated with the model, as returned by the
get_media_files() method.
"""
# Models that use this mixin need to override this method
def get_media_files(self):
return
def delete(se... | Python | 0 |
24c642063ffcb3313545b2e1ba3abbb62aa98437 | Add cuit validator to utils module | nbs/utils/validators.py | nbs/utils/validators.py | # -*- coding: utf-8-*-
def validate_cuit(cuit):
"from: http://python.org.ar/pyar/Recetario/ValidarCuit by Mariano Reingart"
# validaciones minimas
if len(cuit) != 13 or cuit[2] != "-" or cuit [11] != "-":
return False
base = [5, 4, 3, 2, 7, 6, 5, 4, 3, 2]
cuit = cuit.replace("-", "")
... | Python | 0 | |
7274f9286bd267970c286954e9d21e601af30cb7 | Create messenger.py | messenger.py | messenger.py | # -*- coding: utf-8 -*-
import requests
apiurl = '你的地址'
apiheaders = {'U-ApiKey': '你的key'}
code="动态码"
response = requests.get(apiurl, params={"media_id":'gh_3fc78df4c9d2',"auth_code":code, "scene":1,"device_no":1,"location":'jia'})
json = response.json()
print(json)
| Python | 0.000002 | |
620ad7f4dc5ed9403f468f592b99a22a92d22072 | make python -m i3configger work | i3configger/__main__.py | i3configger/__main__.py | import i3configger.main
if __name__ == "__main__":
i3configger.main.main()
| Python | 0.000012 | |
ad2178a8973ce2de55611321c0b7b57b1488fc6b | move utilities in a private module | appengine_toolkit/management/commands/_utils.py | appengine_toolkit/management/commands/_utils.py | import pkg_resources
import os
class RequirementNotFoundError(Exception):
pass
def collect_dependency_paths(package_name):
"""
TODO docstrings
"""
deps = []
try:
dist = pkg_resources.get_distribution(package_name)
except ValueError:
message = "Distribution '{}' not found.... | Python | 0 | |
79b99968d7c9e728efe05f8c962bdda5c9d56559 | Add LDAP authentication plugin | web/utils/auth.py | web/utils/auth.py | # http://www.djangosnippets.org/snippets/501/
from django.contrib.auth.models import User
from django.conf import settings
import ldap
class ActiveDirectoryBackend:
supports_object_permissions = False
supports_anonymous_user = False
supports_inactive_user = False
def authenticate(self, username=None... | Python | 0 | |
6f8460b10827a9877fd0c3f0d45a01e7b2d42014 | Create ios.py | bitcoin/ios.py | bitcoin/ios.py | import ecdsa
import binascii
import hashlib
import struct
from bitcoin.main import *
from bitcoin.pyspecials import *
# https://gist.github.com/b22e178cff75c4b432a8
# Returns byte string value, not hex string
def varint(n):
if n < 0xfd:
return struct.pack('<B', n)
elif n < 0xffff:
return struc... | Python | 0.000005 | |
8e1a3cc1a3d4e4d9bc63fb73a8787e5c627afb7d | add tests for service inspector | tests/test_service_inspector.py | tests/test_service_inspector.py | from __future__ import absolute_import
import unittest
import servy.server
class Dummy(object):
def fn(self):
pass
class Service(servy.server.Service):
def __call__(self):
pass
class ServiceDetection(unittest.TestCase):
def test_lambda(self):
self.assertTrue(servy.server.Serv... | Python | 0.000001 | |
43de875bcb2dcf4213b881ff1de8f9e715fb2d30 | Add brute_force.py | brute_force.py | brute_force.py | from battingorder import *
from itertools import permutations
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Brute force.')
parser.add_argument("filename", nargs='?', default='braves.data', help="file with necessary statistics")
args = parser.parse_args()
player_matrices = re... | Python | 0.99866 | |
b013f059a5d39acf05ba8e5ef9d6cb1d9e3f724c | add a script to exercise the example jsonrpc methods | tester.py | tester.py | import zmq
class JRPC:
def __init__(self):
self.id = 0
def make_req(self, method, params):
req = {"jsonrpc":"2.0", "method":method, "params":params,
"id":self.id}
self.id += 1
return req
zctx = zmq.Context.instance()
zsock = zctx.socket(zmq.REQ)
zsock.connect("tcp://127.0.0.1:10000")
jrpc = JRPC()
re... | Python | 0 | |
0dcf9178564b879a51b06ae06df58917f78adb6d | Fix linting | tensorflow_datasets/image/nyu_depth_v2.py | tensorflow_datasets/image/nyu_depth_v2.py | """NYU Depth V2 Dataset."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import h5py
import numpy as np
import tensorflow.compat.v2 as tf
import tensorflow_datasets as tfds
_CITATION = """\
@inproceedings{Silberman:ECCV12,
author = {Na... | """NYU Depth V2 Dataset."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import h5py
import os
import numpy as np
import tensorflow.compat.v2 as tf
import tensorflow_datasets as tfds
_CITATION = """\
@inproceedings{Silberman:ECCV12,
author = {Nat... | Python | 0.000004 |
061dcecdd7b691cefd34c8a254037a399b251378 | add a new script to build a pypi 'simple' index from a dir containing wheels | build_index.py | build_index.py | import sys
import py
PACKAGES = [
'netifaces',
]
class IndexBuilder(object):
def __init__(self, wheeldir, outdir):
self.wheeldir = py.path.local(wheeldir)
self.outdir = py.path.local(outdir)
self.packages = []
def copy_wheels(self):
for whl in self.wheeldir.visit('*.whl')... | Python | 0 | |
b22bf4e2431ac3598d9c8afee3f924d940e2297e | Create building_df.py | building_df.py | building_df.py | """Utility functions"""
import os
import pandas as pd
def symbol_to_path(symbol, base_dir="data"):
"""Return CSV file path given ticker symbol."""
return os.path.join(base_dir, "{}.csv".format(str(symbol)))
def get_data(symbols, dates):
"""Read stock data (adjusted close) for given symbols from CSV file... | Python | 0.000002 | |
7d84cf8c41105d9990b8cfdf176415f1bcb20e0f | Add tests for batch norm | thinc/tests/integration/test_batch_norm.py | thinc/tests/integration/test_batch_norm.py | import pytest
from mock import MagicMock
import numpy
import numpy.random
from numpy.testing import assert_allclose
from hypothesis import given, settings, strategies
from ...neural._classes.batchnorm import BatchNorm
from ...api import layerize, noop
from ...neural._classes.affine import Affine
from ..strategies imp... | Python | 0 | |
cca6eee8dbf4dda84c74dfedef1cf4bcb5264ca5 | Add the first database revision | admin/migrations/versions/ff0417f4318f_.py | admin/migrations/versions/ff0417f4318f_.py | """ Initial schema
Revision ID: ff0417f4318f
Revises: None
Create Date: 2016-06-25 13:07:11.132070
"""
# revision identifiers, used by Alembic.
revision = 'ff0417f4318f'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
op.create_table('domain',
sa.Column('created_at',... | Python | 0.000001 | |
7473384155edbf85304cc541325d0a94a75d2cf4 | Add converting script | labs/12_i2c_oled_display/convert.py | labs/12_i2c_oled_display/convert.py | import imageio
import sys
import os
import numpy as np
if (len(sys.argv) != 2):
print("Format: python convert.py grayscale_image_name")
sys.exit(1)
try:
data = imageio.imread(sys.argv[1])
except:
print("Wrong image name!")
sys.exit(1)
if (len(data.shape) != 2):
print("Image must be grayscale!... | Python | 0 | |
2448f1d6835129bc08855a9ecc59fea347a14243 | add re.escape for match_with_format | onlinejudge/implementation/format_utils.py | onlinejudge/implementation/format_utils.py | # Python Version: 3.x
import onlinejudge
import onlinejudge.implementation.utils as utils
import onlinejudge.implementation.logging as log
import collections
import glob
import pathlib
import re
import sys
from typing import Dict, List, Match, Optional
def glob_with_format(directory: pathlib.Path, format: str) -> Lis... | # Python Version: 3.x
import onlinejudge
import onlinejudge.implementation.utils as utils
import onlinejudge.implementation.logging as log
import collections
import glob
import pathlib
import re
import sys
from typing import Dict, List, Match, Optional
def glob_with_format(directory: pathlib.Path, format: str) -> List... | Python | 0 |
3db7c5502bcba0adbfbcf6649c0b4179b37cd74a | Create redis_board.py | simpleRaft/boards/redis_board.py | simpleRaft/boards/redis_board.py | import redis
from board import Board
class RedisBoard( Board ):
"""This will create a message board that is backed by Redis."""
def __init__( self, *args, **kwargs ):
"""Creates the Redis connection."""
self.redis = redis.Redis( *args, **kwargs )
def set_owner( self, owner ):
self.owner = own... | Python | 0.000001 | |
69fbab70f09f83e763f9af7ff02d028af62d8d89 | Create weighted_4_node_probability_convergence.py | weighted_4_node_probability_convergence.py | weighted_4_node_probability_convergence.py | # statistics on convergence_weighted_4_node.txt
# output into a csv file
import re,sys, numpy as np, pandas as pd
from pandas import Series, DataFrame
def main(argv):
author = ''
play = ''
sub = []
play_subgraph=Series()
l=''
subgraph = ''
subgraphs = []
pro = 0.0
pros = []
... | Python | 0.000003 | |
f414c122eea771da74efc5837b7bd650ec022445 | normalise - adds new ffv1/mkv script | normalise.py | normalise.py | #!/usr/bin/env python
'''
Performs normalisation to FFV1/Matroska.
This performs a basic normalisation and does not enforce any folder structure.
This supercedes makeffv1 within our workflows. This is mostly because makeffv1 imposes a specific, outdated
folder structure, and it's best to let SIPCREATOR handle the folde... | Python | 0 | |
944ec176f4d6db70f9486dddab9a6cf901d6d575 | Create MyUsefulExample.py | src/zhang/MyUsefulExample.py | src/zhang/MyUsefulExample.py | #JUST EXAMPLES
import pyspark.ml.recommendation
df = spark.createDataFrame(
... [(0, 0, 4.0), (0, 1, 2.0), (1, 1, 3.0), (1, 2, 4.0), (2, 1, 1.0), (2, 2, 5.0)],
... ["user", "item", "rating"])
als = ALS(rank=10, maxIter=5, seed=0)
model = als.fit(df)
model.rank
#10
model.userFactors.orderBy("id").collect()
#[R... | Python | 0 | |
5ba36ca805b002af63c619e17dd00400650da14b | Add script to rewrite the agents used by scc. | agent_paths.py | agent_paths.py | #!/usr/bin/env python3
from argparse import ArgumentParser
import json
import os.path
import re
import sys
from generate_simplestreams import json_dump
def main():
parser = ArgumentParser()
parser.add_argument('input')
parser.add_argument('output')
args = parser.parse_args()
paths_hashes = {}
... | Python | 0 | |
5cc627d0c0cb18e236a055ce7fceb05b63b45385 | Add flask backend file | woogle.py | woogle.py | """:mod:`woogle` --- Flask Backend for Woogle Calendar
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
from flask import Flask
app = Flask(__name__)
@app.route("/")
def calendar():
return "Hello World!"
if __name__ == "__main__":
app.run()
| Python | 0.000001 | |
f82ef484f6440c2b5b10eb144af09b770fa413c9 | Add python script for extracting server i18n msgs | .infrastructure/i18n/extract-server-msgs.py | .infrastructure/i18n/extract-server-msgs.py | import os
# Keys indicating the fn symbols that pybabel should search for
# when finding translations.
keys = '-k format -k format_time -k format_date -k format_datetime'
# Extraction
os.system("pybabel extract -F babel.cfg {} -o messages.pot .".format(keys))
os.system("pybabel init -i messages.pot -d . -o './beavy-s... | Python | 0 | |
5046ff8ba17899893a9aa30687a1ec58a6e95af2 | Add solution for Square Detector. | 2014/qualification-round/square-detector.py | 2014/qualification-round/square-detector.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
class QuizzesParser:
def __init__(self, src):
self.src = src
with open(src) as f:
self.raw = f.read().splitlines()
self.amount = int(self.raw[0])
def quizpool(self):
cur_line = 1
for i in range(self.a... | Python | 0 | |
3df4cc086bf6c85eebc12094cc3ca459bd2bcd3d | Add unit test for programmatic application and approval | project/members/tests/test_application.py | project/members/tests/test_application.py | # -*- coding: utf-8 -*-
import pytest
from members.tests.fixtures.memberlikes import MembershipApplicationFactory
from members.tests.fixtures.types import MemberTypeFactory
from members.models import Member
@pytest.mark.django_db
def test_application_approve():
mtypes = [MemberTypeFactory(label='Normal member')]
... | Python | 0 | |
b1b799c224418b1639850305a7136a3042c5e9b5 | Add station_data.py | station_data.py | station_data.py | from ftplib import FTP
import csv
import os
def unicode_csv_reader(latin1_data, **kwargs):
csv_reader = csv.reader(latin1_data, **kwargs)
for row in csv_reader:
yield [unicode(cell, "latin-1") for cell in row]
def get_station_data():
filename = "/tmp/station_list.txt"
# remove old filename
... | Python | 0 | |
1a682405904dcc711d889881d6a216b3eff9e1dd | remove off method from status light | status_light.py | status_light.py | import time
import config
import RPi.GPIO as GPIO
class StatusLight(object):
"""available patterns for the status light"""
patterns = {
'on' : (.1, [True]),
'off' : (.1, [False]),
'blink_fast' : (.1, [False, True]),
'blink' : (.1, [False, False, False, True, True, True, True,... | import time
import config
import RPi.GPIO as GPIO
class StatusLight(object):
"""available patterns for the status light"""
patterns = {
'on' : (.1, [True]),
'off' : (.1, [False]),
'blink_fast' : (.1, [False, True]),
'blink' : (.1, [False, False, False, True, True, True, True,... | Python | 0.000001 |
f4d94c48c5cf5d999c39d8d6c6dbab72a827fec2 | Add an example | example/cifer10.py | example/cifer10.py | #!/usr/bin/env python3
import argparse
import logging
import json
import matplotlib
matplotlib.use('Agg') # noqa / this should be before numpy/chainer
from chainer.ya.utils import rangelog, SourceBackup, ArgumentBackup, FinalRequest, SlackPost, SamplePairingDataset # noqa
import chainer
from chainer import function... | Python | 0 | |
aa292c2f180ffcfdfc55114750f22b6c8790a69b | Add Jaro-Winkler distance based on code on RosettaCode | pygraphc/similarity/RosettaJaroWinkler.py | pygraphc/similarity/RosettaJaroWinkler.py | from __future__ import division
from itertools import combinations
from time import time
def jaro(s, t):
s_len = len(s)
t_len = len(t)
if s_len == 0 and t_len == 0:
return 1
match_distance = (max(s_len, t_len) // 2) - 1
s_matches = [False] * s_len
t_matches = [False] * t_len
ma... | Python | 0.000004 | |
2674aa95c69c6e0fe0d8fd71d9116150cfab6507 | add xdawn decoding example | examples/decoding/plot_decoding_xdawn_meg.py | examples/decoding/plot_decoding_xdawn_meg.py | """
=============================
XDAWN Decoding From MEG data
=============================
ERF decoding with Xdawn. For each event type, a set of spatial Xdawn filters
are trained and apply on the signal. Channels are concatenated and rescaled to
create features vectors that will be fed into a Logistic Regression.
... | Python | 0.000001 | |
34986c7bfd1d4634861a5c4b54cf90ef18090ff4 | test versions of required libs across different places | spacy/tests/test_requirements.py | spacy/tests/test_requirements.py | import re
from pathlib import Path
def test_build_dependencies(en_vocab):
libs_ignore_requirements = ["pytest", "pytest-timeout", "mock", "flake8", "jsonschema"]
libs_ignore_setup = ["fugashi", "natto-py", "pythainlp"]
# check requirements.txt
root_dir = Path(__file__).parent.parent.parent
req_fi... | Python | 0 | |
08b4e97d3e3bcf07bdc8b0e0c02ce5d29fe5ee9e | Create battleship.py | battleship.py | battleship.py | from random import randint
from random import randrange
ships = 0
board = []
BuiltShips = {}
board_size = int(input("How big would you like the board to be?"))
for x in range(board_size):
board.append(["O"] * board_size)
def print_board(board):
for row in board:
print(" ".join(row))
class BattleShip(... | Python | 0.000038 | |
13959dbce03b44f15c4c05ff0715b7d26ff6c0fa | Add a widget. | python/tkinter/python3/animation_print.py | python/tkinter/python3/animation_print.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2016 Jérémie DECOCK (http://www.jdhp.org)
# 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 witho... | Python | 0 | |
1372a374b02d5e1d01b1569c71f84bdb71fb1296 | Update handler.py | tendrl/node_agent/message/handler.py | tendrl/node_agent/message/handler.py | import os
from io import BlockingIOError
import sys
import struct
import traceback
import gevent.event
import gevent.greenlet
from gevent.server import StreamServer
from gevent import socket
from gevent.socket import error as socket_error
from gevent.socket import timeout as socket_timeout
from tendrl.commons.messa... | import os
from io import BlockingIOError
import sys
import traceback
import gevent.event
import gevent.greenlet
from gevent.server import StreamServer
from gevent import socket
from gevent.socket import error as socket_error
from gevent.socket import timeout as socket_timeout
from tendrl.commons.message import Mess... | Python | 0.000001 |
49253451d65511713cd97a86c7fe54e64b3e80a9 | Add a separate test of the runtest.py --qmtest option. | test/runtest/qmtest.py | test/runtest/qmtest.py | #!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | Python | 0 | |
0c2fb46c977d8d8ee03d295fee8ddf37cee8cc06 | Add script to calculate recalls of track zip files. | tools/stats/zip_track_recall.py | tools/stats/zip_track_recall.py | #!/usr/bin/env python
from vdetlib.utils.protocol import proto_load, proto_dump, track_box_at_frame
from vdetlib.utils.common import iou
import argparse
import numpy as np
import glob
import cPickle
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('vid_file')
parser.add_ar... | Python | 0 | |
3ee41b704e98e143d23eb0d714c6d79e8d6e6130 | Write test for RequestTypeError | tests/web/test_request_type_error.py | tests/web/test_request_type_error.py | import unittest
from performance.web import RequestTypeError
class RequestTypeErrorTestCase(unittest.TestCase):
def test_init(self):
type = 'get'
error = RequestTypeError(type)
self.assertEqual(type, error.type)
def test_to_string(self):
type = 'get'
error = RequestTyp... | Python | 0.000004 | |
125a6714d1c4bda74a32c0b2fc67629ef2b45d7a | 6-2 lucky_number | 06/lucky_number.py | 06/lucky_number.py | friend = {'dwq': '5', 'bql': '3','xx': '28', 'txo':'44', 'fw':'2'}
print(friend['dwq'])
print(friend['bql'])
print(friend['xx'])
print(friend['txo'])
print(friend['fw'])
| Python | 0.998787 | |
00e75bc59dfec20bd6b96ffac7d17da5760f584c | Add Slack integration | hc/api/migrations/0012_auto_20150930_1922.py | hc/api/migrations/0012_auto_20150930_1922.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('api', '0011_notification'),
]
operations = [
migrations.AlterField(
model_name='channel',
name='kind... | Python | 0.000001 | |
f92d06346b3d28513c5f5b9833dbf5a4d48c3e46 | Create rot_alpha.py | rot_alpha.py | rot_alpha.py | #!/usr/bin/env python
from string import uppercase, lowercase, maketrans
import sys
class ROTAlpha():
def rot_alpha(self, data, rot):
upper = ''.join([uppercase[(i+rot)%26] for i in xrange(26)])
lower = ''.join([lowercase[(i+rot)%26] for i in xrange(26)])
table = maketrans(uppercase + lowercase, upper... | Python | 0.000078 | |
d96acd58ecf5937da344942f387d845dc5b26871 | Add db tests | test/test_db.py | test/test_db.py | from piper.db import DbCLI
import mock
import pytest
class DbCLIBase(object):
def setup_method(self, method):
self.cli = DbCLI()
self.ns = mock.Mock()
self.config = mock.Mock()
class TestDbCLIRun(DbCLIBase):
def test_plain_run(self):
self.cli.init = mock.Mock()
ret =... | Python | 0 | |
83afa054e3bee18aba212394973978fd49429afa | Create test_ratings.py | test_ratings.py | test_ratings.py | #!/usr/bin/env python3.5
import sys
import re
import os
import csv
from extract_toc import parseargs
from get_ratings import Ratings, Ratings2
def nvl(v1,v2):
if v1:
return v1
else:
return v2
def process_ratings_for_file(ratings, filename):
ratings.process_file(filename)
ratings.map_ratings()
impr... | Python | 0.000015 | |
f804300765f036f375768e57e081b070a549a800 | Add test script with only a few packages | test-extract-dependencies.py | test-extract-dependencies.py | from dependencies import extract_package
import xmlrpc.client as xmlrpclib
import random
client = xmlrpclib.ServerProxy('http://pypi.python.org/pypi')
packages = ['gala', 'scikit-learn', 'scipy', 'scikit-image', 'Flask']
random.shuffle(packages)
for i, package in enumerate(packages):
extract_package(package, to='t... | Python | 0 | |
7de55b168a276b3d5cdea4d718680ede46edf4d8 | Create file to test thinc.extra.search | thinc/tests/unit/test_beam_search.py | thinc/tests/unit/test_beam_search.py | from ...extra.search import MaxViolation
def test_init_violn():
v = MaxViolation()
| Python | 0 | |
38b839405f9976df2d63c08d3c16441af6cdebd1 | Add test | test/selenium/src/tests/test_risk_threats_page.py | test/selenium/src/tests/test_risk_threats_page.py | # Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: jernej@reciprocitylabs.com
# Maintained By: jernej@reciprocitylabs.com
"""All smoke tests relevant to risks/threats page"""
import pytest # pyl... | Python | 0.000005 | |
3d6f78447175d7f34e2eaedc2b0df82acb1e0e0e | Add a simple script I used to grep all SVN sources for control statements. | tools/dev/find-control-statements.py | tools/dev/find-control-statements.py | #!/usr/bin/python
#
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "Li... | Python | 0.006384 | |
f00c22f79d8f1cd210830957e6c79d75638c7c5b | add test for role | tests/k8s/test_role.py | tests/k8s/test_role.py | #!/usr/bin/env python
# -*- coding: utf-8
# Copyright 2017-2019 The FIAAS 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
#
# Unle... | Python | 0 | |
51030039f68d0dc4243b6ba125fb9b7aca44638d | Add Pipeline tests | test/data/test_pipeline.py | test/data/test_pipeline.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import torchtext.data as data
from ..common.torchtext_test_case import TorchtextTestCase
class TestPipeline(TorchtextTestCase):
@staticmethod
def repeat_n(x, n=3):
"""
Given a sequence, repeat it n times.
"""
retu... | Python | 0.000001 | |
ca4f6e72c152f975c8bf01b920bcbdb3b611876b | add script to save_segment to disk | scripts/save_segment.py | scripts/save_segment.py | '''
IDAPython script that saves the content of a segment to a file.
Prompts the user for:
- segment name
- file path
Useful for extracting data from memory dumps.
Author: Willi Ballenthin <william.ballenthin@fireeye.com>
Licence: Apache 2.0
'''
import logging
from collections import namedtuple
import idaapi
impo... | Python | 0 | |
369eed75c8a2fdc916885344fabb14e116bb60f9 | add datatype test | tests/test_datatype.py | tests/test_datatype.py | # encoding: utf-8
from unittest import TestCase
from statscraper import Datatype, NoSuchDatatype
class TestDatatype(TestCase):
def test_datatype(self):
dt = Datatype("str")
self.assertTrue(str(dt) == "str")
def test_datatype_with_values(self):
dt = Datatype("region")
self.as... | Python | 0.000002 | |
9f7a8e01f7897e8979997b8845a9ace3f64d5412 | Add more tests | tests/test_generate.py | tests/test_generate.py | import pytest
from nlppln.generate import to_bool
def test_to_bool_correct():
assert to_bool('y') == True
assert to_bool('n') == False
def test_to_bool_error():
with pytest.raises(ValueError):
to_bool('foo')
| Python | 0 | |
2cd1ab91ca48b8a8d34eabcc2a01b4014a97bcf6 | add unit tests | test/test_ncompress.py | test/test_ncompress.py | import shutil
import subprocess
from io import BytesIO
import pytest
from ncompress import compress, decompress
@pytest.fixture
def sample_data():
chars = []
for i in range(15):
chars += [i * 16] * (i + 1)
chars += [0, 0, 0]
return bytes(chars)
@pytest.fixture
def sample_compressed(sample_d... | Python | 0.000001 | |
c297de3964c53beffdf33922c0bffd022b376ae6 | Create __init__.py | crawl/__init__.py | crawl/__init__.py | Python | 0.000429 | ||
405385e1c840cd8a98d6021358c603964fa8d0d3 | Create simulator.py | simulator.py | simulator.py | import numpy as np
import random
from naive_selector import NaiveSelector
from bayesian_selector import BayesianSelector
from multiarm_selector import MultiarmSelector
NUM_SIM = 30
NUM_USERS = 1000
def coin_flip(prob_true):
if random.random() < prob_true:
return True
else:
return False
de... | Python | 0.000001 | |
ccf21faf0110c9c5a4c28a843c36c53183d71550 | add missing file | pyexcel_xls/__init__.py | pyexcel_xls/__init__.py | """
pyexcel_xls
~~~~~~~~~~~~~~~~~~~
The lower level xls/xlsm file format handler using xlrd/xlwt
:copyright: (c) 2015-2016 by Onni Software Ltd
:license: New BSD License
"""
from pyexcel_io.io import get_data as read_data, isstream, store_data as write_data
def get_data(afile, file_type=None, **... | Python | 0.000003 | |
5c4ed354d1bfd5c4443cc031a29e6535b2063178 | add test-env | sikuli-script/src/test/python/test-env.py | sikuli-script/src/test/python/test-env.py | from __future__ import with_statement
from sikuli.Sikuli import *
print Env.getOS(), Env.getOSVersion()
print "MAC?", Env.getOS() == OS.MAC
print Env.getMouseLocation()
| Python | 0 | |
1828f7bb8cb735e755dbcb3a894724dec28748cc | add sort file | sort/sort.py | sort/sort.py | #!/usr/bin/env python
# -*- coding:utf-8 -*-
from __future__ import division
from __future__ import unicode_literals
from __future__ import print_function
| Python | 0.000001 | |
fbd6db138ce65825e56a8d39bf30ed8525b88503 | Add exception handler for db not found errors. | resources/middlewares/db_not_found_handler.py | resources/middlewares/db_not_found_handler.py | import falcon
def handler(ex, req, resp, params):
raise falcon.HTTPNotFound()
| Python | 0 | |
a1eaf66efa2041849e906010b7a4fb9412a9b781 | Add instance method unit tests | tests/test_instancemethod.py | tests/test_instancemethod.py | # Imports
import random
import unittest
from funky import memoize, timed_memoize
class Dummy(object):
@memoize
def a(self):
return random.random()
class TestInstanceMethod(unittest.TestCase):
def test_dummy(self):
dummy = Dummy()
v1 = dummy.a()
v2 = dummy.a()
dumm... | Python | 0.000001 | |
c3221d70f829dc2968ebfb1a47efd9538a1ef59f | test gaussian + derivatives | tests/vigra_compare.py | tests/vigra_compare.py | import fastfilters as ff
import numpy as np
import sys
try:
import vigra
except ImportError:
print("WARNING: vigra not available - skipping tests.")
with open(sys.argv[1], 'w') as f:
f.write('')
exit()
a = np.random.randn(1000000).reshape(1000,1000)
for order in [0,1,2]:
for sigma in [1.0, 5.0, 10.0]:
res_... | Python | 0.000002 | |
8ec1d35fe79554729e52aec4e0aabd1d9f64a9c7 | Put main.py display functions in its own module so they can be used in other parts of the package | fire_rs/display.py | fire_rs/display.py | from mpl_toolkits.mplot3d import Axes3D
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.colors import LightSource
from matplotlib.ticker import FuncFormatter
from matplotlib import cm
def get_default_figure_and_axis():
fire_fig = plt.figure()
fire_ax = fire_fig.gca(aspect='equal', xlabel="X ... | Python | 0 | |
b50a85bb93e1e33babb6bc1c7888a22f2bde68de | Add a more reusable document writer class | docs/docs_writer.py | docs/docs_writer.py | import os
class DocsWriter:
"""Utility class used to write the HTML files used on the documentation"""
def __init__(self, filename, type_to_path_function):
"""Initializes the writer to the specified output file,
creating the parent directories when used if required.
'type_to_pat... | Python | 0.000002 | |
b17252a0b1becfda77e4244cf48c2fb9f868c03b | add method to pregenerate html reports | src/bat/generateuniquehtml.py | src/bat/generateuniquehtml.py | #!/usr/bin/python
## Binary Analysis Tool
## Copyright 2012 Armijn Hemel for Tjaldur Software Governance Solutions
## Licensed under Apache 2.0, see LICENSE file for details
'''
This is a plugin for the Binary Analysis Tool. It takes the output of hexdump -Cv
and writes it to a file with gzip compression. The output ... | Python | 0 | |
78f730b405c6e67988cdc9efab1aa5316c16849f | Add initial test for web response | tests/test_web_response.py | tests/test_web_response.py | import unittest
from unittest import mock
from aiohttp.web import Request, StreamResponse
from aiohttp.protocol import Request as RequestImpl
class TestStreamResponse(unittest.TestCase):
def make_request(self, method, path, headers=()):
self.app = mock.Mock()
self.transport = mock.Mock()
... | Python | 0 | |
644a678d3829513361fdc099d759ca964100f2e6 | Add script to replace text | text-files/replace-text.py | text-files/replace-text.py | #!/usr/bin/env python3
# This Python 3 script replaces text in a file, in-place.
# For Windows, use:
#!python
import fileinput
import os
import sys
def isValidFile(filename):
return (filename.lower().endswith('.m3u') or
filename.lower().endswith('.m3u8'))
def processFile(filename):
'''Makes cust... | Python | 0.000003 | |
8d8f6b99357912fa9a29098b0744712eeb1d4c70 | Add coder/decoder skeleton | src/coder.py | src/coder.py | from bitarray import bitarray
from datetime import datetime, timedelta
def decode():
with open() as f:
timestamps = []
start = [0, 0, 0]
end = [1, 1, 1]
delta = timedelta(seconds=1)
for line in f:
ts = line.split(" ", 1)[0]
ts = datetime.strptime(ts, ... | Python | 0.000004 | |
3c18ace928b0339b0edf4763f4132d327936cbe8 | add utils | src/utils.py | src/utils.py | def set_trace():
from IPython.core.debugger import Pdb
import sys
Pdb(color_scheme='Linux').set_trace(sys._getframe().f_back)
def plot_ROC(actual, predictions):
# plot the FPR vs TPR and AUC for a two class problem (0,1)
import matplotlib.pyplot as plt
from sklearn.metrics import roc_curve, auc
false_... | Python | 0.000004 | |
0bca09339bb49e4540c5be8162e11ea3e8106200 | Create a PySide GUI window. | budget.py | budget.py | #!/usr/bin/env python
import sys
from PySide import QtGui
app = QtGui.QApplication(sys.argv)
wid = QtGui.QWidget()
wid.resize(250, 150)
wid.setWindowTitle('Simple')
wid.show()
sys.exit(app.exec_())
| Python | 0 | |
c02b8011b20e952460a84b7edf1b44fcb0d07319 | add re07.py | trypython/stdlib/re_/re07.py | trypython/stdlib/re_/re07.py | """
正規表現のサンプルです
部分正規表現(「(」と「)」)のグルーピングについて
REFERENCES:: http://bit.ly/2TVtVNY
http://bit.ly/2TVRy8Z
http://bit.ly/2TWQQs4
"""
import re
from trypython.common.commoncls import SampleBase
from trypython.common.commonfunc import pr
from trypython.stdlib.re_ import util
class Sample(SampleBas... | Python | 0 | |
19a23591b9b21cbe7dd34c8be7d2cb435c0f965a | generate XML works | umpa/extensions/XML.py | umpa/extensions/XML.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2008 Adriano Monteiro Marques.
#
# Author: Bartosz SKOWRON <getxsick at gmail dot com>
#
# This library is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Softwa... | Python | 0.999372 | |
4ff319033277bbaa04b1e226f9a90232ecadd49d | Trying out the potential new name, Spectra | cronenberg/config.py | cronenberg/config.py | DEBUG = True
DEFAULT_FROM_TIME = '-3h'
DEFAULT_THEME = 'light'
DASHBOARD_APPNAME = 'Spectra'
SQLALCHEMY_DATABASE_URI = 'sqlite:///cronenberg.db'
GRAPHITE_URL = 'http://graphite.prod.urbanairship.com'
SERVER_ADDRESS = '0.0.0.0'
SERVER_PORT ... | DEBUG = True
DEFAULT_FROM_TIME = '-3h'
DEFAULT_THEME = 'light'
DASHBOARD_APPNAME = 'Cronenberg'
SQLALCHEMY_DATABASE_URI = 'sqlite:///cronenberg.db'
GRAPHITE_URL = 'http://graphite.prod.urbanairship.com'
SERVER_ADDRESS = '0.0.0.0'
SERVER_PO... | Python | 0.999999 |
bc28f6ab7ba5bb5e82bf38c544a4d091d89973ea | Use servoblaster to control servo | candycrush.py | candycrush.py | #!/usr/bin/env python
import os.path
import subprocess
import time
def scaler(OldMin, OldMax, NewMin, NewMax):
def fn(OldValue):
return (((OldValue - OldMin) * (NewMax - NewMin)) / (OldMax - OldMin)) + NewMin
return fn
def setup_servod():
if not os.path.exists("/dev/servoblaster"):
subproc... | Python | 0.000001 | |
26595ad3dd7dcd9dfd16ae551345db9b7e58412a | Add updater | updater/openexchangerates.py | updater/openexchangerates.py | #!env/bin/python
import urllib2
import simplejson
import datetime
APP_ID = "40639356d56148f1ae26348d670e889f"
TARGET_URL = "http://taggy-api.bx23.net/api/v1/currency/"
def main():
print 'Getting rates...'
request = urllib2.Request("http://openexchangerates.org/api/latest.json?app_id=%s" % (APP_ID))
opener... | Python | 0 | |
3ef4fdcc98a12111aee6f0d214af98ef68315773 | add reboot module | gozerlib/reboot.py | gozerlib/reboot.py | # gozerbot/utils/reboot.py
#
#
"""
reboot code.
"""
## gozerlib imports
from gozerlib.fleet import fleet
from gozerlib.config import cfg as config
## basic imports
from simplejson import dump
import os
import sys
import pickle
import tempfile
def reboot():
"""
reboot the bot.
.. liter... | Python | 0.000001 | |
edec2fc1f57c31e15793fd56b0f24bb58ba345d9 | Create evalFunctionsLib.py | evalFunctionsLib.py | evalFunctionsLib.py | def plot_stream(stream, data, r):
"""
Plots the values of a specific stream over time.
Inputs: stream - an int indicating the index of the desired stream
data - An array of all sensor data
r = a RAVQ object
Returns: The number of -1s (indicating invalid data) in this stream
"""
values = ... | Python | 0.000002 | |
3c37f63f65a9d85c605dde55ae19c8d5d62ad777 | 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 | |
2100eb3e0a72395f23571c6be2bada9939739869 | add ex | checkDigit.py | checkDigit.py | #-*-coding:UTF-8 -*-
#
# 判斷輸入是否為整數(int)
input_string = input('Please input n:')
#while input_string.isdigit() == False:
while not input_string.isdigit():
print("Error, %s is not digit!" % input_string)
input_string = input('Please input n:')
print("%s is digit!" % input_string)
| Python | 0.00024 | |
09592b081a68f912bf9bb73c5269af8398c36f64 | Add unit test for treating Ordering as a collection | tests/test_collection.py | tests/test_collection.py | from unittest import TestCase
from ordering import Ordering
class TestOrderingAsCollection(TestCase):
def setUp(self) -> None:
self.ordering = Ordering[int]()
self.ordering.insert_start(0)
for n in range(10):
self.ordering.insert_after(n, n + 1)
def test_length(self) -> N... | Python | 0 | |
6f1ed2fcdd43a5237d0211b426a216fd25930734 | add test preprocess | tests/test_preprocess.py | tests/test_preprocess.py | # coding: utf-8
code = '''
n = 10
for i in range(0,n):
x = 2 * i
y = x / 3
# a comment
if y > 1:
print(y)
for j in range(0, 3):
x = x * y
y = x + 1
if x > 1:
print(x)
'''
code = '''
#$ header legendre(int)
def legendre(p):
k = p + 1
x = zeros(k,... | Python | 0.000001 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.