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 2013 Openstack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | insequent/quark | quark/plugin.py | Python | apache-2.0 | 15,924 |
# Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
# 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... | Francis-Liu/animated-broccoli | nova/db/sqlalchemy/api.py | Python | apache-2.0 | 240,590 |
import os
import re
import yaml
try:
from packaging.version import parse as parse_version
except ImportError:
from pkg_resources import parse_version
from toolbox.config.common import BUTTON_CONFIG_KEYS, CRP_TYPES, CURRENT_MAX_VERSION, CURRENT_MIN_VERSION, PROTOCOLS
from .utils import counted_error, fatal_e... | avatao-content/challenge-toolbox | toolbox/utils/config.py | Python | apache-2.0 | 4,202 |
__author__ = 'mpetyx'
from django.db import models
from OPENiapp.APIS.Context.models import OpeniContextAwareModel
class OpeniCard(OpeniContextAwareModel):
# id is missing because it is the default
url = models.TextField()
object_type = models.TextField()
service = models.TextField()
From = mod... | OPENi-ict/ntua_demo | openiPrototype/openiPrototype/APIS/Products_and_Services/Card/models.py | Python | apache-2.0 | 585 |
#!/usr/bin/env python
# Copyright 2015-2017 ARM Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | arm-hpc/allinea_json_analysis | PR_JSON_Scripts/plot_pr_bar.py | Python | apache-2.0 | 5,284 |
# Copyright 2013 OpenStack Foundation
# Copyright 2013 IBM 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 app... | UTSA-ICS/keystone-kerberos | keystone/tests/unit/test_ldap_tls_livetest.py | Python | apache-2.0 | 4,402 |
""" in this file, we describe the data type of fp-tree nodes and present
an algorithm to build a fp-tree from existing datasets """
import fpgrowth
import Queue
def supfilter(dataset, minsup):
"""
supfilter : scan the items and drop the infrequent elements
:param dataset: dataset could be in two available ... | liyi-david/dblpmining | lib/fptree.py | Python | apache-2.0 | 3,263 |
# 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... | dhuang/incubator-airflow | airflow/providers/amazon/aws/operators/datasync.py | Python | apache-2.0 | 18,667 |
"""Numeric integration of data coming from a source sensor over time."""
from decimal import Decimal, DecimalException
import logging
import voluptuous as vol
from homeassistant.components.sensor import (
DEVICE_CLASS_ENERGY,
DEVICE_CLASS_POWER,
PLATFORM_SCHEMA,
STATE_CLASS_TOTAL,
SensorEntity,
)
... | jawilson/home-assistant | homeassistant/components/integration/sensor.py | Python | apache-2.0 | 7,671 |
"""Pytorch Densenet implementation w/ tweaks
This file is a copy of https://github.com/pytorch/vision 'densenet.py' (BSD-3-Clause) with
fixed kwargs passthrough and addition of dynamic global avg/max pool.
"""
import re
from collections import OrderedDict
from functools import partial
import torch
import torch.nn as n... | rwightman/pytorch-image-models | timm/models/densenet.py | Python | apache-2.0 | 15,611 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
from input_functions import get_input_fn
import tensorflow as tf
from tensorflow.contrib.keras.python.keras.datasets import imdb
from tensorflow.contrib.learn.python.learn import learn_runner
f... | mari-linhares/tensorflow-workshop | code_samples/RNN/sentiment_analysis/samples/canned_sentiment_analysis.py | Python | apache-2.0 | 4,929 |
"""
file: processing.py
author: Bryce Mecum (mecum@nceas.ucsb.edu)
Processes the scientific metadata documents in ./documents for person
and organization information. For each document, the script tries to find
the person in an existing list. Matches are currently made off of all
information av... | ec-geolink/d1lod | d1lod/d1lod/people/processing.py | Python | apache-2.0 | 3,993 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | markflyhigh/incubator-beam | sdks/python/apache_beam/options/pipeline_options_validator_test.py | Python | apache-2.0 | 12,764 |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2018.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modif... | QISKit/qiskit-sdk-py | docs/conf.py | Python | apache-2.0 | 4,087 |
###########################################################################
#
# 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/task/cm_to_dv/cm_placement_group.py | Python | apache-2.0 | 2,931 |
from org.myrobotlab.net import BareBonesBrowserLaunch
def outsideLights(value):
if value = 1
BareBonesBrowserLaunch.openURL("http://ip_address:3480/data_request?id=action&output_format=xml&DeviceNum=6&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=01")
else
BareBonesBrowser... | MyRobotLab/pyrobotlab | home/brotherbrown831/old_py/HomeAutomation.py | Python | apache-2.0 | 1,156 |
from freight.models import App, Repository
from .base import Serializer
from .manager import add
@add(App)
class AppSerializer(Serializer):
def serialize(self, item, attrs):
env_map = {}
for env, env_data in list(item.environments.items()):
env_map[env] = {"defaultRef": env_data.get("... | getsentry/freight | freight/api/serializer/app.py | Python | apache-2.0 | 785 |
#!/usr/bin/env python
# ----------------------------------------------------------------
# Copyright 2016 Cisco Systems
#
# 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.apac... | abhikeshav/ydk-py | core/samples/bgp_netconf.py | Python | apache-2.0 | 4,063 |
from setuptools import setup
import os
import codecs
here = os.path.abspath(os.path.dirname(__file__))
def read(*parts):
# intentionally *not* adding an encoding option to open
return codecs.open(os.path.join(here, *parts), 'r').read()
setup(
name='cloudify-agent-packager',
version='3.5.2',
url... | codilime/cloudify-agent-packager | setup.py | Python | apache-2.0 | 930 |
"""Import Module Plotly To Ploting Graph"""
import plotly.plotly as py
import plotly.graph_objs as go
"""Open and Read CSV from database"""
data = open('Real_Final_database_02.csv')
alldata = data.readlines()
listdata = []
for i in alldata:
listdata.append(i.strip().split(','))
type_z = ['Flood', 'Epidemic', 'Drou... | pdeesawat/PSIT58_test_01 | Code_Affect_Damage_Death_countries/Myanmar_total_death.py | Python | apache-2.0 | 1,846 |
# 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, ... | google/vulncode-db | data/forms/__init__.py | Python | apache-2.0 | 4,727 |
"""
Sysconfig - files in ``/etc/sysconfig/``
========================================
This is a collection of parsers that all deal with the system's configuration
files under the ``/etc/sysconfig/`` folder. Parsers included in this module
are:
ChronydSysconfig - file ``/etc/sysconfig/chronyd``
---------------------... | wcmitchell/insights-core | insights/parsers/sysconfig.py | Python | apache-2.0 | 7,321 |
# Copyright 2018 Flight Lab authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | google/flight-lab | controller/utils/display.py | Python | apache-2.0 | 3,167 |
# 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... | anggorodewanto/oppia | scripts/pre_commit_linter.py | Python | apache-2.0 | 16,047 |
from locust import HttpLocust, TaskSet, task
class WebsiteTasks(TaskSet):
@task
def page1(self):
self.client.get("/sugestoes-para/6a-feira-da-quarta-semana-da-pascoa/")
@task
def page2(self):
self.client.get("/sugestoes-para/5a-feira-da-quarta-semana-da-pascoa/")
@task
def pa... | gustavofoa/pympm | scripts/locustfile.py | Python | apache-2.0 | 988 |
# coding: utf-8
"""
Fitmarket
Mali broj ljudi - donori - dijele dnevna mjerenja svoje težine. Iz dnevne težine jednog donora određujemo vrijednosti dviju dionica: - dionica X ima vrijednost koja odgovara težini donora na taj dan. - inverzna dionica ~X ima vrijednost (150 kg - X). Primjetimo da: - kako X r... | brahle/fitmarket-python-api | test/test_status_api.py | Python | apache-2.0 | 2,605 |
import json
import django
import urllib3
if __name__ == '__main__':
django.setup()
from infrastructure.models import Server, CustomField
from resourcehandlers.aws.models import AWSHandler
from common.methods import set_progress
from django.core.serializers.json import DjangoJSONEncoder
def fetch_arns_for_findi... | CloudBoltSoftware/cloudbolt-forge | ui_extensions/aws_network_policy/actions/fetch_update_findings.py | Python | apache-2.0 | 4,209 |
# -*- coding: utf-8 -*-
# Copyright 2017 ProjectV 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... | jhbez/ProjectV | app/v/buy/rest/pendingRst.py | Python | apache-2.0 | 5,665 |
import os
import time
import yaml
import random
import argparse
from rackattack.physical import pikapatch
from rackattack.physical.tests.integration.main import useFakeRackConf, useFakeIPMITool
intervalRanges = {0: (0.01, 0.05), 0.85: (0.3, 0.6), 0.95: (2, 4)}
rangesProbabilities = intervalRanges.keys()
rangesProbabi... | eliran-stratoscale/rackattack-physical | rackattack/physical/tests/integration/fakeipmitool.py | Python | apache-2.0 | 2,252 |
import datetime
class FakeHeatTemplateManager(object):
def __init__(self):
self.templates = {
1: 'Dummy description #1.',
3: 'Dummy description #3.',
4: 'Dummy description #4.',
6: 'Dummy description #6.'}
def get_description(self, template_id):
... | Ingesup-Lab-OS/OS-Lend-Frontend | lend_frontend/tests/api_mock.py | Python | apache-2.0 | 2,035 |
# Copyright 2014 Cloudera 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, so... | wesm/ibis | ibis/sql/sqlite/compiler.py | Python | apache-2.0 | 5,142 |
from google.appengine.ext import ndb
class Tirage(ndb.Model):
nomtirage = ndb.StringProperty()
datecreation = ndb.DateTimeProperty(auto_now_add=True)
| crancerkill/pokeploud | server/TirageModele.py | Python | apache-2.0 | 159 |
import sys
import unittest
from string import ascii_letters
from random import randint, choice
import logging
from influxgraph.templates import parse_influxdb_graphite_templates
from influxgraph.utils import parse_series as parse_py_series
try:
from influxgraph.ext.nodetrie import Node
from influxgraph.ext.tem... | InfluxGraph/influxgraph | tests/test_c_node_tree.py | Python | apache-2.0 | 7,573 |
# -*- coding: utf-8 -*-
from openprocurement.auctions.core.utils import (
apply_patch,
context_unpack,
get_now,
json_view,
opresource,
save_auction,
)
from openprocurement.auctions.core.validation import (
validate_lot_data,
validate_patch_lot_data,
)
from openprocurement.auctions.core.v... | openprocurement/openprocurement.auctions.dgf | openprocurement/auctions/dgf/views/other/lot.py | Python | apache-2.0 | 3,339 |
import sys
from cool_commits import info, find
if __name__ == '__main__':
command = sys.argv[1]
if command == 'find':
print(*find(sys.argv[2]))
elif command == 'info':
for info_text in info(sys.argv[2]):
print('='*60)
print(info_text)
print('='*60)
else:... | OrDuan/cool_commits | cool_commits/__main__.py | Python | apache-2.0 | 399 |
extensions = dict(
required_params=[], # empty to override defaults in gen_defaults
validate_required_params="""
# Required args: either model_key or path
if (is.null(model_key) && is.null(path)) stop("argument 'model_key' or 'path' must be provided")
""",
set_required_params="",
)
doc = dict(
preamb... | h2oai/h2o-3 | h2o-bindings/bin/custom/R/gen_generic.py | Python | apache-2.0 | 701 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010-2012 OpenStack LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | citrix-openstack-build/python-keystoneclient | keystoneclient/middleware/auth_token.py | Python | apache-2.0 | 50,380 |
"""ThreatConnect TI Email"""
# standard library
from typing import TYPE_CHECKING
# first-party
from tcex.api.tc.v2.threat_intelligence.mappings.group.group import Group
if TYPE_CHECKING:
# first-party
from tcex.api.tc.v2.threat_intelligence.threat_intelligence import ThreatIntelligence
class Tactic(Group):
... | ThreatConnect-Inc/tcex | tcex/api/tc/v2/threat_intelligence/mappings/group/group_types/tactic.py | Python | apache-2.0 | 841 |
import os
PUPPETDB_HOST = 'localhost'
PUPPETDB_PORT = 8080
PUPPETDB_SSL_VERIFY = True
PUPPETDB_KEY = None
PUPPETDB_CERT = None
PUPPETDB_TIMEOUT = 20
SECRET_KEY = os.urandom(24)
DEV_LISTEN_HOST = '127.0.0.1'
DEV_LISTEN_PORT = 5000
DEV_COFFEE_LOCATION = 'coffee'
UNRESPONSIVE_HOURS = 2
ENABLE_QUERY = True
LOCALISE_TIMEST... | bewiwi/puppetboard | puppetboard/default_settings.py | Python | apache-2.0 | 1,121 |
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | polyaxon/polyaxon | platform/polycommon/tests/test_options/test_feature.py | Python | apache-2.0 | 1,739 |
# Copyright (c) 2016 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
#
# Un... | denismakogon/aria-cli | aria_cli/config/parser_config.py | Python | apache-2.0 | 7,852 |
"""
decorstate
~~~~~~~~~~
Simple "state machines" with Python decorators.
:copyright: (c) 2015-2017 Andrew Hawker
:license: Apache 2.0, see LICENSE for more details.
"""
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(
name='decorstate',
... | ahawker/decorstate | setup.py | Python | apache-2.0 | 1,177 |
# Copyright 2011 Midokura KK
#
# 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, ... | rlenglet/openfaucet | src/openfaucet/test_ofstats.py | Python | apache-2.0 | 12,672 |
"""Support for Streamlabs Water Monitor Usage."""
from datetime import timedelta
from homeassistant.components.streamlabswater import DOMAIN as STREAMLABSWATER_DOMAIN
from homeassistant.const import VOLUME_GALLONS
from homeassistant.helpers.entity import Entity
from homeassistant.util import Throttle
DEPENDENCIES = ... | fbradyirl/home-assistant | homeassistant/components/streamlabswater/sensor.py | Python | apache-2.0 | 3,962 |
# -*- coding: utf-8 -*-
"""File containing a Windows Registry plugin to parse the AMCache.hve file."""
from __future__ import unicode_literals
import pyregf
from dfdatetime import filetime
from dfdatetime import posix_time
from dfwinreg import definitions as dfwinreg_definitions
from plaso.containers import events
f... | rgayon/plaso | plaso/parsers/amcache.py | Python | apache-2.0 | 11,498 |
# Copyright 2012 Rackspace
#
# 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... | racker/python-service-registry-cli | service_registry_cli/commands/configuration/list.py | Python | apache-2.0 | 2,023 |
# Copyright 2019 Apex.AI, 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... | ros2/launch | launch_testing/launch_testing/loader.py | Python | apache-2.0 | 12,234 |
# Domato - main generator script
# --------------------------------------
#
# Written and maintained by Ivan Fratric <ifratric@google.com>
#
# Copyright 2017 Google Inc. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance wi... | googleprojectzero/domato | generator.py | Python | apache-2.0 | 7,760 |
import random
import glob
from os import path
import biohex
import math
import traceback
# storage class for constants
class locals():
class distanceLookup():
RING_CACHE = 0
BIT_LISTER = 1
try:
# load up bit graphic asset names
bitList = []
for file in glob.glob("biohex/bitGraphics/... | omegachysis/biohex | biohex/life.py | Python | apache-2.0 | 28,573 |
from unittest.mock import patch
from unittest.mock import MagicMock
from django.test import override_settings
from django.test import TestCase
from django.conf import settings
from orchestra.google_apps.convenience import _get_image_mimetype
from orchestra.google_apps.convenience import create_document_from_template
... | Sonblind/orchestra | orchestra/tests/google_apps/test_convenience.py | Python | apache-2.0 | 5,072 |
"""
Linux kernel system control from Python.
"""
| kdart/pycopia | core/pycopia/OS/Linux/sysctl.py | Python | apache-2.0 | 52 |
#!/usr/bin/python
import json
class Client():
def __init__(self, clientHostName, clientPort, channel):
self.clientHostName = clientHostName
self.clientPort = clientPort
self.clientType = self.getClientType()
self.channel = channel
# TO DO implement this method properly
def... | lyubomir1993/AlohaServer | Client.py | Python | apache-2.0 | 616 |
#!/usr/bin/env python
"""Queue definitions.
This module defines the queues where a worker may look for work.
"""
from grr_response_core.lib import rdfvalue
# Queues that a standard worker should work from, highest priority first.
#
# "W" and "CA" are deprecated, but included until we are sure that they are
# empty.... | google/grr | grr/core/grr_response_core/lib/queues.py | Python | apache-2.0 | 822 |
# System
"""Concordance Checking."""
import logging
import os
import functools
# Third Party
from sklearn.cluster import MiniBatchKMeans
from scipy.stats import ks_2samp
import numpy as np
import pandas as pd
# First Party
from submission_criteria import common
def has_concordance(P1, P2, P3, c1, c2, c3, threshold=... | numerai/submission-criteria | submission_criteria/concordance.py | Python | apache-2.0 | 9,505 |
# debuggin
from lxml import etree
# 3rd-party modules
from lxml.builder import E
# module packages
from jnpr.junos.cfg import Resource
from jnpr.junos import jxml as JXML
from jnpr.junos.cfg.srx.shared_ab_addr import SharedAddrBookAddr
from jnpr.junos.cfg.srx.shared_ab_set import SharedAddrBookSet
class SharedAddrB... | dgjnpr/py-junos-eznc | lib/jnpr/junos/cfg/srx/shared_ab.py | Python | apache-2.0 | 2,925 |
#!/usr/bin/env python
import socket
import unittest
from framework import VppTestCase, VppTestRunner
from template_bd import BridgeDomain
from scapy.layers.l2 import Ether
from scapy.layers.inet import IP, UDP
from scapy.layers.vxlan import VXLAN
from scapy.utils import atol
class TestVxlan(BridgeDomain, VppTestCas... | licko/vpp-1701-licko | test/test_vxlan.py | Python | apache-2.0 | 7,549 |
import time
from pymongo import MongoClient
from datetime import datetime, timedelta
import json
from bson import Binary, Code
from bson.json_util import dumps
client = MongoClient('localhost', 27017)
db = client['election-2016']
def dumpData(yesterdayStr):
collectionName = 't' + yesterdayStr
cursor = db[... | seungkim11/election-2016 | python_streaming/yesterday_dump.py | Python | apache-2.0 | 1,289 |
# 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
# di... | HybridF5/jacket | jacket/wsgi/storage/wsgi.py | Python | apache-2.0 | 1,316 |
#!/usr/bin/python
from __future__ import print_function
import os
import sys
import subprocess
import re
import importlib
from cli.utils import Utils
def print_help_opt(opt, desc):
print(" {} {}".format(opt.ljust(13), desc))
def roger_help(root, commands):
print("usage: roger [-h] [-v] command [arg...]\n... | seomoz/roger-mesos-tools | bin/roger.py | Python | apache-2.0 | 2,779 |
# 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 | genomics_ood/images_ood/train.py | Python | apache-2.0 | 8,869 |
#
# Copyright 2013 eNovance <licensing@enovance.com>
#
# Authors: Mehdi Abaakouk <mehdi.abaakouk@enovance.com>
#
# 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/l... | yanheven/ceilometer | ceilometer/alarm/evaluator/combination.py | Python | apache-2.0 | 4,511 |
# AWX settings file
import os
def get_secret():
if os.path.exists("/etc/tower/SECRET_KEY"):
return open('/etc/tower/SECRET_KEY', 'rb').read().strip()
ADMINS = ()
STATIC_ROOT = '/var/lib/awx/public/static'
PROJECTS_ROOT = '/var/lib/awx/projects'
AWX_ANSIBLE_COLLECTIONS_PATHS = '/var/lib/awx/vendor/aw... | GoogleCloudPlatform/sap-deployment-automation | third_party/github.com/ansible/awx/installer/roles/image_build/files/settings.py | Python | apache-2.0 | 2,976 |
# 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... | hfp/tensorflow-xsmm | tensorflow/contrib/distributions/python/ops/autoregressive.py | Python | apache-2.0 | 8,448 |
#
# Copyright (c) 2001 - 2019 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge... | kayhayen/Nuitka | nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/MSCommon/vc.py | Python | apache-2.0 | 33,537 |
from zope.interface import classImplements
from pyramid.config import Configurator
from clld.interfaces import ILanguage, IMapMarker, IValueSet, IValue
from clld.web.app import MapMarker
from clld.db.models.common import Parameter_files
# we must make sure custom models are known at database initialization!
from tsam... | clld/tsammalex | tsammalex/__init__.py | Python | apache-2.0 | 2,206 |
from hashlib import sha256
from .etl import ETL
from kombu.mixins import ConsumerMixin
from kombu import Connection
import traceback
import Queue
import json
import time
import pytz
from datetime import datetime
from tzlocal import get_localzone
import socket
import logging
import os
class KnownHosts(object):
H... | deeso/slow-hitter | src/slow/hitter.py | Python | apache-2.0 | 10,877 |
# 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... | rahulunair/nova | nova/api/openstack/compute/limits.py | Python | apache-2.0 | 3,590 |
'''
Import command for Winthrop team's spreadsheet. It can be invoked using::
python manage.py import_nysql [--justsammel] /path/to/csv
The ``--justsammel`` flag skips import of records to avoid
reproducing duplicates, but rebuilds the ``is_sammelband`` flag set and
produces an output list.
The expect behavior i... | Princeton-CDH/winthrop-django | winthrop/books/management/commands/import_nysl.py | Python | apache-2.0 | 12,753 |
import base64
from cloudify.state import ctx_parameters as inputs
from cloudify.manager import get_rest_client
client = get_rest_client()
client.secrets.create(
'kubernetes_token',
base64.b64decode(inputs['kube_token']),
update_if_exists=True)
| cloudify-cosmo/cloudify-azure-plugin | examples/aks_service/scripts/store_kube_token.py | Python | apache-2.0 | 259 |
#-*- coding: utf-8 -*-
# This file based on MIT licensed code at: https://github.com/imwilsonxu/fbone
from functools import wraps
from flask import abort
from flask.ext.login import current_user
def admin_required(f):
@wraps(f)
def decorated_function(*args, **kwargs):
if not current_user.is_admin()... | achanda/refstack | refstack/decorators.py | Python | apache-2.0 | 409 |
#!/usr/bin/env python
import sys
from modules.ClipRead import *
import os
if __name__ == '__main__':
from optparse import OptionParser
usage = "usage: ./%prog [options] data_file"
parser = OptionParser(usage=usage)
parser.add_option("-v", "--verbose", action = 'store_true', default = False, h... | pegasus-isi/pegasus-gtfar | bin/parse_clipped_alignment.py | Python | apache-2.0 | 994 |
# Copyright 2016 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 applicable law or agree... | ge0rgi/cinder | cinder/volume/drivers/dell/dell_storagecenter_common.py | Python | apache-2.0 | 83,512 |
# 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... | hfp/tensorflow-xsmm | tensorflow/python/kernel_tests/cond_v2_test.py | Python | apache-2.0 | 37,016 |
class ProxyPoolError(Exception):
"""proxypool error base"""
class CrawlerRuleImplementionError(ProxyPoolError):
def __str__(self):
return 'crawler rule required "start_url", "ip_xpath" and "port_xpath".'
class CrawlerRuleBaseInstantiateError(ProxyPoolError):
def __str__(self):
return ... | arrti/proxypool | proxypool/errors.py | Python | apache-2.0 | 501 |
# -*- coding: utf-8 -*-
#
# 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... | tseaver/google-cloud-python | monitoring/google/cloud/monitoring_v3/gapic/metric_service_client.py | Python | apache-2.0 | 43,991 |
import copy
import logging
from strategy import Strategy
logging.basicConfig(level=logging.INFO)
LOG = logging.getLogger(__name__)
class PersistenceStrategy(Strategy):
def __init__(self, strategy):
self.__dict__ = copy.deepcopy(strategy.__dict__)
def compatible(self, event):
if event is N... | ClockworkOrigins/m2etis | configurator/missile/classes/PersistenceStrategy.py | Python | apache-2.0 | 516 |
# Copyright (c) 2013 OpenStack Foundation.
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | cloudbase/neutron-virtualbox | neutron/extensions/l3agentscheduler.py | Python | apache-2.0 | 7,118 |
class CMEModule:
name = 'runasppl'
description = "Check if the registry value RunAsPPL is set or not"
supported_protocols = ['smb']
opsec_safe = True
multiple_hosts = True
def options(self, context, module_options):
'''
'''
def on_admin_login(self, context, connection):
... | byt3bl33d3r/CrackMapExec | cme/modules/runasppl.py | Python | bsd-2-clause | 542 |
from functools import reduce
def vartype(var):
if var.is_discrete:
return 1
elif var.is_continuous:
return 2
elif var.is_string:
return 3
else:
return 0
def progress_bar_milestones(count, iterations=100):
return set([int(i*count/float(iterations)) for i in range(i... | marinkaz/orange3 | Orange/widgets/utils/__init__.py | Python | bsd-2-clause | 811 |
"""
@package mi.instrument.seabird.sbe16plus_v2.test.test_driver
@file mi/instrument/seabird/sbe16plus_v2/test/test_driver.py
@author David Everett
@brief Test cases for InstrumentDriver
USAGE:
Make tests verbose and provide stdout
* From the IDK
$ bin/test_driver
$ bin/test_driver -u
$ bin/t... | mikeh77/mi-instrument | mi/instrument/seabird/sbe16plus_v2/test/test_driver.py | Python | bsd-2-clause | 61,730 |
#!/usr/bin/python3
# Copyright (C) 2015 Bitquant Research Laboratories (Asia) Limited
# Released under the Simplified BSD License
import my_path
import time
import zmq.green as zmq
import pprint
import algobroker
import msgpack
class Dispatcher(algobroker.Broker):
def __init__(self):
algobroker.Broker._... | joequant/algobroker | algobroker/dispatcher.py | Python | bsd-2-clause | 1,618 |
#!/bin/env python
import libsedml
def create_nested_task(file_name):
doc = libsedml.SedDocument(1, 4)
# create simulation
sim = doc.createSteadyState()
sim.setId("steady1")
# need to set the correct KISAO Term
alg = sim.createAlgorithm()
alg.setKisaoID("KISAO:0000282")
# create ... | fbergmann/libSEDML | examples/python/create_nested_task.py | Python | bsd-2-clause | 1,555 |
import os
import sys
import unittest
from unittest.mock import patch
import mkdocs
from mkdocs.config import config_options
from mkdocs.config.base import Config
from mkdocs.tests.base import tempdir
class OptionallyRequiredTest(unittest.TestCase):
def test_empty(self):
option = config_options.Optional... | waylan/mkdocs | mkdocs/tests/config/config_options_tests.py | Python | bsd-2-clause | 31,081 |
from io import StringIO
from coaster.logger import RepeatValueIndicator, filtered_value, pprint_with_indent
def test_filtered_value():
"""Test for filtered values."""
# Doesn't touch normal key/value pairs
assert filtered_value('normal', 'value') == 'value'
assert filtered_value('also_normal', 123) =... | hasgeek/coaster | tests/test_logger.py | Python | bsd-2-clause | 2,411 |
# encoding: utf-8
"""
IMPORTANT - COLOUR SUPPORT IS CURRENTLY EXTREMELY EXPERIMENTAL. THE API MAY CHANGE, AND NO DEFAULT
WIDGETS CURRENTLY TAKE ADVANTAGE OF THEME SUPPORT AT ALL.
"""
import curses
from . import global_options
def disable_color():
global_options.DISABLE_ALL_COLORS = True
def enable_color():
... | tescalada/npyscreen-restructure | npyscreen/ThemeManagers.py | Python | bsd-2-clause | 4,810 |
"""
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
Written (W) 2013 Heiko Strathmann
"""
from kameleon_mcmc.distribution.Gauss... | karlnapf/kameleon-mcmc | kameleon_mcmc/experiments/scripts/glass_ard/glass_ard_ground_truth.py | Python | bsd-2-clause | 4,033 |
__author__ = "Konstantin Osipov <kostja.osipov@gmail.com>"
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and th... | nvoron23/tarantool | test/lib/admin_connection.py | Python | bsd-2-clause | 2,482 |
import setuptools
import os
# This will add the __version__ to the globals
with open("src/lsi/__init__.py") as f:
exec(f.read())
setuptools.setup(
name='lsi',
version=__version__,
author="Narrative Science",
author_email="anelson@narrativescience.com",
url="https://github.com/NarrativeScience/... | NarrativeScience/lsi | setup.py | Python | bsd-2-clause | 583 |
from unittest import mock
import pytest
import stripe
from model_mommy import mommy
from rest_framework.reverse import reverse
from restframework_stripe import models
from restframework_stripe.test import get_mock_resource
@mock.patch("stripe.Customer.save")
@mock.patch("stripe.Customer.retrieve")
@pytest.mark.dja... | andrewyoung1991/django-restframework-stripe | tests/test_customer.py | Python | bsd-2-clause | 4,147 |
#! /usr/bin/env python
# Copyright (c) 2014, Fundacion Dr. Manuel Sadosky
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notic... | programa-stic/barf-project | examples/misc/emulate_binary.py | Python | bsd-2-clause | 7,099 |
# -*- mode: python; coding: utf-8 -*-
# Copyright (c) 2018 Radio Astronomy Software Group
# Licensed under the 2-clause BSD License
"""Primary container for radio interferometer calibration solutions."""
import copy
import numpy as np
import threading
import warnings
from ..uvbase import UVBase
from .. import paramet... | HERA-Team/pyuvdata | pyuvdata/uvcal/uvcal.py | Python | bsd-2-clause | 170,532 |
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class AuthConfig(AppConfig):
name = 'esia_auth'
verbose_name = _('Esia META')
| wolfstein9119/django-esia-auth | esia_auth/apps.py | Python | bsd-2-clause | 178 |
import os, unicodedata
from django.utils.translation import ugettext_lazy as _
from django.core.files.storage import FileSystemStorage
from django.db.models.fields.files import FileField
from django.core.files.storage import default_storage
from django.conf import settings
from django.utils.safestring import mark_safe... | Krozark/django-slider | slider/utils.py | Python | bsd-2-clause | 3,032 |
#
# This file is part of pysmi software.
#
# Copyright (c) 2015-2020, Ilya Etingof <etingof@gmail.com>
# License: http://snmplabs.com/pysmi/license.html
#
class AbstractSearcher(object):
def setOptions(self, **kwargs):
for k in kwargs:
setattr(self, k, kwargs[k])
return self
def ... | etingof/pysmi | pysmi/searcher/base.py | Python | bsd-2-clause | 405 |
"""
Test rest_framework_json_api's utils functions.
"""
from rest_framework_json_api import utils
from ..serializers import EntrySerializer
from ..tests import TestBase
class GetRelatedResourceTests(TestBase):
"""
Ensure the `get_related_resource_type` function returns correct types.
"""
def test_re... | Instawork/django-rest-framework-json-api | example/tests/test_utils.py | Python | bsd-2-clause | 882 |
# created by Angus Clark 9/2/17 updated 27/2/17
# ToDo impliment traceroute function into this
# Perhaps get rid of unnecessary itemediate temp file
import socket
import os
import json
import my_traceroute
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
host = '130.56.253.43'
#print host
port = 5201 # Change ... | wmizzi/tn2capstone | ServerScript/recievestore.py | Python | bsd-2-clause | 1,705 |
from datetime import timedelta
from propeller.cookie import Cookie
from propeller.options import Options
from propeller.template import Template
from propeller.util.dict import MultiDict
from urllib import quote
import httplib
import propeller
class Response(object):
def __init__(self, body='', status_code=200, ... | bwind/propeller | propeller/response.py | Python | bsd-2-clause | 4,589 |
import imp
import os.path
import pkgutil
import six
import unittest
import streamlink.plugins
from streamlink import Streamlink
class PluginTestMeta(type):
def __new__(mcs, name, bases, dict):
plugin_path = os.path.dirname(streamlink.plugins.__file__)
plugins = []
for loader, pname, ispk... | back-to/streamlink | tests/test_plugins.py | Python | bsd-2-clause | 1,609 |
"""Shortest game.
When we play games, we always bet in one of two ways in each game:
- betting one chip
- betting all-in
Wins are paid equal to the wager, so if we bet C chips and wins,
we get 2C chips back.
Suppose yesterday was a lucky day for us, we won every game we played.
Starting with 1 chip and leaving the ... | bowen0701/algorithms_data_structures | alg_shortest_game.py | Python | bsd-2-clause | 1,558 |
import hashlib
import inspect
import json
import logging
import re
from xml.sax.saxutils import escape as xml_escape
import webob
from wsgiservice import xmlserializer
from wsgiservice.decorators import mount
from wsgiservice.exceptions import (MultiValidationException, ResponseException,
... | beekpr/wsgiservice | wsgiservice/resource.py | Python | bsd-2-clause | 58,294 |