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 |
|---|---|---|---|---|---|
#from apetools.commands.ifconfig import IfconfigCommand
#from apetools.commands.iwconfig import Iwconfig
from apetools.commons.enumerations import OperatingSystem
from apetools.devices.basedevice import BaseDevice
from apetools.commons.errors import ConfigurationError
class IosDevice(BaseDevice):
"""
A class... | rsnakamura/oldape | apetools/devices/iosdevice.py | Python | apache-2.0 | 3,060 |
from tornado.web import HTTPError
from biothings.www.api.es.handlers.base_handler import BaseESRequestHandler
from biothings.www.api.es.transform import ScrollIterationDone
from biothings.www.api.es.query import BiothingScrollError, BiothingSearchError
from biothings.www.api.helper import BiothingParameterTypeError
fro... | SuLab/biothings.api | biothings/www/api/es/handlers/query_handler.py | Python | apache-2.0 | 15,331 |
from kfp.components import InputPath, OutputPath, create_component_from_func
def catboost_train_classifier(
training_data_path: InputPath('CSV'),
model_path: OutputPath('CatBoostModel'),
starting_model_path: InputPath('CatBoostModel') = None,
label_column: int = 0,
loss_function: str = 'Logloss',
... | kubeflow/pipelines | components/contrib/CatBoost/Train_classifier/from_CSV/component.py | Python | apache-2.0 | 3,545 |
# -*- coding: utf-8 -*-
import tensorflow as tf
import numpy as np
# Parameters
# ==================================================
# Data Parameters
# tf.flags.DEFINE_string("positive_data_file", "./data/rt-polaritydata/rt-polarity.pos", "Data source for the positive data.")
# tf.flags.DEFINE_string("negative_data... | kevinlee9/cnn-text-classification-tf | load.py | Python | apache-2.0 | 1,773 |
from threepio import logger
from django.core.exceptions import ValidationError
from core.models import IdentityMembership, Identity
from core.models.quota import (
has_floating_ip_count_quota,
has_port_count_quota,
has_instance_count_quota,
has_cpu_quota,
has_mem_quota,
has_storage_quota,
... | CCI-MOC/GUI-Backend | service/quota.py | Python | apache-2.0 | 8,295 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-06-24 08:11
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 = [
migration... | GroSte/feumgmt | base/migrations/0001_initial.py | Python | apache-2.0 | 8,391 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2010-2012 Cidadania S. Coop. Galega
#
# This file is part of e-cidadania.
#
# e-cidadania is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Licen... | cidadania/e-cidadania | tests/unit_tests/src/apps/ecidadania/debate/test_views.py | Python | apache-2.0 | 12,418 |
# sAsync:
# An enhancement to the SQLAlchemy package that provides persistent
# item-value stores, arrays, and dictionaries, and an access broker for
# conveniently managing database access, table setup, and
# transactions. Everything can be run in an asynchronous fashion using
# the Twisted framework and its deferred ... | edsuom/sAsync | sasync/test/test_items.py | Python | apache-2.0 | 12,595 |
#
# Copyright 2014 Shahriyar Amini
#
# 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 wri... | samini/gort-public | Source/Squiddy/src/tema-android-adapter-3.2-sma/AndroidAdapter/adbcommands.py | Python | apache-2.0 | 11,424 |
__author__ = 'Danyang'
fib = lambda n : reduce(lambda x, n: [x[1], x[0]+x[1]], xrange(n), [0, 1])[0] | idf-archive/OneLinerPython | Fibonacci.py | Python | apache-2.0 | 101 |
# Copyright (c) 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 required by applicable law or agreed to in writ... | rnirmal/savanna | savanna/utils/openstack/keypairs.py | Python | apache-2.0 | 933 |
## @package net_printer
# Module caffe2.python.net_printer
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.proto.caffe2_pb2 import OperatorDef, NetDef
from caffe2.python.checkpoint import Job
from caffe2.py... | xzturn/caffe2 | caffe2/python/net_printer.py | Python | apache-2.0 | 12,712 |
from panda3d.core import *
from panda3d.direct import *
from direct.gui.DirectGui import *
from toontown.toonbase import TTLocalizer
from toontown.toonbase import ToontownGlobals
from MakeAToonGlobals import *
from direct.directnotify import DirectNotifyGlobal
from direct.interval.IntervalGlobal import *
import random
... | silly-wacky-3-town-toon/SOURCE-COD | toontown/makeatoon/ShuffleButton.py | Python | apache-2.0 | 5,969 |
#!/usr/bin/env python3
# Copyright 2021 The Kubernetes 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... | monopole/test-infra | hack/analyze-memory-profiles.py | Python | apache-2.0 | 5,404 |
#!/usr/bin/env python3
"""
Adds participant metadata to a given tabular data file for those sessions.
"""
__author__ = "Todd Shore <errantlinguist+github@gmail.com>"
__copyright__ = "Copyright 2018 Todd Shore"
__license__ = "Apache License, Version 2.0"
import argparse
import csv
import os
import sys
from typing imp... | errantlinguist/tangrams-analysis | add_tabular_participant_metadata.py | Python | apache-2.0 | 4,239 |
# Copyright 2015 Palo Alto Networks, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | PaloAltoNetworks/minemeld-core | tests/test_ft_st.py | Python | apache-2.0 | 8,708 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
__author__ = 'Andreas Bader'
__version__ = "0.01"
# db_folders -> List of DB Folder (for space check)
# db_client -> name of ycsb client
# db_args -> special ycsb arguments for this db
# db_name -> name of this db (e.g. for workload file)
# db_desc -> more detailed name/... | TSDBBench/Overlord | vagrant_files/generator/files/databases/opentsdb_cl5_rf1.py | Python | apache-2.0 | 6,981 |
import numpy as np
def array_generator():
array = np.array([(1, 2, 3, 4, 5), (10, 20, 30, 40, 50)])
return array
def multiply_by_number(array, number):
print(array)
multiplied = array * number
print(multiplied)
return multiplied
def divide_by_number(array, number):
# Either the numer or the elements of the a... | arcyfelix/Courses | 17-06-05-Machine-Learning-For-Trading/25_arithmetic operations.py | Python | apache-2.0 | 1,058 |
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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 ... | polyaxon/polyaxon | core/polyaxon/managers/project.py | Python | apache-2.0 | 1,363 |
import os
import pytest
from pycdstar.config import Config
@pytest.fixture
def cfg_path(tmpdir):
return str(tmpdir.join('.config', 'config.ini'))
def test_new_config(cfg_path):
assert not os.path.exists(cfg_path)
Config(cfg=cfg_path)
assert os.path.exists(cfg_path)
def test_existing_config(confi... | clld/pycdstar | tests/test_config.py | Python | apache-2.0 | 454 |
from client import Blueflood, Datapoint
from utils import time_in_ms
import pprint
auth_url = 'https://identity.api.rackspacecloud.com/v2.0/'
apikey = '0e688a460988337e0e759524a2ccfc33'
username = 'privateclouddevs'
client = Blueflood(auth_url=auth_url, apikey=apikey, username="privateclouddevs")
point = {
'col... | absalon-james/python-blueflood | bluefloodclient/main.py | Python | apache-2.0 | 709 |
# Copyright 2014 Rackspace
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | openstack/octavia | octavia/db/migration/alembic_migrations/versions/4c094013699a_update_load_balancer_amphora.py | Python | apache-2.0 | 1,475 |
# Copyright 2012 OpenStack LLC.
# All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | redhat-openstack/python-neutronclient | quantumclient/tests/unit/test_casual_args.py | Python | apache-2.0 | 2,739 |
import ble
import mqtt
from config import *
try:
ble.start()
mqtt.start()
finally:
#notify MQTT subscribers that gateway is offline
mqtt.publish(TOPIC_PREFIX, "offline")
ble.stop()
| blassphemy/mqtt-ble-gateway | main.py | Python | apache-2.0 | 208 |
# Copyright 2018 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,... | google/differentiable-atomistic-potentials | dap/tests/test_tf_neighborlist.py | Python | apache-2.0 | 10,324 |
from scraper import *
WD2_url = "http://www.cms-ud.com/UD/table/WD2.htm"; crit_name_WD2 = "WD2/"
WD2_list = find_urls(url=WD2_url,crit_name=crit_name_WD2)
for url in WD2_list:
try:
url = url.replace('^','%5E')
url = "http://www.cms-ud.com/UD/table/"+url
design = find_design(url)
#pr... | HAOYU-LI/UniDOE | Scraper/WD2.py | Python | apache-2.0 | 590 |
#!/usr/bin/env python
# Copyright 2014 RPiPasswordGenerator
# file: auth.py
# This file just needs to be run.
import tweepy
import sys
CONSUMER_KEY = 'aLrazWkhGaRyLe30HWZcCJrnN'
CONSUMER_SECRET = 'jNSbrJ9TkOobJTbzL4bfd7CWg5x0kv6KMLCZKO5FRAMdIaFvmK'
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.sec... | RPiPasswordGenerator/Twitter-Password-Generator-for-Python | auth.py | Python | apache-2.0 | 672 |
# Copyright 2021 The Meson development team
# SPDX-license-identifier: Apache-2.0
from __future__ import annotations
import re
import os
import typing as T
from ...mesonlib import version_compare
from ...interpreterbase import (
ObjectHolder,
MesonOperator,
FeatureNew,
typed_operator,
noArgsFlatt... | mesonbuild/meson | mesonbuild/interpreter/primitives/string.py | Python | apache-2.0 | 6,549 |
#!/usr/bin/env python
#
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | googleads/googleads-python-lib | examples/ad_manager/v202202/proposal_line_item_service/get_all_proposal_line_items.py | Python | apache-2.0 | 1,904 |
#!/usr/bin/env python
# Author : Pierre Schnizer
"""
This module describes routines for computing Chebyshev
approximations to univariate functions. A Chebyshev approximation is a
truncation of the series \M{f(x) = S{sum} c_n T_n(x)}, where the Chebyshev
polynomials \M{T_n(x) = cos(n \arccos x)} provide an orthogonal ... | poojavade/Genomics_Docker | Dockerfiles/gedlab-khmer-filter-abund/pymodules/python2.7/lib/python/pygsl/chebyshev.py | Python | apache-2.0 | 6,561 |
from django.conf.urls import patterns, url
from users import views
urlpatterns = patterns(
'users.views',
url(
regex=r'^$',
view='login',
name='basic_urls',
),
url(
regex=r'^login/$',
view='login',
name='basic_urls',
),
url(
regex=r'^save/$',
... | Tooskich/python_core | users/urls.py | Python | apache-2.0 | 468 |
__author__ = 'Sarath'
from pyNN import *
import time
from pyNN.optimization.optimization import *
from pyNN.util.Initializer import *
import pickle
class DeepCorrNet2(object):
def init(self, numpy_rng, theano_rng=None, l_rate=0.01, optimization="sgd", tied=False, n_visible_left=None, n_visible_right=None, n_hidd... | apsarath/pyNN | model/crl/deepcorrnet2.py | Python | apache-2.0 | 24,479 |
# Copyright 2017 Huawei Technologies Co.,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
#
# Unl... | openstack/nomad | cyborg/tests/unit/api/controllers/v1/test_fpga_program.py | Python | apache-2.0 | 2,179 |
#!/bin/env python
# mainly for sys.argv[], sys.argv[0] is the name of the program
import sys
import time
# mainly for arrays
import numpy as np
# Time the following methods
def a():
print 'hello'
def b():
print 'hi'
if __name__ == '__main__':
print 'hello'
| ketancmaheshwari/hello-goog | src/python/timeit.py | Python | apache-2.0 | 276 |
#!/usr/bin/env python
# encoding: utf-8
"""Verify that all OSF Storage files have Glacier backups and parity files,
creating any missing backups.
TODO: Add check against Glacier inventory
Note: Must have par2 installed to run
"""
import os
import logging
import pyrax
from boto.glacier.layer2 import Layer2
from pyra... | kushG/osf.io | scripts/osfstorage/files_audit.py | Python | apache-2.0 | 4,698 |
from django.conf.urls import url, include
from django.contrib.auth.decorators import login_required
from .views import *
urlpatterns = [
# Listado
url(r'^evaluacion-lista/', login_required(evaluacion_list), name='listar_evaluacion'),
# Evaluacion paso a paso
url(r'^generar/step1/$', login_required(evaluacion_ste... | Mansilla1/Sistema-SEC | apps/evaluacion/urls.py | Python | apache-2.0 | 2,293 |
#!/usr/bin/python
from ..utils import floatToGoString
CONTENT_TYPE_LATEST = 'application/openmetrics-text; version=0.0.1; charset=utf-8'
"""Content type of the latest OpenMetrics text format"""
def _is_valid_exemplar_metric(metric, sample):
if metric.type == 'counter' and sample.name.endswith('_total'):
... | prometheus/client_python | prometheus_client/openmetrics/exposition.py | Python | apache-2.0 | 2,989 |
_base_ = [
'../_base_/datasets/coco_panoptic.py', '../_base_/default_runtime.py'
]
model = dict(
type='MaskFormer',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=-1,
norm_cfg=dict(type='BN', requires_grad=False)... | open-mmlab/mmdetection | configs/maskformer/maskformer_r50_mstrain_16x1_75e_coco.py | Python | apache-2.0 | 7,843 |
#!/usr/bin/python3
# Copyright 2015 Nathan 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/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | nathanross/amiens | qlib/fq.audio_strict_long_hq.py | Python | apache-2.0 | 2,403 |
#!/usr/bin/env python
"""Example which shows with the MNIST dataset how Lasagne can be used."""
from __future__ import print_function
import gzip
import itertools
import pickle
import os
import sys
import numpy as np
import lasagne
import theano
import theano.tensor as T
from scipy.linalg import hadamard
from scipy.... | kafluette/ffnnet | ffnnet.py | Python | apache-2.0 | 10,067 |
"""
Problem Statement
=================
0/1 Knapsack Problem - Given items of certain weights/values and maximum allowed weight how to pick items to pick items
from this set to maximize sum of value of items such that sum of weights is less than or equal to maximum allowed
weight.
Runtime Analysis
----------------
Ti... | mission-peace/interview | python/dynamic/knapsack_01.py | Python | apache-2.0 | 2,542 |
###########################################################################
#
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/l... | google/starthinker | starthinker/tool/cm.py | Python | apache-2.0 | 6,569 |
#!/usr/bin/env python
#
# Copyright 2010 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 l... | brianrock/brianrock-ringo | main.py | Python | apache-2.0 | 1,353 |
from easydict import EasyDict as edict
import numpy as np
__C = edict()
cfg = __C
__C.TRAIN = edict()
__C.IMG_WIDTH = 300
__C.IMG_HEIGHT = 300
__C.IMG_CHANNEL = 3
__C.CLASS_NUM = 21
__C.BACKGROUND_ID = 0
# training settings
__C.TRAIN.LEARNING_RATE = 0.001 / 4
__C.TRAIN.MOMENTUM = 0.9
__C.TRAIN.BATCH_SIZE = 32
__C.T... | xinghai-sun/models | ssd/config/pascal_voc_conf.py | Python | apache-2.0 | 2,573 |
# Copyright (c) 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | apporc/nova | nova/scheduler/filters/disk_filter.py | Python | apache-2.0 | 3,099 |
# Copyright 2011 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,... | pettai/capirca | tools/cgrep.py | Python | apache-2.0 | 2,954 |
import logging
LOG = logging.getLogger(__name__)
__author__ = 'Hardy.zheng'
class DiskPoller(object):
def __init__(self):
pass
def run(self):
LOG.info('DiskPoller start...')
| lloy/Project | cdsagent/cdsagent/vdisk/disk.py | Python | apache-2.0 | 205 |
#!/usr/bin/env python
import os
import imp
from multiprocessing import Process, Queue
import bottle
import prometheus_client as prom
mod = imp.load_source('function',
'/kubeless/%s.py' % os.getenv('MOD_NAME'))
func = getattr(mod, os.getenv('FUNC_HANDLER'))
func_port = os.getenv('FUNC_PORT', 808... | ngtuna/kubeless | docker/runtime/python-3.6/http-trigger/kubeless.py | Python | apache-2.0 | 2,152 |
# setup.py: based off setup.py for toil-vg, modified to install this pipeline
# instead.
import sys
import os
# Get the local version.py and not any other version module
execfile(os.path.join(os.path.dirname(os.path.realpath(__file__)), "version.py"))
from setuptools import find_packages, setup
from setuptools.comman... | adamnovak/hgvm-builder | setup.py | Python | apache-2.0 | 2,450 |
from ajenti.api import *
from api import PackageInfo, PackageManager
@plugin
@rootcontext
@persistent
class BSDPackageManager (PackageManager):
platforms = ['freebsd']
def init(self):
self.upgradeable = []
def get_lists(self):
pass
def refresh(self):
pass
def search(sel... | lupyuen/RaspberryPiImage | usr/share/pyshared/ajenti/plugins/packages/pm_bsd.py | Python | apache-2.0 | 390 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('spotseeker_server', '0002_auto_20181029_2244'),
]
operations = [
migrations.AlterField(
model_name='spot',
... | uw-it-aca/spotseeker_server | spotseeker_server/migrations/0003_auto_20181105_2251.py | Python | apache-2.0 | 648 |
# Copyright 2019 New Vector Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | matrix-org/sydent | sydent/http/federation_tls_options.py | Python | apache-2.0 | 4,003 |
# ***************************************************************************
# * Copyright (c) 2016 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 ... | cloudify-cosmo/cloudify-manager | tests/integration_tests/resources/dsl/plugin_tests/plugins/mock-plugin/mock_plugin/ops.py | Python | apache-2.0 | 940 |
import abc
import warnings
from pathlib import Path
import pandas as pd
import ibis
import ibis.expr.types as ir
from ibis.backends.base import BaseBackend, Database
from ibis.backends.pandas.core import execute_and_reset
# Load options of pandas backend
ibis.pandas
class FileDatabase(Database):
def __init__(s... | cloudera/ibis | ibis/backends/base/file/__init__.py | Python | apache-2.0 | 5,137 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2012 Yahoo! 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.or... | hagleitn/Openstack-Devstack2 | devstack/cfg.py | Python | apache-2.0 | 6,505 |
import numpy as np
import tvm
from tvm.contrib import graph_runtime
import topi.testing
import nnvm.symbol as sym
import nnvm.compiler
from nnvm.testing.config import ctx_list
from nnvm.testing.check_computation import check_function
def check_map(symfunc, np_func, np_backward=None, dtype="float32", rnd_min=-1, rnd_ma... | mlperf/training_results_v0.6 | Fujitsu/benchmarks/resnet/implementations/mxnet/3rdparty/tvm/nnvm/tests/python/compiler/test_top_level3.py | Python | apache-2.0 | 1,275 |
class AnalogyData():
def __init__(self):
self.read_analogy()
self.translationPairs = None
self.crossZh = None
self.crossJa = None
self.cross2Zh2Ja = None
self.cross1Zh3Ja = None
self.cross3Zh1Ja = None
def read_analogy(self):
self.records = []
... | jileiwang/CJ-Glo | tools/AnalogyData.py | Python | apache-2.0 | 5,375 |
"""TcEx Notification Module"""
# standard library
import json
import logging
from typing import TYPE_CHECKING
# first-party
from tcex.exit.error_codes import handle_error
if TYPE_CHECKING:
# third-party
from requests import Session
# get tcex logger
logger = logging.getLogger('tcex')
class Notifications:
... | ThreatConnect-Inc/tcex | tcex/api/tc/v2/notifications/notifications.py | Python | apache-2.0 | 3,187 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
.. py:currentmodule:: pysemeels.hitachi.eels_su.test_ana_file
.. moduleauthor:: Hendrix Demers <hendrix.demers@mail.mcgill.ca>
Tests for the module :py:mod:`pysemeels.hitachi.eels_su.ana_file`.
"""
####################################################################... | drix00/pysemeels | tests/hitachi/eels_su/test_ana_file.py | Python | apache-2.0 | 3,171 |
#!/usr/bin/env python
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compl... | quattor/aquilon | tests/broker/test_add_rack.py | Python | apache-2.0 | 11,937 |
import urllib, urllib2, sys, httplib
url = "/MELA/REST_WS"
#HOST_IP="128.130.172.191:8180"
newName="EventProcessingTopology_STRATEGY_MELA_COST_RECOMMENDATION_EFFICIENCY_Larger_VMs"
HOST_IP="localhost:8480"
if __name__=='__main__':
connection = httplib.HTTPConnection(HOST_IP)
description_file = open("./2... | tuwiendsg/MELA | MELA-Extensions/MELA-ComplexCostEvaluationService/tests/mela-clients/emulateCost.py | Python | apache-2.0 | 719 |
""" ietf_netconf
NETCONF Protocol Data Types and Protocol Operations.
Copyright (c) 2011 IETF Trust and the persons identified as
the document authors. All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, is permitted pursuant to, and subject
to the license terms co... | 111pontes/ydk-py | core/ydk/services/ietf_netconf.py | Python | apache-2.0 | 60,135 |
# 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... | openstack-dev/bashate | bashate/messages.py | Python | apache-2.0 | 7,248 |
#! /usr/bin/env python
from __future__ import print_function
import os
import time
from github import Github
gh = Github(os.environ['DMWMBOT_TOKEN'])
codeRepo = os.environ.get('CODE_REPO', 'WMCore')
teamName = os.environ.get('WMCORE_REPO', 'dmwm')
repoName = '%s/%s' % (teamName, codeRepo)
issueID = None
if 'ghprb... | dmwm/Docker | jenkins_python/scripts/PullRequestTestBegin.py | Python | apache-2.0 | 887 |
from django.db import models
from .switcher import switch_to_deptname
# Create your models here.
class Classitem(models.Model):
grade = models.CharField(max_length=10, blank=True, null=True)
classname = models.CharField(max_length=50, blank=True, null=True)
krcode = models.CharField(max_length=10, blank=Tr... | kangsanChang/mjutt | timetable/models.py | Python | apache-2.0 | 1,169 |
from model.group import Group
class GroupHelper:
def __init__(self, app):
self.app = app
def open_groups_page(self):
wd = self.app.wd
if not (wd.current_url.endswith("/group.php") and len(wd.find_elements_by_name("new"))>0):
wd.find_element_by_link_text("groups").click()
... | ritatsetsko/python_training | fixture/group.py | Python | apache-2.0 | 3,117 |
import pytest
from indy_common.types import ClientGetAttribOperation
from collections import OrderedDict
from plenum.common.messages.fields import ConstantField, LimitedLengthStringField, IdentifierField
EXPECTED_ORDERED_FIELDS = OrderedDict([
("type", ConstantField),
("dest", IdentifierField),
("raw", Li... | TechWritingWhiz/indy-node | indy_common/test/types/test_get_attrib_schema.py | Python | apache-2.0 | 725 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-aiplatform | tests/unit/gapic/aiplatform_v1/test_tensorboard_service.py | Python | apache-2.0 | 360,461 |
# Copyright 2015 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... | dhalleine/tensorflow | tensorflow/python/ops/nn.py | Python | apache-2.0 | 50,569 |
# Django settings for example project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
import os, sys
APP = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
PROJ_ROOT = os.path.abspath(os.path.dirname(__file__))
sys.path.append(APP)
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABAS... | callowayproject/django-concepts | example/settings.py | Python | apache-2.0 | 4,239 |
# 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
#
... | beagles/neutron_hacking | neutron/tests/unit/linuxbridge/test_rpcapi.py | Python | apache-2.0 | 5,482 |
# Copyright 2011 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... | tanglei528/glance | glance/tests/functional/v1/test_api.py | Python | apache-2.0 | 24,300 |
from __future__ import print_function
import os.path
import os
import re
import imp
import sys
import zipfile
try:
import zlib
compression = zipfile.ZIP_DEFLATED
except:
compression = zipfile.ZIP_STORED
import PythonAPI as api
class Zip(api.PythonAPIRule):
def __init__(self, config):
super(Zip, self).... | unchartedsoftware/PLUTO | src/validator/tests/testRules/zip.py | Python | apache-2.0 | 556 |
__author__ = 'Ralph'
from ui.app import Application
if __name__ == '__main__':
from ui.app import Example
import wx
app = wx.App()
Example(None, title='Example')
app.MainLoop()
# application = Application()
# application.run()
# node1 = ImportARFF()
# node2 = SelectAttributes()... | rbrecheisen/pyminer | pyminer/pyminer.py | Python | apache-2.0 | 1,957 |
import web
render = web.template.render('templates/')
urls = (
'/(.*)', 'index'
)
class index:
def GET(self,name):
i=web.input(name=None)
return render.controlStructures(name)
if __name__ == "__main__":
app = web.application(urls, globals())
app.run()
| urmyfaith/notes_web_py | basic/Templetor/05templetor-control-structures.py | Python | apache-2.0 | 296 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2017 liangzy
#
# 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... | vliangzy/sillypool | sillypool/spider/parser/xpath.py | Python | apache-2.0 | 2,885 |
income = 15000
if income < 10000:
taxCoefficient = 0.0
elif income < 30000:
taxCoefficient = 0.2
elif income < 100000:
taxCoefficient = 0.35
else:
taxCoefficient = 0.45
print("Need to pay: ", income * taxCoefficient, "in taxes")
flag = False
if flag:
print("a")
print("b")
if flag:
print... | precompiler/python-101 | learning-python/ch03/ConditionalProgramming.py | Python | apache-2.0 | 413 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'LikeVideo.fb_like_id'
db.add_column(u'catalog_likevideo',... | Makeystreet/makeystreet | woot/apps/catalog/migrations/0112_auto__add_field_likevideo_fb_like_id__add_field_likeshop_fb_like_id__a.py | Python | apache-2.0 | 61,347 |
import numpy as np
import itertools
import logging
import time
import traceback
from collections import Mapping
from ..conventions import cf_encoder
from ..core.utils import FrozenOrderedDict
from ..core.pycompat import iteritems, dask_array_type, OrderedDict
# Create a logger object, but don't add any handlers. Leav... | drewokane/xray | xarray/backends/common.py | Python | apache-2.0 | 7,619 |
# -*- coding: utf-8 -*-
class Config(object):
SECRET_KEY = "asdfjlsadjflkjlwkqjerljlasdjfl"
debug = False
class Production(Config):
debug = True
CSRF_ENABLED = False
ADMIN = "seunghojung0114@gmail.com"
SQLALCHEMY_DATABASE_URI = "mysql+gaerdbms:///flaskr?instance=mochafac:flaskr-instance"
m... | denovator/myfriki | app/settings.py | Python | apache-2.0 | 354 |
import sys, glob, os
"""
This program creates a csv file where each row contains an
image and one of its associated tag <"image_path, tag">.
An image has to be in 'jpg' format, a label in 'txt' format.
Usage:
@param1: dataset directory
@param2: url base where images and labels have to be located
@param3: output dire... | emvecchi/mss | src/utils/crowdflower/create_csv.py | Python | apache-2.0 | 1,241 |
class Solution(object):
def wordBreak(self, s, wordDict):
"""
:type s: str
:type wordDict: Set[str]
:rtype: List[str]
"""
return self.helper(s, wordDict, {})
def helper(self, s, wordDict, memo):
if s in memo: return memo[s]
if not s: return []
... | stuti-rastogi/leetcodesolutions | 140_wordBreak2.py | Python | apache-2.0 | 760 |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... | napalm-automation/napalm-yang | napalm_yang/models/openconfig/interfaces/interface/subinterfaces/subinterface/ipv4/unnumbered/interface_ref/__init__.py | Python | apache-2.0 | 9,237 |
# -*- 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-recaptcha-enterprise | samples/generated_samples/recaptchaenterprise_v1_generated_recaptcha_enterprise_service_create_assessment_sync.py | Python | apache-2.0 | 1,574 |
from __future__ import print_function
import os.path
import re
import imp
import sys
from shutil import copyfile
import PythonAPI as api
class ValidateFilename(api.PythonAPIRule):
def __init__(self, config):
super(ValidateFilename, self).__init__(config)
def run(self, inputFile, outputFile, encoding):
# NOTE:... | unchartedsoftware/PLUTO | src/rules/validateFilename.py | Python | apache-2.0 | 1,114 |
import numpy as np
import tensorflow as tf
from traindata import training
from test import parsing
import logging
import re
import os
import csv
import gensim
import json
import argparse
logging.basicConfig(format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p',level=logging.DEBUG)
logging.info('logger start... | rakat/depparser | main.py | Python | apache-2.0 | 4,816 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/l... | rajarammallya/melange | melange/tests/unit/test_extensions.py | Python | apache-2.0 | 1,657 |
# -*- coding: utf-8 -*-
import datetime
from django.core import serializers
import simplejson
from weiChatShopPython.service import updateAddr, getRealIP, getBuid, cartInsert, cartDataList, addrInsert
__author__ = 'xiaoming'
from django.http import HttpResponse
from django.template import loader,Context
from weiChatSh... | WeiChatShop/weiChatShopPython | weiChatShopPython/data.py | Python | artistic-2.0 | 5,177 |
"""A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.absp... | rosalindfdt/huzzahbadge | huzzah/register/setup.py | Python | artistic-2.0 | 1,740 |
from django.apps import AppConfig
from django.core import checks
from django.utils.translation import ugettext_lazy as _
import xadmin
class XAdminConfig(AppConfig):
"""Simple AppConfig which does not do automatic discovery."""
name = 'xadmin'
verbose_name = _("Administration")
def ready(self):
... | why168/PythonProjects | MxOnlie/extra_apps/xadmin/apps.py | Python | artistic-2.0 | 396 |
# -*- coding: utf-8 -*-
"""Main Controller"""
import pylons
from tg import expose, flash, require, url, lurl, request, redirect, tmpl_context
from tg.i18n import ugettext as _, lazy_ugettext as l_
from tg import predicates
from ebetl import model
from ebetl.controllers.secure import SecureController
from ebetl.model im... | nomed/ebetl | ebetl/controllers/marketing.py | Python | artistic-2.0 | 12,560 |
#Java/SQL stuff
from java.lang import *
#Grinder stuff
from net.grinder.script.Grinder import grinder
from net.grinder.script import Test
#misc
import time
import sys
#project specific
from framework import TSdata_w, TSdata_h, importstrs
#import relevant t_DATABASENAME depending on settings in grinder.properties
in... | sagark/tsdb-perf-test | tests/insertlongstream.py | Python | bsd-2-clause | 1,776 |
__author__ = 'amelie'
import numpy
from scipy import linalg
from sklearn.base import BaseEstimator
class StructuredKernelRidgeRegression(BaseEstimator):
"""Structured Kernel Ridge Regression.
Attributes
----------
alpha : float
Regularization term.
kernel : Callable
Kernel functi... | a-ro/preimage | preimage/learners/structured_krr.py | Python | bsd-2-clause | 3,990 |
""" Helper functions to communicate with replication servers.
"""
import requests
import urllib.request as urlrequest
import datetime as dt
from collections import namedtuple
from math import ceil
from osmium import MergeInputReader
from osmium import io as oio
from osmium import version
import logging
LOG = logging... | osmcode/pyosmium | src/osmium/replication/server.py | Python | bsd-2-clause | 14,897 |
#!/usr/bin/python
import average_voting
import user_model
import item_model
import graph_builder
import reputation_instrumented
import numpy as np
N_USERS = 50
N_ITEMS = 50
N_REVIEWS = 6
BIAS_STDEV = 0.0
EVAL_STDEV = 0.4
FRACTION_BAD = 0.2
GAMMA_SHAPE = 2
N_ITERATIONS = 10
DO_PLOTS = False
def eval_quality(values):
... | lucadealfaro/vancouver | analysis/crowdsource.py | Python | bsd-2-clause | 1,628 |
# -*- coding: utf-8 -*-
"""An implementation of the Zephyr Abstract Syntax Definition Language.
See http://asdl.sourceforge.net/ and
http://www.cs.princeton.edu/research/techreps/TR-554-97
Only supports top level module decl, not view. I'm guessing that view
is intended to support the browser and I'm not interested ... | shiquanwang/numba | numba/asdl/common/asdl.py | Python | bsd-2-clause | 13,170 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
default_prefixes = ( 'computed__velocity', 'computed__pressure' )
ext = '.vtu'
path = os.getcwd()
pvd_header = '''<?xml version="1.0"?>
<VTKFile type="Collection" version="0.1" byte_order="LittleEndian">
<Collection>
'''
pvd_footer = '''
</Collecti... | wwu-numerik/scripts | python/paraview/paraview_metafile.py | Python | bsd-2-clause | 1,481 |
import html
import json
import time
import requests
class API(object):
ROOT_URL = 'https://api.litmos.com/v1.svc'
PAGINATION_OFFSET = 200
api_key = None
app_name = None
@classmethod
def _base_url(cls, resource, **kwargs):
return cls.ROOT_URL + "/" + \
resource + \
... | charliequinn/python-litmos-api | src/litmos/api.py | Python | bsd-2-clause | 6,221 |
import os,glob
outFileName = 'C:/Users/Guangyu/Downloads/铁汉娇娃/铁汉娇娃.txt'
dirPath = 'C:/Users/Guangyu/Downloads/铁汉娇娃/铁汉娇娃/*'
def write(fn,of):
with open(fn,'rb') as inf:
of.write(inf.read())
pass
def main():
with open(outFileName,'ab+') as of:
print(glob.glob(dirPath))
for fileName ... | liguangyulgy/mytest1 | mergeTxt.py | Python | bsd-2-clause | 444 |
# """
# Test some "real life" harvesting scenario.
# We have "data dumps" of an imaginary catalog for a set of days.
# The testing procedure should be run as follows:
# 1- Get current state of the database
# 2- Update data from the "harvest source"
# 3- Make sure the database state matches the expected one:
# - u... | opendatatrentino/ckan-api-client | ckan_api_client/tests/functional/client_sync/test_real_harvesting_scenario.py | Python | bsd-2-clause | 1,266 |