code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from django import forms
from django.utils.translation import ugettext_lazy ... | shawnadelic/shuup | shuup/xtheme/plugins/category_links.py | Python | agpl-3.0 | 2,994 |
# -*- coding: utf-8 -*-
from .base import BaseHandler
class TestRoute(BaseHandler):
def get(self, file):
return self.render(str(file) + '.jade', show_h1=1)
| web-izmerenie/avto-lux161 | avto-lux/app/core/routes/testroute.py | Python | agpl-3.0 | 162 |
import sys
import time
import sys
num = 1000
print_granularity = 1000
count = 0
first = True
start = 0
gran_start = 0
min = 0
max = 0
avg = 0
sum = 0
total = 0
def set_print_granularity(p):
global print_granularity
print_granularity = p
print("%s: print granularity = %s" % (sys.argv[0], print_granularity))
def l... | scalien/keyspace | test/concurrency/common.py | Python | agpl-3.0 | 1,105 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Odoo, Open Source Business Applications
# Copyright (c) 2015 Odoo S.A. <http://openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affe... | tvtsoft/odoo8 | addons/delivery/models/stock_picking.py | Python | agpl-3.0 | 4,025 |
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
import decimal
import pytest
from django.conf import settings
from shuup.core.models import Shipm... | hrayr-artunyan/shuup | shuup_tests/core/test_shipments.py | Python | agpl-3.0 | 6,394 |
"""
Test cases to cover Accounts-related behaviors of the User API application
"""
import datetime
import hashlib
import json
from copy import deepcopy
from unittest import mock
import ddt
import pytz
from django.conf import settings
from django.test.testcases import TransactionTestCase
from django.test.utils import ... | edx/edx-platform | openedx/core/djangoapps/user_api/accounts/tests/test_views.py | Python | agpl-3.0 | 53,614 |
def _checkInput(index):
if index < 0:
raise ValueError("Indice negativo non supportato [{}]".format(index))
elif type(index) != int:
raise TypeError("Inserire un intero [tipo input {}]".format(type(index).__name__))
def fib_from_string(index):
_checkInput(index)
serie = "0 1 1 2 3 5 8".... | feroda/lessons-python4beginners | students/2016-09-04/simone-cosma/fibonacci.py | Python | agpl-3.0 | 1,035 |
"""
Braitenberg Vehicle2b
The more light sensed on the left side the faster the right motor moves.
The more light sensed on the right side the faster the left motor moves.
This causes the robot to turn towards a light source.
"""
from pyrobot.brain import Brain, avg
class Vehicle(Brain):
def setup(self):
sel... | emilydolson/forestcat | pyrobot/plugins/brains/BraitenbergVehicle2b.py | Python | agpl-3.0 | 789 |
#!/usr/bin/env python
import pygtk
pygtk.require('2.0')
import pynotify
import sys
if __name__ == '__main__':
if not pynotify.init("XY"):
sys.exit(1)
n = pynotify.Notification("X, Y Test",
"This notification should point to 150, 10")
n.set_hint("x", 150)
n.set_hi... | Distrotech/notify-python | tests/test-xy.py | Python | lgpl-2.1 | 418 |
# Copyright Iris contributors
#
# This file is part of Iris and is released under the LGPL license.
# See COPYING and COPYING.LESSER in the root of the repository for full
# licensing details.
"""Integration tests for loading and saving netcdf files."""
# Import iris.tests first so that some things can be initialised ... | pp-mo/iris | lib/iris/tests/integration/test_climatology.py | Python | lgpl-3.0 | 3,683 |
#__all__ = [ 'search', 'ham_distance', 'lev_distance', 'distance', 'distance_matrix' ]
| vfulco/scalpel | lib/gravity/tae/match/__init__.py | Python | lgpl-3.0 | 94 |
#Special rules for nouns, to avoid suggesting wrong lemmas. Nothing is done for other POS.
import pymorphy2
blacklist1 = ['ъб', 'ъв', 'ъг', 'ъд', 'ъж', 'ъз', 'ък', 'ъл', 'ъм', 'ън', 'ъп', 'ър', 'ъс', 'ът', 'ъф', 'ъх', 'ъц', 'ъч', 'ъш', 'ъщ', 'йй', 'ьь', 'ъъ', 'ыы', 'чя', 'чю', 'чй', 'щя', 'щю', 'щй', 'шя', 'шю', 'шй',... | azilya/Zaliznyak-s-grammatical-dictionary | gdictionary/postprocessing.py | Python | lgpl-3.0 | 7,574 |
# -*- encoding: utf-8 -*-
#
# Copyright © 2013 IBM Corp
#
# Author: Tong Li <litong01@us.ibm.com>
#
# 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/LICEN... | tanglei528/ceilometer | ceilometer/tests/dispatcher/test_file.py | Python | apache-2.0 | 3,762 |
# -*- coding: utf-8 -*-
#
# Copyright 2013 - Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | TimurNurlygayanov/mistral | mistral/api/controllers/v1/workbook_definition.py | Python | apache-2.0 | 1,511 |
from trex_astf_lib.api import *
# IPV6 tunable example
#
# ipv6.src_msb
# ipv6.dst_msb
# ipv6.enable
#
class Prof1():
def __init__(self):
pass
def get_profile(self, **kwargs):
# ip generator
ip_gen_c = ASTFIPGenDist(ip_range=["16.0.0.0", "16.0.0.255"], distribution="seq")
... | kisel/trex-core | scripts/astf/param_tcp_rxbufsize_8k.py | Python | apache-2.0 | 1,298 |
from pony.orm.core import *
| buddyli/private2w | libs/pony/orm/__init__.py | Python | apache-2.0 | 28 |
# ===============================================================================
# Copyright 2013 Jake Ross
#
# 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/licens... | USGSDenverPychron/pychron | pychron/pipeline/plot/flow_label.py | Python | apache-2.0 | 3,470 |
"""
websocket - WebSocket client library for Python
Copyright (C) 2010 Hiroki Ohtani(liris)
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, ... | vert-x3/vertx-web | vertx-web/src/test/sockjs-protocol/websocket/_logging.py | Python | apache-2.0 | 2,165 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Ericsson AB
#
# 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 ... | les69/calvin-base | calvin/tests/test_actor.py | Python | apache-2.0 | 7,248 |
#!/var/www/horizon/.venv/bin/python
# $Id: rst2xml.py 4564 2006-05-21 20:44:42Z wiemann $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
A minimal front end to the Docutils Publisher, producing Docutils XML.
"""
try:
import locale
locale.setloc... | neumerance/deploy | .venv/bin/rst2xml.py | Python | apache-2.0 | 619 |
import logging
import threading
import time
from ballast.discovery import ServerList
from ballast.rule import Rule, RoundRobinRule
from ballast.ping import (
Ping,
SocketPing,
PingStrategy,
SerialPingStrategy
)
class LoadBalancer(object):
DEFAULT_PING_INTERVAL = 30
MAX_PING_TIME = 3
def ... | thomasstreet/ballast | ballast/core.py | Python | apache-2.0 | 4,607 |
import os, re, csv
# regular expressions for capturing the interesting quantities
noise_pattern = 'noise: \[(.+)\]'
res_pattern = '^([0-9.]+$)'
search_dir = "output"
results_file = '../results.csv'
os.chdir( search_dir )
files = filter( os.path.isfile, os.listdir( '.' ))
#files = [ os.path.join( search_dir, f ) for ... | jiminliang/msda-denoising | spearmint_variable_noise/output2csv.py | Python | apache-2.0 | 1,028 |
import os
import logging
from mongodb_consistent_backup.Common import LocalCommand
from mongodb_consistent_backup.Pipeline import PoolThread
class TarThread(PoolThread):
def __init__(self, backup_dir, output_file, compression='none', verbose=False, binary="tar"):
super(TarThread, self).__init__(self.__cl... | Percona-Lab/mongodb_consistent_backup | mongodb_consistent_backup/Archive/Tar/TarThread.py | Python | apache-2.0 | 2,555 |
# -------------------------------------------------------------
#
# 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 unde... | apache/incubator-systemml | src/main/python/systemds/operator/algorithm/builtin/garch.py | Python | apache-2.0 | 3,230 |
"""
Tests for login and logout.
"""
import datetime
from unittest.mock import patch
import responses
import quilt3
from .utils import QuiltTestCase
class TestSession(QuiltTestCase):
@patch('quilt3.session.open_url')
@patch('quilt3.session.input', return_value='123456')
@patch('quilt3.session.login_wit... | quiltdata/quilt-compiler | api/python/tests/test_session.py | Python | apache-2.0 | 4,576 |
import logging
import re
import socket
from mopidy.config import validators
from mopidy.internal import log, path
def decode(value):
if isinstance(value, bytes):
value = value.decode(errors="surrogateescape")
for char in ("\\", "\n", "\t"):
value = value.replace(
char.encode(enco... | kingosticks/mopidy | mopidy/config/types.py | Python | apache-2.0 | 9,146 |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | nathanielvarona/airflow | airflow/contrib/operators/qubole_operator.py | Python | apache-2.0 | 1,158 |
# Copyright 2017 Battelle Energy Alliance, 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 t... | idaholab/raven | framework/SupervisedLearning/ScikitLearn/LinearModel/LassoLarsIC.py | Python | apache-2.0 | 6,386 |
################################################################################
# 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... | clarkyzl/flink | flink-python/pyflink/fn_execution/timerservice_impl.py | Python | apache-2.0 | 4,824 |
from mainapp import create_app
app = create_app()
if __name__ == '__main__':
app.run(host='0.0.0.0')
| jonaubf/flask-mongo-testapp | testapp/run.py | Python | apache-2.0 | 107 |
# Copyright 2012 OpenStack Foundation
# Copyright 2013 Nebula Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | varunarya10/python-openstackclient | openstackclient/identity/v2_0/ec2creds.py | Python | apache-2.0 | 5,662 |
# Copyright 2012 SINA Corporation
# Copyright 2014 Cisco Systems, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licens... | frossigneux/blazar | climate/openstack/common/config/generator.py | Python | apache-2.0 | 10,412 |
"""
IP Types
"""
import logging
from ipaddress import ip_address
from socket import AF_INET, AF_INET6
from vpp_papi import VppEnum
from vpp_object import VppObject
try:
text_type = unicode
except NameError:
text_type = str
_log = logging.getLogger(__name__)
class DpoProto:
DPO_PROTO_IP4 = 0
DPO_P... | FDio/vpp | test/vpp_ip.py | Python | apache-2.0 | 6,921 |
import numpy as np
from math import sin, pi, cos
from banti.glyph import Glyph
halfsize = 40
size = 2*halfsize + 1
picture = np.zeros((size, size))
for t in range(-135, 135):
x = round(halfsize + halfsize * cos(pi * t / 180))
y = round(halfsize + halfsize * sin(pi * t / 180))
picture[x][y] = 1
zoomsz = 1 ... | rakeshvar/telugu_ocr_banti | tests/glyph_test.py | Python | apache-2.0 | 613 |
# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False
from __future__ import absolute_import
import logging
import os.path
import re
from pip._vendor.packaging.version import parse as parse_version
from pip._vendor.six.moves.urllib import parse as urllib_parse
fro... | pantsbuild/pex | pex/vendor/_vendored/pip/pip/_internal/vcs/git.py | Python | apache-2.0 | 15,599 |
# coding: utf-8
#
# Copyright (c) 2013 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unle... | gaolichuang/py-essential | essential/db/sqlalchemy/migration.py | Python | apache-2.0 | 10,186 |
# Copyright 2008-2013 Software freedom conservancy
#
# 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 ... | RamaraoDonta/ramarao-clone | py/selenium/webdriver/remote/webelement.py | Python | apache-2.0 | 14,925 |
"""This component provides support to the Ring Door Bell camera."""
import asyncio
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.components.camera import PLATFORM_SCHEMA, Camera
from homeassistant.components.ffmpeg import DATA_FFMPEG
from homeassistant.const import ATTR_ATT... | jabesq/home-assistant | homeassistant/components/ring/camera.py | Python | apache-2.0 | 5,739 |
# Copyright 2015 Rafe Kaplan
#
# 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... | slobberchops/booze | src/booze/gin/rule.py | Python | apache-2.0 | 2,341 |
# ******************************************************************************
# Copyright 2014-2018 Intel Corporation
#
# 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.apa... | NervanaSystems/neon | neon/backends/kernels/cuda/__init__.py | Python | apache-2.0 | 748 |
import os
import sys
import argparse
from pandaharvester.harvesterconfig import harvester_config
from pandaharvester.harvestermisc.selfcheck import harvesterPackageInfo
def main():
oparser = argparse.ArgumentParser(prog='prescript', add_help=True)
oparser.add_argument('-f', '--local_info_file', action='store... | dougbenjamin/panda-harvester | pandaharvester/harvesterscripts/prescript.py | Python | apache-2.0 | 901 |
import tempfile
from git import InvalidGitRepositoryError
try:
from unittest2 import TestCase
from mock import patch, Mock
except ImportError:
from unittest import TestCase
from mock import patch, Mock
import textwrap
from datetime import datetime
from botocore.exceptions import ClientError
from dat... | marco-hoyer/cfn-sphere | src/unittest/python/util_tests.py | Python | apache-2.0 | 8,933 |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | ghchinoy/tensorflow | tensorflow/python/compiler/tensorrt/test/reshape_transpose_test.py | Python | apache-2.0 | 5,407 |
from O365 import attachment
import unittest
import json
import base64
from random import randint
att_rep = open('attachment.json','r').read()
att_j = json.loads(att_rep)
class TestAttachment (unittest.TestCase):
def setUp(self):
self.att = attachment.Attachment(att_j['value'][0])
def test_isType(self):
self.... | roycem90/python-o365 | tests/test_attachment.py | Python | apache-2.0 | 1,812 |
# Copyright 2014 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | openhatch/oh-missions-oppia-beta | core/storage/base_model/gae_models.py | Python | apache-2.0 | 15,533 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | dmlc/tvm | tests/python/contrib/test_ethosn/test_relu.py | Python | apache-2.0 | 2,921 |
from hazelcast.serialization.bits import *
from hazelcast.protocol.client_message import ClientMessage
from hazelcast.protocol.custom_codec import *
from hazelcast.util import ImmutableLazyDataList
from hazelcast.protocol.codec.map_message_type import *
REQUEST_TYPE = MAP_REMOVEENTRYLISTENER
RESPONSE_TYPE = 101
RETRYA... | cangencer/hazelcast-python-client | hazelcast/protocol/codec/map_remove_entry_listener_codec.py | Python | apache-2.0 | 1,199 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for checks."""
from grr.lib import flags
from grr.lib import test_lib
from grr.lib.checks import hints
from grr.lib.rdfvalues import client as rdf_client
from grr.lib.rdfvalues import config_file as rdf_config_file
from grr.lib.rdfvalues import protodict as rdf_pro... | destijl/grr | grr/lib/checks/hints_test.py | Python | apache-2.0 | 4,932 |
#!/usr/bin/env python
# encoding=utf-8
# Copyright 2014 Cloudera Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | andybab/Impala | tests/shell/test_shell_interactive.py | Python | apache-2.0 | 9,064 |
#!/usr/bin/env python
"""
Copyright (c) 2006-2016 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
from lib.core.enums import DBMS
from lib.core.settings import MAXDB_SYSTEM_DBS
from lib.core.unescaper import unescaper
from plugins.dbms.maxdb.enumeration import Enumeration
... | glaudsonml/kurgan-ai | tools/sqlmap/plugins/dbms/maxdb/__init__.py | Python | apache-2.0 | 1,033 |
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | luotao1/Paddle | python/paddle/fluid/tests/unittests/test_fmax_op.py | Python | apache-2.0 | 7,540 |
# Copyright (C) 2013 Nippon Telegraph and Telephone Corporation.
#
# 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 applicab... | Neil741/ryu-master | ryu/lib/ofctl_v1_2.py | Python | apache-2.0 | 24,202 |
# Copyright 2013 IBM Corp.
#
# 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 agree... | pombredanne/MOG | nova/conductor/manager.py | Python | apache-2.0 | 39,345 |
# Copyright 2019 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google-research/remixmatch | mixup.py | Python | apache-2.0 | 4,608 |
# Copyright 2015 Metaswitch Networks
#
# 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 w... | TeaBough/calico-docker | calico_containers/tests/unit/container_test.py | Python | apache-2.0 | 39,497 |
#!/usr/bin/env python
#
# Copyright 2015-2021 Flavio Garcia
#
# 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... | piraz/firenado | tests/util/sqlalchemy_util_test.py | Python | apache-2.0 | 3,289 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import os
import logging
import traceback
import mallet_lda
class MalletTagTopics(mallet_lda.MalletLDA):
"""
Topic modeling with separation based on tags
"""
def _basic_params(self):
self.name = 'mallet_lda_tags'
self.categorical ... | ChristianFrisson/papermachines | chrome/content/papermachines/processors/mallet_lda_tags.py | Python | bsd-2-clause | 1,353 |
import sys
import os
import subprocess
import string
printable = set(string.printable)
def sanitize(txt):
txt = ''.join(filter(lambda c: c in printable, txt))
return txt
def traverse(t, outfile):
print>>outfile, sanitize(t.code+'\t'+t.description)
for c in t.children:
traverse(c, outfile)
de... | yhalpern/anchorExplorer | examples/ICD9/load_ICD9_structure.py | Python | bsd-2-clause | 971 |
#!/usr/bin/env python
"""Bootstrap setuptools installation
To use setuptools in your package's setup.py, include this
file in the same directory and add this to the top of your setup.py::
from ez_setup import use_setuptools
use_setuptools()
To require a specific version of setuptools, set a download
mirror, ... | mtholder/peyotl | ez_setup.py | Python | bsd-2-clause | 10,592 |
import sys
import unittest
from streamlink.plugin.api.utils import itertags
def unsupported_versions_1979():
"""Unsupported python versions for itertags
3.7.0 - 3.7.2 and 3.8.0a1
- https://github.com/streamlink/streamlink/issues/1979
- https://bugs.python.org/issue34294
"""
v = sys.v... | beardypig/streamlink | tests/test_plugin_utils.py | Python | bsd-2-clause | 3,845 |
import batoid
import numpy as np
from test_helpers import timer, do_pickle, all_obj_diff, init_gpu, rays_allclose
@timer
def test_properties():
rng = np.random.default_rng(5)
for i in range(100):
R = rng.normal(0.0, 0.3) # negative allowed
sphere = batoid.Sphere(R)
assert sphere.R == ... | jmeyers314/batoid | tests/test_Sphere.py | Python | bsd-2-clause | 7,740 |
#!/usr/bin/env python3
import sys
import re
import mpmath as mp
mp.dps=250
mp.mp.dps = 250
if len(sys.argv) != 2:
print("Usage: format_CIAAW.py ciaawfile")
quit(1)
path = sys.argv[1]
atomre = re.compile(r'^(\d+) +(\w\w*) +(\w+) +\[?(\d+)\]?\*? +(.*) *$')
isore = re.compile(r'^(\d+)\*? +(\[?\d.*.*\]?) *$'... | pulsar-chem/Pulsar-Core | scripts/data/format_CIAAW.py | Python | bsd-3-clause | 2,449 |
import warnings
import unittest
import sys
from nose.tools import assert_raises
from gplearn.skutils.testing import (
_assert_less,
_assert_greater,
assert_less_equal,
assert_greater_equal,
assert_warns,
assert_no_warnings,
assert_equal,
set_random_state,
assert_raise_message)
fro... | danbob123/gplearn | gplearn/skutils/tests/test_testing.py | Python | bsd-3-clause | 3,785 |
# -*- coding: utf-8 -*-
#
# アルゴリズムデザインコンテストのさまざまな処理
#
# Copyright (C) 2015 Fujitsu
import numberlink
from datastore import *
from hashlib import sha1, sha256
from flask import make_response, render_template
import random
import datetime
from tz import gae_datetime_JST
from define import DEFAULT_YEAR
def adc_response... | dasadc/conmgr | adc2018/server/adcutil.py | Python | bsd-3-clause | 23,866 |
from constance.admin import ConstanceForm
from django.forms import fields
from django.test import TestCase
class TestForm(TestCase):
def test_form_field_types(self):
f = ConstanceForm({})
self.assertIsInstance(f.fields['INT_VALUE'], fields.IntegerField)
self.assertIsInstance(f.fields['B... | jazzband/django-constance | tests/test_form.py | Python | bsd-3-clause | 1,084 |
from pybrain.rl.environments.timeseries.maximizereturntask import DifferentialSharpeRatioTask
from pybrain.rl.environments.timeseries.timeseries import AR1Environment, SnPEnvironment
from pybrain.rl.learners.valuebased.linearfa import Q_LinFA
from pybrain.rl.agents.linearfa import LinearFA_Agent
from pybrain.rl.experim... | samstern/MSc-Project | pybrain/rl/environments/timeseries/test programs/ar1TestScript.py | Python | bsd-3-clause | 976 |
from datetime import datetime, timedelta
from django import http
from django.conf import settings
from django.core.exceptions import PermissionDenied
import mock
import pytest
from olympia.amo.tests import BaseTestCase, TestCase
from olympia.amo import decorators, get_user, set_user
from olympia.amo.urlresolvers imp... | andymckay/addons-server | src/olympia/amo/tests/test_decorators.py | Python | bsd-3-clause | 5,822 |
from django.core.management.base import BaseCommand
import amo
from mkt.webapps.models import AddonPremium
class Command(BaseCommand):
help = 'Clean up existing AddonPremium objects for free apps.'
def handle(self, *args, **options):
(AddonPremium.objects.filter(addon__premium_type__in=amo.ADDON_FRE... | andymckay/zamboni | mkt/developers/management/commands/cleanup_addon_premium.py | Python | bsd-3-clause | 364 |
from lib.common import helpers
class Module:
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'Invoke-LockWorkStation',
'Author': ['@harmj0y'],
'Description': ("Locks the workstation's display."),
'Background' : False,
'OutputE... | Hackplayers/Empire-mod-Hpys-tests | lib/modules/powershell/management/lock.py | Python | bsd-3-clause | 3,056 |
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
## Copyright (C) 2011-2014, NYU-Poly.
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## ... | VisTrails/VisTrails | vistrails/core/vistrail/connection.py | Python | bsd-3-clause | 10,497 |
from __future__ import division, absolute_import, print_function
import collections
import tempfile
import sys
import shutil
import warnings
import operator
import io
import itertools
if sys.version_info[0] >= 3:
import builtins
else:
import __builtin__ as builtins
from decimal import Decimal
import numpy as... | MichaelAquilina/numpy | numpy/core/tests/test_multiarray.py | Python | bsd-3-clause | 220,691 |
import urllib
from canvas import util
def make_cookie_key(key):
return 'after_signup_' + str(key)
def _get(request, key):
key = make_cookie_key(key)
val = request.COOKIES.get(key)
if val is not None:
val = util.loads(urllib.unquote(val))
return (key, val,)
def get_posted_comment(request... | canvasnetworks/canvas | website/canvas/after_signup.py | Python | bsd-3-clause | 698 |
import numpy as np
from Coupling import Coupling
class Coupling2DCavities2D(Coupling):
"""
Coupling for cavity2D to cavity transmission.
"""
@property
def impedance_from(self):
"""
Choses the right impedance of subsystem_from.
Applies boundary conditions correction as w... | FRidh/Sea | Sea/model/couplings/Coupling2DCavities2D.py | Python | bsd-3-clause | 1,049 |
''' The `Filter` hierarchy contains Transformer classes that take a `Stim`
of one type as input and return a `Stim` of the same type as output (but with
some changes to its data).
'''
from .audio import (AudioTrimmingFilter,
AudioResamplingFilter)
from .base import TemporalTrimmingFilter
from .ima... | tyarkoni/pliers | pliers/filters/__init__.py | Python | bsd-3-clause | 1,079 |
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(name='reddit_gold',
description='reddit gold',
version='0.1',
author='Chad Birch',
author_email='chad@reddit.com',
packages=find_packages(),
install_requires=[
'r2',
],
entry_points={
'r2.plugin':
... | madbook/reddit-plugin-gold | setup.py | Python | bsd-3-clause | 418 |
# -*- coding: utf-8 -*-
from django.contrib import admin
from ionyweb.plugin_app.plugin_video.models import Plugin_Video
admin.site.register(Plugin_Video)
| makinacorpus/ionyweb | ionyweb/plugin_app/plugin_video/admin.py | Python | bsd-3-clause | 157 |
from __future__ import unicode_literals
__all__ = (
'Key',
'Keys',
)
class Key(object):
def __init__(self, name):
#: Descriptive way of writing keys in configuration files. e.g. <C-A>
#: for ``Control-A``.
self.name = name
def __repr__(self):
return '%s(%r)' % (self.... | jaseg/python-prompt-toolkit | prompt_toolkit/keys.py | Python | bsd-3-clause | 2,546 |
#!/usr/bin/env python
"""
================
sMRI: FreeSurfer
================
This script, smri_freesurfer.py, demonstrates the ability to call reconall on
a set of subjects and then make an average subject.
python smri_freesurfer.py
Import necessary modules from nipype.
"""
import os
import nipype.pipeline.eng... | FredLoney/nipype | examples/smri_freesurfer.py | Python | bsd-3-clause | 1,804 |
import shutil
from nose.tools import *
from holland.lib.lvm import LogicalVolume
from holland.lib.lvm.snapshot import *
from tests.constants import *
class TestSnapshot(object):
def setup(self):
self.tmpdir = tempfile.mkdtemp()
def teardown(self):
shutil.rmtree(self.tmpdir)
def test_snap... | m00dawg/holland | plugins/holland.lib.lvm/tests/xfs/test_snapshot.py | Python | bsd-3-clause | 1,824 |
from django.apps import AppConfig
class ContentStoreAppConfig(AppConfig):
name = "contentstore"
def ready(self):
import contentstore.signals
contentstore.signals
| praekelt/seed-stage-based-messaging | contentstore/apps.py | Python | bsd-3-clause | 190 |
# -*- coding: utf-8 -*-
"""Git tools."""
from shlex import split
from plumbum import ProcessExecutionError
from plumbum.cmd import git
DEVELOPMENT_BRANCH = "develop"
def run_git(*args, dry_run=False, quiet=False):
"""Run a git command, print it before executing and capture the output."""
command = git[split... | andreoliw/clitoolkit | clit/git.py | Python | bsd-3-clause | 899 |
from __future__ import unicode_literals
from .atomicparsley import AtomicParsleyPP
from .ffmpeg import (
FFmpegPostProcessor,
FFmpegAudioFixPP,
FFmpegEmbedSubtitlePP,
FFmpegExtractAudioPP,
FFmpegFixupStretchedPP,
FFmpegMergerPP,
FFmpegMetadataPP,
FFmpegVideoConvertorPP,
)
from .xattrpp ... | janusnic/youtube-dl-GUI | youtube_dl/postprocessor/__init__.py | Python | mit | 760 |
__author__ = 'Nishanth'
from juliabox.cloud import JBPluginCloud
from juliabox.jbox_util import JBoxCfg, retry_on_errors
from googleapiclient.discovery import build
from oauth2client.client import GoogleCredentials
import threading
class JBoxGCD(JBPluginCloud):
provides = [JBPluginCloud.JBP_DNS, JBPluginCloud.JB... | JuliaLang/JuliaBox | engine/src/juliabox/plugins/dns_gcd/impl_gcd.py | Python | mit | 2,592 |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from datetime import timedelta
from flask import flash, redirect, request, session
from indico.core.db i... | pferreir/indico | indico/modules/news/controllers.py | Python | mit | 3,954 |
#!/usr/bin/env python
import sys
def fix_terminator(tokens):
if not tokens:
return
last = tokens[-1]
if last not in ('.', '?', '!') and last.endswith('.'):
tokens[-1] = last[:-1]
tokens.append('.')
def balance_quotes(tokens):
count = tokens.count("'")
if not count:
return
processed = 0
... | TeamSPoon/logicmoo_workspace | packs_sys/logicmoo_nlu/ext/candc/src/lib/tokeniser/fixes.py | Python | mit | 820 |
# -*- coding: utf-8 -*-
"""
webModifySqlAPI
~~~~~~~~~~~~~~
为web应用与后台数据库操作(插入,更新,删除操作)的接口
api_functions 中的DataApiFunc.py为其接口函数汇聚点,所有全局变量设置都在此;所有后台函数调用都在此设置
Implementation helpers for the JSON support in Flask.
:copyright: (c) 2015 by Armin kissf lu.
:license: ukl, see LICENSE for more detail... | dadawangweb/ukl-gsvc-web | app/api_1_0/webModifySqlAPI.py | Python | mit | 3,719 |
import os, scrapy, argparse
from realclearpolitics.spiders.spider import RcpSpider
from scrapy.crawler import CrawlerProcess
parser = argparse.ArgumentParser('Scrap realclearpolitics polls data')
parser.add_argument('url', action="store")
parser.add_argument('--locale', action="store", default='')
parser.add_argument('... | dpxxdp/berniemetrics | private/scrapers/realclearpolitics-scraper/scraper.py | Python | mit | 1,355 |
from panda3d.core import NodePath, DecalEffect
import DNANode
import DNAWall
import random
class DNAFlatBuilding(DNANode.DNANode):
COMPONENT_CODE = 9
currentWallHeight = 0
def __init__(self, name):
DNANode.DNANode.__init__(self, name)
self.width = 0
self.hasDoor = False
def s... | Spiderlover/Toontown | toontown/dna/DNAFlatBuilding.py | Python | mit | 5,943 |
# -*- coding: utf-8 -*-
"""
Various i18n functions.
Helper functions for both the internal translation system
and for TranslateWiki-based translations.
By default messages are assumed to reside in a package called
'scripts.i18n'. In pywikibot 2.0, that package is not packaged
with pywikibot, and pywikibot 2.0 does ... | emijrp/pywikibot-core | pywikibot/i18n.py | Python | mit | 21,745 |
## www.pubnub.com - PubNub Real-time push service in the cloud.
# coding=utf8
## PubNub Real-time Push APIs and Notifications Framework
## Copyright (c) 2010 Stephen Blum
## http://www.pubnub.com/
import sys
from pubnub import PubnubTornado as Pubnub
publish_key = len(sys.argv) > 1 and sys.argv[1] or 'demo'
subscri... | teddywing/pubnub-python | python-tornado/examples/here-now.py | Python | mit | 1,031 |
# -*- coding: utf-8 -*-
import numbers
import numpy as np
from ..constants import BOLTZMANN_IN_MEV_K
from ..energy import Energy
class Analysis(object):
r"""Class containing methods for the Data class
Attributes
----------
detailed_balance_factor
Methods
-------
integrate
position
... | neutronpy/neutronpy | neutronpy/data/analysis.py | Python | mit | 8,726 |
from itertools import imap, chain
def set_name(name, f):
try:
f.__pipetools__name__ = name
except (AttributeError, UnicodeEncodeError):
pass
return f
def get_name(f):
from pipetools.main import Pipe
pipetools_name = getattr(f, '__pipetools__name__', None)
if pipetools_name:
... | katakumpo/pipetools | pipetools/debug.py | Python | mit | 672 |
import unittest
from PyFoam.Basics.MatplotlibTimelines import MatplotlibTimelines
theSuite=unittest.TestSuite()
| Unofficial-Extend-Project-Mirror/openfoam-extend-Breeder-other-scripting-PyFoam | unittests/Basics/test_MatplotlibTimelines.py | Python | gpl-2.0 | 114 |
#!/bin/python
import os, subprocess
import logging
from autotest.client import test
from autotest.client.shared import error, software_manager
sm = software_manager.SoftwareManager()
class sblim_sfcb(test.test):
"""
Autotest module for testing basic functionality
of sblim_sfcb
@author Wang Tao <wang... | rajashreer7/autotest-client-tests | linux-tools/sblim_sfcb/sblim_sfcb.py | Python | gpl-2.0 | 1,610 |
"""
Test cases adapted from the test_bsddb.py module in Python's
regression test suite.
"""
import sys, os, string
import unittest
import tempfile
from test_all import verbose
try:
# For Python 2.3
from bsddb import db, hashopen, btopen, rnopen
except ImportError:
# For earlier Pythons w/distutils pybsdd... | trivoldus28/pulsarch-verilog | tools/local/bas-release/bas,3.9/lib/python/lib/python2.3/bsddb/test/test_compat.py | Python | gpl-2.0 | 3,862 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
# Copyright (C) 2010 Benny Malengier
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; ei... | Fedik/gramps | gramps/gui/editors/displaytabs/surnametab.py | Python | gpl-2.0 | 16,204 |
#!/usr/bin/env python
# The contents of this file are subject to the BitTorrent Open Source License
# Version 1.1 (the License). You may not copy or use this file, in either
# source code or executable form, except in compliance with the License. You
# may obtain a copy of the License at http://www.bittorrent.com/li... | sulaweyo/torrentflux-b4rt-php7 | html/bin/clients/mainline/BTL/CMap.py | Python | gpl-2.0 | 44,894 |
#!/usr/bin/python
#============================================================================
# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
#
# This library is distribu... | mikesun/xen-cow-checkpointing | tools/python/scripts/xapi.py | Python | gpl-2.0 | 29,258 |
# -*- coding: utf-8 -*-
"""
InaSAFE Disaster risk assessment tool developed by AusAid -
**metadata module.**
Contact : ole.moller.nielsen@gmail.com
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Sof... | Gustry/inasafe | safe/metadata/property/list_property.py | Python | gpl-3.0 | 1,695 |
from django.conf.urls.defaults import *
"""
Also used in cms.tests.ApphooksTestCase
"""
urlpatterns = patterns('cms.test_utils.project.sampleapp.views',
url(r'^$', 'sample_view', {'message': 'sample root page',}, name='sample-root'),
url(r'^settings/$', 'sample_view', kwargs={'message': 'sample settings page'... | hzlf/openbroadcast | website/cms/test_utils/project/sampleapp/urls.py | Python | gpl-3.0 | 842 |