repo_name stringlengths 5 104 | path stringlengths 4 248 | content stringlengths 102 99.9k |
|---|---|---|
bigmlcom/python | bigml/predicates.py | # -*- coding: utf-8 -*-
#
# Copyright 2014-2022 BigML
#
# 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 ... |
edisonlz/fruit | web_project/base/site-packages/wi_model_util/idocument.py | #encoding = utf-8
import StringIO
import datetime, time
import os, sys
from mongoengine import Document
def queryset_2_dict(qs, key='id'):
""" Given a queryset will transform it into a dictionary based on ``key`` """
dic = {}
for q in qs:
value = q._data.get(key)
if value:
k = value.__d... |
tedwen/transmem | src/db/table2java.py | # python to generate Java data class based on tables.xml
# output: .java files in specified subdirectory
import sys, os, string, time, re
from xml.dom.minidom import parse
#to be used by classes to implement Serializable interface
serializableuid = 100
#def tabs(indent):
# return ''.join(['\t' for x in range(indent)... |
awslabs/chalice | chalice/config.py | import os
import sys
import json
from typing import Dict, Any, Optional, List, Union # noqa
from chalice import __version__ as current_chalice_version
from chalice.app import Chalice # noqa
from chalice.constants import DEFAULT_STAGE_NAME
from chalice.constants import DEFAULT_HANDLER_NAME
StrMap = Dict[str, Any]
... |
jiwanlimbu/aura | keystone/conf/kvs.py | # 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... |
qedi-r/home-assistant | homeassistant/components/vicare/water_heater.py | """Viessmann ViCare water_heater device."""
import logging
import requests
import simplejson
from homeassistant.components.water_heater import (
SUPPORT_TARGET_TEMPERATURE,
WaterHeaterDevice,
)
from homeassistant.const import TEMP_CELSIUS, ATTR_TEMPERATURE, PRECISION_WHOLE
from . import DOMAIN as VICARE_DOMAI... |
anthonylife/EventRecommendation | src/GeoBased/PY/train.py | #!/usr/bin/env python
#encoding=utf8
#Copyright [2014] [Wei Zhang]
#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 ... |
WiproOpenSourcePractice/galaxia | galaxia/gapi/controller/v1/alert.py | # Copyright 2016 - Wipro Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... |
wavefrontHQ/python-client | wavefront_api_client/models/paged_external_link.py | # coding: utf-8
"""
Wavefront REST API Documentation
<p>The Wavefront REST API enables you to interact with Wavefront servers using standard REST API tools. You can use the REST API to automate commonly executed operations such as automatically tagging sources.</p><p>When you make REST API calls outside the W... |
paddycarey/mopidy-webhooks | mopidy_webhooks/__init__.py | from __future__ import annotations
import pathlib
import pkg_resources
from mopidy import config, ext
__version__ = pkg_resources.get_distribution("Mopidy-Webhooks").version
class Extension(ext.Extension):
dist_name = "Mopidy-Webhooks"
ext_name = "webhooks"
version = __version__
def get_default_c... |
arenadata/ambari | ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/params_linux.py | """
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 use this ... |
c3nav/c3nav | src/c3nav/mapdata/migrations/0082_dynamiclocation_position.py | # Generated by Django 2.2.8 on 2019-12-27 12:51
import c3nav.mapdata.fields
import c3nav.mapdata.models.locations
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_depend... |
knowmetools/km-api | km_api/know_me/tests/views/test_accessor_accept_view.py | from unittest import mock
from rest_framework import status
from know_me import models, views
@mock.patch(
"know_me.views.DRYGlobalPermissions.has_object_permission", autospec=True
)
def test_check_object_permissions(
mock_dry_permissions, km_user_accessor_factory
):
"""
The view should check the pe... |
stackforge/senlin | senlin/objects/requests/nodes.py | # 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... |
lowRISC/opentitan | hw/ip/otbn/dv/otbnsim/test/testutil.py | # Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
import py
import os
import subprocess
import tempfile
from sim.load_elf import load_elf
from sim.standalonesim import StandaloneSim
OTBN_DIR = os.path.join(os.path.dirna... |
christopherjbly/google-calendar-gadget | build_package.py | import zipfile
PACKAGE_FILENAME = 'google-calendar-gadget.gg'
FILES = [
'addevent.js',
'addevent.xml',
'auth.js',
'cache.js',
'calendar.js',
'calendarevent.js',
'constants.js',
'errorMessage.js',
'eventdetails.js',
'eventdetails.xml',
'events.js',
'gadget.gmanifest',
'geocod... |
alexm2015/himsog | himsog/migrations/0006_auto_20161101_0009.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-11-01 00:09
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('himsog', '0005_auto_20161031_0608'),
]
operations = [
migrations.RemoveField(
... |
harinarayan/samyogam | recruit/models.py | from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Address(models.Model):
class Meta:
verbose_name_plural = "addresses"
line1 = models.CharField(max_length=70)
line2 = models.CharField(max_length=70, blank=True)
city = models.CharField(max_length=20)
state... |
cloudify-cosmo/cloudify-cli | cloudify_cli/commands/maintenance_mode.py | ########
# Copyright (c) 2014 GigaSpaces Technologies Ltd. All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... |
our-city-app/oca-backend | src-test/test/shop/test_service.py | # -*- 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... |
cwilli34/smartcontainers | docs/conf.py | # -*- coding: utf-8 -*-
#
# SmartContainers documentation build configuration file, created by
# sphinx-quickstart on Wed Jul 29 10:48:52 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated fil... |
cdumay/flask-tat | src/flask_tat/base.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
.. codeauthor:: Cédric Dumay <cedric.dumay@gmail.com>
"""
from flask.blueprints import Blueprint
from cdumay_rest_client.client import RESTClient
class BaseTATClient(object):
def __init__(self, app=None):
self.app = None
self.blueprint = None
... |
bbertka/mitrend-flask | test.py | #!/usr/bin/python
import json, sys
import requests
# Enter you MiTrend user name and password
username = ''
password = ''
# Your submission parameters
assessment_name = 'Test Assessment'
company = 'EMC'
city = 'Franklin'
country = 'United States'
state = 'MA'
timezone = 'US Eastern'
tags = ['tag1', 'tag2']
files = [... |
dbentley/pants | tests/python/pants_test/jvm/nailgun_task_test_base.py | # 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)
from pants.backend.j... |
abusse/cinder | cinder/tests/api/contrib/test_volume_transfer.py | # Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
# 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/LICEN... |
comic/comic-django | app/grandchallenge/profiles/serializers.py | from django_countries.serializer_fields import CountryField
from rest_framework import serializers
from rest_framework.fields import URLField
from grandchallenge.evaluation.serializers import UserSerializer
from grandchallenge.profiles.models import UserProfile
class UserProfileSerializer(serializers.ModelSerializer... |
tensorflow/datasets | tensorflow_datasets/core/utils/image_utils.py | # coding=utf-8
# Copyright 2022 The TensorFlow Datasets 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 appl... |
malmiron/incubator-airflow | tests/api/common/experimental/test_mark_tasks.py | # -*- 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
#... |
bobjects/BobStack | bobstack/sipmessaging/concreteheaderfields/pCalledPartyIdSIPHeaderField.py | try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from ...sipmessaging import SIPHeaderField
from ...sipmessaging import classproperty
class PCalledPartyIdSIPHeaderField(SIPHeaderField):
# noinspection PyNestedDecorators
@classproperty
@classmethod
def canon... |
WillSams/CustomerOrders-ASPNET-WebForms-VB | tests.py | import unittest
import sys
import os
sys.path.append(os.getcwd() + '\\src\\bin')
import System
import clr
clr.AddReferenceByPartialName("System.Core")
clr.AddReferenceByPartialName("System.Configuration")
from System.Configuration import *
from System.Collections import IDictionary
from System.Collections.Generic im... |
scrapinghub/deimos | deimos/mesos.py | import json
from deimos._struct import _Struct
class Launch(_Struct):
def __init__(self, proto):
if (proto.task_info.command.value and
proto.task_info.command.value.startswith('{')):
# Hack by duendex. The command is in fact a serialized json
# containing the Docker im... |
rwightman/tensorflow-litterbox | utils/compare_csv.py | import argparse
import numpy as np
import pandas as pd
def calc_rmse(predictions, targets):
mse = ((predictions - targets) ** 2).mean()
rmse = np.sqrt(mse)
return rmse, mse
def main():
parser = argparse.ArgumentParser()
parser.add_argument('files', metavar='filename', type=str, nargs='*')
ar... |
turbokongen/home-assistant | homeassistant/components/rfxtrx/__init__.py | """Support for RFXtrx devices."""
import asyncio
import binascii
from collections import OrderedDict
import copy
import functools
import logging
import RFXtrx as rfxtrxmod
import async_timeout
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.components.binary_sensor import DEVICE_C... |
fs714/sqlalchemy-example | db_update.py | import logging
from db_objects import Story, User, Task
from db_session import session
logging.basicConfig()
logger = logging.getLogger("db_query")
logger.setLevel(logging.DEBUG)
def query_task():
task = (session.query(Task).join(Story).join(User)
.filter(Story.story_title == 'Story 001')
... |
GoogleCloudPlatformTraining/cp100-bookshelf | cloud-storage/bookshelf/storage.py | # 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, ... |
vatjjar/TundraWorldGenerator | TXMLOutput.py | #!/usr/bin/python
#
# Author: Jarkko Vatjus-Anttila <jvatjusanttila@gmail.com>
#
# For conditions of distribution and use, see copyright notice in license.txt
#
import sys, os
class TXMLOutput():
""" class TXMLOutput(): I/O component for writing formatted TXML notation
"""
def __init__(self):
self... |
evernym/plenum | plenum/server/request_handlers/handler_interfaces/write_request_handler.py | from abc import ABCMeta, abstractmethod
from typing import Optional
from plenum.common.constants import CONFIG_LEDGER_ID, VALID_LEDGER_IDS
from common.exceptions import LogicError
from plenum.common.exceptions import InvalidClientRequest
from plenum.server.database_manager import DatabaseManager
from plenum.server.re... |
gkc1000/pyscf | pyscf/prop/polarizability/rhf.py | #!/usr/bin/env python
# Copyright 2014-2019 The PySCF Developers. 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
#
# U... |
shiblon/pytour | tutorials/generators.py | # vim:tw=50
"""Generators
It's head-exploding time!
We recently wrote a function that, given lines
with dates and measurements, splits them up,
makes sure they only move forward, and prints them
out.
Printing is nice, but not impressively useful or
exciting. We want to _transform_ this data
(eventually into a chart... |
UnrememberMe/pants | src/python/pants/backend/jvm/tasks/jvm_dependency_check.py | # 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 colle... |
felixbb/forseti-security | google/cloud/security/inventory/inventory_loader.py | # 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, s... |
google-research/google-research | graph_sampler/tests/graph_io_test.py | # 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... |
GoogleCloudPlatform/python-compat-runtime | appengine-compat/exported_appengine_sdk/google/appengine/tools/xml_parser_utils.py | #!/usr/bin/env python
#
# Copyright 2007 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 o... |
postlund/home-assistant | tests/components/homematicip_cloud/test_light.py | """Tests for HomematicIP Cloud light."""
from homematicip.base.enums import RGBColorState
from homeassistant.components.homematicip_cloud import DOMAIN as HMIPC_DOMAIN
from homeassistant.components.homematicip_cloud.light import (
ATTR_CURRENT_POWER_W,
ATTR_TODAY_ENERGY_KWH,
)
from homeassistant.components.lig... |
MatthewWilkes/mw4068-packaging | src/melange/src/soc/models/base.py | #!/usr/bin/env python2.5
#
# Copyright 2008 the Melange 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 appl... |
tommyip/zulip | zerver/tornado/event_queue.py | # See https://zulip.readthedocs.io/en/latest/subsystems/events-system.html for
# high-level documentation on how this system works.
from typing import cast, AbstractSet, Any, Callable, Dict, List, \
Mapping, MutableMapping, Optional, Iterable, Sequence, Set, Union
from typing_extensions import Deque, TypedDict
fro... |
Unicorn-rzl/pretix | src/pretix/control/views/orders.py | from itertools import groupby
from django.contrib import messages
from django.db.models import Count, Q
from django.utils.timezone import now
from django.utils.translation import ugettext_lazy as _
from django.http import HttpResponse
from django.shortcuts import redirect, render
from django.utils.functional import ca... |
apple/swift-llbuild | products/ui/llbuildui/model.py | import struct
from sqlalchemy import *
from sqlalchemy.orm import relation, relationship
from sqlalchemy.ext.declarative import declarative_base
# DB Declaration
Base = declarative_base()
class KeyName(Base):
__tablename__ = "key_names"
id = Column(Integer, nullable=False, primary_key=True)
name = Colu... |
Yangqing/caffe2 | caffe2/contrib/playground/resnet50demo/IN1k_resnet50.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
from caffe2.python import workspace, cnn, core
from caffe2.python import timeout_guard
from caffe2.proto import caffe2_pb2
def init_model(self):
... |
sander76/home-assistant | homeassistant/components/zwave_js/config_flow.py | """Config flow for Z-Wave JS integration."""
from __future__ import annotations
from abc import abstractmethod
import asyncio
import logging
from typing import Any
import aiohttp
from async_timeout import timeout
import voluptuous as vol
from zwave_js_server.version import VersionInfo, get_server_version
from homeas... |
fras2560/mlsb-platform | api/test/testValidators.py | '''
@author: Dallas Fraser
@author: 2019-02-04
@organization: MLSB API
@summary: Tests all the validators functions
'''
import unittest
from pprint import PrettyPrinter
from api.validators import gender_validator, boolean_validator,\
int_validator, string_validator,\
date_validator, time_validator,\
... |
HewlettPackard/oneview-redfish-toolkit | oneview_redfish_toolkit/api/vlan_network_interface.py | # -*- coding: utf-8 -*-
# Copyright (2018) Hewlett Packard Enterprise Development LP
#
# 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... |
tensorflow/privacy | tensorflow_privacy/privacy/analysis/dp_event.py | # Copyright 2021, The TensorFlow Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... |
imshashank/aws-doc-sdk-examples | python/example_code/sqs/delete_queue.py | # Copyright 2010-2017 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file ac... |
egtaonline/GameAnalysis | sphinx/conf.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Game Analysis documentation build configuration file, created by
# sphinx-quickstart on Tue Oct 11 11:15:47 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in thi... |
JiscPER/jper-oaipmh | config/service.py | """
Main configuration file for the application
On deployment, desired configuration can be overridden by the provision of a local.cfg file
"""
##################################################
# overrides for the webapp deployment
DEBUG = True
"""is the web server in debug mode"""
PORT = 5030
"""port to start the... |
peitur/sys-util | lib/proc/Process.py | import sys,os,re,traceback
from os.path import isfile, join
from pprint import pprint
############# CONSTANTS
PROCINFO_DIR="/proc"
PROCINFO_FILE="status"
PROCINFO_FIELDS={
"Name": { 'type':"string" },
"State": { 'type':"list" },
"Tgid": { 'type':"int" },
"Ngid": { 'type':"int" },
"Pid": { 'type':"... |
memodir/cv | src/profile/forms.py | # -*- coding: utf-8 -*-
import logging
from django import forms
from django.contrib.auth import get_user_model
from django.utils.translation import gettext_lazy as _
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit
from profile.models import Profile
logger = logging.getLogger(__na... |
jamespcole/home-assistant | homeassistant/components/android_ip_webcam/sensor.py | """Support for Android IP Webcam sensors."""
from homeassistant.helpers.icon import icon_for_battery_level
from . import (
CONF_HOST, CONF_NAME, CONF_SENSORS, DATA_IP_WEBCAM, ICON_MAP, KEY_MAP,
AndroidIPCamEntity)
DEPENDENCIES = ['android_ip_webcam']
async def async_setup_platform(
hass, config, asy... |
hammertoe/didactic-spork | gameserver/main.py | import logging.config
import os
from flask import Flask, Blueprint, request
import connexion
import settings
from database import get_db
log = logging.getLogger(__name__)
def configure_app(flask_app):
flask_app.config['SWAGGER_UI_DOC_EXPANSION'] = settings.RESTPLUS_SWAGGER_UI_DOC_EXPANSION
flask_app.config... |
crutcha/Manageengine-netflow-api-wrapper | docs/conf.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# ManageEngine Netflow API documentation build configuration file, created by
# sphinx-quickstart on Fri Dec 9 14:37:51 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are pre... |
ponyorm/pony | pony/orm/tests/test_bug_170.py | import unittest
from pony import orm
from pony.orm.tests import setup_database, teardown_database
db = orm.Database()
class Person(db.Entity):
id = orm.PrimaryKey(int, auto=True)
name = orm.Required(str)
orm.composite_key(id, name)
class Test(unittest.TestCase):
@classmethod
def setUpClass(cls... |
lstorchi/pca_fit | utilities/estimate_eta_linear.py | import numpy
import math
import sys
import re
from scipy import stats
####################################################################
def file_len(fname):
with open(fname) as f:
for i, l in enumerate(f):
pass
return i + 1
####################################################################
f... |
runcom/flocker | flocker/node/test/test_deploy.py | # Copyright Hybrid Logic Ltd. See LICENSE file for details.
"""
Tests for ``flocker.node._deploy``.
"""
from uuid import uuid4
from eliot.testing import validate_logging
from ipaddr import IPAddress
from pyrsistent import pset, pvector
from twisted.internet.defer import fail, FirstError, succeed, Deferred
from t... |
mlperf/training_results_v0.6 | Fujitsu/benchmarks/resnet/implementations/mxnet/3rdparty/tvm/topi/python/topi/generic/injective.py | # pylint: disable=invalid-name
"""generic declaration and schedules."""
from __future__ import absolute_import as _abs
import tvm
@tvm.target.override_native_generic_func("schedule_injective")
def schedule_injective(outs):
"""Schedule for injective op.
Parameters
----------
outs: Array of Tensor
... |
openconfig/gnmi | proto/collector/collector_pb2_grpc.py | # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
from proto.collector import collector_pb2 as proto_dot_collector_dot_collector__pb2
class CollectorStub(object):
"""Missing associated documentation commen... |
stesh/porick-flask | porick/views.py | import bcrypt
import datetime
import hashlib
import math
from collections import defaultdict
from flask import (
abort, render_template, flash, g, request, redirect, make_response, url_for)
from . import app
from .lib import current_page, authenticate, authenticated_endpoint, validate_signup, create_user, hash_p... |
Matir/pwnableweb | pwntalk/views.py | # Copyright 2014 David Tomaschik <david@systemoverlord.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 applic... |
zstackio/zstack-woodpecker | zstackwoodpecker/zstackwoodpecker/test_util.py | #coding:utf-8
'''
@author: Frank
'''
import os
import time
import string
import sys
import traceback
import string
import pkgutil
import copy
import zstacklib.utils.xmlobject as xmlobject
import apibinding.inventory as inventory
import zstackwoodpecker.action_select as action_select
minus_split = '-'*10 + '\n'
acti... |
googleapis/python-bigquery-connection | samples/generated_samples/bigqueryconnection_v1_generated_connection_service_create_connection_sync.py | # -*- 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... |
trevor/calendarserver | twistedcaldav/memcacheprops.py | ##
# Copyright (c) 2009-2014 Apple Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, mod... |
hesseltuinhof/mxnet | python/mxnet/gluon/rnn/rnn_layer.py | # coding: utf-8
# pylint: disable=no-member, invalid-name, protected-access, no-self-use
# pylint: disable=too-many-branches, too-many-arguments, no-self-use
# pylint: disable=too-many-lines, arguments-differ
"""Definition of various recurrent neural network layers."""
from __future__ import print_function
from ... im... |
jawilson/home-assistant | tests/components/mqtt/test_sensor.py | """The tests for the MQTT sensor platform."""
import copy
from datetime import datetime, timedelta
import json
from unittest.mock import patch
import pytest
from homeassistant.components.mqtt.sensor import MQTT_SENSOR_ATTRIBUTES_BLOCKED
import homeassistant.components.sensor as sensor
from homeassistant.const import ... |
google-research/pddm | setup.py | # 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-research/scenic | scenic/projects/baselines/bert/configs/glue/glue_common.py | """BERT Common configurations."""
import ml_collections
EMBEDDING_WIDTH = {'Ti': 128, 'S': 128, 'B': 768, 'L': 1024}
HIDDEN_SIZE = {'Ti': 128, 'S': 256, 'B': 768, 'L': 1024}
NUM_HEADS = {'Ti': 2, 'S': 4, 'B': 12, 'L': 16}
MLP_DIM = {'Ti': 512, 'S': 1024, 'B': 3072, 'L': 4096}
NUM_LAYERS = {'Ti': 6, 'S': 12, 'B': 12, ... |
mezz64/home-assistant | homeassistant/helpers/config_validation.py | """Helpers for config validation using voluptuous."""
from __future__ import annotations
from collections.abc import Callable, Hashable
import contextlib
from datetime import (
date as date_sys,
datetime as datetime_sys,
time as time_sys,
timedelta,
)
from enum import Enum
import inspect
import logging... |
fabregas/aiokafka | aiokafka/message_accumulator.py | import io
import asyncio
import collections
from kafka.common import (KafkaError,
KafkaTimeoutError,
NotLeaderForPartitionError,
LeaderNotAvailableError)
from kafka.producer.buffer import MessageSetBuffer
from kafka.protocol.message import M... |
pureelk/pureelk | container/worker/pureelk/store.py | import json
import os
import urllib
from pureelk.arraycontext import ArrayContext
STATE_FILE = ".pureelk.arrays.state"
class Store(object):
def __init__(self, path, logger):
"""
Store class for saving and loading of states
The current implementation is file-based since the data set is ti... |
MissionCriticalCloud/marvin | marvin/cloudstackAPI/updateLBStickinessPolicy.py | """Updates load balancer stickiness policy"""
from baseCmd import *
from baseResponse import *
class updateLBStickinessPolicyCmd (baseCmd):
typeInfo = {}
def __init__(self):
self.isAsync = "true"
"""id of lb stickiness policy"""
"""Required"""
self.id = None
self.typeI... |
osrf/rosbook | code/basics/src/simple_action_server.py | #! /usr/bin/env python
# BEGIN ALL
#! /usr/bin/env python
import rospy
# BEGIN PART_1
import time
import actionlib
from basics.msg import TimerAction, TimerGoal, TimerResult
# END PART_1
# BEGIN PART_2
def do_timer(goal):
start_time = time.time()
time.sleep(goal.time_to_wait.to_sec())
# END PART_2
# B... |
shashikiranrp/tabulate.py | tabulate/t_print.py | #!/usr/bin/python
from model import Table
def t_print(table, \
table_name = None, \
footer_str = None, \
corner = '+', \
column_sep = '|', \
row_sep = '-', \
box_width = 0, \
col_width_adjust = 2, \
title_row_sep = '=', \
... |
NaohiroTamura/python-ironicclient | ironicclient/tests/functional/test_json_response.py | # Copyright (c) 2016 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 writin... |
chris-martin/hocon-python | hocon/ConfigMergeable.py | class ConfigMergeable(object):
"""
public interface ConfigMergeable
* Marker for types whose instances can be merged, that is {@link Config} and
* {@link ConfigValue}. Instances of {@code Config} and {@code ConfigValue} can
* be combined into a single new instance using the
* {@link ConfigM... |
HighwayFlocking/HighwayFlocking | controller/remote.py | #! python
#coding: utf-8
# Copyright 2015 Sindre Ilebekk Johansen and Andreas Sløgedal Løvland
# 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.... |
senarvi/senarvi-speech | cluster-dictionary/editpartitioning.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# A class that finds a partitioning of two strings into substrings that represent
# the fixed or changed parts between the strings.
class EditPartitioning:
class FixedSubstring:
def __init__(self, element):
self.sequence = str(element)
def append(self, element)... |
william-richard/moto | tests/test_ec2/test_spot_fleet.py | from __future__ import unicode_literals
import boto3
import sure # noqa
from moto import mock_ec2
from moto.core import ACCOUNT_ID
from tests import EXAMPLE_AMI_ID
def get_subnet_id(conn):
vpc = conn.create_vpc(CidrBlock="10.0.0.0/16")["Vpc"]
subnet = conn.create_subnet(
VpcId=vpc["VpcId"], CidrBlo... |
putcn/Paddle | python/paddle/fluid/tests/unittests/parallel_executor_test_base.py | # Copyright (c) 2018 PaddlePaddle 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 appli... |
openstack/ironic-inspector | ironic_inspector/test/unit/test_plugins_local_link_connection.py | # 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... |
bigswitch/neutron | neutron/tests/functional/scheduler/test_dhcp_agent_scheduler.py | # Copyright (c) 2015 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... |
wubo0067/protobuf-tools | proto_2_struct/proto2struct.py | #! /usr/bin/python
#coding=utf-8
# Protobuf 2 C Struct
# Copyright (c) 2015, calmwu
# All rights reserved.
# Email: wubo0067@hotmail.com
import sys
import os
import getopt
import pdb
import time
import shutil
from google.protobuf import descriptor
from google.protobuf import message
from google.protobuf import refle... |
rhyolight/nupic.son | app/soc/modules/gci/models/profile.py | # Copyright 2011 the Melange 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 wr... |
rwl/muntjac | muntjac/demo/sampler/features/windows/SubwindowSizedExample.py |
from muntjac.api import VerticalLayout, Window, Label, Button, Alignment
from muntjac.ui.button import IClickListener
class SubwindowSizedExample(VerticalLayout):
def __init__(self):
super(SubwindowSizedExample, self).__init__()
# Create the window
self._subwindow = Window('A sized subw... |
google/xi-editor | python/bracket_example.py | #!/usr/bin/env python3
# Copyright 2017 The xi-editor 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 applic... |
funasoul/visualizeSBML | cgi-bin/sbml2json.py | #!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# -*- coding: utf-8 -*-
#
# Last modified: Fri, 22 Sep 2017 19:15:19 +0900
#
import json
import sys
from libsbml import *
# List of objects
sbml_json = []
def check_name_duplicated(model):
name_duplicated = False
name_dic = {}
for s in model.getListOf... |
jeffreyzhang/devtool | devtool/settings.py | """
Django settings for devtool project.
Generated by 'django-admin startproject' using Django 1.10.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os
... |
h3biomed/eggo | test/jenkins/test_results.py | # Licensed to Big Data Genomics (BDG) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The BDG licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file ... |
pombredanne/cliques | poll/models.py | from django.db import models
from django import forms
from website.utils import detect_content_type
from website.models import UserProfile, Category
FREQUENCY_CHOICES = (('daily', 'daily'), ('once', 'once'))
class Poll(models.Model):
title = models.CharField(max_length=255)
stub = models.CharField(max_length... |
superphy/backend | app/modules/pan_spfy.py | #!/usr/bin/env python2
# -*- coding: UTF-8 -*-
import os
import redis
import config
from flask import current_app
# Redis Queue
from redis import Redis
from rq import Queue
# other libraries for rdflib
from rdflib import Graph
from modules.qc.qc import qc
from middleware.blazegraph.reserve_id import reserve_id
fr... |
mdempsky/ninja | platform_helper.py | #!/usr/bin/env python
# Copyright 2011 Google Inc.
# Copyright 2013 Patrick von Reth <vonreth@kde.org>
# 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://ww... |
Onager/l2treviewtools | setup.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""Installation and deployment script."""
from __future__ import print_function
import sys
try:
from setuptools import find_packages, setup
except ImportError:
from distutils.core import find_packages, setup
try:
from distutils.command.bdist_msi import bdist_msi
except... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.