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
########################################################################### # # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/l...
google/starthinker
starthinker/util/auth_wrapper.py
Python
apache-2.0
5,824
# Copyright 2016 The Meson development 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 ...
mesonbuild/meson
mesonbuild/scripts/msgfmthelper.py
Python
apache-2.0
1,406
from math import sqrt def pythagorean_triplet(wanted_sum): if wanted_sum <= 0: raise ValueError("Wanted sum must be a positive number") result = [] for c in range(wanted_sum - 3, 2, -1): for b in range(c - 1, 1, -1): a = sqrt(c * c - b * b) if a % 1 == 0 and a + b +...
plilja/project-euler
problem_9/pythagorean_triplet.py
Python
apache-2.0
409
import json import requests import pprint postURL = 'http://localhost:3000/posts' productURL = 'http://localhost:3000/products' dataPost = { 'picture': 'https://s-media-cache-ak0.pinimg.com/474x/1a/eb/2e/1aeb2eff3242f5884a8a23e4bdb7946f.jpg', 'description': 'Marcos favorite outfit', 'tags': [1,2], 'brands': [1,...
PolyStyle/server-nodejs
testQueries.py
Python
apache-2.0
793
# -*- 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...
googleads/google-ads-python
google/ads/googleads/v9/services/services/conversion_action_service/transports/base.py
Python
apache-2.0
4,409
# -*- coding: utf-8 -*- from fixture.variables import UserLogin, Profinity from contract_lib import Contract def test_of_add_new_valid_contact(app): """ Validation of add correct new contact with full data """ app.session.login(UserLogin.name, UserLogin.password) app.add_contract() app.add_fu...
werbk/task-2.3
tests_contract/test_contract.py
Python
apache-2.0
1,864
from fixture.orm import ORMFixture from model.group import Group db = ORMFixture(host="127.0.0.1", name="addressbook", user="root", password="") try: l = db.get_contacts_not_in_group_from_db(Group(id='213')) for item in l: print(item) print(len(l)) finally: pass # orm автоматически закрывает с...
Dob3r/python_training
check_orm_db_connection.py
Python
apache-2.0
417
# 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...
airbnb/superset
superset/views/datasource.py
Python
apache-2.0
4,629
# coding=utf-8 # Copyright 2022 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
google-research/google-research
stochastic_polyak/get_solver.py
Python
apache-2.0
3,787
# 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...
DavidPurcell/murano_temp
murano/common/config.py
Python
apache-2.0
13,696
from panda3d.core import NodePath, Vec4, TextNode, CardMaker, TransparencyAttrib from direct.interval.IntervalGlobal import LerpColorScaleInterval, Sequence, Func, Wait, Parallel from toontown.achievements import Achievements from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer ac...
linktlh/Toontown-journey
toontown/achievements/AchievementsGUI.py
Python
apache-2.0
4,538
# 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...
swiftstack/swift
swift/common/exceptions.py
Python
apache-2.0
5,786
# coding: utf-8 # # Copyright 2014 The Oppia Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
shaz13/oppia
extensions/interactions/SetInput/SetInput.py
Python
apache-2.0
1,817
import hashlib import re import logging from datetime import datetime from django.conf import settings # Avoid shadowing the login() view below. from django.views.decorators.csrf import csrf_protect from django.core.cache import cache from django.core.urlresolvers import reverse from django.contrib import messages from...
Chilledheart/seahub
seahub/auth/views.py
Python
apache-2.0
14,354
# -*- coding: utf-8 -*- __author__ = """Chris Tabor (dxdstudio@gmail.com)""" if __name__ == '__main__': from os import getcwd from os import sys sys.path.append(getcwd()) from random import choice from MOAL.helpers.text import gibberish from MOAL.helpers.display import Section from MOAL.data_structures.a...
christabor/MoAL
MOAL/data_structures/abstract/queues.py
Python
apache-2.0
3,389
# Copyright 2014 Netflix, 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...
lucab/security_monkey
security_monkey/views/item.py
Python
apache-2.0
10,797
import re import collections from enum import Enum from ydk._core._dm_meta_info import _MetaInfoClassMember, _MetaInfoClass, _MetaInfoEnum from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBitsDict from ydk._core._dm_meta_info import ATTRIBUTE, REFERENCE_CLASS, REFERENCE_LIST, REFERENCE_LEAFLI...
abhikeshav/ydk-py
cisco-ios-xr/ydk/models/cisco_ios_xr/_meta/_Cisco_IOS_XR_ip_ntp_cfg.py
Python
apache-2.0
48,727
import paho.mqtt.client as MQTT from enum import Enum from cow_mq.util import Util, DataType from datetime import datetime import time import copy import logging import json import threading class SendType(Enum): NONE = 0 SYNC = 1 ASYNC = 2 class ResponseStatus(Enum): NONE = 0 SUCCESS = 1 TI...
duncanHsu/CowMQ-Python
cow_mq/client.py
Python
apache-2.0
11,395
""" Just playing around with clustering. This file is "divisive hierarchical clustering". """ import pandas as pd import numpy as np import matplotlib.pyplot as plt print("Creating some data to work with...") np.random.seed(123) variables = ['X', 'Y', 'Z'] labels = ["ID_0", "ID_1", "ID_2", "ID_3", "ID_4"] X = np.ran...
MaxStrange/swedish_chef
learning/clustering/div_hi_clust.py
Python
apache-2.0
1,493
# -*- coding: ascii -*- r""" :Copyright: Copyright 2007 - 2015 Andr\xe9 Malo or his licensors, as applicable :License: 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....
ndparker/tdi
tdi/tools/htmlform/_main.py
Python
apache-2.0
34,348
import json from unittest import TestCase from flask import Flask from flask_controllers.GameServerController import GameServerController from flask_helpers.VersionHelpers import VersionHelpers from python_cowbull_server import app from python_cowbull_server.Configurator import Configurator from flask_helpers.ErrorHan...
dsandersAzure/python_cowbull_server
unittests/TestGameServerController.py
Python
apache-2.0
10,659
# 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...
vijayendrabvs/ssl-python-neutronclient
neutronclient/neutron/v2_0/port.py
Python
apache-2.0
9,156
""" 1. Napisz funkcje do obliczania mediany, sredniej, wariancji 2. Sparsuj dane z some_data.csv 3. Sprawdz jakie istnieja typy samochodow, jakie roczniki, jakie modele 4. Sprawdz dystrybucje w/w samochodow 5. Kto ma wiecej jakich samochodow? """
andrzejkrawczyk/python-course
part_1/zadania/data_processing/samochody.py
Python
apache-2.0
266
#!/usr/bin/env python # # VM Backup extension # # Copyright 2015 Microsoft Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
jasonzio/azure-linux-extensions
VMEncryption/main/oscrypto/ubuntu_1404/Ubuntu1404EncryptionStateMachine.py
Python
apache-2.0
7,320
# Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use th...
tonybaloney/st2
st2common/st2common/script_setup.py
Python
apache-2.0
3,066
#!/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...
Aloomaio/googleads-python-lib
examples/adwords/v201802/shopping/add_product_scope.py
Python
apache-2.0
3,218
#!/usr/bin/python # -*- coding: utf-8 -*- # a helper to return a relative filepath to path from start # Usage: python relpath.py path [start] from __future__ import print_function import os import sys argv = sys.argv path = argv[1] start = argv[2] if len(argv) >= 3 else os.curdir print(os.path.relpath(path, start)...
joinAero/XCalculator
sample/hellodjinni/tools/relpath.py
Python
apache-2.0
322
import importlib import os from typing import List import pandas as pd import pkg_resources import pytest import ibis import ibis.common.exceptions as com import ibis.util as util from .base import BackendTest def _random_identifier(suffix): return f'__ibis_test_{suffix}_{util.guid()}' def _get_all_backends(...
cloudera/ibis
ibis/backends/tests/conftest.py
Python
apache-2.0
9,642
# coding=utf-8 # Copyright 2022 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
google-research/google-research
enas_lm/src/tpu/utils.py
Python
apache-2.0
4,102
# Copyright 2013 Rackspace Hosting 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 re...
rackerlabs/quark
quark/plugin_modules/ports.py
Python
apache-2.0
26,372
from .error_info import TypescriptErrorInfo from .error_list import TypescriptProjectErrorList, TypescriptGoToError from .go_to_definition import TypescriptGoToDefinitionCommand from .go_to_type import TypescriptGoToTypeCommand from .nav_to import TypescriptNavToCommand from .quick_info import TypescriptQuickInfo, Typ...
zhengbli/TypeScript-Sublime-Plugin
typescript/commands/__init__.py
Python
apache-2.0
2,322
import re import collections from enum import Enum from ydk._core._dm_meta_info import _MetaInfoClassMember, _MetaInfoClass, _MetaInfoEnum from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBitsDict from ydk._core._dm_meta_info import ATTRIBUTE, REFERENCE_CLASS, REFERENCE_LIST, REFERENCE_LEAFLI...
abhikeshav/ydk-py
cisco-ios-xr/ydk/models/cisco_ios_xr/_meta/_Cisco_IOS_XR_policy_repository_oper.py
Python
apache-2.0
256,335
""" R.P.D. Ransom's Python Daemon """ import os import pathlib import subprocess import asyncio from subprocess import ( run, ) from typing import ( List, Any, ) from functools import ( partial, ) ##BEGIN aliases # modules aio=asyncio subps=subprocess # classes Ex = Exception Exc = Exception # defns ho...
ransomw/dotfiles
pyutils/rpd/__init__.py
Python
apache-2.0
4,432
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2019 EMBL - European Bioinformatics Institute # # 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...
EBI-Metagenomics/emgapi
tests/test_utils/emg_fixtures.py
Python
apache-2.0
19,046
import dataclasses import datetime import logging import re from dataclasses import dataclass, field from functools import partial from multiprocessing.dummy import Pool as ThreadPool from typing import Dict, List, Set import pkg_resources import yaml # pylint: disable=wrong-import-order import dateutil.parser # py...
aws-quickstart/taskcat
taskcat/_amiupdater.py
Python
apache-2.0
13,507
from __future__ import unicode_literals import json import base64 from moto.core.responses import BaseResponse from .models import acm_backends, AWSError, AWSValidationException class AWSCertificateManagerResponse(BaseResponse): @property def acm_backend(self): """ ACM Backend :retur...
william-richard/moto
moto/acm/responses.py
Python
apache-2.0
8,891
# 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, generators, nested_scopes, print_function, unicode_literals, with_statement) import os import sub...
jtrobec/pants
contrib/go/src/python/pants/contrib/go/subsystems/go_distribution.py
Python
apache-2.0
7,190
# Copyright 2019,2020,2021 Sony Corporation. # Copyright 2021 Sony Group Corporation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Un...
sony/nnabla
python/src/nnabla/backward_function/greater.py
Python
apache-2.0
995
import sys from typing import Any, Text, NoReturn import rasa.shared.utils.io def print_color(*args: Any, color: Text) -> None: output = rasa.shared.utils.io.wrap_with_color(*args, color=color) try: # colorama is used to fix a regression where colors can not be printed on # windows. https://g...
RasaHQ/rasa_nlu
rasa/shared/utils/cli.py
Python
apache-2.0
1,129
# Copyright 2019 The Johns Hopkins University Applied Physics Laboratory # # 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 ...
jhuapl-boss/boss-manage
lib/lambdas.py
Python
apache-2.0
19,677
import time from django.http import * import os, logging import sys from vt_manager_kvm.models import * from vt_manager_kvm.models.Action import Action as ActionModel from vt_manager_kvm.controller import * from vt_manager_kvm.controller.actions.ActionController import ActionController from vt_manager_kvm.controller.di...
ict-felix/stack
vt_manager_kvm/src/python/vt_manager_kvm/communication/northCommInterface.py
Python
apache-2.0
6,020
import json import time import boto3 ddb = boto3.client('dynamodb') class CacheController: def __init__(self, CacheTime): self.CacheTime = CacheTime self.last_update_time = 0.0 self.value = None def is_expired(self): return (time.time() > (self.last_update_time + self.Cach...
Riebart/slot-c
Lambda/GetChannels.py
Python
apache-2.0
1,588
# -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2016-06-07 14:57 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('smartshark', '0004_auto_20160603_1549'), ] operatio...
smartshark/serverSHARK
smartshark/migrations/0005_auto_20160607_1657.py
Python
apache-2.0
2,747
# Copyright (C) 2013 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 ...
virtualopensystems/nova
nova/virt/libvirt/designer.py
Python
apache-2.0
4,624
# Copyright (c) 2014 Baidu.com, 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 ...
baidubce/bce-sdk-python
test/dcc/test_dcc_client.py
Python
apache-2.0
1,903
######## # 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...
cloudify-cosmo/cloudify-cli
cloudify_cli/blueprint.py
Python
apache-2.0
6,696
from .default import * DEBUG = True ALLOWED_HOSTS = ['*'] SITE_ID = os.environ.get("SITE_ID", 1) SITE_HEADER = 'Example Header' PROJECT_DIR = os.path.abspath(os.path.join(BASE_DIR, '..')) LOGIN_URL = '/admin/login' # TEMPLATES[0].update({'DIRS': [os.path.join(BASE_DIR, 'templates'), ]}) # TEMPLATES[0]['OPTIONS']['co...
obitec/django-factbook
tests/config/settings.py
Python
apache-2.0
2,234
# Copyright (c) 2014 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...
eayunstack/neutron
neutron/cmd/sanity_check.py
Python
apache-2.0
16,099
from django.db import models class A(models.Model): col = models.CharField(max_length=10, null=False, default="empty")
3YOURMIND/django-migration-linter
tests/test_project/app_make_not_null_with_django_default/models.py
Python
apache-2.0
125
""" Django settings for pyladiesdc project. Generated by 'django-admin startproject' using Django 1.8. For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/settings/ """ # Build pat...
PyLadiesDC/job-translations
pyladiesdc/settings.py
Python
apache-2.0
2,731
"""Builds the Adience network. Summary of available functions: # Compute input images and labels for training. If you would like to run # evaluations, use input() instead. inputs, labels = distorted_inputs() # Compute inference on the model inputs to make a prediction. predictions = inference(inputs) # Comput...
NumesSanguis/MLTensor
adience/adience.py
Python
apache-2.0
18,728
# Author: Denys Makogon # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
aiorchestra/aiorchestra-openstack-plugin
openstack_plugin/common/clients.py
Python
apache-2.0
2,375
"""Provide Tournament style selection. This implements selection based on a tournament style. In this model of selection, two individuals are randomly chosen from the population, and the organism with the higher fitness is considered the 'winner' and moves to the next generation. """ # standard modules import random ...
dbmi-pitt/DIKB-Micropublication
scripts/mp-scripts/Bio/GA/Selection/Tournament.py
Python
apache-2.0
2,999
# # Copyright (c) 2013 Juniper Networks, Inc. All rights reserved. # # # This file is built up from an autogenerated template resource_server.py and # contains code/hooks at different point during processing a request, specific # to type of resource. For eg. allocation of mac/ip-addr for a port during its # creation. ...
cloudwatt/contrail-controller
src/config/api-server/vnc_cfg_types.py
Python
apache-2.0
49,718
import bz2 from collections import Counter from contextlib import contextmanager from datetime import datetime from functools import wraps import gzip import http.client import os import re from shutil import rmtree import string import tempfile import traceback from typing import Union, cast import warnings import zip...
kushalbhola/MyStuff
Practice/PythonApplication/env/Lib/site-packages/pandas/util/testing.py
Python
apache-2.0
92,720
"""Template helper methods for rendering strings with Home Assistant data.""" from datetime import datetime import json import logging import re import jinja2 from jinja2.sandbox import ImmutableSandboxedEnvironment from homeassistant.const import ( STATE_UNKNOWN, ATTR_LATITUDE, ATTR_LONGITUDE, MATCH_ALL) from ho...
JshWright/home-assistant
homeassistant/helpers/template.py
Python
apache-2.0
14,020
class JobResult(): def __init__(self, job, build_number, status): self.job = job self.build_number = int(build_number) self.status = status def __repr__(self): return "job: %s, build number: %s, status: %s" % (self.job, self.build_number, self.status)
alberto/hudson-notifier
src/job_result.py
Python
apache-2.0
263
#TLE class Solution: def maxProduct(self, nums): """ :type nums: List[int] :rtype: int """ if not nums: return 0 ret = - sys.maxsize for i in range(len(nums)): j = i + 1 temp = nums[i] ret = te...
MingfeiPan/leetcode
array/152.py
Python
apache-2.0
932
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals # Mock test input source import unicodecsv as csv class MockInputSource(): def __init__(self, in_file): self._mock_data = self._read_input(in_file) def fetch_gene_info(self, ac): pass ...
jmuhlich/hgvs
tests/framework/mock_input_source.py
Python
apache-2.0
2,910
#!/usr/bin/env python # -*- coding: utf-8 -*- from org.wikiup.database.orm import WikiupEntityManager from org.wikiup.modules.jython.orm import PythonEntity def getEntity(name, ctx=None, **selection): return PythonEntity(_getEntity(name, ctx, selection)) def query(name, relation, ctx=None, **selection): en...
smantinc/wikiup
modules/jython/src/wikiup/webroot/WEB-INF/python/lib/wk/orm.py
Python
apache-2.0
1,017
"""Just a subclass of service_manager.Manager for testing -- the methods don't do anything but print to a logfile. """ import engage.drivers.service_manager as service_manager import engage.utils.log_setup logger = engage.utils.log_setup.setup_script_logger("DummyService") from engage.utils.user_error import UserEr...
quaddra/engage
python_pkg/engage/drivers/genforma/dummy_service_manager.py
Python
apache-2.0
2,556
# Copyright (c) 2015-2016 Tigera, 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 applicabl...
caseydavenport/libcalico
calico_test/tests/st/utils/workload.py
Python
apache-2.0
5,408
# Copyright 2011 Justin Santa Barbara # # 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...
mikalstill/nova
nova/tests/unit/test_utils.py
Python
apache-2.0
57,298
#!/usr/bin/python # -*- coding: utf-8 -*- from collections import defaultdict import re, sys import traceback import cgi, cgitb import json from paths import ether_url from modules.gitdox_sql import * from modules.ether import get_socialcalc, make_spreadsheet, exec_via_temp, get_timestamps, parse_ether from modules.v...
cligu/gitdox
validate.py
Python
apache-2.0
12,616
# dynamic authenticator setup; see config4.json as well from autobahn.wamp.types import Deny def _authenticate(realm, authid, details): """ Authenticate something connecting to the backend. This should only be other proxy processes. We have access to all the "real" front-end credentials the proxy ne...
crossbario/crossbar-examples
proxy/dynauth.py
Python
apache-2.0
1,665
"""Philips Hue sensors platform tests.""" import asyncio from collections import deque import logging from unittest.mock import Mock import aiohue from aiohue.sensors import Sensors import pytest from homeassistant import config_entries from homeassistant.components import hue from homeassistant.components.hue import...
postlund/home-assistant
tests/components/hue/test_sensor_base.py
Python
apache-2.0
15,646
import os def pytest_configure(): from django.conf import settings BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) settings.configure( DEBUG_PROPAGATE_EXCEPTIONS=True, DATABASES={'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAM...
Seraf/lisa-plugins-test
tests/conftest.py
Python
apache-2.0
2,016
# -*- coding: utf-8 -*- import networkx as nx from ryu.base import app_manager from ryu.controller import ofp_event from ryu.controller.handler import MAIN_DISPATCHER, DEAD_DISPATCHER from ryu.controller.handler import set_ev_cls from ryu.ofproto import ofproto_v1_3 from ryu.topology.api import get_all_switch, get_al...
Zouyiran/ryu
ryu/app/reduce_t/network_monitor.py
Python
apache-2.0
7,749
""" Support for building models. Every model must inherit from `Model` and should inherit from the `EntityMixin`. """ from datetime import datetime from time import time from uuid import uuid4 from dateutil.tz import tzutc from pytz import utc from sqlalchemy import Column, Float, types from sqlalchemy.ext.declarati...
globality-corp/microcosm-postgres
microcosm_postgres/models.py
Python
apache-2.0
4,867
# -*- 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-dialogflow-cx
samples/generated_samples/dialogflow_v3_generated_session_entity_types_update_session_entity_type_sync.py
Python
apache-2.0
1,895
#!/usr/bin/env python """Helper functions used by client building/repacking process.""" from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals import io import logging import os import shutil import struct import tempfile from future.builtins import str from f...
dunkhong/grr
grr/client_builder/grr_response_client_builder/build_helpers.py
Python
apache-2.0
13,632
import sys,os import math import numpy as np def dcoptimize(dist): n = len(dist) m = 0 allds = [] for i in range(n): for j in range(i+1,n): allds.append(dist[i][j]) m += 1 allds.sort() maxd = allds[m-1] #calculate lower and upper boundaries for sigma counter = 0 while allds[counter]==...
idotu/SARNAclust
dpcluster.py
Python
apache-2.0
3,239
# Copyright 2016 James Hensman, Arno Solin # # 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...
jameshensman/VFF
experiments/airline/airline_svigp_rbf.py
Python
apache-2.0
4,344
import uuid import hashlib from infosystem.common.subsystem import manager from infosystem.common.subsystem import operation class Create(operation.Operation): def pre(self, **kwargs): # FIXME(samueldmq): this method needs to receive the parameters # explicitly. if kwargs.get('user'): ...
samueldmq/infosystem
infosystem/subsystem/token/manager.py
Python
apache-2.0
1,938
# -*- coding: utf-8 -*- # # tests/entidades/test_detalhamento.py # # Copyright 2019 Base4 Sistemas Ltda ME # # 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/licens...
base4sistemas/satcfe
tests/entidades/test_detalhamento.py
Python
apache-2.0
3,651
# Lint as: python3 # # Copyright 2020 The XLS 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...
google/xls
xls/fuzzer/run_fuzz_multiprocess.py
Python
apache-2.0
9,267
# Copyright 2015-2017 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 ...
smartbgp/libbgp
libbgp/net/family.py
Python
apache-2.0
2,325
#Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
facebook/IT-CPE
pantri/scripts/lib/__init__.py
Python
apache-2.0
71
#!/usr/bin/env python3 import subprocess import warnings import os import sys import utils def call_train_and_predict(settings_file, verbose=False): settings = utils.get_settings(settings_file) null = open(os.devnull, 'w') train_retcode = subprocess.call(['./train.py', '-s', settings_file], ...
Neuroglycerin/hail-seizure
python/train_and_predict.py
Python
apache-2.0
1,079
# coding=utf-8 # Copyright 2022 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
google-research/google-research
meta_reward_learning/semantic_parsing/nsm/tf_utils.py
Python
apache-2.0
21,465
# Copyright 2019 The TensorFlow Hub 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 ap...
tensorflow/hub
tensorflow_hub/tools/make_nearest_neighbour_index/similarity_finder.py
Python
apache-2.0
3,003
from django.conf.urls import patterns, include, url import os.path import tasks.views from django.conf import settings from django.contrib import admin admin.autodiscover() STATIC_PATH = os.path.abspath(os.path.join( os.path.dirname(os.path.abspath(__file__)), '../tasks/static')) if not os.path.exists(STATI...
openhatch/new-mini-tasks
minitasks/urls.py
Python
apache-2.0
1,307
from .polytri import *
eeucalyptus/eeDA
app/dependencies/polytri/__init__.py
Python
apache-2.0
22
from django.conf import settings from django.core.urlresolvers import reverse from django.http import HttpResponseRedirect from django.shortcuts import render_to_response from django.template import RequestContext from django.utils.translation import ugettext from django.contrib import messages from django.contrib.adm...
zhiwehu/IBookmark
webapp/apps/signup_codes/views.py
Python
apache-2.0
4,437
# detection anomalous clusters in the data set from ex import * from ex.geo.common import * from ex.ml import * import utils def ClusterFeature(cluster, features): '''fit a gaussian distribution for this cluster ''' X=features[:, cluster] return (X.mean(1), X.std(1, ddof=1)) if __name__ == '__main_...
excelly/xpy-ml
sdss/detection/detection_clusters.py
Python
apache-2.0
2,297
# This file is part of MLDB. Copyright 2016 mldb.ai inc. All rights reserved. from mldb import mldb, ResponseException import unittest class myTest(unittest.TestCase): def test_sequence(self): with self.assertRaisesRegex(ResponseException, "Executing builtin function exp: Can't convert value 'a' of typ...
mldbai/mldb
testing/MLDB-1336-builtin-checks.py
Python
apache-2.0
636
import torch import torch.nn as nn from torch.utils.data import DataLoader import importlib import os import json import logging import pickle import re from unittest import mock import pytest import numpy as np import pandas as pd import sklearn.datasets as datasets import yaml import mlflow.pyfunc as pyfunc import ...
mlflow/mlflow
tests/pytorch/test_pytorch_model_export.py
Python
apache-2.0
45,474
from setuptools import setup setup(name='servicemanager', version='0.0.30', description='A python tool to manage developing and testing with lots of microservices', url='https://github.com/hmrc/service-manager', author='vaughansharman', license='Apache Licence 2.0', packages=['serv...
andrewgee/service-manager
setup.py
Python
apache-2.0
619
#!/usr/bin/env python # Copyright 2013 Signal Analysis and Interpretation Laboratory, # University of Southern California # 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...
mrfalcone/skip
tool.py
Python
apache-2.0
6,222
"""The Panasonic Viera integration.""" import asyncio from functools import partial import logging from urllib.request import URLError from panasonic_viera import EncryptionRequired, Keys, RemoteControl, SOAPError import voluptuous as vol from homeassistant.components.media_player.const import DOMAIN as MEDIA_PLAYER_...
tchellomello/home-assistant
homeassistant/components/panasonic_viera/__init__.py
Python
apache-2.0
7,555
""" Test that the debugger can call a *really* new function. """ import os import lldb import lldbsuite.test.lldbplatformutil as lldbplatformutil import lldbsuite.test.lldbutil as lldbutil from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * def getOSName(os): if os == 'macosx': return 'm...
apple/swift-lldb
packages/Python/lldbsuite/test/lang/swift/availability/TestAvailability.py
Python
apache-2.0
4,201
# -*- coding:utf-8 -*- # # Copyright (C) 2012 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 re...
gabbayo/git-repo
subcmds/info.py
Python
apache-2.0
6,084
from django.contrib.sites.models import Site from settings import * def get_domain(port=8010): try: #domain = Site.objects.all()[0].domain domain = Site.objects.get(id=SITE_ID).domain if 'localhost' in domain: domain = 'localhost:%s' %port if DEFAULT_PROTOCOL: ...
Ecotrust/COMPASS
mp/utils.py
Python
apache-2.0
500
# 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-research/lag
lag.py
Python
apache-2.0
12,034
''' MAP Client Plugin ''' __version__ = '0.1.0' __author__ = 'Hugh Sorby' __stepname__ = 'Zinc Model Source' __location__ = 'https://github.com/mapclient-plugins/zincdatasourcestep' # import class that derives itself from the step mountpoint. from mapclientplugins.zincmodelsourcestep import resources_rc from mapclien...
mapclient-plugins/zincmodelsourcestep
mapclientplugins/zincmodelsourcestep/__init__.py
Python
apache-2.0
361
def sumInRange(nums, queries): dic = {} su = 0 for i, e in enumerate(nums): su += e dic["0_{}".format(i)] = su sum_r = 0 for i in queries: a, b = i if '{}_{}'.format(a,b) in dic: sum_r += dic['{}_{}'.format(a,b)] else: t = dic['0_{}'.f...
emirot/codefights
interviewPractice/sumInRange.py
Python
apache-2.0
472
import time from pprint import pformat import polling2 import pytest from domino import Domino from domino.helpers import domino_is_reachable from requests.exceptions import RequestException @pytest.fixture def mock_job_start_blocking_setup(requests_mock, dummy_hostname): """ Create mock replies to the chai...
dominodatalab/python-domino
tests/test_jobs.py
Python
apache-2.0
5,342
#!/usr/bin/env python import paramiko import time from getpass import getpass pynet_rtr2 = { 'device':'Cisco 881', 'ip_addr':'184.105.247.71', 'username':'pyclass', 'password':'', 'snmp_port':161, 'ssh_port':22, } def ssh_connect(): pynet_rtr2['password'] = getpass() remote_conn_pre...
gerards/pynet_network_automation_course
week4/q2_paramiko.py
Python
apache-2.0
1,497
# Copyright 2020 Google LLC. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
tensorflow/tfx
tfx/components/util/udf_utils.py
Python
apache-2.0
13,018
# -*- coding: utf-8 -*- import sys import os import urllib import webapp2 import json import logging import datetime import core_util from google.appengine.ext import ndb from google.appengine.ext import blobstore from google.appengine.ext.webapp import blobstore_handlers from google.appengine.api import images import...
copperoxide/littlecircle
gapp/photo_handler.py
Python
apache-2.0
13,084