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
"""This file contains specialized renderers for semantic values.
Other files may also contain specialized renderers for semantic types relevant
to their function, but here we include the most basic and common renderers.
"""
import itertools
import urllib
import logging
from grr.gui import rend... | spnow/grr | gui/plugins/semantic.py | Python | apache-2.0 | 20,338 |
# -*- coding: utf-8 -*-
"""Output module for the native (or "raw") Python format."""
from __future__ import unicode_literals
from dfdatetime import posix_time as dfdatetime_posix_time
from plaso.lib import definitions
from plaso.output import formatting_helper
from plaso.output import interface
from plaso.output imp... | rgayon/plaso | plaso/output/rawpy.py | Python | apache-2.0 | 4,034 |
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
import logging
import traceback
from uw_coda import get_fail_rate, get_course_cgpa, get_majors
from restclients_core.exceptions import DataFailureException
from myuw.util.thread import Thread
from myuw.dao import log_err
logger = l... | uw-it-aca/myuw | myuw/dao/coda.py | Python | apache-2.0 | 1,996 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-12-18 16:55
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0031_auto_20171214_1855'),
]
operations = [
... | swcurran/tfrs | backend/api/migrations/0032_auto_20171218_1655.py | Python | apache-2.0 | 1,363 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# This file is auto-generated by h2o-3/h2o-bindings/bin/gen_python.py
# Copyright 2016 H2O.ai; Apache License Version 2.0 (see LICENSE for details)
#
from __future__ import absolute_import, division, print_function, unicode_literals
from h2o.utils.metaclass import dep... | h2oai/h2o-3 | h2o-py/h2o/estimators/random_forest.py | Python | apache-2.0 | 83,553 |
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 11 19:05:26 2014
Module for linking with the Allen brain atlas
@author: tim
"""
import csv
from os import path, rename, remove
from glob import glob
import numpy as np
from scipy import stats
from matplotlib import pyplot as plt
from maybrain import brain
# from maybrain... | RittmanResearch/maybrain | maybrain/allen.py | Python | apache-2.0 | 40,307 |
#!/usr/bin/env python
import unittest
import random
from scapy.packet import Raw
from scapy.layers.l2 import Ether
from scapy.layers.inet import IP, UDP
from framework import VppTestCase, VppTestRunner
from util import Host, ppp
class TestL2xc(VppTestCase):
""" L2XC Test Case """
@classmethod
def setU... | licko/vpp-1701-licko | test/test_l2xc.py | Python | apache-2.0 | 8,519 |
"""
Contains helper functionality for reading and parsing configuration files.
"""
import os
from configparser import (
ConfigParser,
NoOptionError,
NoSectionError,
)
from six import PY2, string_types
class Config(ConfigParser):
"""
A :class:`configparser.ConfigParser` subclass with added
fu... | therewillbecode/ichnaea | ichnaea/config.py | Python | apache-2.0 | 3,170 |
# 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 agreed to in writing, ... | zmsp/AIY-data-center-assistant | src/aiy/_drivers/_tts.py | Python | apache-2.0 | 2,158 |
from model.contact import Contact
from random import randrange
def test_edit_random_contact(app):
if app.contact.count() == 0:
app.contact.init_creation(Contact(firstname='first', middlename='middl', lastname='last', nickname='nick', title='tit', company='compa', address='add', phonehome='phh', phonemobi... | Fanarohyes/python_training | test/test_editcontact.py | Python | apache-2.0 | 1,976 |
from rest_framework import permissions
class IsStaffOrTargetPlayer(permissions.IsAuthenticatedOrReadOnly):
"""Only allow unsafe methods if the user is staff or the user is editing their own player."""
message = "You do not have permission to perform this action."
def has_permission(self, request, view):
... | prattl/teamfinder-api | common/api/permissions.py | Python | apache-2.0 | 2,840 |
# Copyright (c) 2012 OpenStack Foundation.
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License a... | openstack/oslo.service | oslo_service/eventlet_backdoor.py | Python | apache-2.0 | 9,496 |
import xlrd
from ..exceptions import TableTooBigException, EmptyTableException
#from ..configuration import _config
from ..utilities import header_population
from mfr.extensions.tabular.compat import range, basestring
def xlsx_xlrd(fp):
"""Read and convert a xlsx file to JSON format using the xlrd library
:... | haoyuchen1992/modular-file-renderer | mfr/extensions/tabular/libs/xlrd_tools.py | Python | apache-2.0 | 1,275 |
# -*- 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
#... | Fokko/incubator-airflow | tests/ti_deps/deps/test_dagrun_exists_dep.py | Python | apache-2.0 | 1,720 |
""".. Ignore pydocstyle D400.
==================
Permissions loader
==================
.. autofunction:: load_permissions
"""
import os
import pkgutil
from importlib import import_module
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
permissions_classes = {}
def get_perm... | genialis/resolwe | resolwe/permissions/loader.py | Python | apache-2.0 | 2,608 |
# coding: utf-8
"""
Stakeholder engagement API
This API enables Intelligent Engagement for your Business. iEngage is a platform that combines process, augmented intelligence and rewards to help you intelligently engage customers.
OpenAPI spec version: 1.0
Generated by: https://github.com/swagger... | iEngage/python-sdk | test/test_blog.py | Python | apache-2.0 | 849 |
# 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... | briancurtin/python-openstacksdk | openstack/telemetry/alarm/alarm_service.py | Python | apache-2.0 | 928 |
# Generated by Django 3.0.3 on 2020-03-13 20:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('extras', '0040_standardize_description'),
]
operations = [
migrations.AlterField(
model_name='tag',
name='comments',... | digitalocean/netbox | netbox/extras/migrations/0041_tag_description.py | Python | apache-2.0 | 544 |
from flask import Blueprint, request, jsonify, current_app
from modules.comparisons.frontend_queries import get_all_attribute_types, get_attribute_values, get_types
from routes.file_utils import fix_uri
from middleware.decorators import tofromHumanReadable
bp_ra_views = Blueprint('reactapp_views', __name__)
@tofromHu... | superphy/backend | app/routes/ra_views.py | Python | apache-2.0 | 2,249 |
from matplotlib import pyplot
from math import cos, sin, atan
import numpy as np
vertical_distance_between_layers = 6
horizontal_distance_between_neurons = 2
neuron_radius = 0.5
number_of_neurons_in_widest_layer = 10
class Neuron():
def __init__(self, x, y, neuronType):
self.x = x
self.y... | JakeShulman/G-Neat | Draw_Test.py | Python | apache-2.0 | 4,223 |
""" ocelog_client -- a simple httplib wrapper for ocelog functional testing
"""
import httplib
import urllib
class OcelogResponse(object):
""" A simple wrapper around httplib.HTTPResponse"""
def __init__(self, http_response):
""" Accept and parse an httplib.HTTPResponse object """
self.stat... | codycollier/ocelog | test/functional/ocelog_client.py | Python | apache-2.0 | 1,593 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 Nicira Networks, 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.apach... | russellb/nova | nova/network/quantum/melange_ipam_lib.py | Python | apache-2.0 | 11,031 |
from django.db import models
# Create your models here.
class Article(models.Model):
# 文章的唯一ID
article_id = models.AutoField(primary_key=True)
# 文章标题
title = models.TextField()
subtitle = models.TextField(default='')
# 文章摘要
brief_content = models.TextField()
# 文章内容
content = model... | bbxyard/bbxyard | yard/skills/00-web/django_demo/blog/models.py | Python | apache-2.0 | 498 |
#!/usr/bin/env python
##
# Copyright (c) 2006-2014 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.apache.org/licenses/LICENSE-2.0
#
# Unless r... | trevor/calendarserver | calendarserver/tools/principals.py | Python | apache-2.0 | 27,872 |
from setuptools import setup, find_packages
args = dict(
name='Django-bdd',
version='1.0',
# declare your packages
packages=find_packages(exclude=("test",)),
include_package_data=True, # declarations in MANIFEST.in
)
setup(**args)
| PhoenixWright/django-bdd | setup.py | Python | apache-2.0 | 254 |
#!/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 agree... | google/google-ctf | other/re-risky/split-version/task2/spoilers_and_source/src/gen_checker.py | Python | apache-2.0 | 937 |
#!/usr/bin/python
# Copyright 2007 Google Inc. All Rights Reserved
#
__author__ = 'springer@google.com (Matthew Springer)'
import shutil
import tempfile
import time
import unittest
from lib import filesystem_handler
class FileSystemHandlerTests(unittest.TestCase):
"""Tests our operating system abstraction layer.... | kdlucas/pyrering | lib/filesystem_handler_test.py | Python | apache-2.0 | 10,358 |
# Copyright (C) 2014 Floris Bruynooghe <flub@devork.be>
r"""
Use remote Mercurial repository as a Pillar source.
.. versionadded:: 2015.8.0
The module depends on the ``hglib`` python module being available.
This is the same requirement as for hgfs\_ so should not pose any extra
hurdles.
This external Pillar source... | saltstack/salt | salt/pillar/hg_pillar.py | Python | apache-2.0 | 3,270 |
# 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... | newrelic-forks/cassandra | pylib/cqlshlib/copyutil.py | Python | apache-2.0 | 80,385 |
##
# Copyright (c) 2005-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.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | red-hood/calendarserver | twistedcaldav/test/test_collectioncontents.py | Python | apache-2.0 | 8,362 |
# File name: aiohttp_deploy_serve.py
import ray
from ray import serve
# Connect to the running Ray cluster.
ray.init(address="auto")
# Start a detached Ray Serve instance. It will persist after the script exits.
serve.start(http_options={"http_host": None}, detached=True)
# Set up a deployment with the desired num... | ray-project/ray | python/ray/serve/examples/doc/aiohttp/aiohttp_deploy_serve.py | Python | apache-2.0 | 597 |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/clusterfuzz | src/clusterfuzz/_internal/tests/core/bot/minimizer/delta_minimizer_test.py | Python | apache-2.0 | 1,020 |
#!/usr/bin/env python
import sys,time,argparse
import numpy as np
def main(args):
sys.stdout.write("Start analysis: " + time.strftime("%a,%d %b %Y %H:%M:%S") + "\n")
sys.stdout.flush()
generate_ats_event(args.input,args.output,args.genome,args.distance)
sys.stdout.write("Finish analysis: " + time.strftime("%a,%d %... | yunhaowang/IsoSeqSim | utilities/py_isoseqsim_generate_ats_event.py | Python | apache-2.0 | 3,061 |
# 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 th... | philpep/testinfra | testinfra/modules/interface.py | Python | apache-2.0 | 2,930 |
# -*- coding: utf-8 -*-
"""
Authors: Tim Hessels
UNESCO-IHE 2016
Contact: t.hessels@unesco-ihe.org
Repository: https://github.com/wateraccounting/wa
Module: Collect/MOD15
"""
# import general python modules
import os
import numpy as np
import pandas as pd
import gdal
from bs4 import BeautifulSoup
import re
im... | wateraccounting/wa | Collect/MOD15/DataAccess.py | Python | apache-2.0 | 19,960 |
'''
Created on May 23, 2014
@author: moloyc
'''
import yaml
import os
import json
import math
import zlib
import base64
from netaddr import IPNetwork
from sqlalchemy.orm import exc
from model import Pod, Device, InterfaceLogical, InterfaceDefinition, CablingPlan, DeviceConfig, TrapGroup
from dao import Dao
import u... | plucena24/OpenClos | jnpr/openclos/l3Clos.py | Python | apache-2.0 | 42,311 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | nolanliou/tensorflow | tensorflow/contrib/tpu/python/tpu/tpu_estimator.py | Python | apache-2.0 | 104,642 |
"""
Support for getting collected information from PVOutput.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.pvoutput/
"""
import logging
from collections import namedtuple
from datetime import timedelta
import voluptuous as vol
import homeassist... | jamespcole/home-assistant | homeassistant/components/pvoutput/sensor.py | Python | apache-2.0 | 3,822 |
# the main Flask application
from template_logic import create_template_app
app = create_template_app()
if __name__ == "__main__":
app.run(**app.config['INIT']) | Braiiin/template-logic | run.py | Python | apache-2.0 | 163 |
# -*- 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-dataflow-client | google/cloud/dataflow_v1beta3/services/metrics_v1_beta3/transports/__init__.py | Python | apache-2.0 | 1,194 |
# 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 th... | xuweiliang/Codelibrary | openstack_dashboard/dashboards/admin/aggregates/compute/forms.py | Python | apache-2.0 | 3,868 |
#
# 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
# ... | takeshineshiro/heat | heat/engine/service.py | Python | apache-2.0 | 74,567 |
"""Support for performing TensorFlow classification on images."""
import logging
import os
import sys
import voluptuous as vol
from homeassistant.components.image_processing import (
CONF_CONFIDENCE,
CONF_ENTITY_ID,
CONF_NAME,
CONF_SOURCE,
PLATFORM_SCHEMA,
ImageProcessingEntity,
draw_box,
... | Cinntax/home-assistant | homeassistant/components/tensorflow/image_processing.py | Python | apache-2.0 | 12,574 |
from typing import List
class Solution:
def ans(self, r_dict, k, src, target):
if src == target and k == 0:
return [[src]]
elif k == 0:
return []
ret = []
for x in r_dict.get(src,[]):
sub = self.ans(r_dict, k-1, x,target)
if not sub:... | clarkchen/leetcode_python | contests/2020_spring/2.py | Python | apache-2.0 | 1,355 |
"""Config flow for RFXCOM RFXtrx integration."""
import copy
import os
import RFXtrx as rfxtrxmod
import serial
import serial.tools.list_ports
import voluptuous as vol
from homeassistant import config_entries, exceptions
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
CONF_C... | jawilson/home-assistant | homeassistant/components/rfxtrx/config_flow.py | Python | apache-2.0 | 21,451 |
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import os
from abc import abstractmethod
from pants.backend.jvm.tasks.classpath_entry import ClasspathEntry
from pants.base.build_environment import get_buildroot
from pants.engine.fs imp... | wisechengyi/pants | src/python/pants/backend/jvm/tasks/resources_task.py | Python | apache-2.0 | 4,664 |
# ===============================================================================
# Copyright 2011 Jake Ross
#
# 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/licens... | UManPychron/pychron | pychron/core/displays/__init__.py | Python | apache-2.0 | 790 |
# -*- coding: utf-8 -*-
"""
Authors: Tim Hessels
UNESCO-IHE 2017
Contact: t.hessels@unesco-ihe.org
Repository: https://github.com/wateraccounting/wa
Module: Function/Start
Those function download the data that is not downloaded yet
"""
import os
import glob
import pandas as pd
import numpy as np
import calend... | wateraccounting/wa | Functions/Start/Download_Data.py | Python | apache-2.0 | 27,119 |
"""
Management of PostgreSQL tablespace
===================================
A module used to create and manage PostgreSQL tablespaces.
.. code-block:: yaml
ssd-tablespace:
postgres_tablespace.present:
- name: indexes
- directory: /mnt/ssd-data
.. versionadded:: 2015.8.0
"""
import salt.... | saltstack/salt | salt/states/postgres_tablespace.py | Python | apache-2.0 | 6,780 |
#!/usr/bin/python
# Copyright 2014 Rogier van Dalen.
# 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... | rogiervd/utility | test/utility/python/test-std_function.py | Python | apache-2.0 | 1,524 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-08-20 14:01
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migratio... | kieranmathieson/feds | accounts/migrations/0001_initial.py | Python | apache-2.0 | 863 |
# -*- coding: utf-8 -*-
#
# Author: François Rossigneux <francois.rossigneux@inria.fr>
#
# 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
#
# Unles... | lpouillo/kwapi-g5k | kwapi/drivers/wattsup.py | Python | apache-2.0 | 2,850 |
"""
:copyright: Copyright 2017 by the SaltStack Team, see AUTHORS for more details.
:license: Apache 2.0, see LICENSE for more details.
salt.utils.versions
~~~~~~~~~~~~~~~~~~~
Version parsing based on distutils.version which works under python 3
because on python 3 you can no longer compare s... | saltstack/salt | salt/utils/versions.py | Python | apache-2.0 | 16,715 |
# Copyright 2020 The HuggingFace Team. 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 applicabl... | huggingface/transformers | tests/utils/test_file_utils.py | Python | apache-2.0 | 7,348 |
import zmq
import datetime
import logging
import yaml
from http_comp_env import HttpComputingEnvironmentProxy
from recommendation_manager import RecommendationManager
from util import timed_exec
from zmq_comp_env import ZmqComputingEnvironmentProxy
import os.path
from idomaar_environment import IdomaarEnvironment
from... | egbertbouman/idomaar | datastreammanager/orchestrator/main/orchestrator.py | Python | apache-2.0 | 14,245 |
# -*- 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... | googleapis/python-aiplatform | samples/generated_samples/aiplatform_generated_aiplatform_v1_tensorboard_service_delete_tensorboard_run_sync.py | Python | apache-2.0 | 1,626 |
#!/usr/bin/python
import time
import os
import commands
import RPi.GPIO as GPIO
import json
import sys
import smtplib
from email.encoders import encode_base64
from email.mime.base import MIMEBase
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
PARAMS = {
u"tz": "America/Los_A... | xxepictimexx/deer_camera | src/deer.py | Python | apache-2.0 | 5,339 |
# -*- coding: utf-8 -*-
import pandas as pd
from alphaware.base import FactorEstimator
class TopMinusBottom(FactorEstimator):
def __init__(self, quantiles=5):
super(TopMinusBottom, self).__init__()
self.quantiles = quantiles
def _top_minus_bottom_calc(self, score, fwd_return, tiaocang_date):... | iLampard/alphaware | alphaware/analyzer/top_minus_bottom.py | Python | apache-2.0 | 1,579 |
# -*- coding: utf-8 -*-
# @Author : Huangcc
from selenium import webdriver
browser = webdriver.Firefox()
browser.get('https://list.tmall.com/search_product.htm?q=%C3%C0%C4%EA%BD%A1%BF%B5&type=p&vmarket=&spm=875.7931836%2FB.a2227oh.d100&from=mallfp..pc_1_searchbutton')
html_source = browser.page_source
print h... | huangchuchuan/Spider | TMallCommentSpider/tmall_comment_selenium_spider.py | Python | apache-2.0 | 347 |
class nnetLayer(object):
def __init__(self, *args, **kwargs):
self.input = None
self.W = None
self.b = None
self.delta_W = None
self.delta_b = None | IITM-DONLAB/python-dnn | src/pythonDnn/layers/__init__.py | Python | apache-2.0 | 160 |
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 OpenStack Foundation
# Copyright 2012 Nebula, Inc.
# Copyright (c) 2012 X.commerce, a business unit of eBay Inc.
#
# Licensed under the Apach... | NeCTAR-RC/horizon | openstack_dashboard/api/nova.py | Python | apache-2.0 | 36,094 |
import asyncio
import traceback
import inspect
from collections.abc import Iterable
from itertools import groupby
from typing import Union, List, Any, Callable, Type
import time
import ray
from ray.actor import ActorHandle
from ray.async_compat import sync_to_async
from ray.serve.utils import (parse_request_item, _ge... | richardliaw/ray | python/ray/serve/backend_worker.py | Python | apache-2.0 | 17,021 |
# 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 unde... | stackforge/senlin | senlin/tests/unit/engine/actions/test_cluster_action.py | Python | apache-2.0 | 11,095 |
from flask.ext.login import LoginManager
from app.user.models import User
login_manager = LoginManager()
@login_manager.user_loader
def load_user(user_id):
return User.query.filter(User.id == int(user_id)).first()
| BugisDev/Capture-TheGepeng | app/user/loginmanager.py | Python | apache-2.0 | 220 |
#!/usr/bin/env python
import pika
connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost'))
channel = connection.channel()
channel.exchange_declare(exchange='helloworld', type='fanout')
# channel.exchange_declare(exchange='logs', type='fanout')
result = channel.queue_declare(exclusive=True)
q... | suthat/signal | clients/python/subscriber.py | Python | apache-2.0 | 687 |
import re, collections, time
from nltk import word_tokenize
class wp_node:
def __init__(self,wp='',is_active=False, parent=None):
self.node=wp
self.is_active=is_active
self.active_nodes=0
self.parent=parent
self.children=[]
"""equal methods implementation adapted from:
http://stackoverflow.c... | colmantse/InfoExtract | InfoExtract/bpe.py | Python | apache-2.0 | 6,927 |
"""Support to keep track of user controlled booleans for within automation."""
from __future__ import annotations
import logging
import voluptuous as vol
from homeassistant.const import (
ATTR_EDITABLE,
CONF_ICON,
CONF_ID,
CONF_NAME,
SERVICE_RELOAD,
SERVICE_TOGGLE,
SERVICE_TURN_OFF,
S... | kennedyshead/home-assistant | homeassistant/components/input_boolean/__init__.py | Python | apache-2.0 | 6,512 |
# Copyright 2013 Rackspace Australia
#
# 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 ... | devdattakulkarni/zuul_messaging | zuul/reporter/gerrit.py | Python | apache-2.0 | 1,914 |
# -*- coding: utf-8 -*-
__author__ = 'Aleksey Tanana'
from data.channels_generator import *
from nose import with_setup
from nose_config import *
from nose_parameterized import parameterized, param
def teardown_package():
global db, app, rest
print(__name__, '__init__.py : teardown_package() =================... | alazanman/py_epg_tests | tests/__init__.py | Python | apache-2.0 | 929 |
import unittest
from common import tests
from .. import create_db
class TestArgParser(unittest.TestCase):
def test_auth(self):
parser = create_db.build_arg_parser()
args = parser.parse_args(['auth'])
self.assertEqual(args.func, create_db.create_auth_db)
def test_cust_single(self):
... | ggerrietts/leadpipe | util/tests/test_create_db.py | Python | apache-2.0 | 1,731 |
# 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... | ntymtsiv/tempest | tempest/scenario/test_server_basic_ops.py | Python | apache-2.0 | 6,788 |
# -*- 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-notebooks | samples/generated_samples/notebooks_v1_generated_notebook_service_create_instance_sync.py | Python | apache-2.0 | 1,814 |
#!/usr/bin/env python
# Filename: util.py
'''
util
@author: Andrew Philpot
@version 0.79
collection of misc utils
Usage: python util.py
Options:
\t-h, --help:\tprint help to STDOUT and quit
\t-v, --verbose:\tverbose output
'''
import sys
import inspect
import types
import getopt
import fileinput
import tempfile
impo... | philpot/pymod | util3.py | Python | apache-2.0 | 55,255 |
import unittest
import pytest
from mock import MagicMock, call
from scanpointgenerator import CompoundGenerator, LineGenerator
from malcolm.core import PartRegistrar
from malcolm.modules.scanning.parts import ExposureDeadtimePart
def make_generator(duration):
line1 = LineGenerator("y", "mm", 0, 2, 3)
line2 ... | dls-controls/pymalcolm | tests/test_modules/test_scanning/test_exposuredeadtimepart.py | Python | apache-2.0 | 2,679 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ======================================================================
# Copyright 2017 Julien LE CLEACH
#
# 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 Lice... | julien6387/supvisors | supvisors/test/test_supervisor_177/check_procnums.py | Python | apache-2.0 | 4,036 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "corrigendum.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| zhaipro/corrigendum | corrigendum/manage.py | Python | apache-2.0 | 254 |
# Copyright 2020 Makani Technologies 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... | google/makani | gs/monitor2/apps/plugins/layouts/pilot_layout.py | Python | apache-2.0 | 889 |
try: # assume we are on production environment
from production_conf import *
except ImportError: # assume we are on developer environment
from developer_conf import *
| derdmitry/socraticqs2 | mysite/mysite/settings/__init__.py | Python | apache-2.0 | 175 |
# 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, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from copy ... | pgroudas/pants | src/python/pants/backend/core/wrapped_globs.py | Python | apache-2.0 | 7,412 |
import os
from flask_restful import Api
from app import app
basedir = os.path.abspath(os.path.dirname(__file__))
script_dir = os.path.dirname(__file__)
CSRF_ENABLED = True
SECRET_KEY = 'Replace_With_SecretKey'
api = Api(app)
| rkk09c/SayInterview | API/config.py | Python | apache-2.0 | 229 |
#!/usr/bin/env python
import re
import shlex
import string
import subprocess
import sys
from contextlib import contextmanager
from csv import QUOTE_NONE
from errno import ENOENT
from functools import wraps
from glob import iglob
from io import BytesIO
from os import environ
from os import extsep
from os import linesep
... | madmaze/pytesseract | pytesseract/pytesseract.py | Python | apache-2.0 | 14,639 |
#!/usr/bin/env python
#
# Copyright (C) 2008 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 req... | Ant-OS/android_build | tools/releasetools/ota_from_target_files.py | Python | apache-2.0 | 64,864 |
import bson.json_util
from bson.objectid import ObjectId
import json
from pymongo import MongoClient
CachedNodes = {'maxentries': 10000} # Set to None to disable
CheckedIndices = False
def freeze(rec):
return (str(rec["_id"]), rec["data"]["id"], bson.json_util.dumps(rec))
def process(frozen):
rec = json... | XDATA-Year-3/EntityAlignLarge | service/neighborhood.py | Python | apache-2.0 | 4,362 |
# 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... | tensorflow/addons | tensorflow_addons/optimizers/tests/cyclical_learning_rate_test.py | Python | apache-2.0 | 5,958 |
#! /usr/bin/env python
# coding:utf-8
"""html tag data"""
from lib.data import BaseXssData
class Tag(BaseXssData):
"""Html Tag"""
def __init__(self):
_data = [
'a',
'script',
'img',
'body',
'meta',
'h1',
'ul',
... | blue-bird1/xss_fuzz | data/tag.py | Python | apache-2.0 | 2,696 |
# -*- 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-pubsub | samples/generated_samples/pubsub_v1_generated_schema_service_get_schema_sync.py | Python | apache-2.0 | 1,404 |
# 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 | lib_common/src/d1_common/cert/subject_info.py | Python | apache-2.0 | 20,757 |
"""Functions to call lolo Merit classes, which describe the performance of a machine learning model
These are very similar to the "metrics" from scikit-learn, which is the reason for the name of this module.
"""
from lolopy.loloserver import get_java_gateway
from lolopy.utils import send_1D_array
import numpy as np
... | CitrineInformatics/lolo | python/lolopy/metrics.py | Python | apache-2.0 | 3,299 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | yongshengwang/builthue | apps/impala/src/impala/models.py | Python | apache-2.0 | 2,618 |
# Copyright 2018 - Nokia
#
# 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... | openstack/vitrage | vitrage/middleware/basic_and_keystone_auth.py | Python | apache-2.0 | 5,361 |
#!/usr/bin/env python
#
# Copyright 2013 Quantopian, 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 ... | lsbardel/zipline | setup.py | Python | apache-2.0 | 2,476 |
from .db import db
from .address import Address
from .cluster import Cluster
from .credentials_data import CredentialsData
from .disk import Disk
from .disk_partition import DiskPartition
from .mountpoint import Mountpoint
from .node import Node
from .provision import Provision
from .user import User
| nailgun/seedbox | src/seedbox/models/__init__.py | Python | apache-2.0 | 302 |
#!/usr/bin/env python
# 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... | thenetcircle/dino | test/validation/test_request_users_in_room.py | Python | apache-2.0 | 2,556 |
# 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... | kevin-zhaoshuai/zun | zun/common/utils.py | Python | apache-2.0 | 10,121 |
class Solution(object):
def bulbSwitch(self, n):
"""
:type n: int
:rtype: int
"""
return int((n + .5) ** .5)
| ckclark/leetcode | py/bulb-switcher.py | Python | apache-2.0 | 153 |
#!/usr/bin/env python
# Python imports
import math
# RadiaBeam imports
import radtrack.quadrature.RbGaussianQuadrature as gquad
# Functions defining the analytic electric and magnetic fields
# of a Gaussian 2D ellipse or 3D ellipsoid of charge.
# We assume the beam is moving along x with constant, positive
# ve... | radiasoft/radtrack | radtrack/spacecharge/RbGaussBunchSpaceCharge.py | Python | apache-2.0 | 8,108 |
import sys
import platform
def get_platform() -> str:
"""Get FMU binary platform folder name."""
system = platform.system()
is_64bits = sys.maxsize > 2 ** 32
platforms = {"Windows": "win", "Linux": "linux", "Darwin": "darwin"}
return platforms.get(system, "unknown") + "64" if is_64bits else "32"
... | idaholab/raven | framework/contrib/PythonFMU/pythonfmu/osutil.py | Python | apache-2.0 | 517 |
# Copyright 2008-2015 Nokia Solutions and Networks
#
# 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... | userzimmermann/robotframework | src/robot/model/modifier.py | Python | apache-2.0 | 2,093 |
"""
MariaDBLog - File ``/var/log/mariadb/mariadb.log``
==================================================
Module for parsing the log file for MariaDB
Typical content of ``mariadb.log`` file is::
161109 9:25:42 [Note] WSREP: Read nil XID from storage engines, skipping position init
161109 9:25:42 [Note] WSR... | PaulWay/insights-core | insights/parsers/mariadb_log.py | Python | apache-2.0 | 2,127 |
"""Defines the class for a cleanup task"""
from __future__ import unicode_literals
import datetime
from job.tasks.base_task import AtomicCounter
from job.tasks.node_task import NodeTask
from node.resources.node_resources import NodeResources
from node.resources.resource import Cpus, Mem
CLEANUP_TASK_ID_PREFIX = 'sc... | ngageoint/scale | scale/job/execution/tasks/cleanup_task.py | Python | apache-2.0 | 5,284 |