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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-dialogflow-cx | google/cloud/dialogflowcx_v3beta1/services/pages/transports/base.py | Python | apache-2.0 | 7,215 |
class Group:
def __init__(self, name, header, footer):
self.name = name
self.header = header
self.footer = footer
| winston33/python | model/group.py | Python | apache-2.0 | 142 |
# 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 law or agre... | huntxu/neutron | neutron/tests/fullstack/base.py | Python | apache-2.0 | 4,357 |
import Image
import argparse
from StringIO import StringIO
from urlparse import urlparse
from threading import Thread
import httplib, sys
from Queue import Queue
import numpy as np
from scipy import misc
import os
def doWork():
while True:
task_data = q.get()
print task_data
url = task_dat... | hudvin/brighteye | facenet_experiments/vgg_utils/vgg_downloader.py | Python | apache-2.0 | 2,983 |
#!/usr/bin/env python
# thanks to https://github.com/carljm/django-model-utils
import os
import sys
from django.conf import settings
import django
DEFAULT_SETTINGS = dict(
INSTALLED_APPS=(
'django.contrib.contenttypes',
'project',
'project.tests',
),
DATABASES={
"defau... | darrylcousins/django-project | runtests.py | Python | apache-2.0 | 1,742 |
# Copyright (c) 2012 Citrix Systems, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | SUSE-Cloud/nova | nova/tests/api/openstack/compute/contrib/test_aggregates.py | Python | apache-2.0 | 18,885 |
from django.contrib import admin
from django.contrib.admin.widgets import AdminFileWidget, AdminURLFieldWidget
from django.contrib.contenttypes.models import ContentType
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext as _
from models import (Image, Video, Audio, Flash, Col... | callowayproject/django-massmedia | massmedia/admin.py | Python | apache-2.0 | 10,650 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2017-03-25 22:15
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('crawler', '0005_userapps'),
]
operations = [
migrations.AddField(
... | bkosawa/admin-recommendation | crawler/migrations/0006_user_recommended_apps.py | Python | apache-2.0 | 455 |
"""Anchore Jenkins plugin source up-to-dateness collector."""
from base_collectors import JenkinsPluginSourceUpToDatenessCollector
class AnchoreJenkinsPluginSourceUpToDateness(JenkinsPluginSourceUpToDatenessCollector):
"""Collector for the up to dateness of the Anchore Jenkins plugin security report."""
| ICTU/quality-time | components/collector/src/source_collectors/anchore_jenkins_plugin/source_up_to_dateness.py | Python | apache-2.0 | 312 |
import rospy
import threading
import types
from lg_common.helpers import load_director_message, find_window_with_activity
from lg_msg_defs.msg import ApplicationState
class BackgroundStopper:
def __init__(self, disable_activities, device_writer):
self.disable_activities = disable_activities
self.d... | EndPointCorp/lg_ros_nodes | lg_nav_to_device/src/lg_nav_to_device/background_stopper.py | Python | apache-2.0 | 2,636 |
"""The tests for the MQTT switch platform."""
import copy
from unittest.mock import patch
import pytest
from homeassistant.components import switch
from homeassistant.components.mqtt.switch import MQTT_SWITCH_ATTRIBUTES_BLOCKED
from homeassistant.const import ATTR_ASSUMED_STATE, STATE_OFF, STATE_ON
import homeassista... | aronsky/home-assistant | tests/components/mqtt/test_switch.py | Python | apache-2.0 | 15,084 |
# Copyright 2014 Dan Krause
#:deploy:OHsentinel:/usr/local/share/OHsentinel
#
# 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
#
# ... | humarf/OHsentinel | OHssdp.py | Python | apache-2.0 | 2,132 |
import os
import tempfile
import unittest
import logging
from pyidf import ValidationLevel
import pyidf
from pyidf.idf import IDF
from pyidf.plant_heating_and_cooling_equipment import ChillerElectricReformulatedEir
log = logging.getLogger(__name__)
class TestChillerElectricReformulatedEir(unittest.TestCase):
def... | rbuffat/pyidf | tests/test_chillerelectricreformulatedeir.py | Python | apache-2.0 | 10,596 |
from proximityGraph import *
| ysig/BioClassSim | source/graph/__init__.py | Python | apache-2.0 | 29 |
#!/usr/bin/env python
path="/var/lib/gpu/gpu_locked.txt"
import os,sys
import ast
import socket
def getHost():
return socket.gethostname()
def getlocked():
hostname=getHost()
#print path
fp=open(path, "r")
info=fp.read()
#print info
d=ast.literal_eval(info)
#print len(d)
prin... | linzhaolover/myansible | openstackfile/getgpulocked.py | Python | apache-2.0 | 696 |
__source__ = 'https://leetcode.com/problems/range-module/'
# Time: O(logK) to O(K)
# Space: O(A+R), the space used by ranges.
#
# Description: Leetcode # 715. Range Module
#
# A Range Module is a module that tracks ranges of numbers.
# Your task is to design and implement the following interfaces in an efficient manne... | JulyKikuAkita/PythonPrac | cs15211/RangeModule.py | Python | apache-2.0 | 7,564 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | openstack/freezer-api | freezer_api/tests/unit/sqlalchemy/test_migrations.py | Python | apache-2.0 | 12,143 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-dialogflow-cx | samples/generated_samples/dialogflow_v3beta1_generated_test_cases_batch_run_test_cases_sync.py | Python | apache-2.0 | 1,663 |
# (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
# Copyright 2017 Fujitsu 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/LICE... | stackforge/monasca-notification | monasca_notification/retry_engine.py | Python | apache-2.0 | 3,769 |
"""Configuration definitions
"""
import numpy
from astropy import units as u
from astropy.coordinates import EarthLocation
from processing_library.util.coordinate_support import xyz_at_latitude
from data_models.memory_data_models import Configuration
from data_models.parameters import arl_path, get_parameter
from pr... | SKA-ScienceDataProcessor/algorithm-reference-library | processing_components/simulation/configurations.py | Python | apache-2.0 | 11,417 |
from otp.otpbase import OTPGlobals
from direct.fsm import ClassicFSM
from direct.fsm import State
from direct.distributed import DistributedNodeAI
from direct.task import Task
class DistributedAvatarAI(DistributedNodeAI.DistributedNodeAI):
def __init__(self, air):
DistributedNodeAI.DistributedNodeAI.__ini... | silly-wacky-3-town-toon/SOURCE-COD | otp/avatar/DistributedAvatarAI.py | Python | apache-2.0 | 2,300 |
# Copyright 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 ... | prmtl/fuel-web | nailgun/nailgun/test/unit/test_migration_fuel_7_0.py | Python | apache-2.0 | 24,190 |
import sys
import solution
# from classes import ?
class TestSuite:
def run(self):
self.test000()
self.test001()
self.test002()
# self.test003()
# self.test004()
def test000(self):
print 'test 000\n'
n = 13
r = solution.answer(n)
pr... | 54lihaoxin/GoogleFooBar | src/guard_game/test_suite.py | Python | apache-2.0 | 938 |
# Copyright 2012 Managed I.T.
#
# Author: Kiall Mac Innes <kiall@managedit.ie>
#
# 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... | NeCTAR-RC/designate | designate/utils.py | Python | apache-2.0 | 8,767 |
import unittest
import singer.statediff as statediff
from singer.statediff import Add, Remove, Change
class TestPaths(unittest.TestCase):
def test_simple_dict(self):
self.assertEqual(
[(('a',), 1),
(('b',), 2)],
statediff.paths({'a': 1, 'b': 2}))
def test_nested_... | singer-io/singer-python | tests/test_statediff.py | Python | apache-2.0 | 2,807 |
"""RFC 6962 client API."""
import base64
import json
from ct.crypto import verify
from ct.proto import client_pb2
import gflags
import logging
import requests
import urllib
import urlparse
FLAGS = gflags.FLAGS
gflags.DEFINE_integer("entry_fetch_batch_size", 1000, "Maximum number of "
"entries t... | lexibrent/certificate-transparency | python/ct/client/log_client.py | Python | apache-2.0 | 22,405 |
#
# Hubblemon - Yet another general purpose system monitor
#
# Copyright 2015 NAVER 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
#
# U... | naver/hubblemon | memcached_mon/memcached_view.py | Python | apache-2.0 | 2,728 |
"""
-------------------------------------------------------
Simulator
a package that helps simulate a baseball game based on
previous batting history
-------------------------------------------------------
Author: Dallas Fraser
ID: 110242560
Email: fras2560@mylaurier.ca
Version: 2014-09-11
-----------... | fras2560/Baseball-Simulator | simulator/__init__.py | Python | apache-2.0 | 5,251 |
try:
from .rich import RichTextEdit as Editor
except ImportError as e:
print e
print 'use simple editor'
from .simple import SimpleTextEdit as Editor
| ya790206/RunningEditor | TextEdit/__init__.py | Python | apache-2.0 | 166 |
__author__ = 'stanley'
import webapp2
from domain.statistics.statistics import *
from domain.statistics.entity import Entity
import json
from domain.doc_index import *
class StatHandler(webapp2.RequestHandler):
def get(self):
qry = Statistics.query(Statistics.id == 'Teammate_Statistics')
#delete()... | nimadini/Teammate | handlers/stat.py | Python | apache-2.0 | 1,093 |
import os
import subprocess
class SambaMonitor (object):
def __init__(self):
self.refresh()
def refresh(self):
pids = {}
ll = subprocess.check_output(['smbstatus', '-p']).splitlines()
for l in ll[4:]:
s = l.split()
if len(s) > 0:
pids[s... | lupyuen/RaspberryPiImage | usr/share/pyshared/ajenti/plugins/samba/status.py | Python | apache-2.0 | 881 |
from .shape import Shape
from .shape import Pane
from .shape import mergeBoundary
from .shape import offsetBoundary
class StrokePath(Shape):
def __init__(self, segments):
self.segments = segments
boundary = self.computeBoundary()
self.pane = Pane(*boundary)
def __eq__(self, other):
return (isinstance(other... | xrloong/Xie | src/xie/graphics/stroke_path.py | Python | apache-2.0 | 24,937 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2014 CloudLight, Inc
# All Rights Reserved.
# This module implements the DAP pipeline manager which
# - manages the pipeline set
# - provide API to query the pipeline status
# - allow plug in the index compute units
# - provide the callback entry to driv... | leon-github/cloudlight | mars/engines/dap/pipeline_manager.py | Python | apache-2.0 | 7,971 |
# -*- coding:utf-8 -*-
__author__ = 'Randolph'
import os
import sys
import time
import logging
import numpy as np
sys.path.append('../')
logging.getLogger('tensorflow').disabled = True
import tensorflow as tf
from utils import checkmate as cm
from utils import data_helpers as dh
from utils import param_parser as par... | RandolphVI/CNN-Text-Classification | CRNN/test_crnn.py | Python | apache-2.0 | 6,213 |
#!/usr/bin/env python
#
# 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
# "... | mrkm4ntr/incubator-airflow | airflow/cli/cli_parser.py | Python | apache-2.0 | 53,687 |
# coding: utf-8
# 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"... | ptrendx/mxnet | python/mxnet/optimizer/optimizer.py | Python | apache-2.0 | 66,906 |
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import absolute_import
import os
import re
import traceback
from .printer import print_err, colors
from typing import cast, Any, Callable, Dict, List, Optional, Tuple
def build_custom_checkers(by_lang):
# type: (Dict[str, List[str]])... | vabs22/zulip | tools/linter_lib/custom_check.py | Python | apache-2.0 | 24,509 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
from pants_test.pants_run_integration_test import PantsRunIntegrationTest
class BundleI... | twitter/pants | tests/python/pants_test/backend/jvm/tasks/test_jvm_bundle_integration.py | Python | apache-2.0 | 1,550 |
# 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 | aqt/jax/wmt_mlperf/hparams_configs/leaderboard/full_model_bfloat16.py | Python | apache-2.0 | 1,016 |
# Copyright 2022 The Magenta 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 ... | magenta/magenta | magenta/pipelines/lead_sheet_pipelines.py | Python | apache-2.0 | 7,193 |
# -*- coding: utf-8 -*-
"""
sphinx.pycode.nodes
~~~~~~~~~~~~~~~~~~~
Parse tree node implementations.
:copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
class BaseNode(object):
"""
Node superclass for both terminal and nonterminal ... | axbaretto/beam | sdks/python/.tox/docs/lib/python2.7/site-packages/sphinx/pycode/nodes.py | Python | apache-2.0 | 6,392 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
PyCOMPSs Testbench Arguments Warnings
=====================================
"""
# Imports
import unittest
from modules.testArgumentError import testArgumentError
def main():
suite = unittest.TestLoader().loadTestsFromTestCase(testArgumentError)
unittest.TextTes... | mF2C/COMPSs | tests/sources/python/8_argument_error/src/args_error.py | Python | apache-2.0 | 392 |
__author__ = 'PARKJINSANG'
from SIMON.algorithms.genetic.SIMONGeneticAlgorithm import SIMONGeneticAlgorithm
#
# genetic algorithm for learning and evaluating
#
#
def run_genetic_algorithm(group, actionPool, propertyPool):
algorithm = SIMONGeneticAlgorithm()
for actionName, actionDnaList in actionPool.items... | ParkJinSang/SIMONFramework | src/SIMON_Py/SIMON/algorithms/SIMONAlgorithmMain.py | Python | apache-2.0 | 1,860 |
import datetime
from imap_tools import EmailAddress
DATA = dict(
subject='Re: Saying Hello',
from_='jdoe@machine.example',
to=('smith@home.example',),
cc=(),
bcc=(),
reply_to=(),
date=datetime.datetime(1997, 11, 21, 11, 0, tzinfo=datetime.timezone(datetime.timedelta(-1, 64800))),
date_s... | ikvk/imap_tools | tests/messages_data/rfc2822/example07.py | Python | apache-2.0 | 1,101 |
# coding=utf-8
# Copyright 2016 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 unittest
from... | kwlzn/pants | tests/python/pants_test/engine/test_storage.py | Python | apache-2.0 | 4,071 |
#!/usr/bin/env python
from setuptools import setup
requirements = [
'kombu',
'pika',
'gevent',
'click',
'coid',
'click',
'kafka-python', # should use pykafka
'kazoo',
'pyes',
'redis',
'sqlalchemy',
'psycopg2',
'pilo',
]
setup(
name='msgr',
version='0.0.1'... | cieplak/msgr | setup.py | Python | apache-2.0 | 678 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | tbachman/group-based-policy | gbpservice/tests/contrib/gbpfunctests/libs/verify_libs.py | Python | apache-2.0 | 16,213 |
import numpy as np
from .peptide import peptide
def _check_duplicates(peptides):
candiates = []
rt = []
for pp in peptides:
if pp.sequence not in candiates:
candiates.append(pp.sequence)
rt.append(pp.rt)
if len(candiates) == len(peptides):
return "No duplicated ... | statisticalbiotechnology/GPTime | GPTime/peptides/load.py | Python | apache-2.0 | 1,114 |
# Copyright 2013: 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 b... | ytsarev/rally | rally/exceptions.py | Python | apache-2.0 | 6,154 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tests for the VSS path specification implementation."""
import unittest
from dfvfs.path import vshadow_path_spec
from tests.path import test_lib
class VShadowPathSpecTest(test_lib.PathSpecTestCase):
"""Tests for the VSS path specification implementation."""
def tes... | dc3-plaso/dfvfs | tests/path/vshadow_path_spec.py | Python | apache-2.0 | 2,586 |
#!/usr/bin/env python3
# Copyright 2017 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... | google/aiyprojects-raspbian | src/examples/vision/dish_classification.py | Python | apache-2.0 | 1,303 |
# Copyright 2022 The T5 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 writi... | google-research/text-to-text-transfer-transformer | t5/models/mesh_transformer.py | Python | apache-2.0 | 12,873 |
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | tudorvio/tempest | tempest/api/compute/servers/test_servers_negative.py | Python | apache-2.0 | 21,412 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tests for a file system implementation using pyvslvm."""
import unittest
from dfvfs.path import lvm_path_spec
from dfvfs.path import os_path_spec
from dfvfs.path import qcow_path_spec
from dfvfs.resolver import context
from dfvfs.vfs import lvm_file_system
from tests impo... | dc3-plaso/dfvfs | tests/vfs/lvm_file_system.py | Python | apache-2.0 | 6,113 |
import boto3
import mock
import os
import pytest
from moto import mock_dynamodb2, mock_sns, settings
from unittest import SkipTest
@mock_sns
def test_use_invalid_region():
if settings.TEST_SERVER_MODE:
raise SkipTest("ServerMode will throw different errors")
client = boto3.client("sns", region_name="a... | spulec/moto | tests/test_core/test_mock_regions.py | Python | apache-2.0 | 2,220 |
import re
import collections
from enum import Enum
from ydk._core._dm_meta_info import _MetaInfoClassMember, _MetaInfoClass, _MetaInfoEnum
from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBitsDict
from ydk._core._dm_meta_info import ATTRIBUTE, REFERENCE_CLASS, REFERENCE_LIST, REFERENCE_LEAFLI... | 111pontes/ydk-py | cisco-ios-xe/ydk/models/cisco_ios_xe/_meta/_CISCO_SUBSCRIBER_SESSION_TC_MIB.py | Python | apache-2.0 | 2,087 |
from selenium import webdriver
from fixture.session import SessionHelper
from fixture.group import GroupHelper
from fixture.contact import ContactHelper
class Application:
def __init__(self, browser, base_url):
if browser == "firefox":
self.wd = webdriver.Firefox(capabilities={"marionette": Fa... | schukinp/python_training | fixture/application.py | Python | apache-2.0 | 1,091 |
# Cooccurrence matrix construction tools
# for fitting the GloVe model.
import numpy as np
try:
# Python 2 compat
import cPickle as pickle
except ImportError:
import pickle
from .corpus_cython import construct_cooccurrence_matrix
class Corpus(object):
"""
Class for constructing a cooccurrence mat... | maciejkula/glove-python | glove/corpus.py | Python | apache-2.0 | 2,667 |
"""
developeraccount
FILE: user
Created: 7/6/15 10:16 PM
"""
__author__ = 'Mark Scrimshire:@ekivemark'
from django import forms
from accounts.models import User
from accounts.choices import ACTIVITY_NOTIFY_CHOICES
class User_EditForm(forms.ModelForm):
class Meta:
model = User
fields = ['email'... | ekivemark/BlueButtonFHIR_API | accounts/forms/user.py | Python | apache-2.0 | 813 |
"""
Copyright (c) 2006 Jan-Klaas Kollhof
This file is part of jsonrpc.
jsonrpc is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later ... | minghuascode/pyj | pyjs/jsonrpc/mongrel2/__init__.py | Python | apache-2.0 | 1,193 |
#!/usr/bin/env python2
from os import listdir
from os.path import isfile, isdir, join, dirname
from re import sub
from urllib import urlopen
from subprocess import Popen, PIPE
from configparser import ConfigParser
import fcntl, socket, struct
def getHwAddr(ifname):
"""The pure python solution for this problem un... | stfc/MagDB | client/magdb-discover.py | Python | apache-2.0 | 5,206 |
#!/usr/bin/env python2.7
"""
/shell.py will allow you to get a console and enter commands
within your flask environment.
"""
import os
import sys
import readline
from pprint import pprint
from flask import *
sys.path.insert(0, '/home/lucas/www/text2img.lucasou.com/text2img-env/text2img/backend-flask')
from backend i... | codelucas/facebook-context | backend-flask/shell.py | Python | apache-2.0 | 366 |
# Copyright (C) 2014 eNovance SAS <licensing@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/licenses/LICENSE-2.0
#
# Unless required by applicabl... | chitr/neutron | neutron/agent/linux/keepalived.py | Python | apache-2.0 | 15,590 |
import numpy as np
import pytest
from emukit.multi_fidelity.convert_lists_to_array import (
convert_x_list_to_array,
convert_xy_lists_to_arrays,
convert_y_list_to_array,
)
def test_convert_x_list_to_array():
x_list = [np.array([[1, 0], [2, 1]]), np.array([[3, 2], [4, 5]])]
x_array = convert_x_lis... | EmuKit/emukit | tests/emukit/multi_fidelity/test_convert_list_to_array.py | Python | apache-2.0 | 2,211 |
# -----------------------------------------------------------------------------
# Copyright 2015 Esri
# 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... | JudTown17/solutions-geoprocessing-toolbox | capability/test/test_erg_tools/TestERGTools.py | Python | apache-2.0 | 6,160 |
#!/usr/bin/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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | google/layered-scene-inference | lsi/visualization/html_utils.py | Python | apache-2.0 | 1,782 |
## file_simple_event.py
# Author: Chen-Ning (Jenny) Chi
# Date: 2011 Sep
###########################################################
## The program will generate & input simple event.
# Support files & directory.
# Could specify what's the file to input events if the file is already exieted in the same folder.
# C... | JennyChi/Script-helper | DataGen/file_simple_event.py | Python | apache-2.0 | 2,096 |
#!/usr/bin/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 a... | GoogleCloudPlatform/healthcare | fhir/immunizations_demo/inference/main.py | Python | apache-2.0 | 10,155 |
from __future__ import absolute_import, unicode_literals
import logging
import sys
from datetime import datetime
from flask import current_app
from subprocess import PIPE, Popen, STDOUT
from threading import Thread
from time import sleep, time
from freight import notifiers
from freight.notifiers import NotifierEvent... | jkimbo/freight | freight/tasks/execute_task.py | Python | apache-2.0 | 7,033 |
"""
iOS push notification platform for notify component.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/ecosystem/ios/notifications/
"""
import logging
from datetime import datetime, timezone
import requests
from homeassistant.components import ios
import homeass... | eagleamon/home-assistant | homeassistant/components/notify/ios.py | Python | apache-2.0 | 3,679 |
# Use this script to collapse a multi-level folder of images into one folder.
import fnmatch
import os
import shutil
folderName = 'unknown'
matches = []
for root, dirnames, filenames in os.walk(folderName):
for filename in fnmatch.filter(filenames, '*.jpg'):
matches.append(os.path.join(root, filename))
i... | ajagnanan/docker-opencv-api | openface/images/collapse.py | Python | apache-2.0 | 465 |
'''
Copyright 2017 Digital Hills, 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 ag... | DigitalHills/Esse | dpeer/nexus.py | Python | apache-2.0 | 17,520 |
from django.conf.urls import include, url
from django.contrib import admin
from . import views
urlpatterns = [
url(r'^$', views.dashboard),
url(r'^account-activity/$', views.account_activity),
url(r'^opportunities/$', views.opportunities),
url(r'^db-fuel-suppliers/$', views.db_fuel_suppliers),
url... | jeffmcnd/tfrs | tfrs/urls.py | Python | apache-2.0 | 746 |
"""Support for MQTT lights."""
import logging
import voluptuous as vol
from homeassistant.components import mqtt
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_COLOR_TEMP,
ATTR_EFFECT,
ATTR_HS_COLOR,
ATTR_WHITE_VALUE,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
SUPPORT_COLOR... | titilambert/home-assistant | homeassistant/components/mqtt/light/schema_basic.py | Python | apache-2.0 | 32,866 |
from collections import defaultdict
from ..util import AttributeDict
class Measurement(object):
"""
A generic feature measurement.
Attributes
----------
default_options
Can be set by subclasses to set default option values
"""
default_options = {}
def __init__(self, options=None):
"""
When initializin... | widoptimization-willett/feature-extraction | feature_extraction/measurements/__init__.py | Python | apache-2.0 | 885 |
#
# Copyright (c) 2015 Midokura SARL, 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 ... | mbirru/midonet-charms | midonet-repository/hooks/services.py | Python | apache-2.0 | 1,540 |
#!/usr/bin/env python3.6
import sys
sys.path.insert(1, 'lib')
import os
import json
import logging
import requests
from requests.packages.urllib3.util.retry import Retry
from requests.adapters import HTTPAdapter
logger = logging.getLogger()
logger.setLevel(logging.INFO)
# Retry until AWS Lambda function times out
ret... | alestic/townclock-ping-timercheck | code/lambda_function.py | Python | apache-2.0 | 1,751 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleads/google-ads-python | google/ads/googleads/v8/services/services/asset_field_type_view_service/transports/grpc.py | Python | apache-2.0 | 10,387 |
# 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 or agreed to in writing, ... | google/transperf | metric.py | Python | apache-2.0 | 32,862 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright 2016 Twitter. 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... | lucperkins/heron | heron/shell/src/python/handlers/pmaphandler.py | Python | apache-2.0 | 1,144 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import wx
import wx.lib.newevent
from threading import Thread, Lock
import signal
import logging
from argparse import ArgumentParser, SUPPRESS
from ConfigParser import ConfigParser
from subprocess import Popen
import subprocess as sb
# CoreEventHandler... | bx5974/desktop-mirror | lib/advanced.py | Python | apache-2.0 | 35,589 |
"""This module contains the meta information of ConfigConfMos ExternalMethod."""
from ..imccoremeta import MethodMeta, MethodPropertyMeta
method_meta = MethodMeta("ConfigConfMos", "configConfMos", "Version142b")
prop_meta = {
"cookie": MethodPropertyMeta("Cookie", "cookie", "Xs:string", "Version142b", "InputOutp... | ragupta-git/ImcSdk | imcsdk/methodmeta/ConfigConfMosMeta.py | Python | apache-2.0 | 828 |
"""Support for the Hive devices."""
import logging
from pyhiveapi import Pyhiveapi
import voluptuous as vol
from homeassistant.const import (
CONF_PASSWORD, CONF_SCAN_INTERVAL, CONF_USERNAME)
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.discovery import load_platform
_LOGGER = ... | jabesq/home-assistant | homeassistant/components/hive/__init__.py | Python | apache-2.0 | 2,196 |
# 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/bot/minimizer/html_minimizer.py | Python | apache-2.0 | 7,964 |
#!/usr/bin/python
import argparse
import fcntl
import os
import requests
import socket
import struct
import textwrap
def parse_args():
ap = argparse.ArgumentParser()
ap.add_argument("--host", nargs="?", default=socket.gethostname())
ap.add_argument("--port", nargs="?", default="4001")
ap.add_argument... | jim-minter/ose3-demos | bin/etcd-client.py | Python | apache-2.0 | 2,017 |
#!/usr/bin/python
# *****************************************************************************
#
# Copyright (c) 2016, EPAM SYSTEMS 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
#
# ... | epam/DLab | infrastructure-provisioning/src/ssn/scripts/resource_status.py | Python | apache-2.0 | 2,004 |
# ----------------------------------------------------------------
# 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.apache.org/licenses/LICENS... | abhikeshav/ydk-py | core/ydk/mdt/proto_to_dict.py | Python | apache-2.0 | 2,788 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 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
#
#... | fengkaicnic/traffic | traffic/openstack/common/cfg.py | Python | apache-2.0 | 55,915 |
# -*- coding: utf-8 -*-
# Copyright 2020 Green Valley Belgium NV
#
# 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... | our-city-app/oca-backend | src/rogerthat/cron/rpc_api_result_retention.py | Python | apache-2.0 | 1,211 |
# -*- 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-analytics-admin | samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_archive_custom_dimension_async.py | Python | apache-2.0 | 1,521 |
# coding=utf-8
# Copyright 2022 The Trax 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 a... | google/trax | trax/layers/activation_fns_test.py | Python | apache-2.0 | 1,833 |
# -*- coding: utf-8 -*-
# Copyright 2013 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 requi... | andrei4ka/fuel-web-redhat | nailgun/nailgun/objects/serializers/release.py | Python | apache-2.0 | 1,707 |
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def isPalindrome(self, head):
"""
:type head: ListNode
:rtype: bool
"""
# stack = []
# if (not head):... | stuti-rastogi/leetcodesolutions | 234_palindromeLinkedList.py | Python | apache-2.0 | 1,611 |
# vim: ai ts=4 sts=4 et sw=4
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import copy
from importlib import import_module
from django.apps import AppConfig
from django.db.models import options
__all__ = ['ClubHouseCoreConfig','site']
class ClubHouseCoreC... | chazmead/django-clubhouse | clubhouse/core/__init__.py | Python | bsd-2-clause | 551 |
"""
This scripts specifies all PTX special objects.
"""
from __future__ import print_function, absolute_import, division
import operator
import numpy
import llvmlite.llvmpy.core as lc
from numba import types, ir, typing, macro
from .cudadrv import nvvm
class Stub(object):
'''A stub object to represent special obj... | stefanseefeld/numba | numba/cuda/stubs.py | Python | bsd-2-clause | 9,284 |
"""
pygments.lexers.nit
~~~~~~~~~~~~~~~~~~~
Lexer for the Nit language.
:copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.lexer import RegexLexer, words
from pygments.token import Text, Comment, Operator, Keyword, Name, St... | dscorbett/pygments | pygments/lexers/nit.py | Python | bsd-2-clause | 2,719 |
# "magictoken" is used for markers as beginning and ending of example text.
import unittest
from numba.tests.support import captured_stdout
class DocsLiterallyUsageTest(unittest.TestCase):
def test_literally_usage(self):
with captured_stdout():
# magictoken.ex_literally_usage.begin
... | sklam/numba | numba/tests/doc_examples/test_literally_usage.py | Python | bsd-2-clause | 1,625 |
import os
import logging
import importlib
import archinfo
from collections import defaultdict
from ...relocation import Relocation
ALL_RELOCATIONS = defaultdict(dict)
complaint_log = set()
path = os.path.dirname(os.path.abspath(__file__))
l = logging.getLogger(name=__name__)
def load_relocations():
for filename ... | angr/cle | cle/backends/elf/relocation/__init__.py | Python | bsd-2-clause | 1,417 |
from __future__ import print_function
from ed2d.cmdargs import CmdArgs
debugEnabled = CmdArgs.add_arg('debug', bool, 'Enable debug output.')
def debug(*args):
if debugEnabled:
print(*args)
| explosiveduck/ed2d | ed2d/debug.py | Python | bsd-2-clause | 203 |
# Copyright (c) 2013, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
import re
from . import AWSObject, AWSProperty, Tags
from .validators import boolean, integer, network_port
def validate_node_group_id(node_group_id):
if re.match(r'\d{1,4}', node_group_id):
ret... | ikben/troposphere | troposphere/elasticache.py | Python | bsd-2-clause | 5,785 |