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
from django.contrib.auth import get_user_model from rest_framework.fields import CharField from rest_framework.serializers import ModelSerializer from grandchallenge.challenges.models import Challenge from grandchallenge.components.serializers import ( ComponentInterfaceValueSerializer, ) from grandchallenge.evalu...
comic/comic-django
app/grandchallenge/evaluation/serializers.py
Python
apache-2.0
1,856
import gzip import logging import os import shutil import uuid from PIL import Image from zipfile import ZipFile import pandas as pd import numpy as np import pyresample as pr from trollvalidation.validations import configuration as cfg LOG = logging.getLogger(__name__) # logging.basicConfig(level=logging.DEBUG, # ...
HelgeDMI/trollvalidation
trollvalidation/validation_utils.py
Python
apache-2.0
5,738
#!/usr/bin/env python # DummyMP - Multiprocessing Library for Dummies! # Copyright 2014 Albert Huang. # # 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/LI...
alberthdev/pyradmon
pyradmon/dummymp/loghandler.py
Python
apache-2.0
2,314
#!/usr/bin/env python # # 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 requir...
googleads/googleads-python-lib
examples/adwords/v201809/advanced_operations/add_ad_customizer.py
Python
apache-2.0
8,193
import socket import threading bind_ip = "" bind_port = 60007 server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server.bind((bind_ip, bind_port)) server.listen(5) print("[*] Listening on %s:%d" % (bind_ip, bind_port)) def handle_client(client_socket): request = client_socket.recv(1024).decode() p...
xieyajie/BackHatPython
backhatpython02/server-tcp.py
Python
apache-2.0
707
#!/usr/bin/env python # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
googleapis/python-secret-manager
samples/snippets/iam_grant_access.py
Python
apache-2.0
2,075
from akara.dist import setup setup(name="basic", version="1.0", akara_extensions=["blah.py"] )
uogbuji/akara
test/setup_scripts/setup_basic.py
Python
apache-2.0
108
""" *** Deprecated Model Builder functionality *** Supports functional algorithm calls found in the top-level h2o module. Current modeling is performed via estimator fitting (see estimators sub module for details) """ from connection import H2OConnection from frame import H2OFrame from job import H2OJob...
madmax983/h2o-3
h2o-py/h2o/h2o_model_builder.py
Python
apache-2.0
4,406
# coding=utf-8 import os def run(cmd, decoding = None, clean = False): if cmd: result = [] output = os.popen(cmd).readlines() for line in output: if decoding: line = line.decode(decoding) if clean: line = line.strip() ...
interhui/py-sys
py_sys/execute.py
Python
apache-2.0
477
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import annotations import pytest from pants.core.util_rules import config_files, source_files from pants.core.util_rules.external_tool import rules as external_tool_rules...
benjyw/pants
src/python/pants/jvm/resolve/coursier_fetch_integration_test.py
Python
apache-2.0
11,431
""" Support for HomeMatic devices. For more details about this component, please refer to the documentation at https://home-assistant.io/components/homematic/ """ import asyncio from datetime import timedelta from functools import partial import logging import os import socket import voluptuous as vol from homeassis...
ewandor/home-assistant
homeassistant/components/homematic/__init__.py
Python
apache-2.0
29,766
from JumpScale import j # from SpecModelactorsGenerator import SpecModelactorsGenerator class Specbase(j.tools.code.classGetBase()): def __init__(self, linenr): self.name = "" self.description = "" self.tags = "" self.comment = "" self.linenr = linenr def addDefaults(...
Jumpscale/jumpscale_core8
lib/JumpScale/core/specparser/SpecParser.py
Python
apache-2.0
32,720
# -*- coding: utf-8 -*- """ equip.analysis.dataflow.lattice ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The base lattice implementation (mostly used as semi-lattice). :copyright: (c) 2014 by Romain Gaucher (@rgaucher) :license: Apache 2, see LICENSE for more details. """ class Lattice(object): """ Interface for...
neuroo/equip
equip/analysis/dataflow/lattice.py
Python
apache-2.0
1,624
# Copyright (c) 2012 OpenStack Foundation. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
telefonicaid/murano
murano/openstack/common/policy.py
Python
apache-2.0
29,785
# -*- coding: utf-8 -*- from model.group import Group def test_add_group(app): old_groups = app.group.get_group_list() group = Group(name="hjhj", header="jhjh", footer="jhjjhhj") app.group.create(group) new_groups = app.group.get_group_list() assert len(old_groups) + 1 == len(new_groups) old_...
alenasf/Pythontest
test/test_add_group.py
Python
apache-2.0
813
import pytest import salt.states.openvswitch_port as openvswitch_port from tests.support.mock import MagicMock, patch @pytest.fixture def configure_loader_modules(): return {openvswitch_port: {"__opts__": {"test": False}}} def test_present(): """ Test to verify that the named port exists on bridge, even...
saltstack/salt
tests/pytests/unit/states/test_openvswitch_port.py
Python
apache-2.0
3,213
#!/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 # # Unless required by applicable law or agreed to in writing, software ...
DataDog/sensei
clients/python/sensei/sensei_components.py
Python
apache-2.0
35,124
#!/usr/bin/python # Copyright 2017 Northern.tech AS # # 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 a...
GregorioDiStefano/integration
tests/MenderAPI/inventory.py
Python
apache-2.0
3,224
######## # Copyright (c) 2013 GigaSpaces Technologies Ltd. All rights reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
isaac-s/cloudify-manager
tests/integration_tests/tests/agentless_tests/scale/test_scale_in.py
Python
apache-2.0
9,915
#!/usr/bin/env python """Test for the ee.__init__ file.""" import six import unittest import ee from ee import apitestcase class EETestCase(apitestcase.ApiTestCase): def setUp(self): ee.Reset() def testInitialization(self): """Verifies library initialization.""" def MockSend(path, params, unus...
tylere/earthengine-api
python/ee/tests/ee_test.py
Python
apache-2.0
15,097
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
google/nitroml
nitroml/automl/metalearning/metalearner/component_test.py
Python
apache-2.0
2,460
#!/usr/bin/python3 """Run 'adb devices' and show results in friendly way. Runs 'adb devices' and integrates the results with environment variables DEVTAGS and ANDROID_SERIAL to show model numbers for connected devices. """ import getopt import os import re import sys import script_utils as u valid_dispositions = {...
thanm/devel-scripts
showdevices.py
Python
apache-2.0
2,992
import os import json import logging _DEFAULT_CONFIG_DIR = "config" _DEFAULT_CONFIG_NAME = "config.json" _DEFAULT_LOG_CONFIG_NAME = "default_log.json" ###################################################################################################### def load(path): json_content = _load_json(path) loggin...
dayaftereh/scripts
python/tcu/lib/config.py
Python
apache-2.0
3,690
# @license # Copyright 2020 Google LLC. All Rights Reserved. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
tensorflow/tfjs
e2e/integration_tests/metadata.py
Python
apache-2.0
3,552
"""Test config flow.""" from unittest.mock import Mock, patch from homeassistant.components.hassio.handler import HassioAPIError from homeassistant.const import EVENT_HOMEASSISTANT_START from homeassistant.setup import async_setup_component from tests.common import mock_coro async def test_hassio_discovery_startup(...
leppa/home-assistant
tests/components/hassio/test_discovery.py
Python
apache-2.0
5,530
import sys import numpy as np class ChromStats(object): def __init__(self): self.n = 0 self.n_nan = 0 self.sum = 0 self.min = None self.max = None def mean(self): """Calculates mean of sites that are not nan on this chromsome""" n = self.n - s...
smozaffari/WASP
CHT/chromstat.py
Python
apache-2.0
4,398
""" Routines to compute RMSD of all PROT_IND_ files These routines were developed by: Rodrigo Antonio Faccioli - rodrigo.faccioli@usp.br / rodrigo.faccioli@gmail.com Leandro Oliveira Bortot - leandro.bortot@usp.br / leandro.obt@gmail.com """ import os import sys from collections import OrderedDict...
rodrigofaccioli/2pg_cartesian
scripts/analysis/compute_rmsd_pdb_files.py
Python
apache-2.0
1,725
#!/usr/bin/env python import argparse import os import logging import cdec.configobj import cdec.sa from cdec.sa._sa import monitor_cpu import sys MAX_PHRASE_LENGTH = 4 def precompute(f_sa, max_len, max_nt, max_size, min_gap, rank1, rank2, tight_phrases): lcp = cdec.sa.LCP(f_sa) stats = sorted(lcp.compute_stat...
kho/mr-cdec
python/pkg/cdec/sa/compile.py
Python
apache-2.0
5,575
# 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 agreed to in writing, ...
datacommonsorg/data
scripts/fbi/hate_crime/table1/preprocess_test.py
Python
apache-2.0
2,606
# print absolute value of an integer: a = -100 if a >= 0: print a else: print -a
xingchaoma/github-python-study
byteofpython/ch01_intro/a.py
Python
apache-2.0
93
import datetime import hashlib import itertools import logging import os import time from collections import defaultdict from dataclasses import asdict, dataclass, field from operator import itemgetter from typing import ( IO, AbstractSet, Any, Callable, Collection, Dict, Iterable, List,...
andersk/zulip
zerver/lib/actions.py
Python
apache-2.0
325,551
import numpy as np import matplotlib.pyplot as plt from scipy.stats import norm from scipy.stats import multivariate_normal as mvn norm.pdf(0) # mean: loc, stddev: scale norm.pdf(0, loc=5, scale=10) r = np.random.randn(10) # probability distribution function: norm.pdf(r) # log probability: norm.log...
balazssimon/ml-playground
udemy/lazyprogrammer/numpy-stack/scipy_test.py
Python
apache-2.0
1,730
# # 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 n...
wangyixiaohuihui/spark2-annotation
python/pyspark/shuffle.py
Python
apache-2.0
28,525
# -*- coding:utf-8 -*- from werkzeug.routing import Map, Submount import libcloud from libcloud_rest.api.handlers import app_handler from libcloud_rest.api.handlers.compute import compute_handler from libcloud_rest.api.handlers.dns import dns_handler from libcloud_rest.api.handlers.loadbalancer import lb_handler from ...
islamgulov/libcloud.rest
libcloud_rest/api/urls.py
Python
apache-2.0
704
import zstackwoodpecker.operations.scheduler_operations as sch_ops import zstackwoodpecker.operations.resource_operations as res_ops import zstackwoodpecker.operations.tag_operations as tag_ops import zstackwoodpecker.operations.backupstorage_operations as bs_ops import zstackwoodpecker.test_lib as test_lib import zsta...
zstackio/zstack-woodpecker
integrationtest/vm/virtualrouter/scheduler/test_delete_local_backupstorage.py
Python
apache-2.0
5,456
# Copyright (c) 2014 GigaSpaces Technologies Ltd. All rights reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required ...
denismakogon/tosca-vcloud-plugin
vcloud_plugin_common/__init__.py
Python
apache-2.0
17,925
# -*- coding: utf-8 -*- """ Installs and configures amqp """ import logging import uuid import os from packstack.installer import validators from packstack.installer import processors from packstack.installer import basedefs from packstack.installer import utils from packstack.modules.common import filtered_hosts f...
fr34k8/packstack
packstack/plugins/amqp_002.py
Python
apache-2.0
9,717
# -*- coding: utf-8 -*- # Generated by Django 1.9 on 2016-07-16 10:25 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('testCon', '0010_auto_20160713_1534'), ] operations = [ migrations.AddField( ...
Jameeeees/Mag1C_baNd
kekangpai/testCon/migrations/0011_auto_20160716_1025.py
Python
apache-2.0
1,103
import sys import json import flask from flask import Flask from flask.ext.sqlalchemy import SQLAlchemy from flask.ext.cors import origin from parse import ProfileParser, IHMEParser from flask import render_template from flask import Response from werkzeug.contrib.fixers import ProxyFix app = Flask(__name__) app.confi...
adieyal/ghwa_profiles
server/server.py
Python
apache-2.0
2,916
#!/usr/bin/python # -*- coding: iso-8859-15 -*- # ========================================================================== # Copyright (C) 2016 Dr. Alejandro Pina Ortega # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may ob...
ajpina/uffema
uffema/machines/synchronous.py
Python
apache-2.0
2,520
# Copyright (c) 2017 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 agreed to ...
openstack/sahara
sahara/tests/unit/service/edp/data_sources/base_test.py
Python
apache-2.0
2,415
import ast n = int(input()) a=[] s1=s2=0 for i in range(0, n): a = list(ast.literal_eval(','.join(input().split()))) if(len(a) == n): s1+=a[i] s2+=a[n-1-i] print(abs(s1-s2))
tpb261/hackerRank
warmup/diag_diff.py
Python
apache-2.0
198
# 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...
huijunwu/heron
heron/tools/ui/src/python/handlers/api/__init__.py
Python
apache-2.0
1,275
# Copyright 2015-2016 Rackspace US, 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 i...
rackerlabs/lambda-uploader
lambda_uploader/uploader.py
Python
apache-2.0
8,157
# Copyright (c) 2022 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 appli...
PaddlePaddle/Paddle
python/paddle/fluid/tests/unittests/mlu/c_comm_init_op_mlu.py
Python
apache-2.0
2,475
import numpy as np from src.base.animal import Animal class Stats(object): # TODO: Re-implement this at a higher level # Ugh. I feel dirty. # name, type, min, max ... distro? DATA = { 'air': ('i2', 0, 1000), 'hunger': ('i2', 0, 1000), 'thirst': ('i2', 0, 1000), 'stamin...
lexwraith/ThisIsBob
src/game/person.py
Python
apache-2.0
1,247
# ---------------------------------------------------------- # Introdução a Programação de Computadores - IPC # Universidade do Estado do Amazonas - UEA # Prof. Jucimar Jr # Edson de Lima Barros 1715310043 # Gabriel Nascimento de Oliveira 1715310052 # Luiz Daniel Raposo Nunes de Mello ...
jucimarjr/IPC_2017-1
lista02/lista02_exercicio01_questao05.py
Python
apache-2.0
883
# -*- coding: utf-8 -*- import urllib from . import admin from flask import request from flask import url_for from flask import redirect from flask import render_template from flask_login import UserMixin from flask_login import login_user from flask_login import logout_user from flask_login import login_required from...
moxuanchen/BMS
core/views/admin/login.py
Python
apache-2.0
1,670
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "LaasFrontEnd.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
BryceBrown/LinkstrDjango
manage.py
Python
apache-2.0
255
# Copyright 2011 OpenStack Foundation # aLL Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
rakeshmi/cinder
cinder/tests/unit/api/v2/test_types.py
Python
apache-2.0
8,430
import pytest import watchmaker @pytest.fixture def setup_object(): pass def test_main(): """Placeholder for tests""" # Placeholder assert watchmaker.__version__ == watchmaker.__version__
MarionTheBull/watchmaker
tests/test_watchmaker.py
Python
apache-2.0
209
''' Created on Dec 12, 2011 @author: sean ''' from . import Visitor import ast #FIXME: add tests class CopyVisitor(Visitor): ''' Copy only ast nodes and lists ''' def visitDefault(self, node): Node = type(node) new_node = Node() for _field in Node._fields: ...
diana-hep/femtocode
lang/femtocode/thirdparty/meta/asttools/visitors/copy_tree.py
Python
apache-2.0
1,255
# Copyright 2021 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 agreed to in ...
ChameleonCloud/blazar
blazar/db/migration/alembic_migrations/versions/42c7fd6e792e_add_device_reservation.py
Python
apache-2.0
5,436
from datetime import datetime from rest_framework import serializers from rest_framework.settings import api_settings from api.models import VenueList, EventList class VenueListSerializer(serializers.Serializer): id = serializers.IntegerField(read_only=True) venue_name = serializers.CharField(max_length=255...
dennisdarwis/dugem-backend
api/serializers.py
Python
apache-2.0
3,888
import unittest class TestCase(unittest.TestCase): """Test case base class for all unit tests."""
bondar-pavel/infoblox-client
infoblox_client/tests/base.py
Python
apache-2.0
105
#!/usr/bin/python glint_lib_directory='/var/lib/glint' horizon_git_repo='https://github.com/rd37/horizon.git' glint_git_repo='https://github.com/hep-gc/glint.git' glint_inst_type='default' horizon_inst_type='default' glint_server='django' glint_horizon_server='django' cfg_dir = '/etc/glint' pkg_dir = 'glint-service' ...
hep-gc/glint-service
glint-service/glint_git_setup.py
Python
apache-2.0
12,100
# Copyright 2021 The Kubeflow 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...
kubeflow/pipelines
sdk/python/kfp/deprecated/dsl/artifact_utils.py
Python
apache-2.0
3,439
from tests.base import TestBase from pascal.program import Program class TestVariables(TestBase): def test_pass_valid_var(self): file_name = "tests/mock_pas/all_var.pas" pascal_program = Program(file_name) pascal_program.run() self.assertEqual(len(pascal_program.symbol_table), 7) ...
TheLampshady/pascompiler
tests/test_variables.py
Python
apache-2.0
537
# # This source file is part of the EdgeDB open source project. # # Copyright 2018-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
tests/test_edgeql_casts.py
Python
apache-2.0
82,780
__source__ = 'https://leetcode.com/problems/is-subsequence/description/' # https://github.com/kamyu104/LeetCode/blob/master/Python/is-subsequence.py # Time: O(n) # Space: O(1) # # Description: Leetcode # 392. Is Subsequence # # Given a string s and a string t, check if s is subsequence of t. # # You may assume that th...
JulyKikuAkita/PythonPrac
cs15211/IsSubsequence.py
Python
apache-2.0
5,737
from dirbalak import graph from dirbalak import repomirrorcache from dirbalak import describetime from upseto import gitwrapper class DependencyGraph: _CONTINUOUS_INTEGRATION_VIOLATION_TIME = 14 * 24 * 60 * 60 def __init__(self, dependencies, getNodeAttributesCallback): self._dependencies = dependenc...
Stratoscale/dirbalak
py/dirbalak/dependencygraph.py
Python
apache-2.0
2,973
# Copyright (c) 2014 Cisco Systems, 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 r...
klmitch/nova
nova/tests/unit/api/openstack/compute/test_server_groups.py
Python
apache-2.0
37,885
#!/usr/bin/env python """ responses ========= A utility library for mocking out the `requests` Python library. :copyright: (c) 2013 Dropbox, Inc. """ from setuptools import setup from setuptools.command.test import test as TestCommand import sys setup_requires = [] if 'test' in sys.argv: setup_requires.append(...
cournape/responses
setup.py
Python
apache-2.0
1,534
# Copyright 2014 Cloudbase Solutions Srl # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
HybridF5/jacket
jacket/tests/compute/unit/virt/hyperv/test_livemigrationops.py
Python
apache-2.0
5,845
""" Models initializer. """ from functools import wraps from flask_sqlalchemy import SQLAlchemy from server import app from utils import time_to_json from errors import DataBaseException DB = SQLAlchemy(app) def db_factory_func(func): """ Database connection decorator. Creates a database connection and ...
ITU-DB-MANAGEMENT-HM/itunder-backend-rest
models/base_model.py
Python
apache-2.0
9,264
# Copyright 2017 Josh Karlin. All rights reserved. # Use of this source code is governed by the Apache license found in the LICENSE # file. import argparse import datetime import getopt import json import sys import tempfile import threading import time import urllib.request import urllib.parse gFileCache = None; # ...
karlinjf/ChromiumXRefs
lib/chromium_code_search.py
Python
apache-2.0
7,067
'''/* UVa problem: * * Topic: * * Level: * * Brief problem description: * * * * Solution Summary: * * * * Used Resources: * * * * I hereby certify that I have produced the following solution myself * using the resources listed above in accordance with the CMPUT 403 * collaboration po...
DT9/programming-problems
2017/uva/403/temp/UVa492.py
Python
apache-2.0
703
from qgl2.qgl2 import qgl2decl, qgl2main, qreg from qgl2.qgl2 import QRegister from qgl2.qgl1 import X, Y, Z, Id, Utheta from itertools import product @qgl2decl def cond_helper(q: qreg, cond): if cond: X(q) @qgl2decl def t1(): """ Correct result is [ X(q1) ] """ q1 = QRegister('q1') ...
BBN-Q/pyqgl2
test/code/bugs/84.py
Python
apache-2.0
1,119
#!/usr/bin/env python3 from distutils.core import setup from catkin_pkg.python_setup import generate_distutils_setup d = generate_distutils_setup( packages=['lg_builder'], package_dir={'': 'src'}, scripts=['scripts/lg-ros-build'], install_requires=['catkin_pkg', 'python-debian', 'rospkg'] ) setup(**d...
EndPointCorp/lg_ros_nodes
lg_builder/setup.py
Python
apache-2.0
322
#kpbochenek@gmail.com def common_words(first, second): dd = set() for s in first.split(","): dd.add(s) return ",".join(sorted([w for w in second.split(",") if w in dd])) if __name__ == '__main__': # These "asserts" using only for self-checking and not necessary for auto-testing assert common_words...
kpbochenek/empireofcode
common_words.py
Python
apache-2.0
640
from fancontroller.fan_controller import Thermostat, STATE_ON, STATE_OFF Thermostat STATE_ON STATE_OFF
isdal/raspberrypi-fan-controller
fancontroller/__init__.py
Python
apache-2.0
103
# # Copyright 2012 New Dream Network, LLC (DreamHost) # Copyright 2014 Hewlett-Packard Company # # 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-...
Juniper/ceilometer
ceilometer/api/rbac.py
Python
apache-2.0
2,916
# Copyright (c) 2019 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...
luotao1/Paddle
python/paddle/fluid/dygraph/dygraph_to_static/static_analysis.py
Python
apache-2.0
15,858
# python3 # Copyright 2018 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/licenses/LICENSE-2.0 # # Unless re...
deepmind/acme
acme/utils/counting.py
Python
apache-2.0
4,636
# Copyright (c) 2015 OpenStack Foundation. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
paninetworks/neutron
neutron/db/db_base_plugin_common.py
Python
apache-2.0
12,074
#!/usr/bin/python -tt import commands import re import sys def aray__to_string(ar): array_string="" for item in ar: array_string += " "+item array_string=array_string.replace(ar[0],"") return array_string.rstrip().lstrip() def get_class_path(): #using find /xyz/abc/lib/ -type f \( -name "*.jar" -o -name "...
dushmis/misc
python/bulk_compile_all_java.py
Python
apache-2.0
1,386
# 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, ...
googleapis/python-bigquery
samples/query_external_sheets_permanent_table.py
Python
apache-2.0
3,135
# Copyright (c) 2014 Mirantis Inc. # # Licensed under the Apache License, Version 2.0 (the License); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, ...
Mirantis/pumphouse
setup.py
Python
apache-2.0
656
"""Common code for Withings.""" import asyncio from dataclasses import dataclass import datetime from datetime import timedelta from enum import Enum, IntEnum import logging import re from typing import Any, Callable, Dict, List, Optional, Tuple, Union from aiohttp.web import Response import requests from withings_api...
turbokongen/home-assistant
homeassistant/components/withings/common.py
Python
apache-2.0
34,960
import os from unipath import Path from django.core.exceptions import ImproperlyConfigured import dj_database_url def env_var(var_name): """Get the environment variable var_name or return an exception.""" try: return os.environ[var_name] except KeyError: msg = "Please set the environment ...
rskwan/mt
mt/mt/settings/base.py
Python
apache-2.0
2,992
# Copyright 2012 OpenStack Foundation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
BeenzSyed/tempest
tempest/api/volume/test_volumes_get.py
Python
apache-2.0
6,033
import time from aiohttp import web import asyncio import aiomcache from aiohttp_session import setup, get_session from aiohttp_session.memcached_storage import MemcachedStorage async def handler(request: web.Request) -> web.Response: session = await get_session(request) last_visit = session['last_visit'] if...
aio-libs/aiohttp_session
demo/memcached_storage.py
Python
apache-2.0
788
# -*- coding: utf-8 -*- # # Copyright 2014 - Intel. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
lcostantino/healing-os
healing/db/sqlalchemy/models.py
Python
apache-2.0
3,311
import re from django.conf import settings from django.core.exceptions import ValidationError from django.core.validators import _lazy_re_compile, BaseValidator, URLValidator class EnhancedURLValidator(URLValidator): """ Extends Django's built-in URLValidator to permit the use of hostnames with no domain ext...
digitalocean/netbox
netbox/utilities/validators.py
Python
apache-2.0
1,580
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
tensorflow/data-validation
tensorflow_data_validation/statistics/generators/sparse_feature_stats_generator.py
Python
apache-2.0
7,813
#!/usr/bin/env python3 import sys try: import __builtin__ except ImportError: import builtins as __builtin__ import os # python puts the program's directory path in sys.path[0]. In other words, the user ordinarily has no way # to override python's choice of a module from its own dir. We want to have that a...
openbmc/openbmc-test-automation
bin/validate_plug_ins.py
Python
apache-2.0
3,734
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import numbers from torch.distributions.transforms import Transform from pyro.ops.tensor_utils import safe_normalize from .. import constraints class Normalize(Transform): """ Safely project a vector onto the sphere wrt th...
uber/pyro
pyro/distributions/transforms/normalize.py
Python
apache-2.0
1,072
#! /usr/bin/env python # -*- coding: utf-8 -*- ''' Created on 2012-2-5 @author: zepheir ''' import sys sys.path.append('/app/srv/src') from binascii import b2a_hex try: from twisted.internet import epollreactor epollreactor.install() except: pass from twisted.internet import reactor from twisted.pytho...
zepheir/pySrv_sipai
srv/src/sipaiSampleServer.py
Python
apache-2.0
4,049
# 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 pant...
sid-kap/pants
src/python/pants/backend/jvm/tasks/jvm_compile/java/java_compile.py
Python
apache-2.0
7,482
import logging import os import shutil import subprocess DEVNULL = open(os.devnull, 'wb') class ShellError(Exception): def __init__(self, command, err_no, message=None): self.command = command self.errno = err_no self.message = message def __str__(self): string = "Command '%s...
ModernMT/MMT
cli/utils/osutils.py
Python
apache-2.0
2,402
""" Support for Huawei LTE routers. For more details about this component, please refer to the documentation at https://home-assistant.io/components/huawei_lte/ """ from datetime import timedelta from functools import reduce import logging import operator import voluptuous as vol import attr from homeassistant.const...
persandstrom/home-assistant
homeassistant/components/huawei_lte.py
Python
apache-2.0
3,730
#!/usr/bin/env python """Conditional import for Chipsec. Only Linux is supported at this stage."""
google/grr
grr/client/grr_response_client/components/chipsec_support/actions/__init__.py
Python
apache-2.0
99
# Copyright 2016 MongoDB 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...
mongodb-labs/disasm
app/disasm_demangler.py
Python
apache-2.0
654
class SessionHelper: def __init__(self, app): self.app = app def login(self, username, password): # login wd = self.app.wd self.app.open_home_page_group () wd.find_element_by_name("user").click() wd.find_element_by_name("user").clear() wd.find_element_b...
ElenaBadWolf/for_homework1
fixture/session.py
Python
apache-2.0
1,287
# Name: tools.py # Purpose: XRC editor, toolbar # Author: Roman Rolinsky <rolinsky@mema.ucl.ac.be> # Created: 19.03.2003 # RCS-ID: $Id: tools.py,v 1.12 2006/05/17 03:57:57 RD Exp $ from xxx import * # xxx imports globals and params from tree import ID_NEW # Icons im...
andreas-p/admin4
xrced/tools.py
Python
apache-2.0
12,508
# Lint as: python3 """Unit tests for test_record module.""" import sys import unittest from openhtf.core import test_record def _get_obj_size(obj): size = 0 for attr in obj.__slots__: # pytype: disable=attribute-error size += sys.getsizeof(attr) size += sys.getsizeof(getattr(obj, attr)) return size ...
google/openhtf
test/core/test_record_test.py
Python
apache-2.0
931
# -*- coding: utf-8 -*- # Copyright 2020 Green Valley Belgium NV # # 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...
our-city-app/oca-backend
src/rogerthat/bizz/job/save_service_identities.py
Python
apache-2.0
928
# 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 a...
ewiseblatt/spinnaker
testing/citest/tests/bake_and_deploy_test.py
Python
apache-2.0
30,181
# -*- coding:utf-8 -*- #html_doc = '''<div><a href="http://www.weblio.jp/content/%E5%BD%A2%E5%AE%B9%E5%8B%95%E8%A9%9E" title="形容動詞の意味" class=crosslink>形容動詞</a>「<a href="http://www.weblio.jp/content/%E3%82%A2%E3%83%BC%E3%83%86%E3%82%A3%E3%83%95%E3%82%A3%E3%82%B7%E3%83%A3%E3%83%AB" title="アーティフィシャルの意味" class=crosslink>ア...
pprivulet/DataScience
Dic/getDetail.py
Python
apache-2.0
3,537
# Copyright (c) 2010-2013 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 ...
Khushbu27/Tutorial
swift/obj/mem_server.py
Python
apache-2.0
4,314