text
stringlengths
3.07k
12.6k
import torch import torch.utils.data as data from PIL import Image import os import math import functools import json import copy import pandas as pd from random import shuffle import pickle from utils import load_value_file import random def pil_loader(path): # open path as file to avoid ResourceWarning (https://...
#!/usr/bin/env python ## Copyright (c) 2019, Alliance for Open Media. All rights reserved ## ## This source code is subject to the terms of the BSD 2 Clause License and ## the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License ## was not distributed with this source code in the LICENSE file, you ca...
# Python import math import threading # PyO import pyo class MidiListener(pyo.MidiListener): def __init__(self, *args, **kwargs): super(MidiListener, self).__init__(*args, **kwargs) self._stop_event = threading.Event() def run(self): self._listener.play() while not self._sto...
############################################################# #######Variant Annotator Example Prototype#################### #######<NAME> 06/20/2019 ####################### ############################################################# #A basic script that takes in a VCF, pulls annotations from Ensembl Variant Effect P...
#! /usr/bin/env python3 import re import sys import time import z3 from typing import List, Match, Optional, Tuple TEST = True DEBUG = False STDIN = False INFILENAME = "inputs/24.txt" TESTFILENAME = "inputs/24.test.txt" for arg in sys.argv: if arg == "--notest": TEST = False if arg == "--debug": ...
from SemanticDataset import * def getParentName(page): return getPage(page).get("Is child of") def getParentsNames(page): parents = [] if getPage(page).get("Is child of") != None: parents.append(getPage(page).get("Is child of")) for p in pagesWherePredicateIs("Is parent of", getPage(page).name): parents.app...
""" .. _l-b-numpy-numba-ort: Compares numba, numpy, onnxruntime for simple functions ======================================================= The following benchmark is inspired from `bench_arrayexprs.py <https://github.com/numba/numba-benchmark/blob/master/benchmarks/bench_arrayexprs.py>`_. It compares :epkg:...
#!/usr/bin/python from Bio import Phylo, AlignIO import os.path OUT_PREFIX = "col_" SITES_DELIM = "," RANGE_DELIM = "-" COLOUR_DELIM = "," class InputError(ValueError): pass class Input: DEFAULT_COL_FILE = "default_colour.csv" def __init__(self, tree_path, align_path, branches, tree_in_format, ...
''' Bootstrap replicates of other statistics We saw in a previous exercise that the mean is Normally distributed. This does not necessarily hold for other statistics, but no worry: as hackers, we can always take bootstrap replicates! In this exercise, you'll generate bootstrap replicates for the variance of the annual...
import os import csv import platform import argparse from subprocess import call from shutil import move mol_convert_path = "/Applications/MarvinSuite/bin/molconvert" def generate_image_files(compounds_file, path, structure_key='structure', dir_depth=0, img_type='svg', formating='-a,nosource...
import datetime from django.conf import settings from django.contrib import messages from django.contrib.auth.decorators import login_required from django.urls import reverse from django.shortcuts import render, redirect, get_object_or_404 from accounts.models import Vendor, Customer, Driver from catalog.models import...
import cv2 import math import torch import torch.nn as nn import torch.nn.functional as F import numpy as np import warnings from einops import rearrange class LayerNorm2D(nn.Module): def __init__(self, dim): super(LayerNorm2D, self).__init__() self.norm = nn.LayerNorm(dim) def forward(self, ...
#!/usr/bin/env # -*- coding: utf-8 -*- ''' Copyright (c) 2018 Tramac https://github.com/Tramac/awesome-semantic-segmentation-pytorch/blob/master/core/models/denseaspp.py Copyright (c) 2019 Charles ''' from __future__ import absolute_import import os import torch import torch.nn as nn import torch.nn.functional as F...
"split a single file-like stream into horcruxes" import math import itertools import datetime from rich.progress import Progress, BarColumn, FileSizeColumn from . import crypto from . import sss from . import io MIN_BLOCK_SIZE = 20 DEFAULT_BLOCK_SIZE = 4096 MAX_CHUNK_SIZE = 1024 * 1024 * 100 # 100 MiB def _ideal...
from itertools import product from tqdm import tqdm from functools import cache PRACTICE = True with open("test.txt" if PRACTICE else "input.txt", "r") as f: content = f.read().strip() def overlaps(a, b): # TODO rethink entire xform logic to yield 24 options based on how we orient # +x axis (6 options) ...
#!/usr/bin/python # -*- coding: utf-8 -*- from sympy.core.function import Application from .core import DottedName from .core import Import from .core import Range, Len , Enumerate, Zip, Product, Map from .core import FunctionDef, Return, Assign from .core import Constant, Variable, IndexedVariable from .numpyext imp...
from __future__ import annotations import click import contextvars as cv import inspect import logging import os import secrets import traceback import typing from contextlib import AsyncExitStack from starlette.datastructures import State from starlette.routing import BaseRoute from starlette.types import Receive, Sc...
import pyarrow as pa import numpy as np import pyarrow.compute as c # Cleaning functions def clean_num(arr, impute=0.0, clip_min=None, clip_max=None): return (pa.array(np.nan_to_num(arr.to_numpy(zero_copy_only=False).astype(np.float64), nan=impute).clip(clip_min, clip_max)), ) def clean_cat(arr, categories=[]): ...
import argparse import os import numpy as np import keras.backend as K from keras.optimizers import Adam from keras.utils import generic_utils from keras.callbacks import ModelCheckpoint import nets def load_img_and_dct_data(dataset_path): files = os.listdir(dataset_path) X = np.zeros((len(files), 224, 224...
# -*- coding: utf-8 -*- """ pyrseas.dbobject.operclass ~~~~~~~~~~~~~~~~~~~~~~~~~~ This module defines two classes: OperatorClass derived from DbSchemaObject and OperatorClassDict derived from DbObjectDict. """ from pyrseas.dbobject import DbObjectDict, DbSchemaObject from pyrseas.dbobject import commen...
""" CPC computes Common principal components of a set of matrices. This file uses a variation of Trendafilov (2010) method to compute the k first common principal components of a set of matrices in an efficient way """ import warnings from sklearn.base import BaseEstimator import scipy.sparse.linalg as sparse impor...
from django.db import models from django.utils.translation import ugettext_lazy as _ from mezzanine.core.fields import FileField, RichTextField from mezzanine.pages.models import Page from mezzanine.core.models import Displayable, RichText, Orderable, Slugged, SiteRelated from mezzanine.core.managers import Searchable...
from django.shortcuts import render from django.http import HttpResponseRedirect, HttpResponse from django.contrib.auth.models import User from django.shortcuts import get_object_or_404, render, redirect from .models import * # from .restapis import related methods from django.contrib.auth import login, logout, authent...
#!/usr/bin/python # # Copyright (c) 2021 <NAME>(@praveenghuge) <NAME>(@karldas30) <NAME> (@saurabh3796) # # 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: ...
# copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve. # # 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 applic...
import bson from marshmallow import fields, pre_load from marshmallow.validate import ValidationError from yModel import Schema, OkSchema, ErrorSchema, OkResult, OkDictResult, OkListResult, consumes, produces, can_crash from yModel.mongo import ObjectId, MongoTree, NotFound from ySanic import notaroute class ExistsE...
#!/usr/bin/env python from os import path import sys import sqlite3 import random import argparse import re import gzip import mvmv.mvmv as mvmv import mvmv.mvmvd as mvmvd import mvmv.parse as parse class DownloadDB(argparse.Action): def __init__(self, option_strings, dest, nargs=None, **kwargs): super(D...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import numpy as np # This code is adapted from <NAME> great Surface Projection tutorial # https://bitaesthetics.com/posts...
from django import forms from django.forms import ModelForm, TextInput, EmailInput, DateTimeInput, ClearableFileInput, URLInput from django.contrib.auth.forms import UserCreationForm from django.contrib.auth.models import User from .models import * class ExperienceInputform(forms.ModelForm): name = forms.CharFi...
# =============================================================================== # Copyright 2015 <NAME> # # 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/LI...
import math from IMLearn.utils import split_train_test from IMLearn.learners.regressors import LinearRegression from typing import NoReturn import numpy as np import pandas as pd import plotly.graph_objects as go import plotly.express as px import plotly.io as pio pio.templates.default = "simple_white" def pre_pro...
from random import randint import numpy as np import time import random import matplotlib.pyplot as plt ''' This project is revised by the open source code https://github.com/dingran/knight-isolation. The author of modification is <NAME> <EMAIL> ''' def multimax(game, player,iteration = 0): """The basic eval...
import os import re import subprocess import plac def main(only_vectorial_figures=False): '''only_vectorial_figures=False uses the ./source/media raster images only_vectorial_figures=True uses the vectorial figures placed in ./out/figures''' print('step 1: download from https://www.docx2latex.com/docx...
import numpy as np import csv def thereticalUser(): Method_Of_Communication = np.random.choice(['text', 'email', 'phone', 'mail']) Urgency = np.random.random() Resource_Allocation = np.random.random() CustomerAge = getTheoryAge(Method_Of_Communication, Urgency, Resource_Allocation) Current_Ov...
import torch assert torch.__version__>='1.2.0', 'Expect PyTorch>=1.2.0 but get {}'.format(torch.__version__) from torch import nn import torch.nn.functional as F class DCN_Deep_Layer(nn.Module): """ Deep component of DCN """ def __init__(self, input_dim, ffn_dim, ffn_dropout, *args, **kwargs): ...
# The MIT License (MIT) # # Copyright (c) 2015 <NAME> # # 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 the Software without restriction, including without limitation the rights # to use, copy, modify, me...
# Copyright 2018 Platform9 Systems, 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 wr...
import os from os import environ import argparse import txaio from socs.agent.smurf_recorder import FrameRecorder # For logging txaio.use_twisted() on_rtd = os.environ.get('READTHEDOCS') == 'True' if not on_rtd: from ocs import ocs_agent, site_config class SmurfRecorder: """Recorder for G3 data streams se...
import pickle from pathlib import Path from re import search from typing import Union import pytest from gallica_autobib.gallipy import Ark, Resource from gallica_autobib.gallipy.ark import ArkParsingError from gallica_autobib.models import Article, Book, Collection, Journal from gallica_autobib.query import GallicaRe...
"""Postgres driver.""" # pylint: disable=R0201 import os from contextlib import ContextDecorator from typing import Any, AnyStr, Dict, List, NoReturn, Optional, Tuple from pyqldb.config.retry_config import RetryConfig from pyqldb.driver.qldb_driver import QldbDriver from pyqldb.execution.executor import Executor fr...
from typing import ( Optional, Tuple, Dict, Any, ) from helios.protocol.common.datastructures import HashFragmentBundle from hvm.rlp.headers import BlockHeader from hvm.rlp.consensus import NodeStakingScore from helios.protocol.common.trackers import BasePerformanceTracker from helios.protocol.common....
# Standard library imports from pickle import * import sys, new import logging from types import GeneratorType # Enthought library imports from apptools.persistence.updater import __replacement_setstate__ logger = logging.getLogger(__name__) ##########################################################################...
from typing import Dict, Tuple, Union, TypedDict, List import numpy as np from neo4japp.models import Files from neo4japp.services.annotations import ManualAnnotationService from pandas import DataFrame, MultiIndex from scipy.stats import mannwhitneyu import pandas as pd # region Types class AnnotationMeta(TypedDict...
import numpy as np import xarray as xr from scipy import stats import scipy.odr as odr from statsmodels.tsa.seasonal import STL def _ensure_monthly(ds): np.testing.assert_approx_equal( actual=(ds.time.diff('time') / np.timedelta64(1, 'D')).mean(), desired=30.4, significant=1 ...
# -*- coding: utf-8 -*- """ Created on Sun Oct 15 18:23:12 2017 @author: s157084 """ import pandas as pd import time from sklearn import preprocessing from sklearn.preprocessing import StandardScaler from sklearn.decomposition import PCA as sklearnPCA import matplotlib.pyplot as plt import statsmodels.formula.api as ...
""" Implements nest_ops db subcommand, which does database initializing and clearing and a few simple info methods """ import argparse from nest_py.ops.ops_logger import log import nest_py.nest_envs as nest_envs import nest_py.ops.nest_sites as nest_sites from nest_py.nest_envs import ProjectEnv from nest_py.ops.nest...
from tasks.R2R.utils import load_datasets, load_nav_graphs from tasks.R2R.env import LowLevelR2RBatch from tasks.R2R.utils import check_config_judge from collections import defaultdict import json import os import networkx as nx import numpy as np import pprint pp = pprint.PrettyPrinter(indent=4) class Evaluation(ob...
import os from argparse import ArgumentParser import numpy as np import torch import torch.nn as nn import tqdm from torch import optim from torch.utils.data import DataLoader from segmentation.dataset import DetectionDataset, get_dataloaders from segmentation.models import get_segmentation_model from segmentation.t...
import aiohttp import logging from typing import Tuple from collections import namedtuple from enum import Enum name = "libhhttpcam" _LOGGER = logging.getLogger(__name__) RESULT_CODE = { '0': 'Success', '-1': 'CGI request string format error', '-2': 'Username or password error', '-3': 'Access denied ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Author: <NAME><<EMAIL>> # Date: 2021-3-20 import json import xlutils from xlutils.filter import process,BaseFilter from xlutils.filter import XLWTWriter from xlutils.filter import XLRDReader import xlrd import xlwt #json 模版 pro_json = { "header": [ { ...
""" PyGearsViz module PyGearsViz is a python3 Anari AI PyGears architecture visualization tool. For more information see README.md or visit: https://github.com/vladimirtomic/anari-ai """ import graphviz from pygears.core.intf import Intf from pygears.core.port import HDLProducer, HDLConsumer def render_hierarchy_...
from app.auth import auth_blueprint from app import db from app.models import User from flask import render_template, redirect, url_for, flash from app.auth.forms import ( RegisterForm, LoginForm, ChangePasswordForm, ChangeUsernameForm, RequestForgotPasswordForm, ConfirmForgotPasswordForm, R...
# -*- coding: utf-8 eval: (yapf-mode 1) -*- # February 24 2018, <NAME> <<EMAIL>> # # Copyright (c) 2018, Deutsche Telekom AG. # 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 Licen...
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import unittest from collections import defaultdict from dataclasses import dataclass from pytorch3d.implicit...
""" --- Day 18: Operation Order --- As you look out the window and notice a heavily-forested continent slowly appear over the horizon, you are interrupted by the child sitting next to you. They're curious if you could help them with their math homework. Unfortunately, it seems like this "math" follows different rules...
import logging from dbnd._core.configuration.environ_config import is_databand_enabled from dbnd._core.constants import TaskType from dbnd._core.current import current_task_run from dbnd._core.decorator.dynamic_tasks import run_dynamic_task from dbnd._core.decorator.schemed_result import FuncResultParameter from dbnd....
""" Interface to the functions of libdivsufsort """ import ctypes from array import array import warnings import numpy as np from .dll import libdivsufsort, libdivsufsort64 def _pointer_frombuffer(inp): inp = (ctypes.c_uint8 * len(inp)).from_buffer(inp) return ctypes.byref(inp) _SIGNED_TO_UNSIGNED = { ...
# Copyright 2018 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
# coding: utf-8 # # Basic Libraries # In[1]: import matplotlib.image as mi import matplotlib.pyplot as plt import numpy as np # These are some basic libraries which have been used. # # Reading Image # In[2]: img=mi.imread('Image/rabbit.png') plt.imshow(img) plt.show() img.shape # This is where we are reading ...
import atexit import functools from pyspark import SparkConf, SparkContext import six import sys import os from stolos.plugins import api, log_and_raise, TasksConfigBaseMapping from . import log def receive_kwargs_as_dict(func): """A decorator that recieves a dict and passes the kwargs to wrapped func. It's ...
# -*- coding: utf-8 -*- # # Copyright 2019 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 requir...
import os import random import tempfile import pytest import teek SMILEY_PATH = os.path.join( os.path.dirname(os.path.abspath(__file__)), 'data', 'smiley.gif') def test_width_and_height(): image = teek.Image(file=SMILEY_PATH) assert image.width == 32 assert image.height == 32 # tests that use th...
from __future__ import print_function import os import sys import json import datetime import operator from flask import Flask, url_for, redirect, \ render_template, session, request, jsonify from flask_sqlalchemy import SQLAlchemy from flask_login import LoginManager, login_required, login_user, \ log...
# 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 os import pandas as pd import multiprocessing from tqdm import tqdm from itertools import permutations from rdkit import Chem import torch import sklearn import dgl import dgl.backend as F from dgl.data.utils import save_graphs, load_graphs def combine_reactants(reactant, reagent): if str(reagent) == 'nan...
import sys import json from PyQt5.QtWidgets import QApplication, QTreeWidgetItem from PyQt5.QtGui import QIcon from PyQt5.QtCore import QProcess, pyqtSignal, QObject from PyQt5 import uic import subprocess form, base = uic.loadUiType("ui\\runner.ui") CTEST = r"C:\Program Files\CMake\bin\ctest.exe" de...
import json import pandas as pd import plotly import plotly.graph_objs as go from flask import Flask, render_template, request app = Flask(__name__) data = pd.read_csv("items.csv") data=data.drop([0,1,3,17,18],axis=0) data=data.sort_values(by=['product_price']) new_data=data[0:5] DVDs=new_data.iloc[:,0] Prices=new_...
#/usr/bin/env python # encoding: utf-8 import numpy as np from scipy import linalg def bounds(lats, lons, cycles, lat_min, lat_max, lon_min, lon_max, cycle_min, cycle_max): """ Given bounds calculates indices of points and cycles within the bounds lats, lons, cycles are array-like objects of latitude,...
""" ================================== Bayesian optimization with `skopt` ================================== <NAME>, <NAME> July 2016. Reformatted by <NAME> 2020 .. currentmodule:: skopt Problem statement ----------------- We are interested in solving .. math:: x^* = arg \min_x f(x) under the constraints that...
# -*- coding: utf-8 -*- # @Time : 2021-12-16 1:03 p.m. # @Author : <NAME> # @FileName: Zeiss.py # @Software: PyCharm import pydicom import numpy as np import glob from OssiviewBufferReader import OssiviewBufferReader from os.path import join, isfile from pydicom.uid import generate_uid from skimage.filters impor...
# # Copyright The NOMAD Authors. # # This file is part of NOMAD. # See https://nomad-lab.eu for further info. # # 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/lic...
import random import array import time import os def clear(): os.system('cls' if os.name=='nt' else 'clear') print("*"*100) print("*"*44+" P W - G E N "+"*"*43) print("*"*100) return(" ") MAX_LEN = 12 DIGITS = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] LOCASE_CHARACTERS...
# source: https://stackoverflow.com/q/11736560 # https://stackoverflow.com/q/17697352 # https://doc.qt.io/qt-5/modelview.html import sys import numpy as np from collections import OrderedDict as odict #from PyQt5 import QtGui, QtCore from panta_rhei.gui.Qt import QtGui, QtCore, QtWidgets # données à représenter my_ar...
# Copyright 2016 Google, Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
import datetime import bs4 import flask import freezegun import pytest from flask import url_for from flask_saml2.exceptions import CannotHandleAssertion from flask_saml2.utils import utcnow from .base import SamlTestCase, User class TestEndToEnd(SamlTestCase): """ Test the SP and IdP as a user/browser, go...
#This is the code for single-view pcd generation. We generate 20 single-view pcds #taken one scane using generated camera posision (args.camera_position) import open3d as o3d from numpy.linalg import inv import scipy.io as sio import numpy as np import os import re import argparse def farthest_point_sample(point, npo...
from api.packets import * from api.properties import * from api.entity import Entity, Player from api.vehicle import Vehicle from threading import Thread from multiprocessing import Process, Queue import pygame from copy import deepcopy import util def onTickGenerateWorld(game, deltaTime, tick): """ Event Ho...
import cv2 as cv import numpy as np def sharpen(src): blured = cv.blur(src, (1, 80)) # 横向和纵向的模糊程度 cv.imshow("blured", blured) # kernel = np.array([[0, -1, 0], [-1, 5, -1], [0, -1, 0]], np.float32) # kernel = np.array([[5, 5, 5], [-3, 0, -3], [-3, -3, -3]], np.float32) # kernel = np.array...
#<!---------------------------------------------------------------------------> #<!-- ITU - IT University of Copenhagen --> #<!-- SSS - Software and Systems Section --> #<!-- SIGB - Introduction to Graphics and Image Analysis --> ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' nf model parameters calculation calculate nf1, nf2 and Delta_P of a 2 coils edfa with internal VOA from nf_min and nf_max inputs ''' import numpy as np from pathlib import Path from gnpy.core.utils import lin2db, db2lin, load_json GAIN_MIN_FIELD = "gain_min" GAIN_MA...
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. import re import logging from odoo import api, fields, models from odoo.osv import expression from odoo.exceptions import UserError from psycopg2 import IntegrityError from odoo.tools.translate import _ _logger = logging...
import typing from typing import Any, List, Dict, Union from collections import OrderedDict import os, sklearn from sklearn.svm.classes import SVC from d3m_metadata.container.numpy import ndarray as d3m_ndarray from d3m_metadata import hyperparams, params, metadata as metadata_module, utils from primitive_interfaces...
import numpy as np import random from enum import Enum """ Sign function which can be translated by given value. Used as activation function for perceptron. - Parameters: - translation: breaking point for the function. - Usage: - Sign()(0.5) - returns sign function for unipol...
import zmq import threading import time import random from collections import defaultdict import sys import pickle from follower_on_message import follower_message from candidate_on_message import candidate_message from leader_on_message import leader_message from boards import memory_board from config import cfg from...
import argparse from .config_utils import boolean_string, _VERSION_ def get_default_target_tol(metric): arr = dict() arr['psnr_avg'] = 1 arr['ssim'] = 0.002 arr['vmaf'] = 0.2 arr['file_size_bytes'] = 200 return arr[metric] def get_default_target_arr(metric): arr = dict() if metric =...
class Node(): def __init__(self, data): """Create Node Arguments: data {data} -- data reference to tree """ self.left = None self.data = data self.parent = None self.rigth = None class BinaryTree(): """Create a Binary Tree Re...
""" Copyright Snap Inc. 2021. This sample code is made available by Snap Inc. for informational purposes only. No license, whether implied or otherwise, is granted in or to such code (including any rights to copy, modify, publish, distribute and/or commercialize such code), unless you have entered into a separate agree...
# ROS1 Lifecycle - A library implementing the ROS2 lifecycle for ROS1 # # Copyright 2016,2017 <NAME> GmbH # # 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...
""" Get runnable regions by divide N region alone the reference. Author: <NAME> Date: 2018-09-07 """ import sys import argparse def get_fasta_size_from_faifile(infile): """ Get chromosome size from .fai file .fai format: chr1 248956422 112 70 71 chr2 242193529 252513167 70 71 chr3...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import copy from typing import Any, Dict, List import logging import torch from detectron2.config import CfgNode from lib.torch_utils.solver.lr_scheduler import flat_and_anneal_lr_scheduler from lib.torch_utils.solver.optimize import _get_optimize...
import numpy as np #### CAUTION #### def _step_gamma(step, gamma): """Update gamma parameter for use inside of continuous proximal operator. Every proximal operator for a function with a continuous parameter, e.g. gamma ||x||_1, needs to update that parameter to account for the stepsize of the algorit...
import logging from bs4 import BeautifulSoup from google.appengine.api import urlfetch from models import Ranking, Team, Week, User, Poll from application.notifications import email from application.views import BaseView class PollCronView(BaseView): url = None level = None poll = None sport = N...
import numpy as np from functools import lru_cache class Weights(object): def __init__(self, mean, std, sample_size, zeros=0, is_count=True): super(Weights, self).__init__() self.mean = mean self.std = std self.sample_size = sample_size # Count metrics require positive int...
#!/usr/bin/env python3 # See: https://github.com/pr3d4t0r/COVIDvu/blob/master/LICENSE # vim: set fileencoding=utf-8: from covidvu.visualize import plotTimeSeries from covidvu.visualize import plotTimeSeriesInteractive from covidvu.visualize import plotPrediction from covidvu.visualize import plotDataAndPredictionsWith...
import enum WEEK = 8 POWERPLAYID = 763682731270995969 teamNicknames = { 'Boston': 'Bruins', 'Montreal': 'Canadiens', 'Toronto': 'Maple Leafs', 'New York': 'Rangers', 'Philadelphia': 'Flyers', 'Pittsburgh': 'Penguins', 'Detroit': 'Red Wings', 'Columbus': 'Blue Jackets', 'St. Louis':...
import numpy as np from datetime import datetime import os import subprocess import time import tensorflow as tf import traceback import argparse from data.feeder import Feeder from hparams import hparams, hparams_debug_string from models import create_model from utils import infolog, ValueWindow from utils.text im...
import pygame import random import math from pygame import mixer # initialize pygame pygame.init() # create screen screen = pygame.display.set_mode((800, 600)) # background background = pygame.image.load("img/bg-image.png") # background music # mixer.music.load("bg-audio.mp3") # mixer.music.play(-1)...
# 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...
#!/usr/bin/env python from lib.constants import * def get_string_variations(string, prefix_postfix_option, acronyms_only_option): #Names are not case sensitive string = string.lower() #Remove junk chars that can't be in the bucket name, e.g & , " names = remove_junk_chars(string) #All all sorts o...
from abc import abstractmethod from typing import List, NoReturn, Type from frico.bitstring import BitString from frico.parsers import BCDParser, FlagParser, RegisterParser from frico.typing import RegisterState from .states import ( Alarm1ConfigState, Alarm2ConfigState, AlarmConfigState, DayConfigSta...