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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | Aloomaio/googleads-python-lib | examples/adwords/v201809/advanced_operations/add_multi_asset_responsive_display_ad.py | Python | apache-2.0 | 5,311 |
# Generated by Django 2.2.13 on 2020-06-12 06:49
import diventi.accounts.models
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('accounts', '0330_auto_20200612_0843'),
]
operations = [
migrations.AlterModelManagers(
name='diventiuser... | flavoi/diventi | diventi/accounts/migrations/0331_auto_20200612_0849.py | Python | apache-2.0 | 453 |
#! /usr/bin/env python3
# -*- 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 requi... | googleapis/python-oslogin | scripts/fixup_oslogin_v1_keywords.py | Python | apache-2.0 | 6,257 |
# Lint as: python3
# 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 agr... | mlperf/training_results_v0.7 | Google/benchmarks/minigo/implementations/minigo-research-TF-tpu-v4-128/preprocessing.py | Python | apache-2.0 | 10,808 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.AP_list, name='AP_list'),
]
| OpenWinCon/OpenWinNet | web-gui/AP/urls.py | Python | apache-2.0 | 119 |
# 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 applicable law or agreed t... | openstack/tempest | tempest/test_discover/test_discover.py | Python | apache-2.0 | 1,891 |
# -*- 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, ... | NECCSiPortal/NECCSPortal-dashboard | nec_portal/dashboards/admin/log_management/tables.py | Python | apache-2.0 | 731 |
# -*- 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, ... | pmverdugo/fiware-validator | validator/clients/puppet_client.py | Python | apache-2.0 | 6,861 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
FS Pairtree storage - Reverse lookup
====================================
Conventions used:
From http://www.cdlib.org/inside/diglib/pairtree/pairtreespec.html version 0.1
This is an implementation of a reverse lookup index, using the pairtree path spec to
record the li... | benosteen/pairtree | pairtree/pairtree_revlookup.py | Python | apache-2.0 | 3,270 |
"""The base command."""
from datetime import datetime
from json import dumps
from watches.util import ESClientProducer
class Base(object):
"""A base command."""
TEXT_PLAIN = 'plain/text'
JSON_APPLICATION = 'application/json'
TRANSFORM_PARAM = '--transform'
TIMESTAMP_PARAM = '--timestamp'
... | ViaQ/watches-cli | watches/commands/base.py | Python | apache-2.0 | 7,002 |
# -*- 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, software... | redbo/swift | releasenotes/source/conf.py | Python | apache-2.0 | 10,523 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Symplicity.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| sbelskie/symplicity | manage.py | Python | apache-2.0 | 253 |
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import os
from pants.backend.native.targets.native_artifact import NativeArtifact
from pants.backend.native.tasks.cpp_compile import CppCompile
from pants.backend.native.tasks.link_shared... | tdyas/pants | tests/python/pants_test/backend/native/tasks/test_link_shared_libraries.py | Python | apache-2.0 | 1,358 |
# -*- coding: utf-8 -*-
import sys
import pymongo
from flask import Flask
# Fix messy code
reload(sys)
sys.setdefaultencoding('utf-8')
app = Flask(__name__, instance_relative_config=True)
app.config.from_object('config')
app.config.from_pyfile('config.py')
client = pymongo.MongoClient(app.config['DB_URI'])
db = c... | ruter/WeChat-img-Search | app/__init__.py | Python | apache-2.0 | 418 |
# coding: utf-8
#
# Copyright 2018 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... | AllanYangZhou/oppia | core/controllers/suggestion.py | Python | apache-2.0 | 5,721 |
# coding: utf-8
"""
Wavefront REST API
<p>The Wavefront REST API enables you to interact with Wavefront servers using standard REST API tools. You can use the REST API to automate commonly executed operations such as automatically tagging sources.</p><p>When you make REST API calls outside the Wavefront REST ... | wavefrontHQ/python-client | test/test_user_api_token.py | Python | apache-2.0 | 1,268 |
# -*- coding: utf-8 -*-
"""
Thai Grapheme-to-Phoneme (Thai G2P)
GitHub : https://github.com/wannaphong/thai-g2p
"""
import random
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from pythainlp.corpus import get_corpus_path
device = torch.device("cuda:0" if torch.cuda.is_availabl... | PyThaiNLP/pythainlp | pythainlp/transliterate/thaig2p.py | Python | apache-2.0 | 11,448 |
from changes.config import db
from changes.models.project import ProjectOption
from changes.models.snapshot import SnapshotStatus
from changes.testutils import APITestCase
class SnapshotListTest(APITestCase):
def test_simple(self):
project_1 = self.create_project()
build_1 = self.create_build(proj... | dropbox/changes | tests/changes/api/test_snapshot_index.py | Python | apache-2.0 | 2,245 |
"""
Github Authentication
"""
import httplib2
from django.conf import settings
from django.core.mail import send_mail
from oauth2client.client import OAuth2WebServerFlow
from helios_auth import utils
# some parameters to indicate that status updating is not possible
STATUS_UPDATES = False
# display tweaks
LOGIN_ME... | benadida/helios-server | helios_auth/auth_systems/github.py | Python | apache-2.0 | 2,315 |
"""Tests for the canary component."""
from unittest.mock import MagicMock, PropertyMock
from canary.api import SensorType
def mock_device(device_id, name, is_online=True, device_type_name=None):
"""Mock Canary Device class."""
device = MagicMock()
type(device).device_id = PropertyMock(return_value=device... | tchellomello/home-assistant | tests/components/canary/__init__.py | Python | apache-2.0 | 1,712 |
# -*- coding: utf-8 -*-
# Copyright 2016 Mirantis, Inc.
#
# 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 2 of the License, or
# (at your option) any later version... | ibelikov/jimmy | jimmy/modules/jenkins_configuration/tests/test_jenkins_configuration.py | Python | apache-2.0 | 11,065 |
from model.info_contact import Infos
import random
def test_delete_some_contact(app, db, check_ui):
if app.contact.count() == 0:
app.contact.create(Infos(firstname="AAAAA"))
old_contacts = db.get_contact_list()
contact = random.choice(old_contacts)
app.contact.delete_contact_by_id(contact.id)
... | Alex-Chizhov/python_training | home_works/test/test_del_contact.py | Python | apache-2.0 | 595 |
#!/usr/bin/env python
"""Entry point to run app.
Used to launch the REST and Cron servers.
"""
import logging
import io
import os
import flask
from flask_api import status
from google.cloud import storage
from typing import Text
logging.getLogger().setLevel(logging.INFO)
from metrics import base
import env
import m... | ampproject/amp-github-apps | project-metrics/metrics_service/server.py | Python | apache-2.0 | 6,263 |
from django.http import HttpResponse, HttpRequest
from typing import Optional
import ujson
from django.utils.translation import ugettext as _
from zerver.lib.actions import do_mute_topic, do_unmute_topic
from zerver.lib.request import has_request_variables, REQ
from zerver.lib.response import json_success, json_erro... | dhcrzf/zulip | zerver/views/muting.py | Python | apache-2.0 | 2,792 |
# Copyright 2019 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... | keras-team/keras | keras/engine/compile_utils_test.py | Python | apache-2.0 | 31,261 |
#encoding:utf-8
__authors__ = ['wei keke']
__version__ = "V0.1"
'''
# ChangeLog:
#---------------------------------------------------------------------------------
# Version Date Desc Author
#-----------------------------------------------------------------------------... | faylau/oVirt3.3WebAPITest | src/TestData/Network/ITC06010401_UpdateNetwork.py | Python | apache-2.0 | 1,115 |
"""Support for OVO Energy."""
from __future__ import annotations
from datetime import datetime, timedelta
import logging
import aiohttp
import async_timeout
from ovoenergy import OVODailyUsage
from ovoenergy.ovoenergy import OVOEnergy
from homeassistant.config_entries import ConfigEntry
from homeassistant.const impo... | jawilson/home-assistant | homeassistant/components/ovo_energy/__init__.py | Python | apache-2.0 | 3,757 |
import pytest
pytestmark = [
pytest.mark.skip_on_windows(reason="Not supported on Windows"),
pytest.mark.skip_if_binaries_missing(
"ansible",
"ansible-doc",
"ansible-playbook",
check_all=True,
reason="ansible is not installed",
),
]
@pytest.fixture
def ansible_ping... | saltstack/salt | tests/pytests/functional/modules/test_ansiblegate.py | Python | apache-2.0 | 1,245 |
# ****************************************************************************
# Copyright 2018 The Apollo 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
#
# ht... | ycool/apollo | cyber/python/cyber_py/cyber.py | Python | apache-2.0 | 10,449 |
# -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# 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... | bmaggard/luigi | test/worker_parallel_scheduling_test.py | Python | apache-2.0 | 5,302 |
#!/usr/bin/python
'''
Input: file
Output: stdout
Tidy output of spark stderr file CSV format
Jeremy Schaub
$ ./sparkread.py [time_output_file]
'''
import sys
class Measurement:
'''
Data structure for /usr/bin/time measurement
'''
def __init__(self):
self.stage_times = ['0']
self.s... | jschaub30/tidy | sparkread.py | Python | apache-2.0 | 3,370 |
from __future__ import division
from itertools import chain
from sklearn.feature_extraction.text import CountVectorizer
import numpy as np
import pandas as pd
from fisher import pvalue
import re
import collections
from nltk.stem.porter import PorterStemmer
import math
from percept.tasks.base import Task
from percept.fi... | VikParuchuri/simpsons-scripts | tasks/train.py | Python | apache-2.0 | 16,847 |
import subprocess
import os.path
import re
import argparse
import sys
from pybedtools import BedTool
DEBUG = False
parser = argparse.ArgumentParser(description="find overlap gene.",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
if not DEBUG:
parser.add_argument('-i', '--i... | shengqh/ngsperl | lib/Annotation/findOverlapGene.py | Python | apache-2.0 | 1,368 |
# coding: utf-8
"""
DeliveryHub
DeliveryHub API
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtai... | garywong89/PetStoreAPI | python/test/test_order.py | Python | apache-2.0 | 1,237 |
import boto3
import sure # noqa
from moto import mock_kinesis, mock_cloudformation
@mock_cloudformation
def test_kinesis_cloudformation_create_stream():
cf_conn = boto3.client("cloudformation", region_name="us-east-1")
stack_name = "MyStack"
template = '{"Resources":{"MyStream":{"Type":"AWS::Kinesis::... | william-richard/moto | tests/test_kinesis/test_kinesis_cloudformation.py | Python | apache-2.0 | 5,255 |
# Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | platformio/platformio | platformio/commands/org.py | Python | apache-2.0 | 4,758 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 OpenStack Foundation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.... | ykaneko/quantum | quantum/api/v2/base.py | Python | apache-2.0 | 29,494 |
# Copyright 2015 Palo Alto Networks, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | PaloAltoNetworks/minemeld-core | minemeld/ft/utils.py | Python | apache-2.0 | 6,146 |
#!/usr/bin/env python
import rospy
from std_msgs.msg import Float32
import numpy as np
import soccer_PK.utils
rospy.init_node("reward")
pub = rospy.Publisher("reward", Float32, queue_size=10)
rate = rospy.Rate(3)
rospy.wait_for_service('/gazebo/get_model_state')
soccer_PK.utils.reset_world()
# intial postion
ball_p... | syoamakase/Re-ROS | re_environments/src/soccer_PK/soccer_PK_reward.py | Python | apache-2.0 | 1,763 |
# Copyright (c) 2014-2017. Mount Sinai School of Medicine
#
# 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... | hammerlab/mhctools | mhctools/netmhc_cons.py | Python | apache-2.0 | 1,609 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def do_nothing(apps, schema_editor):
pass
def create_new_behaviors_and_strategies(apps, schema_editor):
CountingBehavior = apps.get_model("core", "CountingBehavior")
RefreshBehavior = apps.get_model... | CCI-MOC/GUI-Backend | core/migrations/0007_create_allocation_strategy_and_behaviors.py | Python | apache-2.0 | 5,962 |
#
# Copyright 2014, 2015 Red Hat. All Rights Reserved.
#
# Author: Chris Dent <chdent@redhat.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/licenses/LICEN... | FND/gabbi | gabbi/simple_wsgi.py | Python | apache-2.0 | 3,301 |
# snapy - a python snmp library
#
# Copyright (C) 2009 ITA Software, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# version 2 as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be ... | marineam/nagcat | python/snapy/netsnmp/unittests/test_netsnmp.py | Python | apache-2.0 | 4,936 |
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under ... | crashlytics/aurora | src/test/python/apache/aurora/client/test_config.py | Python | apache-2.0 | 9,093 |
# 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... | majetideepak/arrow | dev/archery/archery/utils/command.py | Python | apache-2.0 | 2,217 |
'''
Various tools to interface with pyGSTi for running GST experiments.
Created on May 16, 2018
Original Author: Guilhem Ribeill
Copyright 2018 Raytheon BBN Technologies
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 ... | BBN-Q/QGL | QGL/GSTTools.py | Python | apache-2.0 | 7,229 |
"""Support for Xiaomi Mi Air Quality Monitor (PM2.5)."""
import logging
from miio import AirQualityMonitor, Device, DeviceException
import voluptuous as vol
from homeassistant.components.air_quality import PLATFORM_SCHEMA, AirQualityEntity
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_TOKEN
from homeassi... | postlund/home-assistant | homeassistant/components/xiaomi_miio/air_quality.py | Python | apache-2.0 | 7,163 |
#
# 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... | wooga/airflow | airflow/secrets/metastore.py | Python | apache-2.0 | 1,888 |
from io import StringIO
from pathlib import Path
from cwltool.main import main
from .util import get_data
def test_empty_input(tmp_path: Path) -> None:
"""Affirm that an empty input works."""
empty_json = "{}"
empty_input = StringIO(empty_json)
params = [
"--outdir",
str(tmp_path),
... | common-workflow-language/cwltool | tests/test_empty_input.py | Python | apache-2.0 | 513 |
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
import base64
from enum import IntEnum
from xdrlib import Packer, Unpacker
from ..__version__ import __issues__
from ..type_checked import type_checked
__all__ = ["LedgerUpgradeType"]
@type_checked
class LedgerUpgradeType(In... | StellarCN/py-stellar-base | stellar_sdk/xdr/ledger_upgrade_type.py | Python | apache-2.0 | 1,727 |
# -*- coding: utf-8 -*-
#
# google-cloud-irm documentation build configuration file
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that ... | googleapis/python-irm | docs/conf.py | Python | apache-2.0 | 11,253 |
import pytest
from selenium import webdriver
@pytest.fixture
def driver(request):
wd = webdriver.Chrome()
request.addfinalizer(wd.quit)
return wd
def test_example(driver):
driver.get("http://localhost/litecart/")
driver.implicitly_wait(10)
sticker_number = len(driver.find_elements_by_xpath("/... | olga121/Selenium_Webdriver | test_sticker.py | Python | apache-2.0 | 496 |
# Copyright 2019, The TensorFlow Federated 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 o... | tensorflow/federated | tensorflow_federated/python/core/impl/compiler/building_block_factory.py | Python | apache-2.0 | 75,967 |
# -*- coding: utf-8 -*-
# '''
# Author: Eachen Kuang
# Date: 2017.10.20
# Goal: 将文件转化为字典
# Other:
# '''
import string
from math import log
import numpy as np
def KLD(p,q):
p,q=zip(*filter(lambda (x,y): x!=0 or y!=0, zip(p,q))) #去掉二者都是0的概率值
p=p+np.spacing(1)
q=q+np.spacing(1)
print p, q
return su... | EachenKuang/PythonRepository | PublicOpinion/JSDistance.py | Python | apache-2.0 | 1,014 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, re, time, sys
import hashlib, bencode
import requests
from bs4 import BeautifulSoup
reload(sys)
#print sys.getdefaultencoding()
#sys.setdefaultencoding('utf-8')
print sys.getdefaultencoding()
def parse_tor(file):
bt_path = {}
bt_... | dannywxh/mypy | MyPys/common.py | Python | apache-2.0 | 3,687 |
# -*- coding: utf-8 -*-
# Copyright 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
#
# Unless required by applicable... | Akrog/gcs-client | gcs_client/common.py | Python | apache-2.0 | 7,705 |
# Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | platformio/platformio | platformio/managers/package.py | Python | apache-2.0 | 29,447 |
#!/usr/bin/env python
# Copyright 2016 DIANA-HEP
#
# 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... | histogrammar/histogrammar-python | histogrammar/plot/vega/nodejs.py | Python | apache-2.0 | 3,370 |
import subprocess
import os
import argparse
import gzip
parser = argparse.ArgumentParser(description = "Postprocess the VCF file created by the CrossMap to make it valid again.", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("--vcf", help = "Path to the VCF file.")
args = parser.parse_arg... | kauralasoo/Blood_ATAC | scripts/postprocessCrossmap.py | Python | apache-2.0 | 728 |
import ConfigParser
import json
def get_player_id():
config = ConfigParser.ConfigParser()
config.read('yasp.cfg')
return config.get('yasp', 'player_id')
def get_hero_id():
config = ConfigParser.ConfigParser()
config.read('yasp.cfg')
return config.get('yasp', 'hero_id')
def get_hero_data():
file = open(... | jcdavis/yasp-stats | yasp_util.py | Python | apache-2.0 | 437 |
import cPickle
def dump_rules(filename, rules):
with open(filename, 'w') as f:
cPickle.dump(rules, f, cPickle.HIGHEST_PROTOCOL)
def load_rules(filename):
with open(filename, 'r') as f:
rules = cPickle.load(f)
return rules
class Rule():
APPLY_ACTION = 0
CLEAR_ACTION = 1
WRITE_A... | ymktw/SDNProbe | pymodule/rule.py | Python | apache-2.0 | 3,687 |
#
# Copyright (c) 2014 Juniper Networks, Inc. All rights reserved.
#
import re
from distutils.util import strtobool
import kombu
import gevent
import gevent.monkey
gevent.monkey.patch_all()
import time
import signal
from gevent.queue import Queue
try:
from gevent.lock import Semaphore
except ImportError:
# old... | codilime/contrail-controller | src/config/common/vnc_kombu.py | Python | apache-2.0 | 12,514 |
# Copyright 2018-present Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | brettwooldridge/buck | programs/buck_project.py | Python | apache-2.0 | 6,332 |
# -*- coding: utf-8 -*-
import os
import logging
import datetime
def get_logger(directory, name):
"""
"""
logger = logging.getLogger(name)
logger.setLevel(logging.INFO)
date_handler = DateFileHandler(directory, name)
fmt_str = '%(asctime)s %(process)d %(module)s.%(funcName)s.%(lineno)d %(level... | alen-alex/aqi_service | aqi_service/util/log_utils.py | Python | apache-2.0 | 2,106 |
# 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 required by applicable law or a... | huangkuan/hack | lib/gcloud/monitoring/client.py | Python | apache-2.0 | 7,310 |
from __future__ import unicode_literals
import binascii
import hashlib
import logging
import socket
import ssl
import sys
from ansible.module_utils.mt_api.retryloop import RetryError
from ansible.module_utils.mt_api.retryloop import retryloop
from ansible.module_utils.mt_api.socket_utils import set_keepalive
PY2 = s... | zahodi/ansible-mikrotik | pythonlibs/mt_api/__init__.py | Python | apache-2.0 | 12,353 |
# Copyright (c) 2013 Red Hat, 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 require... | github-borat/cinder | cinder/tests/test_glusterfs.py | Python | apache-2.0 | 87,804 |
# Copyright 2018 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 ... | GoogleCloudPlatform/healthcare-deid | deid_app/backend/server.py | Python | apache-2.0 | 29,411 |
# File: TscTelnetLib.py ; This file is part of Twister.
# version: 2.002
#
# Copyright (C) 2012 , Luxoft
#
# Authors:
# Adrian Toader <adtoader@luxoft.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... | twister/twister.github.io | lib/TscTelnetLib.py | Python | apache-2.0 | 17,030 |
import discord
from discord.ext import commands
from sys import argv
class Memes:
"""
Meme commands
"""
def __init__(self, bot):
self.bot = bot
print('Addon "{}" loaded'.format(self.__class__.__name__))
async def _meme(self, ctx, msg):
author = ctx.message.author
if... | T3CHNOLOG1C/Kurisu | addons/memes.py | Python | apache-2.0 | 7,307 |
import abc
import json
from future.utils import with_metaclass
from collections import defaultdict
import numpy as np
import tensorflow as tf
from dps import cfg
from dps.utils import Parameterized, Param
from dps.utils.tf import build_gradient_train_op, trainable_variables, get_scheduled_values, ScopedFunction
from ... | e2crawfo/dps | dps/tf/updater.py | Python | apache-2.0 | 21,553 |
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from ...sipmessaging import SIPHeaderField
from ...sipmessaging import classproperty
class EventSIPHeaderField(SIPHeaderField):
# noinspection PyNestedDecorators
@classproperty
@classmethod
def canonical_fiel... | bobjects/BobStack | bobstack/sipmessaging/concreteheaderfields/eventSIPHeaderField.py | Python | apache-2.0 | 3,899 |
"""
Copyright 2015 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, software
di... | openconfig/oc-pyang | openconfig_pyang/plugins/util/html_emitter.py | Python | apache-2.0 | 14,661 |
# -*- coding: utf-8 -*-
"""OSF mailing utilities.
Email templates go in website/templates/emails
Templates must end in ``.txt.mako`` for plaintext emails or``.html.mako`` for html emails.
You can then create a `Mail` object given the basename of the template and
the email subject. ::
CONFIRM_EMAIL = Mail(tpl_pre... | jolene-esposito/osf.io | website/mails.py | Python | apache-2.0 | 7,045 |
#
# 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... | wooga/airflow | tests/providers/opsgenie/hooks/test_opsgenie_alert.py | Python | apache-2.0 | 5,041 |
# -*- coding: utf-8 -*-
import flask
import functools
import logging
import requests
from .. import storage
from .. import toolkit
from . import cache
from . import config
DEFAULT_CACHE_TAGS_TTL = 48 * 3600
logger = logging.getLogger(__name__)
def is_mirror():
cfg = config.load()
return bool(cfg.get('mirr... | glenux/contrib-docker-registry | docker_registry/lib/mirroring.py | Python | apache-2.0 | 7,154 |
#
# 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... | dhuang/incubator-airflow | airflow/migrations/versions/8646922c8a04_change_default_pool_slots_to_1.py | Python | apache-2.0 | 3,222 |
#!/usr/bin/python
# @lint-avoid-python-3-compatibility-imports
#
# uobjnew Summarize object allocations in high-level languages.
# For Linux, uses BCC, eBPF.
#
# USAGE: uobjnew [-h] [-T TOP] [-v] {java,ruby,c} pid [interval]
#
# Copyright 2016 Sasha Goldshtein
# Licensed under the Apache License, Version 2.0 ... | mkacik/bcc | tools/uobjnew.py | Python | apache-2.0 | 5,131 |
# Copyright 2022 The ML Collections Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | google/ml_collections | ml_collections/config_flags/examples/define_config_dataclass_basic.py | Python | apache-2.0 | 1,322 |
from model.group import Group
import pytest
def test_add_group(app, db, json_groups):
group = json_groups
with pytest.allure.step('Given a group list'):
old_groups = db.get_group_list()
with pytest.allure.step('When I add a group %s to the list' % group):
app.group.cre... | potolock/proverca | test/test_add_group.py | Python | apache-2.0 | 690 |
# coding=utf-8
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import logging
from... | UnrememberMe/pants | contrib/node/src/python/pants/contrib/node/subsystems/package_managers.py | Python | apache-2.0 | 8,798 |
#!/usr/bin/python3
ci_version="0.10"
# This script is used to retrieve corpus information. It can be run after the parser
# has finished its work. The corpus information is part of the final report.
# Database connection is configured in the server configuration.
# Include custom libs
import sys
sys.path.append( '../... | Thylossus/tud-movie-character-insights | Server/Tools/Parser/corpusInfo.py | Python | apache-2.0 | 3,953 |
# Copyright 2016 Battelle Energy Alliance, 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 agr... | idaholab/civet | ci/gitlab/api.py | Python | apache-2.0 | 19,475 |
# Copyright 2011 OpenStack Foundation
# 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 wi... | leilihh/novaha | nova/cmd/all.py | Python | apache-2.0 | 3,403 |
class NodeType(object):
Base = 'base'
Model = 'model'
Analysis = 'analysis'
Test = 'test'
Archive = 'archive'
Macro = 'macro'
Operation = 'operation'
Seed = 'seed'
Documentation = 'documentation'
@classmethod
def executable(cls):
return [
cls.Model,
... | nave91/dbt | dbt/node_types.py | Python | apache-2.0 | 686 |
# -*- 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-aiplatform | samples/generated_samples/aiplatform_v1beta1_generated_endpoint_service_deploy_model_async.py | Python | apache-2.0 | 1,792 |
import logging
import os
import time
from parsl.providers.error import ScaleOutFailed
from parsl.channels import LocalChannel
from parsl.launchers import AprunLauncher
from parsl.providers.cobalt.template import template_string
from parsl.providers.cluster_provider import ClusterProvider
from parsl.utils import Repres... | swift-lang/swift-e-lab | parsl/providers/cobalt/cobalt.py | Python | apache-2.0 | 8,583 |
# coding: utf-8
from __future__ import print_function, absolute_import, division, unicode_literals
import sys
from .compat import no_limit_int # NOQA
if False: # MYPY
from typing import Text, Any, Dict, List # NOQA
__all__ = ["ScalarFloat", "ExponentialFloat", "ExponentialCapsFloat"]
class ScalarFloat(floa... | Samuel789/MediPi | MedManagementWeb/env/lib/python3.5/site-packages/ruamel/yaml/scalarfloat.py | Python | apache-2.0 | 3,378 |
#!/usr/local/bin/python2.7
# encoding: utf-8
from __future__ import division
from argparse import ArgumentParser
import logging
import sys
from expertfinding import ExpertFinding
from collections import Counter
def main():
'''Command line options.'''
parser = ArgumentParser()
parser.add_argument("-n", "... | marcocor/expert-finding | src/main/python/expertfinding/preprocessing/create_profile.py | Python | apache-2.0 | 1,232 |
# 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/clusterfuzz | src/clusterfuzz/_internal/base/modules.py | Python | apache-2.0 | 2,700 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
from foo_receiver import FooReceiver
from foo_listener_bf import FooListenerBfHelper
from PyCFFIlib_cffi import ffi, lib
import gc
class FooListenerBfImpl:
def delete_fl_in_fl(self):
print ("Not to b... | trafi/djinni | test-suite/handwritten-src/python/test_proxying.py | Python | apache-2.0 | 5,511 |
"""
Test plugin views.
"""
import os
import glob
from django.test import TestCase
from django.utils import simplejson as json
from django.conf import settings
from django.test.client import Client
from django.contrib.auth.models import User
from ocradmin.core.tests import testutils
from nodetree import script, node
i... | vitorio/ocropodium | ocradmin/presets/tests/test_scripts.py | Python | apache-2.0 | 4,800 |
# 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
#
# Unless required by applicable law or agree... | openstack/horizon | horizon/utils/validators.py | Python | apache-2.0 | 2,698 |
# -*- coding: utf-8 -*-
#
# Copyright 2021 Elliot Jordan
#
# 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... | autopkg/homebysix-recipes | Perforce/PerforceURLProvider.py | Python | apache-2.0 | 3,976 |
from pykintone.base_api import BaseAPI
import pykintone.user_api.user_api_result as ur
class Export(BaseAPI):
def __init__(self, account, requests_options=()):
super(Export, self).__init__(account=account, requests_options=requests_options)
def get_users(self, ids=(), codes=(), offset=-1, size=0):
... | icoxfog417/pykintone | pykintone/user_api/export.py | Python | apache-2.0 | 1,411 |
# Copyright 2014 ETH Zurich
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, sof... | klausman/scion | python/sciond/sciond.py | Python | apache-2.0 | 30,793 |
import asyncio
import enum
import io
import json
import mimetypes
import os
import warnings
from abc import ABC, abstractmethod
from itertools import chain
from typing import (
IO,
TYPE_CHECKING,
Any,
ByteString,
Dict,
Iterable,
Optional,
TextIO,
Tuple,
Type,
Union,
)
from m... | KeepSafe/aiohttp | aiohttp/payload.py | Python | apache-2.0 | 13,689 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | alexpilotti/python-keystoneclient | keystoneclient/auth/__init__.py | Python | apache-2.0 | 1,031 |
# -*- coding: utf-8 -*-
# Copyright 2017 IBM RESEARCH. 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... | atilag/qiskit-sdk-py | qiskit/qasm/_node/_gatebody.py | Python | apache-2.0 | 1,570 |
# Copyright 2021, The TensorFlow Federated 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 o... | tensorflow/federated | tensorflow_federated/python/simulation/baselines/emnist/char_recognition_tasks.py | Python | apache-2.0 | 8,376 |