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 |
|---|---|---|---|---|---|
import unittest
import mock
from greenpithumb import light_sensor
class LightSensorTest(unittest.TestCase):
def setUp(self):
self.mock_adc = mock.Mock()
channel = 1
self.light_sensor = light_sensor.LightSensor(self.mock_adc, channel)
def test_light_50_pct(self):
"""Near mid... | JeetShetty/GreenPiThumb | tests/test_light_sensor.py | Python | apache-2.0 | 826 |
#!/usr/bin/env python
# encoding: utf-8
"""
Copyright 2011, 2012 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unl... | tectronics/tvod-integrate | lib/python/tvod/util.py | Python | apache-2.0 | 3,896 |
import unreal_engine as ue
import json
class FilmActor:
def begin_play(self):
self.pawn = self.uobject.get_owner()
def getjson(self):
ue.log("@@@@video getting json:")
loc = self.uobject.get_actor_location()
rot = self.uobject.get_actor_forward()
data = {
"x":loc.x,"y":loc.y,"z":loc.z,
"rx":rot.x,... | meahmadi/ThreeDHighway | Content/Scripts/FilmActor.py | Python | apache-2.0 | 767 |
#!/usr/bin/python
"""
Example from pybedtools documentation (:ref:`third example`) to count \
reads in introns and exons using multiple CPUs.
"""
from __future__ import print_function
import pybedtools
import argparse
import os
import sys
import multiprocessing
def featuretype_filter(feature, featuretype):
"""
... | poojavade/Genomics_Docker | Dockerfiles/gedlab-khmer-filter-abund/pymodules/python2.7/lib/python/pybedtools-0.7.6-py2.7-linux-x86_64.egg/EGG-INFO/scripts/intron_exon_reads.py | Python | apache-2.0 | 3,362 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Author: mcxiaoke
# @Date: 2018-01-26
from __future__ import print_function, unicode_literals, absolute_import
import json
import sys
import os
import re
import time
import shutil
import random
import mimetypes
import imghdr
import traceback
import json
import redis
im... | mcxiaoke/python-labs | scripts/wechat_upload.py | Python | apache-2.0 | 8,692 |
"""The auto-tuning module of tvm
This module includes:
* Tuning space definition API
* Efficient auto-tuners
* Tuning result and database support
* Distributed measurement to scale up tuning
"""
from . import database
from . import feature
from . import measure
from . import record
from . import task
from . impor... | mlperf/training_results_v0.6 | Fujitsu/benchmarks/resnet/implementations/mxnet/3rdparty/tvm/python/tvm/autotvm/__init__.py | Python | apache-2.0 | 794 |
sum=0
for x in range(0,1000):
if(x%3==0 or x%5==0):
sum+=x
print(sum)
| scottnm/ProjectEuler | python/Problem1-Multiples_of_3_&_5.py | Python | apache-2.0 | 82 |
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import hashlib
import json
from dataclasses import dataclass
from enum import Enum
from typing import Any, Callable, Iterable, Set, TypeVar
from pkg_re... | patricklaw/pants | src/python/pants/backend/python/util_rules/lockfile_metadata.py | Python | apache-2.0 | 14,210 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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... | os-cloud-storage/openstack-workload-disaster-recovery | dragon/db/sqlalchemy/migration.py | Python | apache-2.0 | 3,810 |
# python3
# pylint: disable=g-bad-file-header
# Copyright 2019 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... | deepmind/bsuite | bsuite/experiments/discounting_chain/analysis.py | Python | apache-2.0 | 4,042 |
# coding: utf-8
"""
Copyright 2015 SmartBear Software
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... | jlongever/redfish-client-python | on_http_redfish_1_0/models/thermal_1_0_0_temperature.py | Python | apache-2.0 | 8,295 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-05-04 12:05
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0001_initial'),
]
operations = [
migrations.AddField(
mod... | CSchool/SchoolSite | CSchoolSite/main/migrations/0002_notification_queued.py | Python | apache-2.0 | 457 |
from __future__ import unicode_literals
from django import template
from django.conf import settings
from django.utils import timezone
from ads.models import Ad
register = template.Library()
@register.inclusion_tag('ads/tags/render_ads_zone.html', takes_context=True)
def render_ads_zone(context, zone):
"""
... | razisayyed/django-ads | ads/templatetags/ads_tags.py | Python | apache-2.0 | 956 |
'''
Created on Sep 15, 2012
Agent classes. Contains references to instances of classes containing observer
handlers and code
Agent Instances are created automatically. Create a named Handler instance under the Agent,
as an instance of the desired handler class,
by create (POST) of a JSON object containing a dicti... | connectIOT/iottoolkit | iottoolkit/core/Agent.py | Python | apache-2.0 | 6,297 |
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | GoogleCloudPlatform/ml-on-gcp | tutorials/tensorflow/mlflow_gcp/trainer/model_deployment.py | Python | apache-2.0 | 6,618 |
from typing import Any, Callable, Tuple, Union
from packed import pack, unpack
import jj
from jj import default_app, default_handler
from jj.apps import BaseApp, create_app
from jj.http.codes import BAD_REQUEST, OK
from jj.http.methods import ANY, DELETE, GET, POST
from jj.matchers import LogicalMatcher, RequestMatch... | nikitanovosibirsk/jj | jj/mock/_mock.py | Python | apache-2.0 | 3,717 |
""" EPYNET Classes """
from . import epanet2
from .objectcollection import ObjectCollection
from .baseobject import BaseObject, lazy_property
from .pattern import Pattern
class Node(BaseObject):
""" Base EPANET Node class """
static_properties = {'elevation': epanet2.EN_ELEVATION}
properties = {'head': ep... | VitensTC/epynet | epynet/node.py | Python | apache-2.0 | 4,030 |
import numpy as np
import random
import os
import shutil
import platform
import pytest
import ray
from ray.test_utils import wait_for_condition
from ray.internal.internal_api import memory_summary
MB = 1024 * 1024
def _init_ray():
return ray.init(
num_cpus=2,
object_store_memory=700e6,
_... | pcmoritz/ray-1 | python/ray/tests/test_plasma_unlimited.py | Python | apache-2.0 | 7,447 |
from __future__ import print_function
import pandas as pd
from sklearn.base import TransformerMixin
class FamilyCounter(TransformerMixin):
def __init__(self, use=True):
self.use = use
def transform(self, features_raw, **transform_params):
if self.use:
features = features_raw.copy... | wojtekwalczak/kaggle_titanic | titanic/transformers/FamilyCounter.py | Python | apache-2.0 | 946 |
#coding: utf-8
__author__ = 'horacioibrahim'
import unittest, os
import datetime
from time import sleep, ctime, time
from random import randint
from hashlib import md5
from types import StringType
# python-iugu package modules
import merchant, customers, config, invoices, errors, plans, subscriptions
def check_tes... | horacioibrahim/iugu-python | lib/iugu/tests.py | Python | apache-2.0 | 80,119 |
"""
Copyright (C) 2017 Open Source Robotics 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 agreed to... | ekumenlabs/terminus | terminus/geometry/enu.py | Python | apache-2.0 | 1,657 |
#
# Copyright 2011 the Melange 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 i... | adviti/melange | app/soc/views/helper/gdata_apis/__init__.py | Python | apache-2.0 | 638 |
"""Configure number in a device through MQTT topic."""
from __future__ import annotations
import functools
import logging
import voluptuous as vol
from homeassistant.components import number
from homeassistant.components.number import (
DEFAULT_MAX_VALUE,
DEFAULT_MIN_VALUE,
DEFAULT_STEP,
NumberEntity... | home-assistant/home-assistant | homeassistant/components/mqtt/number.py | Python | apache-2.0 | 8,276 |
# 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... | alex/warehouse | tests/unit/accounts/test_views.py | Python | apache-2.0 | 12,295 |
'''
Created on Nov 26, 2014
@author: Yury Zhauniarovich <y.zhalnerovich{at}gmail.com>
'''
import os, time
from interfaces.adb_interface import AdbInterface
from bboxcoverage import BBoxCoverage
from running_strategies import IntentInvocationStrategy
import smtplib
import email.utils
from email.mime.text import MIMET... | zyrikby/BBoxTester | BBoxTester/main_intents_strategy.py | Python | apache-2.0 | 5,189 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2011 Citrix Systems, Inc.
# Copyright 2011 OpenStack 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
#
# htt... | termie/nova-migration-demo | nova/network/vmwareapi_net.py | Python | apache-2.0 | 3,772 |
# Copyright (c) 2016 Huawei Technologies Co., Ltd.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... | bswartz/cinder | cinder/volume/drivers/huawei/huawei_driver.py | Python | apache-2.0 | 97,319 |
# Copyright 2015-2016 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... | gstarnberger/paasta | tests/cli/test_cmds_list.py | Python | apache-2.0 | 1,751 |
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
'''
Insights Forex live source
--------------------------
:copyright (c) 2014 Xavier Bruhiere
:license: Apache 2.0, see LICENSE for more details.
'''
import time
import pandas as pd
import dna.logging
import intuition.data.forex as forex
log = dna.logging.logger(__n... | intuition-io/insights | insights/sources/live/currencies.py | Python | apache-2.0 | 1,793 |
# 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 required by applicabl... | huggingface/transformers | tests/rag/test_tokenization_rag.py | Python | apache-2.0 | 7,364 |
# coding=utf-8
# Copyright 2018 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/transformers | tests/trainer/test_trainer_utils.py | Python | apache-2.0 | 18,824 |
from models.RepPoints.builder import RepPoints as Detector
from models.dcn.builder import DCNResNetFPN as Backbone
from models.RepPoints.builder import RepPointsNeck as Neck
from models.RepPoints.builder import RepPointsHead as Head
from mxnext.complicate import normalizer_factory
def get_config(is_train):
class ... | TuSimple/simpledet | config/RepPoints/reppoints_moment_dcn_r101v1b_fpn_multiscale_2x.py | Python | apache-2.0 | 7,766 |
from django.shortcuts import render
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.shortcuts import redirect
from main.models import Link
from main.models import Tag
# Create your views here.
def index(request):
context = RequestContext(request)
... | cntnboys/410Lab6 | bookmarks/main/views.py | Python | apache-2.0 | 1,325 |
#
# 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
# ... | ozamiatin/oslo.messaging | oslo_messaging/tests/functional/test_functional.py | Python | apache-2.0 | 13,879 |
#
# This source file is part of the EdgeDB open source project.
#
# Copyright 2008-present MagicStack Inc. and the EdgeDB 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... | edgedb/edgedb | edb/schema/links.py | Python | apache-2.0 | 21,887 |
import bisect
import string
from abc import ABC, abstractmethod
from typing import Optional
from django.conf import settings
class AbstractGrid(ABC):
enabled = False
@abstractmethod
def get_square_for_point(self, x, y) -> Optional[str]:
pass
@abstractmethod
def get_squares_for_bounds(se... | c3nav/c3nav | src/c3nav/mapdata/grid.py | Python | apache-2.0 | 2,343 |
from model.contact import Contact
from random import randrange
def test_edit_contact(app, db, check_ui):
if len(db.get_contact_list()) == 0:
app.contact.create(Contact(first_name ="Sabina", last_name="test", company="Pewex",
address="osiedle", phone_home="123456789", e_m... | sabinaczopik/python_training | test/test_edit_contact.py | Python | apache-2.0 | 949 |
# Copyright 2014 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | openstack/oslo.service | oslo_service/tests/test_systemd.py | Python | apache-2.0 | 2,580 |
class Solution:
def dailyTemperatures(self, T):
ans = []
m = [None]*101
for i in range(len(T)-1, -1, -1):
x = T[i]
m[x] = i
ans.append(min([x for x in m[x+1:] if x is not None], default=i)-i)
ans.reverse()
return ans
print(Solution().dailyT... | zuun77/givemegoogletshirts | leetcode/python/739_daily-temperatures.py | Python | apache-2.0 | 367 |
#!/usr/bin/python2.7
"""
Print the number of bases in a nib file.
usage: %prog nib_file
"""
from bx.seq import nib as seq_nib
import sys
nib = seq_nib.NibFile( file( sys.argv[1] ) )
print nib.length
| poojavade/Genomics_Docker | Dockerfiles/gedlab-khmer-filter-abund/pymodules/python2.7/lib/python/bx_python-0.7.1-py2.7-linux-x86_64.egg/EGG-INFO/scripts/nib_length.py | Python | apache-2.0 | 203 |
'''
Created on Feb 3, 2013
@author: bpurgaso
'''
from twisted.words.protocols import irc
from twisted.internet import protocol
from twisted.internet import reactor
from twisted.internet import threads
from ConfigManager import ConfigManager
from Authenticator import Authenticator
from subprocess import PIPE, STDOUT, ... | bpurgaso/hydra-ircbot | hydra/Hydra.py | Python | apache-2.0 | 9,993 |
"""Support for Tibber."""
import asyncio
import logging
import aiohttp
import tibber
from homeassistant.const import (
CONF_ACCESS_TOKEN,
CONF_NAME,
EVENT_HOMEASSISTANT_STOP,
Platform,
)
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers import discovery
from homeassis... | home-assistant/home-assistant | homeassistant/components/tibber/__init__.py | Python | apache-2.0 | 2,333 |
import pytest
from collections import OrderedDict
from insights.parsers import (calc_offset, keyword_search, optlist_to_dict, parse_delimited_table, parse_fixed_table,
split_kv_pairs, unsplit_lines, ParseException, SkipException)
SPLIT_TEST_1 = """
# Comment line
keyword1 = value1 #... | RedHatInsights/insights-core | insights/parsers/tests/test_parsers_module.py | Python | apache-2.0 | 24,552 |
"""
@date 2014-11-16
@author Hong-She Liang <starofrainnight@gmail.com>
"""
from selenium.common.exceptions import *
| starofrainnight/rabird.selenium | rabird/selenium/exceptions.py | Python | apache-2.0 | 118 |
# Copyright The PyTorch Lightning 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 law or agreed to i... | williamFalcon/pytorch-lightning | tests/accelerators/ddp_model.py | Python | apache-2.0 | 2,010 |
import csv
import os
import color
def _GetDataDirPath():
return os.path.join(os.path.dirname(__file__), 'data')
def _GetCsvPath():
return os.path.join(_GetDataDirPath(), 'dmccolors.csv')
def _GetCsvString():
with open(_GetCsvPath()) as f:
return f.read().strip()
def _CreateDmcColorFromRow(row):
number =... | nanaze/pystitch | pystitch/dmc_colors.py | Python | apache-2.0 | 1,790 |
"""A simple memcache-like server.
The basic data structure maintained is a single in-memory dictionary
mapping string keys to string values, with operations get, set and
delete. (Both keys and values may contain Unicode.)
This is a TCP server listening on port 54321. There is no
authentication.
Requests provide an... | leetreveil/tulip | examples/cachesvr.py | Python | apache-2.0 | 9,357 |
#
# 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... | jlopezmalla/spark | python/pyspark/ml/classification.py | Python | apache-2.0 | 70,656 |
"""
Test lldb breakpoint command add/list/delete.
"""
from __future__ import print_function
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
import side_effect
class BreakpointCommandTestCase(TestBase):
NO_DEBUG_INFO_TESTCASE = True
... | apple/swift-lldb | packages/Python/lldbsuite/test/commands/breakpoint/basic/TestBreakpointCommand.py | Python | apache-2.0 | 12,042 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | Intel-Corporation/tensorflow | tensorflow/python/kernel_tests/array_ops/stack_op_test.py | Python | apache-2.0 | 14,594 |
# (c) Copyright 2017-2019 SUSE 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 writ... | ArdanaCLM/ardana-service | ardana_service/admin.py | Python | apache-2.0 | 8,071 |
import experiment
from ..util import dirs
from ..util import file_handling as fh
from optparse import OptionParser
import sys
def main():
usage = "%prog project logfile "
parser = OptionParser(usage=usage)
parser.add_option('-n', dest='new_name', default=None,
help='New name for e... | dallascard/guac | core/experiment/rerun.py | Python | apache-2.0 | 1,879 |
# Copyright (c) 2010-2012 OpenStack, 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 ... | garvenshen/zeda-swift | swift/common/manager.py | Python | apache-2.0 | 21,270 |
"""App name"""
from django.apps import AppConfig
class CertificateEngineConfig(AppConfig):
name = "certificate_engine"
| repleo/bounca | certificate_engine/apps.py | Python | apache-2.0 | 126 |
# 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 applica... | tensorflow/addons | tensorflow_addons/seq2seq/decoder.py | Python | apache-2.0 | 23,035 |
# -*- 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-bigquery-storage | google/cloud/bigquery_storage_v1beta2/services/big_query_write/async_client.py | Python | apache-2.0 | 35,099 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | jhseu/tensorflow | tensorflow/python/platform/test.py | Python | apache-2.0 | 3,771 |
#!/usr/bin/env python
import click
from copy import copy
from netCDF4 import Dataset
import numpy as np
import numpy.ma as ma
import os
import rasterio
import rasterio.warp as rwarp
import time
import osr
from .. import geotools
from .. import utils
def earth_radius():
srs = osr.SpatialReference()
srs.ImportFrom... | ricardog/raster-project | projections/scripts/gen_sps.py | Python | apache-2.0 | 6,241 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Binux<i@binux.me>
# http://binux.me
# Created on 2014-02-07 17:05:11
import itertools
import json
import logging
import os
import time
from collections import deque
from six import iteritems, itervalues... | nicozhang/pyspider | pyspider/scheduler/scheduler.py | Python | apache-2.0 | 46,109 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance wi... | viggates/nova | nova/compute/manager.py | Python | apache-2.0 | 269,840 |
# coding: utf-8
"""
Wavefront REST API Documentation
<p>The Wavefront REST API enables you to interact with Wavefront servers using standard REST API tools. You can use the REST API to automate commonly executed operations such as automatically tagging sources.</p><p>When you make REST API calls outside the W... | wavefrontHQ/python-client | wavefront_api_client/models/response_container_paged_recent_traces_search.py | Python | apache-2.0 | 4,945 |
#! /usr/bin/python
# -*- coding: utf-8 -*-
"""
- 1. This model has 1,068,298 paramters and quantization compression strategy(weight:8 bits, active: 8 bits here, you can change the setting),
after 705 epoches' training with GPU, test accurcy of 84.0% was found.
- 2. For simplified CNN layers see "Convolutional layer (... | zsdonghao/tensorlayer | examples/quantized_net/tutorial_quanconv_cifar10.py | Python | apache-2.0 | 7,696 |
__author__ = 'thorsteinn'
def get_all_ship_fields(db):
ships = db.keys()
fields = []
for ship in ships:
shipDB = db[ship]
shipKeys = shipDB.keys()
for oneKey in shipKeys:
if oneKey not in fields:
fields.append(oneKey)
return fields
| ThorsteinnAdal/webcrawls_in_singapore_shippinglane | db_format_helpers/get_all_ship_fields.py | Python | apache-2.0 | 302 |
# Numbers 数字
print(2 + 2) # 4
print(50 - 5*6) # 20
print((50 - 5*6) / 4) # 5.0
print(8/5) # 1.6
print(17 / 3) # 5.666666666666667 float
print(17 // 3) # 5 取整
print(17 % 3) # 2 取模
print(5*3+2) # 17 先乘除,后加减
print(2+5*3) # 17 先乘除,后加减
pri... | wurainren/leaningPython | com/wurainren/base/Calculator.py | Python | apache-2.0 | 3,849 |
# coding: utf-8
"""
Server API
Reference for Server API (REST/Json)
OpenAPI spec version: 2.0.6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import sys
import os
import re
# python 2 and python 3 compatibility library
from six im... | kinow-io/kinow-python-sdk | kinow_client/apis/directors_api.py | Python | apache-2.0 | 71,299 |
#!/usr/bin/python
"""
.. module:: shellscribe
Shell-Scribe run.py
@author: Keith E. Miller <keithmiller@umass.edu>
Expected issues:
- cd command is shell-scribe specific so commands that use cd in a non-trivial
way might break the cd command
"""
import cmd
import os
import sys
import argparse as ap
import datetime
im... | keithemiller/shell-scribe | shell-scribe.py | Python | apache-2.0 | 12,528 |
#!/usr/bin/env python
import os
import sys
import etcd
import subprocess
import signal
import time
if len(sys.argv) < 2:
print("Please provide a server argument")
sys.exit(1)
def siginthandler(signum, stackframe):
sys.exit(-1)
signal.signal(signal.SIGINT, siginthandler)
logpath="/log"
if len(sys.argv) > 2:
lo... | rasros/CloudTranscoderLTH2 | readlog.py | Python | apache-2.0 | 723 |
from mido import MidiFile
from time import sleep
import pibrella
""" fade test
pibrella.light.red.fade(0,100,10)
sleep(11)
pibrella.light.red.fade(100,0,10)
sleep(11)
"""
""" start
pibrella.buzzer.note(-9)
sleep(.9)
pibrella.buzzer.off()
sleep(0.1)
pibrella.buzzer.note(-9)
sleep(0.9)
pibrella.buzzer.off()
sleep(0.1)
... | brata-hsdc/brata.station | bin/pibrellaMidi.py | Python | apache-2.0 | 1,422 |
from model.contact import Contact
import random
def test_delete_some_contact(app, db, check_ui):
if len(db.get_contact_list()) == 0:
app.contact.add(Contact(firstname="test"))
old_contacts = db.get_contact_list()
contact = random.choice(old_contacts)
app.contact.delete_contact_by_id(contact.i... | AndreyBalabanov/python_training | test/test_del_contact.py | Python | apache-2.0 | 633 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import paddle.fluid as fluid
from utility import get_gpu_num
class NpairsLoss():
def __init__(self,
train_batch_size = 160,
samples_each_class=2,
reg_l... | kuke/models | fluid/PaddleCV/metric_learning/losses/npairsloss.py | Python | apache-2.0 | 2,981 |
"""Support for INSTEON Modems (PLM and Hub)."""
import asyncio
from contextlib import suppress
import logging
from pyinsteon import async_close, async_connect, devices
from homeassistant.config_entries import SOURCE_IMPORT
from homeassistant.const import CONF_PLATFORM, EVENT_HOMEASSISTANT_STOP
from homeassistant.exce... | home-assistant/home-assistant | homeassistant/components/insteon/__init__.py | Python | apache-2.0 | 5,664 |
"""Config flow for ReCollect Waste integration."""
from __future__ import annotations
from typing import Any
from aiorecollect.client import Client
from aiorecollect.errors import RecollectError
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const import CONF_FRIENDLY_NAME
from ... | sander76/home-assistant | homeassistant/components/recollect_waste/config_flow.py | Python | apache-2.0 | 3,365 |
import robot_util
def sendSettings(ser, args):
if args.right_wheel_forward_speed is not None:
robot_util.sendSerialCommand(ser, "rwfs " + str(args.right_wheel_forward_speed))
if args.right_wheel_backward_speed is not None:
robot_util.sendSerialCommand(ser, "rwbs " + str(args.right_wheel_bac... | runmyrobot/runmyrobot | telly.py | Python | apache-2.0 | 1,037 |
""" Cisco_IOS_XR_infra_objmgr_cfg
This module contains a collection of YANG definitions
for Cisco IOS\-XR infra\-objmgr package configuration.
This module contains definitions
for the following management objects\:
object\-group\: Object\-group configuration
Copyright (c) 2013\-2016 by Cisco Systems, Inc.
All rig... | 111pontes/ydk-py | cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_infra_objmgr_cfg.py | Python | apache-2.0 | 90,489 |
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
from model_utils import Choices
from model_utils.models import TimeStampedModel
class History(TimeStampedModel):
RESOLUTIONS = Choices('second', 'minute', 'hour... | hello-base/web | apps/history/models.py | Python | apache-2.0 | 1,311 |
#FLM: ---------
pass
| impallari/Impallari-Fontlab-Macros | IMP Kerning/20 ---.py | Python | apache-2.0 | 27 |
#!/usr/bin/python
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
import sys
import re
"""Baby Names exercise
Define the extract_names() function below and c... | chintak/google-python-ex | babynames/solution/babynames.py | Python | apache-2.0 | 3,874 |
# coding=utf-8
# -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException, TimeoutException
from bs4 import BeautifulSoup
from datetime import datetime
from decimal import *
import sys
#phantonPath = "/home/jmartinz/00.py/phantomjs/phantomjs"
phantonPath = "... | jmartinz/pyCrawler | 10.contratacionE/pce_extrae_detalle_contrato.py | Python | apache-2.0 | 7,393 |
from python_kemptech_api import *
# Specify the LoadMaster connection credentials here:
loadmaster_ip = ""
username = ""
password = ""
vs_ip_1 = ""
vs_ip_2 = ""
rs_ip_1 = ""
rs_ip_2 = ""
vs_port = ""
rs_port = ""
class RealServerPool(object):
healthcheck_parameters = [
"checktype",
"checkport",
... | KEMPtechnologies/python-kemptech-api | examples/real_server_pooling.py | Python | apache-2.0 | 4,377 |
# Copyright (c) 2015 Mellanox Technologies, Ltd
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | noironetworks/neutron | neutron/tests/unit/agent/l2/extensions/test_qos.py | Python | apache-2.0 | 22,770 |
#!/usr/bin/env python
#
# Copyright 2007 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 o... | adviti/melange | thirdparty/google_appengine/google/storage/speckle/python/api/rdbms.py | Python | apache-2.0 | 22,582 |
# 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 agreed to in writing, ... | GoogleCloudPlatform/repo-automation-playground | xunit-autolabeler-v2/ast_parser/lib/test_data/appengine/gae_sample.py | Python | apache-2.0 | 695 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | kawamon/hue | desktop/core/src/desktop/lib/thrift_/http_client.py | Python | apache-2.0 | 2,588 |
#
# 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... | pcostell/google-cloud-datastore | python/googledatastore/local_cloud_datastore.py | Python | apache-2.0 | 7,713 |
# coding=utf-8
# Copyright 2016 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 logging
from... | UnrememberMe/pants | src/python/pants/engine/isolated_process.py | Python | apache-2.0 | 2,261 |
## Adding ./getresults to the Python path so that the modules in folder can be imported
import sys
sys.path.insert(0, './getresults')
import datetime
from flightsearch import flightsearch, flightresult
import os
import uuid
import time
from pprint import pprint
def main():
flyfrom = 'YYZ' #input("Enter departure ... | brahul90/cheapflights | cheapflights/main.py | Python | apache-2.0 | 1,721 |
# pylint: disable=no-self-use,invalid-name
import pytest
import torch
from torch.autograd import Variable
from allennlp.common import Params
from allennlp.common.checks import ConfigurationError
from allennlp.data import Vocabulary
from allennlp.modules.text_field_embedders import BasicTextFieldEmbedder
from allennlp... | nafitzgerald/allennlp | tests/modules/text_field_embedders/basic_token_embedder_test.py | Python | apache-2.0 | 2,108 |
#! /home/nsanthony/miniconda3/bin/python
import inventory.inventory_class as inv
import weapons.weapon_class as wp
class people:
"""This is the people class with attributes:"""
def name():
n = ''
return n
def health():
hp = 0
return hp
def descript():
d = 'Desc... | nsanthony/super-fortnight | wwk/py/people/people_class.py | Python | apache-2.0 | 583 |
az.plot_dist(b, rug=True, quantiles=[.25, .5, .75], cumulative=True)
| mcmcplotlib/mcmcplotlib | api/generated/arviz-plot_dist-5.py | Python | apache-2.0 | 69 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for parser and parser plugin presets."""
from __future__ import unicode_literals
import unittest
from plaso.containers import artifacts
from plaso.parsers import presets
from tests import test_lib as shared_test_lib
class ParserPresetTest(shared_test_lib.Bas... | rgayon/plaso | tests/parsers/presets.py | Python | apache-2.0 | 4,926 |
# _*_ coding: utf-8 _*_
# filename: pic.py
import csv
import numpy
import matplotlib.pyplot as plt
# 读取 house.csv 文件中价格和面积列
price, size = numpy.loadtxt('house.csv', delimiter='|', usecols=(1, 2), unpack=True)
print price
print size
plt.figure()
plt.subplot(211)
# plt.title("price")
plt.title("/ 10000RMB")
plt.hist(... | tongxindao/shiyanlou | shiyanlou_cs869/ershoufang_info/pic.py | Python | apache-2.0 | 766 |
#!python3
import requests
import yaml
import time
import enum
import sys
import re
import logging
import ssl
from requests.auth import HTTPDigestAuth
from requests.auth import HTTPBasicAuth
from lxml import etree as ET
from requests.packages.urllib3.exceptions import InsecureRequestWarning
from requests.adapters import... | adam-miller/h3_py | h3_py/h3.py | Python | apache-2.0 | 8,597 |
import os
import subprocess
import sys
import pytest
sys.path.append("tests/python")
import testing as tm
import test_demos as td # noqa
@pytest.mark.skipif(**tm.no_cupy())
def test_data_iterator():
script = os.path.join(td.PYTHON_DEMO_DIR, 'quantile_data_iterator.py')
cmd = ['python', script]
sub... | dmlc/xgboost | tests/python-gpu/test_gpu_demos.py | Python | apache-2.0 | 1,044 |
"""
Tests for zipline.pipeline.loaders.frame.DataFrameLoader.
"""
from unittest import TestCase
from mock import patch
from numpy import arange, ones
from numpy.testing import assert_array_equal
from pandas import (
DataFrame,
DatetimeIndex,
Int64Index,
)
from zipline.lib.adjustment import (
Float64Ad... | ChinaQuants/zipline | tests/pipeline/test_frameload.py | Python | apache-2.0 | 7,612 |
'''
Implements the RTS ALUA Target Port Group class.
This file is part of RTSLib.
Copyright (c) 2016 by Red Hat, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at
http://www.apache.org/lice... | cvubrugier/rtslib-fb | rtslib/alua.py | Python | apache-2.0 | 15,637 |
# Copyright (c) 2019, NVIDIA Corporation. All rights reserved.
#
# This work is made available under the Nvidia Source Code License-NC.
# To view a copy of this license, visit
# https://nvlabs.github.io/stylegan2/license.html
from . import submission
from .submission.run_context import RunContext
from .submission.su... | google/lecam-gan | third_party/dnnlib/__init__.py | Python | apache-2.0 | 774 |
# Copyright 2019 The dm_control 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 i... | deepmind/dm_control | dm_control/locomotion/soccer/soccer_ball.py | Python | apache-2.0 | 8,413 |
# http://remotescripts.blogspot.com
"""
Track Control User Modes component originally designed for use with the APC40.
Copyright (C) 2010 Hanz Petrov <hanz.petrov@gmail.com>
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 Fre... | jim-cooley/abletonremotescripts | remote-scripts/samples/APC_64_40_r1b/APC_64_40/EncoderUserModesComponent.py | Python | apache-2.0 | 6,872 |
# Copyright 2019 The dm_control 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 i... | deepmind/dm_control | dm_control/entities/manipulators/kinova/kinova_test.py | Python | apache-2.0 | 11,745 |
# -*- coding: utf-8 -*-
# Copyright 2014 Foxdog Studios
#
# 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 l... | foxdog-studios/pyddp | tests/messages/client/test_method_message_parser.py | Python | apache-2.0 | 1,258 |