text stringlengths 3.07k 22.1k |
|---|
from enum import IntEnum
from typing import Optional, Union, Iterable, List, Set, Any
from dataclasses import dataclass, field
from wewcompiler.objects.variable import Variable, DataReference
from wewcompiler.objects.astnode import BaseObject
class CompType(IntEnum):
(uncond, # unconditional (set to 1)
lt, ... |
# main imports
import numpy as np
import pandas as pd
import sys, os, argparse
# image processing
from PIL import Image
from ipfml import utils
from ipfml.processing import transform, segmentation
import matplotlib.pyplot as plt
# model imports
import joblib
# modules and config imports
sys.path.insert(0, '') # tri... |
# FlowUI table widget
#
# Copyright (c) 2012-2013, <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
# n... |
"""
MLIR compiler plugin:
"""
from metagraph_numba.compiler import SymbolTable
from metagraph.core.plugin import Compiler, CompileError
from typing import Dict, List, Tuple, Callable, Hashable, Any
from dask.core import toposort, ishashable
from dataclasses import dataclass, field
import inspect
@dataclass
class MLI... |
import re
import copy
import json
import logging
import itertools
from typing import Any, Dict, Iterator, Optional
from collections import defaultdict
from collections.abc import MutableMapping
from . import exceptions
LOG = logging.getLogger(__name__)
class Event(MutableMapping):
"""
MutableMapping represe... |
# ----------------------------------------------------------------------------
# Copyright 2016 Nervana Systems Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.o... |
# -*- coding: utf-8 -*-
# KALMAN FILTER FUNCTION
# Python version 2.7
# <EMAIL> 2017nov22 my first attempt at integrating this code into DSAS
# <EMAIL> 2018may21 minor changes to allow time step to be 0.1 of a year
# <EMAIL> 2018jun01 made some changes suggested by code review
# <EMAIL> 2018Aug07 fixed minor d... |
"""
THis defines a jupydoc helper which manages creation of HTML for objects of selected classes
For such classes, replace the object in the variable dictionary with a new one that implements a __str__ function, which returns
markdown, usually HTML.
Implemented here: dict, wrappers for plt.Figure, pd.Dataframe
"""
i... |
#!/usr/bin/env python
# extract data by tag ID from formatted db by my_formatdb.py
import os
import sys
import myfunc
from array import array
from .mydb_common import *
#import numpy as np
#import cProfile
# ChangeLog 2011-11-15 #{{{
# added the following options
# -sn
# -splitall
# removed the global de... |
import json
import time
from oic.oauth2 import Message
__author__ = 'roland'
# Message direction
INCOMING = 1
OUTGOING = 2
# standard event labels
EV_ASSERTION = 'assertion'
EV_CONDITION = 'condition'
EV_EXCEPTION = 'exception'
EV_END = 'end'
EV_EVENT = 'event'
EV_FAULT = 'fault'
EV_FUNCTION = 'function'
EV_HANDLER... |
import os
import pickle
import igl
import scipy.sparse as sparse
from .mesh_utils import *
def export_spheres(int_list, dest_folder):
if not os.path.isdir(dest_folder):
os.makedirs(dest_folder)
fname = os.path.join(dest_folder, "icosphere_{}.pkl")
for i in int_list:
s = icosphere(i)
... |
#!/bin/python
import os
import sys
import pwd
import re
import logging
import logging.handlers
import stopit
import kombu
import time
from flask import Flask
from kombu.common import maybe_declare
from amqp import AccessRefused
from python_logging.setup_logging import setup_logging
"""
Register-Publisher: forwards me... |
# Copyright (c) 2017, <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the... |
from typing import Tuple
import numpy as np
NUM_PARAMS = 31
NUM_PARAMS_LITE = 7
NUM_PARAMS_CORNERS = 3
def map_to_range(x, target_range, source_range=(-1, 1)):
""" maps x from [-1, 1] to [a, b]"""
src_min, src_max = source_range
tgt_min, tgt_max = target_range
p = (x - src_min) / (src_max - src_min)... |
"""
**************************
The :code:`rivulet` client
**************************
"""
import enum
import json
import time
import uuid
from typing import List, Dict, Union
import redis
import redis.exceptions
# pylint: disable=unused-import
from redis.client import Pipeline
# pylint: disable=redefined-builtin
fro... |
from first_CS import first_CS
from base_parameters import RMSD
from score import score_population
from score import change_Ligand
from score import CheckDirection
import numpy as np
import copy
def select_bests(OF,nog):
bests=np.zeros([nog,2])
do=np.zeros([len(OF),1])
for i in range(0,len(OF))... |
import numpy as np
import torch
from ...ops.iou3d_nms import iou3d_nms_utils
from ...config import cfg
def proposal_target_layer(input_dict, roi_sampler_cfg):
rois = input_dict['rois']
roi_raw_scores = input_dict['roi_raw_scores']
roi_labels = input_dict['roi_labels']
gt_boxes = input_dict['gt_boxes']... |
import asyncio
import os
import random
import re
from collections import defaultdict
from functools import wraps
import nonebot
import pytz
from nonebot.command import SwitchException, _FinishException, _PauseException
import rin
from rin import log, priv, trigger
from rin.typing import *
try:
import ujson as js... |
import base64, discord, random, requests
from utils.datautils import config, data, default, save_data, set_client
from utils.discordbot import BotClient, send, get_member, get_role, get_color, english_list
client = None
class SupportClient(BotClient):
def __init__(self):
BotClient.__init__(self)
self.name ... |
import time
from contextlib import suppress
from dataclasses import dataclass
from enum import IntEnum
from typing import Optional, Dict, List, Callable
from functools import partial
import pandas as pd
from panoptes.utils import error
from streamz.dataframe import PeriodicDataFrame
from astropy import units as u
fr... |
import gc
from model_validator import ModelValidator
from rolling_mean_encoding import rolling_mean_encoding
import pandas as pd
from datetime import datetime
from constants import (DATA_FPATH, TEST_LIKE_SALES_FPATH, SALES_FPATH, ITEMS_FPATH, SHOPS_FPATH, TEST_SALES_FPATH,
ITEM_CATEGORIES_FPATH)
... |
# coding: utf-8
import enum
import re
import sys
import json
from common.exceptions import ValidationError
def RE(regex, flags=0):
pattern = re.compile(regex, flags)
return pattern.match
# RegEx pattern for matching email address
EMAIL_ADDRESS = RE(
"([A-Za-z0-9!#$%&'*+\/=?^_`{|.}~-]+@(?:[a-z0-9](?:[a-z... |
import os
import re
import regex
import sys
import time
import csv
import collections
from collections import Counter, deque
from emoji import UNICODE_EMOJI
from tqdm import tqdm
import pandas as pd
import argparse
import logging as log
from utils import config
import random
import numpy as np
import torch
import tor... |
import argparse
import time
import math
import os
import os.path
import sys
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.autograd import Variable
from apex.fp16_utils import *
from apex import amp, optimizers
#from stream_gbw import Voca... |
import torch
import torch.nn as nn
from torchvision.models import resnet
class BasicBlockSem(nn.Module):
def __init__(self, in_planes, out_planes, kernel_size, stride, padding):
super(BasicBlockSem, self).__init__()
self.conv = nn.Conv2d(in_planes, out_planes, kernel_size=kernel_size, stride=stri... |
import numpy as np
import scipy.sparse as sp
import torch
import sys
import pickle as pkl
import networkx as nx
def encode_onehot(labels):
classes = set(labels)
classes_dict = {c: np.identity(len(classes))[i, :] for i, c in
enumerate(classes)}
labels_onehot = np.array(list(map(classes_... |
import genetics
import random
import json
from typing import List, Tuple
from PIL import Image
tyGene = dict
tyDna = List[tyGene]
tyPop = List[Tuple[int, tyDna]]
# Serves for reporting during evolution
THIN_SEP = "-"*80
THICK_SEP = "="*80
def initial_population(dna_tools, dna_len: int, pop_size: int, img)-> tyPop:
... |
#!/usr/bin/env python
# encoding: utf-8
"""
geo_anim.py
Created by <NAME> on 2008-01-14.
Copyright (c) 2008 Texas A&M Univsersity. All rights reserved.
"""
import matplotlib
matplotlib.use('Agg')
from numpy import *
from matplotlib.pyplot import *
import pylab
import zipfile
import pycnal
import os
kml_preamble = '... |
import os
import pickle
import asyncio
import pandas as pd
from binance import Client
from typing import Iterable
from binance_bot_simulation.exchange_bots.strategy import Strategy
from common import mkdirs, timing
from binance_bot_simulation.exchange_bots.portfolio import InitialPortfolio
from binance_bot_simulatio... |
#CODE FROM https://docs.ocean.dwavesys.com/en/latest/examples/map_coloring.html
import dwavebinarycsp
from dwave.system.samplers import DWaveSampler
from dwave.system.composites import EmbeddingComposite
import networkx as nx
import matplotlib.pyplot as plt
import torch
from SAVsMLConvergence import MLOptim
from facto... |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..compat import compat_HTTPError
from ..utils import (
float_or_none,
ExtractorError,
)
class RedBullTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?redbull(?:\.tv|\.com(?:/[^/]+)?(?:/tv)?)(?:/events/[^... |
"""Sun2 Sensor."""
from datetime import timedelta
import logging
from astral import AstralError
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
CONF_MONITORED_CONDITIONS, DEVICE_CLASS_TIMESTAMP)
from homeassistant.core import callback
from hom... |
import os
# comment out below line to enable tensorflow logging outputs
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import time
import tensorflow as tf
physical_devices = tf.config.experimental.list_physical_devices('GPU')
if len(physical_devices) > 0:
tf.config.experimental.set_memory_growth(physical_devic... |
import math
import cmath
import numpy as np
# not necessary
import glob, os # for debug
def drange(start, stop, step):
# equivalent of function range except that it allows float steps
r = start
while r < stop:
yield r
r += step
def DFT(dataFrame, m):
lFrame_ = len(dataFrame) # fram... |
"""
15. 3Sum
Medium
Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0.
Notice that the solution set must not contain duplicate triplets.
Example 1:
Input: nums = [-1,0,1,2,-1,-4]
Output: [[-1,-1,2],[-1,0,1]]... |
#import sys
#import os
import time
import argparse
import torch
#import torch.nn as nn
import torch.backends.cudnn as cudnn
from torch.autograd import Variable
#from PIL import Image
import cv2
import pandas as pd
import uuid
#from skimage import io
import numpy as np
from src.utilities.craft_pytorch import craft_utils... |
import torch
import random
import torchvision
import torchvision.transforms as transforms
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import DHR_Net as models
import numpy as np
import pickle
import os
from PIL import Image
import argparse
from models import *
def get_args():
p... |
from ..core.stream import Stream, StreamArray, _no_value, _multivalue
from ..core.agent import Agent, InList
# agent, stream are in ../core
# _no_value and _multivalue are in helper_control, but it is imported
# into stream, so we can import above
from ..helper_functions.recent_values import recent_values
# recent_valu... |
# Trademark monitor fills out search form at www.tmnd.org with provided data,
# and sends the results as html text within an email to receiver's email address.
# Script is then run once a month via Cron.
#
# There has to be module :email_data with the variable named 'receiver'.
# The variable contains email address of ... |
import os
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
from torchvision import transforms
import numpy as np
from tensorboardX import SummaryWriter
from sacred import Experiment
from sacred.observers import FileStorageObserver
import utils.data_set_utls as utls
from utils import fct
fro... |
"""
The command-line entry point into hera-py.
Author: <NAME> (<EMAIL>)
Version: July 2019
"""
import functools
import sys
from .assembler import assemble_and_print
from .data import VOLUME_QUIET, VOLUME_VERBOSE, HERAError, Settings
from .debugger import debug
from .loader import load_program_from_file
from .op impo... |
# Standard Library
import argparse
import base64
from datetime import datetime
import os
import re
import textwrap
# external
from stix2validator import validate_string
from stix2validator.validator import FileValidationResults
# internal
from stix2elevator.options import info, warn
def find_string_in_list_case_ins... |
from __future__ import unicode_literals
import abc
import os
import re
import six
MYPY = False
if MYPY:
# MYPY is set to True when run under Mypy.
from typing import Any, List, Match, Optional, Pattern, Text, Tuple, cast
Error = Tuple[Text, Text, Text, Optional[int]]
class Rule(six.with_metaclass(abc.A... |
import math
import inspect
import wx
import koko
from koko.prims.evaluator import Evaluator, NameEvaluator
from koko.prims.editpanel import EditPanel
################################################################################
class PrimSet(object):
class PrimDict(object):
def __init__(se... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# MIT License
#
# Copyright (c) 2018 <NAME> <<EMAIL>>
#
# 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 witho... |
from tkinter import ttk
from PIL import Image, ImageTk
from PIL.ImageTk import PhotoImage
from sklearn.metrics import silhouette_score
import config
import spotipy
import pandas as pd
from spotipy.oauth2 import SpotifyClientCredentials
from emotion_video_classifier import emotion_testing
import tkinter as tk
from tki... |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
import time, json, sys, logging
from logging.handlers import RotatingFileHandler
from argparse import ArgumentParser, FileType
from datetime import datetime
from pathlib import Path
from froeling.FroelingValueConverter import *
from froeling.FroelingClient import Fro... |
#!/usr/bin/env python
#
# Copyright 2014 - 2018 The BCE Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the license.txt file.
#
import bce.math.constant as _math_constant
import bce.parser.interface.printer as _interface_printer
import sympy as _symp... |
#
# This file is part of Brazil Data Cube Collection Builder.
# Copyright (C) 2019-2020 INPE.
#
# Brazil Data Cube Collection Builder is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
#
"""Describe Sentinel 2 publish generation."""
# Py... |
# Copyright 2018 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import mock
import pytest
from flask import Markup
from dmutils.filters import (
capitalize_first, format_links, nbsp, smartjoin, preserve_line_breaks, sub_country_codes
)
class TestSmartJoin:
def test_smartjoin_for_more_than_one_item(self):
... |
# -*- coding: utf-8 -*-
"""Contains function for visually comparing values in various objects.
See the :mod:`mass.visualization` documentation for general information
on :mod:`mass.visualization` functions.
This module contains the following functions for visually comparing a set of
values in one object against a si... |
"""
This is the final code structure for the R2D2 project
Cornell Cup Robotics, Spring 2019
File Created by <NAME> '22 (yz366)
"""
########## MAIN FILE STARTS HERE
#hello
### import respective package
import sys
import speech_recognition as sr
import pyaudio
import nltk
nltk.download('vader_lexicon')
nltk.download('... |
#!/usr/bin/env python2
# Copyright (c) 2018-2021, Arm Limited, All Rights Reserved
# SPDX-License-Identifier: Apache-2.0
#
# 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.... |
#
# Copyright 2022 DMetaSoul
#
# 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... |
from app.models import User
import io
import os
import re
import datetime
from datetime import datetime
import json
import sys
from flask import current_app
from reportlab.lib import colors
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import A4
from reportlab.platypus import Image, Paragraph, Spacer... |
# coding: utf-8
# In[1]:
import numpy as np
import imutils
import time
import timeit
import dlib
import cv2
import matplotlib.pyplot as plt
from scipy.spatial import distance as dist
from imutils.video import VideoStream
from imutils import face_utils
from threading import Thread
from threading import Timer
from che... |
# files
import pathlib as pl
import os
from io import open
from numpy.lib.function_base import iterable
# manipulation and tabulation
import pandas as pd
import numpy as np
from math import sqrt, pow
# images
from PIL import Image
# time
from time import time_ns, process_time_ns, sleep
# concurrency
from concurrent... |
# -*- coding: utf-8 -*-
from asyncy.Exceptions import AsyncyError
from asyncy.processing.Mutations import Mutations
import pytest
from pytest import mark
@mark.parametrize('case', [
# Protocol for a case:
# case[0] = value (LHS operand)
# case[1] = operator (mutation)
# case[2] = operand (RHS operand... |
"""
This code is modified based on <NAME>'s repository (Bilinear Attention Networks - https://github.com/jnhwkim/ban-vqa) by <NAME>
"""
import argparse
import torch
from torch.utils.data import DataLoader
import dataset_RAD
import base_model
import utils
import pandas as pd
import numpy as np
import os
import json
impo... |
"""
Collection of functions that make making graphs easier.
"""
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.patches as patches
import sys
def prepare_figure(fig, ax, title, xlim, ylim):
"""
xlim and ylim must start at a negative number and end
at a positive number. they must both ... |
import time
import datetime
import numpy as np
import pandas as pd
import lightgbm as lgb
from dateutil.parser import parse
from sklearn.cross_validation import KFold
from sklearn.metrics import mean_squared_error
from sklearn.model_selection import train_test_split
trains = pd.read_csv('./raw_data/d_train.csv',encodin... |
#
# Copyright 2019 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... |
from __future__ import unicode_literals
import six
import django
from django.contrib.auth.decorators import login_required
from django.contrib.sites.models import Site
from django.core.urlresolvers import reverse
from django.http import Http404
from django.shortcuts import get_object_or_404, redirect, render
from dja... |
"""Support for the ShinTao Gas Fee."""
import logging
from typing import Callable
from datetime import timedelta
from http import HTTPStatus
from aiohttp.hdrs import USER_AGENT
import requests
from bs4 import BeautifulSoup
from homeassistant.core import HomeAssistant
from homeassistant.config_entries import ConfigEntr... |
"""Defines plots for classification models built with scikit-learn."""
from warnings import simplefilter
import numpy as np
from sklearn import naive_bayes
import wandb
import wandb.plots
from wandb.sklearn import utils
from wandb.sklearn import calculate
from . import shared
# ignore all future warnings
simplefil... |
import numpy as np
import scipy as sp
import warnings
import copy
# from scipy.stats import norm
from yetagain.dists import NormalDistribution, MixtureDistribution, StudentTDistribution
from yetagain.estimation import EstimationMixin
class ModelMixin:
'''Mixin class for models.'''
def __init__(self):
... |
"""Assuming test predictions are available, compute and display scores."""
import os
import sys
import warnings
import numpy as np
import dill
from sklearn.metrics import precision_recall_fscore_support, f1_score
from marseille.datasets import get_dataset_loader
from marseille.custom_logging import logging
def a... |
from sys import path
path.append("../APTED/apted")
path.append("../ML_Models/ObjectDetection")
path.append("util/")
import caption_generator
import constants
import json
import requests
import datetime
import parse_show_tree
import urllib
from apted import APTED, PerEditOperationConfig
import apted.helpers as apth
imp... |
"""
This modeule is for cleaning user text and chunking it as specified. Preparing it for the BERT module.
"""
import nltk
import pandas as pd
import re
import json
import numpy
# nltk.download('punkt')
# tokenizer = nltk.data.load('tokenizers/punkt/english.pickle')
from nltk.tokenize import word_tokenize
nltk.da... |
'''
Base Network class for the neural entropy closure.
Author: <NAME>
Version: 0.0
Date 29.10.2020
'''
### imports ###
# import matplotlib.pyplot as plt
import json
import tensorflow as tf
import numpy as np
import csv
import pandas as pd
from os import path, makedirs, walk
import time
### class definitions ###
clas... |
#!/usr/bin/env python3
from __future__ import print_function, unicode_literals
import re
import sys
import threading
try:
# Python 2.x imports
from StringIO import StringIO
import Queue as Queue
except ImportError:
# Python 3.x imports
from io import StringIO
import queue as Queue
pyver = sys... |
# coding: utf-8
import operator
import logging
import re
from django.conf import settings
from django.db.models import Q
from django.http import JsonResponse
from django.contrib.auth.models import Group
from functools import reduce
from rest_framework.exceptions import ValidationError
from jbei.rest.auth import Hma... |
#import datetime
#import enum
import json
import logging
import psutil
import os
#import re
import signal
import sys
import time
import subprocess
import uuid
# third-party imports
import flask
# neocortix imports
try:
import ncs
except ImportError:
# set python path for default place, since path seems to be ... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""
Some tools for task management.
"""
import bisect
import pandas as pd
from qlib.data import D
from qlib.workflow import R
from qlib.config import C
from qlib.log import get_module_logger
from pymongo import MongoClient
from pymongo.database ... |
import csv
import sys
from saleor_gql_loader import ETLDataLoader, utils, ETLDataRequester
# TODO: Move the authentication query in the package utils
def get_auth_query():
return """fragment
User
on
User
{
id
... |
"""
CleanPDB
========
"""
import argparse
import logging
import os
import os.path as op
import textwrap
from Bio import PDB
from tqdm import tqdm
import ssbio.utils
from ssbio.protein.structure.utils.structureio import StructureIO
log = logging.getLogger(__name__)
class CleanPDB(PDB.Select):
"""Selection rul... |
import argparse
import datetime
import functools
import queue
import threading
import traceback
import urllib.parse
import random
import swiftclient
import sys
import time
RETRIES = 10
def iterate_listing(list_func):
marker = ''
while True:
tries = 0
while tries < RETRIES:
try:
... |
import numpy as np
import numpy
import os, sys
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
from time import time
import matplotlib.pyplot as plt
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
import tensorflow_probability as tfp
#from tensorflow.contrib.opt import ScipyOptimizerInterface
import tensorflow_hub... |
import logging
import os
import time
import cv2
import numpy as np
import torch
import yaml
from matplotlib import colors
from matplotlib import pyplot as plt
from torch import Tensor, nn
from torch.utils.data import ConcatDataset
class CharsetMapper(object):
"""A simple class to map ids into strings.
It wo... |
##Copyright 2008-2015 <NAME> (<EMAIL>)
##
##This file is part of pythonOCC.
##
##pythonOCC is free software: you can redistribute it and/or modify
##it under the terms of the GNU Lesser General Public License as published by
##the Free Software Foundation, either version 3 of the License, or
##(at your option) any late... |
"""
pygnmi_call
###########
Task plugin to manage devices over gNMI protocol.
Requires `PyGNMI library <https://pypi.org/project/pygnmi/>`_ to be installed::
pip install pygnmi
This task plugin is a wrapper around ``gNMIclient`` connection object
and allows to execute any of its methods supplying method name us... |
import supalib
EPS = 0.01
TOLE = 0.2
COVER_FRONT_XSIZE = 210.0
COVER_BACK_XSIZE = 140.0
COVER_YSIZE = 245.0
SUPPORT_OFFSET = 20.0
COVER_HEIGH = 100.0 + SUPPORT_OFFSET
BASE_THICK = 1.6
SUPPORT_XSIZE = 30.0
SUPPORT_YSIZE = BASE_THICK
SUPPORT_ZSIZE = 10.0
HOLE_RAD = 3.0/2.0 + TOLE
BATTERY_HOLEX_BA... |
import numpy as np
import cv2
from .photometric import imdenormalize
def tensor2imgs(tensor, mean=(0, 0, 0), std=(1, 1, 1), to_rgb=True):
"""Convert tensor to 3-channel images.
Args:
tensor (Tensor): Tensor that contains multiple images, shape (
N, C, H, W).
mean (tuple[float], o... |
#!/usr/bin/env python
from __future__ import print_function
import os
import sys
import re
import gzip
import bz2
import argparse
import logging
from collections import defaultdict
logging.basicConfig(format='%(asctime)s - %(message)s', level=logging.DEBUG)
class CustomFormatter(argparse.ArgumentDefaultsHelpFormatter,... |
import threading
from UIUtil import *
from ConnectWindow import *
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
# メインUIのベース 継承元:UIUtil
class MainUiBase(UIUtil):
connectFlag = False
dutyValue = 0
connectTimeStamp = 0
# コンストラクタ
def __init__(self, ... |
#!/usr/bin/env python3
# coding: utf-8
# Copyright 2019 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 ... |
# Copyright (c) 2019-2020 <NAME>
# License: MIT License
# Created 2019-03-06
from typing import TYPE_CHECKING, Iterable, Sequence
import array
import copy
from itertools import chain
from contextlib import contextmanager
from ezdxf.math import Vector
from ezdxf.lldxf.attributes import DXFAttr, DXFAttributes, DefSubclas... |
# Copyright 2017-2018 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" fil... |
from model import Model
import torch
import torch.nn.functional as F
from torch.utils.data import Sampler, BatchSampler
import os
import shutil
import time
import logging
import copy
import types
import importlib.machinery
import numpy as np
import h5py
from dataset import ShapeNetPartDataset, BalancedSampler
import ... |
# Copyright (c) 2018, Rensselaer Polytechnic Institute, Wason Technology LLC
# 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 copyri... |
import tensorflow as tf
from tensorflow.keras.layers import Conv2D, BatchNormalization, MaxPooling2D, Flatten, Dropout, Dense
import tensorflow_addons as tfa
import tensorflow_datasets as tfds
import pickle, urllib
from datetime import datetime
import os
import sys
import shutil
class Preprocessing:
@staticmethod
... |
from __future__ import absolute_import
from itertools import chain
from six.moves import range, reduce
import os
import re
import numpy as np
import tensorflow as tf
import codecs
import sys
from tqdm import tqdm
import pickle
class Dataset():
def __init__(self, data='data/tasks_1-20_v1-2/en/',ts_num=1):
s... |
import sys, os
import numpy as np
import matplotlib as mpl
# mpl.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from random import seed as randseed
from random import randint
from math import ceil
# from abc import ABC, abstractmethod
class Obstacle(object):
"""
Base 2D Obstacle class
... |
#!/bin/python3.4
import sys, getopt
import binascii
import time
import math
import datetime
import numpy as np
import pandas as pd
def get_step_name(s):
if s == 1:
return "CC_Chg"
elif s == 2:
return "CC_Dchg"
# TODO: 3s
elif s == 4:
return "Rest"
... |
import os
import csv
import cv2
import copy
import random
import numpy as np
from sklearn.utils import shuffle
from sklearn.model_selection import train_test_split
STEERING_CORRECTION_LEFT = 0.2
STEERING_CORRECTION_RIGHT = 0.2
USE_SIDE_CAMERAS = True
FLIP_IMAGES = True
class SteeringData:
def __init__... |
# -*- coding: utf-8 -*-
# +
import pandas as pd
import lightgbm as lgbm
import numpy as np
import os
import random
import torch
def extract_time(df,column):
date = pd.to_datetime(df[column])
df[f'{column}_year'] = date.dt.year.values
df[f'{column}_month'] = date.dt.month.values
df[f'{column}_day... |
__author__ = 'shamilsakib'
from collections import OrderedDict
from rest_framework.pagination import LimitOffsetPagination
from rest_framework.pagination import _positive_int, CursorPagination, _reverse_ordering
from rest_framework.response import Response
from rest_framework.utils.urls import remove_query_param
from... |
# Copyright 2014 DreamHost, LLC
#
# Author: DreamHost, 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 applicabl... |
import numpy as np
from torch import nn, tensor
import torch
from torch.autograd import Variable
import torch.nn.functional as F
def normalize(x, axis=-1):
"""Normalizing to unit length along the specified dimension.
Args:
x: pytorch Variable
Returns:
x: pytorch Variable, same shape as input
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.