content
stringlengths
5
1.05M
# Copyright (c) 2015, Zhenwen Dai # Licensed under the BSD 3-clause license (see LICENSE.txt) import abc import os import numpy as np import scipy.io class AutoregTask(object): __metaclass__ = abc.ABCMeta def __init__(self, datapath=os.path.join(os.path.dirname(__file__),'../../datasets/system_identifica...
from scripts.ssc.models.TopoAE import test_grid_euler from src.models.TopoAE.train_engine import simulator_TopoAE from joblib import Parallel, delayed if __name__ == "__main__": Parallel(n_jobs=4)(delayed(simulator_TopoAE)(config) for config in [test_grid_euler,test_grid_euler,test_grid_euler,test_grid_euler])
import psutil def kill_process_with_children(parent_pid): parent = psutil.Process(parent_pid) for child in parent.children(recursive=True): child.kill() parent.kill()
# # Copyright (c) 2013, Centre National de la Recherche Scientifique (CNRS) # # 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 require...
import tensorflow as tf from slim import ops from slim import scopes import numpy as np import np_helper import losses import models.model_helper as model_helper from models.model_helper import convolve, read_vgg_init FLAGS = tf.app.flags.FLAGS def inference(inputs, is_training=True): if is_training: vgg_layer...
''' Functions for working with generic dual-input bi-exponential models (DIBEM) This general function form can be used by the two-compartment exchange model (2CXM), two compartment filtration module and the active-uptake and efflux model (AUEM). In each case the specific model needs to define how to convert its physi...
r""" Classical Invariant Theory This module lists classical invariants and covariants of homogeneous polynomials (also called algebraic forms) under the action of the special linear group. That is, we are dealing with polynomials of degree `d` in `n` variables. The special linear group `SL(n,\CC)` acts on the variable...
# -*- coding: utf-8 -*- """Installer for the docxcompose package.""" from setuptools import find_packages from setuptools import setup tests_require = [ 'pytest', ] setup( name='docxcompose', version='1.3.4.dev0', description="Compose .docx documents", long_description=(open("README.rst").read()...
# Generated by Django 3.1.7 on 2021-04-01 06:35 from django.db import migrations, models import django.db.models.deletion import mptt.fields import nautobot.extras.models.statuses import taggit.managers class Migration(migrations.Migration): initial = True dependencies = [ ("tenancy", "0001_initial...
def say_hello(): s = "hello" return s if __name__ == "__main__": print(say_hello())
# -*- coding: utf-8 -*- # file: __init__.py # date: 2021-09-23 from .expt import *
# Script to make plots from the RJ-MCMC output import matplotlib.pyplot as plt import matplotlib.mlab as mlab import matplotlib.cm as cm import numpy as np from scipy import stats from matplotlib.colors import LogNorm import os import sys if not os.path.exists('input_file'): print('*'*50) print('Cannot find f...
from pyxb.bundles.opengis.citygml.raw.building import *
from random import randint class Sorting: """Groups different sorting algorithms.""" @classmethod def qsort(cls, arr, beggining=0, pivot=None): """Quick sort implementation.""" start = beggining if pivot is None: pivot = len(arr) - 1 arr_lenght = pivot - start ...
from mothra.settings import INSTALLED_APPS, INSTALLED_APPS_EXTERNAL_PACKAGES appName = 'workflows' def get_installed_apps(): return list(get_local_installed_apps()) + list(get_extern_installed_apps()) def get_local_installed_apps(): return [name[len(appName) + 1:] for name in INSTALLED_APPS if ...
"""The Robotarium class used to instantiate experimentation. Written by: The Robotarium Team Modified by: Zahi Kakish (zmk5) """ import functools import math import time from typing import Tuple import numpy as np import rclpy from geometry_msgs.msg import Twist from nav_msgs.msg import Odometry from robotarium_n...
import numpy as np class QuantizedNdarray(np.ndarray): def __new__(cls, input_array, qtype=None, **kwargs): obj = np.asarray(input_array).view(cls) obj.qtype = qtype return obj def __array_finalize__(self, obj): if obj is None: return #pylint: disable=attribute-def...
from . import soot_foil, schlieren __all__ = ["soot_foil", "schlieren"]
import os.path from data.base_dataset import BaseDataset from data.image_folder import make_dataset import human36m_skeleton from PIL import Image import torchvision.transforms as transforms import torchvision.transforms.functional as functional import matplotlib.pyplot as plt import skimage.io import skimage.transform...
from django.conf import settings from django.utils import translation import pytest from mock import Mock, patch from olympia.amo.tests import TestCase from olympia.amo.utils import from_string from olympia.addons.models import Addon from olympia.translations.templatetags import jinja_helpers from olympia.translation...
import badger2040 import machine import time import gc # **** Put the name of your text file here ***** text_file = "book.txt" # File must be on the MicroPython device try: open(text_file, "r") except OSError: try: # If the specified file doesn't exist, # pre-populate with Wind In The Willo...
import pytest import numpy as np import pandas as pd from cudf import melt as cudf_melt from cudf.dataframe import DataFrame @pytest.mark.parametrize('num_id_vars', [0, 1, 2, 10]) @pytest.mark.parametrize('num_value_vars', [0, 1, 2, 10]) @pytest.mark.parametrize('num_rows', [1, 2, 1000]) @pytest.mark.parametrize( ...
import yaml import time import numpy as np from selenium import webdriver from selenium.webdriver.common.by import By # loading connfigs with open("config.yaml", "r") as ymlfile: config = yaml.load(ymlfile, Loader=yaml.FullLoader) DRIVER_LOCATION = config["Survey"]["DRIVER_LOCATION"] URL = config["Survey"]["URL"...
# -*- coding: utf-8 -*- """ pip_services_logging.logic.LoggingController ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Logging controller implementation :copyright: Conceptual Vision Consulting LLC 2015-2016, see AUTHORS for more details. :license: MIT, see LICENSE for more details. """ fr...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import numpy as np from numpy.fft import fft from scipy.interpolate import interp1d from .common import mmul_weight from .polynomial import multEdwdx, nl_terms, poly_deriv from .statespace import NonlinearStateSpace, StateSpaceIdent """ PNLSS -- a collection of classes...
import traceback class Foo(): def __init__(self): self.bar = "it's foo" def __enter__(self): print("setup") # Объяснить зачем return self return self def __exit__(self, exc_type, exc_val, exc_tb): print(traceback.extract_tb(exc_val)) # print("teardown wit...
from docutils.writers import html4css1, Writer from rst2text.translators import TextTranslator from flask_rstpages.parsers import HTMLTranslator from typing import Iterable, cast class HTMLWriter(html4css1.Writer): """Subclass the html4css1.Writer to redefine the translator_class""" def __init__(self): ...
#! -*- coding: utf-8 -*- # 用GlobalPointer做中文命名实体识别 # 数据集 https://github.com/CLUEbenchmark/CLUENER2020 import json import numpy as np from snippets import * from bert4keras.backend import keras from bert4keras.backend import multilabel_categorical_crossentropy from bert4keras.layers import EfficientGlobalPointer as Glo...
# -*- coding: utf-8 -*- from data.reader import wiki_from_pickles, corpora_from_pickles from data.corpus import Sentences from collections import Counter from itertools import combinations import numpy as np import matplotlib.pyplot as plt def number_sents(sents): d = dict() i = 0 found = 0 for s i...
# coding: utf-8 from __future__ import unicode_literals import calendar import re import time from .amp import AMPIE from .common import InfoExtractor from ..compat import compat_urlparse class AbcNewsVideoIE(AMPIE): IE_NAME = 'abcnews:video' _VALID_URL = r'https?://abcnews\.go\.com/[^/]+/video/(?P<display_...
import numpy as np from foolbox2.criteria import TargetClass from foolbox2.models.wrappers2 import CompositeModel # from fmodel3 import create_fmodel_combo from fmodel import create_fmodel as create_fmodel_18 from fmodel2 import create_fmodel as create_fmodel_ALP from foolbox2.attacks.iterative_projected_gradient impor...
import pandas as pd import githubstats.database as db class Reports: """Generate reports from the database. :param target_db: Full path with file name and extension to your SQLite3 database USAGE ``` from githubstats import Reports # instantiate reports class rpt = Reports("<full...
# # All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or # its licensors. # # For complete copyright and license terms please see the LICENSE at the root of this # distribution (the "License"). All use of this software is governed by the License, # or, if provided, by the license below or th...
from flask.cli import FlaskGroup from app import create_app, db app = create_app() cli = FlaskGroup(app) @cli.command('recreate_db') def recreate_db(): db.drop_all() db.create_all() db.session.commit() if __name__ == '__main__': cli()
#!/usr/bin/env python import os import sys from django_app.config import get_project_root_path, import_env_vars if __name__ == "__main__": import_env_vars(os.path.join(get_project_root_path(), 'envdir')) os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_app.config.settings.dev") from django.core.m...
''' Voici le module qui a une fonction de déboggage ''' from Game import window import time debugger = None class Debug: def __init__(self, stage): self.fps = 0 self.t0Win = 0 self.stage = stage self.stop = False def fps_add(self): # Compteur de fps self.fps += ...
########################## FWMAV Simulation ######################### # Version 0.3 # Fan Fei Feb 2019 # Direct motor driven flapping wing MAV simulation ####################################################################### import gym import flappy from stable_baselines.common.policies import MlpPolicy from stab...
import sublime import sublime_plugin import os import re from ..settings import get_setting from ..utils import get_namespace, get_active_project_path class ImportNamespaceCommand(sublime_plugin.TextCommand): def run(self, edit): projectPath = get_active_project_path() file_name = self.view.file_...
import os from pathlib import Path class Constants: test_dir: Path = Path(__file__).parent sample_data_dir: str = os.path.join(test_dir, 'sample_data') test_data_dir: str = os.path.join(test_dir, 'test_data') ref_data_dir: str = os.path.join(test_dir, 'reference_data') # files scrummyrc: str ...
import urllib3 import traversal_rule_identifier from bs4 import BeautifulSoup import json import tldextract import certifi import ssl from traversal_rule_identifier import TraversalRule ssl_context = ssl.SSLContext() ssl_context.load_verify_locations(certifi.where()) http = urllib3.PoolManager(ssl_context=ssl_context)...
from nodes import Var, Term, Fact, BinOp, Goals, Rule, Rules from knowledgeBase import KnowledgeBase from visitors import make_expr from unificationVisitor import Substitutions import utils lovely_rules = KnowledgeBase({'loves/2': [Rule(Fact('loves/2', [Term('hanna'), Term('miles')]), None), Rule(Fact('loves/2', [Term...
# -*- coding:ISO-8859-1 -*- ''' This file contains the class that is responsability to open package.json remove all contents in the key dependencies and devDependencies and add all dependencies from csv to dependencies key ''' import json class Package: # the file to change is the package json d...
#!/usr/bin/env python3 import argparse from logging import getLogger from os import path from common import setup_log, list_csv_files, read_csv from model import ParcelOffer from place_resolver import MapQuestClient, PlaceResolver def main(map_quest_api_key: str, csv_cache: str, offers_directory: str): setup_lo...
#!/usr/local/bin/python # -*- coding: utf-8 -*- """ list keys from inverted files (ZODB) """ from os.path import dirname, basename, exists, join from ZODB import FileStorage, DB from persistent.list import PersistentList from persistent.dict import PersistentDict import transaction from BTrees.OOBTree import OOBTree ...
import sys import requests import getpass from IPython.display import display, clear_output, HTML # if Python2, prompt with raw_input instead of input if sys.version_info.major==2: input = raw_input class EarthdataLogin(requests.Session): """ Prompt user for Earthdata credentials repeatedly until auth su...
# (C) Copyright 1996-2018 ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergov...
# encoding: utf8 from __future__ import unicode_literals # Source: https://github.com/stopwords-iso/stopwords-hr STOP_WORDS = set(""" a ah aha aj ako al ali arh au avaj bar baš bez bi bih bijah bijahu bijaše bijasmo bijaste bila bili bilo bio bismo biste biti brr buć budavši bud...
import random print(''' Password Generator ================== ''') chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@&0123456789' number = input('number of passwords?') number = int(number) length = input('password length?') length = int(length) print('\nhere are your passwords:') for pwd in range(num...
#!/usr/bin/env python3 # A simple game without purpose (yet) # version 0.1.1 # author: key999 # exit codes: # 0 - correct exit # anything else i will add here, i.e. -1 something import pygame import objects as obj import menu class Game: def __init__(self): self.running = True s...
__________________________________________________________________________________________________ sample 28 ms submission class Solution: def count_indents(self, paths): res = [] for path in paths: count = 0 i = 0 while i < len(path) and path[i] == '\t': ...
from pprint import pprint def rule110CA(arr): CARule = [0,1,1,0,1,1,1,0] N = len(arr) arrX = [[10 for i in range(N)] for k in range(N)] arrX[0] = arr for k in range(1,N): arrX[k][0] = arrX[k-1][0] arrX[k][N-1] = arrX[k-1][N-1] for i in range(1,N-1): arrX[k][i] = C...
# COMMON REGION_NAME="us-east-1" # AIRFLOW AIRFLOW_DAG_ID="mwaa-sm-customer-churn-dag" # GLUE GLUE_ROLE_NAME="AmazonMWAA-Glue-Role" GLUE_JOB_NAME_PREFIX="mwaa-xgboost-preprocess" GLUE_JOB_SCRIPT_S3_BUCKET="glue-scripts-XXXXXXXXXXXX-us-east-1" GLUE_JOB_SCRIPT_S3_KEY="mwaa-xgboost/preprocess-data/glue_etl.py" DATA_S3_...
from typing import List import numpy as np import torch import pyonmttok from purano.annotator.processors import Processor from purano.models import Document from purano.proto.info_pb2 import Info as InfoPb @Processor.register("elmo") class ElmoProcessor(Processor): def __init__(self, options_file: str, weight_...
odbc_Dcs_GetObjRefHdl_ASParamError_exn_ = 1 odbc_Dcs_GetObjRefHdl_ASTimeout_exn_ = 2 odbc_Dcs_GetObjRefHdl_ASNoSrvrHdl_exn_ = 3 odbc_Dcs_GetObjRefHdl_ASTryAgain_exn_ = 4 odbc_Dcs_GetObjRefHdl_ASNotAvailable_exn_ = 5 odbc_Dcs_GetObjRefHdl_DSNotAvailable_exn_ = 6 odbc_Dcs_GetObjRefHdl_PortNotAvailable_exn_ = 7 odbc_Dcs_G...
rule map_bwa_index: input: RAW + "genome.fa" output: expand( RAW + "genome.fa.{extension}", extension="amb ann bwt pac sa".split(" ") ) threads: 1 log: MAP + "bwa_index.log" benchmark: MAP + "bwa_index.time" conda: "...
#!/usr/bin/python ## @file MBGeneratedDefines.py ## @date Jul 30 2012 ## @copyright ## 2012 Brandon LeBlanc <demosdemon@gmail.com> ## This program is made avaliable under the terms of the MIT License. ## ## @brief Generated MBGeneratedDefines at build time. import sys import os import os.path import subprocess im...
# формирует url-адреса для api # ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: from django.conf.urls import url from .views import * # ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: urlpatterns = [ url(r'^set$', add_cash), url(r'^withdraw$', withdraw_ca...
import json import glob import os import yaml from collections import defaultdict try: from yaml import CLoader as Loader except ImportError: from yaml import Loader import re import requests import textwrap from datetime import datetime from random import randint from invoker import ReplyObject, Command class...
import pytest from hw import ObjectDict from hw.object_dict import NoneType @pytest.mark.parametrize( "typename, value", [("int", 42), ("float", 3.14159), ("string", "I'm a string"), ("NoneType", None)], ) def test_passthrough(typename, value): assert ObjectDict(value) is value def test_empty_list(): ...
class DiceRollResult: """ Class to keep track of the result of the roll of the dice. """ def __init__(self): self.__dice_result = 0 # It is used to keep track of how many times an equal number has been rolled self.__double_value_counter = 0 @property def dice_result(sel...
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
# -*- coding: utf-8 -*- """ greenbyteapi This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). """ from greenbyteapi.api_helper import APIHelper import greenbyteapi.models.data_signal import greenbyteapi.models.status_item class StatusItem(object): """Implementation of the 'St...
# -*- coding: utf-8 -*- # Generated by Django 1.11.5 on 2017-10-03 11:45 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('calculator', '0002_auto_20161121_1804'), ] operations = [ migrations.RemoveField( ...
def bingo(ticket, win):
from setuptools import setup, find_packages description = """ See `github repo <https://github.com/pior/appsecrets>`_ for information. """ VERSION = '0.7.0' # maintained by release tool setup( name='appsecrets', version=VERSION, description='Manage your application secrets (with Google Cloud KMS)', ...
import time, sys from selenium import webdriver from selenium.webdriver.firefox.options import Options START_URL = 'https://life.bsc.es/pid/pydockweb/default/index' EMAIL = 'ser499webscraper@gmail.com' if len(sys.argv) != 3: print('Usage: -a receptor -a ligand') sys.exit(1) receptor = sys.argv[1] receptor_ch...
import ctypes import osgDB, osgViewer, osg, osgGA, osgAnimation floatKeys = osgAnimation.FloatKeyframeContainer() key0 = osgAnimation.FloatKeyframe(0.0, 1.0) floatKeys.push_back(key0) vec3Keys = osgAnimation.Vec3KeyframeContainer() key0 = osgAnimation.Vec3Keyframe(0.0, osg.Vec3(1,2,3)) vec3Keys.push_back(key0) vec4...
import pathlib import subprocess from conductor.utils.git import Git def test_detect_no_git(tmp_path: pathlib.Path): g = Git(tmp_path) assert not g.is_used() def test_detect_empty_repo(tmp_path: pathlib.Path): setup_git(tmp_path, initialize=False) g = Git(tmp_path) assert g.is_used() def test...
### This program uses the tkinter library to draw egypt ### from tkinter import * # Creates a new window without a canvas main = Tk() # Creates a canvas to draw on canvas = Canvas(main, bg="darkred", height=500, width=2000) # Creates a sun rising from the west. canvas.create_oval(10,10,150,150, fill ="darkorange"...
import unittest from gphotospy.album import Album class TestAlbum(unittest.TestCase): def test_create_album(self): pass
# Created by Xingyu Lin, 2019-09-18 import argparse import torch import numpy as np from rlkit.torch.pytorch_util import set_gpu_mode import rlkit.torch.pytorch_util as ptu import copy import cv2 def batch_chw_to_hwc(images): rets = [] for i in range(len(images)): rets.append(copy.copy(np.transpose(im...
from typing import List def digits(x: int) -> List[int]: return [int(d) for d in str(x)] assert digits(103) == [1, 0, 3] assert digits(5) == [5] def new_recipes(recipe1: int, recipe2: int) -> List[int]: total = recipe1 + recipe2 return digits(total) assert new_recipes(3, 7) == [1, 0] def scoreboard(num...
from fabric.api import task, runs_once from fabric.api import run, sudo, hide, settings, abort, execute, puts, env from fabric import colors from time import sleep import json import re def _strip_bson(raw_output): stripped = re.sub(r'(ISODate|ObjectId|NumberLong)\((.*?)\)', r'\2', raw_output) return re.sub(r...
from typing import * from mongoengine import StringField from .commented_odm import CommentedODM class Account(CommentedODM): username = StringField(required=True) hashdata = StringField(required=True) Account.setup_odm()
#!/usr/bin/env /usr/local/bin/python3 #tool thrown together to decode obfuscate strings in sample with sha256 586409e98ade6e754cfba0bd0aec2e8690a909c41cebac4085cad6f79d9676b4 import re def decode_HojmKcMqFYaYKqxLdDAfSKDHMYMhyihZnH_numArray1(): string_to_decode ='''numArray1[18] = 48; numArray1[18] = 100; ...
from pyglet.window import mouse, key from pyglet import gl import app import graphicutils as gu from core import draw from ui import widgets, elements, handlers from core.context_wrapper import ContextWrapper from constants import * class ContextFrame(widgets.Frame): def __init__(self, x, y, w, h): super...
from account.models.users import User from account.serializer.user import UserSerializer from account.forms import LoginForm, SignUpForm from rest_framework.renderers import TemplateHTMLRenderer from rest_framework.response import Response from rest_framework.views import APIView from django.contrib.auth import login...
# Generated by Django 3.1.4 on 2020-12-15 23:34 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('administracion', '0003_auto_20201212_1253'), ] operations = [ migrations.AddField( model_name='almacenmodel', name='...
# -*- coding: utf-8 -*- """ File name: simulation_interface.py Description: a set of functions for recording and training/testing neural networks Author: Roman Pogodin Python version: 3.6 """ IS_REPRODUCIBLE = True from warnings import warn import numpy as np # For reproducibility in Keras # https:/...
#!/usr/bin/env python from __future__ import print_function import argparse from bluepy.btle import UUID, Peripheral, ADDR_TYPE_RANDOM, Scanner, DefaultDelegate, BTLEException from bluepy import btle import time from time import sleep import struct import binascii import sys import os import datetime from BoogioLogger ...
############################################################################### ## ## Copyright 2011-2013 Tavendo 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 ## ## ...
"""A setup module for psidPy Based on the pypa sample project. A tool to download data and build psid panels based on psidR by Florian Oswald. See: https://github.com/floswald/psidR https://github.com/tyler-abbot/psidPy """ from setuptools import setup, find_packages from codecs import open from os import path her...
""" Tutorials / horn antenna Description at: http://openems.de/index.php/Tutorial:_Horn_Antenna (C) 2011,2012,2013 Thorsten Liebig <thorsten.liebig@uni-due.de> Python Adaptation : ESIR Project 2015 """ from pylayers.em.openems.openems import * import scipy.constants as cst import numpy as np # setup the simulation...
""" system/pre_kaster.py - Tasks to be done when the program is initialized Copyright (C) 2017-2018 Nguyen Hoang Duong <novakglow@gmail.com> Licensed under MIT License (see LICENSE). """ import sys import os sys.path.insert(0, "utils") from global_vars import * def main(): """ All processes to be ran on pro...
#!/usr/bin/python fname = "H37Rv_genome.fasta" fh = open(fname, 'r') fh.readline() # remove the fasta header numA = 0 numT = 0 numC = 0 numG = 0 for line in fh: numA += line.count("A") numT += line.count("T") numC += line.count("C") numG += line.count("G") allbases = float(numA+numT+numC+numG) print ("...
import numpy as np def bbox_iou(bbox_a, bbox_b): ''' 计算建议框和真实框的重合程度 Parameters ---------- bbox_a bbox_b Returns ------- ''' if bbox_a.shape[1] != 4 or bbox_b.shape[1] != 4: print(bbox_a, bbox_b) raise IndexError tl = np.maximum(bbox_a[:, None, :2], bbox_b[...
fruit = input() set_type = input() set_count = int(input()) price = 0 if set_type == "small": if fruit == "Watermelon": price = set_count * 2 * 56 elif fruit == "Mango": price = set_count * 2 * 36.66 elif fruit == "Pineapple": price = set_count * 2 * 42.10 elif fruit == "Raspber...
# -*- coding: utf-8 -*- """Extends urllib with additional handlers.""" from __future__ import (absolute_import, division, print_function, unicode_literals, with_statement) import argparse import json import sys import boto3 def keys_from_bucket_objects(objects): """Extract keys from a li...
import platform import pypinyin from pathlib import Path from PIL.ImageFont import FreeTypeFont from PIL import Image, ImageDraw, ImageFont from PIL.Image import Image as IMG dir_path = Path(__file__).parent.absolute() def cn2py(word) -> str: temp = "" for i in pypinyin.pinyin(word, style=pypinyin.NORMAL): ...
import json import os import sys import urllib.parse from datetime import datetime from string import Template import numpy import uvicorn from fastapi import FastAPI, BackgroundTasks from starlette.requests import Request from starlette.responses import HTMLResponse, RedirectResponse, Response from starlette.staticfi...
# Databricks notebook source # MAGIC %md-sandbox # MAGIC # MAGIC <div style="text-align: center; line-height: 0; padding-top: 9px;"> # MAGIC <img src="https://databricks.com/wp-content/uploads/2018/03/db-academy-rgb-1200px.png" alt="Databricks Learning" style="width: 600px"> # MAGIC </div> # COMMAND ---------- # M...
import os import unittest from XvfbRobot import XvfbRobot def reset_display(): os.environ["DISPLAY"] = ":0" class TestXvfbRobot(unittest.TestCase): def setUp(self): reset_display() def test_start_virtual_display(self): xvfb_robot = XvfbRobot() xvfb_robot.start_virtual_display(...
""" /llrws/tools/mave/validation/__init__.py ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Tools for interfacing with MAVE file validation tasks. """ import csv import warnings import numpy as np import pandas as pd warnings.simplefilter(action="ignore", category=UserWarning) def get_tidy_pd_dataframe_from_csv(csv_fil...
""" This is a module used to get hardware info """ import psutil import cpuinfo import math import platform import sys import sysconfig from datetime import datetime import speedtest class CPU: info = cpuinfo.get_cpu_info() @staticmethod def cpu_cores(hyperthreading = False): return ps...
from django.shortcuts import render,redirect,HttpResponse,reverse from django.views.generic import View from apps.imgshow.models import Imgmain class Imghomepage(View): def get(self,request): img=Imgmain.objects.all() return render(request,'imghomepage.html',locals())
from vou.utils import logistic from random import Random from enum import IntEnum, unique from itertools import repeat from collections import deque import numpy as np @unique class BehaviorWhenResumingUse(IntEnum): SAME_DOSE = 0 LOWER_DOSE = 1 @unique class OverdoseType(IntEnum): NON_FATAL = 0 FA...
# Copyright 2017-2020 TensorHub, 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...
import pandas as pd from tqdm import tqdm def initFile(): with open('../logs/meanScoreLogs.csv', 'w') as f: pass def getDF(df, angle): dff = df[df['angle'] == angle] dff = dff.sort_values(by=["reward"], ascending=False) return dff def writeFile(file): df = pd.read_csv(file, sep=',', he...
# Copyright @2018 The CNN_MonoFusion Authors (NetEaseAI-CVlab). # All Rights Reserved. # # Please cited our paper if you find CNN_MonoFusion useful in your research! # # See the License for the specific language governing permissions # and limitations under the License. # from __future__ import print_function import ...
import FWCore.ParameterSet.Config as cms process = cms.Process("SKIM") process.configurationMetadata = cms.untracked.PSet( version = cms.untracked.string('$Revision: 1.1 $'), name = cms.untracked.string('$Source: /cvs/CMSSW/CMSSW/DPGAnalysis/Skims/python/logErrorSkim_cfg.py,v $'), annotation = cms.untrack...