code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
# coding=utf-8
from django.contrib.auth.forms import PasswordResetForm, SetPasswordForm
from django.contrib.auth.tokens import default_token_generator
from django.contrib.auth.views import password_reset_confirm
from django.template.response import TemplateResponse
from django.utils.translation import ugettext as ... | LennonChin/Django-Practices | MxOnline/extra_apps/xadmin/plugins/passwords.py | Python | apache-2.0 | 4,992 |
# Copyright 2020 The FedLearner 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... | bytedance/fedlearner | fedlearner/common/metrics.py | Python | apache-2.0 | 8,599 |
#
# Copyright 2016 The BigDL 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 ... | intel-analytics/BigDL | python/nano/src/bigdl/nano/quantization/neural_compressor/quantization.py | Python | apache-2.0 | 7,996 |
"""An HTTP proxy that supports IPv6 as well as the HTTP CONNECT method, among
other things."""
# Standard libary imports
import socket
import thread
import select
__version__ = '0.1.0 Draft 1'
BUFFER_LENGTH = 8192
VERSION = 'Python Proxy/{}'.format(__version__)
HTTP_VERSION = 'HTTP/1.1'
class ConnectionHandler(obje... | jeffknupp/kickstarter_video_two | proxy.py | Python | apache-2.0 | 3,925 |
#!/usr/bin/env python
from __future__ import print_function
import argparse
import sys
import os
import multiprocessing as mp
import subprocess as sp
import tempfile
import shlex
import shutil
"""
Compress all netcdf files under a directories.
compress_nc.py ~/exps/access/cm_1440x1080-1/archive/ ./'
This will recu... | CWSL/access-cm-tools | operations/compress_nc.py | Python | apache-2.0 | 1,765 |
# Copyright 2014 Cloudera 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, so... | laserson/ibis | ibis/impala/tests/test_partition.py | Python | apache-2.0 | 7,977 |
import sys, csv, string
def generate_R_input(report_path, output_path):
confidence_values = []
report_file = open(report_path, 'r')
first_line = True
for line in report_file:
if first_line:
first_line = False
continue
line = line.strip().split(',')
if line[5] == 'Yes'... | emvecchi/mss | src/utils/crowdflower/retrieve_stats.py | Python | apache-2.0 | 925 |
from kubeflow.kubeflow.crud_backend import api, status
def pvc_status(pvc):
"""
Set the status of the pvc
"""
if pvc.metadata.deletion_timestamp is not None:
return status.create_status(status.STATUS_PHASE.TERMINATING,
"Deleting Volume...")
if pvc.statu... | kubeflow/kubeflow | components/crud-web-apps/volumes/backend/apps/common/status.py | Python | apache-2.0 | 2,168 |
# Copyright 2014 Novo Nordisk Foundation Center for Biosustainability, DTU.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | biosustain/cameo | tests/test_strain_design_heuristics.py | Python | apache-2.0 | 55,803 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: release-1.23
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import si... | kubernetes-client/python | kubernetes/client/models/v1_ingress_class_spec.py | Python | apache-2.0 | 5,087 |
# 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/ml-metadata | ml_metadata/tools/documentation/build_docs.py | Python | apache-2.0 | 4,411 |
import os
import pydoc
import sys
class DocTree:
def __init__(self, src, dest):
self.basepath = os.getcwd()
sys.path.append(os.path.join(self.basepath, src))
self.src = src
self.dest = dest
self._make_dest(dest)
self._make_docs(src)
self._move_docs(dest)
... | Artemkaaas/indy-sdk | vcx/wrappers/python3/generate_docs.py | Python | apache-2.0 | 952 |
import os
import tempfile
import unittest
import logging
from pyidf import ValidationLevel
import pyidf
from pyidf.idf import IDF
from pyidf.coils import CoilHeatingDxVariableSpeed
log = logging.getLogger(__name__)
class TestCoilHeatingDxVariableSpeed(unittest.TestCase):
def setUp(self):
self.fd, self.pa... | rbuffat/pyidf | tests/test_coilheatingdxvariablespeed.py | Python | apache-2.0 | 38,214 |
# coding: utf-8
# C++
# http://www.e-olimp.com/articles/21
# http://hardfire.ru/Dij_sparse
# Weak 5
# TODO: hear lession + lession about heap
"""
NAIVE:
Initialize:
- X = [S] [vert. processed so far]
- A[S] = 0 [computed shortest path distances]
[- B[S] = []] [path - help only]
- while X != V:
- among all ed... | zaqwes8811/my-courses | stanford1/py/shortest_path.py | Python | apache-2.0 | 533 |
from django.db import models
from django.core.validators import MinValueValidator, MaxValueValidator
from django.conf import settings
from datetime import datetime
import uuid
User = settings.AUTH_USER_MODEL
def generate_new_uuid():
return str(uuid.uuid4())
class behaviourExperimentType_model(models.Model):
#... | Si-elegans/Web-based_GUI_Tools | behaviouralExperimentDefinition/models.py | Python | apache-2.0 | 36,673 |
#Задача 7. Вариант 6
#компьютер загадывает название одного из семи городов России, имеющих действующий метрополитен, а игрок должен его угадать.
#Борщёва В.О
#28.03.2016
import random
subways=('Москва','Санкт-Петербург','Нижний Новгород','Новосибирск','Самара','Екатеринбург','Казань')
subway=random.randint(0,... | Mariaanisimova/pythonintask | BITs/2014/Borsheva_ V_O/task_7_6.py | Python | apache-2.0 | 1,044 |
"""
Author: Keith Bourgoin, Emmett Butler
"""
__license__ = """
Copyright 2015 Parse.ly, 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 ... | thedrow/samsa | pykafka/topic.py | Python | apache-2.0 | 7,391 |
# This file is part of the pyqualtrics package.
# For copyright and licensing information about this package, see the
# NOTICE.txt and LICENSE.txt files in its top-level directory; they are
# available at https://github.com/Baguage/pyqualtrics
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you ma... | Baguage/pyqualtrics | examples/import_panel_example.py | Python | apache-2.0 | 1,983 |
#!/usr/bin/env python3
"""
Test for Hintidentifier
"""
import datetime
import unittest
from base_test import PschedTestBase
from pscheduler.limitprocessor.identifier.hint import *
DATA = {
"hint": "value",
"match": {
"style": "exact",
"match": "testing",
"case-insensitive": False
... | perfsonar/pscheduler | python-pscheduler/pscheduler/tests/limitprocessor_identifier_hint_test.py | Python | apache-2.0 | 1,127 |
# coding=utf-8
import datetime
from django.db import models
from django.conf import settings
from django.contrib.auth.models import User
from django.core.signing import Signer
from djorm_pgfulltext.models import SearchManager
from djorm_pgfulltext.fields import VectorField
from urllib import quote_plus
from django.util... | boldprogressives/django-opendebates | opendebates/opendebates/models.py | Python | apache-2.0 | 7,910 |
from cloudify import ctx
from cloudify.exceptions import NonRecoverableError
from cloudify.state import ctx_parameters as inputs
import subprocess
import os
import re
import sys
import time
import threading
import platform
from StringIO import StringIO
from cloudify_rest_client import CloudifyClient
from cloudify im... | alien4cloud/alien4cloud-cloudify3-provider | alien4cloud-cloudify3-provider/src/test/resources/outputs/blueprints/openstack/lamp/wrapper/Wordpress_Mysql/wordpressConnectToMysqlMysql/tosca.interfaces.relationship.Configure/pre_configure_source/_a4c_pre_configure_source.py | Python | apache-2.0 | 17,718 |
from .split import Split
from .tree import Tree
from .node import Node
from .column import NominalColumn, OrdinalColumn, ContinuousColumn
from .stats import Stats
from .invalid_split_reason import InvalidSplitReason
__version__ = "5.3.0"
| Rambatino/CHAID | CHAID/__init__.py | Python | apache-2.0 | 239 |
"""
WSGI config for hpt project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_M... | hollowpoint/hollowpoint | hpt/hpt/wsgi.py | Python | apache-2.0 | 382 |
# -------------------------------- Database models----------------------------------------------------------------------
import sys, os
import sqlalchemy
from sqlalchemy import create_engine
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
import secrets
import settings
MY... | MQFN/MQFN | bbmq/server/models.py | Python | apache-2.0 | 3,993 |
# coding=utf-8
# Copyright 2022 The Uncertainty Baselines 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 ap... | google/uncertainty-baselines | uncertainty_baselines/datasets/imagenet_test.py | Python | apache-2.0 | 1,536 |
import datetime
import json
import logging
from django.contrib import messages
from django.contrib.auth import REDIRECT_FIELD_NAME, get_user_model
from django.contrib.auth.decorators import login_required
from django.contrib.auth.views import logout
from django.contrib.sites.shortcuts import get_current_site
from djan... | caktus/django-opendebates | opendebates/views.py | Python | apache-2.0 | 19,833 |
from __future__ import absolute_import
from __future__ import division
from typing import Any, Dict, List, Tuple
from django.db import connection
from django.template import RequestContext, loader
from django.core import urlresolvers
from django.http import HttpResponseNotFound
from jinja2 import Markup as mark_safe
... | peiwei/zulip | analytics/views.py | Python | apache-2.0 | 26,077 |
# -*- 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
#... | owlabs/incubator-airflow | tests/test_utils/db.py | Python | apache-2.0 | 2,430 |
from nose_parameterized import parameterized
from unittest import TestCase
from tensorrec import TensorRec
from tensorrec.representation_graphs import (
LinearRepresentationGraph, NormalizedLinearRepresentationGraph, FeaturePassThroughRepresentationGraph,
WeightedFeaturePassThroughRepresentationGraph, ReLURepr... | jfkirk/tensorrec | test/test_representation_graphs.py | Python | apache-2.0 | 2,973 |
import os
import sys
def readable_dir(prospective_dir):
""" Function that checks if a path is a directory, if it exists and if it is accessible and only
returns true if all these three are the case
:param prospective_dir: path to the directory"""
if prospective_dir is not None:
if not os.... | smartshark/vcsSHARK | pyvcsshark/utils.py | Python | apache-2.0 | 1,460 |
#! /usr/bin/env python
"""
Variables that are shared between modules
"""
import sys
import codecs
version = ""
scriptPath = ""
scriptName = ""
mediaInfoExe = ""
mets_ns = ""
mods_ns = ""
premis_ns = ""
ebucore_ns = ""
xlink_ns = ""
xsi_ns = ""
isolyzer_ns = ""
cdInfo_ns = ""
dfxml_ns = ""
metsSchema = ""
modsSchema =... | bitsgalore/omSipCreator | omSipCreator/config.py | Python | apache-2.0 | 867 |
#
# 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
# ... | LoHChina/nova | nova/tests/unit/compute/test_compute_api.py | Python | apache-2.0 | 128,405 |
# Copyright 2019 DeepMind Technologies 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 agr... | deepmind/open_spiel | open_spiel/python/algorithms/psro_v2/meta_strategies.py | Python | apache-2.0 | 5,344 |
from __future__ import division
# # TODO: document those functions
# def array_hash(X):
# writeable = X.flags.writeable
# X.flags.writeable = False
# h = hash(X.tobytes())
# X.flags.writeable = writeable
# return h
def filehash(filepath):
r"""Compute sha256 from a given file."""
import h... | Horta/limix | limix/sh/_hash.py | Python | apache-2.0 | 582 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Hive Netius System
# Copyright (c) 2008-2020 Hive Solutions Lda.
#
# This file is part of Hive Netius System.
#
# Hive Netius System is free software: you can redistribute it and/or modify
# it under the terms of the Apache License as published by the Apache
# Foun... | hivesolutions/netius | src/netius/sh/base.py | Python | apache-2.0 | 1,533 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
'''
私有方法和私有字段
私有字段:self.__Thailand
私有字段是不能直接被对象和类进行访问的,需要通过动态方法访问
同样私有字段也是可以通过特性的方法访问的
私有方法:
私有方法是不能直接被对象和类进行访问的,通过使用动态方法进行访问
japan._Provice__sha() #显示调用私有方法,但是不建议这么使用
私有字段使用字段,可以让被人访问,但是不可以让别人改动
'''
class Provice:... | zhangyage/Python-oldboy | day04/oop/class_study5.py | Python | apache-2.0 | 2,002 |
# Copyright 2022 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | magenta/magenta | magenta/models/drums_rnn/drums_rnn_create_dataset.py | Python | apache-2.0 | 2,181 |
# Copyright 2016-2017 University of Pittsburgh
# 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 agr... | dbmi-pitt/dbmi-annotator | translation/mp-evidence-base-ETL/deprecated/mpEvidenceQry.py | Python | apache-2.0 | 12,990 |
from __future__ import print_function, division
from brian import (Network, NeuronGroup, SpikeMonitor,
PoissonGroup, Connection,
mV, ms, Hz)
import sys
import matplotlib.pyplot as plt
import numpy as np
import itertools as itt
fin = [f*Hz for f in range(10, 41, 5)]
win = [w*mV for... | achilleas-k/brian-scripts | thesis_stuff/test_in_out.py | Python | apache-2.0 | 2,076 |
from rest_framework import status
from test_utils import serialized_time
def test_get_profile_topics(
api_client, enable_premium_requirement, profile_topic_factory, user_factory
):
"""
Premium users should be able to list their own profile topics.
"""
password = "password"
user = user_factory... | knowmetools/km-api | km_api/functional_tests/know_me/profile/profile_topics/test_profile_topic_list.py | Python | apache-2.0 | 2,774 |
#!/usr/bin/env python
# -*- coding: ascii -*-
u"""
:Copyright:
Copyright 2015 - 2021
Andr\xe9 Malo or his licensors, as applicable
:License:
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
... | ndparker/gensaschema | setup.py | Python | apache-2.0 | 3,688 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Item',
fields=[
('id', models.AutoField(verbose... | PeterHo/mysite | lists/migrations/0001_initial.py | Python | apache-2.0 | 420 |
"""A zigzag path, a sequence of points."""
import collections
from .defuzz import Defuzzer
from .euclid import collinear, Point, Line, Segment, Bounds, EmptyBounds
from .postulates import adjacent_pairs, triples
class Path:
def __init__(self, points):
self.points = tuple(points)
def __repr__(self):... | nedbat/zellij | zellij/path.py | Python | apache-2.0 | 8,958 |
#
# 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... | tengqm/senlin-container | senlin/tests/tempest_tests/config.py | Python | apache-2.0 | 1,284 |
import sys
import errno
import json
import os
from argparse import ArgumentParser
sys.path.insert(1, 'py-bindings')
from squad import SQUADConverter
def get_samples(test_file, vocab_file, output_dir):
print("Test file:", test_file)
print("Vocab file:", vocab_file)
print("Output dir:", output_dir)
max_s... | mlperf/inference_results_v0.7 | closed/Intel/code/resnet/resnet-ov/py-bindings/convert.py | Python | apache-2.0 | 2,497 |
# 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 u... | openstack/barbican | barbican/common/policies/secrets.py | Python | apache-2.0 | 4,101 |
#(C) Copyright Syd Logan 2017-2020
#(C) Copyright Thousand Smiles Foundation 2017-2020
#
#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... | slogan621/tscharts | tschartslib/medications/medications.py | Python | apache-2.0 | 8,744 |
"""Time offset classes for use with cftime.datetime objects"""
# The offset classes and mechanisms for generating time ranges defined in
# this module were copied/adapted from those defined in pandas. See in
# particular the objects and methods defined in pandas.tseries.offsets
# and pandas.core.indexes.datetimes.
# ... | shoyer/xarray | xarray/coding/cftime_offsets.py | Python | apache-2.0 | 35,760 |
""" test """
import logging
import os
import tempfile
import sys
import random
from bzt.engine import Engine, Configuration, FileLister
from bzt.utils import load_class
from bzt.engine import Provisioning, ScenarioExecutor, Reporter, AggregatorListener
from bzt.modules.aggregator import ResultsReader
from tests import... | Nefry/taurus | tests/mocks.py | Python | apache-2.0 | 5,148 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
import string
from urlparse import urlparse, parse_qs
from mopidy import backend
from mopidy.models import SearchResult, Track, Album, Artist
import pykka
import pafy
import requests
import unicodedata
from mopidy_youtube import logger
yt_api_e... | hkariti/mopidy-youtube | mopidy_youtube/backend.py | Python | apache-2.0 | 5,359 |
# coding:utf-8
# 单向循环链表的相关操作:
# is_empty() 判断链表是否为空
# length() 返回链表的长度
# travel() 遍历
# add(item) 在头部添加一个节点
# append(item) 在尾部添加一个节点
# insert(pos, item) 在指定位置pos添加节点
# remove(item) 删除一个节点
# search(item) 查找节点是否存在
class Node(object):
"""节点"""
def __init__(self, item):
self.elem = item
self.next... | coderwjq/adt_python | 02-linked_list/04-single_cycle_linked_list.py | Python | apache-2.0 | 5,206 |
# -*- coding: utf-8 -*-
import json
import requests
import sys, os
import time
import re
class Helper:
initheaders = {
"Host": "segmentfault.com",
"Connection": "keep-alive",
"Content-Length": "55",
"Accept": "*/*",
"Origin": "https://segmentfault.com",
"X-Requested-With": "XMLHttpRequest",
"User-... | liaozhida/liaozhida.github.io | _posts/pythonbak/porter/porter_segment.py | Python | apache-2.0 | 8,573 |
#!/usr/bin/env python
from absl.testing import absltest
from typing import Text
from grr_response_core.lib import rdfvalue
from grr_response_server import blob_store
from grr_response_server.databases import db as abstract_db
from grr.test_lib import db_test_lib
class WithDatabaseTest(absltest.TestCase):
def tes... | google/grr | grr/test_lib/db_test_lib_test.py | Python | apache-2.0 | 3,039 |
# Copyright 2015-2016 Hewlett Packard Enterprise Development Company, LP
#
# 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/li... | noironetworks/neutron | neutron/services/auto_allocate/db.py | Python | apache-2.0 | 17,334 |
from kvmagent import kvmagent
from zstacklib.utils import jsonobject
from zstacklib.utils import http
from zstacklib.utils import log
from zstacklib.utils.bash import *
from zstacklib.utils import linux
from zstacklib.utils import thread
from jinja2 import Template
import os.path
import re
import time
import traceback
... | live4thee/zstack-utility | kvmagent/kvmagent/plugins/prometheus.py | Python | apache-2.0 | 4,603 |
from __future__ import unicode_literals
from moto.core.responses import BaseResponse
from .models import support_backends
import json
class SupportResponse(BaseResponse):
SERVICE_NAME = "support"
@property
def support_backend(self):
return support_backends[self.region]
def describe_trusted_a... | william-richard/moto | moto/support/responses.py | Python | apache-2.0 | 3,039 |
# -*- 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-tpu | google/cloud/tpu_v2alpha1/types/__init__.py | Python | apache-2.0 | 2,318 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('orchestra', '0010_merge'),
]
operations = [
migrations.AlterField(
model_name='project',
name='proce... | Sonblind/orchestra | orchestra/migrations/0011_auto_20150618_0003.py | Python | apache-2.0 | 1,311 |
"""
error types
Copyright (c) 2010-2012 Mika Eloranta
See LICENSE for details.
"""
class Error(Exception):
"""error"""
class InvalidProperty(Error):
"""invalid property"""
class MissingProperty(Error):
"""missing property"""
class UserError(Error):
"""user error"""
class InvalidRange(Error):
... | ohmu/poni | poni/errors.py | Python | apache-2.0 | 1,028 |
from plenum.test.plugin.demo_plugin import DemoTransactions
AUCTION_LEDGER_ID = 909
AUCTION_START = DemoTransactions.AUCTION_START.value
AUCTION_END = DemoTransactions.AUCTION_END.value
PLACE_BID = DemoTransactions.PLACE_BID.value
GET_BAL = DemoTransactions.GET_BAL.value
AMOUNT = "amount"
ID = "id"
| evernym/zeno | plenum/test/plugin/demo_plugin/constants.py | Python | apache-2.0 | 303 |
"""Add Graph and GraphCache models
Revision ID: 654121a84a33
Revises: fc7bc5c66c63
Create Date: 2020-11-16 21:02:36.249989
"""
# revision identifiers, used by Alembic.
revision = '654121a84a33'
down_revision = 'fc7bc5c66c63'
from alembic import op
import sqlalchemy as sa
def upgrade():
# ### commands auto gen... | google/timesketch | timesketch/migrations/versions/654121a84a33_.py | Python | apache-2.0 | 3,278 |
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# TH... | mdworks2016/work_development | Python/05_FirstPython/Chapter9_WebApp/fppython_develop/lib/python3.7/site-packages/zope/interface/tests/test_verify.py | Python | apache-2.0 | 19,156 |
# Copyright (c) 2015 Quobyte 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... | rahulunair/nova | nova/virt/libvirt/volume/quobyte.py | Python | apache-2.0 | 7,552 |
#!/usr/bin/env python
import json
from tdclient import api, models
class Client:
"""API Client for Treasure Data Service
"""
def __init__(self, *args, **kwargs):
self._api = api.API(*args, **kwargs)
def __enter__(self):
return self
def __exit__(self, type, value, traceback):
... | treasure-data/td-client-python | tdclient/client.py | Python | apache-2.0 | 32,550 |
#!/usr/bin/env python
# Welcome to Gobbler, the Scapy pcap parser and dump scripts
# Part of the sniffMyPackets suite http://www.sniffmypackets.net
# Written by @catalyst256 / catalyst256@gmail.com
import datetime
from layers.http import *
from layers.BadLayers import *
from auxtools import error_logging
import loggi... | SneakersInc/sniffmypacketsv2 | src/sniffmypacketsv2/transforms/common/packetParser.py | Python | apache-2.0 | 2,024 |
import os
import sys
import textwrap
import warnings
from stripe import error, util
# - Requests is the preferred HTTP library
# - Google App Engine has urlfetch
# - Use Pycurl if it's there (at least it verifies SSL certs)
# - Fall back to urllib2 with a warning if needed
try:
import urllib2
except ImportError:... | Rio517/pledgeservice | lib/stripe/http_client.py | Python | apache-2.0 | 10,566 |
#!/usr/bin/env python
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License");... | maocorte/ambari-tachyon-service | package/scripts/service_check.py | Python | apache-2.0 | 1,490 |
#! /usr/bin/env python
# -*- Mode: python; py-indent-offset: 4; tab-width: 8; indent-tabs-mode: t; -*-
#
# A script for generating a number of flows.
#
# The output of the script should be saved to a file, and the flows from
# that file should be added by the following command:
#
# web/add_flow.py -f filename
#
# N... | opennetworkinglab/spring-open | scripts/perf-scripts/generate_flows.py | Python | apache-2.0 | 2,622 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tests for the volume scanner objects."""
import unittest
from dfvfs.lib import errors
from dfvfs.path import fake_path_spec
from dfvfs.path import os_path_spec
from dfvfs.path import qcow_path_spec
from dfvfs.path import raw_path_spec
from dfvfs.path import tsk_partition_p... | dc3-plaso/dfvfs | tests/helpers/volume_scanner.py | Python | apache-2.0 | 18,673 |
__author__ = 'PaleNeutron'
import os
from urllib.parse import urlparse, unquote
import sys
from PyQt5 import QtWidgets, QtCore, QtGui
class MyMainWindow(QtWidgets.QMainWindow):
file_loaded = QtCore.pyqtSignal(str)
image_loaded = QtCore.pyqtSignal(QtGui.QImage)
def __init__(self):
su... | PaleNeutron/EpubBuilder | my_mainwindow.py | Python | apache-2.0 | 3,933 |
# -*- coding: utf-8 -*-
"""
Created on Mon May 16 17:14:41 2016
@author: sdemyanov
"""
import numpy as np
from sklearn import metrics
def get_prob_acc(probs, labels):
return np.mean(np.argmax(probs, axis=1) == labels)
def get_auc_score(scores, labels):
fpr, tpr, thresholds = metrics.roc_curve(labels, scores, p... | sdemyanov/tensorflow-worklab | classes/stats.py | Python | apache-2.0 | 3,985 |
#!/usr/bin/env python3
import glob
import numpy as np
import pyboof as pb
# Scene recognition is defined here as the problem where you wish to find multiple views of the same scene
# In this example we will load a set of images that has sets of 3 related images. We will tell it to find the 5
# most similar images so ... | lessthanoptimal/PyBoof | examples/scene_recognition.py | Python | apache-2.0 | 2,120 |
import pymysql.cursors
from model.group import Group
from model.contact import Contact
class DbFixture:
def __init__(self, host, name, user, password):
self.host = host
self.name = name
self.user = user
self.password = password
self.connection = pymysql.connect(host=host, ... | evgeniy-shorgin/python_training | fixture/db.py | Python | apache-2.0 | 2,681 |
#!/usr/bin/env python
from tdclient.model import Model
class User(Model):
"""User on Treasure Data Service
"""
def __init__(self, client, name, org_name, role_names, email, **kwargs):
super(User, self).__init__(client)
self._name = name
self._org_name = org_name
self._rol... | treasure-data/td-client-python | tdclient/user_model.py | Python | apache-2.0 | 860 |
# 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/objects/base.py | Python | apache-2.0 | 6,515 |
# 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... | reyoung/Paddle | python/paddle/fluid/layers/layer_function_generator.py | Python | apache-2.0 | 10,724 |
# 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 app... | baidu/Paddle | python/paddle/fluid/tests/unittests/test_pool3d_op.py | Python | apache-2.0 | 13,221 |
"""
.. module: lemur.certificate.service
:platform: Unix
:copyright: (c) 2015 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
.. moduleauthor:: Kevin Glisson <kglisson@netflix.com>
"""
import arrow
from flask import current_app
from sqlalchemy import func, or_, not_, c... | kevgliss/lemur | lemur/certificates/service.py | Python | apache-2.0 | 17,189 |
from django.test import TestCase
from score.templatetags.score_tags import display_score
class TestDisplayScore(TestCase):
def test_string(self):
assert "?" in display_score("")
def test_none(self):
assert "?" in display_score(None)
def test_danger(self):
assert "danger" in disp... | kencochrane/scorinator | scorinator/score/tests/tags.py | Python | apache-2.0 | 638 |
#!/usr/bin/env python
# Copyright 2014-2018 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... | sunqm/pyscf | pyscf/lib/logger.py | Python | apache-2.0 | 6,296 |
#!/usr/bin/python
from __future__ import division
import math
import signal
import sys
import numpy as np
from scipy.spatial import distance
from munkres import munkres
from . import Matcher
from itertools import izip
from scipy.stats import kendalltau
from matteautils.base import printd
import matteautils.config as co... | mattea/mattea-utils | matteautils/match/vectorsim.py | Python | apache-2.0 | 17,233 |
#!/usr/bin/env python
from groupflow_shared import *
from mininet.net import *
from mininet.node import OVSSwitch, UserSwitch
from mininet.link import TCLink
from mininet.log import setLogLevel
from mininet.cli import CLI
from mininet.node import Node, RemoteController
from scipy.stats import truncnorm
from numpy.rando... | kvasukib/groupflow_simulator | groupflow_scripts/mininet_multicast_dynamic.py | Python | apache-2.0 | 15,080 |
import pytest
from openshift_checks.docker_image_availability import DockerImageAvailability
@pytest.fixture()
def task_vars():
return dict(
openshift=dict(
common=dict(
service_type='origin',
is_containerized=False,
is_atomic=False,
... | detiber/openshift-ansible | roles/openshift_health_checker/test/docker_image_availability_test.py | Python | apache-2.0 | 9,879 |
# Copyright 2014 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 req... | sniperganso/python-manilaclient | manilaclient/v2/share_servers.py | Python | apache-2.0 | 3,246 |
def add(a, b):
"""
This function adds two numbers
"""
return a + b
def sub(a,b):
"""
This function subtracts two numbers
"""
return a - b
# print "The first number you want to subtract?"
# a = int(raw_input("First no: "))
# print "What's the second number you want to subtract"
# b = int(raw_input("Second no... | alveyworld-dev/calculator | team6.py | Python | apache-2.0 | 738 |
# Copyright 2015 Mirantis, Inc.
# All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | jcsp/manila | manila/tests/network/test_standalone_network_plugin.py | Python | apache-2.0 | 16,379 |
import cmd
class HelloWorld(cmd.Cmd):
prompt = 'prompt: '
intro = "Simple command processor example."
doc_header = 'doc_header'
misc_header = 'misc_header'
undoc_header = 'undoc_header'
ruler = '-'
def do_prompt(self, line):
"Change the interactive prompt"
self.prompt =... | jasonwee/asus-rt-n14uhp-mrtg | src/lesson_application_building_blocks/cmd_attributes.py | Python | apache-2.0 | 438 |
import sys
def fix(element):
if element and element[0] == '<':
new = '<'
for c in element[1:-1]:
if c == '<':
new += '<'
elif c == '>':
new += '>'
else:
new += c
new += '>'
return new
else:
return element
for line in open(sys.argv[1]):
cols = li... | Buchhold/QLever | misc/fix_nt_file.py | Python | apache-2.0 | 554 |
import synapse.common as s_common
import synapse.cryotank as s_cryotank
import synapse.lib.const as s_const
import synapse.tests.utils as s_t_utils
from synapse.tests.utils import alist
logger = s_cryotank.logger
cryodata = (('foo', {'bar': 10}), ('baz', {'faz': 20}))
class CryoTest(s_t_utils.SynTest):
async ... | vertexproject/synapse | synapse/tests/test_cryotank.py | Python | apache-2.0 | 4,379 |
# -*- 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/network_instances/network_instance/mpls/lsps/static_lsps/__init__.py | Python | apache-2.0 | 13,426 |
import numpy as np
import pandas
import scipy, scipy.spatial
import sklearn
import sys
from sklearn import linear_model
from sklearn.metrics import precision_score, recall_score, f1_score
import argparse
def main():
parser = argparse.ArgumentParser()
parser.add_argument('train', help='Training Data')
p... | mirjalil/ml-visual-recognition | codes/logisticRegression.py | Python | apache-2.0 | 3,262 |
#!/usr/bin/env python3
class Employee:
num_of_emps = 0
raise_amount = 1.04
def __init__(self,first,last):
self.first = first
self.last = last
self.email = first + '.' + last + '@kellynoah.com'
def fullname(self):
return '{} {}'.format(self.first,self.last)
def ... | lmascare/utils | python/tutorials/oop6a.py | Python | artistic-2.0 | 811 |
import numpy as np
from scipy import sparse
from . import Mapper
from . import samplers
class VolumeMapper(Mapper):
@classmethod
def _cache(cls, filename, subject, xfmname, **kwargs):
from .. import db
masks = []
xfm = db.get_xfm(subject, xfmname, xfmtype='coord')
pia = db.get_... | gallantlab/pycortex | cortex/mapper/volume.py | Python | bsd-2-clause | 7,345 |
"""
pygments.lexers.other
~~~~~~~~~~~~~~~~~~~~~
Just export lexer classes previously contained in this module.
:copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.lexers.sql import SqlLexer, MySqlLexer, SqliteConsoleLexer
fr... | dscorbett/pygments | pygments/lexers/other.py | Python | bsd-2-clause | 1,744 |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompar... | jmcnamara/XlsxWriter | xlsxwriter/test/comparison/test_simple09.py | Python | bsd-2-clause | 1,048 |
from UtmpHead import UtmpHead
import Config
from Log import Log
class Login:
def __eq__(self, other):
if (other == None):
return (self._loginid == 0)
return (self._loginid == other._loginid)
def __ne__(self, other):
return not self.__eq__(other)
def __init__(self, logi... | HenryHu/pybbs | Login.py | Python | bsd-2-clause | 4,609 |
from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
import logging
from indra.java_vm import autoclass, JavaException
logger = logging.getLogger('reach_reader')
class ReachReader(object):
"""The ReachReader wraps a singleton instance of the REACH reader.
Th... | jmuhlich/indra | indra/reach/reach_reader.py | Python | bsd-2-clause | 1,451 |
# -*- coding: UTF-8 -*-
# Copyright 2016 Luc Saffre
# License: BSD (see file COPYING for details)
from lino.api import dd, _
class PartnerEvents(dd.ChoiceList):
verbose_name = _("Observed event")
verbose_name_plural = _("Observed events")
max_length = 50
| khchine5/xl | lino_xl/lib/contacts/choicelists.py | Python | bsd-2-clause | 272 |
# -*- coding: utf-8 -*-
"""Remove team domain
Revision ID: 07f975f81f03
Revises: 4e206c5ddabd
Create Date: 2017-08-04 15:12:11.992856
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '07f975f81f03'
down_revision = '4e206c5ddabd'
branch_labels = None
depends_on = ... | hasgeek/lastuser | migrations/versions/07f975f81f03_remove_team_domain.py | Python | bsd-2-clause | 655 |
# -*- coding: utf-8 -*-
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.http import HttpResponseRedirect, Http404
from django.core.urlresolvers import reverse
from StackSmash.apps.uploader.models import Document
from StackSmash.apps.uploader.forms import DocumentF... | Justasic/StackSmash | StackSmash/apps/uploader/views.py | Python | bsd-2-clause | 1,444 |