content
stringlengths
5
1.05M
# -*- coding: utf-8 -*- # <nbformat>3.0</nbformat> # <codecell> import os, os.path import concurrent.futures import csv import urllib.request import shutil import gzip os.chdir('/home/will/AutoMicroAnal/') # <codecell> with open('MicroarraySamples.tsv') as handle: microdata = list(csv.DictReader(handle, delimi...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from frappe import _ def get_data(): return [ { "label": _("Documents"), "items": [ { "type": "doctype", "name": "Files", "description": _("Files.") }, { "type": "doctype", "name": "Fuel Reques...
JSON = { "id": "999", "to": { "data": [ { "id": "1", "name": "Person One" }, { "id": "2", "name": "Person Two" }, { "id": "3", "name": "Person Three" }, { "id": ...
#!/usr/bin/env python2.7 # example # An example to retrieve incident mttr statistics per analyst # # Author: Slavik Markovich # Version: 1.0 # import argparse from datetime import date, datetime, timedelta import csv import demisto def format_dt(dt): return dt.strftime('%Y-%m-%dT%H:%M:%S') def pars...
import emoji print(emoji.emojize('Ola! :smiling_imp:', use_aliases=True))
import unittest from apal_cxx import PyPolynomialTerm, PyPolynomial class TestPhaseFieldPolynomial(unittest.TestCase): def test_phase_field_poly(self): term1 = PyPolynomialTerm([2, 3]) term2 = PyPolynomialTerm([1, 2]) poly = PyPolynomial(2) poly.add_term(1.0, term1) poly.a...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('Web', '0031_auto_20181030_1839'), ] operations = [ migrations.CreateModel( name...
import csv import datetime import gzip import json import os import subprocess import sys from xml.etree import ElementTree import hail as hl from tqdm import tqdm from data_pipeline.datasets.gnomad_v3.gnomad_v3_mitochondrial_variants import ( FILTER_NAMES as MITOCHONDRIAL_VARIANT_FILTER_NAMES, ) from data_pipeli...
import datetime class Solution: # @return a string def convert(self, s, nRows): l = len(s) if nRows==1 or nRows>=l: return s else : dim = l - nRows + 1 arr = [([''] * dim) for i in range(nRows)] x = y = 0 # position d = 0 # 2 direction 0 down 1 right up for ...
#!/usr/bin/env python3 import os import sys import pdb CUR_DIR = os.path.abspath(os.path.dirname(__file__)) class Parser(object): def __init__(self): self.config = {} # self.config['SYSTEM'] = 'Linux kernel ...' self.data = {} # self.data[ self.key ] = {self.schema:VALUE} self.ke...
# coding: utf-8 #----------------------------------------------------------------------------- # Imports #----------------------------------------------------------------------------- # stdlib import errno import logging import os import random import select import signal import socket import sys import threading imp...
import json from indy.ledger import build_ledgers_freeze_request, build_get_frozen_ledgers_request from plenum.test.helper import sdk_get_and_check_replies, \ sdk_send_signed_requests, sdk_sign_and_submit_req_obj, sdk_multi_sign_request_objects, sdk_json_to_request_object def sdk_send_freeze_ledgers(looper, sdk_...
# -*- coding: utf-8 -*- """Module for defining classes that handle the conversion between bytes and data structures. """ import struct __author__ = 'andreas@blixt.org (Andreas Blixt)' __all__ = ['Array', 'Marshaler', 'MarshalerInitializer'] class MarshalerInitializer(type): """Meta-class for setting up new cl...
# -*- coding: utf8 -*- from __future__ import print_function, unicode_literals import json import logging from . import BaseParser logger = logging.getLogger("config") class ThreathunterJsonParser(BaseParser): """ Parse config from json with threathunter format. Threathunter api uses special json for...
"""Class implementation for the rotation_around_center_interface interface. """ from typing import Dict from apysc._animation.animation_rotation_around_center_interface import \ AnimationRotationAroundCenterInterface from apysc._type.attr_linking_interface import AttrLinkingInterface from apysc._type.int...
# flake8: noqa # type: ignore from .bot import PotiaBot from .paginator import * from .redis import RedisBridge from .utils import *
import os import shutil import sys import time import tempfile __test__ = {} ROOT = os.path.dirname( os.path.dirname( os.path.dirname( os.path.dirname(__file__)))) DYNOMITE = os.path.join(ROOT, 'bin', 'dynomite') TMP_DIR = None def setup_module(): cmd = "%s start -o dpct1 -p 11222 -t 9200 --data '%...
from EAB_tools.tools import ( display_and_save_df, hash_df, )
#!/usr/bin/env python import server import supervisor class MinionServer(server.Server): def __init__(self, ip, port): super(MinionServer, self).__init__(ip, port) def handle(self, data): """Start a worker. Message format: { 'image': 'image name' ...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys # Hack so you don't have to put the library containing this script in the PYTHONPATH. sys.path = [os.path.abspath(os.path.join(__file__, '..', '..'))] + sys.path import argparse import numpy as np from os.path import join as pjoin from smartlearner ...
# -*- coding: utf-8 -*- from sqlalchemy import Column, text from sqlalchemy.dialects.mysql import TIMESTAMP class MysqlTimestampsMixin: created_at = Column( "created_at", TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP"), ) updated_at = Column( "updated_at", TIMES...
from django.core.management.base import BaseCommand from users.models import Major, Minor, Course from django.db import IntegrityError from os import path import json class Command(BaseCommand): def _create_majors(self): base_path = path.dirname(__file__) majors_path = path.abspath(path.join(base_...
import os def is_windows(): return os.name == 'nt' def is_linux(): return os.name =='posix' def is_raspberrypi(): return is_linux() and os.uname()[1] == 'raspberrypi'
# -*- coding: utf-8 -*- from __future__ import absolute_import import pytest from sentry import eventstore from sentry.event_manager import EventManager START_TIME = 1562873192.624 END_TIME = 1562873194.624 @pytest.fixture def make_spans_snapshot(insta_snapshot): def inner(data): mgr = EventManager(da...
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright 2016 Red Hat | Ansible # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type DOCUMENTATION = ''' --- module: docker_image_load short_de...
# coding: utf-8 # /*########################################################################## # # Copyright (c) 2017 European Synchrotron Radiation Facility # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal #...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Users', fields=[ ('id', models.AutoField(verbos...
import math import random import sys from threading import * class Ant(Thread): def __init__(self, ID, start_node, colony, beta, q0, rho): Thread.__init__(self) self.ID = ID self.start_node = start_node self.colony = colony self.curr_node = self.start_node self.grap...
# first create an empty list and append the strings into it, # by taking inputs from user a = [] list_size = int(input("Please enter the size of List: ")) for i in range(list_size): n = str(input("Please enter your desired string: ")) a.append(n) print("You entered", a, "as list.") # now create an another emp...
import argparse from Bio import pairwise2 import numpy as np from itertools import combinations parser = argparse.ArgumentParser() parser.add_argument("-t","--folderToWrite",type=str,help="Input a folder in which you want to write files into") parser.add_argument("-m","--motifType",type=str,help="Input one of the of t...
#!/usr/bin/env python # -*- coding: utf-8 -*- """Exercise 9.14 from Kane 1985.""" from __future__ import division from sympy import expand, symbols from sympy.physics.mechanics import ReferenceFrame, Point from sympy.physics.mechanics import dot, dynamicsymbols from util import msprint, partial_velocities from util im...
# # Copyright (C) 2020 Satoru SATOH <satoru.satoh@gmail.com>. # SPDX-License-Identifier: MIT # # ref. https://serverspec.org/resource_types.html#group # ref. https://testinfra.readthedocs.io/en/latest/modules.html#group # """User related tests. """ import typing from ..common import get_group_by_name def get(name: s...
import uvicore from uvicore.typing import Dict from uvicore.package import ServiceProvider from uvicore.support.dumper import dump, dd from uvicore.console.provider import Cli from uvicore.support.module import load from uvicore.console import group as cli_group from uvicore.console import bootstrap from uvicore.founda...
from decouple import config SANIC_HOST = config("SANIC_HOST", default="0.0.0.0") SANIC_PORT = config("SANIC_PORT", default="8000", cast=int) SANIC_DEBUG = config("SANIC_DEBUG", default="False", cast=bool) POSTGRES_DB = config("POSTGRES_DB") POSTGRES_HOST = config("POSTGRES_HOST") POSTGRES_PASSWORD = config("POSTGRES...
import os import numpy as np import pandas as pd from keras import models, optimizers, backend from keras.layers import core, convolutional, pooling from sklearn import model_selection,utils from dataPreprocessing import generate_samples, preprocess if __name__ == '__main__': # Read splitted data df_train =...
from django import template from django.db.models import Count from django.db.models.functions import TruncMonth register = template.Library()
# uncompyle6 version 3.2.0 # Python bytecode 2.4 (62061) # Decompiled from: Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)] # Embedded file name: pirates.destructibles.DistributedBarrel from pirates.piratesbase.PiratesGlobals import * from direct.interval.IntervalGlobal import * fr...
#!/usr/bin/python3 # -*- coding: utf-8 -*- """ Created on Jan, 2019 All the information shall come from the wssubjson and the wssubsoillulatlon file. @author: qyfen """ ####################################################### # Environment setting ####################################################### import sys,os...
# pieces from Classes import * # black pieces black_a_rook = Rook("black", (0, 0)) black_b_knight = Knight("black", (0, 1)) black_c_bishop = Bishop("black", (0, 2)) black_d_queen = Queen("black", (0, 3)) black_e_king = King("black", (0, 4)) black_f_bishop = Bishop("black", (0, 5)) black_g_knight = Knight("black", (0, ...
class ExceptionResourceTracker: class AttributeAlreadyExist(Exception): def __init__(self, resource_group_name, attribute_name): super().__init__(f"Attribute {attribute_name} already exist in {resource_group_name}")
# Autogenerated from KST: please remove this line if doing any edits by hand! import unittest from docstrings_docref_multi import DocstringsDocrefMulti class TestDocstringsDocrefMulti(unittest.TestCase): def test_docstrings_docref_multi(self): with DocstringsDocrefMulti.from_file('src/fixed_struct.bin') ...
""" Class String Helper @author Moch Nurhalimi Zaini D <moch.nurhalimi@gmail.com> @author Irfan Andriansyah <irfan@99.co> """ import base64 class StringHelper: """ Helper for transform string """ @staticmethod def decode_base64(text): """Decode base64, padding being optional. U...
import time import torch from cubework.module.loss.loss_3d import CrossEntropyLoss3D, VocabParallelCrossEntropyLoss3D from cubework.module.module_std import ClassifierSTD, PatchEmbeddingSTD from cubework.module.parallel_3d import ( Classifier3D, Embedding3D, LayerNorm3D, Linear3D, PatchEmbedding3D,...
from flask import Flask, make_response, jsonify app = Flask('docker-flask:dev') @app.route('/', methods=['GET']) def root(): return make_response( jsonify({'message': 'Hello from Flask', 'env': 'dev'}))
from Logics.BluetoothManager import BluetoothManager from data import ServerEnvelope, PebbleCommand from services.IncomingPebbleMessageService import IncomingPebbleMessageService from injector import inject, singleton import threading class IncomingMessageService(object): @singleton @inject(bluetoothManager =...
import unittest import numpy as np from gnn import GraphNeuralNetwork from optimizer import SGD, MomentumSGD from preprocessing import SplitError from trainer import Trainer, binary_mean_accuracy class TestTrainer(unittest.TestCase): def test_fit(self): gnn1 = GraphNeuralNetwork(2) gnn2 = GraphNe...
#!/usr/bin/env python from pprint import pprint def print_output(device, table, descr): pprint('hostname: {}'.format(device.hostname)) pprint('netconf port: {}'.format(device.port)) pprint('user: {}'.format(device.user)) pprint('***** {} *****'.format(descr)) pprint(table)
import os, re import numpy as np import pandas as pd rel_path = "dataset/" sel_data = "train" input_path = rel_path+sel_data+"_set/" output_path = rel_path short_file = open(output_path+"sS200_"+sel_data+".csv", 'a', encoding = 'utf-8', errors='ignore') long_file = open(output_path+"lS200_"+sel_data+".c...
from django.contrib import admin from .models import Customer, Photographer, Appointment, Blog, City # Register your models here. admin.site.register(Customer) admin.site.register(Photographer) admin.site.register(Appointment) admin.site.register(Blog) admin.site.register(City)
#!/usr/bin/env python3 import pyperf def bench_dict(loops, mydict): range_it = range(loops) t0 = pyperf.perf_counter() for loops in range_it: mydict['0'] mydict['100'] mydict['200'] mydict['300'] mydict['400'] mydict['500'] mydict['600'] myd...
""" create database proxydb charset utf8; use proxydb; create table proxytab( ip varchar(50), port varchar(10) )charset=utf8; """ import requests from lxml import etree import time import random from fake_useragent import UserAgent import pymysql class KuaiProxy: def __init__(self): self...
from utils import* ;imp.reload(dsp) from EDutils import pets as pets_imp ;imp.reload(pets_imp) from utils import pytest_util ;imp.reload(pytest_util) plt.close('all') pts_path = 'pets/glycine.pts' #make sure pets folder exists in dat def test_import_pets(): pets = pets_imp.Pets(pts_path,ge...
"""Coding module.""" import numpy as np from scipy.sparse import csr_matrix from . import utils def parity_check_matrix(n_code, d_v, d_c, seed=None): """ Build a regular Parity-Check Matrix H following Callager's algorithm. Parameters ---------- n_code: int, Length of the codewords. d_v: int,...
# Copyright 2017 Planet Labs, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
# Author: Francesco Nuzzo from os import listdir import numpy as np import operator # This is the script we used for aggregating the lp solutions all together. # The result is a file with x rows, where x is the number of tests. # Each row is in the format: # n;seed;total_reward path_with_solutions = '../lp_...
import FWCore.ParameterSet.Config as cms hltFixedGridRhoFastjetAllCaloForMuons = cms.EDProducer("FixedGridRhoProducerFastjet", gridSpacing = cms.double(0.55), maxRapidity = cms.double(2.5), pfCandidatesTag = cms.InputTag("hltTowerMakerForAll") )
from typing import Dict, ClassVar, Any from qcodes.instrument_drivers.Lakeshore.lakeshore_base import ( LakeshoreBase, BaseOutput, BaseSensorChannel) from qcodes.instrument.group_parameter import GroupParameter, Group import qcodes.utils.validators as vals # There are 16 sensors channels (a.k.a. measurement inpu...
from django.db import models # Create your models here. class Common(models.Model): created_at = models.DateTimeField(auto_now_add=True) class Meta: abstract = True class Game(Common): game_id = models.CharField(primary_key=True, max_length=100, blank=False) wallet_number = models.CharField(m...
from __future__ import annotations from spark_auto_mapper_fhir.fhir_types.uri import FhirUri from spark_auto_mapper_fhir.value_sets.generic_type import GenericTypeCode from spark_auto_mapper.type_definitions.defined_types import AutoMapperTextInputType # This file is auto-generated by generate_classes so do not edi...
#!/usr/bin/env python3 # @generated AUTOGENERATED file. Do not Change! from enum import Enum class SurveyQuestionType(Enum): BOOL = "BOOL" EMAIL = "EMAIL" COORDS = "COORDS" PHONE = "PHONE" TEXT = "TEXT" TEXTAREA = "TEXTAREA" PHOTO = "PHOTO" WIFI = "WIFI" CELLULAR = "CELLULAR" F...
import argparse import pandas as pd import upload_plan def arguments(): """ Process CLI arguments """ description = 'Upload multiple communication plans to Slate.' parser = argparse.ArgumentParser(description=description) parser.add_argument("-l", "--List", action="store", help="CSV of Plans", requir...
from django import forms from django.contrib.auth.models import User from .models import Post class UserForm(forms.ModelForm): email = forms.EmailField(required=True) class Meta: model = User fields = ['username', 'email', 'password'] def clean_email(self): email = self.cleaned_da...
# Copyright (C) 2019 Intel Corporation. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause # import os import sys import copy sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'library')) from scenario_item import HwInfo, VmInfo import board_cfg_lib import scenario_cfg_lib impo...
"""aniffinity class.""" from . import calcs from . import endpoints from . import models from .exceptions import NoAffinityError class Aniffinity: """ The Aniffinity class. The purpose of this class is to store a "base user"'s scores, so affinity with other users can be calculated easily. For ...
from Calculator.Sqrt import sqrt from Stats.VarP import variance def samplestddev(num): try: variance_float = variance(num) return round(sqrt(variance_float), 5) except ZeroDivisionError: print("Can't Divide by 0 Error") except ValueError: print("Please Check your data inpu...
import subprocess import os from ..qtim_utilities.nifti_util import save_numpy_2_nifti from ..qtim_utilities.format_util import convert_input_2_numpy def run_dtifit(input_data, input_bvec, input_bval, input_mask='', output_fileprefix='', method="fsl", command="fsl5.0-dtifit", temp_dir='./'): """ This will fail i...
''' modélisation de la propagation d'un virus ''' """ importation """ import numpy as np import matplotlib.pyplot as plt from sklearn.datasets import make_blobs import random as rd import time from scipy.spatial import distance def distance_e(x, y): # distance entre 2 points du plan cartésien return distance.eu...
#!/usr/bin/env python # Copyright (c) 2013 Ondrej Kipila <ok100 at lavabit dot com> # This work is free. You can redistribute it and/or modify it under the # terms of the Do What The Fuck You Want To Public License, Version 2, # as published by Sam Hocevar. See the COPYING file for more details. import argparse impor...
#!/usr/bin/env python3 """ Converts Mp3 files to Wav - also repeats them a given number of times """ import os import random import sys def run_ffmpeg(fname:str, directory="$PWD"): """Runs the ffmpeg and copies the file a random number of times""" filename = fname if ".mp3" in fname: filename = fil...
# -*- coding: utf-8 -*- # # Copyright (c) 2014, Kacper Żuk # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, # this li...
# -*- coding: utf-8 -*- # # screenViewInterface.py # # Interface for all screen's views # from abc import ABC, abstractmethod class ScreenViewInterface(ABC): """ Interface contains methods that every screen view has to implement """ @abstractmethod def get_screen_name(self): pass @a...
#!/bin/env python """ Unit tests for high level Python interface. Author: Daniel Lee, DWD, 2016 """ import os from tempfile import NamedTemporaryFile import unittest from eccodes import GribFile from eccodes import GribIndex from eccodes import GribMessage from eccodes.high_level.gribmessage import IndexNotSelected...
#!/usr/bin/env python3 import utils utils.check_version((3,7)) utils.clear() print('Hello, my name is Robbie Frank') print('') print('My favorite game is probably Arma3.') print('') print("I don't really have any concerns for this class.") print('') print("I'm mostly excited to meet some fellow game designers and fi...
from . import create_app # run the create_app function defined in init # which returns an app app = create_app() if(__name__ == '__main__'): app.run(debug=True)
""" Attempt to replicate features of the Functional Model within a sub-classed model. # TODO: -Create a model that has dictionary inputs and outputs. -Ability to run fit method with said dictionary outputs. -Ability to control which variables are updated with the fit method. """ import tensorflow as tf import tensorfl...
""" Classes for extending GraphMCF functionality for membranes # Author: Antonio Martinez-Sanchez (Max Planck Institute for Biochemistry) # Date: 03.11.15 """ __author__ = 'martinez' from pyseg.globals import * from pyseg.graph import GraphGT from pyseg import disperse_io from pyseg import pexceptions import math im...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_webhooks ---------------------------------- Tests for `webhooks` module. """ from webhooks import webhook, unhashed_hook from webhooks.senders.simple import sender import json from standardjson import StandardJSONEncoder from Crypto.Hash import SHA256 def test...
import torch import numpy as np from scipy.optimize import linear_sum_assignment from mmdet.core import bbox2roi, build_assigner, build_sampler, bbox2result_with_id from .cluster_rcnn import ClusterRCNN from .. import builder from ..registry import DETECTORS def chunker_list(seq, length, shift): return [seq[i:...
import sys import argparse import torch from model.ENet import ENet from model.ERFNet import ERFNet from model.CGNet import CGNet from model.EDANet import EDANet from model.ESNet import ESNet from model.ESPNet import ESPNet from model.LEDNet import LEDNet from model.ESPNet_v2.SegmentationModel import EESPNet_Seg from...
# -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available. Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. BK-BASE 蓝鲸基础平台 is licensed under the MIT License. License for BK-BASE 蓝鲸基础平台: ------------------------------------------...
# coding=utf-8 from support.views import ( assign_campaigns, list_campaigns_with_no_seller, assign_seller, seller_console_list_campaigns, seller_console, scheduled_activities, edit_address, import_contacts, send_promo, new_subscription, product_change, partial_unsubscript...
# # Copyright (c) 2021, NVIDIA CORPORATION. # # 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 ...
from abc import ABC, abstractmethod import numpy as np import pandas as pd class ContrastMatrix: """A representation of a contrast matrix Parameters ---------- contrast: 2-dimensional np.array The contrast matrix as a numpy array. labels: list or tuple The labels for the columns ...
from django.conf.urls import url from . import views from django.conf import settings from django.conf.urls.static import static from django.conf.urls import include urlpatterns = [ url(r'^$', views.home,name='home'), url(r'^accounts/profile/', views.add_profile, name='add_profile'), url(r'^profile/(\d+)',...
""" Support for the PRT Heatmiser themostats using the V3 protocol. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/climate.heatmiser/ """ import logging import voluptuous as vol from homeassistant.components.climate import ( ClimateDevice, PLATFORM...
import torch import torch.nn as nn import torch.nn.functional as F from lib.models.core import BaseSequentialModel from lib.distributions import Normal, Multinomial class CTVAE_info(BaseSequentialModel): name = 'ctvae_info' # conditional trajectory VAE policy w/ information factorization model_args = ['stat...
a = np.random.randn(10, 2) print("forma: ", a.shape) print("# dimensiones: ", a.ndim) print("# elementos: ", a.size) print("El número de elementos es igual a multiplicar " "todos los elementos de la forma (Shape): ", np.multiply(*a.shape) == a.size) print("Tamaño de cada elemento en bytes: ", a.itemsize) p...
# coding: utf-8 """ Nodeum API # About This document describes the Nodeum API version 2: If you are looking for any information about the product itself, reach the product website https://www.nodeum.io. You can also contact us at this email address : info@nodeum.io # Filter parameters When browsing a list ...
""" ----------------------------------------------------------------------------- Created: 11.02.2021, 18:04 ----------------------------------------------------------------------------- Author: Matthieu Scherpf Email: Matthieu.Scherpf@tu-dresden.de Website: https://becuriouss.github.io/matthieu-scherpf/ Project page: ...
"""This module defines the views corresponding to the tasks.""" import logging from datetime import date from drf_yasg.utils import swagger_auto_schema from django.contrib.contenttypes.models import ContentType from django.core.exceptions import ObjectDoesNotExist from maintenancemanagement.models import ( Field...
''' Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between). For example: Given binary tree [3,9,20,null,null,15,7], For example: Given binary tree [3,9,20,null,null,15,7], 3 / \ 9 20 / \ ...
# -*- coding: utf-8 -*- """Utilities for the PyBEL database manager.""" from ..utils import parse_datetime def extract_shared_required(config, definition_header='Namespace'): """Get the required annotations shared by BEL namespace and annotation resource documents. :param dict config: The configuration dic...
from vb2py.test.testframework import * import vb2py.utils import vb2py.vbparser import vb2py.parserclasses import sys in_vb_module_tests = [] tests.append(( 'a = "hello".Length', {'a': 5}, )) tests.append(( 'a = ("hello").Length', {'a': 5}, )) tests.append(( 'a = ("hello" + "world").Length + 2', ...
from django.contrib.auth.models import User from django.db import models from django_extensions.db.models import TimeStampedModel from back.models.instance import Instance from back.models.city import City class SignalProperties(models.Model): """ Симптомы и свойства, например газа на вкус. Человек отме...
from .reader_unit_test_helpers import ( get_reader, get_conn, send_message ) def test_initial_probe_then_full_throttle(): r = get_reader() conn = get_conn(r) assert conn.rdy == 1 send_message(conn) assert conn.rdy == r._connection_max_in_flight() def test_new_conn_throttles_down_exis...
import torch import numpy as np import torch.nn as nn # Create batches with positive samples in first half and negative examples in second half class BatchSamplerWithNegativeSamples(torch.utils.data.Sampler): def __init__(self, pos_sampler, neg_sampler, batch_size, items): self._pos_sampler = pos_sampler ...
from .uri import Uri
import numpy #for numpy storage import os #to find files import time #for time to complete import sklearn import pickle #Load Test Data running = True selection = 1 while running: if (selection == 21): print ("done") exit() elif (selection == 1): testdata = numpy.load("Data/UkiORBT...
# -*- coding: utf-8 -*- from django.db import models class CurrencyQuerySet(models.QuerySet): def active(self): return self.filter(is_active=True) def default(self): return self.get(is_default=True) def base(self): return self.get(is_base=True) class CurrencyManager(models.Ma...
#!/usr/bin/env python import os import os.path as op import sys import argparse if __name__ == "__main__": parser = argparse.ArgumentParser( description = 'parse interproscan output' ) parser.add_argument( 'fi', help = 'input file' ) parser.add_argument( 'fo', help = 'ou...