repo_name
stringlengths
5
104
path
stringlengths
4
248
content
stringlengths
102
99.9k
lxc/pylxd
pylxd/models/tests/test_model.py
# Copyright (c) 2016 Canonical 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 ...
rossella/neutron
quantum/plugins/cisco/tests/unit/test_cisco_extension.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # 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/l...
igordcard/RO
osm_ro/vmware_utils/OVF_converter/format_converter/command_progress.py
#!/usr/bin/env python # -*- coding: utf-8 -*- ## # Copyright 2016-2017 VMware Inc. # This file is part of ETSI OSM # 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 # # ...
google/balloon-learning-environment
docs/conf.py
# coding=utf-8 # Copyright 2022 The Balloon Learning Environment 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 require...
antont/tundra
src/Application/PythonScriptModule/pymodules_old/lib/webdav/acp/Principal.py
# Copyright 2008 German Aerospace Center (DLR) # # 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 agre...
liveonnet/p3_server
lib/applog.py
#coding=utf8 import os import logging import logging.handlers import socket #-#from multiprocessing import Queue #-#import threading #-#import traceback #-#from urllib.parse import unquote #-#from io import StringIO #-#import types #-#from Queue import Empty #-#from time import sleep #-#from cPickle import dumps #-#fr...
lorensen/VTKExamples
src/Python/IO/ReadSLC.py
#!/usr/bin/env python import vtk def main(): InputFilename = get_program_parameters() colors = vtk.vtkNamedColors() # vtkSLCReader to read. reader = vtk.vtkSLCReader() reader.SetFileName(InputFilename) reader.Update() # Create a mapper. mapper = vtk.vtkPolyDataMapper() mapper.S...
rwightman/tensorflow-litterbox
litterbox/layers/lstm.py
# Copyright (C) 2016 Ross Wightman. 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 # =================================...
olivierlemasle/murano
murano/tests/functional/engine/config.py
# Copyright (c) 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 agreed to in w...
airbnb/streamalert
tests/unit/streamalert/classifier/clients/test_sqs.py
""" 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...
panda73111/aiohttp
aiohttp/helpers.py
"""Various helper functions""" import asyncio import base64 import binascii import datetime import functools import io import os import re import warnings from collections import namedtuple from pathlib import Path from urllib.parse import urlencode from async_timeout import timeout from multidict import MultiDict, M...
ucbrise/clipper
containers/python/noop_container.py
from __future__ import print_function import rpc import os import sys import numpy as np class NoopContainer(rpc.ModelContainerBase): def __init__(self, prediction="1.0"): self.prediction = prediction def _predict(self, inputs): return [self.prediction] * len(inputs) def predict_ints(sel...
google-research/selfstudy-adversarial-robustness
defense_discretize/model.py
# Copyright 2021 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, ...
pypa/warehouse
warehouse/migrations/versions/a65114e48d6f_set_user_last_login_automatically_in_.py
# 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...
google/starthinker
starthinker/util/csv.py
########################################################################### # # 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/l...
racker/fleece
fleece/boto3.py
from __future__ import absolute_import import boto3 as real_boto3 from boto3 import docs # noqa: F401 from boto3 import exceptions # noqa: F401 from boto3 import logging # noqa: F401 from boto3 import resources # noqa: F401 from boto3 import session # noqa: F401 from boto3 import set_stream_logger # noqa: F401 f...
openstack/senlin
senlin/conf/receiver.py
# 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 t...
PHB-CS123/graphene
tests/storage/base/test_id_store.py
import unittest from graphene.storage.base.id_store import * class TestIdStoreMethods(unittest.TestCase): TEST_FILENAME = "graphenestore.teststore.db.id" def setUp(self): GrapheneStore.TESTING = True def tearDown(self): """ Clean the database so that the tests are independent of...
Morphux/installer
pkgs/flex_p2/flex_p2.py
################################### LICENSE #################################### # Copyright 2016 Morphux # # # # Licensed under the Apache License, Version 2.0 (the "License"); ...
PalNilsson/pilot2
pilot/api/benchmark.py
#!/usr/bin/env python # 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 # # Authors: # - Paul Nilsson, paul.nilsson@cern.ch, 2018 from .services impo...
dc3-plaso/plaso
plaso/parsers/plist_plugins/bluetooth.py
# -*- coding: utf-8 -*- """This file contains a default plist plugin in Plaso.""" from plaso.containers import plist_event from plaso.parsers import plist from plaso.parsers.plist_plugins import interface class BluetoothPlugin(interface.PlistPlugin): """Basic plugin to extract interesting Bluetooth related keys. ...
3DHubs/Ranch
test/conftest.py
import json import pytest import ranch as addressing @pytest.fixture def ranch(): return addressing @pytest.fixture def AddressParts(): return addressing.AddressParts @pytest.fixture def address_data(): with open('test/data.json', 'r') as js: return json.load(js) @pytest.fixture def address(...
robertnishihara/ray
python/ray/tune/tests/test_experiment_analysis.py
import unittest import shutil import tempfile import random import os import pandas as pd from numpy import nan import ray from ray import tune from ray.tune.examples.async_hyperband_example import MyTrainableClass class ExperimentAnalysisSuite(unittest.TestCase): def setUp(self): ray.init(local_mode=Fal...
huleiak47/python-hlutils
hlutils/rand.py
#!/usr/bin/env python # -*- coding:utf-8 -*- ''' random utils ''' # Changes: # ** version 1.0 2013-10-22 Hulei ** # 1. first version def randbytes(length): ''' @brief generate a byte string with random data @param length byte string length @return a random data string ''' import rando...
kfaraaz/tests
src/genDecimal.py
import random import string def generatePrecisionValue(p): precision_str = ''.join([random.choice(string.digits) for x in xrange(1,p)]) if precision_str.startswith('0'): precision_str = '1' + precision_str[1:] return precision_str def generateScaleValue(s): scale_str = ''.join([random...
cneill/designate
designate/backend/agent_backend/impl_bind9.py
# Copyright 2014 Rackspace Inc. # # Author: Tim Simmons <tim.simmons@rackspace.com> # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
webrecorder/webrecorder
webrecorder/test/test_colls_api.py
from datetime import datetime import os from .testutils import FullStackTests # ============================================================================ class TestWebRecCollsAPI(FullStackTests): @classmethod def setup_class(cls): super(TestWebRecCollsAPI, cls).setup_class() def test_create_a...
xe1gyp/TheIoTLearningInitiative
InternetOfThings101/main.py
#!/usr/bin/python import paho.mqtt.client as paho import psutil import signal import sys import time from threading import Thread def interruptHandler(signal, frame): sys.exit(0) def on_publish(mosq, obj, msg): pass def dataNetwork(): netdata = psutil.net_io_counters() return netdata.packets_sent +...
uber/ludwig
tests/integration_tests/test_validation_metrics.py
import logging from collections import namedtuple import pytest from ludwig.api import LudwigModel from ludwig.constants import * from tests.integration_tests.utils import binary_feature from tests.integration_tests.utils import category_feature from tests.integration_tests.utils import generate_data from tests.integ...
icatproject/python-icat
doc/examples/paramtype.py
#! /usr/bin/python # # A simple command line tool to manage ParameterTypes. See # https://repo.icatproject.org/site/icat/server/4.10.0/schema.html#ParameterType # for a definition of ParameterType in the ICAT schema. # # This example also shows the use of sub-commands in with the # icat.config module. import logging ...
mntalateyya/Shapes_Studio
Layer.py
import Tkinter from PIL import Image, ImageDraw, ImageTk # This class creates a thumbnail of a layer class Layer: def __init__(self, im, frame, meta): self.meta = meta self.cv = Tkinter.Canvas(frame, width=120, height=40, highlightthickness=0, bd=0, bg='#cccccc') self.bd...
kdart/pycopia3
aid/pycopia/urls.py
#!/usr/bin/python3.4 # vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab """ """ from urllib.parse import (quote, unquote_plus, urlencode) import re # A classification of schemes ('' means apply by default) uses_relative = ['ftp', 'http', 'gopher', 'nntp', 'imap', 'wais', 'file', 'https'...
google-research/google-research
milking_cowmask/train_semisup.py
# 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...
GlobalFishingWatch/treniformis
scripts/update_filter_lists.py
from __future__ import print_function import bqtools import glob import treniformis import os import six import csv from utility import this_dir from utility import top_dir from utility import asset_dir from utility import default_date_ranges from utility import filter_lists from utility import config def copy_to_sort...
egustafson/uvoyeur
uvoyeur/daemon/bus.py
"""uVoyeur Application Bus""" class PublishFailures(Exception): delimiter = '\n' def __init__(self, *args, **kwargs): Exception.__init__(self, *args, **kwargs) self._exceptions = list() def capture_exception(self): self._exceptions.append(sys.exc_info()[1]) def get_instance...
rakeshmi/tempest
tempest/services/identity/v2/json/identity_client.py
# 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...
dropbox/pyannotate
tests/integration_test.py
"""Some things you just can't test as unit tests""" import os import subprocess import sys import tempfile import unittest import shutil example = """ def main(): print(gcd(15, 10)) print(gcd(45, 12)) def gcd(a, b): while b: a, b = b, a%b return a """ driver = """ from pyannotate_runtime im...
nischalsheth/contrail-controller
src/container/kube-manager/kube_manager/common/kube_config_db.py
# # Copyright (c) 2016 Juniper Networks, Inc. All rights reserved. # """ Database for Kubernetes objects. """ import json from cfgm_common.vnc_db import DBBase from kube_manager.sandesh.kube_introspect import ttypes as introspect from ast import literal_eval from utils import get_vn_fq_name_from_dict_string class K...
s9xie/convnet2_misc
convnet.py
# 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...
ramseydsilva/djangster
djangster/djangster/wsgi.py
""" WSGI config for djangster project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``WSGI_APPLICATION`...
jmiserez/sts
sts/happensbefore/hb_race_detector.py
from collections import namedtuple import itertools import networkx as nx from hb_utils import op_to_str from hb_utils import nCr from hb_commute_check import CommutativityChecker # Sanity check! This is a mapping of all predecessor types that make sense. predecessor_types = { 'HbAsyncFlowExpiry': [ 'HbMessag...
yegorkowalew/local_kow
news/parser.py
# -*- coding:utf-8 -*- import lxml.html import requests from lxml.cssselect import CSSSelector import git def go_news_wed(): """ first = go_news_wed() for i, y in first.items(): print(i) print(y) # print(list(news_list.keys())[0]) """ r = requests.get('http://www.wimagic.com.ua...
AndreyBalabanov/python_training
fixture/session.py
class SessionHelper: def __init__(self, app): self.app = app def login(self, username, password): wd = self.app.wd self.app.open_home_page() wd.find_element_by_name("user").click() wd.find_element_by_name("user").clear() wd.find_element_by_name("user").send_key...
curtisallen/Alarmageddon
alarmageddon/run.py
"""Methods that support running tests""" import time import collections import multiprocessing from alarmageddon.config import Config from alarmageddon.reporter import Reporter from alarmageddon.publishing import hipchat, pagerduty, graphite, junit from alarmageddon.validations.validation import Priority from alarmag...
enigmampc/catalyst
tests/utils/test_sentinel.py
from copy import copy, deepcopy from pickle import loads, dumps from unittest import TestCase from weakref import ref from catalyst.utils.sentinel import sentinel class SentinelTestCase(TestCase): def tearDown(self): sentinel._cache.clear() # don't pollute cache. def test_name(self): self.a...
dc3-plaso/plaso
plaso/parsers/mactime.py
# -*- coding: utf-8 -*- """Parser for the Sleuthkit (TSK) bodyfile or mactime format. The format specifications can be read here: http://wiki.sleuthkit.org/index.php?title=Body_file """ import re from plaso.containers import time_events from plaso.lib import eventdata from plaso.parsers import manager from plaso.p...
datastax/python-driver
tests/integration/standard/test_single_interface.py
# Copyright DataStax, 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, softwa...
ebt-hpc/cca
cca/scripts/Git2.py
#!/usr/bin/env python3 ''' A pygit2 wrapper Copyright 2012-2020 Codinuum Software Lab <https://codinuum.com> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/...
UnrememberMe/pants
tests/python/pants_test/backend/project_info/tasks/test_filedeps.py
# coding=utf-8 # Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) import os from textw...
ptphp/PyLib
src/devs/SimpleSecureHTTPServer1.py
# -*- coding:utf8 -*- import httplib import cookielib import urllib2 import urllib # 用chilkat拆分pfx得到key,cert的pem格式 key_file = 'chilkat_pkey.pem' cert_file = 'chilkat_cert.pem' class HTTPSClientAuthConnection(httplib.HTTPSConnection): def __init__(self, host, timeout=None): httplib.HTTPSConnection.__init...
aiorchestra/aiorchestra-openstack-plugin
openstack_plugin/tasks/lbaas.py
# Author: Denys Makogon # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
MediaMath/t1-python
terminalone/connection.py
# -*- coding: utf-8 -*- """Provides connection object for T1.""" from __future__ import absolute_import from requests import Session, post from requests.utils import default_user_agent from .config import ACCEPT_HEADERS, API_BASES, SERVICE_BASE_PATHS, AUTH_BASES from .errors import ClientError, T1Error from .metadata...
dragoon/kilogram
mapreduce/reducer_generic.py
#!/usr/bin/env python import sys current_ngram = None ngram = None cur_count = 0 # input comes from STDIN for line in sys.stdin: # remove leading and trailing whitespace line = line.strip() # parse the input we got from mapper.py try: ngram, w_count = line.rsplit('\t', 1) except: ...
ryantierney513/capirca
lib/junipersrx.py
# Copyright 2011 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...
mrkm4ntr/incubator-airflow
airflow/example_dags/example_external_task_marker_dag.py
# # 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...
StackPointCloud/profitbricks-sdk-python
profitbricks/utils.py
# Copyright 2015-2017 ProfitBricks GmbH # Author: Benjamin Drung <benjamin.drung@profitbricks.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICEN...
hansonchar/dagger
util/maven/generate_poms.py
# Copyright (C) 2017 The Dagger 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 w...
jstooks9/mpp
2d_histogram.py
# create 2D histogram, where histogram height is displayed as color import numpy as np import matplotlib.pyplot as plt import sys # Arguments: # 1 - data filename # 2 - number of bins # 3 - figure title # 4 - cutoff for # of stds (default 4) def make_histogram(data, bins): range = max(data) - min(data) binWidth = ...
armando-migliaccio/neutron
neutron/db/migration/alembic_migrations/versions/2032abe8edac_lbaas_add_status_des.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright 2013 OpenStack Foundation # # 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...
ddexnet/dsrf
conformance/conformance_processor_test.py
# Lint as: python2, python3 # Copyright 2015 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 req...
emory-libraries/ddi-search
ddisearch/ddi/tests.py
# file ddisearch/ddi/tests.py # # Copyright 2014 Emory University # # 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...
ScottFreeLLC/AlphaPy
alphapy/__main__.py
################################################################################ # # Package : AlphaPy # Module : __main__ # Created : July 11, 2013 # # Copyright 2017 ScottFree Analytics LLC # Mark Conway & Robert D. Scott II # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use ...
deepmind/dm_robotics
py/moma/sensors/robot_wrist_ft_sensor.py
# Copyright 2020 DeepMind Technologies Limited. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
EthereumWebhooks/blockhooks
lib/rlp/lazy.py
from collections import Iterable, Sequence from .codec import consume_length_prefix, consume_payload from .exceptions import DecodingError from .utils import Atomic def decode_lazy(rlp, sedes=None, **sedes_kwargs): """Decode an RLP encoded object in a lazy fashion. If the encoded object is a bytestring, this...
huggingface/pytorch-transformers
src/transformers/models/blenderbot_small/configuration_blenderbot_small.py
# coding=utf-8 # Copyright 2021 The Facebook, Inc. and The HuggingFace Inc. team. 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/L...
matthewelse/pyOCD
pyOCD/target/family/target_kinetis.py
""" mbed CMSIS-DAP debugger Copyright (c) 2006-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 Unless required by applicable ...
google/mirandum
alerts/twitchaccount/views.py
# Copyright 2016 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 applica...
BlackLight/Armando
t/testspeechrules.py
#!/usr/bin/env python import unittest import os from __armando__ import Armando ### Armando.initialize() ### from config import Config class TestTakkRules(unittest.TestCase): __dummy_file = 'test_action_dummy_file' def setUp(self): Config.get_config('conf/main.test.conf') from rules import...
SeanLee97/xiaoming
rnn_models.py
# !/usr/bin/env python # -*- coding: utf-8 -*- ''' 神经网络 EncoderRNN DecoderRNN AttnDecoderRNN采用GRU ''' import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable from config.config import * class EncoderRNN(nn.Module): def __init__(self, input_size, hidden_size, n_layers=1): ...
souravbadami/oppia
core/storage/email/gae_models.py
# coding: utf-8 # # 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 requi...
MyRobotLab/pyrobotlab
home/pedrosenarego/scripts/zorba/chatbotwithsound.py
from java.lang import String import threading import random import codecs import io import itertools import time import os import urllib2 import textwrap import socket import shutil ############################################################# # This is the ZOrba # ##################################################...
mtreinish/tempest-lib
tempest_lib/cli/base.py
# Copyright 2013 OpenStack Foundation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
scnakandala/cloud-simulator
sources/models/vm.py
class VirtualMachine(object): #Type of the vm vm_type = "default" #Available ammount of memory in GB memory = 0 #Number of CPUs available cpu_count = 0 #I/O availability based on some unit io = 0 #cost per vm per hour price = 0 #VM state state = "" #Migration ti...
openstack/ironic-inspector
ironic_inspector/plugins/base_physnet.py
# Copyright (c) 2017 StackHPC 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 writ...
cicorias/mongo-web-shell
webapps/lib/util.py
# Copyright 2013 10gen 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...
dataversioncontrol/dvc
tests/unit/remote/test_gs.py
import mock from unittest import TestCase from dvc.remote.gs import RemoteGS class TestRemoteGS(TestCase): BUCKET = "bucket" PREFIX = "prefix" URL = "gs://{}/{}".format(BUCKET, PREFIX) CREDENTIALPATH = "/path/to/gcp_credentials.json" PROJECT = "PROJECT" CONFIG = { "projectname": PROJE...
anchore/anchore-engine
tests/unit/anchore_engine/services/policy_engine/engine/policy/gates/test_npms.py
from unittest.mock import Mock import pytest from anchore_engine.db.entities.policy_engine import Image, ImagePackage, NpmMetadata from anchore_engine.services.policy_engine.engine.policy.gate import ExecutionContext from anchore_engine.services.policy_engine.engine.policy.gates import npms image_id = "1" user = "ad...
googleinterns/smart-content-summary
lasertagger/predict_main.py
# 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, ...
russellclarke82/CV
Pi/McTwis.py
#!/usr/bin/python #Generic beautiful soup DOM scraper from bs4 import BeautifulSoup from datetime import datetime import re import urllib2 import csv import os # Scraping Techniques - module 1: # BeautifulSoup is simple and great for small-scale web scraping. But if you are interested in scraping # data at a...
knightsamar/change_agent
give_feedback/models.py
from django.db import models # Create your models here. class feedbackSubmission(models.Model): feedbackForm = models.ForeignKey('manage_feedback.feedbackForm',help_text='Which Form\'s submission?'); submitter = models.ForeignKey('ldap_login.user',help_text='Submitted by which user?'); when = models.DateTi...
NervanaSystems/neon
examples/imagenet/allcnn.py
#!/usr/bin/env python # ****************************************************************************** # Copyright 2014-2018 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at ...
saltstack/salt
salt/utils/powershell.py
""" Common functions for working with powershell .. note:: The PSModulePath environment variable should be set to the default location for PowerShell modules. This applies to all OS'es that support powershell. If not set, then Salt will attempt to use some default paths. If Salt can't find your modules, en...
JioCloud/glance
glance/db/sqlalchemy/api.py
# Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # Copyright 2010-2011 OpenStack Foundation # Copyright 2012 Justin Santa Barbara # Copyright 2013 IBM Corp. # Copyright 2015 Mirantis, Inc. # All Rights Reserved. # # Licensed under t...
huggingface/transformers
tests/optimization/test_optimization.py
# coding=utf-8 # Copyright 2020 The HuggingFace Team. 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 requir...
DistrictDataLabs/yellowbrick
yellowbrick/utils/wrapper.py
# yellowbrick.utils.wrapper # Utility package that provides a wrapper for new style classes. # # Author: Benjamin Bengfort # Created: Sun May 21 20:27:32 2017 -0700 # # Copyright (C) 2017 The sckit-yb developers # For license information, see LICENSE.txt # # ID: wrapper.py [b2ecd50] benjamin@bengfort.com $ """ Util...
kytovaya/test-repository-Sel7
Link_in_window.py
import pytest from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.support import expected_conditions as EC @pytest.fixture def driver(request): wd = webdriver.Chrome() request.addfinalizer(wd.quit) retu...
square/pylink
tests/unit/unlockers/test_unlock_kinetis.py
# Copyright 2017 Square, 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,...
ldrozdz/Webforming
backend/pipelines/xls_pipeline.py
from collections import Counter from xlwt import Workbook import os __author__ = 'admin' class XlsPipeline(object): def __init__(self, data_dir, id): self.data_dir = data_dir self.id = id def process(self, items, nested=False): sorted_items = sorted(items.values(), key=lambda i: i.parsed_post_date.re...
cdpetty/Pixal
VidAnalysis/run_analysis.py
from analyzer import get_avg_colors import pandas as pd from os import listdir video_dirs = ['country_vids','edm_vids','pop_vids','rap_vids','rock_vids'] for vid_dir in video_dirs: directory = '../VidScrape/' + vid_dir vid_files = listdir(directory) avg_colors = [] x = 0 for vid in vid_files: ...
alexgorban/models
research/object_detection/builders/target_assigner_builder_test.py
"""Tests for google3.third_party.tensorflow_models.object_detection.builders.target_assigner_builder.""" # 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...
enigmampc/catalyst
catalyst/marketplace/utils/eth_utils.py
import binascii # def bytes32(string): # """ # Convert string to bytes32 data type for smart contract # Parameters # ---------- # string: str # Returns # ------- # list # """ # return binascii.hexlify(string.encode('utf-8')) # def b32_str(bytes32): # """ # Convert ...
nburn42/tensorflow
tensorflow/contrib/autograph/operators/__init__.py
# 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...
deepmind/neural_testbed
neural_testbed/agents/factories/sweeps/testbed_2d/bbb.py
# python3 # pylint: disable=g-bad-file-header # Copyright 2021 DeepMind Technologies Limited. 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...
charlieaustin/bazel
tools/android/incremental_install_test.py
# Copyright 2015 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 ag...
polyaxon/polyaxon
core/polyaxon/client/client.py
#!/usr/bin/python # # Copyright 2018-2021 Polyaxon, 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 ...
ShaguptaS/python
bigml/tests/test_24_cluster_derived.py
# -*- 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...
DedMemez/ODS-August-2017
keyword.py
# Fuck you Disyer. Stealing my fucking paypal. GET FUCKED: keyword __all__ = ['iskeyword', 'kwlist'] kwlist = ['and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'exec', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'l...
wangjie1492/tango_with_django_project
rango/migrations/0004_userprofile.py
# -*- 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), ('rango', '0003_category_slug'), ] ...
VEVO/hidi
hidi/inout.py
import numpy as np import pandas as pd from hidi.transform import Transform class ReadTransform(Transform): """ Read input csv data from disk. Input data should be a csv file formatted with three columns: :code:`link_id`, :code:`item_id`, and :code:`score`. If score is not provided, it we be ...
stephanie-wang/ray
rllib/examples/hierarchical_training.py
"""Example of hierarchical training using the multi-agent API. The example env is that of a "windy maze". The agent observes the current wind direction and can either choose to stand still, or move in that direction. You can try out the env directly with: $ python hierarchical_training.py --flat A simple hierar...