text stringlengths 6.04k 39.5k |
|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import torch
import torch.nn as nn
import math
import torchvision.transforms as transforms
import torchvision as tv
import torchvision.models as models
from torch.utils.data import DataLoader
from load_utils import load_state_dict_from_url
from cub_voc import CUB_VOC
import... |
#!/usr/bin/env python
# coding: utf-8
# # Machine Learning using Regularized Logistic Regression
#
# Classifier model that predict whether microchips from a fabrication plant passes quality assurance (QA).
# In[1]:
import pandas as pd
import numpy as np
# import pandas_profiling
import seaborn as sns
import matplo... |
#!/usr/bin/env python
#************************************************************************
#
# Plot figures and output numbers for Terrestrial Water Storage (TWS) section.
# For BAMS SotC 2016
#
#************************************************************************
# SVN Info
# $Rev:: ... |
"""
Frame encoders and decoders for each frame type. Note that we have encoders
for frames that the server does not use; it's for testing, and in case someone
wants to write a Python Minerva client.
"""
import re
import sys
import operator
from simplejson import dumps
from simplejson.decoder import JSONDecodeError
f... |
import cv2
import torch
import tqdm
import os
import numpy as np
import h5py
import copy
from imageio import imread
import sys
from OurNet import HeatNet1
from OurNet import HeatNet2
from OurNet import ImNet1
from OurNet import ImNet2
from OurNet import BothNet1
from OurNet import BothNet2
from Trainer import Trainer... |
#!/usr/bin/env python3
'''
###############################################################################
###############################################################################
## ##
## _ ___ ___ ___ ___ ___ ... |
#===============================================================================
# Copyright 2007 <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/... |
import json
import csv
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
from calibration import *
import pandas as pd
from tqdm import tqdm
from scipy.stats import norm
from scipy.stats import pearsonr
import argparse
import itertools
from os import listdir
from os.path import isfile, join
fro... |
# Code adapted from https://github.com/koren-v/Interpret
import torch
from torch.nn.functional import softmax
import numpy as np
from tqdm import tqdm
import matplotlib
from torch import nn
from utils.bert_utils import get_entity_pair_attr_idxs, get_sent_pair_word_idxs
from utils.result_collector import BinaryClassifi... |
import os
from helper_evaluate import compute_accuracy, compute_mae_and_mse
from helper_losses import niu_loss, coral_loss, conditional_loss, conditional_loss_ablation
from helper_data import levels_from_labelbatch
import time
import torch
import torch.nn.functional as F
from collections import OrderedDict
import jso... |
import torch
from torch import nn
from torch.autograd import Variable
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
from transformers import BertModel, BertPreTrainedModel
import torch.nn.functional as F
PAD_INDEX = nn.CrossEntropyLoss().ignore_index
class MLP(nn.Module):
""... |
"""
Classic cart-pole system implemented by <NAME> et al.
Copied from http://incompleteideas.net/sutton/book/code/pole.c
permalink: https://perma.cc/C9ZM-652R
"""
import logging
import math
import gym
from gym import spaces
from gym.utils import seeding
import numpy as np
from keras.models import load_model
import job... |
#!/usr/bin/env python3
import argparse
import json
from pathlib import Path
import sys
import subprocess
import os
import re
from functools import reduce
def bold(msg):
return '\033[1m' + msg + '\033[0m'
def yellow(msg):
return '\033[94m' + msg + '\033[0m'
def red(msg):
return '\033[91m' + msg + '\033[0m... |
#################################################################
# STYLING OF THE GUI AND WIDGETS
#################################################################
'''
Non-active background: #33393b
Active background: #474d4e
'''
# Load modules
import os
import tkinter as tk
from tkinter import ttk
fro... |
# Basic libs
import os, time, glob, random, pickle, copy, torch
import open3d as o3d
import numpy as np
import open3d
from scipy.spatial.transform import Rotation
from torchvision.transforms import transforms
# Dataset parent class
from torch.utils.data import Dataset
from collections import namedtuple
from common.cam... |
from collections.abc import Iterable
from typing import List, Dict, Any, Optional, Set, Union, Optional
from docassemble.base.util import (
DAFile,
DAFileCollection,
DAFileList,
get_session_variables,
set_session_variables,
set_variables,
all_variables,
user_info,
variables_snapshot_... |
"""Create models of assertions accepted as factual by courts."""
from __future__ import annotations
from copy import deepcopy
import operator
from typing import Any, ClassVar, Dict, Iterator, List
from typing import Mapping, Optional, Sequence, Tuple, Union
from pydantic import BaseModel, Extra, ValidationError, valid... |
# -*- encoding: utf-8 -*-
"""Tools for performing validations based on json schemas"""
import os
import copy
import functools
import json
import collections.abc
from contextlib import contextmanager
from typing import Optional, Callable, Union
import dateparser
from deepdiff import DeepSearch
import jsonschema
from ... |
__copyright__ = "Copyright (C) 2019 <NAME>"
__license__ = """
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, modif... |
#TODO: maybe move the functions from calculate_PSNR_SSIM.py here
#TODO: add the Tensor versions of the losses, check that they are equivalent to the np ones
import numpy as np
import torch
import cv2
import math
from dataops.common import np2tensor, tensor2np, read_img, bgra2rgb, bgr2ycbcr
from models.modules.LPIPS i... |
import json
from datetime import datetime
import base64
import boto3
from random import randint
import sys
sys.path.insert(1, '/opt')
import cv2
import time
from random import randint
TABLE_DB1_NAME = 'DB1'
TABLE_DB2_NAME = 'DB2'
TABLE_DUP_CHECK = 'hw2-LF1-check-duplicate'
S3_BUCKET_NAME = 'assignment2-fall2020-faces... |
import math
import re
from datetime import datetime, timedelta
from unittest import mock
import numpy
import pandas
import pytest
from cognite.client import CogniteClient, utils
from cognite.client.data_classes import DatapointsList, DatapointsQuery, TimeSeries
from cognite.client.exceptions import CogniteAPIError
fr... |
##################################################
# All functions related to training a deep learning architecture using sensor-based activity data.
##################################################
# Author: <NAME>
# Email: <EMAIL>
# Author: <NAME>
# Email: <EMAIL>
##################################################
... |
import click
from distutils.version import StrictVersion
import emoji
import hashlib
import logging
import os
import platform
import re
import requests
import shutil
import stat
import subprocess
import sys
import urllib
from honeytail_version import (HONEYTAIL_VERSION, HONEYTAIL_CHECKSUM)
def get_version():
try:... |
import BAC0
import paho.mqtt.client as mqtt
from random import randrange
import time
import configparser
config = configparser.ConfigParser()
config.read('command.ini')
# inisialisasi variabel
device0 = 0
device0address = 0
device1 = 0
device2 = 0
device3 = 0
device4 = 0
device5 = 0
state = 2
def connect_get_points... |
import datetime
import fnmatch
import os
import tempfile
import time
from baricadr.db_models import BaricadrTask
from baricadr.utils import get_celery_tasks
import dateutil.parser
from flask import current_app
from tzlocal import get_localzone
import yaml
class Repo():
def __init__(self, local_path, conf):
... |
#!/usr/bin/env python
"""
# MIT License
Copyright (c) 2018 <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, modi... |
import numpy
# from . import txyz # read_body and write_body live now here in mfpx.py
import logging
from molsys.util.misc import argsorted
import molsys.util.images as images
"""
These functions implement the reading and writing of mfpx files
for the handling of metadata of topologies/embedding the system of keywor... |
import datetime
import pathlib
from math import sqrt
import matplotlib.dates as mdates
import numpy as np
import steampi.json_utils
# Reference: https://stackoverflow.com/a/3054314
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
from aggregate_steam_spy... |
import json
from datetime import datetime
import os
from werkzeug.contrib.cache import SimpleCache
from openpyxl import load_workbook
from openpyxl.styles import Border, Font, Side
cache = SimpleCache()
"""
RESTful Endpoints
"""
class RafService:
@staticmethod
def calculate(beneficiary_in) -> object:
... |
#!/usr/bin/env python3
# Copyright 2020-2022, Collabora, Ltd.
# SPDX-License-Identifier: BSL-1.0
"""Generate code from a JSON file describing interaction profiles and
bindings."""
import argparse
import json
class PathsByLengthCollector:
"""Helper class to sort paths by length, useful for creating fast path
... |
# Generates C++ include files for the SPIR-V instructions.
import sys
import json
import re
HEADER = "#ifndef %s\n#define %s\n\n// Automatically generated by generate_ops.py. DO NOT EDIT.\n\n"
FOOTER = "\n#endif // %s\n"
IMPL_RE = re.compile(r"void Interpreter::step(.*)\(const Insn(.*)& insn\)")
EMIT_RE = re.compile... |
import pygame
import os
import sys
from pygame.locals import *
import characters
import constants as const
import random
from pathlib import Path
vec = pygame.math.Vector2
pygame.init()
class Game_State:
"""
The state of the game. Contains all of the sprites and interactable objects
Attributes:
v... |
import glob
import logging
import nose
import os.path
import pkg_resources
import shutil
import socket
import sys
import unittest
from numpy.testing import assert_array_equal
from openmdao.main.api import Assembly, Component, FileRef, set_as_top
from openmdao.lib.datatypes.api import File, Float, Str
from openmdao.ut... |
import time
import numba
import numpy as np
import math
@numba.jit(nopython=True)
def _spherical_points_to_voxel_reverse_kernel(spherical_points,
points,
grid_size,
coors_range,
... |
# -*- coding: utf-8 -*-
import os
import re
from opensextant.Extraction import TextMatch, Extractor
"""
FlexPat: regular-expression assistant.
Create a pattern library that is easy to read, adapt, test and share.... let alone execute and diagnose.
FlexPat is a configuration-based approach to employing regular expres... |
# Copyright 2021 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
from __future__ import print_function, division
import numpy as np
import torch
import torch.nn as nn
from torch.utils.data import Dataset, DataLoader
import pytorch_lightning as pl
from torchdiffeq import odeint_adjoint as odeint
import matplotlib.pyplot as plt
import json
class GeneralModeDataset(Dataset):
"""
... |
import numpy as np
from descartes import PolygonPatch
import alphashape
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import os, logging, h5py, pickle, cv2
from PIL import Image, ImageDraw
from tqdm import tqdm
from collections import defaultdict
from scipy import spatial
import pycolmap
import t... |
#!/usr/bin/env python
# work with MPU6050_kalman.ino
from PyQt5 import QtCore, QtWidgets, uic, QtGui
from pyqtgraph import PlotWidget
from PyQt5.QtWidgets import QApplication, QVBoxLayout
import pyqtgraph as pg
import numpy as np
import datetime
import serial
import sys
import os
import time
from time import sleep
fro... |
#!/usr/bin/env python3
#
# Author: <NAME> (<EMAIL>)
# Date: Sept 16, 2017
# Upwork Contract: https://www.upwork.com/d/contracts/18729685
#
# Code Tested with Python 3.5.3
#
import csv
import logging
import logging.config
import os
import platform
import re
import subprocess
import sys
import shutil
import zipfile
from ... |
import glob
import json
import logging
import os
import re
import shutil
import sqlite3
import subprocess
import sys
from collections import defaultdict
from datetime import datetime
import yaml
from jinja2 import Template
from dao import Dao
sys.path.append(os.path.abspath(os.path.dirname(__file__)))
from leetcode ... |
import os
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import torch
from torch.utils.data import DataLoader
from locs.utils.flags import build_flags
import locs.models.model_builder as model_builder
from locs.datasets.small_synth_d... |
import argparse
import os
import random
from tensorboardX import SummaryWriter
import torch
from config import TrainConfig as C
from dataset.MSVD import MSVD
from eval import evaluate
from models.decoder import Decoder
from models.local_reconstructor import LocalReconstructor
from models.global_reconstructor import G... |
"""dspritesb.py
Stuff to know:
- a basic class to load the dSprites and paint a randomly centered 2D gaussian blob behind each sprite.
- uses pytorch DataLoader.
- dspritesb.demo() runs basic unit tests
"""
from torch.utils.data import Dataset, DataLoader
import torch
import os
import numpy as np
from matplotlib imp... |
import os
import uuid
from decouple import config
# Django
from django.conf import settings
from django.contrib import messages
from django.http import HttpResponseRedirect, HttpResponse
from django.shortcuts import render, redirect
from django.template import Context
from django.template.loader import render_to_stri... |
from datetime import datetime
from flask import Flask, render_template, request, session
from flask_session import Session
from riotwatcher import LolWatcher, ApiError
from unicodedata import normalize
import flask_app
import json
import pandas as pd
def add_mastery_chest(champion_mastery_list, champion_mastery):
... |
###############################################################################
#
# Package: RoadNarrows Robotics Laelaps Robotic Mobile Platform ROS Package
#
# Link: https://github.com/roadnarrows-robotics/laelaps
#
# ROS Node: laelaps_panel, laelaps_range
#
# File: RangeSensorWin.py
#
## \file
##
## \brief ... |
from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
#from builtins import str
from builtins import range
from quantities.quantity import Quantity
import sciunit
from sciunit import Test,Score
try:
from sciunit import ObservationError
except:
from sciunit.... |
"""
The Cobweb3 module contains the :class:`Cobweb3Tree` and :class:`Cobweb3Node`
classes, which extend the traditional Cobweb capabilities to support numeric
values on attributes.
"""
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
from __future__ i... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Created by <NAME>
from typing import List, Optional
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
import numpy as np
import plotly.graph_objects as go
from mitoviz.constants import COLORS, LABELS, NAMES
from mitoviz.locus import _LinearLocus, _Po... |
"""Builds the ring network.
Summary of available functions:
# Compute pics of the simulation runnig.
# Create a graph to train on.
"""
import tensorflow as tf
import numpy as np
from nn import *
import input.lat_inputs as lat_inputs
import systems.fluid_createTFRecords as fluid
import systems.em_createTFRec... |
import numpy as np
import pandas as pd
import torch
class SessionDataset:
def __init__(self, sep='\t', session_key='SessionId', item_key='ItemId', time_key='TimeStamp', user_key='UserId',
mode='train', train_data=None, test_data=None, n_samples=-1, itemmap=None, time_sort=False, print_info=True):... |
import argparse
import copy
import datetime
import os
import os.path
import random
import time
from os.path import join as pjn
import numpy as np
import torch
from torch.cuda.amp import autocast
from tqdm import tqdm
import wandb
from dataset.common import ConfusionMatrix
from modeling.ELN import ELNetwork
from model... |
# -*- coding: utf-8 -*-
import configparser
import logging
import os
import re
import shutil
import sys
import textwrap
import webbrowser
from collections import namedtuple
from itertools import zip_longest
from pathlib import Path
import requests
from bs4 import BeautifulSoup
from .templates import CONFIG_TEMPLATE
... |
import contextlib
import json
from collections import defaultdict
from itertools import product
from operator import attrgetter, itemgetter
from typing import Mapping
from .exception import MachineError, TransitionError
from .callbacks import Callbacks
from .transitions import Transition
from .normalize import normali... |
"""Module for univariate densities (see also :mod:`ddl.independent`)."""
from __future__ import division, print_function
import logging
import warnings
import numpy as np
import scipy.stats
from sklearn.base import BaseEstimator
from sklearn.exceptions import DataConversionWarning, NotFittedError
from sklearn.utils.v... |
"""Tests for building"""
# Get methods references before compilertools.build
from distutils.command.build_ext import build_ext
BUILD_EXTENSION = build_ext.build_extension
GET_EXT_FILENAME = build_ext.get_ext_filename
GET_EXT_FULLNAME = build_ext.get_ext_fullname
GET_OUTPUTS = build_ext.get_outputs
BUILD_EXT_NEW = bui... |
__author__ = ("<NAME> <mrost AT inet.tu-berlin.de>, "
"<NAME> <aelvers AT inet.tu-berlin.de>")
__all__ = [
"from_personal_room_plan_to_plan",
"from_personal_room_plan_to_personal_plan",
"from_joint_plan_to_list",
"evaluate_plan",
"get_plan",
"pickle_it",
"search_room",
"se... |
import pyttsx3 # pip install pyttsx3
import datetime
import speech_recognition as sr # pip install SpeechRecognition
import wikipedia # pip install wikipedia
from googlesearch import search # pip install google
import webbrowser
import os
import ctypes
import random
from bs4 import BeautifulSoup as soup
from urllib... |
##
# Copyright (c) 2008-2012 Sprymix Inc.
# All rights reserved.
#
# See LICENSE for details.
##
import collections
import errno
import imp
import os
import pickle
import struct
import sys
from importkit.utils.debug import debug
from . import cache as caches
from . import module as module_types
from . import utils ... |
import transforms as T
from pycocotools.coco import COCO
import torchvision
import torch
import os
import numpy as np
import cv2
import matplotlib.pyplot as plt
from torchvision import datasets, transforms
from PIL import Image
from glob import glob
import math
import itertools
import torch
import torch.utils.data as... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 2 11:47:44 2019
@author: Aayush
This file contains the dataloader and the augmentations and preprocessing done
Required Preprocessing for all images (test, train and validation set):
1) Gamma correction by a factor of 0.8
2) local Contrast limite... |
class P:
DEDUCED = 'deduced'
AID = '_aid'
USER_ID = 'user_id'
MATCH_SCORE = 'match_score'
ATTRIBUTION_ID = "attribution_id"
ATTRIBUTION_NAME = "attribution_name"
# Administrative information
FIRST_NAME = 'first_name'
MIDDLE_NAME = 'middle_name'
LAST_NAME = 'last_name'
FU... |
# Copyright 2015 Cisco Systems, 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... |
from __future__ import division, print_function
import numpy as np
from scipy.signal import flattop
from scipy.optimize import curve_fit
import matplotlib.pyplot as plt
import scipy.linalg
import scipy.ndimage as ndi
"""
This is for operations on arrays, which will be extended to a class of image data.
"""
#Functio... |
# coding:utf-8
import re
import torch
import torch.nn as nn
from torch import optim
from torch.nn import functional as F
import random
import codecs
import pathlib
import numpy as np
from tqdm import tqdm
import matplotlib.pyplot as plt
from pathlib import Path
from functools import partial
SOS = '<sos>'
EOS = '<eos>... |
# -*- coding: utf-8 -*-
"""
htmlgen.py
Generates HTML pages for result display.
:copyright: (c) 2016 by <NAME>.
:license: BSD, see LICENSE for more details.
"""
import os
import time
import lmcore
TAIL_SIZE = 20
def time_to_string(t):
return time.strftime("%H:%M:%S", t)
def laptime_to_string(t... |
from math import pi, sqrt
from cmath import phase
from wilson import Wilson
import flavio
import flavio.statistics.fits
from flavio.physics.running.running import get_alpha
from flavio.physics import ckm
from flavio.classes import Observable, Prediction, Measurement, Parameter
from flavio.statistics.probability import ... |
"""
Results summary in LaTeX format
Called from routines.report_results.py
"""
import os
import xlwt
from tabulate import tabulate
from msl.io import read
from ..constants import IN_DEGREES_C, MU_STR
from ..log import log
def greg_format(number):
try:
before, after = '{:.9f}'.format(number).split('.')
... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... |
"""Base bolt classes."""
from __future__ import absolute_import, print_function, unicode_literals
import logging
import os
import re
import signal
import sys
import threading
import time
from collections import defaultdict, namedtuple
from six import iteritems, itervalues, reraise
from .component import Component, T... |
# Copyright 2017 data.world, 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 writin... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import math
from lib.models.vision.resnet import Bottleneck, conv1x1
model_urls = {
"resnet18": "https://s3.amazonaws.com/pytorch/models/resnet18-5c106cde.pth",
"resnet34": "https://s3.amazonaws.com/pytorch/models/resnet34-333f7ec4.pth",
"... |
#!/usr/bin/env python3
# Copyright (c) 2015
#
# All rights reserved.
#
# This file is distributed under the Clear BSD license.
# The full text can be found in LICENSE in the root directory.
"""Configuration of dut, database, files and connect the devise to run."""
import atexit
import inspect
import json
# Setup loggi... |
"""
This module provides the fundamental Spheral Geometry types (Vector, Tensor,
etc.) and associated methods such as products and eigenvalues.
"""
from PYB11Generator import *
import types
# Forcibly override the common preamble
PYB11preamble = ""
# Define some useful type collections we're going to be wrapping in... |
import datetime
import os
import tempfile
from nose.tools import (
assert_raises,
eq_,
set_trace,
)
from . import (
DatabaseTest,
)
from model import (
get_one,
CustomList,
DataSource,
Identifier,
Timestamp
)
from scripts import (
Script,
CustomListManagementScript,
Dat... |
import numpy
from .parameters import *
from .spatialHashTable import SpatialHashTable
def isCellData(cell):
return [cell.getX(), cell.getY(), cell.getRadius()]
def checkNan(value):
if math.isnan(value):
print("ERROR: predicted reward is nan")
quit()
def getRelativeCellPos(cell, left, top,... |
#!/bin/python3
import os
import subprocess
import types
import copy
import re
import json
import datetime
import asyncio
import discord
def findmatchlist(pattern, string):
matches = []
results = re.finditer(pattern, string)
for result in results:
matches.append(result)
return matches
def deleteallmatches(patt... |
from discord.ext import commands, tasks
from discord import Embed
import discord
import discord as d
from discord import channel
from discord import guild
from database_func import database_func
from datetime import datetime
import asyncio
class basic(commands.Cog):
# this file store basic commands
def __init... |
# The MIT License
#
# Copyright 2019 <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, merge, publ... |
"""
S3M Postprocessing tools - Mosaic outputs
__date__ = '20211029'
__version__ = '1.0.0'
__author__ =
'<NAME> (<EMAIL>'
'<NAME> (<EMAIL>',
<NAME> (<EMAIL>)
__library__ = 's3m'
General command line:
### python s3m_postprocessing_merger.py -settings_file s3m_postprocessing_merger.json -time "YYYY... |
"""
Simple flask thing
"""
import requests
from subprocess import call
from datetime import datetime, timedelta
from flask import render_template, jsonify, request, redirect, url_for, flash
from flask_breadcrumbs import register_breadcrumb
from flask_menu import register_menu
from flask_login import login_required, l... |
from __future__ import division
import os
import time
import math
from glob import glob
import tensorflow as tf
import numpy as np
from six.moves import xrange
from ops import *
from utils import *
from pre_process import *
def conv_out_size_same(size, stride):
return int(math.ceil(float(size) / float(stride)))
... |
"""Keil2Makefile
file: Keil2Makefile.py
author: qrpucp (<EMAIL>)
brief: a automatic script to change a Keil project to makefile project
date: 2021-12-31
usage: move Keil2Makefile-master to root directory of Keil project,
then enter Keil2Makefile-master and run Keil2Makefile.py.
read ... |
from __future__ import print_function
import chainer
import chainer.functions as F
import chainer.links as L
import numpy as np
from common.utils import backward_var_iter_nodup
def named(code, var, prefix=None, **kwargs):
if prefix:
var.name = prefix + code
else:
var.name = code
return ... |
from pyb import UART
from pyb import delay
from pyb import micros, elapsed_micros
# This hashmap collects all generic AT commands
CMDS_GENERIC = {
'TEST_AT': b'AT',
'RESET': b'AT+RST',
'VERSION_INFO': b'AT+GMR',
'DEEP_SLEEP': b'AT+GSLP',
'ECHO': b'ATE',
'FACTORY_RESET': b'AT+RESTORE'... |
"""The main pixel art window, containing the DrawControl and MainWindow classes"""
from array import array
import os
import wx
import png
import tool
import color as clr
import command
class DrawControl(wx.Control):
""" The DrawControl class contains the image which we are maniplulating """
#pylint: disable... |
from typing import Union
from contextlib import contextmanager
import warnings
import torch
import torch.nn as nn
from ctt.models import modules as mods, attn
# Legend
# B: batch (i.e. humans)
# T: index of the day
# M: message/encounter index
# C: channel
class _ContactTracingTransformer(nn.Module):
... |
# -*- coding: utf-8 -*-
import sys
try:
import cPickle as pickle
except ImportError:
import pickle
from functools import wraps
from cacheops import cross
from cacheops.cross import json
import django
from django.core.exceptions import ImproperlyConfigured
from django.contrib.contenttypes.generic import Generi... |
import os
import pymel.core as pm
import lct.src.core.lcColor as lcColor
import lct.src.core.lcConfiguration as lcConfiguration
import lct.src.core.lcGeometry as lcGeometry
import lct.src.core.lcPath as lcPath
import lct.src.core.lcPlugin as lcPlugin
import lct.src.core.lcRender as lcRender
import lct.src.core.lcShad... |
import ast
import io
import tokenize
from abc import ABC, abstractmethod
from typing import Any, Callable, Iterable, List, Optional, Tuple
__all__ = [
'classes_to_string', 'string_to_classes',
'classes_to_tuples', 'tuples_to_classes', 'update_classes',
'Class', 'Field', 'Comment',
'AbstractSourceGenera... |
import os
# from mpi4py import MPI
import pandas as pd
import re
from copy import deepcopy
# TODO : Add proper docstrings
class Codeml(object):
"""
Codeml object to generate control file and run the program
"""
CODEML_CMD = 'codeml'
def __init__(self, control_filename='codeml.ctl'):
"""
... |
from typing import Optional, Sequence
import time
import shlex
from timeit import default_timer as timer
import os
import sys
import threading
import logging
import docker
import dronekit
from bugzoo.client import Client as BugZooClient
from pymavlink import mavutil
from .home import HomeLocation
from .connection imp... |
# -*- coding: utf-8 -*-
# Copyright 2018 Resonai Ltd. 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 sys
from pathlib import Path, PurePosixPath
from mimetypes import guess_type
import io
import itertools
import functools
import base64
import dataclasses
from typing import Optional, Mapping
import enum
from urllib.parse import urljoin
from werkzeug.datastructures import Headers
from werkzeug.http import parse_... |
#! /usr/bin/python3
# ------------------------------------------------------------------
#
# Copyright (C) 2015 <NAME> <<EMAIL>>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
# License published by the Free Software Found... |
"""
Goes through a dataset and add dataset to audio tracks with Voice Activity Detection data.
"""
import multiprocessing.dummy as multiprocessing
#import multiprocessing
import collections
import time
import os.path
import argparse
import numpy as np
import scipy.io.wavfile as wavefile
from google.cloud import speech
... |
import json
import os
import random
from collections import defaultdict
from os import listdir, mkdir, makedirs
from os.path import abspath, basename, dirname, exists, isfile, join
from re import search, sub
from datetime import datetime
import click
import pandas as pd
from roboai_cli.util.cli import print_error, pr... |
import numpy as np
from src_py.utils import get_direction_offset, read_tile
from src_py.types import *
def evaluate(x, y, world):
evaluate_functions = {
0: read_arrow,
1: addition,
2: subtraction,
3: multiplication,
4: division,
5: floor_division,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.