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 |
|---|---|---|---|---|---|
# Copyright 2014 Novo Nordisk Foundation Center for Biosustainability, DTU.
# 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 ... | biosustain/optlang | slow_tests/test_miplib_gurobi_interface.py | Python | apache-2.0 | 3,070 |
from apetools.baseclass import BaseClass
from apetools.tools import copyfiles
from apetools.log_setter import LOGNAME
from apetools.proletarians import teardown
class TearDownBuilder(BaseClass):
"""
A basic tear-down builder that just copies log and config files.
"""
def __init__(self, configfilename... | rsnakamura/oldape | apetools/builders/subbuilders/teardownbuilder.py | Python | apache-2.0 | 1,942 |
# 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 | rl4circopt/rules.py | Python | apache-2.0 | 30,401 |
# coding: utf-8
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
"""Test text-based summary reporting for coverage.py"""
import glob
import os
import os.path
import py_compile
import re
import coverage
from cove... | blueyed/coveragepy | tests/test_summary.py | Python | apache-2.0 | 33,253 |
import datetime
import glob
import os
import random
import requests
import sys
import time
import traceback
from locust import HttpLocust, TaskSet, task
timeout = (0.5, 1.0)
corpus_glob = os.environ["CORPUS_GLOB"]
all_files = glob.glob(corpus_glob)
test_index = os.environ.get("TEST_INDEX", "load_test")
simple_queri... | jmeagher/playground | kubernetes/locust/tasks/tasks.py | Python | apache-2.0 | 5,021 |
# Copyright 2015 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... | brchiu/tensorflow | tensorflow/python/keras/engine/network.py | Python | apache-2.0 | 74,238 |
import mock
from opensearchsdk.apiclient.api_base import Manager
from opensearchsdk.tests import base
from opensearchsdk.v2.search import SearchManager
class AppTest(base.TestCase):
def setUp(self):
super(AppTest, self).setUp()
self.search_manager = SearchManager('', '')
mock_send = mock.... | yanheven/ali-opensearch-sdk | opensearchsdk/tests/v2/test_search.py | Python | apache-2.0 | 1,190 |
from itertools import repeat
import numpy as np
from tensorflow import keras
import sys
sys.path.append("../../Lekhaka")
import telugu as lang
from Lekhaka import Scribe, Deformer, Noiser
from Lekhaka import DataGenerator as Gen
from lab.model_by_function import build_model
from banti2chamanti import banti2chamanti
... | rakeshvar/chamanti_ocr | lab/show_features.py | Python | apache-2.0 | 1,882 |
#!/bin/python
# Copyright 2018-2020 Arm Limited.
# SPDX-License-Identifier: Apache-2.0
#
# 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
#
# ... | ARM-software/bob-build | tests/generate_source/generator.py | Python | apache-2.0 | 1,833 |
#
# Copyright 2019 The FATE 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... | FederatedAI/FATE | examples/pipeline/homo_sbt/pipeline-homo-sbt-binary-with-memory-backend.py | Python | apache-2.0 | 4,517 |
# 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 | tf3d/semantic_segmentation/metric.py | Python | apache-2.0 | 9,713 |
# Copyright 2011 OpenStack LLC.
# 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 b... | NoBodyCam/TftpPxeBootBareMetal | nova/tests/test_plugin_api_extensions.py | Python | apache-2.0 | 2,869 |
"""Copyright 2008 Orbitz WorldWide
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, softwa... | rackerlabs/graphite-api | graphite_api/render/glyph.py | Python | apache-2.0 | 85,060 |
# -*- coding: utf-8 -*-
# Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# 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... | ekarlso/partizan | tests/functional/fixtures/database.py | Python | apache-2.0 | 2,371 |
#!/usr/bin/python
"""Ansible module to transfer files to Cisco IOS devices."""
from ansible.module_utils.basic import *
from netmiko import ConnectHandler, FileTransfer
def main():
"""Ansible module to transfer files to Cisco IOS devices."""
module = AnsibleModule(
argument_spec=dict(
host=... | ktbyers/scp_sidecar | ansible_modules/cisco_file_transfer.py | Python | apache-2.0 | 3,025 |
class APIError(Exception):
"""Represents an error returned in a response to a fleet API call
This exception will be raised any time a response code >= 400 is returned
Attributes:
code (int): The response code
message(str): The message included with the error response
http_error(goo... | cnelson/python-fleet | fleet/v1/errors.py | Python | apache-2.0 | 1,594 |
from intelligine.core.exceptions import MoleculeException
from intelligine.synergy.object.Bug import Bug
from intelligine.cst import CARRYING, TRANSPORTER, ATTACKER, COL_TRANSPORTER, COL_TRANSPORTER_NOT_CARRYING, \
COL_FIGHTER, MODE_EXPLO, MODE_GOHOME, BODY_PART_PHEROMONE_GLAND, TYPE, TYPE_ANT, \
COL_TRANSPORTE... | buxx/intelligine | intelligine/synergy/object/ant/Ant.py | Python | apache-2.0 | 4,135 |
#!/usr/bin/env python2
# Copyright (C) 2013-2014 Computer Sciences 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
#
#... | infochimps-forks/ezbake-common-python | support/django/setup.py | Python | apache-2.0 | 1,200 |
import pcbnew
import wx
import wx.aui
# get the path of this script. Will need it to load the png later.
import inspect
import os
filename = inspect.getframeinfo(inspect.currentframe()).filename
path = os.path.dirname(os.path.abspath(filename))
print("running {} from {}".format(filename, path))
def findPcbnewWind... | mmccoo/kicad_mmccoo | menus_and_buttons/menus_and_buttons.py | Python | apache-2.0 | 2,271 |
from generate_chain_system import *
class BezierConstraintSolverOdd( BezierConstraintSolver ):
'''
Free direction, magnitude fixed (for G1 or A).
'''
def update_system_with_result_of_previous_iteration( self, solution ):
### Iterate only over the parts of the matrix that will change,
### such as the lagrange... | songrun/VectorSkinning | src/bezier_constraint_odd_solver.py | Python | apache-2.0 | 9,730 |
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
from uw_gws.utilities import fdao_gws_override
from uw_pws.util import fdao_pws_override
from uw_hrp.util import fdao_hrp_override
from uw_bridge.util import fdao_bridge_override
| uw-it-aca/bridge-sis-provisioner | sis_provisioner/tests/__init__.py | Python | apache-2.0 | 267 |
# 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... | asimshankar/tensorflow | tensorflow/contrib/distribute/python/parameter_server_strategy.py | Python | apache-2.0 | 21,809 |
from __future__ import unicode_literals
import logging
import os
import socket
import tornado.escape
import tornado.web
import tornado.websocket
import mopidy
from mopidy import core, models
from mopidy.utils import jsonrpc
logger = logging.getLogger(__name__)
def make_mopidy_app_factory(apps, statics):
def ... | liamw9534/mopidy | mopidy/http/handlers.py | Python | apache-2.0 | 5,682 |
#########
# Copyright (c) 2013 GigaSpaces Technologies Ltd. All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | cloudify-cosmo/version-tool | version_control/tests/resources/cloudify-test2/input/cloudify-module/setup.py | Python | apache-2.0 | 1,244 |
## Flow for determining preferences
# Command line for prefs
## ex. fire, cold, phys, magi, asph, acid, pois, elec
# read for each file in directory and then create dict
# for line in test_file
# of lstrip starts with "if line.strip().startswith("replace: prefix-list") and list_name is None :"
## ex dict abbot {}
... | securify/pref-finder | pref-calc.py | Python | apache-2.0 | 3,310 |
# coding=utf-8
# Copyright 2015 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
import hashlib
from builtins import str
from pants.backend.codegen.thrift.java.java_thri... | foursquare/pants | contrib/scrooge/src/python/pants/contrib/scrooge/tasks/java_thrift_library_fingerprint_strategy.py | Python | apache-2.0 | 1,733 |
"""Resolwe contributor serializer."""
from django.contrib import auth
from rest_framework import serializers
from rest_framework.exceptions import ValidationError
from rest_framework.fields import empty
from resolwe.rest.serializers import SelectiveFieldMixin
class ContributorSerializer(SelectiveFieldMixin, seriali... | jberci/resolwe | resolwe/flow/serializers/contributor.py | Python | apache-2.0 | 1,499 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("fluent_contents", "0001_initial")]
operations = [
migrations.CreateModel(
name="GistItem",
fields=[
... | edoburu/django-fluent-contents | fluent_contents/plugins/gist/migrations/0001_initial.py | Python | apache-2.0 | 1,780 |
# Copyright (C) 2016 Universidad Politecnica de Madrid
#
# 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 la... | ging/keystone | keystone/contrib/oauth2/migrate_repo/versions/009_support_postgresql.py | Python | apache-2.0 | 3,936 |
from __future__ import unicode_literals
from moto.core.responses import BaseResponse
from .models import kinesisvideoarchivedmedia_backends
import json
class KinesisVideoArchivedMediaResponse(BaseResponse):
SERVICE_NAME = "kinesis-video-archived-media"
@property
def kinesisvideoarchivedmedia_backend(self... | william-richard/moto | moto/kinesisvideoarchivedmedia/responses.py | Python | apache-2.0 | 3,369 |
"""
sphinx.builders.latex.nodes
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Additional nodes for LaTeX writer.
:copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from docutils import nodes
class captioned_literal_block(nodes.container):
"""A node fo... | sonntagsgesicht/regtest | .aux/venv/lib/python3.9/site-packages/sphinx/builders/latex/nodes.py | Python | apache-2.0 | 1,051 |
import re
import uuid as py_uuid
from common_fixtures import * # NOQA
TEST_IMAGE = 'ibuildthecloud/helloworld'
TEST_IMAGE_LATEST = TEST_IMAGE + ':latest'
TEST_IMAGE_UUID = 'docker:' + TEST_IMAGE
if_docker = pytest.mark.skipif("os.environ.get('DOCKER_TEST') == 'false'",
reason='DOCKER_T... | willseward/cattle | tests/integration/cattletest/core/test_docker.py | Python | apache-2.0 | 31,065 |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/jax | jax/experimental/jax2tf/examples/tf_js/quickdraw/quickdraw.py | Python | apache-2.0 | 6,160 |
import pandas as pd
import pandas.testing as tm
import pyspark.sql.functions as F
import pytest
from pyspark.sql import Window
import ibis
@pytest.mark.parametrize(
('ibis_windows', 'spark_range'),
[
([(ibis.interval(hours=1), 0)], (-3600, 0)), # 1h back looking window
([(ibis.interval(hours... | cloudera/ibis | ibis/backends/pyspark/tests/test_window_context_adjustment.py | Python | apache-2.0 | 13,958 |
# Copyright 2014 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 ... | google/realtime-help | custom-xblocks/realtime_help/views.py | Python | apache-2.0 | 1,410 |
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/struct2tensor | struct2tensor/prensor_value.py | Python | apache-2.0 | 9,379 |
"""Support for Ambient Weather Station Service."""
import asyncio
import logging
from aioambient import Client
from aioambient.errors import WebsocketError
import voluptuous as vol
from homeassistant.components.binary_sensor import DEVICE_CLASS_CONNECTIVITY
from homeassistant.config_entries import SOURCE_IMPORT
from ... | tchellomello/home-assistant | homeassistant/components/ambient_station/__init__.py | Python | apache-2.0 | 20,729 |
#!/usr/bin/env python3
"""Hindsight - Internet history forensics for Google Chrome/Chromium.
This script parses the files in the Chrome data folder, runs various plugins
against the data, and then outputs the results in a spreadsheet.
"""
import argparse
import datetime
import importlib
import logging
import os
impo... | obsidianforensics/hindsight | hindsight.py | Python | apache-2.0 | 15,659 |
# Import Functions
import urllib2
import xml.etree.ElementTree as ET
# Get online XML file
url="https://cghub.ucsc.edu/cghub/metadata/analysisDetail/a8f16339-4802-440c-81b6-d7a6635e604b"
request=urllib2.Request(url, headers={"Accept" : "application/xml"})
u=urllib2.urlopen(request)
tree=ET.parse(u)
root=tree.getroot... | minesh1291/Learning-Python | solutions/parse-xml.py | Python | apache-2.0 | 508 |
#__BEGIN_LICENSE__
# Copyright (c) 2015, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All rights reserved.
#
# The xGDS platform is licensed under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance ... | xgds/xgds_plot | xgds_plot/pandasUtil.py | Python | apache-2.0 | 12,685 |
# Copyright 2011 OpenStack LLC.
# 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 b... | salv-orlando/MyRepo | nova/tests/test_vsa.py | Python | apache-2.0 | 7,062 |
# Copyright 2020 The FedLearner 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... | bytedance/fedlearner | fedlearner/trainer/cluster_server.py | Python | apache-2.0 | 3,797 |
"""
Simple dynamodb health check.
"""
def check_health(graph):
# TODO: Is there a basic service health check to perform here akin to 'SELECT 1;' ?
pass
| globality-corp/microcosm-dynamodb | microcosm_dynamodb/health.py | Python | apache-2.0 | 163 |
'''
'''
import re
import http
import logging
import urllib
import urllib.request
from itertools import *
import collections.abc
from versa.driver import memory
from versa import I, VERSA_BASEIRI, ORIGIN, RELATIONSHIP, TARGET, ATTRIBUTES
from versa.reader import rdfalite
from versa.reader.rdfalite import RDF_NS, SCHEM... | uogbuji/Library.Link | pylib/util.py | Python | apache-2.0 | 17,711 |
###############################################################
# Imports
###############################################################
from System.Diagnostics import *
from System.IO import *
from System import TimeSpan
from Deadline.Events import *
from Deadline.Scripting import *
import re
import sys... | ThinkboxSoftware/Deadline | Custom/events/PriorityClamp/PriorityClamp.py | Python | apache-2.0 | 2,103 |
# -*- coding: utf-8 -*-
from core.exception import ProductError
from core.core import Core
from core.helpers.yaml_literal import Literal
from core.env_manager import EnvManager
from core.helpers.version import compare_versions
from core.download_manager import DownloadManager
from core.log_manager import LogManager
... | helicontech/zoo | Zoocmd/core/models/base_product.py | Python | apache-2.0 | 16,060 |
input = """
% By this example we can check
% a) the correcteness of the jumps-arrays
% b) the correctness of the use of indexLastSolution and
% c) how we eliminate the duplicates of the rule
% ok | -ok
ok | -ok :- p(A,B), q(E,F), r(F,E), t(A), s(B,A).
p(1,2).
p(2,1).
p(3,1).
q(3,4).
r(4,3).
t(1).
s(1,2... | veltri/DLV2 | tests/parser/grounding.backjump.2.test.py | Python | apache-2.0 | 703 |
"""
salt._logging.handlers
~~~~~~~~~~~~~~~~~~~~~~
Salt's logging handlers
"""
import copy
import logging
import logging.handlers
import queue
import sys
from collections import deque
from salt._logging.mixins import ExcInfoOnLogLevelFormatMixin
# from salt.utils.versions import warn_until_date
log = lo... | saltstack/salt | salt/_logging/handlers.py | Python | apache-2.0 | 9,030 |
class ExampleCombiner:
## This example iterator assumes the CQ contains a field name
## and value pair separated by a null delimiter
def onNext(iterator):
if (iterator.hasTop()):
mapping = {}
key = iterator.getTopKey()
cf = key.getColumnFamily()
while (iterator.hasTop() a... | phrocker/sharkbite | examples/jsoncombiner.py | Python | apache-2.0 | 850 |
from collections import defaultdict
from typing import Any, Callable, Dict, List, Mapping, Optional, Sequence, Set, Union
import orjson
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from django.core.exceptions import ValidationError
from django.db import transaction
from django.... | andersk/zulip | zerver/views/streams.py | Python | apache-2.0 | 34,461 |
# 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 th... | philpep/testinfra | testinfra/modules/iptables.py | Python | apache-2.0 | 2,936 |
#!/usr/bin/python
'''
Epilog wrapper for docker images submission to batch systems
Created on Oct 28, 2015
@author: mariojmdavid@gmail.com
'''
import time
import os
import peUtils
if __name__ == '__main__':
print '==========================================='
print '========================================... | LIP-Computing/pelogw | src/epilw.py | Python | apache-2.0 | 950 |
# -*- 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-channel | google/cloud/channel_v1/types/entitlements.py | Python | apache-2.0 | 11,801 |
# Copyright (c) 2018 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 app... | chengduoZH/Paddle | python/paddle/reader/tests/decorator_test.py | Python | apache-2.0 | 5,642 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2013 Boris Pavlovic (boris@pavlovic.me).
# 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
#
# ... | sridevikoushik31/nova | nova/db/sqlalchemy/utils.py | Python | apache-2.0 | 10,646 |
"""
Copyright 2017-present Airbnb, 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, sof... | airbnb/streamalert | streamalert/apps/config.py | Python | apache-2.0 | 18,276 |
# Copyright (c) 2013 Red Hat 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 writi... | tellesnobrega/storm_plugin | sahara/tests/unit/service/validation/edp/test_job_executor_java.py | Python | apache-2.0 | 2,252 |
# #
# Copyright (c) 2005-2017 Apple 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 ... | macosforge/ccs-calendarserver | twistedcaldav/method/post.py | Python | apache-2.0 | 2,228 |
#########################################
# Servo.py
# categories: servo
# more info @: http://myrobotlab.org/service/Servo
#########################################
# uncomment for virtual hardware
Platform.setVirtual(True)
# Every settings like limits / port number / controller are saved after initial use
# so you c... | MyRobotLab/myrobotlab | src/main/resources/resource/Servo/Servo.py | Python | apache-2.0 | 2,843 |
"""
Generic decorators for use in all parts of the system
"""
def delegate_to_callable(fn, err_msg=None):
"""
Delegate a call of the same name to the object returned by the fn() invocation. Useful for lazy initializers and functions
that return a common singleton. Can be used to hoist a singleton objects ... | anchore/anchore-engine | anchore_engine/decorators.py | Python | apache-2.0 | 1,604 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Description
#Β -----------
# Print information about a DEX file in the JSON format
import argparse
import sys
import lief
import json
def main():
parser = argparse.ArgumentParser()
parser.add_argument('file', help='VDEX file')
args = parser.parse_args()
... | lief-project/LIEF | examples/python/vdex_json.py | Python | apache-2.0 | 639 |
# -*- coding: utf-8 -*-
#
# 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... | tswast/google-cloud-python | asset/google/cloud/asset_v1/gapic/transports/asset_service_grpc_transport.py | Python | apache-2.0 | 7,999 |
"""
Django settings for DESIGNDB_REBUILD project.
Generated by 'django-admin startproject' using Django 1.9.7.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
imp... | matt-dale/designdb | DESIGNDB_REBUILD/DESIGNDB_REBUILD/settings.py | Python | apache-2.0 | 3,383 |
"""Gross moist stability-related quantities."""
from aospy.constants import c_p, grav, L_v
from aospy.utils.vertcoord import to_pascal
from indiff.deriv import EtaCenDeriv, CenDeriv
import numpy as np
from .. import PLEVEL_STR
from . import horiz_divg, vert_divg
from .thermo import dse, mse, fmse
def field_vert_int_... | spencerahill/aospy-obj-lib | aospy_user/calcs/gms.py | Python | apache-2.0 | 4,514 |
"""
auth_backend.py
Peter Zujko (@zujko)
Defines Django authentication backend for shibboleth.
04/05/17
"""
from django.contrib.auth.models import User
class Attributes():
EDU_AFFILIATION = 'urn:oid:1.3.6.1.4.1.4447.1.41'
FIRST_NAME = 'urn:oid:2.5.4.42'
LAST_NAME = 'urn:oid:2.5.4.4'
USERNAME = 'urn:... | ritstudentgovernment/PawPrints | auth/auth_backend.py | Python | apache-2.0 | 1,971 |
# -*- coding: utf-8 -*-
# Import python libs
from __future__ import absolute_import
import warnings
# Import third party libs
import yaml
from yaml.nodes import MappingNode
from yaml.constructor import ConstructorError
try:
yaml.Loader = yaml.CLoader
yaml.Dumper = yaml.CDumper
except Exception:
pass
# Thi... | smallyear/linuxLearn | salt/salt/utils/yamlloader.py | Python | apache-2.0 | 3,478 |
#
# Copyright 2019 The FATE 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... | FederatedAI/FATE | python/federatedml/feature/homo_feature_binning/homo_binning_base.py | Python | apache-2.0 | 9,934 |
from typing import List, Dict # noqa
from chalice.config import Config, DeployedResources # noqa
from chalice.deploy import models
MarkedResource = Dict[str, List[models.RecordResource]]
class ResourceSweeper(object):
def execute(self, plan, config):
# type: (models.Plan, Config) -> None
ins... | awslabs/chalice | chalice/deploy/sweeper.py | Python | apache-2.0 | 7,626 |
"""Translate an ics file's events to a different timezone."""
from optparse import OptionParser
from vobject import icalendar, base
try:
import PyICU
except:
PyICU = None
from datetime import datetime
def change_tz(cal, new_timezone, default, utc_only=False, utc_tz=icalendar.utc):
"""
Change the tim... | eventable/vobject | docs/build/lib/vobject/change_tz.py | Python | apache-2.0 | 3,148 |
from __future__ import print_function
import requests
import json
import codecs
from .location import Location
from .base import EvohomeBase
class EvohomeClient(EvohomeBase):
def __init__(self, username, password, debug=False):
super(EvohomeClient, self).__init__(debug)
self.username = username
... | andrew-blake/evohome-client | evohomeclient2/__init__.py | Python | apache-2.0 | 5,034 |
import pytest
from insights.parsers import uname
from insights.tests import context_wrap
from distutils.version import LooseVersion, StrictVersion
import doctest
UNAME1 = "Linux foo.example.com 2.6.32-504.el6.x86_64 #1 SMP Tue Sep 16 01:56:35 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux"
UNAME2 = "Linux rhel7box 3.10.0-... | RedHatInsights/insights-core | insights/parsers/tests/test_uname.py | Python | apache-2.0 | 20,093 |
#
# -*- coding: utf-8 -*-
#
# (C) Copyright 2016 Karellen, Inc. (http://karellen.co/)
#
# 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
#
# U... | karellen/karellen-testing | src/main/python/karellen/testing/mock/__init__.py | Python | apache-2.0 | 7,674 |
# -*- coding: utf-8 -*-
#!/usr/bin/env python
#
# Copyright 2015 BigML
#
# 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 b... | brokendata/bigmler | bigmler/tests/test_05_evaluation.py | Python | apache-2.0 | 14,252 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2016-08-15 10:11:05
# @Author : Zhou Bo (zhoub@suooter.com)
# @Link : http://onlyus.online
# @Version : $Id$
try:
from SimpleXMLRPCServer import SimpleXMLRPCServer
from SimpleXMLRPCServer import SimpleXMLRPCRequestHandler
from SocketServer imp... | congminghaoxue/learn_python | xml_rpc/SimpleXMLRPCServer.py | Python | apache-2.0 | 1,576 |
print "I will now count my chickens:"
print "Hens",25+30.0/6
print "Roosters",100-25*3%4
print "Now I will count the eggs:"
print 3+2+1-5+4%2-1.0/4+6
print "Is it true that 3+2<5-7?"
print 3+2<5-7
print "What is 3+2?",3+2
print "What is 5-7?",5-7
print "Oh,that's why it's False."
print "How about some more."
print "Is ... | Jumpers/MysoftAutoTest | Step1-PythonBasic/Practices/yuxq/1-5/ex3_5.py | Python | apache-2.0 | 410 |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
if __name__ == "__main__":
from build import *
addroot()
import pytools.build as b
b.build()
b.run('qtfract')
| rboman/progs | apps/fractal/cpp_qt/run.py | Python | apache-2.0 | 179 |
# 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 re... | openstack/murano | murano/policy/modify/actions/action_manager.py | Python | apache-2.0 | 3,403 |
"""
General utilities used by the application
"""
import logging
import logging.config
import logging.handlers
import os
def start_app_logging(config=None):
"""
Start logging for the application
:param config:
:return:
"""
# Avoids circular import
from osfoffline import settings
loggin... | chennan47/OSF-Offline | osfoffline/utils/__init__.py | Python | apache-2.0 | 1,132 |
from .entailment.decomposable_attention import DecomposableAttention
from .memory_networks.differentiable_search import DifferentiableSearchMemoryNetwork
from .memory_networks.memory_network import MemoryNetwork
from .memory_networks.softmax_memory_network import SoftmaxMemoryNetwork
from .multiple_choice_qa.decomposab... | RTHMaK/RPGOne | deep_qa-master/deep_qa/models/__init__.py | Python | apache-2.0 | 3,009 |
#!/usr/bin/env python3
"""Prepares a simple TVM library for testing."""
from os import path as osp
import sys
import tvm
def main():
n = tvm.var('n')
A = tvm.placeholder((n,), name='A')
B = tvm.placeholder((n,), name='B')
C = tvm.compute(A.shape, lambda *i: A(*i) + B(*i), name='C')
s = tvm.creat... | mlperf/training_results_v0.6 | Fujitsu/benchmarks/resnet/implementations/mxnet/3rdparty/tvm/rust/tests/test_tvm_basic/src/build_test_lib.py | Python | apache-2.0 | 551 |
import json
import pkg_resources
import pylons
pylons.c = pylons.tmpl_context
pylons.g = pylons.app_globals
from pylons import c
from ming.orm import ThreadLocalORMSession
from datadiff.tools import assert_equal
from allura.lib import helpers as h
from allura.tests import decorators as td
from allura import model as ... | leotrubach/sourceforge-allura | ForgeHg/forgehg/tests/functional/test_controllers.py | Python | apache-2.0 | 6,075 |
from typing import Dict
from overrides import overrides
from keras import backend as K
from keras.layers import Dense, Dropout, Input
from ...data.instances.multiple_choice_qa import QuestionAnswerInstance
from ...layers.wrappers import EncoderWrapper
from ...layers.attention import Attention
from ...training import ... | matt-gardner/deep_qa | deep_qa/models/multiple_choice_qa/question_answer_similarity.py | Python | apache-2.0 | 5,186 |
# third party
from sqlalchemy import Column
from sqlalchemy import ForeignKey
from sqlalchemy import Integer
from sqlalchemy import String
# relative
from . import Base
class BinObjDataset(Base):
__tablename__ = "bin_obj_dataset"
id = Column(Integer(), primary_key=True, autoincrement=True)
name = Column... | OpenMined/PySyft | packages/syft/src/syft/core/node/common/node_table/bin_obj_dataset.py | Python | apache-2.0 | 508 |
# Generated by Django 3.0.3 on 2020-03-13 20:27
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0003_token_permissions'),
]
operations = [
migrations.AlterField(
model_name='token',
name='description',
... | digitalocean/netbox | netbox/users/migrations/0004_standardize_description.py | Python | apache-2.0 | 400 |
# Copyright 2015 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... | hfp/tensorflow-xsmm | tensorflow/python/keras/backend.py | Python | apache-2.0 | 160,654 |
import re
class rgxHandler:
# Taken from https://www.safaribooksonline.com/library/view/python-cookbook-2nd/0596007973/ch01s19.html
linetitles = ["product/productId: ", "product/title: ", "product/price: ", "review/userId: ", "review/profileName: ", "review/helpfulness: ", "review/score: ", "review/time: ", "... | quentinlautischer/291MiniProject2 | src/rgxHandler.py | Python | apache-2.0 | 3,349 |
# -*- coding: utf-8 -*-
#
# catkin_tools documentation build configuration file, created by
# sphinx-quickstart on Mon Feb 24 18:03:21 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
... | NikolausDemmel/catkin_tools | docs/conf.py | Python | apache-2.0 | 8,535 |
# Copyright 2010-2011 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 ap... | pnavarro/neutron | neutron/tests/base.py | Python | apache-2.0 | 13,886 |
# Copyright 2017 NeuStar, 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 a... | sbarbett/ssp-sdk-python | src/blacklists.py | Python | apache-2.0 | 1,822 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import utool as ut
import vtool_ibeis as vt
import numpy as np
import ubelt as ub
import pandas as pd
import dtool_ibeis as dt
from os.path import join
from ibeis.algo.graph import nx_utils as nxu
from ibeis.core_... | Erotemic/ibeis | ibeis/algo/verif/pairfeat.py | Python | apache-2.0 | 20,369 |
#! /usr/local/bin/python3
# Usage: binning.py filter_data data_to_extract_from column1 column2 cutoff1 cutoff2
import sys
import os
def main(*argv):
fn = sys.argv[1]
my_data = sys.argv[2]
my_column1 = int(sys.argv[3])-1
my_column2 = int(sys.argv[4])-1
my_cutoff1 = float(sys.argv[5])
my_cuto... | demharters/git_scripts | binning_two_files_two_columns.py | Python | apache-2.0 | 2,034 |
# 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 ... | chessco/cursus | controllers/utils.py | Python | apache-2.0 | 25,293 |
import json
import unittest
from crassus.deployment_response import DeploymentResponse
from crassus.output_converter import OutputConverter
from mock import call, patch
from utils import load_fixture_json
cfn_event = load_fixture_json('cfn_event.json')
cfn_event_different_termination = load_fixture_json(
'cfn_eve... | ImmobilienScout24/crassus | src/unittest/python/output_converter_tests.py | Python | apache-2.0 | 5,826 |
from __future__ import absolute_import, unicode_literals
import unittest
from mopidy.internal import path
from mopidy.models import Album, Artist, Playlist, TlTrack, Track
from mopidy.mpd import translator
class TrackMpdFormatTest(unittest.TestCase):
track = Track(
uri='a uri',
artists=[Artist(n... | dbrgn/mopidy | tests/mpd/test_translator.py | Python | apache-2.0 | 6,809 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-09 14:43
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('batch', '0002_auto_20170412_1225'),
('recipe', '001... | ngageoint/scale | scale/storage/migrations/0008_auto_20170609_1443.py | Python | apache-2.0 | 1,859 |
from prime_check import isprime
prim_list = []
for i in xrange(100):
if isprime(i):
prim_list += [i]
print prim_list
count = 1
prod = 1
while (prod <= 1000000):
prod = 1
for i in xrange(count):
prod *= prim_list[i]
count +=1
print prod
print count
p... | khaleeque-ansari/Online-Coding- | ProjectEulerCode/prob69.py | Python | apache-2.0 | 434 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | hortonworks/hortonworks-sandbox | apps/help/src/help/tests.py | Python | apache-2.0 | 1,364 |
# Lint as: python3
# Copyright 2017 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 ... | annarev/tensorflow | tensorflow/compiler/xla/python/xla_client.py | Python | apache-2.0 | 24,551 |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... | napalm-automation/napalm-yang | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/bgp/global_/state/__init__.py | Python | apache-2.0 | 36,541 |
# -*- coding: utf-8 -*-
'''
Support for reboot, shutdown, etc
'''
from __future__ import absolute_import
import salt.utils
def __virtual__():
'''
Only supported on POSIX-like systems
'''
if salt.utils.is_windows() or not salt.utils.which('shutdown'):
return False
return True
def halt():... | smallyear/linuxLearn | salt/salt/modules/system.py | Python | apache-2.0 | 1,800 |