text
stringlengths
1
927k
import pandas as pd from taxonomic import ncbi n = ncbi.NCBI() taxonomic = pd.read_table('/g/bork1/coelho/DD_DeCaF/genecats.cold/GMGC10.taxonomic.map', index_col=0, engine='c') species = pd.read_table('/g/bork1/coelho/DD_DeCaF/genecats.cold/GMGC10.species.match.map', header=None, usecols=[1,2], index_col=0, squeeze=Tr...
# Copyright (c) 2020, NVIDIA CORPORATION. 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...
import asyncio import logging log = logging.getLogger(__name__) class Inbound: def __init__(self, loop, settings): self.loop = loop self.settings = settings self.inbox = asyncio.Queue(loop=self.loop) self.stop_event = asyncio.Event() def stop(self): self.stop_event.se...
# coding=utf-8 # Copyright (c) 2020, NVIDIA CORPORATION. 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 re...
from .function_arg_capture import capture_args from .serializable import Serializable __all__ = ["capture_args", "Serializable"]
#!/usr/bin/env python3 # This script updates icons from the SVG file import os import subprocess import sys BASEDIR = os.path.abspath(os.path.dirname(__file__)) inkscape_path = 'inkscape' if sys.platform == 'darwin': inkscape_app_path = '/Applications/Inkscape.app/Contents/Resources/script' if os.path.exist...
# -*- coding: utf-8 -*- import re from time import time from cachelib._compat import iteritems, to_native from cachelib.base import BaseCache, _items _test_memcached_key = re.compile(r'[^\x00-\x21\xff]{1,250}$').match class MemcachedCache(BaseCache): """A cache that uses memcached as backend. The first a...
import imageio import numpy as np import zengl from skimage.filters import gaussian import assets from window import Window imageio.plugins.freeimage.download() img = imageio.imread(assets.get('Terrain002.exr')) # https://ambientcg.com/view?id=Terrain002 normals = np.zeros((512, 512, 3)) normals[:, 1:-1, 0] = img[:...
""" Root system data for type A """ #***************************************************************************** # Copyright (C) 2008-2009 Daniel Bump # Copyright (C) 2008-2009 Justin Walker # Copyright (C) 2008-2009 Nicolas M. Thiery <nthiery at users.sf.net>, # # Distributed under the terms of th...
#!/usr/bin/env python """Some corpus statistics""" import random import litcorpt corpusdb = litcorpt.corpus_load() corpus = litcorpt.corpus(corpusdb) # Naive counting corpus_documents = len(corpus) # Expected: 5222 (in version 0.0.6) corpus_words = sum(True for document in corpus for word in document.split()) # E...
# -*- coding: utf-8 -*- ''' Management of package repos =========================== Package repositories can be managed with the pkgrepo state: .. code-block:: yaml base: pkgrepo.managed: - humanname: CentOS-$releasever - Base - mirrorlist: http://mirrorlist.centos.org/?release=$releasever&...
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: POGOProtos/Enums/Platform.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf.internal import enum_type_wrapper from google.protobuf import descriptor as _descriptor from google.protobuf im...
# src/openprocurement.tender.belowthreshold/openprocurement/tender/belowthreshold/models.py:246 from openprocurement.api.adapters import Serializable class SerializableTenderMultilotValue(Serializable): serialized_name = "value" serialize_when_none = False def __call__(self, obj, *args, **kwargs): ...
from django.http import JsonResponse, StreamingHttpResponse from django.shortcuts import get_object_or_404 from django.utils.datastructures import MultiValueDictKeyError from django.utils.decorators import method_decorator from django.views.decorators.http import condition from django.views.generic import ListView fro...
""" sphinx.builders.html ~~~~~~~~~~~~~~~~~~~~ Several HTML builders. :copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ import html import posixpath import re import sys import warnings from hashlib import md5 from os import path from typi...
import logging import shlex from rrmngmnt.service import Service logger = logging.getLogger(__name__) LV_CHANGE_CMD = 'lvchange -a %s %s/%s' class NFSService(Service): """ Storage management class to maintain NFS services """ def mount(self, source, target=None, opts=None): """ Moun...
from mock import patch import pytest import yaml # When switch to new version change EnvironmentPathNotFoundError to: # from sceptre.exceptions import InvalidSceptreDirectoryError from sceptre.exceptions import EnvironmentPathNotFoundError from sceptre_template_fetcher.template_fetcher import TemplateFetcher class ...
from app.models import User, Poll from app import db from flask import render_template, flash, redirect, url_for, Markup, current_app from flask_login import login_required, current_user, login_user, logout_user from sqlalchemy.orm.attributes import flag_modified import sys from datetime import datetime import operator...
# -*- coding: UTF-8 -*- """ Define public APIs that are used by users here. """ import os import warnings from copy import copy from typing import Union import regex from chicksexer import PACKAGE_ROOT from ._encoder import UnseenCharacterException from .constant import POSITIVE_CLASS, NEGATIVE_CLASS, NEUTRAL_CLASS, ...
""" License manager module. Define a license key and a license manager classes. """ from __future__ import print_function import datetime import hashlib from os.path import isfile, join import logging from six import PY3 from six import string_types from traits.api import Any, Bool, Date, HasStrictTraits, Instance, L...
obj0 = SystemBusNode() obj1 = SystemBusDeviceNode( qom_type = "TYPE_INTERRUPT_CONTROLLER", system_bus = obj0, var_base = "interrupt_controller" ) obj2 = SystemBusDeviceNode( qom_type = "TYPE_UART", system_bus = obj0, var_base = "uart" ) obj3 = DeviceNode( qom_type = "TYPE_CPU", var_ba...
# -*- coding: utf-8 -*- # Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Un...
from datetime import datetime import pandas as pd import pytz from nowcasting_dataset.data_sources.gsp.pvlive import ( get_installed_capacity, load_pv_gsp_raw_data_from_pvlive, ) def test_load_gsp_raw_data_from_pvlive_one_gsp_one_day(): """ Test that one gsp system data can be loaded, just for one d...
import _plotly_utils.basevalidators class VolumeValidator(_plotly_utils.basevalidators.CompoundValidator): def __init__(self, plotly_name="volume", parent_name="", **kwargs): super(VolumeValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, data_c...
import enum from app import db from app.models.user import User class OrganizationRank(enum.Enum): owner = 1 admin = 2 active_member = 3 inactive_member = 4 applicant = 5 class OrganizationStatus(enum.Enum): pending = 1 approved = 2 denied = 3 unverified = 4 class OrganizationUser...
from unittest import TestCase from collective.solr.parser import SolrFlare from collective.solr.flare import PloneFlare class FlareTests(TestCase): def testRelevanceFormatting(self): def score(**kw): return PloneFlare(SolrFlare(**kw)).data_record_normalized_score_ self.assertEqual(sc...
#!/usr/bin/env python import numpy class Point: """Represents a point in 2D.""" def __init__(self, x, y): self.x = x self.y = y def euclidean_dist(p1, p2): """Euclidean distance of two 2D points.""" from math import sqrt return sqrt((p1.x-p2.x)**2 + (p1.y-p2.y)**2) def get_min...
""" Tests for emitting junit xml """ from junit2htmlreport import parser, merge def test_case_tojunit_failed(): """ Test coverting a failed case to xml :return: """ testclass = parser.Class() testclass.name = "myclass" testcase = parser.Case() testcase.name = "mytest" testcase.tes...
# -*- coding:utf-8 -*- #!/usr/bin/env python """ Date: 2019/9/30 13:58 Desc: 奇货可查网站目前已经商业化运营, 特提供奇货可查-指数数据接口, 方便您程序化调用 注:期货价格为收盘价; 现货价格来自网络; 基差=现货价格-期货价格; 基差率=(现货价格-期货价格)/现货价格 * 100 %. """ from typing import AnyStr import pandas as pd import requests from akshare.futures.cons import ( QHKC_INDEX_URL, QHKC_IND...
from absl.testing import absltest from pylox.parser import scanner Token = scanner.Token TokenType = scanner.TokenType scan = scanner.scan class ScannerTest(absltest.TestCase): def test_eof(self): assert list(scan('')) == [Token(TokenType.EOF, '', None, 1)] if __name__ == '__main__': absltest.main()
import os import torch from torch import nn from torch.autograd import Function from torch.utils.cpp_extension import load module_path = os.path.dirname(__file__) fused = load( 'fused', sources=[ os.path.join(module_path, 'fused_bias_act.cpp'), os.path.join(module_path, 'fused_bias_act_kernel...
# noinspection PyShadowingBuiltins,PyUnusedLocal def compute(x, y): return x + y
from functools import reduce, wraps, partial from itertools import product from operator import mul import collections import operator import random import torch import numpy as np from torch._six import inf from torch.autograd import Variable import collections.abc from typing import List, Sequence, Tuple, Dict, Any...
from zeeguu.core.test.rules.article_rule import ArticleRule from zeeguu.core.test.rules.base_rule import BaseRule from zeeguu.core.test.rules.language_rule import LanguageRule from zeeguu.core.test.rules.url_rule import UrlRule from zeeguu.core.model.text import Text class TextRule(BaseRule): """A Rule testing cl...
# 19 July 2014 # in case any of this upsets Python purists it has been converted from an equivalent JRuby program # this is designed to work with ... ArduinoPC2.ino ... # the purpose of this program and the associated Arduino program is to demonstrate a system for sending # and receiving data between a PC and an ...
""" WSGI config for epixdeploy 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/2.1/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SE...
#!/usr/bin/python ################################################################################ # # File: wiimode_node.py # RCS: $Header: $ # Description: Top level ROS node that publishes Wiimote data # and allows Wiimote rumble/LED setting. # Author: Andreas Paepcke # Created:...
# 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 ...
# Copyright 2019 Extreme Networks, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
#! /usr/bin/env python3 """A program to verify output of prophyle-assembler. Author: Karel Brinda <kbrinda@hsph.harvard.edu> Licence: MIT """ import sys import re from Bio import SeqIO in1_fn = sys.argv[1] in2_fn = sys.argv[2] out1_fn = sys.argv[3] out2_fn = sys.argv[4] inter_fn = sys.argv[5] k = int(sys.argv[6]) ...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import pycocotools.coco as coco from pycocotools.cocoeval import COCOeval import numpy as np import json import os import torch.utils.data as data import src.config as cf sensor = 'fir' class FIR(data.Datase...
# Copyright 2021 the authors. # This file is part of Hy, which is free software licensed under the Expat # license. See the LICENSE. from __future__ import unicode_literals from contextlib import contextmanager from math import isnan, isinf from hy import _initialize_env_var from hy.errors import HyWrapperError from f...
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import os import lib import api import inspect from glob import glob from core.alert import messages from core.alert import info from core.alert import warn from core._die import __die_failure from core.compatible import is_windows from core.config import _core_...
#!/usr/bin/env python # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Enhances `git log --graph` view with information on commit branches + tags that point to them. Items are colorized as follows: *...
# 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 u...
import unittest from onmt.translate.random_sampling import RandomSampling import torch class TestRandomSampling(unittest.TestCase): BATCH_SZ = 3 INP_SEQ_LEN = 53 DEAD_SCORE = -1e20 BLOCKED_SCORE = -10e20 def test_advance_with_repeats_gets_blocked(self): n_words = 100 repeat_idx ...
import os import zipfile import tarfile import io from collections import defaultdict, namedtuple import pytest import mock from chalice.config import Config from chalice import Chalice from chalice import package from chalice.deploy.packager import PipRunner from chalice.deploy.packager import DependencyBuilder from...
# -*- coding: utf-8 -*- """Setup module for BioKEEN.""" import setuptools if __name__ == '__main__': setuptools.setup()
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = "Larissa Triess" __email__ = "mail@triess.eu" from typing import List import tensorflow as tf from my_tf_ops.knn_op import k_nearest_neighbor_op as get_knn from ..layers.sample_and_group import group class FeaturePropagationModule(tf.keras.models.Model)...
import torch import torch.nn as nn class ComplexResGate(nn.Module): def __init__(self, embedding_size): super(ComplexResGate, self).__init__() self.fc1 = nn.Linear(2*embedding_size, 2*embedding_size) self.fc2 = nn.Linear(2*embedding_size, embedding_size) self.sigmoid = nn.Sigmoid()...
class DrawTree(object): def __init__(self, tree, depth=-1): self.x = -1 self.y = depth self.tree = tree self.children = [DrawTree(t) for t in tree] self.thread = None self.offset = 0 def left(self): return self.thread or len(self.children) and self.child...
from pydantic import BaseModel from src.User.InterfaceAdapters.Payloads.UserAssignRolePayload import UserAssignRolePayload from typing import List class UserAssignRoleRequest(UserAssignRolePayload, BaseModel): rolesId: List[str] = [] def getRolesId(self): return self.rolesId
""" Copyright 2020 The Magma Authors. This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES O...
# 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...
# Copyright 2010-2011 OpenStack Foundation # Copyright (c) 2013 Hewlett-Packard Development Company, L.P. # # 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/licens...
""" submit failure or test session information to a pastebin service. """ import pytest import py, sys import tempfile def pytest_addoption(parser): group = parser.getgroup("terminal reporting") group._addoption('--pastebin', metavar="mode", action='store', dest="pastebin", default=None, choic...
import torch import torch.nn as nn import torch.nn.functional as F def initial_bounds(x0, epsilon): ''' x0 = input, b x c x h x w ''' upper = x0+epsilon lower = x0-epsilon return upper, lower def weighted_bound(layer, prev_upper, prev_lower): prev_mu = (prev_upper + prev_lower)/2 prev_...
""" Note: This script is imported from scikit-learn 0.20.X, because scikit-learn 0.21.0 is no longer supported these functions """ """ Randomized Lasso/Logistic: feature selection based on Lasso and sparse Logistic Regression """ # Author: Gael Varoquaux, Alexandre Gramfort # # License: BSD 3 clause import itertools...
import warnings from leapp.exceptions import StopActorExecutionError from leapp.libraries.stdlib import api from leapp.libraries.common import rpms from leapp.models import InstalledRPM, RPM no_yum = False no_yum_warning_msg = "package `yum` is unavailable" try: import yum except ImportError: no_yum = True ...
""" Disclaimer All investment strategies and investments involve risk of loss. Nothing contained in this program, scripts, code or repositoy should be construed as investment advice.Any reference to an investment's past or potential performance is not, and should not be construed as, a recommendation or as a guarantee...
# -*- coding: utf-8 -*- """ har2lilua Tests """ from __future__ import unicode_literals from io import open import unittest from har2lilua import har2lilua def _read_testfiles(): with open("test.har", "r", encoding="utf-8") as fil: harstring = fil.read() with open("test.lua", "r", encoding="utf-8") as...
#!/usr/bin/env python # 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, sof...
import torch import torch.nn as nn class MNIST(nn.Module): def __init__(self): super(MNIST, self).__init__() self.shared_encoder = torch.nn.Sequential( nn.Conv2d(in_channels=1, out_channels=32, kernel_size=5, padding=2), nn.ReLU(inplace=True), nn.MaxPool2d(2, 2)...
# -*- coding: utf-8 -*- import os import sys import idcmanager_sdk.model.idcmanager.user_setting_pb2 import google.protobuf.empty_pb2 import idcmanager_sdk.api.idcrack.list_pb2 import idcmanager_sdk.api.idcrack.list_device_type_pb2 import idcmanager_sdk.api.idcrack.list_user_setting_pb2 import idcmanager_sdk.api...
# coding: utf-8 """ SCORM Cloud Rest API REST API used for SCORM Cloud integrations. # noqa: E501 OpenAPI spec version: 2.0 Contact: systems@rusticisoftware.com Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re # noqa: F401 import six class UserIn...
# Copyright 2017 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
"""Adds a discoverable field to terms. Revision ID: 85bff3e51dc4 Revises: ab9879051d6c Create Date: 2020-07-09 09:54:09.343487 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = "85bff3e51dc4" down_revision = "ab9879051d6c" branch_labels = None depends_on = None ...
# Generated from STIXPattern.g4 by ANTLR 4.8 # encoding: utf-8 from __future__ import print_function from antlr4 import * from io import StringIO import sys def serializedATN(): with StringIO() as buf: buf.write(u"\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3") buf.write(u"8\u00eb\4\2\t\2\4...
""" ASGI config for danniesMovies project. It exposes the ASGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/ """ import os from django.core.asgi import get_asgi_application os.environ.setdefault('DJANGO...
#!/usr/bin/env python # coding: utf8 # # Copyright (c) 2020 Centre National d'Etudes Spatiales (CNES). # # This file is part of CARS # (see https://github.com/CNES/cars). # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obta...
import theano.tensor as TT import theano from rllab.misc import logger from rllab.misc.overrides import overrides from rllab.misc import ext from rllab.algos.batch_polopt import BatchPolopt from rllab.optimizers.first_order_optimizer import FirstOrderOptimizer from rllab.core.serializable import Serializable class VP...
class Group(object): def __init__(self, _name): self.name = _name self.groups = [] self.users = [] def add_group(self, group): self.groups.append(group) def add_user(self, user): self.users.append(user) def get_groups(self): return self.groups def ...
#!/usr/bin/env python # Copyright (c) 2015-2016 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. ''' This checks if all command line args are documented. Return value is 0 to indicate no error. Author: @...
# Generated by Django 3.1.7 on 2021-03-04 07:55 from django.db import migrations, models import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ('notification', '0003_notifications_tweeter'), ] operations = [ migrations.AddField( model_name='not...
# ------------------------------------------------- # IMPORTS # ------------------------------------------------- import numpy as np from tensorflow import set_random_seed seed = 1 np.random.seed(seed) set_random_seed(seed) import keras import tempfile import keras.models from keras import backend as K from shift_d...
def printTime(remtime): hrs = int(remtime)/3600 mins = int((remtime/60-hrs*60)) secs = int(remtime-mins*60-hrs*3600) timedisp="Time remaining : " if hrs>0: timedisp+=str(hrs)+"Hrs " if mins>0: timedisp+=str(mins)+"Mins " timedisp += str(secs)+"Secs" print(timedisp)
""" Regression tasks estimate a numeric variable, such as the price of a house or voter turnout. This example is adapted from a [notebook](https://gist.github.com/mapmeld/98d1e9839f2d1f9c4ee197953661ed07) which estimates a person's age from their image, trained on the [IMDB-WIKI](https://data.vision.ee.ethz.ch/cvl/rro...
"""Check behaviors of ``Line2D``. """ import numpy as np import matplotlib.pyplot as plt from figpptx.comparer import Comparer class Line2DCheck: """Line2DCheck. """ @classmethod def run(cls, ax): cls.various_line2d(ax) Comparer().compare(ax.figure) @classmethod def various_l...
import unittest from context import parser class TVShowFileParserTests(unittest.TestCase): def setUp(self): self.filename = parser.Parser("S.W.A.T.s01E01.1080p.avi") def tearDown(self): self.filename = None def testObjValuesSet(self): self.assertEqual(self.filename._showName, "S...
""" This module runs octave modules copyright (c) P-O Quirion Centre de recherche de l'institut de Gériatrie de Montréal Université de Montréal, 2015-2016 Maintainer : poq@criugm.qc.ca Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (th...
# tagging those table rows in new-north-shore-network.md still doesn't work # warn for single space indent in a few places (generic block and tag) from . import regexshim as _re from . import errors from .blocks import FakeFormatStdBlocks from .elements import * from .lineparser import * _IN_PARAGRAPH = Sentinel("I...
import os import git import shutil import tempfile import yaml from distutils import dir_util import mock import pytest import mlflow from mlflow.entities import RunStatus, ViewType, Experiment, SourceType from mlflow.exceptions import ExecutionException, MlflowException from mlflow.store.file_store import FileStor...
from __future__ import print_function import FWCore.ParameterSet.Config as cms import sys import six ## Helpers to perform some technically boring tasks like looking for all modules with a given parameter ## and replacing that to a given value # Next two lines are for backward compatibility, the imported functions an...
import numpy as np import cv2 import socket #define #Curryのしきい値 Edge_min = 100 Edge_max = 200 lazer_on_message='lazer_on' lazer_off_message='lazer_off' frame_start_message='frame_start' def send_udp_message(message): try: udp.sendto(message.encode(), address) #文字列をバイトデータに変換してaddress宛に送信 except Keyboard...
from pyinfra import host from pyinfra.operations import files # Note: This requires files in the files/ directory. SUDO = True if host.fact.linux_name in ['CentOS', 'RedHat']: files.download( {'Download the Docker repo file'}, 'https://download.docker.com/linux/centos/docker-ce.repo', '/e...
# -*- coding: utf-8 -*- import os import json import pickle from datetime import datetime, timedelta import numpy as np import pandas as pd from utils import day_of_month def is_first_day(shop_timeline, seq, dt): '''Jude whether a day is the first day of the sequence ''' timeline = shop_timeline[seq] ...
import io import sys import time import gzip import random import pandas as pd def parse_vcf(vcf_path: str, tumor_normal: bool = False, ploidy: int = 2, include_homs: bool = False, include_fail: bool = False, debug: bool = False, choose_random_ploid_if_no_gt_found: bool = True): tt = ...
#!/usr/bin/env python """Django's command-line utility for administrative tasks.""" import os import sys def main(): os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mylib.settings') try: from django.core.management import execute_from_command_line except ImportError as exc: raise ImportEr...
# -*- coding: utf-8 -*- """**DOCSTRING**. description Routing Listings ---------------- """ ############################################################################### # IMPORTS # GENERAL import numpy as np import astropy.units as u import matplotlib.pyplot as plt from matplotlib import rcParams import seab...
import os import logging from abc import ABCMeta, abstractmethod from six import add_metaclass import requests from util.abchelpers import nooper from util.repomirror.validator import RepoMirrorConfigValidator from _init import CONF_DIR TOKEN_VALIDITY_LIFETIME_S = 60 # Amount of time the repo mirror has to call the...
"""Process simulation results.""" import sys import os import pathlib import mmap import numpy import pandas timesteps = (1e-2, 1e-3, 1e-4, 1e-5) def save_results_csv(results): """Save results to seperate CSV files.""" with open("results-IP.csv", "w", newline="") as f: scene_names = sorted(list(res...
import os import uuid import base64 import multiprocessing import traceback import tr from flask import Flask, request, jsonify from flask_cors import CORS app = Flask(__name__) CORS(app) def tr_run(path, return_dict): try: return_dict['ret'] = tr.run(path) except: return_dict['ret'] = None ...
# -*- coding: utf-8 -*- ########################################################################### # Copyright (c), The AiiDA team. All rights reserved. # # This file is part of the AiiDA code. # # ...
# -*- coding: utf-8 -*- # # Copyright (C) 2012-2020 Edgewall Software # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms # are also available at https://trac.edgewall.org/wiki/TracLicense. # # This software cons...
"""Create and save random price data""" from random import random import os from datetime import datetime, timedelta import pandas as pd # type: ignore def random_walker(data_length: int): """Create a random walk data list""" # seed(1) random_walk = list() random_walk.append(-1 if random() < 0.5 else...
from abc import ABC, abstractmethod class AbstractStatistcs(ABC): @abstractmethod def __init__(self, *args): # Args can be used for building from dumped strings. # Init needs to implement load from string. pass @abstractmethod def __str__(self): pass @abstractmeth...
import sys mass_file=open('integer_mass_table.txt') mass_table = {} for line in mass_file: aa, mass = line.rstrip().split(' ') mass_table[int(mass)] = aa def SpectrumGraph(spectrum): adj_list = [] for i in range(len(spectrum)): for j in range(i, len(spectrum)): if spectrum[j] - sp...
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT license. import unittest import ast from textwrap import dedent import inspect from typing import List, Tuple from pyis.onnx.transpiler.passes.type_infer import TypeInfer from pyis.onnx.transpiler.ast_printer import pformat_ast class...
# Code in this file is copied and adapted from # https://github.com/openai/evolution-strategies-starter and from # https://github.com/modestyachts/ARS from collections import namedtuple import logging import numpy as np import random import time import ray from ray.rllib.agents import Trainer, with_common_config from...
from PySide2.QtCore import Qt, QCoreApplication from PySide2.QtGui import QShowEvent from PySide2.QtWidgets import QDialog, QDialogButtonBox, QVBoxLayout, QFormLayout, QLabel, QComboBox, \ QWidget, QSizePolicy from livia.input.DeviceFrameInput import Device from livia_ui.gui.views.utils.DevicePanel import DevicePa...