text
stringlengths
3.07k
22.1k
""" Code to run grasp detection given an image using the network learnt. Copy and place the checkpoint files under './checkpoint' to load the trained network Example run: 1. initialize predict model with pretrained weights G = Predictor('./checkpoint_100index') 2. given input image, calculate best grasp location an...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Oct 25 07:47:34 2017 @author: jshliu Util scripts """ import os import pandas as pd import numpy as np import pickle import pprint import tarfile import copy import re import torch from sklearn.feature_extraction.text import CountVectorizer import pic...
from flask import render_template, redirect, url_for, request from application import app, db, bcrypt from application.models import Users, Shoes, Shops, ShoesShops from application.forms import LoginForm, UpdateShoeForm, AddShoeForm, UpdateQuantityForm from flask_login import login_user, current_user, logout_user, log...
import math def get_slope(p=None, ang=None): if p != None: (x1, y1), (x2, y2) = p if x2 - x1 != 0: return (y2 - y1) / (x2 - x1) else: return 'infinity' elif ang != None: if ang not in [90, -90]: return math.tan(ang) ...
import sounddevice as sd import soundfile as sf import queue from collections import namedtuple from threading import Event from ._helper import _print_debug ######################## ### Data Definitions ### ######################## AudioParametersStruct = namedtuple('AudioParametersStruct', ['device', 'buffersize'...
import torch from torch import nn from torch.nn import functional as F from torch.utils.data import DataLoader from torch.utils.data import random_split import pytorch_lightning as pl from torch.utils.data import Dataset from torch.utils.data import DataLoader import torch.autograd.functional as AGF from pytorch_lightn...
import torch from torch import Tensor from torchvision.transforms.functional_tensor import _is_tensor_a_torch_image, convert_image_dtype def resize(clip, target_size, interpolation_mode): assert len(target_size) == 2, "target size should be tuple (height, width)" return torch.nn.functional.interpolate( ...
#!/usr/bin/env python # -*- coding: utf-8 -*- from itertools import chain import logging from dipy.align.streamlinear import (StreamlineLinearRegistration, BundleMinDistanceMetric) from dipy.segment.clustering import qbx_and_merge from dipy.tracking.distances import bundles_distan...
import numpy as np import torch import torch.nn as nn from smt.sampling_methods import LHS from scipy import linalg # Set double precision by default torch.set_default_tensor_type(torch.DoubleTensor) torch.set_default_dtype(torch.float64) def generate_mesh( limits: np.array, num_samples: int, method: str = "LHS"...
import math from hippy.builtin import wrap from hippy.builtin import StringArg from hippy.builtin import BoolArg from hippy.builtin import LongArg from hippy.builtin import Optional from rpython.rlib import rsocket from rpython.rlib.rstring import StringBuilder from hippy.module.date.funcs import _strftime from hippy.o...
""" Get information on numa architecture. """ from __future__ import print_function, division, unicode_literals import os import socket import fcntl import struct import ipaddress import sys import logging import coloredlogs _log = logging.getLogger("mpikat.core.utils.numa") try: import mpikat.utils.pynvml as ...
import numpy as np import subprocess as sp from igorwriter import IgorWave import os def load_agr(path): # output: ndarray energy(band,kx), weight(band,kx) if not path.endswith('.agr'): return 0 with open(path, 'r') as f: lines = f.readlines() ba = 1 ba_ls = [i for i in range(1, 600)] eng = [] wei = [] n ...
import numpy as np import pyro import pyro.distributions as dist import torch import transforms3d as tf3d from generation.ArticulatedObjs import ArticulatedObject from generation.utils import sample_quat, sample_pose, make_string, make_single_string, make_quat_string, get_cam_relative_params2, angle_to_quat, get_cam_p...
#!/usr/bin/env python #title :pyscript.py #description :This will navigate a Turtlebot in Gazeboo to published Targets #author :<NAME> (<EMAIL>) #date :2019-06-02 #version :1 #usage :roslaunch ts_171727_prj start.launch #notes : #python_version :3.5.2 #===...
"""Logger application""" from __future__ import annotations import csv import json import queue import sys import threading import time import traceback import warnings from datetime import datetime from typing import Any, Optional from serial.threaded import ReaderThread #type:ignore from flask import render_template,...
"""============= Example : face_chacer.py Author : <NAME> Description : A tool to cntrol the PC mouse only with your head motion and blinck to click At the beginning clicking is deactivated. You need to close your eyes for at least 2seconds to activate blink clicking <================""" i...
import argparse import math import os import shutil from datetime import datetime, timedelta from pathlib import Path from typing import Optional, Dict import numpy as np from netCDF4 import Dataset from dtran import IFunc, ArgType from dtran.ifunc import IFuncType from dtran.metadata import Metadata class Gldas2Cyc...
try: from .Legacy import run as cxgen except: from Legacy import run as cxgen try: from .utils import * except: from utils import * from tkinter import * from tkinter.filedialog import askdirectory, askopenfilename, askopenfile, askopenfilenames, askopenfiles, asksaveasfile, asksaveasfilename from tkinter.message...
#!/usr/bin/env python3 # The script outputs TPS stats in runtime # Run example: ./tx_stats.py -n node.hostname.com:8080 # Also possible to dump statistic into cvs files if you provide # path to the file # E.g. ./tx_stats.py -n node.hostname.com:8080 -o /path/to/stat.cvs import argparse import csv import requests impo...
# coding: utf-8 import json from django.db import IntegrityError from django.conf import settings from django.core.exceptions import ObjectDoesNotExist from django.contrib.auth import authenticate from django.contrib.sites.shortcuts import get_current_site from django.utils import timezone from django.utils.http impor...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Oct 4 09:24:24 2019 @author: danielogenrwot """ from __future__ import print_function import os import re import csv def read_original_data(basepath): files = [] for file in os.listdir(basepath): path = os.path.join(basepath, file)...
#!/usr/bin/env python3 # @brief: Pytorch Lightning module for KITTI Odometry # @author <NAME> [<EMAIL>] import os import yaml import torch import numpy as np from torch.utils.data import Dataset, DataLoader from pytorch_lightning import LightningDataModule from pcf.utils.projection import projection from pcf....
import csv import re from collections import defaultdict, OrderedDict from datetime import datetime import argparse import matplotlib.pyplot as plt from matplotlib.backends.backend_pdf import PdfPages from matplotlib.dates import date2num, HourLocator, DateFormatter MAX_TIME = 999999999999 SELECTIONS_COUNT_INDEX = 3...
def bb_abmag(diag=False, val=False, **kwargs): """ Take a blackbody with a certain temperature and convert to AB magnitudes in two bands. Scaled to u-band or Swift UVW2 magnitude. Inputs (defaults): umag = apparent u-band AB magnitude (22*ur.ABmag) swiftmag = apparent Swift UVW2 magnitude (22...
import sys import time import io import csv # Imports for inferencing import cv2 import onnxruntime as rt from inference import run_onnx import numpy as np # Imports for communication w/IOT Hub from azure.iot.device import IoTHubDeviceClient from azure.iot.device import Message from azure.core.exceptions import Resou...
import json import time import traceback from inspect import isclass, isfunction from typing import Callable, Union import pretty_errors from devtools import debug, pprint from sanic import Sanic # from sanic.websocket import WebSocketProtocol from pepperbot.action.chain import * from pepperbot.command.handle import h...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Sep 5 10:26:54 2020 @author: <NAME> """ import pandas as pd import numpy as np import matplotlib.pyplot as plt import sys import json import os # Choices: SU2, Pytornado # ssh cfs11 solver = 'SU2' dy = 0.0625*10 if solver == 'SU2': cwd1 = '../../...
# -*- coding: utf-8 -*- # Generated by Django 1.11.21 on 2019-07-02 16:30 from __future__ import unicode_literals import bitfield.models from django.db import migrations, models from django.utils.translation import gettext as _ from model_utils import Choices # Deprecating AGE_AT_BIRTH_CHOICES = Choices( ("na", _...
import random import pulp as pl import numpy as np from sklearn.base import BaseEstimator, ClassifierMixin import re import pandas as pd def atoi(text): """ Based on a stackoverflow post: https://stackoverflow.com/questions/5967500/how-to-correctly-sort-a-string-with-a-number-inside """ re...
# Solar v.1.01 NW 23/10/2020 # https://nsi.xyz/solar # par <NAME> et <NAME> from math import sqrt from random import randint from polysol import * screen_w, screen_h, font_h, set_pixel, fill_rect, draw_ellipse, fill_circle, draw_string, get_key = get_infos() def cercle(x0,y0,r,c,e): for i in range(2*e): ...
# Copyright 2020 trueto # 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 writi...
# Copyright (c) 2021 - present / Neuralmagic, Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
# Copyright 2012 IBM Corp. # # 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 agree...
# Copyright (c) 2015, The MITRE Corporation. All rights reserved. # See LICENSE.txt for complete terms. """ Entity field data descriptors (TypedFields) and associated classes. """ import functools import inspect from .datautils import is_sequence, resolve_class from .typedlist import TypedList from .dates import parse...
#!/usr/bin/env python3 import pytest import os from chomsky import to_weak_CNF from algebra import matrix_alg from algebra import solve_tensor_alg from algebra import solve_matrix_alg def test_matrix1(): prods = [("S", ["eps"]), ("S", ["a"])] graph = [(0, "b", 1), (1, "b", 0)] res = matrix_alg(to_weak_CN...
# @Author : FederalLab # @Date : 2021-09-25 16:51:58 # @Last Modified by : <NAME> # @Last Modified time: 2021-09-25 16:51:58 # Copyright (c) FederalLab. All rights reserved. from abc import abstractmethod from copy import deepcopy from typing import List import numpy as np import numpy.random ...
import gdown import re import cv2 import numpy as np import webcolors import matplotlib import matplotlib.pyplot as plt from modules.detection import draw_bbox def download_weights(id_or_url, cached=None, md5=None, quiet=False): if id_or_url.startswith('http'): url = id_or_url else: url = 'https...
import cv2 import glob import os import numpy as np import veloster_config as cnf from veloster_data_utils import get_filtered_lidar from veloster_bev_utils import makeBEVMap, makeBEVMap_binary prev_boundary = { "minX": 0., "maxX": 40., "minY": -20., "maxY": 20., "minZ": -0.50, "maxZ": 3.50 } ...
# author: <NAME>, <NAME>, and <NAME> # date: 2021-01-22 """ Generate crime statistics dashboard with 2 tabs Usage: python src/app.py Source for code to create tabs: https://dash.plotly.com/dash-core-components/tabs Source for choropleth map boundaries: https://exploratory.io/map Tutorial used for Leaflet: https://da...
# -*- coding: utf-8 -*- import datetime import json import time from django.conf import settings from django.contrib.auth.models import User from django.core.mail import send_mail from django.db import models from django.db.models import Sum from django.utils import timezone from subprocess import Popen, PIPE def ru...
# Copyright 2014 Knowledge Economy Developments Ltd # # <NAME> # <EMAIL> # # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright noti...
# from __future__ import division from lyse import * from numpy import * from scipy.optimize import leastsq import numexpr as ne def rebin(a, m=5): if m > 1: s = floor_divide(a.shape, m) sh = s[0], m, s[1], m return a[:s[0]*m,:s[1]*m].reshape(sh).mean(3).mean(1) else: return a ...
import pygame as pg import gui.constants as c from gui.colors import Color def get_color_by_code(code): return Color.colors.get(code, Color.WALL) def get_direction(initial_pos, new_pos): """ Get the predicted straight line direction (the most dominant direction of the x and y movement) :param rel_p...
import numpy as np import random import linecache from keras.utils import Sequence from keras.utils.np_utils import to_categorical import code class Vocab: def __init__(self, word2id, unk_token): self.word2id = dict(word2id) self.id2word = {v: k for k, v in self.word2id.items()} ...
import numpy as np from gym import utils from gym.envs.dart import dart_env from matplotlib import pyplot as plt class DartSnake7LinkEnv(dart_env.DartEnv, utils.EzPickle): def __init__(self,num_inds_to_add=0): self.control_bounds = np.array([[1.0, 1.0, 1.0, 1.0, 1.0, 1.0],[-1.0, -1.0, -1.0, -1.0, -1.0, -...
# -*- coding: utf-8 -*- """ Created on Wed Dec 4 15:51:58 2019 @author: Mijael """ import bs4 import re import json import os import sys from pathlib import Path from itertools import chain from collections import Counter from utils import utils from dataclasses import field, dataclass from typing import List class...
__all__ = ['Lexer', 'LexerStateChange'] import re import copy class LexError(Exception): def __init__(self, message, text, error_index): self.args = (message,) self.text = text self.error_index = error_index class PatternError(Exception): pass class LexerBuildError(Exception): pa...
import datetime import dash import dash_core_components as dcc import dash_html_components as html import pandas as pd import plotly.graph_objs as go from plotly.subplots import make_subplots import plotly.express as px from dash.dependencies import Output, Input, State from ta_scanner.data.data import aggregate_bars...
# -*- coding: utf-8 -*- """ Created on Tue Aug 18 06:39:59 2015 @author: piotr at nicecircuits.com """ from libraryManager.library import libraryClass from libraryManager.part import part from libraryManager.footprint import footprint from libraryManager.footprintPrimitive import * from libraryManager.defaults import...
import json import os import sys from enum import IntEnum as Enum import ZODB import ZODB.FileStorage import persistent import transaction import ArtsInfo from utils import decodeValue import Levenshtein bundle_dir = getattr(sys, '_MEIPASS', os.path.abspath(os.path.dirname(__file__))) class ArtifactType(Enum): ...
#Nasa-bot drive code written in pygame using UDP import time import socket import pygame """Packet Meanings: DR = Drive ST = Steer(Actuator) AU = Auger TI = Tilt(Actuators) SL = BallScrew Slide CO = Conveyor """ def stop(): pygame.joystick.quit() ...
# Copyright Least Authority Enterprises. # See LICENSE for details. """ View implementation. Theory of Operation =================== #. Combine a data source with a text-emitting renderer function and a text output-capable target (e.g. a file descriptor). """ from __future__ import unicode_literals, division fr...
""" Funspell is An automatic spell corrector using statistical n-gram models. This is a module which help us to build our custom n-gram model and make use of that language model to perform a context aware automatic spell correction. """ import pickle import os import re import string import collections import sys fr...
#coding=utf8 #!/usr/bin/env python # -*- coding: utf-8 -*- # -*- encoding: utf8 -*- # author: xiepengyue import sys import os import tensorflow as tf from encoder import BoxEncoder from inputs import dataset_generator #from sklearn.metrics import precision_score #from sklearn.metrics import recall_score, accuracy_scor...
#!/usr/bin/env python # -*- coding: utf-8 -*- import json import socket import argparse from websocket_server import WebsocketServer def get_args(): parser = argparse.ArgumentParser() parser.add_argument("--host", type=str, default=None) parser.add_argument("--port", type=int, default=8080) args = ...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-today OpenERP SA (<http://www.openerp.com>) # # This program is free software: you can redistribute it and/or modify # it under the terms o...
import logging import os import subprocess from typing import Dict, List, Tuple from flask import Flask, g, request, redirect, send_from_directory from flask import session as flask_session from flask_compress import Compress from flask_cors import CORS from flask_httpauth import HTTPBasicAuth from prometheus_client i...
# -*- coding: utf-8 -*- import json # 用于JsonWorker from src.tools.controler import Control from src.tools.db import DB from src.tools.debug import Debug from src.tools.http import Http from src.tools.match import Match from src.lib.jianshu_parser.jianshuparser import JianshuParser from src.lib.jianshu_parser.tools....
import numpy as np import scipy.signal import torch import torch.nn as nn import torch.nn.functional as F from torch.distributions.normal import Normal def tensor(x): return torch.as_tensor(x, dtype=torch.float32).cuda() def combined_shape(length, shape=None): if shape is None: return (length,) ...
import frappe from frappe.utils import get_datetime, add_to_date, cstr, flt from one_fm.api.doc_events import haversine from frappe import _ @frappe.whitelist() def scan_checkpoint(qr_code, latitude, longitude): """ Creates a Checkpoint Assignment Scan document provided the user email, a QR code and the locati...
# _____ _ _ ___ _ _ #/ ___| | | | | / _ \| | | #\ `--. _ _ __| | ___ | | ___ _/ /_\ \ | |_ _ # `--. \ | | |/ _` |/ _ \| |/ / | | | _ | | | | | | #/\__/ / |_| | (_| | (_) | <| |_| | | | | | | |_| | #\____/ \__,_|\__,_|\___/|_|\_\\__,_\_| |_/_|_|\__...
# coding=utf-8 """Site model definition. """ import logging import requests import json from django.core.exceptions import ValidationError from django.contrib.gis.db import models from django.dispatch import receiver from django.contrib.postgres.fields import JSONField from django.conf import settings from bims.mod...
import logging from typing import Callable, Union, Any from requests import Response from django_swagger_tester.case_checks import case_check from django_swagger_tester.configuration import load_settings from django_swagger_tester.dynamic.get_schema import fetch_generated_schema from django_swagger_tester.exceptions ...
from vergeml.views import ListView, IteratorView from vergeml.loader import LiveLoader from vergeml.io import SourcePlugin, source, Sample import random import itertools def test_listview_default(): loader = LiveLoader('.cache', SourceTest()) listview = ListView(loader, 'train') assert list(map(lambda tp: ...
''' File Converter ''' #<NAME> import csv #USING WorldCups.csv world_cups = {} world_cups_data_file = open('WorldCupsData.csv') world_cups_reader = csv.reader(world_cups_data_file) world_cups_file = open('worldcups.csv', 'w') world_cups_writer = csv.writer(world_cups_file) heading_row = next(world_cups_reader) ...
#! /usr/bin/env python # -*- coding: utf-8 -*- """Make target labels for the End-to-End model (Librispeech corpus).""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from os.path import join import re from tqdm import tqdm from utils.labels.character imp...
from glob import glob from PIL import Image import pickle as pkl import os import configargparse import configparser import torch import numpy as np import argparse import sys import matplotlib.pyplot as plt import yaml from munch import munchify import json import PIL from parse import parse import collections import ...
import os import mock import pytest from azure.storage.blob import Blob, BlobPrefix, BlobProperties, BlockBlobService from mlflow.store.artifact_repo import ArtifactRepository from mlflow.store.azure_blob_artifact_repo import AzureBlobArtifactRepository TEST_ROOT_PATH = "some/path" TEST_URI = "wasbs://container@acc...
from __future__ import print_function from gae.initializations import * from gae.raggedHelper import * import tensorflow.compat.v1 as tf tf.compat.v1.disable_eager_execution() #tf.disable_v2_behavior() flags = tf.app.flags FLAGS = flags.FLAGS # global unique layer ID dictionary for layer name assignment _LAYER_UIDS ...
""" Name: Aachen Impulse Response (AIR) Database Website: http://www.iks.rwth-aachen.de/de/forschung/tools-downloads/aachen-impulse-response-database/ License: ? Papers: <NAME>., <NAME>., <NAME>., <NAME>., <NAME>. und <NAME>.: Download der Veröffentlichung KurzfassungDo We Need Dereverberation for Hand-Held Telepho...
"""This module defines some handy :py:class:`Importable` elements. An ``Importable`` is usually composed of two different parts: * A *natural key* used to identify *the same* element across different systems. This is the only required component for an ``Importable``. * An optional set of properties that form *the ...
import os import json import random import torch import argparse import importlib from .utils import eval_distinct, calculate_ppl from .pycocoevalcap.bleu.bleu import Bleu from .fairness_test import bias_evaluate def score(refs, hypos): ''' :param refs: instance_num x refer_num x str :param hypos: instance...
from collections import OrderedDict from rest_framework.fields import SkipField """ 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 ...
# -*- coding: utf-8 -*- # Copyright (c) 2015-2020, Exa Analytics Development Team # Distributed under the terms of the Apache License 2.0 """ Geometry ====================== Functions for constructing molecular and solid state geometries with symmetry adapted or crystalline structures. """ import numpy as np import pan...
# -*- coding: utf-8 -*- from __future__ import absolute_import, division import logging import bkt.ui notify_property = bkt.ui.notify_property import bkt.library.powerpoint as pplib # ================= # = FUNCTIONALITY = # ================= class ScaleShapes(object): excluded_shapes = [ pplib.MsoSh...
from multiprocessing import Pool from struct import Struct import heapq from bisect import bisect_left import numpy as np import yaml, glob import argparse import random import os import time import sys import json import base64 import logging from tqdm import tqdm sys.path.append(os.path.join(os.path.dirname(__file__...
#!/usr/bin/env python import xlwings import os import re import logging from glob import glob from types import SimpleNamespace from prodctrlcore.io import HeaderParser ENG_DIR = r"\\hssieng\DATA\HS\JOBS" part_mark_pattern = re.compile(r'[a-zA-Z][0-9]+[a-zA-Z]+') skip = SimpleNamespace() skip.books = ['Products', ...
import os, yaml, copy from dsh import api, shell, node, evaluators, matchers from flange import cfg DSH_MARKER_ELEMENT = 'dsh' DSH_DEFAULT_ROOT = 'root' NS_SEPARATOR = cfg.DEFAULT_UNFLATTEN_SEPARATOR + 'contexts' + cfg.DEFAULT_UNFLATTEN_SEPARATOR def node_factory_context(data, name=None, ctx={}): if name: ...
import sys import os, fnmatch from adsputils import setup_logging, load_config, get_date from datetime import datetime, timedelta import argparse import threading from adsrefpipe import tasks from adsrefpipe.refparsers.handler import verify from adsrefpipe.utils import get_date_modified_struct_time, ReprocessQueryTy...
from typing import List import torch import random from torch.utils.data import Dataset from src.data.typed_table import TypedColumnSequenceDataset from src.geometry.skeleton import Skeleton class BaseBatchedSequenceDataset(Dataset): """ Base class for batched sequence data. Defines the interface the batched ...
from __future__ import division import numpy as np np.seterr(invalid='raise') import copy from scipy.special import digamma from HDP.basic.distributions import Multinomial from HDP.util.general import cumsum, rcumsum ################# HDP dishes matrix class _HDPMatrixBase(object): def __init__(self,num_state...
from app.models import Order, OrderInfo, Itinerary, User,\ Frag, db as alchemy, SupplierOrder, City, Country from app.base.func import listToCSV, update_db from flask import request, abort, session, Blueprint, Response from flask_cors import CORS from sqlalchemy import or_ import json import requests from config imp...
#!/usr/bin/env python3 import math import os import random import time import asynccp import board import microcontroller import pwmio import storage from analogio import AnalogIn from asynccp.time import Duration MAX_DUTY_CYCLE = 2 ** 16 - 1 pwm_freq = 500 state_file = "last_state.txt" STATE_UNKNOWN = "UNKNOWN" S...
from collections import deque # Solution def part1(data): board, goblins, elves = init_board(data) outcome = calculate_battle_outcome(data, board, goblins, elves) return outcome def part2(data): elf_damage = 3 while True: board, goblins, elves = init_board(data, elf_damage ...
#!/usr/bin/env python # encoding: utf-8 # Copyright (c) 2014-2015 pyReScene # # 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 t...
# modified from original source by <NAME> # source: https://github.com/leoxiaobin/deep-high-resolution-net.pytorch/blob/master/demo/inference.py from __future__ import absolute_import from __future__ import division from __future__ import print_function import argparse import csv import os import shutil import json ...
""" Python Character Mapping Codec generated from 'CP1253.TXT' with gencodec.py. Written by <NAME> (<EMAIL>). (c) Copyright CNRI, All Rights Reserved. NO WARRANTY. (c) Copyright 2000 <NAME>. """#" import codecs ### Codec APIs class Codec(codecs.Codec): def encode(self,input,errors='strict'): return ...
#!/usr/bin/env python # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # # Authors: # - <NAME>, <EMAIL>, 2017-2018 # - <NAME>, <EMAIL>, 2017-2021 # ...
""" validation module """ import csv import os from typing import Union from collections.abc import Generator from csv_file_validator import validation_functions as validation_funcs from csv_file_validator.exceptions import InvalidConfigException, \ InvalidLineColumnCountException def get_validation_function(attr...
import torch import torch.nn as nn import torch.nn.functional as F from torch.distributions.categorical import Categorical import torch_ac ### Add block model components from attention_model import BaseModel # Function from https://github.com/ikostrikov/pytorch-a2c-ppo-acktr/blob/master/model.py def init_params(m): ...
# Calculates MAX and MIN insertion loss DATA at both wavelengths 1310nm and 1550nm # makes chart output with series IL@1310nm and IL@1550nm # across temperature changing # import os from graphics import * import tkinter as Tk def select_file(window_message: str): # taking current directory todo use tkinter for...
import argparse import docker import io import os import random import requests.exceptions import sys import tempfile import threading try: from retro import data_path except ImportError: def data_path(): raise RuntimeError('Could not find Gym Retro data directory') class LogThread: def __init__(s...
from rest_framework import serializers from rest_framework.reverse import reverse from wxapp.models import WxUser, WxSession from wxapp.https import wx_config from wxapp.WXBizDataCrypt import WXBizDataCrypt from apps.config.models import RechargeType from qapi.utils import generate_full_uri, secret_string from apps.qfi...
import os import json import hashlib from flask import Flask, render_template, session, redirect, url_for,request from flask_bootstrap import Bootstrap from flask_moment import Moment from flask_wtf import FlaskForm from wtforms import StringField, SubmitField from wtforms.validators import DataRequired from flask_sqla...
# Turta IoT HAT Helper for Raspbian # Distributed under the terms of the MIT license. # Python Driver for Vishay VEML6075 UV Light Sensor # Version 1.01 # Updated: July 14th, 2018 # Visit https://docs.turta.io for documentation. import time from enum import IntEnum from smbus import SMBus #Enumerations class Integ...
import struct import numpy as np import json class BatchTable(object): def __init__(self): self.header = BatchTableHeader() self.body = BatchTableBody() def add_property(self, property_name, array): """ Parameters ---------- property_name : 'str' na...
import bpy import bmesh from mathutils import Vector import numpy as np # Blender import system clutter import sys from pathlib import Path SRC_PATH = Path.home() / "Documents/python_workspace/data-science-learning/graphics/agents" UTILS_PATH = Path.home() / "Documents/python_workspace/data-science-learning" sys.path...
import sys import cv2 import numpy as np """ The rest of this file defines some GUI plotting functionality. There are plenty of other ways to do simple x-y data plots in python, but this application uses cv2.imshow to do real-time data plotting and handle user interaction. This is entirely independent o...
#!/usr/bin/python3 import argparse import csv import json import os import random # package local imports import sys import uuid import boto3 from tqdm import tqdm sys.path.append(os.getcwd() + "/..") from common_datagen import ( download_url, generate_setup_json, compress_files, generate_inputs_di...
#!/usr/bin/env python # coding=utf-8 """ Split a Wiktionary dump file. It can output to files on disk or return an iterator over chunks in memory. Each file or chunk can contain one or more MediaWiki pages. """ from __future__ import absolute_import from __future__ import print_function from collections import name...