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 |
|---|---|---|---|---|---|---|---|
5dd9cc55368e9f5bd8c79f74f3c7c1fc84a6bd8b | Add common migration (unrelated to branch) | common/migrations/0010_auto_20200529_0514.py | common/migrations/0010_auto_20200529_0514.py | # Generated by Django 2.2.12 on 2020-05-29 05:14
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('common', '0009_upload_hosting'),
]
operations = [
migrations.AlterField(
model_name='upload',
name='destination',
... | Python | 0 | |
f53488e3c797afb4f47f005e078d53a3bea14715 | add solution for Combination Sum III | algorithms/combinationSumIII/combinationSumIII.py | algorithms/combinationSumIII/combinationSumIII.py | class Solution:
# @param {integer} k
# @param {integer} n
# @return {integer[][]}
def combinationSum3(self, k, n):
return [arr for arr in ([j+1 for j in xrange(10) if i & (1 << j)]
for i in xrange(1, 512) if bin(i).count('1') == k)
if sum(arr) == ... | Python | 0.000007 | |
fedb80cf8ee5859e1d8f5caccc7a67ae979e743e | Remove unnecessary grit_out_dir variable from component_strings.gyp. | components/component_strings.gyp | components/component_strings.gyp | # 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.
{
'targets': [
{
'target_name': 'component_strings',
'type': 'none',
'actions': [
{
'action_name': 'component_s... | # 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.
{
'variables': {
'grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/components',
},
'targets': [
{
'target_name': 'component_strings',
... | Python | 0.000166 |
6307a8a813062b3faad6b0f393d1886d4ad9bed8 | add initial date for committees | application/migrations/0019_auto_20150316_2009.py | application/migrations/0019_auto_20150316_2009.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from application.models import Committee
def add_committees(apps, schema_editor):
committees = [
'Fundraising and Social Action',
'Membership',
'Social Functions',
'Archivist an... | Python | 0.000011 | |
fa0afad07f34f350233ae2a4f1654faef9bc1814 | Add a python version for the phonebook benchmark | utils/benchmark/Strings/PySort.py | utils/benchmark/Strings/PySort.py |
words=[
u"James", u"John", u"Robert", u"Michael", u"William", u"David", u"Richard", u"Joseph",
u"Charles", u"Thomas", u"Christopher", u"Daniel", u"Matthew", u"Donald", u"Anthony",
u"Paul", u"Mark", u"George", u"Steven", u"Kenneth", u"Andrew", u"Edward", u"Brian",
u"Joshua", u"Kevin", u"Ronald", u"Timothy", u"Jason... | Python | 0.000001 | |
a041fd28a600341e893f87687bddadec3c6c0e36 | add confirm.py (incomplete) | device/confirm.py | device/confirm.py | #!/usr/bin/python
"""
Run a confirmation screen in a separate process.
"""
import multiprocessing
import sys
import os
import time
import inspect
import pygame
from pygame.locals import *
from evdev import InputDevice, list_devices
class ConfirmScreenController(object):
def __init__(self, fullscreen=False):
... | Python | 0 | |
5c063b06a35fef646a45b52f0d414c818b1d0993 | Remove the dependency to dbus-glib from device.gyp. | device/device.gyp | device/device.gyp | # 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.
{
'variables': {
},
'targets': [
{
'target_name': 'device_bluetooth',
'type': '<(library)',
'dependencies': [
'../c... | # 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.
{
'variables': {
},
'targets': [
{
'target_name': 'device_bluetooth',
'type': '<(library)',
'dependencies': [
'../c... | Python | 0.000064 |
22e3933f6a9ff6c424d1a1f6d225f32c234359c5 | add leetcode Pascal's Triangle II | leetcode/PascalTriangleII/solution.py | leetcode/PascalTriangleII/solution.py | # -*- coding:utf-8 -*-
class Solution:
# @return a list of integers
def getRow(self, rowIndex):
if rowIndex == 0:
return [1]
ret = [1]
begin = 1
while rowIndex > 0:
ret.append(ret[-1] * rowIndex / begin)
rowIndex -= 1
begin += 1
... | Python | 0.001927 | |
8deb311e6196c618f9ae3f18d18c1827407b8b96 | Add a snippet. | python/pyside/pyside6/widget_QSqlTableModel_sqlite_from_file.py | python/pyside/pyside6/widget_QSqlTableModel_sqlite_from_file.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Ref: http://doc.qt.io/qt-5/modelview.html#2-1-a-read-only-table
import sys
from PySide6 import QtCore, QtWidgets
from PySide6.QtCore import Qt
from PySide6.QtWidgets import QApplication, QTableView
from PySide6.QtSql import QSqlDatabase, QSqlQuery, QSqlTableModel
# ... | Python | 0.000002 | |
1fe2e3b2ed933f22ce128ca1ea8c728981009a44 | Add squashed migration | billjobs/migrations/0002_service_is_available_squashed_0005_bill_issuer_address_default.py | billjobs/migrations/0002_service_is_available_squashed_0005_bill_issuer_address_default.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-03-21 16:55
from __future__ import unicode_literals
from django.db import migrations, models
from billjobs.settings import BILLJOBS_BILL_ISSUER
class Migration(migrations.Migration):
replaces = [('billjobs', '0002_service_is_available'), ('billjobs', '... | Python | 0.000002 | |
fb41c5295d867dc9ac6ec64da3646246c897e109 | add running time of algorithms | src/algorithms/arrays_and_sorting/running_time_of_algorithms.py | src/algorithms/arrays_and_sorting/running_time_of_algorithms.py | number = input()
number_array = [(int)(x) for x in raw_input().split()]
total = 0
for i in range(1, number):
for j in range(i):
ii = number_array[i]
jj = number_array[j]
if ii < jj:
total += i - j
number_array = number_array[:j] + [ii] + [jj] + number_array[j+1:i] + number_array[i+1:]
break
print tot... | Python | 0.000162 | |
1f062298a68aaf6a4161279c539caed07816f1a8 | Add tests for influxdb/alarm_state_history_repository.py | monasca_persister/tests/test_influxdb_alarm_state_history_repository.py | monasca_persister/tests/test_influxdb_alarm_state_history_repository.py | # (C) Copyright 2019 Fujitsu Limited
#
# 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 writi... | Python | 0.000001 | |
1cd457765727a0a65d02ddc9ea164af4913448c6 | Create a python file | InternetOfThings101/main.py | InternetOfThings101/main.py | import time
import sys
import signal
def interruptHandler(signal, frame):
sys.exit(0)
if __name__ == '__main__':
signal.signal(signal.SIGINT, interruptHandler)
while True:
print "Hello Internet of Things 101"
time.sleep(5)
# End of File
| Python | 0 | |
2e9f43d1c1679355e2d7d452137ddf7fb2bbdedf | Test Basic.Publish -> Basic.Get message passing | tests/async-send-get-test.py | tests/async-send-get-test.py | #!/usr/bin/env python
"""
Send a message and confirm you can retrieve it with Basic.Get
Test Steps:
1) Connect to broker - start_test
2) Open Channel - on_connected
3) Delcare Queue - on_channel_open
4) Send test message - on_queue_declared
5) Call basic get - on_queue_declared
6) Validate t... | Python | 0 | |
2cb8f7b2df2583c9fdb545744adad2386b4ee7f3 | Add test for issue #2465 - tuple subsclass subscript | tests/basics/subscr_tuple.py | tests/basics/subscr_tuple.py | # subscripting a subclassed tuple
class Foo(tuple):
pass
foo = Foo((1,2))
foo[0]
| Python | 0 | |
7d46f6e714be4b53a800c72f800d400ef6b280c4 | add tests for core functions | tests/test_core_functions.py | tests/test_core_functions.py | from pygelf import gelf
import json
import zlib
import struct
import pytest
@pytest.mark.parametrize('compress', [True, False])
def test_pack(compress):
message = {'version': '1.1', 'short_message': 'test pack'}
packed_message = gelf.pack(message, compress)
unpacked_message = zlib.decompress(packed_messag... | Python | 0 | |
2c665dbcb90785b9754f89cb6a0d3d9c3ffddc95 | Add test | tests/test_proxy_nca_loss.py | tests/test_proxy_nca_loss.py | # -*- coding: utf-8 -*-
"""
Created on Tue Feb 07 19:23:18 2017
@author: sakurai
"""
import unittest
import numpy as np
import chainer
from chainer import cuda
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
import chainer.functions as F
from deep_metric_learning.li... | Python | 0.000005 | |
703a5556174706db330c8d2e426471e490a00cef | Switch rottentomatoes to xfail rather than skip test. | tests/test_rottentomatoes.py | tests/test_rottentomatoes.py | from __future__ import unicode_literals, division, absolute_import
import pytest
class TestRottenTomatoesLookup(object):
config = """
tasks:
test:
mock:
# tests search
- {title: 'Toy Story'}
- {title: 'The Matrix'}
- {title: '... | from __future__ import unicode_literals, division, absolute_import
from nose.plugins.skip import SkipTest
class TestRottenTomatoesLookup(object):
config = """
tasks:
test:
mock:
# tests search
- {title: 'Toy Story'}
- {title: 'The Matrix'}... | Python | 0 |
ecdda7cf81cb3feb353a1d62441eff92aed082af | Add aggregationtypes to routes | iatidataquality/aggregationtypes.py | iatidataquality/aggregationtypes.py |
# IATI Data Quality, tools for Data QA on IATI-formatted publications
# by Mark Brough, Martin Keegan, Ben Webb and Jennifer Smith
#
# Copyright (C) 2013 Publish What You Fund
#
# This programme is free software; you may redistribute and/or modify
# it under the terms of the GNU Affero General Public License v3... | Python | 0.000001 | |
e7e51333133dd561e8a746144c29c6635d8a982a | Add migration to add column for proposal image filename | migrations/versions/320f4eb0698b_add_proposal_image.py | migrations/versions/320f4eb0698b_add_proposal_image.py | """add proposal image
Revision ID: 320f4eb0698b
Revises: 26ef95fc6f2c
Create Date: 2015-03-31 15:55:20.062624
"""
# revision identifiers, used by Alembic.
revision = '320f4eb0698b'
down_revision = '26ef95fc6f2c'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alemb... | Python | 0 | |
4990f7c761382654c7577e8c23527ea3c1f8a773 | Patch for saving the pose | models/tridimensional/docking_validation/mutate_pdb.py | models/tridimensional/docking_validation/mutate_pdb.py | import os
from rosetta import *
from toolbox import mutate_residue
def mutate_pose(pose, mutations):
"""Applies list of mutations to the given template pose and returns a mutated version
Args:
pose: PyRosetta Pose() object representing a loaded pdb structure
mutations: list of amino acid swap... | import os
from rosetta import *
from toolbox import mutate_residue
def mutate_pose(pose, mutations):
"""Applies list of mutations to the given template pose and returns a mutated version
Args:
pose: PyRosetta Pose() object representing a loaded pdb structure
mutations: list of amino acid swap... | Python | 0 |
0b5d724607aa25654853d29245736794da4db21f | Adding wtcmatrix convert scores to matrix | bregman/examples/WTCexamples/wtcmatrix.py | bregman/examples/WTCexamples/wtcmatrix.py | """
wtcmatrix - convert list of scores into matrix form
Requires:
Music21 version 1.4.0+ - web.mit.edu/music21/
BregmanToolkit - https://github.com/bregmanstudio/BregmanToolkit
2015, Michael A. Casey, Dartmouth College, Bregman Media Labs
License:
Creative Commons Attributio... | Python | 0.999874 | |
2233b8cb2e59e4304492b60eb9842962130e14c2 | Create NoisyNeighborsClosedForm.py | NoisyNeighborsClosedForm.py | NoisyNeighborsClosedForm.py | # Google Code Jam
# Google Code Jam 2015
# Round 1B
# Problem B. Noisy Neighbors
# Closed form solution O(1)
from math import ceil
testCaseFile = open("NoisyNeighbors_B-large-practice.in", "r")
lines = testCaseFile.read().split('\n')
n = int(lines[0])
testCases = [0 for x in range(n)]
class TestCase:
def __init... | Python | 0 | |
f39947677bc2eaf15a0a9d5ef976a29905b23339 | Add AirQuality notification | PushAirQuality.py | PushAirQuality.py | from twitter import *
from pushbullet import PushBullet
import config
CONSUMER_KEY = config.twitter_consumer_key
CONSUMER_SECRET = config.twitter_consumer_secret
OAUTH_TOKEN = config.twitter_oauth_token
OAUTH_SECRET = config.twitter_oauth_secret
pb_api_key = config.pb_api_key
twitter = Twitter(auth=OAuth(
OAUTH_TOKE... | Python | 0 | |
d4b86bc3b4440d665eb8119828a9ffe241b321a6 | Update 24-game.py | Python/24-game.py | Python/24-game.py | # Time: O(n^3 * 4^n), n = 4
# Space: O(n^2)
from fractions import Fraction
from operator import *
class Solution(object):
def judgePoint24(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""
def dfs(nums):
if len(nums) == 1:
return nums[0] =... | # Time: O(n^3 * 4^n)
# Space: O(n^2)
from fractions import Fraction
from operator import *
class Solution(object):
def judgePoint24(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""
def dfs(nums):
if len(nums) == 1:
return nums[0] == 24
... | Python | 0 |
aa212ffb28d48835c788199ec9f5a09bf83fb443 | Add a utility to reduce GlobalISel tests | utils/bugpoint_gisel_reducer.py | utils/bugpoint_gisel_reducer.py | #!/usr/bin/env python
"""Reduces GlobalISel failures.
This script is a utility to reduce tests that GlobalISel
fails to compile.
It runs llc to get the error message using a regex and creates
a custom command to check that specific error. Then, it runs bugpoint
with the custom command.
"""
from __future__ import pr... | Python | 0 | |
fcf0ed3c4e2deb9ce1d6a758dc18e6a03542eb59 | Add a script to find parties with multiple emblems (logos) from the EC | candidates/management/commands/candidates_parties_with_multiple_emblems.py | candidates/management/commands/candidates_parties_with_multiple_emblems.py | from django.core.management.base import BaseCommand
from candidates.popit import create_popit_api_object, popit_unwrap_pagination
class Command(BaseCommand):
def handle(self, *args, **options):
api = create_popit_api_object()
for org in popit_unwrap_pagination(
api.organizations,
... | Python | 0 | |
c06a72515cf2fddc604641b70b497f74d9ef5d78 | use vlc to set clips | vlc.py | vlc.py | #!/usr/bin/env python
import dbus
import Tkinter
import os
import pprint
import yaml
videofiles = {}
def format_time(s, fmt="{m:02d}:{s:02.0f}"):
return fmt.format(m=int(s/60), s=float(s)%60)
def current_filename():
current_video_file = props.Get("org.mpris.MediaPlayer2.Player", "Metadata")["xesam:url"].repl... | Python | 0 | |
0f6e065a70bcd1f9dd64dfa04c13cb0065e33c13 | Add basic test for navigator | src/autobot/src/navigator_test.py | src/autobot/src/navigator_test.py | #!/usr/bin/env python
import unittest
import mock
from autobot.msg import detected_object
from navigator import *
def fake_stopCar():
return True
def fake_srvTogglePathFinder(state):
return
def fake_setWallDist(dist, wall):
return
class NavigatorTest(unittest.TestCase):
@mock.patch('navigator.se... | Python | 0.000002 | |
dc72a321311f213132ef448afecbe7a0797aede8 | Fix for GLUT | vispy/app/tests/test_context.py | vispy/app/tests/test_context.py | import os
from nose.tools import assert_equal, assert_raises
from vispy.util.testing import requires_application, has_backend
from vispy.app import Canvas
from vispy.app.backends import BACKEND_NAMES
from vispy.gloo import (get_gl_configuration, VertexShader, FragmentShader,
Program, check_erro... | import os
from nose.tools import assert_equal, assert_raises
from vispy.util.testing import requires_application, has_backend
from vispy.app import Canvas
from vispy.app.backends import BACKEND_NAMES
from vispy.gloo import (get_gl_configuration, VertexShader, FragmentShader,
Program, check_erro... | Python | 0.000001 |
d11d7c38edef63e50dbd1da78a8829905a86c2a5 | Add forgotten file | bluebottle/assignments/states.py | bluebottle/assignments/states.py | from bluebottle.activities.states import ActivityStateMachine, ContributionStateMachine
from bluebottle.assignments.models import Assignment, Applicant
class AssignmentStateMachine(ActivityStateMachine):
model = Assignment
class ApplicantStateMachine(ContributionStateMachine):
model = Applicant
| Python | 0.000001 | |
98f26afc012b1ab25360738776c36b58229d0b3a | Add CLI interface. | fulltext/__main__.py | fulltext/__main__.py | """
Fulltext CLI interface.
"""
from __future__ import absolute_import
import sys
import logging
from docopt import docopt
import fulltext
def _handle_open(path):
with open(path, 'rb') as f:
return fulltext.get(f)
def main(args=sys.argv[1:]):
"""
Extract text from a file.
Usage:
... | Python | 0 | |
5666161f59a8c3efa5b3f884912f9777c9a12edd | Add the ability to get template variables from the CLI | saliere/main.py | saliere/main.py | #!/usr/bin/python3
"""Creates a skeleton for various projects based on Jinja2 templates.
Example:
$ main.py mysql -t salt-formula
$ main.py mysql-django -t django
$ main.py mysql -t salt-formula -o my-formula-directory
$ main.py mysql -t ~/my/custom/template -o my-template-directory
"""
import argpar... | #!/usr/bin/python3
"""Creates a skeleton for various projects based on Jinja2 templates.
Example:
$ main.py mysql -t salt-formula
$ main.py mysql-django -t django
$ main.py mysql -t salt-formula -o my-formula-directory
$ main.py mysql -t ~/my/custom/template -o my-template-directory
"""
import argpar... | Python | 0 |
1dc11286b21d8a84e3d1d9a194cc49275be4d97d | Add core models example factories | apps/core/factories.py | apps/core/factories.py | from factory import Faker, Iterator, SubFactory
from factory.django import DjangoModelFactory
from apps.data.factories import EntryFactory, RepositoryFactory
from . import models
class SpeciesFactory(DjangoModelFactory):
name = Faker('word')
reference = SubFactory(EntryFactory)
repository = SubFactory(R... | Python | 0 | |
b27a5127c8a98df0cdbe8715587b3d40415e32c7 | add unit tests | pypeman/tests/test_ctx_nodes.py | pypeman/tests/test_ctx_nodes.py | """
tests for pypeman.contrib.ctx
"""
import asyncio
import pytest
from pypeman.contrib.ctx import CombineCtx
from pypeman.nodes import NodeException
from pypeman.tests.pytest_helpers import clear_graph # noqa: F401
from pypeman.tests.common import generate_msg
# TODO: might refactor to another file?
from pypeman.... | Python | 0.000001 | |
38e231076209f0d71ee64bd4d60e1769aac8ce93 | add raspberry pi receiver script | power_monitor_rf24.py | power_monitor_rf24.py | #!/usr/bin/env python
# receive values from CS5460A power monitor via NRF24L01
# may need to run as sudo
# see https://github.com/zerog2k/power_meter_cs5460a for arduino transmitter code
import time as time
from RF24 import *
import RPi.GPIO as GPIO
import binascii
import struct
from datetime import datetime, date... | Python | 0 | |
3b33a9410bac5b710a52e603fd40ed88765b7414 | Create colecoes.py | colecoes/colecoes.py | colecoes/colecoes.py | from aula5.pessoa import import Pessoa
from aula6.pessoas_tipos import Homem, Mulher
if __name__=='__main__':
gomes = Homem('Gomes')
gomes_igual = Homem('Gomes')
gomes_identico=gomes
selina=Mulher('Selina')
print(gomes is gomes_igual)
print(gomes is gomes_identico)
print(gomes == gomes_ig... | Python | 0 | |
0f06b139ecfbdb05dee86b4cbda5b23c9af4379a | test private name | chap5/test_private_name_coven.py | chap5/test_private_name_coven.py | #!/usr/bin/python
# -*- indent-tabs-mode: nil; tab-width: 4 -*-
# vi: et ts=4 sts=4 sw=4
class Foo:
def __priv(self):
print "I'm private"
def main():
foo = Foo()
getattr(Foo, '_Foo__priv')(foo)
if __name__ == '__main__':
main()
| Python | 0.000011 | |
c48bf268ec7e077443ad347f007d7477d841cc04 | Add ds_binary_heap.py | ds_binary_heap.py | ds_binary_heap.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
class BinaryHeap(object):
def __init__(self):
pass
def main():
pass
if __name__ == '__main__':
main()
| Python | 0.000853 | |
7b9023dc5dcdd4ad8e1ea9c7803e81a13da42a5b | Add MNIST dataset | chainer/dataset/datasets/mnist.py | chainer/dataset/datasets/mnist.py | import gzip
import os
import struct
import numpy
import six
from six.moves.urllib import request
from chainer.dataset.datasets import tuple_dataset
from chainer.dataset import download
def get_mnist_training(withlabel=True, ndim=1, dtype=numpy.float32, scale=1.):
"""Gets the MNIST training set.
`MNIST <htt... | Python | 0.000181 | |
d0cfb59819cdb1f55115616e3600c8483f54d43f | add viz.py file | viz.py | viz.py | # -*- coding: utf-8 -*-
import math
from collections import OrderedDict
import pandas as pd
import netCDF4
from bokeh.plotting import figure, show, output_notebook
from bokeh.models import DatetimeTickFormatter, ColumnDataSource, HoverTool, Plot, Range1d
from bokeh.palettes import RdBu11
from bokeh.models.glyphs impo... | Python | 0.000001 | |
cd1c67c34768bdef0cc4649573e2541558e648ad | Add : Basic client implementation | elevator/client.py | elevator/client.py | #!/usr/bin/env python
#Copyright (c) 2011 Fabula Solutions. All rights reserved.
#Use of this source code is governed by a BSD-style license that can be
#found in the license.txt file.
# leveldb client
import zmq
import threading
import time
import ujson as json
class Elevator(object):
def __init__(self, host="tc... | Python | 0 | |
fc40c3f740f9f5dedbcddd4dcbd274c76aaba529 | Add ToS script | output/tos.py | output/tos.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""tos.py - Accept PokemonGo ToS for multiple accounts using file."""
from pgoapi import PGoApi
from pgoapi.utilities import f2i
from pgoapi import utilities as util
from pgoapi.exceptions import AuthException
import pprint
import time
import threading
import sys,... | Python | 0 | |
db4f449be99d7b66bd7c46a1a3af8b46424421c6 | Add tests for DummyCurrentPlaylistController.get_by_{id,uri} | tests/backends/get_test.py | tests/backends/get_test.py | import unittest
from mopidy.backends.dummy import DummyBackend, DummyCurrentPlaylistController
from mopidy.models import Playlist, Track
class CurrentPlaylistGetTest(unittest.TestCase):
def setUp(self):
self.b = DummyBackend()
self.c = self.b.current_playlist
def test_get_by_id_returns_unique... | Python | 0 | |
069a031ce871125fb727a5ec43f406539be0150f | add .mdown ext in check_ext | simiki/utils.py | simiki/utils.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
from os import path as osp
RESET_COLOR = "\033[0m"
COLOR_CODES = {
"debug" : "\033[1;34m", # blue
"info" : "\033[1;32m", # green
"warning" : "\033[1;33m", # yellow
"error" : "\033[1;31m", # red
"critical" : "\033... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
from os import path as osp
RESET_COLOR = "\033[0m"
COLOR_CODES = {
"debug" : "\033[1;34m", # blue
"info" : "\033[1;32m", # green
"warning" : "\033[1;33m", # yellow
"error" : "\033[1;31m", # red
"critical" : "\033... | Python | 0.000001 |
f68c673273acbc62259213ceb47bb34e7d3f87fd | Create combination_test.py | test/combination_test.py | test/combination_test.py |
def loop(array_input, com_len, head, array_output):
n= com_len-1;sign=range(head+1,head+com_len)
while(sign[n-1]<=len(array_input)-n):
core(head,sign, n,array_input,array_output)
sign=[x + 1 for x in sign]
def core(head, sign, n, array_input,array_output):
fetch=sign[n-1]
... | Python | 0.000004 | |
d4d5ef52cf7ac9f40bb8ada199b6c035690eacfa | Add tests for transmission | rpihelper/transmission/tests.py | rpihelper/transmission/tests.py | # -*- coding: utf-8 -*-
import transmissionrpc
from unittest import TestCase
from unittest.mock import patch, MagicMock
from rpihelper.transmission.logic import (
transmissionrpc_client, transmissionrpc_add_torrent,
)
__all__ = (
'TransmissionrpcClientLogicTests',
'TransmissionrpcAddTorrentLogicTests',
... | Python | 0 | |
cb1e797c6039a1677024a563852b117b581faaf2 | Add solution of problem 1 in Python | problem1/rumen.py | problem1/rumen.py | sum(filter(lambda x: x % 3 == 0 or x % 5 == 0, range(1, 1000)))
| Python | 0.998909 | |
cb82fd05c02b97bfc82668164fe3f3bb22faaade | Add fair and square | 2013/qualification_round/fair_and_square.py | 2013/qualification_round/fair_and_square.py | #!/usr/bin/env python
# Need solve time complexity
from __future__ import print_function
from collections import deque
def count_fair_and_square_numbers(a, b):
count = 0
n = a
while n <= b:
if is_fair_and_square(n):
count += 1
n += 1
return count
def is_fair_and_square(n):... | Python | 0.002189 | |
8a245ab951e1c5a72e8a14a8bb95d3f1d3a549ee | Hello World | pyexamples/conditions.py | pyexamples/conditions.py | print ('Hello World')
| Python | 0.99998 | |
463b20a1fa6740e6db2c8abac3861fa9a30f9a2e | Add Django 1.4.1 as a support version to suppress warning. | src/reversion/__init__.py | src/reversion/__init__.py | """
Transactional version control for Django models.
Developed by Dave Hall.
<http://www.etianen.com/>
"""
import django, warnings
from reversion.revisions import default_revision_manager, revision_context_manager, VersionAdapter
from reversion.admin import VersionAdmin
from reversion.models import pre_revision_com... | """
Transactional version control for Django models.
Developed by Dave Hall.
<http://www.etianen.com/>
"""
import django, warnings
from reversion.revisions import default_revision_manager, revision_context_manager, VersionAdapter
from reversion.admin import VersionAdmin
from reversion.models import pre_revision_com... | Python | 0 |
0b445c9606d30f31a6df1d99ef4d564f931014f2 | use unittest | python/calc/calc_test.py | python/calc/calc_test.py | import unittest
from calc import Calc
class CalcTest(unittest.TestCase):
def setUp(self):
print "Calc Test"
def test_add(self):
c = Calc()
x = 100
y = 200
result = 0
result = c.add(x,y)
print '{0} + {1} = {2}'.format(x, y, result)
self.assertEqual... | Python | 0.000001 | |
4972930bb42ed6d7ebc1bad2909ede1a3c213cec | Add preprocessing functions. | preprocess.py | preprocess.py | import numpy as np
"""This file contains some functions related to preprocessing."""
def get_output_array_from_labels(output_labels, labels_encoding=None):
labels = np.unique(output_labels)
labels = labels.reshape(len(labels), 1)
outputs = np.zeros((output_labels.shape[0], labels.shape[0]))
if not labels_encodin... | Python | 0.000001 | |
c1d66909a6ce9903aa0a856d80721c756bc54806 | test for neo4j | test/test_neo4j_graph.py | test/test_neo4j_graph.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# from py2neo import neo4j, node, rel
from bulbs.config import DEBUG
from bulbs.neo4jserver import Graph, Config, NEO4J_URI
from message import Message, IsRetweet # models
from datetime import datetime
# setup
config = Config(NEO4J_URI, "james", "secret")
g = Graph(confi... | Python | 0.000001 | |
09f1cf984a456a4a452f1a1c0a0ff6fd09b7b415 | add code.py | code.py | code.py | print 'Hello GitHub' | Python | 0.000008 | |
a5012c9fb81768e85b555b52264baa11efc17ba1 | Add unittest for select_taxa that runs main and selects a single genome | test/test_select_taxa.py | test/test_select_taxa.py | import logging
import os
import tempfile
import unittest
import select_taxa
class Test(unittest.TestCase):
def setUp(self):
self.longMessage = True
logging.root.setLevel(logging.DEBUG)
def test_main(self):
'''
Select a single genome and assert the download log file contains ... | Python | 0 | |
b5207cfcee8bd3f1a41fc87f3e9afcfe94646314 | Add example of how to list of codecs. | src/swig/python/codecs.py | src/swig/python/codecs.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Import required modules
import mlt
# Start the mlt system
mlt.Factory().init( )
# Create the consumer
c = mlt.Consumer( mlt.Profile(), "avformat" )
# Ask for video codecs supports
c.set( 'vcodec', 'list' )
# Start the consumer to generate the list
c.start()
# Get th... | Python | 0 | |
872e2a38845d8a9d321435092f808e2eb79a26e3 | test case for issue #9 | tests/test_formatters.py | tests/test_formatters.py | import os
from unittest import TestCase
from textwrap import dedent
import pyexcel as pe
class TestAutoDetectInt(TestCase):
def setUp(self):
self.content = [[1,2,3.1]]
self.test_file = "test_auto_detect_init.ods"
pe.save_as(array=self.content, dest_file_name=self.test_file)
def test_... | Python | 0 | |
5692f64619bf009cf92bf0a8c6f77bf82f0e3d02 | Add a new regression testing module | tests/test_regression.py | tests/test_regression.py | # Copyright: See the LICENSE file.
"""Regression tests related to issues found with the project"""
import datetime
import typing as T
import unittest
import factory
# Example objects
# ===============
class Author(T.NamedTuple):
fullname: str
pseudonym: T.Optional[str] = None
class Book(T.NamedTuple):
... | Python | 0.000001 | |
58354f477decff942a3063a12fb72684beca8233 | Add singleton tests | tests/test_singletons.py | tests/test_singletons.py | # coding=utf-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import unittest
import properties
from properties.extras import Singleton
class TestSingleton(unittest.TestCase):
def test_singleton(self):
... | Python | 0.000001 | |
360cc7990b1182f7b4c4ff13a55f899c250640d4 | Add graph traversal algorithms in Python | graph_traversal.py | graph_traversal.py | # coding: utf-8
# Copyright (c) 2012 Gregg Gajic <gregg.gajic@gmail.com>
#
# 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 u... | Python | 0.000197 | |
b93b8d96114338809e6a082f819291144eedd4af | add an utils to reduce the original dataset to a choosen class samples size | reduce_dataset.py | reduce_dataset.py | import sys, os
from shutil import copyfile
supplied_args = sys.argv[1:]
DATA_DIRECTORY = "data_dir"
NEW_DATA_DIRECTORY = supplied_args[0] if supplied_args else sys.exit("You need to supplied a new data directory name : $python reduce_dataset.py <new data directory name> <max sample by class>")
MAX_SAMPLE_BY_CLASS = i... | Python | 0.000002 | |
ab164307310474625926bbc9ea7fae03b99c99cf | Create architecture core models | opps/core/models/__init__.py | opps/core/models/__init__.py | # -*- coding: utf-8 -*-
from opps.core.models.channel import *
from opps.core.models.publisher import *
| Python | 0.000001 | |
ec0c7e6c22ae9d0ff035fc5f1184645c95e73965 | Create command.py | Target/command.py | Target/command.py | import be_jogio
import jogio_cmd_motors
import time, socket
mysock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
server = "127.0.0.1"
port = 55142
msgout = "CLIENT DISPONIBLE"
def setHeadingSimple(head):
headOk = False
jogio_cmd_motors.motorInit()
jogio_cmd_motors.motorRightForward()
jogio_cmd_mot... | Python | 0.000009 | |
c488befd6f27a6576a2f6f34c46f29f63d5505dc | add BAM module report | sequana/modules_report/bamqc.py | sequana/modules_report/bamqc.py | # -*- coding: utf-8 -*-
#
# This file is part of Sequana software
#
# Copyright (c) 2016 - Sequana Development Team
#
# File author(s):
# Thomas Cokelaer <thomas.cokelaer@pasteur.fr>
# Dimitri Desvillechabrol <dimitri.desvillechabrol@pasteur.fr>,
# <d.desvillechabrol@gmail.com>
# Rachel Lege... | Python | 0 | |
9fde684095ba34300fcade827dfb17eae99f4daa | add advanced.py | renew/advanced.py | renew/advanced.py |
def fib(max):
a, b, n = 0, 1, 0
while n < max:
yield b
a, b = b, a + b
n += 1
print('done')
for i in fib(20):
print(i)
| Python | 0.000001 | |
fab91baa976693f89c6001a0e09e0f351d30ccfe | add decorator timeout test | test/test_decorator.py | test/test_decorator.py | # coding=utf-8
import unittest
from decorators.decorator import *
import time
class TestDecorator(unittest.TestCase):
def test_timeout(self):
@timeout(1)
def test_timeout_no_params():
time.sleep(2)
self.assertTrue()
test_timeout_no_params()
@timeout(1)
... | Python | 0.000001 | |
db85c1a9aca124ef4cf45c61244c6cf556138d77 | Add cmd.py script | python/cmd.py | python/cmd.py | #!/usr/bin/env python3
# Copyright (c) 2014, Ruslan Baratov
# All rights reserved.
import argparse
import os
import stat
import subprocess
import sys
import detail.os
import detail.command
assert(sys.version_info.major == 3)
parser = argparse.ArgumentParser(description='Start windows cmd')
args = parser.parse_args... | Python | 0.000002 | |
6d80008e2d14621943830ba6ca4a533f1bdc1da3 | add test which is checking answer after user input | quiz/tests.py | quiz/tests.py | # coding=utf-8
from django.core.urlresolvers import resolve
from django.test import TestCase
from django.http import HttpRequest
from django.template.loader import render_to_string
from django.shortcuts import render
from quiz.views import home_page
from quiz.models import Phrase
from quiz.models import PlayerRecord
... | # coding=utf-8
from django.core.urlresolvers import resolve
from django.test import TestCase
from django.http import HttpRequest
from django.template.loader import render_to_string
from django.shortcuts import render
from quiz.views import home_page
from quiz.models import Phrase
from quiz.models import PlayerRecord
... | Python | 0.000008 |
48faf04cfcd40739e2a0ddfc593f2320f1aeef65 | Create re_install.py | re_install.py | re_install.py | # -*- coding: utf-8 -*-
#-----------------------------------------------------------------------------#
# #
# import libs #
# ... | Python | 0.000001 | |
4411c676426fb580d33ae09682444c093ab2c204 | Add multi-processing tests | test/test_mp.py | test/test_mp.py | import unittest
import time
from clopure.core import ClopureRunner
from clopure.parser import ClopureParser
class TestMultiprocessing(unittest.TestCase):
def setUp(self):
self.parser = ClopureParser()
self.runner = ClopureRunner(procs=4)
def test_pmap(self):
code = "(defimport time ... | Python | 0.000001 | |
122eb3c6eb9f8467fc5d3325f0e5c58cc285cb50 | Add a script to convert hex formatted key to token using random partitioner | token-hexkey.py | token-hexkey.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# 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... | Python | 0 | |
b35a0d2415cfc8d8d5d4060f1cf411a42c90a9a0 | add leetcode Pascal's Triangle. | leetcode/PascalTriangle/solution.py | leetcode/PascalTriangle/solution.py | # -*- coding:utf-8 -*-
class Solution:
# @return a list of lists of integers
def generate(self, numRows):
ret = []
if numRows == 0:
return []
if numRows == 1:
ret.append([1])
return ret
if numRows == 2:
ret.extend([[1], [1,1]])
... | Python | 0 | |
8b5f09708eb79abdcde730727f6788881a3a68a3 | Initialize P4_textToExcel | books/AutomateTheBoringStuffWithPython/Chapter12/PracticeProjects/P4_textToExcel.py | books/AutomateTheBoringStuffWithPython/Chapter12/PracticeProjects/P4_textToExcel.py | # Write a program to read in the contents of several text files (you can make
# the text files yourself) and insert those contents into a spreadsheet, with
# one line of text per row. The lines of the first text file will be in the
# cells of column A, the lines of the second text file will be in the cells of
# column ... | Python | 0.00127 | |
ed17414ed09e117b33f8407517e2a69fa839452e | add edit-keps.py | hack/edit-keps.py | hack/edit-keps.py | #!/usr/bin/env python3
# Copyright 2021 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 appl... | Python | 0 | |
c50e072c5e79083ec3ec4104789a64223c2f63f8 | Create tao.py | tao.py | tao.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from apscheduler.schedulers.blocking import BlockingScheduler
import itchat, time
itchat.auto_login()
def task():
chatroomList = itchat.get_chatrooms(False);
for m in chatroomList:
NickName = m['NickName'].encode('utf-8')
if NickName == u'测试'.encode('utf-8'):
... | Python | 0.000028 | |
7e757d24bff5758350dd2bc92b9e2b1e2f919c12 | Add compute synth (#3830) | java-compute/google-cloud-compute/synth.py | java-compute/google-cloud-compute/synth.py | # Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | Python | 0 | |
2d88daf10d11033bfd597112fb6484783c5a852a | Create xyz.py | xyz.py | xyz.py | #...
| Python | 0.000768 | |
c3b59831924b2e2913b3b8fa3a8d1ebc672b8bff | Create 2048.py | 2048.py | 2048.py | import random
import time
class Board(object):
def __init__(self):
self._width = 4
self._height = 4
self._matrix = None
self.init_board()
def init_board(self):
self._matrix = list()
for i in range(self._height):
row = list()
for j in ran... | Python | 0.998661 | |
e61840020820af4e7a625e472c060e8396b24055 | add migrations | gem/migrations/0013_gemsettings_moderator_name.py | gem/migrations/0013_gemsettings_moderator_name.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.12 on 2017-03-09 13:45
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('gem', '0012_partner_credit'),
]
operations = [
migrations.AddField(
... | Python | 0.000001 | |
955ae619a6502a68f9a8d34022a4a8b1ebeb5ce2 | Create 20.py | E/20.py | E/20.py | # Problem 20 - Factorial digit sum
# n! means n × (n − 1) × ... × 3 × 2 × 1
# For example, 10! = 10 × 9 × ... × 3 × 2 × 1 = 3628800,
# and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27
# Find the sum of the digits in the number 100!
from math import factorial as f
print(sum(int(c) for c in s... | Python | 0.000015 | |
81f983c833d9858ad23f589367bf601babddf858 | Add some useful activation functions. | elements/activation_functions.py | elements/activation_functions.py | import theano
import theano.tensor as T
"""
A set of activation functions for Neural Network layers.
They're in the form of class so we can take advantage of constructor
to set initial value for some parameters.
"""
def tanh(x):
"""
tanh function (-1 to 1)
@input: x, theano shared variable.
@output: element-wise... | Python | 0 | |
b8e7f5381abcf15d07cac07c20c671ec7cc64c90 | Add missing migration. | ideascube/mediacenter/migrations/0013_auto_20170323_1525.py | ideascube/mediacenter/migrations/0013_auto_20170323_1525.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-23 15:25
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mediacenter', '0012_auto_20170210_0940'),
]
operations = [
migrations.Alter... | Python | 0 | |
6585ca91a399a06094636a505fe813a0425c1a35 | add auth module (split from server mod.) | auth.py | auth.py | from urllib import urlencode
from requests import post
auth_url = 'https://github.com/login/oauth/authorize'
access_token_url = 'https://github.com/login/oauth/access_token'
def generate_auth_link(client_id, scopes):
# append the client_id and scopes list to the url query string
return auth_url + '?' + urle... | Python | 0 | |
dbc20f37c7fb1dd00c90ac54d2021fb1ba3b5eda | Add some end-to-end functional tests | exam.py | exam.py | import time
import sys
from groupy.client import Client
def read_token_from_file(filename):
with open(filename) as f:
return f.read().strip()
def test_groups(groups):
for group in groups:
print(group)
print('Members:')
for member in group.members[:5]:
print(memb... | Python | 0.000003 | |
64139e0a41c1b1da81e9b5e244b2d7095c4a7a2b | Add delete old sessions command | core/management/commands/delete_old_sessions.py | core/management/commands/delete_old_sessions.py | from datetime import datetime
from django.core.management.base import BaseCommand
from django.contrib.sessions.models import Session
"""
>>> def clean(count):
... for idx, s in enumerate(Session.objects.filter(expire_date__lt=now)[:count+1]):
... s.delete()
... if str(idx).endswith('000'): print idx
... p... | Python | 0.000001 | |
53add23b6dcb19251a41c7a99347ef6592b2898f | Add tests for serving precompressed files | tests/sentry/web/frontend/generic/test_static_media.py | tests/sentry/web/frontend/generic/test_static_media.py | from __future__ import absolute_import
import os
from django.test.utils import override_settings
from sentry.testutils import TestCase
from sentry.web.frontend.generic import FOREVER_CACHE, NEVER_CACHE
class StaticMediaTest(TestCase):
@override_settings(DEBUG=False)
def test_basic(self):
url = '/_sta... | from __future__ import absolute_import
from django.test.utils import override_settings
from sentry.testutils import TestCase
from sentry.web.frontend.generic import FOREVER_CACHE, NEVER_CACHE
class StaticMediaTest(TestCase):
@override_settings(DEBUG=False)
def test_basic(self):
url = '/_static/sentry... | Python | 0 |
bb0cff292f1931b52bf05a3a0630dda9a508023f | Add basic wrapper for gym env | packages/syft/src/syft/lib/gym/env.py | packages/syft/src/syft/lib/gym/env.py | # third party
import gym
# syft relative
from ...generate_wrapper import GenerateWrapper
from ...proto.lib.gym.env_pb2 import Env as Env_PB
gym_env_type = type(gym.Env())
def object2proto(obj: gym.Env) -> Env_PB:
return Env_PB(id=obj.unwrapped.spec.id)
def proto2object(proto: Env_PB) -> gym.Env:
return gy... | Python | 0 | |
05bf0cd188d4666c9c0aeb56a95d7867f25952c2 | Add a script for dqn continuous task demo | demo_dqn_continuous.py | demo_dqn_continuous.py | import argparse
import chainer
from chainer import serializers
import gym
import numpy as np
import random_seed
import env_modifiers
import q_function
def eval_single_run(env, model, phi):
test_r = 0
obs = env.reset()
done = False
while not done:
s = chainer.Variable(np.expand_dims(phi(obs),... | Python | 0 | |
a2cb69b40daa7ab7b222e7d670dd1022571395a1 | add aiohttp demon | demos/aiohttp_demon.py | demos/aiohttp_demon.py | # -*- coding: utf-8 -*-
# 18/5/22
# create by: snower
import datetime
from torpeewee import *
from aiohttp import web
db = MySQLDatabase("test", host="127.0.0.1", user="root", passwd="123456")
class BaseModel(Model):
class Meta:
database = db
class Test(BaseModel):
id = IntegerField(primary_key= Tru... | Python | 0 | |
6d43946db5b672ca875c793417f1fb7894387f73 | Add Ycm Config | tests/.ycm_extra_conf.py | tests/.ycm_extra_conf.py | import os
import ycm_core
# These are the compilation flags that will be used in case there's no
# compilation database set (by default, one is not set).
# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR.
flags = [
'-Wall',
'-Wextra',
'-Werror',
'-Weffc++',
'-pedantic',
#'-Wc++98-compat',
'... | Python | 0 | |
3b88f0a96b60734374656e290845fc826f988850 | add dumpprices | scripts/dumpprices.py | scripts/dumpprices.py | #!/bin/python3
import requests
import grequests
assets = ['USD', 'USDT', 'EUR', 'BTC', 'XRP', 'ETH', 'HKD', 'LTC', 'RUR']
#btce
def btc_e(assets):
retval = []
r = requests.get('https://btc-e.com/api/3/info').json()
urls=[]
pairs = []
for k, v in r['pairs'].items():
k1, k2 = k.upper().split... | Python | 0.000002 | |
f61570297ef56e94b104aff42c822ea82a66030b | Add tests for database | tests/test_database.py | tests/test_database.py | import unittest
from rcblog import db
class TestDataBase(unittest.TestCase):
@classmethod
def setUpClass(cls):
db.DB_NAME = 'test'
date_base = db.DataBase()
try:
db.r.table_drop('languages').run(date_base.connection)
except Exception as e:
print(e)
... | Python | 0.000001 | |
054c71e88a5fb278ffcdac2ce85a59843f5e3ac0 | add new tests for oop | tests/scripts/oop/ex1.py | tests/scripts/oop/ex1.py | # coding: utf-8
#$ header class Point(public)
#$ header method __init__(Point, double, double)
#$ header method __del__(Point)
#$ header method translate(Point, double, double)
class Point(object):
def __init__(self, x, y):
self.x = x
self.y = y
def __del__(self):
pass
def transl... | Python | 0 | |
8d280e5a464a9ca75ac7c35e02d8de6bddbaaa7e | Add reaction tests | tests/test_reaction.py | tests/test_reaction.py | import pytest
import linkatos.reaction as react
def test_positive_reaction():
reaction = '+1'
assert react.positive_reaction(reaction) is True
def test_not_positive_reaction():
reaction = '-1'
assert react.positive_reaction(reaction) is False
def test_known_reaction_neg():
reaction = '-1'
a... | Python | 0.000051 | |
c0f7be02fb1dc294a9bac2867fc695e353ea3445 | Test Resource. | tests/test_resource.py | tests/test_resource.py | # -*- coding: utf-8 -*-
from unittest import TestCase
from electro.resource import Resource
class TestResource(TestCase):
def assert_parser(self, assert_value, values):
resource = Resource()
value = resource._parse_response(values)
self.assertEqual(value, assert_value)
def test_empty... | Python | 0 | |
5adf35b9131ea6c0a16f6765cf44c50767ddc3f3 | add testanalyzing | tests/testanalyzing.py | tests/testanalyzing.py | from timeside.decoder import *
from timeside.analyzer import *
from unit_timeside import *
import os.path
__all__ = ['TestAnalyzing']
class TestAnalyzing(TestCase):
"Test all analyzers"
def setUp(self):
self.source = os.path.join (os.path.dirname(__file__), "samples/sweep.wav")
def testDC(self... | Python | 0.998693 | |
b2a083e1531134ec82a70ca581fca31db7867566 | add test for data with no coincidences | tests/test_singletons.py | tests/test_singletons.py | # -*- coding: utf-8 -*-
# pylint: disable=missing-docstring
# pylint: disable=redefined-outer-name
"""Test ref results for data with no coincidences."""
import numpy
import pytest
from pytest import approx
from ndd.estimators import NSB, AsymptoticNSB, Plugin
from ndd.exceptions import NddError
N = (10, 10)
K = (10, ... | Python | 0.000009 | |
d8470858316f260a1801d7113f2eee6a0595b9d1 | add tool.py | examples/adversarial_asr/tool.py | examples/adversarial_asr/tool.py | from tensorflow.python import pywrap_tensorflow
import numpy as np
import tensorflow as tf
from lingvo.core import asr_frontend
from lingvo.core import py_utils
def _MakeLogMel(audio, sample_rate):
audio = tf.expand_dims(audio, axis=0)
static_sample_rate = 16000
mel_frontend = _CreateAsrFrontend()
with tf.con... | Python | 0.000002 | |
7ac29357f9bd022a5d1bc68a0a7aa589a7ff5790 | add server crypto example | examples/object_server_crypto.py | examples/object_server_crypto.py | # -*- coding: utf-8 -*-
import os
import shutil
import oss2
from oss2.headers import requestHeader
# 以下代码展示了其用服务端加密功能的各项操作
# 首先初始化AccessKeyId、AccessKeySecret、Endpoint等信息。
# 通过环境变量获取,或者把诸如“<你的AccessKeyId>”替换成真实的AccessKeyId等。
#
# 以杭州区域为例,Endpoint可以是:
# http://oss-cn-hangzhou.aliyuncs.com
# https://oss-cn-hangzh... | Python | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.