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 python3
# Copyright (C) 2013 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | GerritCodeReview/gerrit | tools/maven/mvn.py | Python | apache-2.0 | 2,729 |
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import datetime
import faulthandler
import logging
import os
import signal
import sys
import threading
import traceback
from contextlib import contextmanager
from typing import Callable, I... | tdyas/pants | src/python/pants/base/exception_sink.py | Python | apache-2.0 | 23,733 |
# -*- coding: utf-8 -*-
"""
Add compatibility for gevent and multiprocessing.
Source based on project GIPC 0.6.0
https://bitbucket.org/jgehrcke/gipc/
"""
import os, sys, signal, multiprocessing, multiprocessing.process, multiprocessing.reduction
gevent=None
geventEvent=None
def _tryGevent():
global gevent, gevent... | byaka/flaskJSONRPCServer | flaskJSONRPCServer/gmultiprocessing.py | Python | apache-2.0 | 6,393 |
import pytest
import math
import io
import time
import base64
import hashlib
from http import client
from unittest import mock
import aiohttpretty
from waterbutler.core import streams
from waterbutler.core import metadata
from waterbutler.core import exceptions
from waterbutler.core.path import WaterButlerPath
from... | RCOSDP/waterbutler | tests/providers/azureblobstorage/test_provider.py | Python | apache-2.0 | 18,530 |
__author__ = 'mark'
"""
User Profile Extension based on One-to-One fields code in Django Docs here:
https://docs.djangoproject.com/en/1.7/topics/auth/customizing/
"""
from django.db import models
from django.contrib.auth.models import User
from uuid import uuid4
class Member(models.Model):
user = models.OneToOneFi... | ekivemark/my_device | bbp/bbp/member/models.py | Python | apache-2.0 | 548 |
# Copyright 2015 Mirantis, 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 a... | VTabolin/networking-vsphere | networking_vsphere/agent/firewalls/dvs_securitygroup_rpc.py | Python | apache-2.0 | 2,782 |
#!/usr/bin/env python3
# encoding: utf-8
"""
main.py
The entry point for the book reader application.
"""
__version_info__ = (0, 0, 1)
__version__ = '.'.join(map(str, __version_info__))
__author__ = "c.guenther@mac.com"
import time
import sqlite3
import pdb
import signal
import sys, os
import rfid
import config
i... | siliconchris1973/fairytale | RASPI-stuff/python-codeline/fairytale/main.py | Python | apache-2.0 | 3,954 |
from ..user_namespaces import UserNamespaces
from ...parsers.cmdline import CmdLine
from ...parsers.grub_conf import Grub2Config
from ...tests import context_wrap
ENABLE_TOK_A = '''
user_namespaces.enable=1
'''.strip() # noqa
ENABLE_TOK_B = '''
user-namespaces.enable=1
'''.strip() # noqa
CMDLINE = '''
BOOT_IMAGE=/... | wcmitchell/insights-core | insights/combiners/tests/test_user_namespaces.py | Python | apache-2.0 | 4,522 |
# -*- 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, soft... | devdattakulkarni/test-solum | solum/tests/api/handlers/test_assembly.py | Python | apache-2.0 | 8,505 |
"""
Copyright 2013 OpERA
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, softwar... | ComputerNetworks-UFRGS/OpERA | python/algorithm/qa_test.py | Python | apache-2.0 | 3,935 |
# -*- coding:utf-8 -*-
'''
Created on 2015年3月12日
@author: wanhao01
'''
import os
class SpiderFileUtils(object):
'''
deal with file related operations.
'''
def __save_page(self, data, url, outputdir):
'''
save the page content with the specific url to the local p... | onehao/opensource | pyml/crawler/minispider/SpiderFileUtils.py | Python | apache-2.0 | 610 |
#!/usr/bin/env python
#
# Copyright 2014 Simone Campagna
#
# 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... | simone-campagna/py-configment | src/configment/configment.py | Python | apache-2.0 | 5,069 |
"""Example training a memory neural net on the bAbI dataset.
References Keras and is based off of https://keras.io/examples/babi_memnn/.
"""
from __future__ import print_function
from tensorflow.keras.models import Sequential, Model, load_model
from tensorflow.keras.layers import Embedding
from tensorflow.keras.laye... | pcmoritz/ray-1 | python/ray/tune/examples/pbt_memnn_example.py | Python | apache-2.0 | 10,874 |
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
"""
TR-55 Model Implementation
A mapping between variable/parameter names found in the TR-55 document
and variables used in this program are as follows:
* `precip` is referred to as P... | WikiWatershed/tr-55 | tr55/model.py | Python | apache-2.0 | 13,671 |
'''
Kurgan AI Web Application Security Analyzer.
http://www.kurgan.com.br/
Author: Glaudson Ocampos - <glaudson@vortexai.com.br>
Created in May, 11th 2016.
'''
import db.db as db
import config as cf
class WebServer(object):
banner = None
os = None
server = None
framework = None
version = None
... | glaudsonml/kurgan-ai | libs/WebServer.py | Python | apache-2.0 | 3,716 |
#############################################################################
#
# 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
... | asrashley/ieee-802-11-timeline | report/models.py | Python | apache-2.0 | 3,172 |
# Copyright 2015 Huawei Technologies Co.,LTD.
#
# 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... | dimtruck/magnum | magnum/tests/unit/conductor/test_monitors.py | Python | apache-2.0 | 11,331 |
# Copyright 2017 AT&T Intellectual Property. All other 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... | att-comdev/deckhand | deckhand/tests/unit/db/test_revision_diffing.py | Python | apache-2.0 | 14,036 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
#
# Copyright 2010 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... | nearlyfreeapps/python-googleadwords | tests/adspygoogle/adwords/campaign_target_service_unittest.py | Python | apache-2.0 | 3,781 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'BadgeByCourse.title_en'
db.add_column('badges_badgebycourse', 'title_en',
... | GeographicaGS/moocng | moocng/badges/migrations/0011_badgesbycoursemultilang.py | Python | apache-2.0 | 26,422 |
import numpy as np
import matplotlib.pyplot as plt
def readmesh(fname):
"""
input
-----
fname: string
gmsh file name
output
------
V: array
vertices
E: array
element ids
"""
import gmsh
mesh = gmsh.Mesh()
mesh.read_msh(f... | lukeolson/python-mesh-scripts | ns.py | Python | apache-2.0 | 1,505 |
CAMERA_MODE_PHOTO2 = 100
CAMERA_MODE_PHOTO = 0
CAMERA_MODE_FACE_BEAUTY = 1
CAMERA_MODE_PANORAMA = 2
CAMERA_MODE_SELF_WIDEVIEW = 3
CAMERA_MODE_SCENE_FRAME = 4
CAMERA_MODE_GESTURE_SHOT = 5
CAMERA_MODE_LIVE_PHOTO = 6
CAMERA_MODE_VIDEO = 7
CAMERA_MODE_PROFESSIONAL = 8
CAMERA_MODE_NIGHTSHOT = 9
CAMERA_MODE_PIP = 10
CAMERA_M... | liuxuyang/tools | kpiTest/data/mode_tag.py | Python | apache-2.0 | 3,667 |
# coding=utf-8
"""
This module, problem_019.py, solves the nineteenth project euler problem.
"""
from project_euler_problems.problem import Problem
from datetime import date
'''
You are given the following information, but you may prefer to do some research for yourself.
1 Jan 1900 was a Monday.
Thirty days has Se... | utarsuno/urbtek | project_euler_problems/problems/problem_019.py | Python | apache-2.0 | 1,284 |
# Copyright 2015 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 required by app... | eharney/cinder | cinder/volume/drivers/ibm/storwize_svc/storwize_svc_common.py | Python | apache-2.0 | 179,526 |
# Copyright (c) 2013 eBay Software 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
#
# Unl... | hplustree/trove | trove/guestagent/datastore/experimental/couchbase/service.py | Python | apache-2.0 | 10,461 |
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
"""
DEV SCRIPT
This is a hacky script meant to be run mostly automatically with the option of
interactions.
dev.py is supposed to be a developer non-gui interface into the IBEIS software.
dev.py runs experiments and serves as a scratchpad for new code and quick scripts... | SU-ECE-17-7/ibeis | ibeis/dev.py | Python | apache-2.0 | 32,707 |
# 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... | prasanna08/oppia | core/domain/user_domain_test.py | Python | apache-2.0 | 27,932 |
#!/usr/bin/env python
'''You can easily read off two sample,line coordinates from qview, but ISIS
crop wants one sample,line and then offsets. This just takes two coordinates,
does the math, and then calls crop.'''
# Copyright 2016, 2019, Ross A. Beyer (rbeyer@seti.org)
#
# Licensed under the Apache License, Version ... | rbeyer/scriptorium | cropsl.py | Python | apache-2.0 | 2,797 |
from flask import Flask
from flask_bootstrap import Bootstrap
from flask_mail import Mail
from flask_moment import Moment
from flask_sqlalchemy import SQLAlchemy
from config import config
import chartkick
bootstrap = Bootstrap()
mail = Mail()
moment = Moment()
db = SQLAlchemy()
def create_app(config_name):
app ... | ASaiun/saiun_bysj | app/__init__.py | Python | apache-2.0 | 785 |
#!/usr/bin/env python3
#
# Copyright 2014 Simone Campagna
#
# 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 ... | simone-campagna/rubik | rubik/filename.py | Python | apache-2.0 | 2,441 |
# Copyright 2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | OpenAcademy-OpenStack/nova-scheduler | nova/api/openstack/compute/plugins/v3/extended_volumes.py | Python | apache-2.0 | 9,702 |
# 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, ... | GoogleCloudPlatform/repo-automation-playground | xunit-autolabeler-v2/ast_parser/core/test_data/cli/additions/additions.py | Python | apache-2.0 | 926 |
# Copyright 2008 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, ... | sandeva/appspot | astro/birth/urls.py | Python | apache-2.0 | 1,038 |
# Standard Python packages
import math, cmath
import re
import itertools
import numbers
import random
# Special dependencies
import numpy, numpy.random # sudo apt-get install python-numpy
# import minuit # no package
# Augustus dependencies
from augustus.kernel.unitable import UniTable
# Cassius interdependencies
im... | opendatagroup/cassius | tags/cassius-0_1_0_0/cassius/containers.py | Python | apache-2.0 | 141,242 |
# Copyright 2013 IBM Corp
# 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/LICENS... | nuagenetworks/tempest | tempest/tests/lib/test_decorators.py | Python | apache-2.0 | 4,381 |
# 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, ... | tensorflow/neural-structured-learning | research/multi_representation_adversary/multi_representation_adversary/selectors.py | Python | apache-2.0 | 6,095 |
# This work was created by participants in the DataONE project, and is
# jointly copyrighted by participating institutions in DataONE. For
# more information on DataONE, see our web site at http://dataone.org.
#
# Copyright 2009-2019 DataONE
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you ma... | DataONEorg/d1_python | gmn/src/d1_gmn/app/revision.py | Python | apache-2.0 | 18,605 |
# Copyright 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 required b... | redhat-openstack/glance | glance/tests/unit/test_quota.py | Python | apache-2.0 | 28,856 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | mcgonagle/ansible_f5 | library/bigip_snmp_trap.py | Python | apache-2.0 | 13,740 |
# -*- coding: utf-8 -*-
import logging
from flask import request
from flask import render_template
from relay import app
from relay.decorators import jsonify
from relay.decorators import session_required
from relay.decorators import sanitize_user
from relay.models.relays import add_relay_model
from relay.models.rel... | Magicjarvis/relay-backend | relay/views/relays.py | Python | apache-2.0 | 5,107 |
# Copyright 2015-2016 Internap.
#
# 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... | internap/fake-switches | tests/cisco/test_cisco_switch_protocol.py | Python | apache-2.0 | 58,284 |
# -*- coding: utf-8 -*-
# Copyright (c) 2018 Ericsson 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 ... | EricssonResearch/calvin-base | calvinextras/calvinsys/data/buffer/PersistentBuffer.py | Python | apache-2.0 | 7,704 |
#
# 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... | BryanCutler/spark | python/pyspark/ml/classification.py | Python | apache-2.0 | 126,641 |
from django.conf.urls import url
from externals.views import (
PartnerVendorNumberAPIView,
PartnerExternalDetailsAPIView,
PartnerBasicInfoAPIView,
)
urlpatterns = [
url(r'^vendor-number/partner/$', PartnerVendorNumberAPIView.as_view(), name="vendor-number-create"),
url(r'^vendor-number/partner/(?... | unicef/un-partner-portal | backend/unpp_api/apps/externals/urls.py | Python | apache-2.0 | 707 |
"""Tests for init functions."""
from datetime import timedelta
from zoneminder.zm import ZoneMinder
from homeassistant import config_entries
from homeassistant.components.zoneminder import const
from homeassistant.components.zoneminder.common import is_client_in_data
from homeassistant.config_entries import (
ENT... | tchellomello/home-assistant | tests/components/zoneminder/test_init.py | Python | apache-2.0 | 4,539 |
"""Resource manager for using the add-apt-repository command (part of the
python-software-properties package).
"""
# Common stdlib imports
import sys
import os
import os.path
import re
import glob
# fix path if necessary (if running from source or running as test)
try:
import engage.utils
except:
sys.exc... | quaddra/engage | python_pkg/engage/drivers/genforma/add_apt_repository.py | Python | apache-2.0 | 5,376 |
# 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 | adaptive_learning_rate_tuner/resnet_model_fast.py | Python | apache-2.0 | 19,574 |
import json
import re
from behave import given, when, then
from behave import use_step_matcher
use_step_matcher("re")
# implicitly used
import sure # noqa
# We use this instead of validator from json_schema_generator
# because its error reports are far better
from jsonschema import validate
from _lazy_request import... | sunForest/AviPost | e2e/features/steps/crud.py | Python | apache-2.0 | 2,306 |
#!/usr/bin/env python
# -- Content-Encoding: UTF-8 --
"""
Runs an Herald XMPP framework
:author: Thomas Calmant
:copyright: Copyright 2014, isandlaTech
:license: Apache License 2.0
:version: 0.0.4
:status: Alpha
..
Copyright 2014 isandlaTech
Licensed under the Apache License, Version 2.0 (the "License");
... | ahmadshahwan/cohorte-herald | python/run_xmpp.py | Python | apache-2.0 | 5,512 |
"""
Functions for converting numbers with SI units to integers
"""
import copy
import re
si_multipliers = {
None: 1,
'': 1,
'k': 1000 ** 1,
'm': 1000 ** 2,
'g': 1000 ** 3,
't': 1000 ** 4,
'p': 1000 ** 5,
'e': 1000 ** 6,
'z': 1000 ** 7,
'y': 1000 ** 8,
'ki': 1024 ** 1,
... | mfeit-internet2/pscheduler-dev | python-pscheduler/pscheduler/pscheduler/sinumber.py | Python | apache-2.0 | 5,585 |
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | alfasin/st2 | st2common/tests/unit/test_policies.py | Python | apache-2.0 | 4,902 |
#!/usr/bin/env python
# vim: set filetype=python expandtab tabstop=4 shiftwidth=4 autoindent smartindent:
#from distutils.core import setup
import os
import logging
import setuptools
import distutils.cmd
import subprocess
# TODO add check to make sure required libs are present (eg sqlite3)
_PACKAGE_NAME = 'python... | craig5/python-ibank | setup.py | Python | apache-2.0 | 2,638 |
#!/usr/bin/env python
"""A flow to run checks for a host."""
from grr.lib import aff4
from grr.lib import flow
from grr.lib import rdfvalue
from grr.lib.checks import checks
from grr.proto import flows_pb2
class CheckFlowArgs(rdfvalue.RDFProtoStruct):
protobuf = flows_pb2.CheckFlowArgs
class CheckRunner(flow.GRRF... | wandec/grr | lib/flows/general/checks.py | Python | apache-2.0 | 3,098 |
# -*- coding: utf-8 -*-
class Config(object):
def __init__(self, bucket, root):
self.bucket = bucket
self.root = root
| lyst/shovel | src/shovel/config.py | Python | apache-2.0 | 138 |
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | tonybaloney/st2 | st2common/st2common/services/datastore.py | Python | apache-2.0 | 8,753 |
# stdlib
from collections import defaultdict
import sys
from typing import Any as TypeAny
from typing import Callable
from typing import Dict
from typing import KeysView
from typing import List as TypeList
from typing import Set
# third party
from cachetools import cached
from cachetools.keys import hashkey
# relativ... | OpenMined/PySyft | packages/syft/src/syft/lib/misc/__init__.py | Python | apache-2.0 | 6,217 |
# 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.... | zhhf/charging | charging/tests/unit/test_db_plugin.py | Python | apache-2.0 | 180,785 |
from django.db import models
class ProductionDatasetsExec(models.Model):
name = models.CharField(max_length=200, db_column='NAME', primary_key=True)
taskid = models.DecimalField(decimal_places=0, max_digits=10, db_column='TASK_ID', null=False, default=0)
status = models.CharField(max_length=12, db_column='... | PanDAWMS/panda-bigmon-atlas | atlas/getdatasets/models.py | Python | apache-2.0 | 1,240 |
#!/usr/bin/python
# Copyright 2015 Comcast Cable Communications Management, 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 ... | Comcast/rulio | examples/actionendpoint.py | Python | apache-2.0 | 2,070 |
# Copyright 2020 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | tensorflow/tfx | tfx/experimental/templates/penguin/pipeline/pipeline.py | Python | apache-2.0 | 6,485 |
from __future__ import annotations
import os
import shutil
import time
import gc
import threading
from typing import Optional
from utils.utilfuncs import safeprint
def DummyAsyncFileWrite(fn, writestr, access='a'):
safeprint('Called HB file write before init {} {} {}'.format(fn, writestr, access))
AsyncFileWrite ... | kevinkahn/softconsole | historybuffer.py | Python | apache-2.0 | 4,574 |
#!/usr/bin/env python
# -*- encoding:utf-8 -*-
__author__ = 'kairong'
#解决crontab中无法执行的问题
import sys
reload(sys)
sys.setdefaultencoding('utf8')
import ConfigParser
import MySQLdb
import requests
import re
from socket import socket, SOCK_DGRAM, AF_INET
from multiprocessing import Process
###函数声明区域
def get_localIP():
... | sageskr/domain_mon | code/url_monitor.py | Python | apache-2.0 | 2,606 |
#
# 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 the ... | igor-toga/knob2 | knob/objects/service.py | Python | apache-2.0 | 2,894 |
# -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import, unicode_literals
import os
import time
import threading
import tempfile
from mog_commons.command import *
from mog_commons import unittest
class TestCommand(unittest.TestCase):
def test_execute_command(self):
self.a... | mogproject/mog-commons-python | tests/mog_commons/test_command.py | Python | apache-2.0 | 2,719 |
import base64
import itertools
import json
import logging
import os
import re
import time
from .buckets import get_bucket_client
from .params import get_param_client
from .secrets import get_secret_client
logger = logging.getLogger("zentral.conf.config")
class Proxy:
pass
class EnvProxy(Proxy):
def __init... | zentralopensource/zentral | zentral/conf/config.py | Python | apache-2.0 | 9,328 |
# Copyright 2021 The Kubeflow Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | kubeflow/pipelines | sdk/python/kfp/deprecated/dsl/metrics_utils.py | Python | apache-2.0 | 6,121 |
from django.conf import settings
from django.template import RequestContext
from django.shortcuts import render_to_response
from django.contrib.auth import authenticate, login, logout
from django.core.context_processors import csrf
from skilltreeapp.forms import LoginForm
from django.shortcuts import render_to_response... | abztrakt/uw-skilltree | skilltreeapp/views/pages.py | Python | apache-2.0 | 4,046 |
#!/usr/bin/env python
"""
MCNPX Model for Cylindrical RPM8
"""
import sys
sys.path.append('../MCNPTools/')
sys.path.append('../')
from MCNPMaterial import Materials
import subprocess
import math
import mctal
import numpy as np
import itertools
import os
class CylinderRPM(object):
# Material Dictionaries
cell... | murffer/DetectorSim | MCNPXRPMModels/WrappedCylinders/CylinderMCNPX.py | Python | apache-2.0 | 23,537 |
#
# Copyright 2015 Simulmedia, 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 wr... | Simulmedia/pyembedpg | pyembedpg.py | Python | apache-2.0 | 10,244 |
# Copyright 2011 Eldar Nugaev
# 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 ... | rahulunair/nova | nova/tests/unit/api/openstack/compute/test_keypairs.py | Python | apache-2.0 | 27,057 |
from __future__ import unicode_literals
import datetime
from boto.ec2.elb.attributes import (
LbAttributes,
ConnectionSettingAttribute,
ConnectionDrainingAttribute,
AccessLogAttribute,
CrossZoneLoadBalancingAttribute,
)
from boto.ec2.elb.policies import (
Policies,
OtherPolicy,
)
from moto.... | heddle317/moto | moto/elb/models.py | Python | apache-2.0 | 15,471 |
# Copyright 2018 The TensorFlow Constrained Optimization 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
#
#... | google-research/tensorflow_constrained_optimization | tensorflow_constrained_optimization/python/rates/general_rates.py | Python | apache-2.0 | 52,315 |
# Copyright 2015 Philipp Pahl, Sven Schubert, Daniel Britzger
#
# 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... | PeachstoneIO/peachbox | tutorials/tutorial_movie_reviews/model/master.py | Python | apache-2.0 | 3,918 |
# Copyright (c) 2013,2014 VMware, 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 requi... | ramineni/my_congress | congress/datasources/datasource_utils.py | Python | apache-2.0 | 6,907 |
#! /usr/bin/python
import json
import os
import re
import datetime
class Advisories(object):
today = datetime.datetime.now().strftime("%Y-%m-%d")
def __init__(self, initial_advisories_path=None, format="txt"):
self.advisories = []
self.added_packages = {}
if initial_advisories_path ... | globus/globus-release-tools | share/python/repo/advisories.py | Python | apache-2.0 | 3,857 |
import sqlalchemy
from sqlalchemy import Column, Integer, String
from sqlalchemy.orm import mapper, sessionmaker
import subprocess
class PygrationState(object):
'''Python object representing the state table'''
def __init__(self, migration=None, step_id=None, step_name=None):
self.migration = migration
... | mdg/pygrate | pygration/db.py | Python | apache-2.0 | 2,877 |
# -*- coding: utf-8 -*-
from collections import defaultdict
import subprocess
import os
import bisect
import re
from .common import log_fmt
class GitProcess():
GIT_BIN = None
def __init__(self, repoDir, args, text=None):
startupinfo = None
if os.name == "nt":
startupinfo = sub... | timxx/gitc | qgitc/gitutils.py | Python | apache-2.0 | 14,220 |
# 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, ... | tartavull/google-cloud-python | logging/google/cloud/logging/_http.py | Python | apache-2.0 | 17,745 |
#!/usr/bin/env python
class AllPermutations(object):
def __init__(self, arr):
self.arr = arr
def all_permutations(self):
results = []
used = []
self._all_permutations(self.arr, used, results)
return results
def _all_permutations(self, to_use, used, results):
... | davjohnst/fundamentals | fundamentals/backtracking/all_permutations.py | Python | apache-2.0 | 772 |
#!/usr/bin/env python
import re
from codecs import open
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
def get_version():
version = ''
with open('grimreaper.py', 'r') as fd:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
... | matee911/GrimReapersPie | setup.py | Python | apache-2.0 | 1,788 |
"""
This component provides HA sensor support for Ring Door Bell/Chimes.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.ring/
"""
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.components.sensor import ... | jamespcole/home-assistant | homeassistant/components/ring/sensor.py | Python | apache-2.0 | 6,215 |
import sys
q_to_time = {}
i = 0
for line in open(sys.argv[1]):
try:
line = line.strip()
cols = line.split('\t')
q_to_time[cols[0]] = [(int(cols[2].split(' ')[0]), i)]
i += 1
except ValueError:
continue
i = 0
for line in open(sys.argv[2]):
try:
line = line.s... | Buchhold/QLever | misc/compare_shuffled.py | Python | apache-2.0 | 1,155 |
# -*- test-case-name: txdav.common.datastore.upgrade.sql.test -*-
# #
# Copyright (c) 2011-2015 Apple 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.... | red-hood/calendarserver | txdav/common/datastore/upgrade/sql/upgrades/addressbook_upgrade_from_1_to_2.py | Python | apache-2.0 | 3,445 |
#!/usr/bin/env python3.4
#
# 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... | yusufm/mobly | mobly/controllers/attenuator_lib/minicircuits.py | Python | apache-2.0 | 5,184 |
import core
logger = core.log.getLogger("monitoring-utils")
class MonitoringUtils(object):
def __init__(self):
pass
@staticmethod
def check_existing_tag_in_topology(root, node, node_type, node_urns,
domain=None):
tag_exists = False
try:
... | ict-felix/stack | modules/resource/orchestrator/src/monitoring/utils.py | Python | apache-2.0 | 4,165 |
# file eulcommon/djangoextras/formfields.py
#
# Copyright 2010,2011 Emory University Libraries
#
# 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... | emory-libraries/eulcommon | eulcommon/djangoextras/formfields.py | Python | apache-2.0 | 8,195 |
import httplib
import logging
from error import HapiError
class NullHandler(logging.Handler):
def emit(self, record):
pass
def get_log(name):
logger = logging.getLogger(name)
logger.addHandler(NullHandler())
return logger
| jonathan-s/happy | happy/utils.py | Python | apache-2.0 | 255 |
import serial
from sys import platform as platform
import serial.tools.list_ports
import serial.threaded
from pymouse import PyMouse
from Voice.GoogleTTS import speak
import threading
import math
import copy
import time
import json
data_repository_right = {
"id" : [],
"name" : [],
"short... | ashwinpilgaonkar/Flick | Bluetooth/Bluetooth.py | Python | apache-2.0 | 25,172 |
# Copyright (c) 2015 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | openstack/sahara | sahara/tests/unit/service/api/test_v10.py | Python | apache-2.0 | 11,635 |
import re
import datetime
from collections import OrderedDict
TimePattern = re.compile("^[0-9]{4}\-[0-9]{2}\-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}Z$")
TimeFormat = "%Y-%m-%dT%H:%M:%S.%fZ"
TimePatternSimple = re.compile("^[0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}$")
TimeFormatSimple = "%Y-%m-%d %H:%M"
d... | flarno11/teslasuc | lib.py | Python | apache-2.0 | 1,173 |
"""replace.py
Tool for replacing variable names in Damon.
Copyright (c) 2009 - 2011, Mark H. Moulton for Pythias Consulting, LLC.
Purpose: This tool was developed to replace CamelCase argument
variables with all lower case equivalents across all Damon modules.
It is being retained because it is readily adaptable to ... | Sohojoe/damon | damon1/replace_it.py | Python | apache-2.0 | 14,439 |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@author: mango
@contact: w4n9@sina.com
@create: 16/7/4
hail hydra!
"""
__author__ = "mango"
__version__ = "0.1"
from kazoo.client import KazooClient
import logging
logging.basicConfig()
class ZookeeperClient(object):
def __init__(self, zk_host):
self.... | w4n9H/PythonSkillTree | Storage/BigData/Zookeeper/ZKClient.py | Python | apache-2.0 | 2,203 |
"""A simple multi-agent env with two agents playing rock paper scissors.
This demonstrates running the following policies in competition:
(1) heuristic policy of repeating the same move
(2) heuristic policy of beating the last opponent move
(3) LSTM/feedforward PG policies
(4) LSTM policy with custom e... | richardliaw/ray | rllib/examples/rock_paper_scissors_multiagent.py | Python | apache-2.0 | 5,789 |
from os.path import dirname
import numpy as np
from ..os import open_file, exists_isdir, makedirs
from ..log import get_logger
logger = get_logger()
def read_or_write(data_f, fallback=None):
"""Loads the data file if it exists. Otherwise, if fallback is provided,
call fallback and save its return to disk.
... | google/nerfactor | third_party/xiuminglib/xiuminglib/io/np.py | Python | apache-2.0 | 1,973 |
from core_tests_base import CoreTestsBase, FakeTessagon, FakeTileSubClass
class TestTile(CoreTestsBase):
# Note: these tests are highly dependent on the behavior of
# FakeTessagon and FakeAdaptor
def test_add_vert(self):
tessagon = FakeTessagon()
tile = FakeTileSubClass(tessagon, u_rang... | cwant/tessagon | tests/core/test_tile.py | Python | apache-2.0 | 2,833 |
# old single process tictactoe game to be rewritten....
import numpy
import os
class TicTacToePlayer:
def __init__(self, playerType, playerName, ttt_game_settings):
if playerType not in ['AI', 'Terminal']:
raise(ValueError())
self.type=playerType
self.name=playerName
self.board_size = ttt_game_settings['... | dirrelito/animated-invention | ThreadedTicTacToe/_old/ttt.py | Python | apache-2.0 | 5,563 |
import os
import numpy as np
from sklearn.datasets import load_iris
from sklearn.ensemble import RandomForestClassifier
import shap
import mlflow
# prepare training data
X, y = load_iris(return_X_y=True, as_frame=True)
# train a model
model = RandomForestClassifier()
model.fit(X, y)
# log an explanation
with mlf... | mlflow/mlflow | examples/shap/multiclass_classification.py | Python | apache-2.0 | 964 |
# !/usr/bin/python
# coding=utf-8
#
# @Author: LiXiaoYu
# @Time: 2013-10-17
# @Info: lang
_lang = {
'_MODULE_NOT_EXIST_':'无法加载模块',
'_ERROR_ACTION_':'非法操作',
'_LANGUAGE_NOT_LOAD_':'无法加载语言包',
'_TEMPLATE_NOT_EXIST_':'模板不存在',
'_MODULE_':'模块',
'_ACTION_':'操作',
'_ACTION_NOT_EXIST_':'控制器不存在或者没有定义',
... | lxy235/lserver | src/Common/Lang/zh_cn.py | Python | apache-2.0 | 1,569 |
#!/usr/bin/env python3
#
# Copyright (c) 2015, Roberto Riggio
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, t... | LokiNetworks/empower-runtime | empower/apps/zephyr/zephyr.py | Python | apache-2.0 | 17,023 |
class StoreChangeLogger:
def __init__(self, store_name, context) -> None:
self.topic = f'{context.application_id}-{store_name}-changelog'
self.context = context
self.partition = context.task_id.partition
self.record_collector = context.state_record_collector
def log_change(self,... | wintoncode/winton-kafka-streams | winton_kafka_streams/state/logging/store_change_logger.py | Python | apache-2.0 | 503 |