text
stringlengths
2
999k
""" Copyright 2020 Goldman Sachs. 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 di...
"""Test init of LCN integration.""" from unittest.mock import patch from pypck.connection import ( PchkAuthenticationError, PchkConnectionManager, PchkLicenseError, ) from homeassistant import config_entries from homeassistant.components.lcn.const import DOMAIN from homeassistant.config_entries import Con...
# # 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...
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
#!/usr/bin/env python2 # Copyright 2015 Dejan D. M. Milosavljevic # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
#!/usr/bin/env python import os import sys import re import utils assertNames = [ "uassert" , "massert" ] def assignErrorCodes(): cur = 10000 for root in assertNames: for x in utils.getAllSourceFiles(): print( x ) didAnything = False fixed = "" for lin...
import logging import json from contextlib import contextmanager from sqlalchemy import DateTime from sqlalchemy import inspect from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import Column, Unicode, String, create_engine, Integer from sqlalchemy.orm import sessionmaker # ## SQL DB Base = de...
# -*- coding: utf-8 -*- """ Created on Mon Sep 19 11:45:20 2016 @author: johnguttag """ import random, pylab, numpy #set line width pylab.rcParams['lines.linewidth'] = 4 #set font size for titles pylab.rcParams['axes.titlesize'] = 20 #set font size for labels on axes pylab.rcParams['axes.labelsize'] = 20 #set size ...
"""Common test utils for working with recorder.""" from datetime import timedelta from homeassistant import core as ha from homeassistant.components import recorder from homeassistant.helpers.typing import HomeAssistantType from homeassistant.util import dt as dt_util from tests.common import async_fire_time_changed,...
import json import nltk import numpy import os import pickle import random import re import sys import time import tensorflow import tflearn from nltk.stem.lancaster import LancasterStemmer from termcolor import colored, cprint from time import sleep CONST_REG = r'(?i)\b((?:https?:(?:/{1,3}|[a-z0-9%])|[a-z0-9.\-]+[.]...
from matplotlib import use import matplotlib.pyplot as plt use('Agg') class ImageMixin(object): def __init__(self, x, size=(640, 480), color_depth=3): self.x = x self.size = size self.color_depth = color_depth def transform(self): raise NotImplementedError() def save(se...
from typing import Callable, Dict, Optional, Union from Helper import Log, Level class Task: def __init__(self, name: str, parent, params: Optional[Dict] = None, logMethod: Optional[Callable] = None, conditionMethod: Optional[Callable] = None): from Executor import Execut...
from __future__ import unicode_literals import datetime import re from django import forms from django.contrib.auth.forms import ( AdminPasswordChangeForm, AuthenticationForm, PasswordChangeForm, PasswordResetForm, ReadOnlyPasswordHashField, ReadOnlyPasswordHashWidget, SetPasswordForm, UserChangeForm, Use...
# Copyright 2020 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...
#!/usr/bin/env python2 import re, argparse, sys, datetime, time from bluetooth import * devlist = [] def detect(): for (mac, name) in discover_devices(lookup_names=True): if mac not in devlist: devlist.append(mac) print("[%s] Detected: %s : \"%s\"" % (datetime.datetime.now(), str...
from __future__ import annotations from itertools import zip_longest from math import floor from typing import List, Tuple, Union class Category: STR_SIZE = 30 ledger: List[dict] balance: int def __init__(self, name: str): self.name = name self.ledger = [] def deposit(self, amo...
#!/usr/bin/python #coding=utf-8 ''' @author: sheng @license: ''' import unittest from meridian.acupoints import qishe44 class TestQishe44Functions(unittest.TestCase): def setUp(self): pass def test_xxx(self): pass if __name__ == '__main__': unittest.main()
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
import rethinkdb as r import modernremodel.connection run = r.ast.RqlQuery.run def remodel_run(self, c=None, **global_optargs): """ Passes a connection from the connection pool so that we can call .run() on a query without an explicit connection """ if not c: with modernremodel.connecti...
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
from Doubly_List import Doubly_List # Insert node to the head of Doubly Linked List # [head] 0 <-> 1 <-> 2 [Tail] mylist = Doubly_List() print('Insert node to the head of Doubly Linked List') mylist.insert_first(2) mylist.insert_first(1) mylist.insert_first(0) print('The list is:') mylist.print_list() print('Length is...
from .layers import CalculationLayer, CalculationLayerResult, CalculationLayerSchema from .plugins import ( calculation_layer, register_calculation_layer, register_calculation_schema, registered_calculation_layers, registered_calculation_schemas, ) __all__ = [ calculation_layer, Calculation...
from editor.attributes.player.player_attribute import ( PlayerAttribute, PlayerAttributeTypes, ) class PlayerAttributeAcceleration(PlayerAttribute): @classmethod def att_class_name(cls): return "Acceleration" @classmethod def att_class_type(cls): return PlayerAttributeTypes.St...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from refinery.lib.loader import load_detached as L import refinery as r from .. import TestUnitBase class TestMetaPushPop(TestUnitBase): def test_simple_variable_01(self): pl = L('emit "FOO BAR" [') | L('push') | L('snip :4') | L('pop oof') | L('nop') | L('c...
#!/usr/bin/env python import os import torch import torch.distributed as dist import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from math import ceil from random import Random from torch.autograd import Variable from torchvision import datasets, transforms class Partition(object): ...
# -*- coding: utf-8 -*- import argparse import hashlib import json import os import re import time os.environ['PYWIKIBOT_DIR'] = os.path.dirname(os.path.realpath(__file__)) import pywikibot from pywikibot.data.api import Request from config import config_page_name # pylint: disable=E0611,W0614 parser = argparse.Argu...
from django.core.management.base import BaseCommand from optparse import make_option class Command(BaseCommand): option_list = BaseCommand.option_list + ( make_option('--noinput', action='store_false', dest='interactive', default=True, help='Tells Django to NOT prompt the user for input of an...
from random import randint, choice as randchoice from time import time as current_time from datetime import timedelta from input import Box from constants import Colours import pygame import pygame.freetype import sys class Generate: def __init__(self): # Modify table into sudoku se...
from django import http from django.core.exceptions import PermissionDenied from django.db.models import Prefetch, Q from django.db.transaction import non_atomic_requests from django.shortcuts import get_object_or_404, redirect from django.utils.encoding import force_text from django.utils.translation import ugettext ...
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. # from .build import MODEL_REGISTRY, build_model # noqa from .custom_video_model_builder import * # noqa from .video_model_builder import ResNet, SlowFast # noqa
# coding=utf-8 # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor. # # 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/lice...
#!/usr/bin/env python # -*- coding: utf-8 -*- # @author: yewennuan # @Mail: ywnjohu@gmail.com # @date: 2020/7/24 16:17 import base64 import json import logging import random logger = logging.getLogger(__name__) def decrypt_token(token): try: args_str = base64.b64decode(token) except Exception as e: ...
import dlib import glob import cv2 import os opcoes = dlib.simple_object_detector_training_options() opcoes.add_left_right_image_flips = True opcoes.C = 5 #dlib.train_simple_object_detector("recursos/treinamento_delirium.xml", "recursos/detector_delirium.svm", opcoes) detector = dlib.simple_object_detector("recursos/...
from __future__ import unicode_literals import dvc.logger as logger from dvc.exceptions import DvcException from dvc.command.base import CmdBase class CmdLockBase(CmdBase): def run(self, unlock=False): for target in self.args.targets: try: self.repo.lock_stage(target, unlock=u...
# coding: utf-8 import argparse from distutils.version import LooseVersion import tempfile import json import pytest import torch from espnet.asr.pytorch_backend.asr_init import load_trained_model import espnet.lm.pytorch_backend.extlm as extlm_pytorch from espnet.nets.beam_search_transducer import BeamSearchTransdu...
#!/usr/bin/python3 # -*- coding: utf-8 -*- """ # @author : biao chen # @Email : chenbiao@sleepace.net # @Project : Python_Files # @File : utils.py # @Software: PyCharm # @Time : 2021/5/20 下午7:42 """ import os import struct import sys import time import traceback from datetime import datetime from pathlib import Path i...
# Copyright (c) 2013 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 ...
from setuptools import setup, find_packages __version__ = '0.3.0' LONG_DESCRIPTION = open("README.md", "r", encoding="utf-8").read() setup( name="modbusclc", version=__version__, author="Duk Kyu Lim", author_email="hong18s@gmail.com", long_description=LONG_DESCRIPTION, long_description_conten...
#!/usr/bin/env python """ Module for MRJob. Following https://pythonhosted.org/mrjob/guides/quickstart.html """ from mrjob.job import MRJob class MRWordcount(MRJob): def mapper(self, _, line): """ Read in line. Parse line into list of words. Yield words with a single count. """ ...
""" Support for Vera thermostats. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/switch.vera/ """ import logging from homeassistant.util import convert from homeassistant.components.climate import ClimateDevice, ENTITY_ID_FORMAT from homeassistant.const...
# -*- coding: utf-8 -*- """ Created on Sat Mar 26 08:53:26 2016 @author: tomas """ import sys import json import numpy as np from util import MAP, MAP_qbs if __name__ == '__main__': fold = int(sys.argv[1]) tmp_file = str(sys.argv[2]) ub = int(sys.argv[3]) with open('data/washington/washington_p...
"""Main classes to add caching features to ``requests.Session`` .. autosummary:: :nosignatures: CachedSession CacheMixin .. Explicitly show inherited method docs on CachedSession instead of CachedMixin .. autoclass:: requests_cache.session.CachedSession :show-inheritance: :inherited-members: .. aut...
#!/usr/bin/env python3 # Copyright (c) 2015-2017 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test unitd with different proxy configuration. Test plan: - Start unitd's with different proxy configu...
#!/usr/bin/python # Copyright (c) 2020, 2021 Oracle and/or its affiliates. # This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license. # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # Apache License v2.0 # See LICENSE.TXT for d...
# Copyright 2019 SiFive, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You should have received a copy of LICENSE.Apache2 along with # this software. If not, you may obtain a copy at # # https://www.apache.org/licenses/LI...
#!/usr/bin/env python # -*- coding: utf-8 -*- from .coil_combine import root_sum_squares from .transforms import fft_centered, ifft_centered __all__ = ('root_sum_squares', 'fft_centered', 'ifft_centered')
"""Map Filter Zip List Comprehensions Higher order functions A function that takes a function as a parameter and/or returns a function as it's return value Example: sorted map _ | -- modern alternative -> list comprehensions and generator expressions ...
import argparse import os import json import torch import torch.nn.functional as F from transformers import * import numpy as np import json import ast if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('--subset',type=str,default='aan') parser.add_argument('--gen_folder',typ...
# coding=utf-8 # Author: Jianghan LI # Question: 457.Circular_Array_Loop # Complexity: O(N) # Date: 2018-01-09 class Solution(object): # O(N^2), O(1) def circularArrayLoop(self, nums): """ :type nums: List[int] :rtype: bool """ n = len(nums) for i in range(n): ...
# coding: utf-8 # Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c...
import time import unittest from itsdangerous import BadSignature, SignatureExpired from werkzeug.exceptions import InternalServerError from response_operations_ui import create_app from response_operations_ui.common.token_decoder import ( decode_email_token, generate_email_token, ) class TestTokenDecoder(u...
COUNTRIES = { 'colombia': 31, 'argentina': 45, 'venezuela': 12, 'peru': 22, 'ecuador': 55, 'mexico': 143, } while True: country = str(input('Ingresa el nombre del pais: ')).lower() try: print('El numero de habiantes en {} es de {} millones de habitantes'. format(country , COUNTRIES[country])) except ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # NZ RealMe documentation build configuration file, created by # sphinx-quickstart on Tue Jul 9 22:26:36 2013. # # 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 # a...
# -*- coding: utf-8 -*- # Generated by Django 1.11.2 on 2017-10-25 15:52 from __future__ import unicode_literals import django.contrib.gis.db.models.fields from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('hnfp', '0010_auto_20171024_1648'), ] ope...
""" Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, add spaces in s to construct a sentence where each word is a valid dictionary word. Return all such possible sentences. Note: The same word in the dictionary may be reused multiple times in the segmentation. You may assu...
from sklearn_explain.tests.skl_datasets import skl_datasets_test as skltest skltest.test_class_dataset_and_model("iris" , "LGBMClassifier_17")
import os import librosa from tqdm import tqdm folder = '../data/km_kh_male/wavs' files = [f for f in os.listdir(folder) if f.endswith('.wav')] sampling_rate = 22050 total_duration = 0 for file in tqdm(files): fullpath = os.path.join(folder, file) y, sr = librosa.core.load(fullpath, sampling_rate) yt, ...
# Your code goes here if __name__ == "__main__": filename = 'students.csv' # Ecrivez une fonction permettant de récupérer toutes les lignes # du fichier CSV dans une list() `data` rows = # TODO print(f'\nLe fichier brut contient {len(rows)} lignes') # Les étudiants ont chacun un diplôme qui ...
import logging from PySide6.QtCore import QPointF from . import ( gui_utils, BaseElement, LineElement, ActorElement, PackageElement, EllipseElement, NoteElement, TextElement, ClassElement, ) from umlayer import model class SceneLogic: def __init__(self): self.temp_li...
from django.db import IntegrityError from django.contrib import auth from plok.models import Blog, Article, Comment from .ext_test_case import ExtTestCase class BlogTests(ExtTestCase): def can_save_and_load_blog(self): creator = auth.get_user_model().objects.create(username='creator') self.assertE...
#!/usr/bin/python # -*- coding: UTF-8 -*- import os import sys import json import sqlite3 import subprocess # SQLite3 aggregate 类 class Concatenate(): def __init__(self): self.itemList = [] def step(self, value): # print 'step(%r)' % value self.itemList.append(value) def finaliz...
# # Copyright 2021 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # import elasticsearch import json import logging from flask import Blueprint, jsonify, request, Response from aquarius.ddo_checker.ddo_checker import ( is_valid_dict_local, list_errors_dict_local, is_valid_dict_remote, ...
# Copyright 2018 Canonical 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...
# Copyright (C) 2013,2014 Nippon Telegraph and Telephone Corporation. # Copyright (C) 2013,2014 YAMAMOTO Takashi <yamamoto at valinux co jp> # # 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 # ...
import argparse import logging import asyncio import yaml import signal import sys import ssl import pkgutil import pathlib import cachetools import geoip2.database # create default logger for the dnstap receiver clogger = logging.getLogger("dnstap_receiver.console") # import all inputs from dnstap_receiver.inputs ...
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** 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 from .. import _utilitie...
# -*- coding: utf-8 -*- # @Time : 2020/7/16 10:08 # @Author : zhaohuayang # @email : zhaohuayang@myhexin.com import os import tensorflow as tf import threading import shutil TPU_NAMES = ['z1', 'z2', 'c1', 'c2'] GS_ROOT = "gs://squad_cx/xlnet_data" INIT_CKPT_DIR = f"xlnet_cased_L-24_H-1024_A-16" SQUAD_DIR = f"sq...
#----------------------------------------------------------------------------- # Copyright (c) 2012 - 2019, Anaconda, Inc., and Bokeh Contributors. # All rights reserved. # # The full license is in the file LICENSE.txt, distributed with this software. #-------------------------------------------------------------------...
import pytest @pytest.mark.skipif('Dot1' not in pytest.config.lldpd.features, reason="Dot1 not supported") class TestLldpDot1(object): def test_one_vlan(self, lldpd1, lldpd, lldpcli, namespaces, links): with namespaces(2): links.vlan('vlan100', 100, 'eth1') lld...
""" This defines a the Server's generic session object. This object represents a connection to the outside world but don't know any details about how the connection actually happens (so it's the same for telnet, web, ssh etc). It is stored on the Server side (as opposed to protocol-specific sessions which are stored o...
# Author: Acer Zhang # Datetime: 2021/5/26 # Copyright belongs to the author. # Please indicate the source for reprinting. import os from qpt.version import version as qpt_version from qpt.modules.base import SubModule, SubModuleOpt, TOP_LEVEL_REDUCE, LOW_LEVEL from qpt.kernel.qos import FileSerialize from qpt.kerne...
def lambda_handler(event, context): print("In lambda handler") resp = { "statusCode": 200, "headers": { "Access-Control-Allow-Origin": "*", }, "body": "Ryan Kroonenburg" } return resp
# encoding: utf-8 """ .. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com> """ from __future__ import absolute_import, unicode_literals import re def strip_quote(text, value): re_replace = re.compile("[\"']{:s}[\"']".format(value), re.MULTILINE) return re_replace.sub(value, text)
""" Example defining predictor class and losses for relational ERM model """ import tensorflow as tf from node_classification_with_features.node_classification_template import make_node_classifier from relational_erm.models.skipgram import _make_edge_list_logits, make_simple_skipgram_loss, make_weighted_loss def mak...
from mysql2mongodb.database import DatabaseFactory import mysql2mongodb def mysql_init(self, address="localhost", port=3306, user=None, password=None, database_name=None): """ Used to monkey patch new constructor for MysqlDatabase class :param self: :param address="localhost": :param...
from django.contrib.auth import get_user_model, authenticate from django.utils.translation import ugettext_lazy as _ from rest_framework import serializers class UserSerializer(serializers.ModelSerializer): """Serializer for the users objects""" class Meta: model = get_user_model() fields = (...
#!/usr/bin/env python """ Example script for testing quality of trained vxm models. This script iterates over a list of images and corresponding segmentations, registers them to an atlas, propagates segmentations to the atlas, and computes the dice overlap. Example usage is: test.py \ --model models/model.h5 ...
# -*- coding: utf-8 -*- ''' Azure (ARM) Resource State Module .. versionadded:: Fluorine :maintainer: <devops@decisionlab.io> :maturity: new :depends: * `azure <https://pypi.python.org/pypi/azure>`_ >= 2.0.0 * `azure-common <https://pypi.python.org/pypi/azure-common>`_ >= 1.1.8 * `azure-mgmt <https://pypi...
from django.conf import settings from django.http import HttpResponse from django.views.generic import View from django_mako_plus import view_function from django_mako_plus import RedirectException from django_mako_plus import PermanentRedirectException from django_mako_plus import InternalRedirectException from djang...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import time from src import InstaBot from src.check_status import check_status from src.feed_scanner import feed_scanner from src.follow_protocol import follow_protocol from src.unfollow_protocol import unfollow_protocol from multiprocessing import Process from ...
""" Generate cards JSON from APK CSV source. """ import csv import logging import os import re from .base import BaseGen from .util import camelcase_split logger = logging.getLogger(__name__) if os.environ.get('DEBUG') == '1': logging.basicConfig(level=logging.DEBUG) else: logging.basicConfig(level=logging....
import numpy as np from gym.spaces import Box from metaworld.envs.env_util import get_asset_full_path from metaworld.envs.mujoco.sawyer_xyz.sawyer_xyz_env import SawyerXYZEnv, _assert_task_is_set class SawyerPushEnvV2(SawyerXYZEnv): """ Motivation for V2: V1 was very difficult to solve because the ob...
# coding=utf-8 # *** WARNING: this file was generated by crd2pulumi. *** # *** 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 from ... import _utilities, _tables from . import outp...
# 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 agreed to...
from .configdev import Development from .configprod import Production Config = Development
NODE_SUBSCRIPTIONS_AVAILABLE = { 'comments': 'Comments added', 'file_updated': 'Files updated' } # Note: if the subscription starts with 'global_', it will be treated like a default # subscription. If no notification type has been assigned, the user subscription # will default to 'email_transactional'. USER_SU...
from icssploit import ( exploits, print_success, print_status, print_error, mute, validators, ) import socket import struct import time # define packet cotp_connect_packet = bytearray.fromhex('030000231ee00000000100c1020600c2' \ '0f53494d415449432d524f4f542d4553c' \ ...
import urllib2 import json def lambda_handler(event, context): if (event["session"]["application"]["applicationId"] != "amzn1.ask.endpoint"): raise ValueError("Invalid Application ID") if event["session"]["new"]: on_session_started({"requestId": event["request"]["requestId...
# -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available. Copyright (C) 2017-2019 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file except in co...
# Copyright (c) 2009, Giampaolo Rodola'. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Linux platform implementation.""" from __future__ import division import base64 import collections import errno import functools import glob import os...
from transfer_blend_shape.utils.api import conversion
# nlantau, 2020-12-28 import re def solution(s, m): if len(m) > 1: s = s.split("\n") r = "[" + "".join(m) + "]" print(r) print(s) com = re.compile(r) nl = list() for line in s: keep = com.search(line) if keep: print(...
def squares(a, b): sqrt_a, sqrt_b = a**(1/2), b**(1/2) lower = [int(sqrt_a), int(sqrt_a)+1][sqrt_a != int(sqrt_a)] upper = int(sqrt_b) return upper - lower + 1
# Takes a list of pairs of SNPs in LD # and a file with p-value of each SNP # and gives a list of SNPs to remove such that none of the pairs of # SNPs in LD remains. # Usage: python removeRelatedIndividuals.py <LD_file> <file with P-values> <rsid column in p-file> <p-value column in p-file> > out.remove # Garrett Won...
import sys import re class FatalError(Exception): """Class for throwing fatal errors.""" pass class ErrorReporter: """Class for reporting error messages.""" def __init__(self, warnings=False): # The warnings parameter determines whether to print nonfatal # errors to stderr or suppres...
# Fabric for deploying the spritecow app import os import datetime import ConfigParser from fabric.colors import yellow from fabric.api import local, env PROJECT_ROOT = os.path.dirname(os.path.realpath(__file__)) here = lambda *x: os.path.join(PROJECT_ROOT, *x) config = ConfigParser.ConfigParser() config.readfp(open...
from typing import FrozenSet from collections import Iterable from math import log, ceil from mathsat import msat_term, msat_env from mathsat import msat_make_constant, msat_declare_function from mathsat import msat_get_integer_type, msat_get_rational_type, msat_get_bool_type from mathsat import msat_make_and, msa...
import torch import torch.nn as nn import math import warnings from torch.functional import norm def trunc_normal(tensor, mean=0.0, std=1.0, a=-2.0, b=2.0): """ Fills the input tensor with`values drawn from a truncated normal distribution. The values are effectively drawn from the normal distribution(`N(...
# -*- coding: utf-8 -*- from __future__ import (absolute_import, division, print_function) import json from branca.element import Element, Figure from folium.map import Layer from folium.utilities import image_to_url, mercator_transform from jinja2 import Template class ImageOverlay(Layer): """ Used to l...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import re import sys try: from setuptools import setup except ImportError: from distutils.core import setup def get_version(*file_paths): """Retrieves the version from django_user_emulation/__init__.py""" filename = os.path.join(os.path.dirname(...