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 2015 Hewlett-Packard Development Company, L.P.
#
# 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 ... | rahulunair/nova | nova/tests/functional/wsgi/test_secgroup.py | Python | apache-2.0 | 3,421 |
from enum import unique, auto
from partner.permissions import PartnerPermission
from common.enums import AutoNameEnum
@unique
class PartnerRole(AutoNameEnum):
"""
Editing names here WILL break roles saved in DB
"""
ADMIN = auto()
EDITOR = auto()
READER = auto()
@classmethod
def get_c... | unicef/un-partner-portal | backend/unpp_api/apps/partner/roles.py | Python | apache-2.0 | 6,282 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compli... | anotherjesse/nova | nova/auth/manager.py | Python | apache-2.0 | 28,865 |
# The Computer Language Benchmarks Game
# http://benchmarksgame.alioth.debian.org/
#
# contributed by Jacob Lee, Steven Bethard, et al
# 2to3, fixed by Daniele Varrazzo
# modified by Daniel Nanz
import sys
def show(seq, table=bytes.maketrans(b'ACBDGHKMNSRUTWVYacbdghkmnsrutwvy',
b'... | flowlo/gothon | test/revcomp.py | Python | apache-2.0 | 750 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Nebula, 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
#
# ... | ikargis/horizon_fod | openstack_dashboard/dashboards/admin/projects/tests.py | Python | apache-2.0 | 74,820 |
# Copyright (c) 2017, Lenovo. 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 ... | lenovo-network/networking-lenovo | networking_lenovo/db/migration/alembic_migrations/__init__.py | Python | apache-2.0 | 639 |
# coding=utf-8
# 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,... | bacaldwell/ironic | ironic/tests/unit/common/test_driver_factory.py | Python | apache-2.0 | 7,434 |
from django.conf.urls.defaults import *
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
(r'^login/', 'django.contrib.auth.views.login'),
(r'^admin/', include(admin.site.urls)),
)
| callowayproject/django-cookiesession | example/urls.py | Python | apache-2.0 | 222 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import time
import json
import uuid
import datetime
from boto3 import Session
from moto.core import BaseBackend, BaseModel
from .exceptions import (
SecretNotFoundException,
SecretHasNoValueException,
InvalidParameterException,
ResourceE... | william-richard/moto | moto/secretsmanager/models.py | Python | apache-2.0 | 20,426 |
# 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 use ... | secondstory/dewpoint | libcloud/types.py | Python | apache-2.0 | 2,842 |
# -*- coding: utf-8 -*-
# Copyright 2010-2011 OpenStack Foundation
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
#
# 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... | opstooling/python-cratonclient | cratonclient/tests/base.py | Python | apache-2.0 | 1,608 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... | vmturbo/nova | nova/tests/unit/test_service.py | Python | apache-2.0 | 14,578 |
# Copyright 2017 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 ... | dis-xcom/fuel-devops-driver-ironic | devops_driver_ironic/__init__.py | Python | apache-2.0 | 1,137 |
"""Support for MySensors sensors."""
from homeassistant.components import mysensors
from homeassistant.components.sensor import DOMAIN
from homeassistant.const import TEMP_CELSIUS, TEMP_FAHRENHEIT
SENSORS = {
'V_TEMP': [None, 'mdi:thermometer'],
'V_HUM': ['%', 'mdi:water-percent'],
'V_DIMMER': ['%', 'mdi:p... | HydrelioxGitHub/home-assistant | homeassistant/components/mysensors/sensor.py | Python | apache-2.0 | 2,939 |
# -*- 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-tasks | samples/generated_samples/cloudtasks_v2beta2_generated_cloud_tasks_cancel_lease_sync.py | Python | apache-2.0 | 1,442 |
# coding=utf-8
# Copyright 2022 The Tensor2Robot 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 ... | google-research/tensor2robot | utils/train_eval_test_utils.py | Python | apache-2.0 | 5,835 |
import six
from .log import log_input, log_output
def open(*args, **kwargs):
"""Built-in open replacement that logs input and output
Workaround for issue #44. Patching `__builtins__['open']` is complicated,
because many libraries use standard open internally, while we only want to
log inputs and out... | recipy/recipy | recipy/utils.py | Python | apache-2.0 | 1,587 |
import os
from pyramid.config import Configurator
from pyramid.session import UnencryptedCookieSessionFactoryConfig
import rdflib
from .lib import (
bookdb,
LABEL_PROPERTIES,
detect_types,
reverse_types,
find_resources,
reverse_resources,
)
from .lib.htmlresults import term_to_string
__vers... | gjhiggins/pyralod | pyralod/__init__.py | Python | apache-2.0 | 3,712 |
import urllib
import pandas as pd
import pandas.io.data as web
#from datetime import datetime
import matplotlib.pyplot as plt
import pickle as pk
from pandas.tseries.offsets import BDay
# pd.datetime is an alias for datetime.datetime
#today = pd.datetime.today()
import time
#time.sleep(5) # delays for 5 seconds
today ... | iamaris/pystock | scansingle.py | Python | apache-2.0 | 2,023 |
import testtools
from keystoneclient.middleware import memcache_crypt
class MemcacheCryptPositiveTests(testtools.TestCase):
def _setup_keys(self, strategy):
return memcache_crypt.derive_keys('token', 'secret', strategy)
def test_constant_time_compare(self):
# make sure it works as a compare,... | tylertian/Openstack | openstack F/python-keystoneclient/tests/test_memcache_crypt.py | Python | apache-2.0 | 3,163 |
import socket, re, sys
from codecs import encode, decode
from . import shared
def get_whois_raw(domain, server="", previous=None, rfc3490=True, never_cut=False, with_server_list=False, server_list=None):
previous = previous or []
server_list = server_list or []
# Sometimes IANA simply won't give us the right root W... | goocarlos/domaindiscoverer | pythonwhois/net.py | Python | apache-2.0 | 4,072 |
__author__ = 'saeedamen' # Saeed Amen
#
# Copyright 2016 Cuemacro
#
# 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... | kalaytan/findatapy | findatapy/market/datavendor.py | Python | apache-2.0 | 7,322 |
print ("suma de los digitos de un numero")
print ("de cuantos digitos quere trabajar")
a = int(raw_input("numero de dijitos"))
if a == 2 :
print("escribe el numero")
b = int(raw_input("numero="))
c = b/10
d = b%10
print (c + d )
if a == 3 :
print("escribe el numero")
b = int(raw_input("numer... | andres00157/Curso-de-javeriana | 4.py | Python | apache-2.0 | 1,335 |
__author__ = "Rick Sherman"
import unittest2 as unittest
from nose.plugins.attrib import attr
from jnpr.junos.device import Device
from jnpr.junos.decorators import timeoutDecorator
from mock import patch, PropertyMock, call
from ncclient.manager import Manager, make_device_handler
from ncclient.transport import SS... | JamesNickerson/py-junos-eznc | tests/unit/test_decorators.py | Python | apache-2.0 | 1,937 |
__author__ = 'Scalsol'
from PIL import Image
import numpy as np
import pytesseract
import os
rows = 100
cols = 210
dx = np.array([0, 0, -1, 1])
dy = np.array([-1, 1, 0, 0])
save_dir = "D:\\\Python\\Small_Contribution\\image"
def get_point(ncol):
global rows
for row in range(rows):
i... | Scalsol/XMU_bkxk_Captcha | captcha_recognition.py | Python | apache-2.0 | 4,092 |
from django.test import SimpleTestCase
from zentral.contrib.inventory.utils import clean_ip_address
class CleanIPAddressTestCase(SimpleTestCase):
def test_ipv4(self):
for value, result in ((None, None),
(123, None),
("127.0.0.1 ", "127.0.0.1"),
... | zentralopensource/zentral | tests/inventory/test_clean_ip_address.py | Python | apache-2.0 | 814 |
"""
Support for monitoring OctoPrint sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.octoprint/
"""
import logging
import requests
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.co... | persandstrom/home-assistant | homeassistant/components/sensor/octoprint.py | Python | apache-2.0 | 4,749 |
# Credit to original post from Amar Birgisson at
# http://tools.cherrypy.org/wiki/AuthenticationAndAccessRestrictions
# Form based authentication for CherryPy. Requires the
# Session tool to be loaded.
import cherrypy
import urllib
import DB
from jinja2 import Environment, FileSystemLoader
env = Environment(loader=F... | circlesabound/matchr | server/Auth.py | Python | apache-2.0 | 4,880 |
import fiona
meta = fiona.open(r'U:\egoldman\hs_2015_update\footprint.shp').meta
with fiona.open(r'U:\egoldman\hs_2015_update\merge.shp', 'w', **meta) as output:
for features in fiona.open(r'U:\egoldman\hs_2015_update\footprint.shp'):
output.write(features)
output.close() | elizabethgoldman/emerging_hotspots | test.py | Python | apache-2.0 | 277 |
#!/usr/bin/env python
# Copyright 2015 Dell 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 appl... | vedujoshi/tempest | tempest/cmd/cleanup_service.py | Python | apache-2.0 | 30,727 |
# Copyright 2017 Amazon.com, Inc. or its affiliates. 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. A copy of the License
# is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file acc... | mlperf/training_results_v0.6 | Fujitsu/benchmarks/resnet/implementations/mxnet/sockeye/sockeye/train.py | Python | apache-2.0 | 46,961 |
# -*- 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-resource-manager | google/cloud/resourcemanager_v3/services/tag_keys/pagers.py | Python | apache-2.0 | 5,731 |
# Copyright 2010 OpenStack Foundation
# Copyright 2012 University Of Minho
#
# 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.... | yosshy/nova | nova/tests/unit/virt/libvirt/test_driver.py | Python | apache-2.0 | 667,651 |
# --------------------------------------------------------------------------
# Copyright (c) 2020-2022 Arm Limited (or its affiliates). All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the License); you may
# not use this file except in compliance with t... | ARM-software/CMSIS_5 | CMSIS/DSP/cmsisdsp/sdf/nodes/host/message.py | Python | apache-2.0 | 3,886 |
# 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... | souravbadami/oppia | core/domain/visualization_registry.py | Python | apache-2.0 | 2,447 |
#!/usr/bin/env python
# Copyright 2014 Donald Stufft
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | dstufft/sessions | setup.py | Python | apache-2.0 | 2,121 |
from pysys.constants import *
from xpybuild.xpybuild_basetest import XpybuildBaseTest
class PySysTest(XpybuildBaseTest):
def execute(self):
self.xpybuild(args=['--depgraph', 'depgraph-output.dot'])
def validate(self):
self.assertDiff(file1='depgraph-output.dot', file2='ref-depgraph-output.dot')
| xpybuild/xpybuild | tests/correctness/framework/DepGraph/run.py | Python | apache-2.0 | 306 |
# 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 | xirl/xirl/evaluators/base.py | Python | apache-2.0 | 3,670 |
# Copyright 2013 Intel Corp.
#
# 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... | angdraug/nova | nova/tests/api/openstack/compute/plugins/v3/test_pci.py | Python | apache-2.0 | 10,171 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# Copyright 2017 University of Westminster. 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.ap... | mesgarpour/T-CARER | Stats/FeatureSelection.py | Python | apache-2.0 | 13,332 |
#Задача №10, Вариант 13
#Напишите программу "Генератор персонажей" для игры.
#Пользователю должно быть предоставлено 30 пунктов,
#которые можно распределить между четырьмя
#характеристиками: Сила, Здоровье, Мудрость и Ловкость.
#Надо сделать так, чтобы пользователь мог не только брать
#эти пункты из общего "... | fantasyy8/pythonintask | BITs/2014/KOSTAREV_A_I/task_10_13.py | Python | apache-2.0 | 3,987 |
import re
from bs4 import BeautifulSoup
from scripts.features.feature_extractor import FeatureExtractor
from scripts.data.cleaning import clean_code
def clean_html_tags(html_text):
soup = BeautifulSoup(html_text, 'html.parser')
if soup.find("h") is not None:
soup.find("h").extract()
cleaned_text... | chakki-works/elephant_sense | scripts/features/charactor_extractor.py | Python | apache-2.0 | 3,901 |
"""Platform for the iZone AC."""
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const import CONF_EXCLUDE, Platform
from homeassistant.core import HomeAssistant
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.typing import ConfigType
from .const im... | home-assistant/home-assistant | homeassistant/components/izone/__init__.py | Python | apache-2.0 | 1,621 |
#!/usr/bin/env python
import sys
import pymacaroons
if len(sys.argv) == 1:
sys.stderr.write("usage: %s macaroon [key]\n" % (sys.argv[0],))
sys.exit(1)
macaroon_string = sys.argv[1]
key = sys.argv[2] if len(sys.argv) > 2 else None
macaroon = pymacaroons.Macaroon.deserialize(macaroon_string)
print(macaroon.i... | matrix-org/synapse | scripts-dev/dump_macaroon.py | Python | apache-2.0 | 532 |
# Copyright 2006 James Tauber and contributors
# Copyright (C) 2009 Luke Kenneth Casson Leighton <lkcl@lkcl.net>
#
# 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/... | anandology/pyjamas | library/gwt/ui/VerticalPanel.py | Python | apache-2.0 | 1,733 |
import doctest
from insights.parsers import ls_var_cache_pulp
from insights.parsers.ls_var_cache_pulp import LsVarCachePulp
from insights.tests import context_wrap
LS_VAR_CACHE_PULP = """
total 0
drwxrwxr-x. 5 48 1000 216 Jan 21 12:56 .
drwxr-xr-x. 10 0 0 121 Jan 20 13:57 ..
lrwxrwxrwx. 1 0 0 19 Jan 21 12:... | RedHatInsights/insights-core | insights/parsers/tests/test_ls_var_cache_pulp.py | Python | apache-2.0 | 1,314 |
from ..remote import RemoteModel
class AccessProvisioningAlertsRulesGridRemote(RemoteModel):
"""
list of alerts
| ``id:`` The internal NetMRI identifier for this alert view.
| ``attribute type:`` number
| ``issue_meta_type_id:`` The name of the meta type of this alert. One of 'WhiteList', 'B... | infobloxopen/infoblox-netmri | infoblox_netmri/api/remote/models/access_provisioning_alerts_rules_grid_remote.py | Python | apache-2.0 | 1,565 |
"""Color util methods."""
from __future__ import annotations
import colorsys
import math
from typing import NamedTuple
import attr
# mypy: disallow-any-generics
class RGBColor(NamedTuple):
"""RGB hex values."""
r: int
g: int
b: int
# Official CSS3 colors from w3.org:
# https://www.w3.org/TR/2010... | home-assistant/home-assistant | homeassistant/util/color.py | Python | apache-2.0 | 23,863 |
from optics.driver.abstract_driver_setting import AbstractDriverSetting
class ShadowDriverSetting(AbstractDriverSetting):
def __init__(self):
from code_drivers.shadow.driver.shadow_driver import ShadowDriver
AbstractDriverSetting.__init__(self,
driver=Shadow... | radiasoft/optics | code_drivers/shadow/driver/shadow_driver_setting.py | Python | apache-2.0 | 330 |
#
# ovirt-engine-setup -- ovirt engine setup
# Copyright (C) 2013-2015 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
#
# Unl... | OpenUniversity/ovirt-engine | packaging/setup/plugins/ovirt-engine-common/base/core/misc.py | Python | apache-2.0 | 4,950 |
'''
IAM2 Vid Attribute Checker.
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.header.checker as checker_header
import zstackwoodpecker.operations.iam2_operations as iam2_ops
import zstackwoodpecker.operations.resource_operations as res_ops
import zstackwoodpecker.operations.vm_operations a... | zstackio/zstack-woodpecker | zstackwoodpecker/zstackwoodpecker/zstack_test/vid_checker/zstack_vid_checker.py | Python | apache-2.0 | 135,498 |
# 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/objax | objax/util/check.py | Python | apache-2.0 | 2,313 |
from google.appengine.ext import ndb
class User(ndb.Model):
name = ndb.StringProperty() | lamkeewei/battleships | server/models/User.py | Python | apache-2.0 | 90 |
from datetime import datetime
from google.appengine.ext import db
from django.utils import simplejson as json
from couch import errors
from couch.models.util import gen_uuid
class DocumentRoot(db.Model):
''' Controls document '''
revno = db.IntegerProperty(default = 0)
revsuffix = db.StringProperty()
d... | yssk22/gaecouch | couch/models/document.py | Python | apache-2.0 | 708 |
#
# Copyright (c) SAS Institute Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | fedora-conary/conary | conary/build/defaultrecipes.py | Python | apache-2.0 | 27,584 |
# -*- 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-datacatalog | samples/generated_samples/datacatalog_v1_generated_data_catalog_modify_entry_overview_sync.py | Python | apache-2.0 | 1,496 |
# 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/ops/clip_ops.py | Python | apache-2.0 | 15,309 |
import pytest
import json
import os.path
import importlib
import jsonpickle
from fixture.application import Application
from fixture.db import DBfixture
from fixture.orm import ORMfixture
fixture = None
target = None
def load_config(file):
global target
if target is None:
config_file = os.path.join(o... | OlgaKuratkina/python_training_qa | conftest.py | Python | apache-2.0 | 2,798 |
# -*- coding: utf-8 -*-
# Copyright (c)2013 Rackspace US, 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/LIC... | rackerlabs/heat-pyrax | pyrax/cloudcdn.py | Python | apache-2.0 | 7,833 |
__author__ = 'Poseidon'
# Import the AW SDK Information
from ctypes import *
aw = CDLL("aw")
AWEVENT = CFUNCTYPE(None)
AWCALLBACK = CFUNCTYPE(None)
import sqlite3
import genericMessaging
db = sqlite3.connect('awrpg.db')
cursor = db.cursor()
from random import randint
session_dict = {}
def player_check(player_s... | PoseidonAW/Py_RPG | playerdata.py | Python | apache-2.0 | 4,639 |
#!/usr/bin/env python
"""
A credential management component for AutoPyFactory
"""
import logging
import math
import os
import pwd, grp
import sys
import threading
import time
import socket
# Added to support running module as script from arbitrary location.
from os.path import dirname, realpath, sep, pardir
fu... | PanDAWMS/autopyfactory | autopyfactory/authmanager.py | Python | apache-2.0 | 8,906 |
# -*- coding: utf-8 -*-
import psycopg2
import sqlalchemy
from sqlalchemy import Column, Float, Integer, String, Boolean, DateTime, and_
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import ForeignKey
from sqlalchemy.orm import relationship
from sqlalchemy.orm import sessionmaker
from sqlalche... | verejnedigital/verejne.digital | obstaravania/data_model.py | Python | apache-2.0 | 4,625 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for the analysis mediator."""
from __future__ import unicode_literals
import unittest
from dfvfs.lib import definitions as dfvfs_definitions
from dfvfs.path import factory as path_spec_factory
from plaso.analysis import mediator
from plaso.containers import se... | rgayon/plaso | tests/analysis/mediator.py | Python | apache-2.0 | 1,743 |
import parsl
import time
from parsl.app.app import python_app
@python_app
def slow_double(x):
import time
time.sleep(0.1)
return x * 2
def test_garbage_collect():
""" Launches an app with a dependency and waits till it's done and asserts that
the internal refs were wiped
"""
x = slow_do... | Parsl/parsl | parsl/tests/test_python_apps/test_garbage_collect.py | Python | apache-2.0 | 1,044 |
__author__ = 'shuai'
class Solution:
# @param {integer[]} nums
# @return {string}
def largestNumber(self, nums):
ret = ""
for i in range(len(nums)):
for j in range(i + 1, len(nums)):
str_i = str(nums[i])
str_j = str(nums[j])
if st... | shuaizi/leetcode | leetcode-python/num179.py | Python | apache-2.0 | 685 |
#!/usr/bin/env python3
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | google/google-ctf | 2021/quals/pwn-tridroid/attachments/server.py | Python | apache-2.0 | 4,265 |
#!/usr/bin/env python3
# Copyright 2019 IBM Corp.
#
# 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... | open-power-ref-design-toolkit/cluster-genesis | scripts/python/inv_add_switches.py | Python | apache-2.0 | 1,219 |
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt
"""XML reporting for coverage.py"""
import os
import sys
import time
import xml.dom.minidom
from coverage import __url__, __version__, files
from coverage.report ... | larsbutler/coveragepy | coverage/xmlreport.py | Python | apache-2.0 | 7,340 |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | tensorflow/estimator | tensorflow_estimator/python/estimator/tpu/error_handling.py | Python | apache-2.0 | 5,327 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | KirtoXX/Security_Camera | ssd_mobilenet/object_detection/trainer.py | Python | apache-2.0 | 12,596 |
import pytest
import utils
from scrapi.linter.document import NormalizedDocument, RawDocument
from scrapi.processing.elasticsearch import es, ElasticsearchProcessor
test_db = ElasticsearchProcessor()
RAW = RawDocument(utils.RAW_DOC)
NORMALIZED = NormalizedDocument(utils.RECORD)
@pytest.mark.elasticsearch
def test_... | icereval/scrapi | tests/test_elasticsearch_processor.py | Python | apache-2.0 | 1,164 |
# coding=utf-8
# Copyright 2020 The TF-Agents Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | tensorflow/agents | tf_agents/replay_buffers/py_replay_buffers_test.py | Python | apache-2.0 | 12,535 |
"""`main` is the top level module for your Flask application."""
# Import the Flask Framework
import os
import json
from flask import Flask, request, send_from_directory, render_template
app = Flask(__name__, static_url_path='')
# Note: We don't need to call run() since our application is embedded within
# the App E... | i5on9i/echoserver | main.py | Python | apache-2.0 | 1,161 |
"""
Copyright (c) 2015 Michael Bright and Bamboo HR 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... | BambooHR/rapid | rapid/master/data/migrations/versions/ce9be6e8354c_test_history_date_created.py | Python | apache-2.0 | 1,560 |
import webapp2
from jinja2 import Environment, FileSystemLoader
from os.path import dirname, join
import os
import json
import base64
import hashlib
import StringIO
from google.appengine.api import users
import numpy as np
if not os.environ.get('SERVER_SOFTWARE','').startswith('Development'):
import PIL
import... | EvanBianco/pickr | main.py | Python | apache-2.0 | 13,664 |
import stats_buffer
import util_cli as util
class BucketSummary:
def run(self, accessor):
return stats_buffer.bucket_info
class DGMRatio:
def run(self, accessor):
result = []
hdd_total = 0
ram_total = 0
for node, nodeinfo in stats_buffer.nodes.iteritems():
... | bcui6611/healthchecker | cluster_stats.py | Python | apache-2.0 | 19,273 |
# Copyright 2018 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, s... | quartzmo/gcloud-ruby | google-cloud-bigquery-data_transfer/synth.py | Python | apache-2.0 | 3,453 |
#!/usr/bin/env python
# Copyright (C) 2014 Yahoo! 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... | mc2014/anvil | setup.py | Python | apache-2.0 | 2,199 |
# 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, ... | google/neural-light-transport | data_gen/util.py | Python | apache-2.0 | 2,045 |
# 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... | google/citest | tests/json_predicate/map_predicate_test.py | Python | apache-2.0 | 7,327 |
# Copyright 2017 Rice University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | capergroup/bayou | src/main/python/bayou/experiments/low_level_sketches/utils.py | Python | apache-2.0 | 2,543 |
# Copyright (c) 2014 Ahmed H. Ismail
# 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... | spdx/tools-python | spdx/parsers/__init__.py | Python | apache-2.0 | 577 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | jiahaoliang/group-based-policy | gbpservice/neutron/services/servicechain/plugins/ncp/config.py | Python | apache-2.0 | 1,338 |
# -*- coding: utf8 -*-
from injector import singleton, inject
try:
import configparser
except ImportError:
import configparser as configparser
from sht1x.Sht1x import Sht1x as SHT1x
@singleton
class Sensor:
name = "SHT1x"
@inject
def __init__(self, config_parser: configparser.ConfigParser):
... | wuan/klimalogger | klimalogger/sensor/sht1x_sensor.py | Python | apache-2.0 | 1,458 |
from .cluster_pb2 import FLNodeDef, FLClusterDef
from .cluster_spec import FLClusterSpec
| bytedance/fedlearner | fedlearner/fedavg/cluster/__init__.py | Python | apache-2.0 | 90 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# coding=utf-8
# Copyright 2012 Hewlett-Packard Development Company, L.P.
# Copyright (c) 2012 NTT DOCOMO, 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.... | fajoy/nova | nova/virt/baremetal/ipmi.py | Python | apache-2.0 | 8,800 |
# coding: utf-8
# # TensorFlow基础
# In this tutorial, we are going to learn some basics in TensorFlow.
# ## Session
# Session is a class for running TensorFlow operations. A Session object encapsulates the environment in which Operation objects are executed, and Tensor objects are evaluated. In this tutorial, we will... | jastarex/DeepLearningCourseCodes | 01_TF_basics_and_linear_regression/tensorflow_basic.py | Python | apache-2.0 | 8,932 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from undebt.pattern.lang.python import UNARY_OP_ATOM
from undebt.pattern.util import tokens_as_list
from undebt.pyparsing import Literal
grammar = UNARY_OP_ATOM + Literal("<>").suppres... | Yelp/undebt | undebt/examples/deprecated_inequality_operator.py | Python | apache-2.0 | 470 |
# coding=utf8
from __future__ import print_function
import os
import argparse
import numpy as np
import math
import random
from sys import stderr, stdout
import six
import plumbum.cmd as cmd
import pprint
from os.path import splitext, join
import codecs
from patterns import re_escape, re_amp, re_quote_escape
from pand... | alexanderpanchenko/vec2synset | jnt/common.py | Python | apache-2.0 | 9,157 |
"""
:codeauthor: Jayesh Kariya <jayeshk@saltstack.com>
"""
import pytest
import salt.modules.cmdmod
import salt.modules.rpm_lowpkg as rpm
import salt.utils.path
from tests.support.mock import MagicMock, patch
# pylint: disable=unused-import
try:
import rpm as rpm_lib
HAS_RPM = True
except ImportError:
... | saltstack/salt | tests/pytests/unit/modules/test_rpm_lowpkg.py | Python | apache-2.0 | 11,207 |
# 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... | aldian/tensorflow | tensorflow/python/keras/applications/xception.py | Python | apache-2.0 | 13,084 |
# 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... | bhaisaab/ipmisim | setup.py | Python | apache-2.0 | 2,011 |
""" Django settings """
from django.core.urlresolvers import reverse_lazy
DEBUG = True
TEMPLATE_DEBUG = DEBUG
SESSION_COOKIE_SECURE = False
CSRF_COOKIE_SECURE = False
TEMPLATE_STRING_IF_INVALID = '**** INVALID EXPRESSION: %s ****'
ADMINS = (
('admin', 'code@pkimber.net'),
)
MANAGERS = ADMINS
# Local time zone... | pkimber/old_moderate | example/base.py | Python | apache-2.0 | 5,826 |
# Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
from django.db import models
from django.core.exceptions import ValidationError
import json
class GradingStandardManager(models.Manager):
def find_by_login(self, login_id, id=None, name=None):
kwargs = {'created_by': l... | uw-it-aca/grading-standard-lti | grading_standard/models.py | Python | apache-2.0 | 3,569 |
# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand
from apps.user.models import UserProfile
# Thanks to @ajrobbins for generating this
DRB_ZIPS = ['07416', '07438', '07461', '07820', '07821', '07822', '07823',
'07825', '07826', '07827', '07828', '07832', '07833', '07836',
... | WikiWatershed/model-my-watershed | src/mmw/apps/user/management/commands/drbusers.py | Python | apache-2.0 | 9,850 |
# Copyright 2016 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 or agreed to in writing, ... | daspecster/google-cloud-python | scripts/verify_included_modules.py | Python | apache-2.0 | 6,329 |
import json
import jsonschema
import os
import re
import six
from jsonschema import FormatChecker, Draft4Validator
from mdstudio.api.exception import RegisterException
from mdstudio.api.singleton import Singleton
from mdstudio.deferred.chainable import chainable
from mdstudio.deferred.return_value import return_value... | MD-Studio/MDStudio | mdstudio/mdstudio/api/schema.py | Python | apache-2.0 | 9,728 |
# 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 req... | wolverineav/networking-bigswitch | networking_bigswitch/plugins/bigswitch/db/migration/alembic_migrations/versions/kilo_add_base_bsn_plugin.py | Python | apache-2.0 | 5,765 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
################################################################################
#
# Copyright (c) 2015 Baidu.com, Inc. All Rights Reserved
#
################################################################################
"""
Authors: zhousongsong(doublesongsong@gmail.c... | baidu/broc | client/TaskWorker.py | Python | apache-2.0 | 2,998 |
import docker
import subprocess
import json
from aslist import aslist
import logging
import os
from process import WorkflowException
import process
import yaml
import avro_ld.validate as validate
import avro_ld.ref_resolver
_logger = logging.getLogger("cwltool")
def exeval(ex, jobinput, requirements, outdir, tmpdir, ... | foreveremain/common-workflow-language | reference/cwltool/expression.py | Python | apache-2.0 | 2,977 |