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 |
|---|---|---|---|---|---|
#!/usr/bin/python
from azuremodules import *
import argparse
import sys
import time
#for error checking
parser = argparse.ArgumentParser()
parser.add_argument('-H', '--serverip', help='specifies server VIP of server name', required=True)
parser.add_argument('-u', '--udp', help='switch : starts the client in udp dat... | xian123/azure-linux-automation | remote-scripts/start-netperf-client.py | Python | apache-2.0 | 1,985 |
# 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 use ... | cloudkick/libcloud | libcloud/base.py | Python | apache-2.0 | 1,286 |
# Copyright 2014 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, ... | calpeyser/google-cloud-python | datastore/google/cloud/datastore/query.py | Python | apache-2.0 | 19,823 |
# coding=utf-8
# Copyright 2020 The HuggingFace Inc. team.
#
# 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... | huggingface/pytorch-transformers | utils/get_modified_files.py | Python | apache-2.0 | 1,484 |
# Copyright (c) 2012 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 requi... | maoy/zknova | nova/compute/resource_tracker.py | Python | apache-2.0 | 23,300 |
# 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 required by applica... | alexgorban/models | research/object_detection/core/box_list_ops.py | Python | apache-2.0 | 43,889 |
import copy
from datetime import datetime
from dateutil import parser
from contextlib import contextmanager
from memsql_loader.util import apsw_helpers, super_json as json
from memsql_loader.util.apsw_sql_step_queue.errors import TaskDoesNotExist, StepAlreadyStarted, StepNotStarted, StepAlreadyFinished, StepRunning, A... | memsql/memsql-loader | memsql_loader/util/apsw_sql_step_queue/task_handler.py | Python | apache-2.0 | 10,504 |
# coding=utf-8
# Copyright 2022 The REALM authors and The HuggingFace Inc. team.
#
# 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 ... | huggingface/transformers | src/transformers/models/realm/tokenization_realm_fast.py | Python | apache-2.0 | 14,317 |
#Задача 5.Вариант 29.
#Напишите программу, которая бы при запуске случайным образом отображала имя одного из пяти членов экипажей программы "Союз - Апполон".
#Чинкиров В.В.
#28.03.2016
import random
print("Программа случайным образом отображает имя одного из пяти членов экипажа Союз-Апполон")
x = int (random.randint(... | Mariaanisimova/pythonintask | INBa/2015/Chinkirov_V_V/task_5_29.py | Python | apache-2.0 | 939 |
#
# 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/fate_client/flow_sdk/client/api/base.py | Python | apache-2.0 | 1,520 |
# 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 License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIE... | kubeflow/pipelines | components/gcp/container/component_sdk/python/tests/google/bigquery/test__query.py | Python | apache-2.0 | 5,793 |
import queue
import sys
import threading
import traceback
from halocoin import tools
from halocoin.ntwrk.message import Order
class NoExceptionQueue(queue.Queue):
"""
In some cases, queue overflow is ignored. Necessary try, except blocks
make the code less readable. This is a special queue class that
... | halilozercan/halocoin | halocoin/service.py | Python | apache-2.0 | 11,707 |
import numpy as np
def get_triangles(npimage, depth=10):
"""
Makes upper left and lower right triangles. Takes in numpy array, returns array of triangles. Automatically
excludes invalid triangles (triangles with one vertex off the edge)
"""
npimage = npimage + depth
h, w = npimage.shape
y, x = np.indices((h, w)... | leisir2017/dyp | app/tools/img2stl/meshcreator.py | Python | apache-2.0 | 5,411 |
from enum import IntEnum
class FingerPosition(IntEnum):
VerticalUp = 0
VerticalDown = 1
HorizontalLeft = 2
HorizontalRight = 3
DiagonalUpRight = 4
DiagonalUpLeft = 5
DiagonalDownRight = 6
DiagonalDownLeft = 7
@staticmethod
def get_finger_position_name(finger_position):
... | dedoogong/asrada | HandPose_Detector/FingerPosition.py | Python | apache-2.0 | 1,202 |
import pdb
def calc(i, n):
j = i * n
return j
def f(n):
for i in range(n):
j = calc(i, n)
print(i, j)
return
if __name__ == '__main__':
pdb.set_trace()
f(5)
| jasonwee/asus-rt-n14uhp-mrtg | src/lesson_developer_tools/pdb_next.py | Python | apache-2.0 | 202 |
#!/usr/bin/env python
if __name__ == '__main__':
from gevent import monkey
monkey.patch_all()
import redis
import json
import pprint
import argparse
import mturk_vision
import base64
import uuid
import pickle
import time
import databases
from hadoop_parse import scrape_hadoop_jobs
class UnauthorizedException(... | bwhite/picarus | server/jobs.py | Python | apache-2.0 | 9,515 |
# Copyright 2020 Google 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 by applicable law or a... | google-business-communications/bm-bonjour-meal-django-starter-code | bonjourmeal-codelab/full-sample/bmcodelab/urls.py | Python | apache-2.0 | 1,533 |
##############################
### ALGO MODULE SETUP TOOL ###
##############################
from distutils.core import setup
setup(name='algo',
version='1.0',
python_modules=['alg... | MicBrain/Python-algo-Module | setup.py | Python | apache-2.0 | 2,077 |
# -*- coding: utf-8 -*-
"""
Base settings file, common to all environments.
These settings can be overridden in local.py.
"""
import datetime
import os
import json
import hashlib
import logging
from datetime import timedelta
from collections import OrderedDict
os_env = os.environ
def parent_dir(path):
'''Return... | aaxelb/osf.io | website/settings/defaults.py | Python | apache-2.0 | 47,085 |
#!/usr/bin/env python
"""settings.py
Udacity conference server-side Python App Engine app user settings
$Id$
created/forked from conference.py by wesc on 2014 may 24
"""
# Replace the following lines with client IDs obtained from the APIs
# Console or Cloud Console.
WEB_CLIENT_ID = '86908364842-sk7dtpvg5of9fr95pm... | jamesyin96/conference_central | settings.py | Python | apache-2.0 | 494 |
# Copyright 2019 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... | ros2/launch | launch_testing/launch_testing/actions/gtest.py | Python | apache-2.0 | 1,364 |
# 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
# d... | openstack/senlin | senlin/tests/unit/cmd/test_conductor.py | Python | apache-2.0 | 1,992 |
class UNA(object):
"""Wrapper class for UNA (Service String Advice) components."""
component_data_element_separator = ':'
data_element_separator = '+'
decimal_mark = ','
release_character = '?'
segment_terminator = '\''
@staticmethod
def is_valid_una_string(input_string):
"""Re... | FriedrichK/python-edifact | edifact/message_headers/una.py | Python | apache-2.0 | 1,786 |
from __future__ import unicode_literals
import logging
import hashlib
from mopidy.backends import base
from mopidy.models import Artist, Album, Track, SearchResult
logger = logging.getLogger('mopidy.backends.gmusic')
class GMusicLibraryProvider(base.BaseLibraryProvider):
def find_exact(self, query=None, uris=... | jeh/mopidy-gmusic | mopidy_gmusic/library.py | Python | apache-2.0 | 11,350 |
# 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 ... | anthkris/oppia | core/controllers/base.py | Python | apache-2.0 | 20,845 |
# Copyright 2019 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 a... | google/timesketch | api_client/python/timesketch_api_client/sketch.py | Python | apache-2.0 | 66,968 |
"""Theia CLI entrypoint.
"""
from theia.cli.parser import get_parent_parser
from theia.cli.watcher import get_parser as get_watcher_parser, run_watcher
from theia.cli.collector import get_parser as get_collector_parser, run_collector
from theia.cli.query import get_parser as get_query_parser, run_query
def run_cli():
... | theia-log/theia | theia/cli/__main__.py | Python | apache-2.0 | 1,067 |
#!/usr/bin/env python
"""
Problem Definition :
"""
__author__ = 'vivek'
import time
startTime = time.clock()
special_cards = ['T','J','Q','K','A']
special_cards_translate = {'T':'10','J':'11', 'Q':'12', 'K':'13', 'A':'14'}
def divide_cards(data) :
cards = data.split(' ')
p1 = {}
p2 = {}
for i... | vivekpabani/projecteuler | python/054/problem_054.py | Python | apache-2.0 | 731 |
# 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 required by applica... | dyoung418/tensorflow | tensorflow/contrib/estimator/python/estimator/logit_fns.py | Python | apache-2.0 | 3,764 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
.. py:currentmodule:: pymcxray.Simulation
.. moduleauthor:: Hendrix Demers <hendrix.demers@mail.mcgill.ca>
MCXRay simulation parameters.
"""
###############################################################################
# Copyright 2017 Hendrix Demers
#
# Licensed ... | drix00/pymcxray | pymcxray/Simulation.py | Python | apache-2.0 | 58,934 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2013 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual 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 L... | cvandeplas/plaso | plaso/parsers/plist.py | Python | apache-2.0 | 5,390 |
# ----------------------------------------------------------------------
# Copyright (c) 2010-2014 Raytheon BBN Technologies
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and/or hardware specification (the "Work") to
# deal in the Work without restriction, including... | ict-felix/stack | modules/resource/orchestrator/src/credentials/cred_util.py | Python | apache-2.0 | 16,348 |
# Copyright 2015-2019 Yelp 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 writin... | Yelp/paasta | paasta_tools/check_services_replication_tools.py | Python | apache-2.0 | 8,925 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-08 15:45
from __future__ import unicode_literals
from django.db import migrations
import share.robot
class Migration(migrations.Migration):
dependencies = [
('share', '0001_initial'),
('djcelery', '0001_initial'),
]
operatio... | zamattiac/SHARE | providers/edu/opensiuc/migrations/0001_initial.py | Python | apache-2.0 | 661 |
import errno
import os
for num in [errno.ENOENT, errno.EINTR, errno.EBUSY]:
name = errno.errorcode[num]
print('[{num:>2}] {name:<6}: {msg}'.format(
name=name, num=num, msg=os.strerror(num)))
| jasonwee/asus-rt-n14uhp-mrtg | src/lesson_runtime_features/os_strerror.py | Python | apache-2.0 | 208 |
#!/usr/bin/env python
#
# -*- coding: utf-8 -*-
#
# This file is part of PyBuilder
#
# Copyright 2011-2015 PyBuilder Team
#
# 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
#
# ... | esc/pybuilder | build.py | Python | apache-2.0 | 6,011 |
#TODO replace RPSGame with this class(for clarity)
__author__ = "Paul Council, Joseph Gonzoph, Anand Patel"
__version__ = "sprint1"
__credits__ = ["Greg Richards"]
# imports
from ServerPackage import Game
class RockPaperScissors(Game.Game):
""" this class simulates two players playing a game of rock, paper, sci... | PaulieC/sprint2-Council | AvailableGames/RockPaperScissors.py | Python | apache-2.0 | 2,006 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.python import core, workspace
from hypothesis import given
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
import numpy as n... | bwasti/caffe2 | caffe2/python/operator_test/rank_loss_operator_test.py | Python | apache-2.0 | 4,147 |
__author__ = 'quanix'
| idomac/pyserver | node/common/__init__.py | Python | apache-2.0 | 22 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2009 Scott Kirkwood. All Rights Reserved.
"""
Build everything for mm2s5.
You'll need:
sudo apt-get install alien help2man fakeroot lintian
Also python-bdist
"""
from pybdist import pybdist
import optparse
import setup
def main():
parser = optparse.OptionPars... | scottkirkwood/mm2s5 | build_all.py | Python | apache-2.0 | 556 |
from collections import Counter
from scattertext.external.phrasemachine import phrasemachine
from scattertext.features.FeatsFromSpacyDoc import FeatsFromSpacyDoc
class PhraseMachinePhrases(FeatsFromSpacyDoc):
'''
Returns unigrams and phrase machine phrases
'''
def get_feats(self, doc):
'''
Parameters
----... | JasonKessler/scattertext | scattertext/features/PhraseMachinePhrases.py | Python | apache-2.0 | 1,370 |
# -*- coding: utf-8 -*-
#
# lect documentation build configuration file, created by
# sphinx-quickstart on Fri Aug 2 17:40:25 2013.
#
# 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.
#
# All co... | dhh1128/lect | docs/source/conf.py | Python | apache-2.0 | 9,538 |
import os
import time
import json
import datetime
import requests
import threading
import ConfigParser
import paho.mqtt.client as mqtt
from InformationFetcher import InformationFetcher
from Template import TemplateMatcher
from requests.auth import HTTPBasicAuth
SECOND = 1
MINUTE = 60 * SE... | AnsgarSchmidt/sensomatic | server/Tank.py | Python | apache-2.0 | 9,629 |
# -*- coding: utf-8 -*-
# Copyright 2014 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 requi... | SmartInfrastructures/fuel-web-dev | nailgun/nailgun/api/v1/handlers/plugin.py | Python | apache-2.0 | 2,321 |
from rest_framework import serializers
from accounts.models import Account
class AccountImageSerializer(serializers.Serializer):
"""
A serializer for account images.
The main purpose of this class is to provide a subschema
for the type of the account.image in responses.
"""
small = serializ... | stencila/hub | manager/accounts/api/serializers_account_image.py | Python | apache-2.0 | 740 |
# -*- 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-debugger-client | samples/generated_samples/clouddebugger_v2_generated_debugger2_get_breakpoint_sync.py | Python | apache-2.0 | 1,557 |
from viterbi import Viterbi
from rtree import Rtree
from spatialfunclib import *
class GPSMatcher:
def __init__(self, hmm, emission_probability, constraint_length=10, MAX_DIST=500, priors=None, smallV=0.00000000001):
# initialize spatial index
self.previous_obs = None
if pr... | Vanuan/gpx_to_road_map | biagoni2012/gpsmatcher.py | Python | apache-2.0 | 2,740 |
# Copyright 2014-2016 OpenMarket Ltd
#
# 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... | matrix-org/synapse | synapse/rest/client/profile.py | Python | apache-2.0 | 5,704 |
# -*- coding: iso-8859-1 -*-
"""
MoinMoin - Clock
@copyright: 2001-2003 Juergen Hermann <jh@web.de>,
2003-2006 MoinMoin:ThomasWaldmann
@license: GNU GPL, see COPYING for details.
"""
import time
class Clock:
""" Helper class for code profiling
we do not use time.clock() as thi... | RealTimeWeb/wikisite | MoinMoin/util/clock.py | Python | apache-2.0 | 2,028 |
"""IPA-GNN models."""
from typing import Any
from flax import linen as nn
import jax
import jax.numpy as jnp
from core.data import error_kinds
from core.modules.ipagnn import compressive_ipagnn
from core.modules.ipagnn import encoder
from core.modules.ipagnn import ipagnn
from core.modules.ipagnn import logit_math
f... | google-research/runtime-error-prediction | core/models/ipagnn.py | Python | apache-2.0 | 6,218 |
# Copyright 2016 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 applicab... | wangyang59/tf_models | video_prediction/prediction_input_flo_chair_old.py | Python | apache-2.0 | 4,801 |
# Copyright 2015 Cloudbase Solutions Srl
# 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 r... | bacaldwell/ironic | ironic/tests/unit/drivers/modules/msftocs/test_power.py | Python | apache-2.0 | 7,843 |
# 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... | aristanetworks/arista-ovs-nova | nova/tests/test_metadata.py | Python | apache-2.0 | 17,823 |
import os
import warnings
import numpy as np
from pyrates.utility.genetic_algorithm import CGSGeneticAlgorithm
from pandas import DataFrame, read_hdf
from copy import deepcopy
class CustomGOA(CGSGeneticAlgorithm):
def eval_fitness(self, target: list, **kwargs):
# define simulation conditions
wor... | Richert/BrainNetworks | BasalGanglia/stn_gpe_str_opt.py | Python | apache-2.0 | 14,060 |
#
# Copyright 2017 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/ion | ion/dev/replace_strings.py | Python | apache-2.0 | 3,728 |
import os
from collections import defaultdict
from dataclasses import asdict
from pathlib import Path
from unittest import mock
import numpy as np
import pydicom
import pytest
from panimg.image_builders.dicom import (
_get_headers_by_study,
_validate_dicom_files,
format_error,
image_builder_dicom,
)
fr... | comic/comic-django | app/tests/cases_tests/test_dicom.py | Python | apache-2.0 | 5,037 |
#
# 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 us... | holdenk/spark | python/pyspark/rdd.py | Python | apache-2.0 | 109,178 |
# Copyright (C) 2017 FireEye, Inc. All Rights Reserved.
import contextlib
import envi
import viv_utils
class ApiMonitor(viv_utils.emulator_drivers.Monitor):
"""
The ApiMonitor observes emulation and cleans up API function returns.
"""
def __init__(self, vw, function_index):
viv_utils.emulat... | fireeye/flare-floss | floss/api_hooks.py | Python | apache-2.0 | 14,484 |
from django import forms
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.utils.safestring import mark_safe
from dcim.models import DeviceRole, Platform, Region, Site
from tenancy.models import Tenant, TenantGroup
from utilities.forms import (
add_b... | digitalocean/netbox | netbox/extras/forms.py | Python | apache-2.0 | 11,110 |
"""
CeilometerConf - file ``/etc/ceilometer/ceilometer.conf``
=========================================================
The ``/etc/ceilometer/ceilometer.conf`` file is in a standard '.ini' format,
and this parser uses the IniConfigFile base class to read this.
Given a file containing the following test data::
[D... | wcmitchell/insights-core | insights/parsers/ceilometer_conf.py | Python | apache-2.0 | 1,890 |
"""Support for Google Assistant Smart Home API."""
from asyncio import gather
from collections.abc import Mapping
from itertools import product
import logging
from homeassistant.util.decorator import Registry
from homeassistant.core import callback
from homeassistant.const import (
CLOUD_NEVER_EXPOSED_ENTITIES, C... | jamespcole/home-assistant | homeassistant/components/google_assistant/smart_home.py | Python | apache-2.0 | 12,254 |
import Queue
import handlers
import inspect
import threading
import pkgutil
import os
import sys
import imp
from gatherer import Gatherer
import signal
import platform
import ConfigParser
class GatherAgent(object):
"""
A simple layer between inputs (gatherers) and output (handler) using a simple
implementa... | burmanm/gather_agent | gather_agent/gather_agent.py | Python | apache-2.0 | 5,283 |
import sys
import time
import uuid
import pandaserver.userinterface.Client as Client
from pandaserver.taskbuffer.JobSpec import JobSpec
from pandaserver.taskbuffer.FileSpec import FileSpec
aSrvID = None
prodUserNameDefault = 'unknown-user'
prodUserName = None
prodUserNameDP = None
prodUserNamePipeline = None
site = '... | PanDAWMS/panda-server | pandaserver/test/lsst/lsstSubmit.py | Python | apache-2.0 | 5,693 |
#!/usr/bin/python -W all
"""
combineCsv.py: adapt values in a csv file based on values in a second file
usage: combineCsv.py [-c] -k column -v column -F file2 -K column -V column < file1
notes: changes values in column v of file1 to value in column V of file2
when values in key columns k and K match
optio... | online-behaviour/machine-learning | combineCsv.py | Python | apache-2.0 | 3,006 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import oauth2client.django_orm
class Migration(migrations.Migration):
dependencies = [
('sites', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Profile',... | thecut/thecut-googleanalytics | thecut/googleanalytics/migrations/0001_initial.py | Python | apache-2.0 | 1,911 |
import unittest
from igraph import Graph
class TestIgraph(unittest.TestCase):
def test_graph(self):
# Create a graph with 10 vertices & 2 children each.
g2 = Graph.Tree(n=10, children=2)
self.assertEqual(9, len(g2.get_edgelist()))
| Kaggle/docker-python | tests/test_igraph.py | Python | apache-2.0 | 272 |
#
# 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... | Juniper/ceilometer | ceilometer/event/storage/impl_elasticsearch.py | Python | apache-2.0 | 11,518 |
# -*- coding: utf-8 -*-
# Scrapy settings for crawlAll project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
# http://scrapy.readthedocs.org/en/lates... | RennesUsher/crawlAll | crawlAll/settings.py | Python | apache-2.0 | 3,379 |
from __future__ import unicode_literals
from collections import defaultdict
import datetime
import json
from moto.compat import OrderedDict
from moto.core import BaseBackend
from .comparisons import get_comparison_func
from .utils import unix_time
class DynamoJsonEncoder(json.JSONEncoder):
def default(self, obj)... | 2mf/moto | moto/dynamodb2/models.py | Python | apache-2.0 | 15,127 |
import json
import pytest
import requests
from globus_sdk.transfer.paging import PaginatedResource
from globus_sdk.transfer.response import IterableTransferResponse
N = 25
class PagingSimulator:
def __init__(self, n):
self.n = n # the number of simulated items
def simulate_get(
self, path... | globusonline/globus-sdk-python | tests/unit/test_transfer_paging.py | Python | apache-2.0 | 4,108 |
# Copyright 2019 The Magenta 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 in ... | jesseengel/magenta | magenta/pipelines/pipeline_test.py | Python | apache-2.0 | 8,715 |
#!/usr/bin/env python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012 NEC Corporation.
# Based on ryu/openvswitch agents.
#
# Copyright 2012 Isaku Yamahata <yamahata at private email ne jp>
# Copyright 2011 Nicira Networks, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0... | rossella/neutron | quantum/plugins/nec/agent/nec_quantum_agent.py | Python | apache-2.0 | 4,286 |
# -*- 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 or... | googleapis/python-dialogflow | samples/generated_samples/dialogflow_generated_dialogflow_v2_documents_delete_document_async.py | Python | apache-2.0 | 1,580 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.Create... | Andrew0701/coursework-web | progress/home/migrations/0001_initial.py | Python | apache-2.0 | 4,089 |
#!/usr/bin/env python
"""
builder plugin
Define the plugin base API for builders
for managing virtualenvs of various flavours
"""
import os
import re
import argparse
import subprocess
from collections import namedtuple
from cirrus.configuration import load_configuration
from cirrus.environment import repo_directory... | evansde77/cirrus | src/cirrus/builder_plugin.py | Python | apache-2.0 | 4,230 |
from mysharky.writers import SharkyWriterConnection
#TODO should be able to pass parameters to conn fn
def mongo_conn(self):
from pymongo import MongoClient
m= MongoClient()['shark']['test']
return m
def mongo_processor(tweet, target_queue):
## TODO: recast datetime
target_queue.put(tweet)
def mongo_single_... | rawkintrevo/sharky | mysharky/prebuilt_sharky_writer_connections.py | Python | apache-2.0 | 1,720 |
from math import ceil
def round(valor, n, max_value, precision):
result = int(ceil(valor / (max_value * (precision / n))))
return result
def calcular_mochila(items, pesoMax, precision):
n = len(items)
filtered_items = filter(lambda item: (item[1] <= pesoMax), items)
max_value = reduce(lambda ite... | GFibrizo/TPS_7529 | TP3/Mochila_aprox/calculador_mochila.py | Python | apache-2.0 | 1,966 |
"""
Copyright (c) 2016 Jet Propulsion Laboratory,
California Institute of Technology. All rights reserved
"""
import json
import unittest
import urllib
from multiprocessing.pool import ThreadPool
from unittest import skip
import numpy as np
from mock import Mock
from nexustiles.model.nexusmodel import Tile, BBox
from... | dataplumber/nexus | analysis/tests/algorithms/StandardDeviationSearch_test.py | Python | apache-2.0 | 9,139 |
import os
import pandas as pd
from igf_data.utils.seqrunutils import get_seqrun_date_from_igf_id
def _count_total_reads(data,seqrun_list):
'''
An internal function for counting total reads
required params:
:param data, A dictionary containing seqrun ids a key an read counts as values
:param seqrun_list, ... | imperial-genomics-facility/data-management-python | igf_data/utils/project_data_display_utils.py | Python | apache-2.0 | 8,493 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-04-08 11:04
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0004_myuser_is_approved'),
]
operations = [
migrations.AddField(
... | BD2KGenomics/brca-website | django/users/migrations/0005_myuser_email_me.py | Python | apache-2.0 | 450 |
# coding=utf-8
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License");... | iemejia/incubator-beam | sdks/python/apache_beam/examples/snippets/transforms/elementwise/flatmap.py | Python | apache-2.0 | 7,404 |
"""
Return data to a memcache server
To enable this returner the minion will need the python client for memcache
installed and the following values configured in the minion or master
config, these are the defaults.
.. code-block:: yaml
memcache.host: 'localhost'
memcache.port: '11211'
Alternative configurat... | saltstack/salt | salt/returners/memcache_return.py | Python | apache-2.0 | 5,855 |
# Copyright 2022 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 | pages/metrics_test.py | Python | apache-2.0 | 2,931 |
# Lint as: python3
"""Unit tests for dmiparse."""
import os
import dmiparse
from google3.pyglib import resources
from google3.testing.pybase import googletest
TEST_PATH = 'google3/third_party/py/dmiparse/test_data'
class DmiParserTest(googletest.TestCase):
def setUp(self):
super(DmiParserTest, self).setUp(... | google/smbios-validation-tool | dmiparse/dmiparse_test.py | Python | apache-2.0 | 3,929 |
DEBUG = True
SQLALCHEMY_DATABASE_URI = 'sqlite:///../instance/pa-hotness.db' | Code4SA/pa-hotness | instance/config.py | Python | apache-2.0 | 76 |
# Copyright 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 req... | CingHu/neutron-ustack | neutron/extensions/loadbalancer.py | Python | apache-2.0 | 19,800 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
if sys.version_info >= (3, 0):
from unittest.mock import patch
else:
from mock import patch
from pyfakefs import fake_filesystem_unittest
from shellfoundry.utilities.config.config_context import ConfigContext
from shellfoundry.utilities.config.config_file_... | QualiSystems/shellfoundry | tests/test_utilities/config/test_config_record.py | Python | apache-2.0 | 5,062 |
"""
Platform independent versions of some os/os.path functions. Gets around PY2's
lack of support for reading NTFS links.
"""
import logging
import os
import posixpath
import re
from collections.abc import Iterable
import salt.utils.args
import salt.utils.platform
import salt.utils.stringutils
from salt.exceptions i... | saltstack/salt | salt/utils/path.py | Python | apache-2.0 | 11,038 |
# -*- 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 or... | googleapis/python-datacatalog | samples/generated_samples/datacatalog_generated_datacatalog_v1beta1_data_catalog_create_tag_template_sync.py | Python | apache-2.0 | 1,586 |
#!/bin/python3
if __name__ == '__main__':
a = int(input())
b = int(input())
print(a // b)
print(a / b) | oleg-cherednik/hackerrank | Python/Introduction/Python - Division/solution.py | Python | apache-2.0 | 120 |
import tornado.web
import tornado.gen
import json
import io
import logging
from mickey.basehandler import BaseHandler
from mickey.groups import GroupMgrMgr, MickeyGroup
class AcceptInviteHandler(BaseHandler):
@tornado.web.asynchronous
@tornado.gen.coroutine
def post(self):
data = json.loads(self.r... | micjerry/groupservice | handlers/acceptinvite.py | Python | apache-2.0 | 951 |
"""The airvisual component."""
import asyncio
from datetime import timedelta
from math import ceil
from pyairvisual import CloudAPI, NodeSamba
from pyairvisual.errors import (
AirVisualError,
InvalidKeyError,
KeyExpiredError,
NodeProError,
)
from homeassistant.config_entries import SOURCE_REAUTH
from ... | partofthething/home-assistant | homeassistant/components/airvisual/__init__.py | Python | apache-2.0 | 13,229 |
#!/usr/bin/env python3 -tt
"""
Utility methods for strings.
"""
class StringTool:
def __init__(self):
pass
def clean_string(self, a_string):
"""
Return string with unwanted punctuation removed.
Currently uses str.replace()
Could make more efficient using regular exp... | beepscore/google-python-exercises | basic/string_tool.py | Python | apache-2.0 | 2,076 |
from parsl.channels import SSHChannel
from parsl.providers import SlurmProvider
from parsl.launchers import SrunLauncher
from parsl.config import Config
from parsl.executors.ipp import IPyParallelExecutor
from parsl.executors.ipp_controller import Controller
# This is an example config, make sure to
# replace ... | swift-lang/swift-e-lab | parsl/configs/comet_ipp_multinode.py | Python | apache-2.0 | 1,364 |
# coding=utf-8
# Copyright 2022 The TensorFlow Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | tensorflow/datasets | tensorflow_datasets/text/openbookqa.py | Python | apache-2.0 | 4,817 |
# 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/clusterfuzz | src/clusterfuzz/_internal/tests/appengine/handlers/issue_redirector_test.py | Python | apache-2.0 | 2,102 |
# -*- coding: utf-8 -*-
""" Implements a Class for Representing a Simulated Senate Election. """
from collections import Counter
from random import random
from random import seed as set_seed
from time import asctime
from time import localtime
from aus_senate_audit.senate_election.base_senate_election import BaseSena... | berjc/aus-senate-audit | aus_senate_audit/senate_election/simulated_senate_election.py | Python | apache-2.0 | 3,665 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017-2018 KuraLabs S.R.L
#
# 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... | kuralabs/flowbber | lib/flowbber/plugins/sinks/print.py | Python | apache-2.0 | 1,764 |
from cloudman.cloudman.models import TopLevelAllocationByZone,TopLevelAllocation,TopLevelAllocationAllowedResourceType
from cloudman.cloudman.models import ProjectAllocation,Project,ProjectMetadata,ProjectAllocationMetadata,GroupAllocation
from cloudman.cloudman.models import GroupAllocationMetadata
from cloudman.cloud... | cernops/CloudMan | export/export.py | Python | apache-2.0 | 11,272 |
"""Script to add DNS records to TinyDNS"""
import logging
import os
import subprocess
DEFAULT_NS_TTL = 600
DEFAULT_TTL = 60
DEFAULT_WEIGHT = 10
DEFAULT_PRIORITY = 10
_LOGGER = logging.getLogger(__name__)
class TinyDnsClient(object):
"""Helper class to call tinyDNS"""
def __init__(self, dns_path):
... | gaocegege/treadmill | treadmill/tinydns_client.py | Python | apache-2.0 | 2,375 |