content
stringlengths
5
1.05M
from flask import request, Response from json import dumps def makeResponse(data=None, error=None, code=200, cache_hit=False): """ Shapes the response """ responseBody = {"success": error is None, "error": error, "data": data} if "minify" in request.values: response = Response(dumps(respon...
#!/usr/bin/env python """ _ListRunningJobs_ Oracle implementation of Monitoring.ListRunningJobs """ from WMCore.WMBS.MySQL.Monitoring.ListRunningJobs import ListRunningJobs \ as ListRunningJobsMySQL class ListRunningJobs(ListRunningJobsMySQL): pass
# Cell import torch from torch import nn from solutions.lesson1 import * from solutions.lesson2 import * from fastai.datasets import download_data
import random import numpy as np import matplotlib.pyplot as plt def mountain(seed, n_skip, n_iter, step = 0.0001, r_min = 0, scaling = 0): def logistic(r, x, scaling): return r*x*(1 - x) + scaling*np.sin(2*np.pi*x)**2 R = [] X = [] r_range = np.linspace(r_min, 4, int(1/step)) for r i...
#!/usr/bin/env python import logging import socket LOG = logging.getLogger(__name__) from django.utils.translation import ugettext as _ from django.utils.encoding import smart_str LOG = logging.getLogger(__name__) def handle_rest_exception(e, msg): parent_ex = e.get_parent_ex() reason = None if hasat...
from django.db import models MOLTEN_CORE = 'MC' BLACKWING_LAIR = 'BWL' ZUL_GURUB = 'ZG' ONYXIA = 'ONY' AQ_20 = 'AQ20' AQ_40 = 'AQ40' NAXX = 'NAXX' RAIDS = ( (MOLTEN_CORE, 'Molten Core'), (BLACKWING_LAIR, 'Blackwing Lair'), (ZUL_GURUB, 'Zul\'gurub'), (ONYXIA, 'Onyxia'), (AQ_20, 'Ruins of Ahn\'Qiraj...
# flake8: noqa import numpy as np import pytest import torch from catalyst.contrib.nn import criterion as module from catalyst.contrib.nn.criterion import CircleLoss, TripletMarginLossWithSampler from catalyst.contrib.nn.criterion.contrastive import BarlowTwinsLoss from catalyst.data import AllTripletsSampler def te...
import flask.scaffold flask.helpers._endpoint_from_view_func = flask.scaffold._endpoint_from_view_func import flask_restful from flask import request from sqlalchemy.exc import IntegrityError from sqlalchemy.orm import joinedload from app import auth, db, RestException from app.model.category import Category from app....
import copy import wrapt from aws_xray_sdk.core import xray_recorder class XRayTracedConn(wrapt.ObjectProxy): _xray_meta = None def __init__(self, conn, meta={}): super(XRayTracedConn, self).__init__(conn) self._xray_meta = meta def cursor(self, *args, **kwargs): cursor = sel...
# Copyright 2021 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...
import sys import argparse from .split_fa import Config as SplitFastaConfig from .anno2seqs import Config as Anno2SeqsConfig from .extract_fx import Config as ExtractFastxConfig def main(): parser = argparse.ArgumentParser() subparsers = parser.add_subparsers( title='HTS Fastx Processor', desc...
# TBD # Implement data leakage cleanup ( Image and CSV cleaners )
# https://atcoder.jp/contests/abc174/tasks/abc174_b N, D = map(int, input().split()) zahyo = [] ans = 0 for _ in range(N): x, y = map(int, input().split()) if D**2 >= (x**2 + y**2): ans += 1 print(ans)
# Download the Python helper library from twilio.com/docs/python/install from twilio.rest import Client # Your Account Sid and Auth Token from twilio.com/user/account account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" auth_token = "your_auth_token" client = Client(account_sid, auth_token) # A list of message objects ...
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
from attrdict import AttrDict import os cfg = AttrDict({ # 'exp_name': 'test-len10-delta', # 'exp_name': 'test-len1-fixedscale-aggre-super', # 'exp_name': 'test-aggre-super', # 'exp_name': 'test-mask', 'exp_name': 'test-proposal', 'resume': True, 'device': 'cuda:3', # 'device': 'cpu', ...
## Meeting ## 6 kyu ## https://www.codewars.com/kata/59df2f8f08c6cec835000012 def meeting(s): return ''.join(sorted([f"({', '.join(item.split(':')[::-1])})" for item in s.upper().split(';')]))
# See: https://github.com/pr3d4t0r/aoc2020/blob/0001-AoC-day-2/LICENSE # vim: set fileencoding=utf-8: from aoc.day_06_customforms import loadExerciseDataFrom from aoc.day_06_customforms import main from aoc.day_06_customforms import confirmedMixedAnswers from aoc.day_06_customforms import confirmedGroupAnswers impor...
from config.deckbox import deckbox_user_id, deckbox_folder
def print_album_information(metadata_dictionary): print("Album Info:") print("Title:\t\t%s" % metadata_dictionary['album']) print("Artist:\t\t%s" % metadata_dictionary['artist']) print("Year:\t\t%s" % metadata_dictionary['date'][:4]) print("Tracks:\t\t%s" % metadata_dictionary['total_tracks']) ...
import secrets from time import time from sqlalchemy import and_ from boggle import db from boggle.utils.db import in_transaction # Default functions def unix_time(): """Return the current unix timestamp.""" return int(time()) # Generate random token def generate_token(): return secrets.token_hex(16) ...
import numpy as np from fastai.core import V, T, to_gpu, to_np from quicknlp.modules import EmbeddingRNNEncoder def test_BiRNNEncoder(): ntoken = 4 emb_sz = 2 nhid = 6 # Given a birnnencoder encoder = EmbeddingRNNEncoder(ntoken, emb_sz, nhid=nhid, nlayers=2, pad_token=0, ...
# -*- coding: utf-8 -*- """ Created on Tuesday May 29 13:08:01 2018 @author: Tony Saad """ # !/usr/bin/env python from scipy import interpolate import numpy as np from numpy import pi class file_spectrum: def __init__(self,specfname): filespec = np.loadtxt(specfname) kfile=filespec[:,0] efile=filespec[...
######################################################################## # amara/xslt/expressions/avt.py """ Implementation of XSLT attribute value templates """ from amara.xpath import datatypes from amara.xpath.expressions import expression from amara.xslt import XsltError from amara.xslt.expressions import _avt _p...
#!/usr/bin/env python3 # # Tests a joinsplit double-spend and a subsequent reorg. # from test_framework.test_framework import BitcoinTestFramework from test_framework.authproxy import JSONRPCException from test_framework.util import assert_equal, connect_nodes, \ gather_inputs, sync_blocks import time class Joi...
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import io import unittest from typing import Iterable, Union from ...analysis_output import AnalysisOutput, Metadata from .. import ( Par...
from glob import glob import matplotlib.pyplot as plt from tqdm import tqdm import numpy as np import cv2 class DataGenerator(): def __init__(self): self.dataset_name = "Cars" self.preview_elements = 25 self.data_path = "./data" self.sourcedata_path = f"./datasets/{self.dataset_na...
import random from random import randint print('-=-'*20) print('VAMOS JOGAR PAR OU IMPAR') print('-=-'*20) v = 0 while True: jogador = int(input('Digite um numero: ')) computador = random.randint(0, 10) total = jogador + computador tipo = ' ' while tipo not in 'PI': tipo = str(input('Par o...
import numpy as np import re def strings_in_line(line, strings): evaluation = np.any([string in line for string in strings]) return(evaluation) def end_on_same_line(line): evaluation = True return(evaluation) def converged_line_list_transform(line_list, **kwargs): regex = '\((.*)[<|>]' str_li...
""" @Author: huuuuusy @GitHub: https://github.com/huuuuusy 系统: Ubuntu 18.04 IDE: VS Code 1.39 工具: python == 3.7.3 """ """ 思路: 动态规划 结果: 执行用时 : 64 ms, 在所有 Python3 提交中击败了76.50%的用户 内存消耗 : 13.8 MB, 在所有 Python3 提交中击败了5.19%的用户 """ class Solution: def uniquePathsWithObstacles(self, obstacleGrid): if...
import pathlib import os import sys import argparse import urllib from typing import * from os.path import join, isfile, isdir sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..')) import helper here = pathlib.Path(__file__).parent.absolute() def download_raw_expression_matrices(...
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019-04-19 21:16 # @Author : Mayandev # @Site : https://github.com/Mayandev/ # @File : view_base.py # @Software: PyCharm from django.views.generic import View from .models import Movie from django.http import HttpResponse import json class MovieList(V...
from elasticsearch import Elasticsearch import sys indir="D:/ml-data/movielens/ml-1m" movieId2name = {} movieId2name[0] = "NaN" for line in open(indir+"/movies.dat", 'r', encoding='iso-8859-15'): id, name, _ = line.strip().split("::") movieId2name[int(id)] = name userId = int(sys.argv[1]) es = Elasticsearch...
def fourier_transformLP(im): """ Short Summary ------------- This function uses Fourier Transformation to transform our image information gray scaled pixels into frequencies and do further process Extended Summary ------------- This function computes the Fourier transformation using the fol...
import subprocess import re from os.path import expanduser import os import shutil import click from dotenv import load_dotenv from utils import util, hiss from utils.kube import KubeHelper DEFAULT_CONFIG_PATH = expanduser('~/.akachain/akc-mamba/mamba/config/.env') DEFAULT_SCRIPT_PATH = expanduser('~/.akachain/akc-mam...
import autograd.numpy as np from scipy.stats import pearsonr from surpyval.nonparametric import plotting_positions from scipy.optimize import minimize def mpp(model): """ MPP: Method of Probability Plotting This is the classic probability plotting paper method. This method creates the plotting points...
from random import randint import pygame from pygame.locals import * def gcd(a, b): if b > a: a, b = b, a if a % b == 0: return b else: return gcd(b, a % b) def pi_aprox(n, co_primo, total): c_p = co_primo t = total for _ in range(n): if gcd(randint(1, 9999), ...
from setuptools import setup, find_packages setup( name='itkimage2dicomseg', version='0.0.3', packages=find_packages(), long_description=open('README.md', "r", encoding="utf-8").read(), long_description_content_type="text/markdown", url='https://gitlab.chudequebec.ca/MaxenceLarose/itkimage2dico...
# Copyright 2017, OpenCensus Authors # # 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 w...
from syned.storage_ring.magnetic_structure import MagneticStructure from vinyl_srw.srwlib import array, SRWLMagFldC from wofrysrw.srw_object import SRWObject class SRWMagneticStructureDecorator(): def get_SRWMagneticStructure(self): raise NotImplementedError("this method should be implented in subclasses...
# Copyright 2004-2005 Grant T. Olson. # See license.txt for terms. import unittest from pyasm.x86disasm import x86Block,x86Disassembler """ We could probably write a more proper unittest, but at this point the output isn't perfect. I'm happy if it runs without crashing. Here is the output for a release build of hel...
from django.apps import AppConfig class DefaultConfig(AppConfig): name = '{{cookiecutter.project_name}}.{{cookiecutter.django_app}}'
#!/usr/bin/env python def check(n): num = n while num > 0: if (num % 10) not in xrange(3): return False num //= 10 return True def f(n): num = n while not check(num): num += n return num if __name__ == '__main__': print sum((f(n)/n for n in xrange(1,10001)))
#!/usr/bin/python #coding:utf-8 import mybaselib import logging import jieba import jieba.analyse import numpy as np import csv import sys import stat import os reload(sys) sys.setdefaultencoding('utf-8') logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) def walktree(dirname, callback, userdata): ...
#!/usr/bin/env python """ Detect AES in ECB mode https://cryptopals.com/sets/1/challenges/8 """ ciphertexts = [ "8a10247f90d0a05538888ad6205882196f5f6d05c21ec8dca0cb0be02c3f8b09e382963f443aa514daa501257b09a36bf8c4c392d8ca1bf4395f0d5f2542148c7e5ff22237969874bf66cb85357ef99956accf13ba1af36ca7a91a50533c4d89b7353f908...
from dresponse.handler import BaseDresponseHandler class MyHandler(BaseDresponseHandler): def handle(self, root, netns, container_attrs, image_attrs): name = container_attrs['Name'] labels = container_attrs['Config']['Labels'] print 'there are %d labels for container %s:' % (len(labels), n...
import csv from pathlib import Path equity_funding = [ {"Company": "CryptoVisors", "Amount": 200000, "Series": "A"}, {"Company": "Flutterwave", "Amount": 65000000, "Series": "D"}, {"Company": "nCino", "Amount": 80000000, "Series": "D"}, {"Company": "Privacy.com", "Amount": 10000000, "Series": "B"}, ] ...
from __future__ import unicode_literals from builtins import object import operator import pytest from context import utils as u from context import units as uns # Fixtures, factories, and test data # noargs, args, kwargs, and args_kwargs are factory functions that # produce memoized functions, where the memo key ...
from datetime import datetime from logging import info, warning, error import time import scd30_i2c from lib import common from lib.measurement import Measurement from lib.user_config import user_config # # CO₂, temperature & humidity sensor (SCD30) # scd30: scd30_i2c.SCD30 firmware_version: int temperature_offset_co...
# Python Program to find Factorial of a Number number = int(input(" Please enter any Number to find factorial : ")) fact = 1 for i in range(1, number + 1): fact = fact * i print("The factorial of %d = %d" %(number, fact))
#!/usr/bin/python3 # generate data for plot import pigpio import time import board import busio import adafruit_ads1x15.ads1115 as ADS from adafruit_ads1x15.analog_in import AnalogIn def main(): try: i2c = busio.I2C(board.SCL, board.SDA) ads = ADS.ADS1115(i2c) chan = AnalogIn(ads, ADS.P3)...
import cv2 import os GaussianNoise_path = './img/Gaussian_Noise.jpg' SaltPepperNoise_path = './img/SaltPepper_Noise.jpg' # 均值滤波 def meanfilter(img, kernel_size=5): return cv2.blur(img, (kernel_size, kernel_size)) # 高斯平滑 def guassianfilter(img, kernel_size=5): return cv2.GaussianBlur(img, (kernel_size, kerne...
import numpy as np import pygame as pg import random import math class Board: def __init__(self, w, h): self.x_pos = 0 self.y_pos = 0 self.width = w self.height = h self.cell_size = 50 self.snake = [[int(self.height/2),int(self.width/2)]]*3 self.board = np.zeros((self.height,self.width)) self.board[i...
# 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 ...
import os import sys import json import time import os.path import hashlib from bottle import Bottle, template, static_file, request, response, redirect _VERSION = 150909 _DEBUG = True _CODEDIR = os.path.dirname(__file__) _SECRET = 'SUPERSECRETPASSPHRASE' _COOKIE_TTL = 3600 * 24 * 7 _TIME_FMT = '%d %b %Y %H:%M:%S %Z'...
""" Greynir: Natural language processing for Icelandic Basic classes module Copyright (C) 2021 Miðeind ehf. This software is licensed under the MIT License: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation ...
# Generated by Django 3.1.4 on 2020-12-25 22:54 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('finders', '0034_delete_itemfoundtemp'), ] operations = [ migrations.AlterField( model_name='userfinder', name='bGetR...
import unittest import nose.tools import numpy as np from skimage import io, transform from ..test_utils import generate_linear_structure from mia.features._orientated_bins import orientated_bins class OrientatedBinsTest(unittest.TestCase): def test_with_pure_structure(self): linear_structure = generate_...
from marshmallow import Schema, fields, post_load from rest_client.SpecieRest import SpecieAPI class SpecieSchema(Schema): """ This class map the json into the object Specie ..note:: see marshmallow API """ id = fields.Int() designation = fields.Str() genus = fields.Int() strains = fi...
import re from typing import Any import requests from bs4 import BeautifulSoup from requests import Response from library.DataObject import DataObject from library.Models import RunsList, SourceRun, TestsList from library.Problem import Problem from library.Result import Result from library.UnauthorizedException impo...
from turtle import setup, reset, pu, pd, bye, left, right, fd, bk, screensize from turtle import goto, seth, write, ht, st, home, dot, pen, speed from turtle import setworldcoordinates, begin_fill, end_fill def text(pos, info, align="center", font=("Arial", 8, "normal"), move=False, color="black"): pu() goto...
#!/usr/bin/python class BouncedProbe(): def __init__(self, src_ip, dst_ip, bounce_time_ns, rcv_time_ns, hop_id): self.src_ip = src_ip self.dst_ip = dst_ip self.bounce_time_ns = bounce_time_ns self.rcv_time_ns = rcv_time_ns self.hop_id = hop_id def __str__(self): ...
from __future__ import print_function from __future__ import division from pdb import set_trace class Params: """ Set parameters """ def __init__(self, dicipline, distribution="exp", C=1e6, rho=0.95, lmbd=1.0, mu=1/3000): self.C = C self.mu = mu self.rho = rho...
import binascii import os import pkg_resources import urllib import tempfile import webbrowser from http.server import BaseHTTPRequestHandler, HTTPServer import click import mf2py import requests import yaml VERSION = pkg_resources.get_distribution("entries").version CLIENT_ID = "https://hexa.ninja/5ce9a178def3b70a/...
import numpy as np import torch import tqdm from torch import nn
# !/usr/bin/env python # -- coding: utf-8 -- # @Author zengxiaohui # Datatime:7/28/2021 5:17 PM # @File:base2onnx import torch import onnxruntime # cuda10.2==onnxruntime-gpu 1.5.2 import torch.nn.functional as F class JustReshape(torch.nn.Module): def __init__(self): super(JustReshape, self).__init__() ...
#!/usr/bin/env python """ Insert a circle and a lot of lines (a fractal) in a text document. """ import os import sys import cmath from math import sqrt from odfdo import Document, Header, LineShape, EllipseShape, Paragraph CYCLES = 4 # beware, 5 is big, 6 too big to display... # some graphic computations class Ve...
command = '/home/mark/env/ris/bin/gunicorn' pythonpath = '/home/mark/env/ris/bin/python' bind = '127.0.0.1:8000' workers = 3 user = "root"
# Generated by Django 2.1.5 on 2019-02-03 23:29 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [("main", "0004_auto_20190203_2232")] operations = [ migrations.AlterField( model_name="entry", name="imdb", field=model...
#!/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. import sys import in_generator import make_names import media_feature_symbol class MakeMediaFeatureNamesWriter(make_names.MakeNamesW...
from imutils.video import VideoStream from imutils.video import FPS import numpy as np import argparse import imutils import pickle import time import cv2 import os import pyfakewebcam import sys def run(): args = {"detector": "face_detection_model", "embedding_model": "openface_nn4.small2.v1.t7", "recognizer": "o...
import os, numpy as np, sys, cv2 import random from PIL import Image from datasets.coordinate_transformation import compute_box_3dto2d max_color = 30 score_threshold = -10000 width = 1242 height = 374 def draw_projected_box3d(image, qs, color=(255,255,255), thickness=2): ''' Draw 3d bounding box in image ...
import requests # now carriage return r = requests.post('http://127.0.0.1:5000/DEBUG',json={"Message":"Trying to do something funky and logging it"},headers={'Content-type': 'application/json', 'Accept': 'text/plain'}) print(r.status_code) print(r.text) # short request r = requests.post('http://127.0.0.1:5000/DEBUG',...
"""spec2nii module containing functions specific to interpreting Philips DICOM Author: William Clarke <william.clarke@ndcn.ox.ac.uk> Copyright (C) 2020 University of Oxford """ import numpy as np import nibabel.nicom.dicomwrappers from spec2nii.dcm2niiOrientation.orientationFuncs import dcm_to_nifti_orientation from sp...
import torch from torch import nn from einops import repeat from einops.layers.torch import Rearrange from module import ConvAttention, PreNorm, FeedForward import numpy as np class Transformer(nn.Module): def __init__(self, dim, img_size, depth, heads, dim_head, mlp_dim, dropout=0., last_stage=False): su...
""" Loads trained agents and tests them on a plane of the RGB cube with G fixed. Results are saved in the results folder and plotted with plot_interpolation in the plotting folder """ import pickle import numpy as np from env import gym import matplotlib.pyplot as plt import cv2 cv2.ocl.setUseOpenCL(False) from a...
from django.contrib.admin import AdminSite from django.contrib.admin.models import LogEntry from django.contrib.auth.admin import GroupAdmin from django.contrib.auth.models import Group, Permission from django.contrib.sites.admin import SiteAdmin from django.contrib.sites.models import Site from blog.admin import ( ...
from JumpScale import j j.base.loader.makeAvailable(j, 'system.platform') platformid = None import sys if not sys.platform.startswith("win"): try: import lsb_release platformid = lsb_release.get_distro_information()['ID'] except ImportError: exitcode, platformid = j.system.process.exe...
''' This is the resnet structure. ''' import tensorflow as tf from hyper_parameters import * BN_EPSILON = 0.001 NUM_LABELS = 6 def activation_summary(x): ''' :param x: A Tensor :return: Add histogram summary and scalar summary of the sparsity of the tensor ''' tensor_name = x.op.name # tf.his...
# -*- coding: utf-8 -*- # Generated by Django 1.11.2 on 2017-06-10 11:58 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('transactions', '0011_transaction'), ] operations =...
import numpy as np import SimpleITK as sitk __all__ = [ "load_sitk_to_numpy", "save_numpy_to_sitk", ] def load_sitk_to_numpy(path, header=False, dtype=None, dcm=False): if dcm: reader = sitk.ImageSeriesReader() dcm_series = reader.GetGDCMSeriesFileNames(path) reader.SetFileNames(d...
# # PySNMP MIB module PROXIM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PROXIM-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:42:21 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:...
"""This module contains the general information for FirmwareSecureFPGA ManagedObject.""" from ...ucsmo import ManagedObject from ...ucscoremeta import MoPropertyMeta, MoMeta from ...ucsmeta import VersionMeta class FirmwareSecureFPGAConsts: FPGAIMAGE_STATUS_ACTIVATION_FAILED = "Activation Failed" FPGAIMAGE_S...
# Show the curse of dimensionality. import numpy as np import matplotlib.pyplot as plt import pyprobml_utils as pml ds = [1., 3., 5., 7., 10.] s = np.linspace(0, 1, 100) for d in ds: y = s ** (1 / d) plt.plot(s, y, 'b-') plt.text(0.3, 0.3**(1/d), 'd=%d' % d) plt.xlabel('Fraction of data in neighborhood') ...
import os from datetime import datetime from typing import Any from typing import Dict from typing import Optional from typing import Union from twitterapiv2.http import Http from twitterapiv2.model.recent.recent import Recent as SearchResponse _BEARER_TOKEN = "TW_BEARER_TOKEN" class SearchClient(Http): URL = ...
"""Anomalib Inferencer Script. This script performs inference by reading a model config file from command line, and show the visualization results. """ # Copyright (C) 2020 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the L...
from queue import Queue dr = [0, 0, -1, 1] dc = [-1, 1, 0, 0] def BFS(sr, sc, fr, fc): q = Queue() q.put((sr, sc)) gameMap[sr][sc] = "X" while not q.empty(): ur, uc = q.get() for i in range(4): r = dr[i] + ur c = dc[i] + uc if (r, c) == (fr, fc) and gameMap[r][c] == "X": return True if r i...
#!/usr/bin/env python3 import time import threading import requests from bs4 import BeautifulSoup import numpy as np import pandas as pd from bokeh.plotting import figure, output_file, show from bokeh.models import ColumnDataSource, HoverTool URL = 'http://192.168.1.18/' #Temperature sensor endpoint FILENAME = 'ts_te...
from art_export import ArtExporter WIDTH, HEIGHT = 80, 25 class EndDoomExporter(ArtExporter): format_name = 'ENDOOM' format_description = """ ENDOOM lump file format for Doom engine games. 80x25 DOS ASCII with EGA palette. Background colors can only be EGA colors 0-8. """ def run_export(self, out_fil...
from shiftschema.filters.abstract_filter import AbstractFilter from shiftschema.filters.digits import Digits from shiftschema.filters.slugify import Slugify from shiftschema.filters.stringify import Stringify from shiftschema.filters.strip import Strip from shiftschema.filters.lowercase import Lowercase from shiftschem...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import json import os import pdb import zipfile from xml.etree import ElementTree import numpy as np from torch.utils import data from torchvision.datasets import VOCSegmentation, SBDataset from...
from models.layers import * class VGG16(object): def __init__(self, num_classes, name='vgg16'): super(VGG16, self).__init__() units = [64, 64, "M", 128, 128, "M", 256, 256, 256, "M", 512, 512, 512, "M", 512, 512, 512] self.num_classes = num_classes self.layers = [] with t...
import pytest class TestAdminPermissions: PAGES = ( # (URL, accessible by role.Staff?) ("/admin/", True), ("/admin/admins", False), ("/admin/badge", False), ("/admin/features", False), ("/admin/groups", True), ("/admin/mailer", True), ("/admin/nipsa"...
import os def make_directory(name, path:str='') -> None: ''' This functions creates a directory :param name: The name of the directory to create. :param path: The path where the directory has to be created. :return: None or OS-Error if the directory could not be created. ''' ...
# -*- coding: utf-8 -*- """ spfs/utils/test/test_normalization """ import unittest import numpy as np from spfs.utils.normalization import Normalization class TestNormalization(unittest.TestCase): def setUp(self): self.vector = np.arange(4) def test_lp(self): for p in range(3): ...
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: demo = ListNode() head = demo while l1 != None and ...
# The MIT License (MIT) # # Copyright (c) 2018 stanwood GmbH # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, m...
from setuptools import setup from pathlib import Path readme = Path(__file__).with_name("README.rst").read_text() setup( name='talk_video_uploader', version='0.1', description='Batch upload talk videos to YouTube', long_description=readme, long_description_content_type="text/x-rst", url='https...
#!/usr/bin/env python import roslib; roslib.load_manifest('speech_cmd') import rospy from std_msgs.msg import String from geometry_msgs.msg import Twist from std_srvs.srv import * import actionlib from move_base_msgs.msg import * import os import commands import pyttsx class cmd(object): def __init__(self): ...
# -*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ from KalmanFilter import * from math import cos, sin, sqrt, atan2 def H_of (pos, pos_A, pos_B): """ Given the position of our object at 'pos' in 2D, and two transmitters A and B at positions 'pos_A' and 'pos_B', return the partia...