text stringlengths 2 999k |
|---|
# -*- coding: utf-8 -*-
# @Time : 2021/5/8 7:17
# @Author : 咸鱼型233
# @File : config_example.py.py
# @Software: PyCharm
# @Function: 配置文件示例,存放图片路径以及阿里云表格文字识别API的APPCODE
# 使用时请删除文件的_example后缀
# @ChangeLog
# 阿里云表格文字识别API的APPCODE
# #购买链接 : https://market.aliyun.com/products/57124001/cmapi024968.html
APPC... |
import itertools
import logging
import os.path as osp
import tempfile
import mmcv
import numpy as np
from mmcv.utils import print_log
from pycocotools.coco import COCO
#from pycocotools.cocoeval import COCOeval
from mmdet.datasets.fast_eval_api import COCOeval_opt as COCOeval
from terminaltables import AsciiTable
fro... |
ROOT = "/home/homeassistant/.homeassistant/"
class SwitchMaker:
def __init__(self, name, room, conf_folder):
self._name = name
self._room = room
ROOT = conf_folder
self._f= open(ROOT + "skyq" + self._room.replace(" ","") + ".yaml","w+")
self._f.write(" skyq_pause" + self... |
# -*- coding: utf-8 -*-
from datetime import date, datetime, timedelta
from nose.tools import * # noqa
from tests.base import OsfTestCase
from tests.factories import RegistrationFactory
from tests.factories import UserFactory
from scripts.embargo_registrations import main
class TestRetractRegistrations(OsfTestCas... |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# MIT License. See license.txt
from __future__ import unicode_literals
import webnotes
class DocType():
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doclist = doclist
def get_parent_bean(self):
return webnotes.bean(self.doc.parenttype, self... |
#!/usr/bin/env python3
#### PYTHON IMPORTS ################################################################################
import csv
import os
import shutil
import sys
from pathlib import Path
#### CONFIG ########################################################################################
csv.field_size_limit(... |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('lexicon', '0120_auto_20161019_1545'),
]
operations = [
migrations.AlterField(
model_name='source',
n... |
from typing import Generator, Optional, Callable, Iterable, Sequence, Union, Tuple
import torch
from torch.nn import Parameter, ParameterDict
from torch_kalman.process import Process
from torch_kalman.internals.utils import zpad, infer_forward_kwargs
from torch_kalman.process.utils.bounded import Bounded
from torch_... |
# coding: utf-8
# flake8: noqa
"""
videoapi
The video APIs help you convert, encode, and transcode videos. # noqa: E501
OpenAPI spec version: v1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
# import models into model package
from... |
###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) Crossbar.io Technologies GmbH
#
# 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 ... |
import copy
import re
import textwrap
import numpy as np
import pytest
import pandas.util._test_decorators as td
import pandas as pd
from pandas import DataFrame
import pandas._testing as tm
jinja2 = pytest.importorskip("jinja2")
from pandas.io.formats.style import Styler, _get_level_lengths # isort:skip
class T... |
# Copyright (c) 2016-2018 Uber Technologies, 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 agree... |
import unittest
import itertools
import rpy2.rlike.functional as rlf
class TapplyTestCase(unittest.TestCase):
def testSumByString(self):
seq = ( 1, 2, 3, 4, 5, 6)
tags = ('a', 'b', 'a', 'c', 'b', 'a')
expected = {'a': 1+3+6,
'b': 2+5,
'c'... |
'''Torch transformer models.'''
import math
import torch
from torch import nn
# helper functions
def generate_square_subsequent_mask(size: int):
"""Generate a triangular (size, size) mask. From PyTorch docs."""
mask = (torch.triu(torch.ones(size, size)) == 1).transpose(0, 1)
mask = mask.float().masked_fi... |
import copy
import re
import urllib
import cv2
import numpy as np
import urllib3
from . import config
from .course import Course, courseTimeParser
import datetime
import threading
from queue import Queue
urllib3.disable_warnings()
def capture_idft_worker(qin):
from . import capture
while True:
img... |
"""
@author: ArcREST Team
@contact: www.github.com/Esri/ArcREST
@company: Esri
@version: 1.0.0
@description: deletes an item from AGOL
@requirements: Python 2.7.x, ArcGIS 10.2.2, ArcREST 2.0
@copyright: Esri, 2015
"""
from arcpy import env
import arcpy
import arcrest
#-----------------------... |
#!/usr/bin/python
# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from optparse import OptionParser
import os
import re
import sys
"""Header Scanner.
This module will scan a set of input sources... |
# Copyright 2018 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... |
from asposebarcode import Settings
from com.aspose.barcode import BarCodeBuilder
from com.aspose.barcode import Symbology
class SetBarsHeight:
def __init__(self):
dataDir = Settings.dataDir + 'WorkingWithBarcode/AdvanceBarcodeFeatures/SetBarsHeight'
bb = BarCodeBuilder()
# Set up... |
##############################################################################
#
# Copyright (c) 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.
# THIS SOF... |
#!/usr/bin/env python3
import ntpath
import os
import lvsfunc as lvf
from acsuite import eztrim
path = r'BDMV/[KUNO-DIY][BDMV][CLANNAD][Blu-ray BOX Disc 1-5 Fin]/CLANNAD_3/BDMV/STREAM/00003.m2ts'
src = lvf.src(path)
if __name__ == "__main__":
eztrim(src, (0, -48), f"{os.path.splitext(path)[0]}.wav", f"{ntpath.b... |
# This file is autogenerated by the command `make fix-copies`, do not edit.
from ..file_utils import requires_backends
QDQBERT_PRETRAINED_MODEL_ARCHIVE_LIST = None
class QDQBertForMaskedLM:
def __init__(self, *args, **kwargs):
requires_backends(self, ["pytorch_quantization", "torch"])
@classmethod
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import hashlib
def repr_data_size(size_in_bytes, precision=2):
"""Return human readable string represent of a file size. Doesn"t support
size greater than 1EB.
For example:
- 100 bytes => 100 B
- 100,000 bytes => 97.66 KB
- 100,000,000... |
#compdef dscomputers.py
local arguments
arguments=(
'--name[name regexp>]'
'--syshive[to system hive>]'
'--lmoutfile[to the LM hash output file>]'
'--ntoutfile[to the NT hash output file>]'
'--pwdformat[of the hash output>]'
'--passwordhashes[]'
'--passwordhistory[]'
'--supplcreds[]'
'--bitlocker[ex... |
"""Issuer registration admin routes."""
from aiohttp import web
from aiohttp_apispec import docs, request_schema
from marshmallow import fields, Schema
from aries_cloudagent.admin.request_context import AdminRequestContext
from aries_cloudagent.connections.models.conn_record import ConnRecord
from aries_cloudagent.s... |
import re
from .common import InfoExtractor
from ..aes import aes_decrypt_text
from ..compat import compat_urllib_parse_unquote
from ..utils import (
determine_ext,
ExtractorError,
format_field,
int_or_none,
str_to_int,
strip_or_none,
url_or_none,
)
class KeezMoviesIE(InfoExtractor):
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2016, Silvio Peroni <essepuntato@gmail.com>
#
# Permission to use, copy, modify, and/or distribute this software for any purpose
# with or without fee is hereby granted, provided that the above copyright notice
# and this permission notice appear in all copies.
... |
import pytest
from django.core.management import call_command
@pytest.fixture(scope="function")
def mock_data(django_db_setup, django_db_blocker) -> None:
"""Injects fixtures data into database during runtime"""
with django_db_blocker.unblock():
call_command("loaddata", "person.json")
|
import FWCore.ParameterSet.Config as cms
import RecoTracker.IterativeTracking.iterativeTkConfig as _cfg
from Configuration.Eras.Modifier_fastSim_cff import fastSim
#for dnn classifier
from Configuration.ProcessModifiers.trackdnn_cff import trackdnn
from RecoTracker.IterativeTracking.dnnQualityCuts import qualityCutDic... |
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
workspace_sid = "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
task_sid = "WTXXX... |
# Copyright 2018-2019 QuantumBlack Visual Analytics 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
#
# THE SOFTWARE IS PROVIDED "AS IS"... |
from wolfbot import const, one_night, replay
def main() -> None:
"""Simulate play_one_night_werewolf."""
if const.REPLAY:
replay.replay_game_from_state()
else:
enable_logging = const.NUM_GAMES < const.MAX_LOG_GAMES
_ = one_night.simulate_game(
num_games=const.NUM_GAMES,... |
import unittest
from Solver5a import Solver5a
from Solver5b import Solver5b
class Solver5Test(unittest.TestCase):
def test_example_a(self):
password = Solver5a().find_password('abc')
self.assertEqual('18f47a30', password)
def test_real_input_a(self):
password = Solver5a().find_passwor... |
from typing import List
class Solution:
def intersect(self, nums1: List[int], nums2: List[int]) -> List[int]:
if len(nums1) > len(nums2):
larger_of_two_list = nums1
smaller_of_two_list = nums2
else:
larger_of_two_list = nums2
smaller_of_two_list = nu... |
"""
Cisco Intersight
Cisco Intersight is a management platform delivered as a service with embedded analytics for your Cisco and 3rd party IT infrastructure. This platform offers an intelligent level of management that enables IT organizations to analyze, simplify, and automate their environments in more advan... |
from .runner import Runner
from .statemachine import CreationState
from paramiko.ssh_exception import (
BadAuthenticationType,
NoValidConnectionsError,
AuthenticationException,
PasswordRequiredException
)
from pypsrp.exceptions import (
AuthenticationError,
WinRMTransportError,
WSManFaultE... |
from migrate.migrate import Migrate
|
import argparse
import sys
import os
def get_args():
parser=argparse.ArgumentParser(
prog="main.py",
description="Atualiza os campos pré-definidos dos XMLs contendo determinado CNPJ emitente."
)
parser.add_argument("-f","--file",
type=str,
required=True,
metavar="arquivo.xml|diretório",
help="Cam... |
#! mm
#! MM
#! `7Mb,od8 ,pW"Wq. `7MM `7MM mmMMmm .gP"Ya `7Mb,od8 ,pP"Ybd
#! MM' "' 6W' `Wb MM MM MM ,M' Yb MM' "' 8I `" ... |
from typing import Dict, Any, Optional
import blxr_rlp as rlp
from bxcommon.utils import convert
from bxcommon.utils.blockchain_utils.eth import eth_common_utils, crypto_utils, eth_common_constants
from bxcommon.utils.object_hash import Sha256Hash
from bxcommon.messages.eth.serializers.unsigned_transaction import Uns... |
import uuid
from fastapi import status
#
# INVALID TESTS
#
def test_get_invalid_uuid(client_valid_access_token):
get = client_valid_access_token.get("/api/user/role/1")
assert get.status_code == status.HTTP_422_UNPROCESSABLE_ENTITY
def test_get_nonexistent_uuid(client_valid_access_token):
get = clien... |
# -*- coding: utf-8 -*-
#
# synapse-client groups documentation build configuration file, created by
# sphinx-quickstart on Mon Jul 9 15:45:58 2012.
#
# 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... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import simplejson as json
from alipay.aop.api.constant.ParamConstants import *
class AlipayEbppOrderItemPayModel(object):
def __init__(self):
self._alipay_item_id = None
@property
def alipay_item_id(self):
return self._alipay_item_id
@a... |
import glob
import os
from chainercv.chainer_experimental.datasets.sliceable import GetterDataset
from chainercv.datasets.ade20k.ade20k_utils import get_ade20k
from chainercv.utils import read_image
root = 'pfnet/chainercv/ade20k'
url = 'http://data.csail.mit.edu/places/ADEchallenge/release_test.zip'
class ADE20KTe... |
import asyncio
from io import BytesIO
from telethon import types
from telethon.errors import PhotoInvalidDimensionsError
from telethon.tl.functions.messages import SendMediaRequest
from userbot import *
from userbot.cmdhelp import CmdHelp
CmdHelp("ftoimg").add_command(
"ftoimg", None, "Here file must be in imag... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
from... |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'note.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportErr... |
import random
from random import sample
import argparse
import numpy as np
import os
import pickle
from tqdm import tqdm
from collections import OrderedDict
from sklearn.metrics import roc_auc_score
from sklearn.metrics import roc_curve
from sklearn.metrics import precision_recall_curve
from sklearn.covariance import L... |
"""Tests of the UniformReal class."""
import pytest
from gemd.entity.value.uniform_real import UniformReal
def test_bounds_order():
"""Lower bound must be <= upper bound."""
UniformReal(4.4, 8.8, 'm')
UniformReal(100.0, 100.0, 'm')
with pytest.raises(AssertionError):
UniformReal(23.2, 18.9, '... |
# Generated by Django 3.1.7 on 2021-10-30 10:04
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('donations', '0027_contribution'),
]
operations = [
migrations.AddField(
model_name='donationlet... |
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
# file: __init__.py
from .main import *
|
"""The tests for the Demo vacuum platform."""
import unittest
from homeassistant.components import vacuum
from homeassistant.components.demo.vacuum import (
DEMO_VACUUM_BASIC,
DEMO_VACUUM_COMPLETE,
DEMO_VACUUM_MINIMAL,
DEMO_VACUUM_MOST,
DEMO_VACUUM_NONE,
DEMO_VACUUM_STATE,
FAN_SPEEDS,
)
fro... |
from __future__ import division
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import matplotlib.cm as cm
import numpy as np
import os
class_name = "dt"
name = "Dalitz"
avmin=0.01
filename= class_name+"_optimisation_values_"+name
data=np.loadtxt(filename+".txt",dtype='d')
x=data[:50,0]
y=data[:50... |
import torch.optim as optim
from layers.scheduler_base import SchedulerBase
class Adam45(SchedulerBase):
def __init__(self, params_list=None):
super(Adam45, self).__init__()
self._lr = 3e-4
self._cur_optimizer = None
self.params_list=params_list
def schedule(self, net, epoch, e... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 17 09:31:37 2021
Provides the ConwayBase class and an implementation of said class.
@author: dkappe
"""
from abc import ABC, abstractclassmethod
import numpy as np
from configs import DYING, REBORN, ALIVE
class ConwayBase(ABC):
"""
Conw... |
import logging
from itertools import chain
import crayons
from .utils import generate_id
logger = logging.getLogger('restless-client')
def get_class(cls, kwargs):
if not cls._polymorphic.get('identities'):
return cls
discriminator_name = cls._polymorphic['on']
for discriminator, k... |
# Copyright (C) 2015 Stefan C. Mueller |
#
# 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 us... |
class Solution:
""" Note: for UnionFind structure, see Structures/UnionFind/uf.py. """
def findRedundantConnection(self, edges: List[List[int]]) -> List[int]:
# Yes, goes from 0-n+1 but we don't use 0.
uf = UnionFind(range(len(edges)+1))
last = None
for (u, v) in edges:
... |
# Copyright (C) 2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import argparse
from mo.utils.error import Error
from mo.utils.cli_parser import parse_transform
def get_available_transformations():
try:
from openvino.offline_transformations import ApplyLowLatencyTransformation, ApplyMakeSta... |
"""This module contain classes defining the Function Spaces."""
from dof_map import DofMap
from mesh import CrazyMesh
import numpy as np
class FunctionSpace(object):
"""Define a functional space."""
def __init__(self, mesh, form_type, degree, is_inner=True, separated_dof=True):
self.mesh = mesh
... |
# PyMsgBox - A simple, cross-platform, pure Python module for JavaScript-like message boxes.
# By Al Sweigart al@inventwithpython.com
__version__ = "1.0.9"
# Modified BSD License
# Derived from Stephen Raymond Ferg's EasyGui http://easygui.sourceforge.net/
"""
The four functions in PyMsgBox:
- alert(text='', title... |
# Lint as: python3
# 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/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
# Yahoo! Finance market data downloader (+fix for Pandas Datareader)
# https://github.com/regularfry/regularfrynance
#
# Copyright 2020 Alex Young
#
# 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... |
from fpdf import FPDF
from fpdf.errors import FPDFException
from tools import assure_decimal, assert_instance, assert_subclass, draw_str
from tools import prog_bar_prefix, print_progress_bar, calc_prog_bar_refresh_rate
from constants import TT, ALIGNMENT, ALIGNMENT, STRIKE_THROUGH, UNDERLINE, FONT_FAMILIES, FONTS_TO_I... |
from typing import List, Optional
import aiosqlite
from covid.util.db_wrapper import DBWrapper
from covid.util.ints import uint32
from covid.wallet.util.wallet_types import WalletType
from covid.wallet.wallet_action import WalletAction
class WalletActionStore:
"""
WalletActionStore keeps track of all wallet... |
# Python Character Mapping Codec gunilc
# -*- coding': utf-8 -*-
import codecs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
try:
result = ""
count = 0
for i in input:
try:
result += encoding_map[i... |
from .dev_settings import * # noqa
# These endpoints will throw an error on the django debug panel
EXCLUDED_DEBUG_URLS = [
"/content/storage",
]
DEBUG_PANEL_ACTIVE = True
def custom_show_toolbar(request):
return not any(
request.path.startswith(url) for url in EXCLUDED_DEBUG_URLS
) # noqa F405... |
import unittest
import subprocess as sp
import os
import glob
class TestEpjson2Rad(unittest.TestCase):
def test_help(self):
cmd = ["ep2rad", "-h"]
process = sp.run(cmd, check=True, stderr=sp.PIPE, stdout=sp.PIPE)
self.assertEqual(process.stderr, b'')
def test_cfscase(self):
cm... |
# coding=utf-8
from __future__ import unicode_literals
from .. import Provider as SsnProvider
class Provider(SsnProvider):
def ssn(self):
"""
Returns a 9 digits Dutch SSN called "burgerservicenummer (BSN)".
the Dutch "burgerservicenummer (BSN)" needs to pass the "11-proef",
whic... |
c.NotebookApp.allow_root = True
c.NotebookApp.ip = '0.0.0.0'
c.NotebookApp.open_browser = False
c.NotebookApp.password = ''
c.NotebookApp.token = ''
c.KernelSpecManager.ensure_native_kernel = False
c.KernelSpecManager.whitelist = {'kotlin'} |
# Copyright 2019 The Oppia 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 applicable ... |
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import torch
from torch.utils.data import Dataset
import numpy as np
import jsonlines
import json
from pytorch_transformers.tokeniz... |
#!/usr/bin/python3
# This file is part of libmodulemd
# Copyright (C) 2018 Red Hat, Inc.
#
# Fedora-License-Identifier: MIT
# SPDX-2.0-License-Identifier: MIT
# SPDX-3.0-License-Identifier: MIT
#
# This program is free software.
# For more information on the license, see COPYING.
# For more information on free softwar... |
import subprocess
import sys, os
from pathlib import Path
import unittest
from typing import List, Optional
import json
import neatest
from neatest._neatest import ModulesNotFoundError
def _pip_uninstall(package: str):
subprocess.run([sys.executable, '-m', 'pip', 'uninstall', package, '-y'],
c... |
# -*- coding: utf-8 -*-
"""Top-level package for ci-tests."""
__author__ = """James Morris"""
__email__ = 'actuallyjamez@gmail.com'
__version__ = '0.1.0'
|
class S3ProcessesAdapterError(Exception):
"""
This class is responsible for flagging errors in s3 processes.
"""
def __init__(self, message: str) -> None:
"""
The constructor for the S3ProcessesAdapterError class.
:param message: (str) the error message raised when being calle... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# LIFX V4 Controller - Constants © Autolog 2016
#
# plugin Constants
K_LOG_LEVEL_NOT_SET = 0
K_LOG_LEVEL_DETAILED_DEBUGGING = 5
K_LOG_LEVEL_DEBUGGING = 10
K_LOG_LEVEL_INFO = 20
K_LOG_LEVEL_WARNING = 30
K_LOG_LEVEL_ERROR = 40
K_LOG_LEVEL_CRITICAL = 50
K_LOG_LEVEL_TRANS... |
"""
Copyright 2021-present, Nuance, Inc.
All rights reserved.
This source code is licensed under the Apache-2.0 license found in
the LICENSE.md file in the root directory of this source tree.
"""
import json
import logging
import os
from providers import PhoneStore
import azure.functions as func
SUCCESS_CODE = '0'
... |
"""
Restart the WSGI daemon process in development when files have changed.
"""
import atexit
import os
import queue
import signal
import sys
import threading
__author__ = "Alex Laird"
__copyright__ = "Copyright 2018, Helium Edu"
__version__ = "1.1.15"
_interval = 1.0
_times = {}
_files = []
_running = False
_queue... |
from django.test import Client, TestCase
from django.contrib.auth import get_user_model
from django.urls import reverse
class AdminSiteTests(TestCase):
def setUp(self):
self.client = Client()
self.admin_user = get_user_model().objects.create_superuser(
email='admin@example.com',
... |
import numpy as np
from bnbML.Deep_Learning import ActivationFunctions
from bnbML.Utils import LossFunctions
from bnbML.Utils.Metrics import accuracy
from bnbML.Utils.Plotting import plotLossGraph
from bnbML.Utils.PreProcessing import normalize
import matplotlib.pyplot as plt
import pandas as pd
import progressbar
cl... |
import wx.dataview as wxdv
class ShowAllPipsModel(wxdv.DataViewIndexListModel):
def __init__(self, data):
wxdv.DataViewIndexListModel.__init__(self, len(data))
self.data = data
def GetColumnType(self, col):
"""默认全部是字符串类型"""
return "string"
def GetValueByRow(self, row, col)... |
#!/usr/bin/env python3
"""
Tools for setting up proplot and configuring global settings.
See the :ref:`configuration guide <ug_config>` for details.
"""
# NOTE: The matplotlib analogue to this file is actually __init__.py
# but it makes more sense to have all the setup actions in a separate file
# so the namespace of t... |
# coding: utf-8
"""
Copyright 2016 SmartBear Software
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... |
"""
Duplicate QE labels and map to extended QE vocabulary
Input: segmented_target_file, original_labels_file
Output: new_labels_file, where labels are copied where necessary to match the target segmentation
"""
import codecs
import logging
import sys
import argparse
from sequence_qe.dataset import parallel_iterato... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
from niftynet.utilities.user_parameters_helper import float_array
from niftynet.utilities.user_parameters_helper import int_array
from ... |
from django.db import models
from utils.models import CreatedUpdatedModel
from teams.models import Team
class Type(CreatedUpdatedModel):
"""
The events.Type model contains different types of system events which can happen.
New event types should be added in data migrations.
The following types are cur... |
# Generated by Django 3.1.7 on 2021-03-12 12:31
import diri.users.models
import diri.utils.storages
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0006_remove_entrepreneurs_acc_val'),
]
operations = [
migrations.AlterField(
... |
"""
These tests are originally part of CellProfiler, code licensed under both GPL and BSD licenses.
Website: http://www.cellprofiler.org
Copyright (c) 2003-2009 Massachusetts Institute of Technology
Copyright (c) 2009-2011 Broad Institute
All rights reserved.
Original author: Lee Kamentsky
"""
import numpy as np
from... |
# =================================================================
#
# Terms and Conditions of Use
#
# Unless otherwise noted, computer program source code of this
# distribution is covered under Crown Copyright, Government of
# Canada, and is distributed under the MIT License.
#
# The Canada wordmark and related grap... |
import logging
import os
import click
from pypgatk.ensembl.data_downloader import EnsemblDataDownloadService
from pypgatk.toolbox.exceptions import AppConfigException
this_dir, this_filename = os.path.split(__file__)
@click.command('ensembl-downloader', short_help='Command to download the ensembl information')
@cl... |
# import only system from os
from os import system, name
# define our clear function
def clear():
# for windows
if name == 'nt':
_ = system('cls')
# for mac and linux(here, os.name is 'posix')
else:
_ = system('clear')
# now call function we defined above
clear()
##################... |
import FWCore.ParameterSet.Config as cms
###The following configurations for efficiency loss are read from the DB by default
###If you want to set private inefficiency factors use this file and change the appropriate values
###The values below are set for 2012 running conditions
###For the PhaseI detector please change... |
import random
def justify():
candidate = [
'sky', 'tclan', 'william', 'yiming',
'rachael', 'michael', 'hugo', 'yugioh',
'changty', 'rinns', 'jimmy', 'kfira' ]
return candidate[random.randint(0, len(candidate)-1)]
|
# Copyright 2020 Huawei Technologies Co., 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 agree... |
#pythran export next_pythagorean_triples(int64[:,:])
#runas import numpy as np; next_pythagorean_triples(np.array([[3, 4, 5]]))
import numpy as np
def next_pythagorean_triples(previous):
matrices = np.array(
[[-1, 2, 2],
[-2, 1, 2],
[-2, 2, 3],
[1, 2, 2],
[2, 1, 2],
... |
import unittest
import numpy as np
import six
import chainer
from chainer import testing
from chainer_tests.dataset_tests.tabular_tests import dummy_dataset
def _filter_params(params):
for param in params:
key_size = 0
key_size += 3 if param['mode_a'] else 1
key_size += 2 if param['mode_... |
"""
Resistor Color
"""
COLOR_DCT = {
"black": 0,
"brown": 1,
"red": 2,
"orange": 3,
"yellow": 4,
"green": 5,
"blue": 6,
"violet": 7,
"grey": 8,
"white": 9,
}
def color_code(color):
"""
Return the color code in number
"""
return COLOR_DCT[color]
def colo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.