repo_name stringlengths 5 104 | path stringlengths 4 248 | content stringlengths 102 99.9k |
|---|---|---|
skuda/client-python | kubernetes/test/test_v1_node_status.py | # coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.6.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
im... |
rbuffat/pyidf | tests/test_setpointmanagerfollowgroundtemperature.py | import os
import tempfile
import unittest
import logging
from pyidf import ValidationLevel
import pyidf
from pyidf.idf import IDF
from pyidf.setpoint_managers import SetpointManagerFollowGroundTemperature
log = logging.getLogger(__name__)
class TestSetpointManagerFollowGroundTemperature(unittest.TestCase):
def s... |
theflofly/tensorflow | tensorflow/python/keras/layers/recurrent_test.py | # 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... |
dims/cinder | cinder/tests/unit/test_backup.py | # Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICEN... |
CMPUT404F16T06/CMPUT404Project | mysite/socialnet/migrations/0031_author_url.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-11-22 22:55
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('socialnet', '0030_author_displayname'),
]
operations = [
migrations.AddFiel... |
wzhfy/spark | python/pyspark/sql/tests/test_serde.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 us... |
htcondor/htcondor | src/condor_tools/htcondor_cli/job_set.py | import time
import re
import getpass
from datetime import datetime
from copy import deepcopy
import htcondor
import classad
from htcondor_cli.noun import Noun
from htcondor_cli.verb import Verb
class Submit(Verb):
"""
Submits a job set when given a job set file
"""
options = {
"job_set_fil... |
Hybrid-Cloud/conveyor | conveyor/tests/unit/objects/test_plan.py | # Copyright (c) 2017 Huawei, 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 a... |
hirokihamasaki/irma | probe/modules/antivirus/sophos_win/sophos_win.py | #
# Copyright (c) 2013-2016 Quarkslab.
# This file is part of IRMA project.
#
# 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 in the top-level directory
# of this distribution and at:
#
# http:... |
pony-revolution/helpothers | listings/migrations/0009_gatheringcenter_contact.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('listings', '0008_auto_20151031_1353'),
]
operations = [
migrations.AddField(
model_name='gatheringcenter',
... |
asimshankar/tensorflow | tensorflow/contrib/distribute/python/cross_device_ops_test.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... |
zstackio/zstack-woodpecker | integrationtest/vm/multihosts/vm_snapshots/paths/ceph_path4.py | import zstackwoodpecker.test_state as ts_header
import os
TestAction = ts_header.TestAction
def path():
return dict(initial_formation="template5", checking_point=8, path_list=[
[TestAction.create_vm, 'vm1', ],
[TestAction.create_volume, 'volume1', 'flag=scsi'],
[TestAction.attach_volume, 'vm1', 'volume1'],
... |
googleapis/python-talent | samples/generated_samples/jobs_v4_generated_job_service_search_jobs_sync.py | # -*- 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... |
javacruft/snap-gnocchi | tests/snapstack_test.py | import unittest
from snapstack import Plan, Setup, Step
class SnapstackTest(unittest.TestCase):
def test_snapstack(self):
'''
_test_snapstack_
Run a basic smoke test, utilizing our snapstack testing harness.
'''
gnocchi = Step(
snap='gnocchi',
scr... |
ARMmbed/greentea | src/htrun/host_tests/rtc_auto.py | #
# Copyright (c) 2021 Arm Limited and Contributors. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
"""RTC auto test."""
import re
from time import strftime, gmtime
from .. import BaseHostTest
class RTCTest(BaseHostTest):
"""Test RTC."""
PATTERN_RTC_VALUE = r"\[(\d+)\] \[(\d+-\d+-\d+ \d+:\d+:\... |
anythingrandom/eclcli | eclcli/storage/storageclient/common/apiclient/fake_client.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... |
levythu/swift | swift/common/memcached.py | # Copyright (c) 2010-2012 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-2.0
#
# Unless required by applicable law or agree... |
mitlib-tdm/minecart | tests/test_upload.py | import os
import pytest
import requests_mock
from minecart.upload import Bucket, BucketObject, Client
@pytest.yield_fixture
def google():
with requests_mock.Mocker() as m:
m.post('mock://example.com/b/foo/o',
headers={'Location': 'mock://example.com/b/foo/o?upload_id=1'})
m.put('m... |
thnuclub/kandota | spiderserver/crawl/spiderserver/items.py | # -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class DotamaxItem(scrapy.Item):
img = scrapy.Field()
created_at = scrapy.Field()
updated_at = scrapy.Field()
tag = scrapy.Field()
ch... |
opalmer/deprecated-pyfarm-models | pyfarm/models/tag.py | # No shebang line, this module is meant to be imported
#
# Copyright 2013 Oliver Palmer
# Copyright 2014 Ambient Entertainment GmbH & Co. KG
#
# 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
#
... |
jasonwee/asus-rt-n14uhp-mrtg | src/lesson_runtime_features/sys_exc_info.py | import sys
import threading
import time
def do_something_with_exception():
exc_type, exc_value = sys.exc_info()[:2]
print('Handling {} exception with message "{}" in {}'.format(
exc_type.__name__, exc_value,
threading.current_thread().name))
def cause_exception(delay):
time.sleep(delay)
... |
google/pybadges | pybadges/pil_text_measurer.py | # Copyright 2018 The pybadge 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
ibmjstart/bluemix-python-eve-sample | macreduce/hooks/event.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Provides Event Hooks against REST Resources.
This module is the mastermind controlling the
flow of triggers and events to resources
"""
import traceback
from settings import (LANGUAGES,
LANGUAGE_DEFAULT)
__author__ = "Sanjay Joshi"
__copyright__... |
cvandeplas/plaso | plaso/formatters/oxml.py | #!/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... |
napalm-automation/napalm-yang | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/isis/levels/level/link_state_database/lsp/tlvs/tlv/mt_isn/neighbors/neighbor/subTLVs/subTLVs_/unreserved_bandwidth/setup_priority/__init__.py | # -*- 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... |
MichaelStadtmiller/Reds | stats/models.py | from __future__ import unicode_literals, division
from django.db import models
# Create your models here.
class Player(models.Model):
name = models.CharField(max_length=20, primary_key=True)
guess = models.IntegerField(default=0)
def total_games(self):
return 162
def perc_guess(self):
... |
dataversioncontrol/dvc | tests/unit/dependency/test_local.py | import mock
from dvc.stage import Stage
from dvc.dependency import DependencyLOCAL
from tests.basic_env import TestDvc
class TestDependencyLOCAL(TestDvc):
def _get_cls(self):
return DependencyLOCAL
def _get_dependency(self):
stage = Stage(self.dvc)
return self._get_cls()(stage, "pat... |
kdart/pycopia | process/pycopia/proctools.py | #!/usr/bin/python2.7
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
... |
QISKit/qiskit-sdk-py | qiskit/pulse/commands/__init__.py | # -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... |
opendatagroup/hadrian | titus/titus/lib/impute.py | #!/usr/bin/env python
# Copyright (C) 2014 Open Data ("Open Data" refers to
# one or more of the following companies: Open Data Partners LLC,
# Open Data Research LLC, or Open Data Capital LLC.)
#
# This file is part of Hadrian.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this... |
dgomez10/xanon | SDK/installer/vboxapisetup.py | """
Copyright (C) 2009-2012 Oracle Corporation
This file is part of VirtualBox Open Source Edition (OSE), as
available from http://www.virtualbox.org. This file is free software;
you can redistribute it and/or modify it under the terms of the GNU
General Public License (GPL) as published by the Free Software
Foundatio... |
bukin242/geoip-redis-ru | models.py | from redisco import models
from slugify import slugify
class City(models.Model):
city = models.Attribute(required=True)
slug = models.Attribute()
region = models.Attribute()
territory = models.Attribute()
country = models.Attribute()
coordinates = models.ListField(float)
def save(self):
... |
boto/botocore | botocore/validate.py | """User input parameter validation.
This module handles user input parameter validation
against a provided input model.
Note that the objects in this module do *not* mutate any
arguments. No type version happens here. It is up to another
layer to properly convert arguments to any required types.
Validation Errors
... |
brianhks/tablesaw | test/java/build.py | """
* Copyright (c) 2004, Brian Hawkins
* Permission is granted to use this code without restriction as long
* as this copyright notice appears in all source files.
THIS BUILD FILE DOES NOT WORK
"""
bldoutdir = "build"
srcdir = "src"
sourceFiles = make.createFileList(srcdir, ".*\\.java")
classFiles = make... |
victorywang80/Maintenance | saltstack/src/tests/integration/states/rabbitmq_user.py | '''
Tests for the rabbitmq state
'''
# Import python libs
import os
# Import Salt Testing libs
from salttesting.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import salt libs
import integration
class RabbitUserTestCase(integration.ModuleCase,
integration.SaltReturnAssertsM... |
bremond/siconos | examples/Mechanics/GeometricPrimitives/heightmap.py | #!/usr/bin/env python
#
# Example of how to use the heightmap object to interact with static terrain.
#
from siconos.mechanics.collision.tools import Contactor
from siconos.io.mechanics_io import Hdf5
import siconos.numerics as Numerics
import numpy as np
import pydoc
# Creation of the hdf5 file for input/output
wit... |
att-comdev/drydock | tests/unit/test_models.py | # Copyright 2017 AT&T Intellectual Property. All other 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... |
dennisding/ether | gate/game_mgr.py | # -*- coding:utf-8 -*-
import random
import engine
from network import server
from network import service
from protocols import gate_to_game
from protocols import game_to_gate
class Connection:
def __init__(self):
self.gameid = None
def connection_made(self):
print('game connection made')
def connection_lo... |
quantumlib/Cirq | cirq-core/cirq/experiments/readout_confusion_matrix_test.py | # Copyright 2022 The Cirq Developers
#
# 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 ... |
jmccrae/zrtifi | analyzers/xml.py | from subprocess import Popen, PIPE
from cStringIO import StringIO
import sys
from uuid import uuid4
step_id = str(uuid4())
ZRTIFI_ONTOLOGY = "http://www.zrtifi.org/ontology#"
def format_err(lines):
for line in lines:
yield line.strip()
if __name__ == "__main__":
p = Popen(["xmllint","--noouti","--loa... |
saltstack/salt | tests/integration/cloud/helpers/virtualbox.py | import logging
import salt.utils.json
import salt.utils.virtualbox
import tests.integration.cloud.helpers
from tests.support.case import ShellCase
from tests.support.unit import TestCase, skipIf
# Create the cloud instance name to be used throughout the tests
INSTANCE_NAME = tests.integration.cloud.helpers.random_nam... |
dmilos/nucleotide | src/nucleotide/component/linux/gcc/atom/rtti.py | #!/usr/bin/env python2
# Copyright 2015 Dejan D. M. Milosavljevic
#
# 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... |
gimli-org/gimli | pygimli/testing/__init__.py | # coding=utf-8
"""
Testing utilities
In Python you can call `pygimli.test()` to run all docstring
examples.
Writing tests for pygimli
-------------------------
Please check: https://docs.pytest.org/en/latest/
"""
import sys
from os.path import join, realpath
import matplotlib.pyplot as plt
import numpy as np
impo... |
rockychen-dpaw/oim-cms | rcs_assets/router.py | class RCSAssetsRouter(object):
"""
A read-only router to control all database operations on models in the
rcs_assets application.
"""
def db_for_read(self, model, **hints):
"""
Attempts to read rcs_assets models go to rcs_assets.
"""
if model._meta.app_label == 'rcs_a... |
Johnetordoff/osf.io | website/mails/mails.py | # -*- coding: utf-8 -*-
"""OSF mailing utilities.
Email templates go in website/templates/emails
Templates must end in ``.txt.mako`` for plaintext emails or``.html.mako`` for html emails.
You can then create a `Mail` object given the basename of the template and
the email subject. ::
CONFIRM_EMAIL = Mail(tpl_pre... |
huggingface/transformers | examples/research_projects/mlm_wwm/run_mlm_wwm.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 require... |
mickem/json-protobuf | json_protobuf/generator.py | # Copyright 2014 Michael Medin
#
# 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... |
asidev/aybu-controlpanel | tests/test_language.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright 2010-2012 Asidev 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 b... |
buckbaskin/Insight | flaskserver/app/automock/decorator.py | import os
def automock(param, default, prod=None, stage=None, test=None, dev=None):
def inner_decorator(func):
def new_function(*args, **kwargs):
# print('dec: %s,%s,%s' % (default, test, server.config['TESTING']))
# print('dec3: prod %s stage %s test %s %s dev %s' % (prod is not ... |
mudzi42/pynet_class | class4/class4_ex1.py | #!/usr/bin/env python
"""
1. Use Paramiko to retrieve the entire 'show version' output from pynet-rtr2.
"""
__author__ = 'Chip Hudgins'
__email__ = 'mudzi42@gmail.com'
import paramiko
from time import sleep
import sys
import class4_devices as devices
MAX_BUFFER = 65535
def router_connect(device):
'''
par... |
mercycorps/TolaActivity | workflow/migrations/0002_auto_20161104_0345.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-11-04 10:45
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('workflow', '0001_initial'),
]
operations = [
migrations.RemoveField(
mod... |
reminisce/mxnet | python/mxnet/contrib/tensorrt.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 u... |
wtpayne/hiai | a3_src/h70_internal/da/check/schema/spec/spec_python_embedded.py | # -*- coding: utf-8 -*-
"""
Unit tests for the da.check.schema.python_embedded module.
---
type:
python_module
validation_level:
v00_minimum
protection:
k00_public
copyright:
"Copyright 2016 High Integrity Artificial Intelligence Systems"
license:
"Licensed under the Apache License, Version 2.0... |
facebook/fbthrift | thrift/compiler/test/fixtures/includes/gen-py/module/ttypes.py | #
# Autogenerated by Thrift
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
# @generated
#
from __future__ import absolute_import
import sys
from thrift.util.Recursive import fix_spec
from thrift.Thrift import TType, TMessageType, TPriority, TRequestContext, TProcessorEventHandler, TServerInterfa... |
nikitanovosibirsk/blahblah | tests/list/test_list_generation.py | from unittest.mock import call
from baby_steps import given, then, when
from district42 import schema
from blahblah._consts import LIST_LEN_MAX, LIST_LEN_MIN
from .._fixtures import * # noqa: F401, F403
from .._utils import schema_mock
def test_list_generation(*, generate, random_):
with given:
sch = ... |
foursquare/pants | src/python/pants/engine/struct.py | # 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
from abc import abstractproperty
from collections import MutableMapping, MutableSequence
... |
QiJune/Paddle | python/paddle/fluid/layers/ops.py | # 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... |
jriguera/bosh-ironic-cpi-release | src/bosh_ironic_cpi/ironic_cpi/manager.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
BOSH OpenStack Ironic CPI
"""
# Python 2 and 3 compatibility
from __future__ import unicode_literals, print_function
import logging
import json
from ironic_cpi.action import CPIAction as CPIAction
from ironic_cpi.action import CPIActionError as CPIActionError
cla... |
bowlofstew/changes | changes/backends/jenkins/buildsteps/test_collector.py | from __future__ import absolute_import
from flask import current_app
import heapq
import logging
from hashlib import md5
from changes.api.client import api_client
from changes.backends.jenkins.buildsteps.collector import JenkinsCollectorBuilder, JenkinsCollectorBuildStep
from changes.config import db
from changes.c... |
elvinzeng/wifi-attendance | wifi_attendance/settings.py | # coding=utf-8
"""
Django settings for wifi_attendance project.
Generated by 'django-admin startproject' using Django 1.11.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/... |
googleapis/python-media-translation | docs/conf.py | # -*- coding: utf-8 -*-
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
googleads/google-ads-python | google/ads/googleads/v10/resources/types/carrier_constant.py | # -*- 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... |
silky/airflow | airflow/models.py | from __future__ import print_function
from future.standard_library import install_aliases
install_aliases()
from builtins import str
from past.builtins import basestring
from builtins import object, bytes
import copy
from datetime import datetime, timedelta
import functools
import getpass
import imp
import jinja2
impor... |
evansde77/cirrus | src/cirrus/plugins/jenkins.py | import requests
from cirrus.configuration import get_buildserver_auth
from cirrus.logger import get_logger
LOGGER = get_logger()
class JenkinsClient(object):
"""Barebones Jenkins remote API wrapper"""
def __init__(self, jenkins_url):
self.jenkins_url = jenkins_url
self.session = requests.Ses... |
postlund/home-assistant | homeassistant/components/frontend/__init__.py | """Handle the frontend for Home Assistant."""
import json
import logging
import mimetypes
import os
import pathlib
from typing import Any, Dict, Optional, Set, Tuple
from aiohttp import hdrs, web, web_urldispatcher
import jinja2
import voluptuous as vol
from yarl import URL
from homeassistant.components import websoc... |
quantopian/zipline | zipline/data/resample.py | # Copyright 2016 Quantopian, 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 writ... |
sresoft/thengrow | rsa/rsa.py | #!/usr/bin/env Python
import random
import mr_test as mra
import mod
class RSAEncrypt():
def __init__(self):
self.val_d = 0
self.mod_n = 0
self.int_e = 0
self.phi_n = 0
self.prime_p = 0
self.prime_q = 0
self.val_c = 0
self.lowrange =... |
agabert/zeus | lib/zeus/ubuntu.py |
from fabric.api import run
class RepoManager(object):
def __init__(self):
return
@classmethod
def repokey(cls, url):
run("""
URL="%s"
wget -SO- "${URL}" | apt-key add -
""" % url)
@classmethod
def install(cls, package_name):
run("""
PACKAGE_NAME="%s"
dpkg --list -- "$PA... |
benauthor/pykafka | pykafka/cli/kafka_tools.py | from __future__ import print_function
import argparse
import calendar
import datetime as dt
import sys
import time
import tabulate
import pykafka
from pykafka.common import OffsetType
from pykafka.protocol import PartitionOffsetCommitRequest
from pykafka.utils.compat import PY3
#
# Helper Functions
#
def fetch_of... |
gandelman-a/neutron-lbaas | neutron_lbaas/tests/unit/common/cert_manager/test_barbican.py | # Copyright 2014 Rackspace
#
# 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... |
paxapy/zulip | zerver/tests/test_signup.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from django.conf import settings
from django.http import HttpResponse
from django.test import TestCase
from mock import patch
from fakeldap import MockLDAP
from zilencer.models import Deployment
from zerver.views import do_change_password, create_homepag... |
jieyu/maple | script/maple/race/main.py | """Copyright 2011 The University of Michigan
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... |
eieio/pyy | modules/channel.py | ''' channel.py
Copyright 2008 Corey Tabaka
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... |
hnousiainen/pghoard | pghoard/rohmu/object_storage/azure.py | """
rohmu - azure object store interface
Copyright (c) 2016 Ohmu Ltd
See LICENSE for details
"""
# pylint: disable=import-error, no-name-in-module
from azure.storage.blob import BlockBlobService
from azure.storage.blob.models import BlobPrefix
from .base import BaseTransfer
from ..errors import FileNotFoundFromStorage... |
kreuks/liven | bot/sessions.py | class Session(object):
def __init__(self):
self.sessions = {}
def find_create_session(self, chat_id):
if chat_id in self.sessions:
return chat_id
else:
self.sessions[chat_id] = {'context': {}}
return chat_id
def update_context(self, chat_i... |
nbir/gambit-scripts | scripts/la_grid_analysis/src/kld.py | # Gambit scripts
#
# Copyright (C) USC Information Sciences Institute
# Author: Nibir Bora <nbora@usc.edu>
# URL: <http://cbg.isi.edu/>
# For license information, see LICENSE
import os
import sys
import csv
import anyjson
import itertools
import matplotlib
import numpy as np
import cPickle as pickle
import jsbeautifie... |
FatalTouch/BlogExample | handlers/deletepost.py | from handlers import ViewHandler
from google.appengine.ext import db
import json
import entities
import time
# Handler for deleting posts
class DeletePostHandler(ViewHandler):
# This handler only accepts post requests and we make sure that post is
# valid and user is owner of the post with the decorators and... |
0xc0170/pyOCD | pyOCD/debug/semihost.py | """
mbed CMSIS-DAP debugger
Copyright (c) 2015 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 law o... |
luca-s/alphalens | alphalens/tests/test_tears.py | #
# Copyright 2017 Quantopian, 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 wr... |
alirepobake/git-repo | git_command.py | #
# Copyright (C) 2008 The Android Open Source Project
#
# 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... |
partofthething/home-assistant | homeassistant/components/nissan_leaf/__init__.py | """Support for the Nissan Leaf Carwings/Nissan Connect API."""
import asyncio
from datetime import datetime, timedelta
import logging
import sys
from pycarwings2 import CarwingsError, Session
import voluptuous as vol
from homeassistant.const import CONF_PASSWORD, CONF_REGION, CONF_USERNAME, HTTP_OK
from homeassistant... |
gkc1000/pyscf | pyscf/nao/test/test_0162_bse_h2o_spin2_uhf_cis.py | # Copyright 2014-2018 The PySCF Developers. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
zhiyue/owllook | owllook/utils/verification/verification.py | #!/usr/bin/env python
import os
import random
import logging
from configparser import ConfigParser
_dir = os.path.dirname(__file__)
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s: %(message)s')
def ver_question() -> tuple:
"""
针对注册问题验证
问: 小说名
答: 作者名
:return: (questio... |
FederatedAI/FATE | examples/pipeline/homo_logistic_regression/pipeline-homo-lr-train-eval.py | #
# 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... |
pycharmer/py-training | datastructures.py | from __future__ import print_function
# Lists
# lists begin in [
# Lists are mutable
# Lists are a sequence
list = ['harry potter', 1, 'hobbit']
user = ['vivek', 'puja']
print(list)
list.pop()
list.insert(1, 'inserted')
print(list)
list.append('spiderman')
print(list)
list[0] = "harry potter the philosophers ston... |
polyaxon/polyaxon | core/polyaxon/utils/validation.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 ... |
googleapis/python-datacatalog | samples/generated_samples/datacatalog_generated_datacatalog_v1_data_catalog_delete_entry_sync.py | # -*- 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... |
TheWardoctor/Wardoctors-repo | script.module.fantastic/lib/resources/lib/sources/en/rlsmovies.py | # -*- coding: utf-8 -*-
'''
fantastic Add-on
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This pro... |
cliffyg/heron | heron/ui/src/python/log.py | # Copyright 2016 Twitter. 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 agree... |
hubblestack/hubble-salt | hubblestack_nova/mount.py | # -*- encoding: utf-8 -*-
'''
HubbleStack Nova plugin for verifying attributes associated with a mounted partition.
Supports both blacklisting and whitelisting patterns. Blacklisted patterns must
not be found in the specified file. Whitelisted patterns must be found in the
specified file.
:maintainer: HubbleStack / b... |
linsomniac/luigi | luigi/parameter.py | # -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
Samsung/meminsight | scripts/install-web-deps.py | # Copyright 2013 Samsung Information Systems America, 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 applica... |
tcalmant/ipopo | tests/remote/test_discovery.py | #!/usr/bin/python
# -- Content-Encoding: UTF-8 --
"""
Tests remote services discovery using the JSON-RPC transport
:author: Thomas Calmant
:copyright: Copyright 2020, Thomas Calmant
:license: Apache License 2.0
..
Copyright 2020 Thomas Calmant
Licensed under the Apache License, Version 2.0 (the "License");
... |
markstoehr/structured_gaussian_mixtures | structured_gaussian_mixtures/mdn.py | """
This script is a collection of objects and methods used for MDNs: inspired from Theano MLP tutorial http://deeplearning.net/tutorial
"""
__docformat__ = 'restructedtext en'
import cPickle
import os
import sys
import time
import numpy as np
import theano
import theano.tensor as T
import sys
class MDNoutputLaye... |
brianjianhuang/cnn-text-classification-tf | data_helpers_gen_word_vec.py | import numpy as np
import re
import itertools
from collections import Counter
def clean_str(string):
"""
Tokenization/string cleaning for all datasets except for SST.
Original taken from https://github.com/yoonkim/CNN_sentence/blob/master/process_data.py
"""
#print (string)
string = re.sub(r"[... |
phisiart/tvm | topi/python/topi/x86/injective.py | # pylint: disable=invalid-name
"""x86 declaration and schedules."""
from __future__ import absolute_import as _abs
import tvm
from .. import generic
@generic.schedule_injective.register(["cpu"])
def schedule_injective(outs):
"""X86 schedule for injective op.
Parameters
----------
outs: Array of Tensor... |
zstackio/zstack-woodpecker | integrationtest/vm/mn_ha2/test_mnha2_2_mn_host_stop_recover_crt_vm.py | '''
Test Steps:
1. force stop both mn host and recover.
2. check vip and all service recovered.
3. create vm to validate everything goes on well.
@author: SyZhao
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.test_lib ... |
pdscraml/bunny-hunter | catkin_ws/src/easter_egg_hunt/scripts/egg_detect.py | #!/usr/bin/env python
# Intro to Robotics - EE5900 - Spring 2017
# Final Project
# Philip (Team Lead)
# Ian
# Akhil
#
# Revision: v1.5
# imports
import rospy
import sys
import time
import roslaunch
import os
import cv_bridge
import cv2
import smach
import smach_ros
impor... |
floh1695/fcc | argparser.py | #!/usr/bin/env python3
import argparse
def _compile_args(subparsers):
compile_subparser = subparsers.add_parser('compile',
help='Compile LC File(s) to the target language. Default: C')
compile_subparser.add_argument('files', metavar='FILE', type=str,
nargs='+', help='Input LC files')
... |
predikto/python-sdk | predikto/resources/project.py | # Copyright 2014-2015 Predikto, 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.