text stringlengths 3.07k 22.1k |
|---|
# lil-lobby-bot
import a2s
import asyncio
import datetime
import discord
import json
import re
from discord.ext import tasks
from datetime import timedelta
# importing config and reading variables
with open("config.json", "r") as jsonfile:
config = json.load(jsonfile)
DiscordBotToken = config['DiscordBotToken']
Lo... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
import cv2
import json
import edit_distance as ed
import pdb
import matplotlib.pyplot as plt
import random
from PIL import Image, ImageDraw, ImageFont
import sys
import math
import time
def asMinu... |
# Copyright 2019:
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# This file is part of BME547_Final_Project.
#
# BME547_Final_Project is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundatio... |
# -*- coding: utf-8 -*-
"""
Referee creates struct xrefs for decompiled functions
"""
import logging
import traceback
import idaapi
logging.basicConfig(level=logging.WARN)
log = logging.getLogger("referee")
NETNODE_NAME = '$ referee-xrefs'
NETNODE_TAG = 'X'
def is_assn(t):
return (
t == idaapi.cot_asg... |
# Impots for models to work
from __main__ import app
from api_key import DATAGOV_APIKEY
from flask_sqlalchemy import SQLAlchemy
import cache # cache is used for caching the requests to API
import maps # this is a map of nutrients to their names
# Imports for login management
from flask_login import LoginManager, login... |
import xml.etree.ElementTree as xml
from api.util import chunkify
def return_update_order_resp(*args, **kwargs):
class foo(object):
def success(self):
return True
return foo()
def get_user_name(arg1):
return '<EMAIL>'
# product_list is type list, contact_id is type str
# needs to ... |
# 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, ... |
import binascii
import json
import os
import random
import string
import subprocess
from typing import List, Optional
import requests
import typer
import config
from fuzzer_container import (
find_payloads_in_admin,
find_payloads_in_files,
find_payloads_in_pages,
fuzz_actions,
fuzz_actions_admin,
... |
# *******************************************************************************************
# *******************************************************************************************
#
# Name : a16.py
# Purpose : RCA18016 Assembler
# Date : 25th August 2019
# Author : <NAME> (<EMAIL>)
#
# *****************... |
from rfvision.models.detectors3d.category_ppf.utils.eval_utils import compute_degree_cm_mAP
from rfvision.models.detectors3d.category_ppf.category_ppf import CategoryPPF
from rflib.runner import load_checkpoint
import os
import glob
from tqdm import tqdm
import pickle
import numpy as np
import torch
import cv2
def get... |
# -*- coding: utf-8 -*-
"""
urls.py ---
Copyright (C) 2017, <NAME>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any la... |
# /usr/bin/env python
import numpy as np
from hpp import Transform
from hpp.corbaserver.manipulation import ConstraintGraph, ProblemSolver, Rule
from hpp.corbaserver.manipulation.robot import CorbaClient, Robot
from hpp.gepetto.manipulation import ViewerFactory
import CORBA
clients = CorbaClient(postContextId="_estim... |
# -- coding: utf-8 --
# Copyright 2018 <NAME> <<EMAIL>>
import scipy.optimize as opt
"""
Provides some useful mathematical functions which are not present in numpy.
"""
import numpy as np
def prod(x):
p = 1
for k in x:
p *= k
return p
def perm(x):
"""
permutation with repetition of n fa... |
"""
Direct NumPy port of tfgan.eval.classifier_metrics
"""
# CREDITS: https://github.com/hojonathanho/diffusion/blob/1e0dceb3b3495bbe19116a5e1b3596cd0706c543/diffusion_tf/tpu_utils/classifier_metrics_numpy.py
import numpy as np
import scipy.special
def log_softmax(x, axis):
return x - scipy.special.logsumexp(x, ... |
import numpy as np
from homog.util import jit, guvec, float32, float64
def is_valid_quat_rot(quat):
assert quat.shape[-1] == 4
return np.isclose(1, np.linalg.norm(quat, axis=-1))
def quat_to_upper_half(quat):
ineg0 = (quat[..., 0] < 0)
ineg1 = (quat[..., 0] == 0) * (quat[..., 1] < 0)
ineg2 = (qu... |
#!/usr/bin/env python
### Program: MetaDownSampler.py
### Author: <NAME>
### UW Madison MDTP / Rotating in Anantharaman Lab
"""
Special thanks to: <NAME> and <NAME>
"""
import os
import sys
from time import sleep
from Bio import SeqIO
import logging
import time
import argparse
import pysam
from collections import de... |
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
import ujson as json
font = {'family': 'normal',
# 'weight' : 'bold',
'size': 12}
matplotlib.rc('font', **font)
labels = {'lstm': 'LSTM', 'bilstm': 'Bi-LSTM', 'nn': 'Fully-Connected'}
plot_colors = {'lstm': 'red', 'bilstm': 'blue', ... |
"""シミュレーション環境
・いつかクラス化する
"""
import numpy as np
import math
from math import pi, sin, cos, tan
from math_utils import * # いろんな関数のモジュール
from env_utils import * # 障害物関連のモジュールfrom env_utils import * # 障害物関連のモジュール
def env0():
o1 = make_squre_obs(1, 1, np.pi/3, np.array([[2, 3]], dtype = np.float32).T)
o2 = ... |
import os
import vtk
import ctk
import qt
import slicer
from EditOptions import HelpButton
import LabelEffect
__all__ = [
'WandEffectOptions',
'WandEffectTool',
'WandEffectLogic',
'WandEffect'
]
#
# This defines the hooks to be come an editor effect.
#
#
# WandEffectOptions - see LabelEffect, EditOptions a... |
"""
Following functions are specific to the analysis of the data saved
with BELLA control system
"""
import pandas as pd
import matplotlib.pyplot as plt
import os
import glob
import re
from numpy import unravel_index
import numpy as np
from scipy import stats
import json
from functions.data_analysis import df_outlier2... |
from ..language.parser import parse_value
from ..pyutils.ordereddict import OrderedDict
from ..type import (
GraphQLArgument,
GraphQLBoolean,
GraphQLEnumType,
GraphQLEnumValue,
GraphQLField,
GraphQLFloat,
GraphQLID,
GraphQLInputObjectField,
GraphQLInputObjectType,
GraphQLInt,
... |
import array
import logging
import os.path
import platform
import random
import socket
import string
import sys
import tempfile
import time
from contextlib import AbstractContextManager, contextmanager
from struct import Struct
from typing import Optional, Union
import _thread
NATIVE_BYTE_ORDER = sys.byteorder
SUPPOR... |
import gc
from time import time
from ..utils.config import *
from ..visualization.plot import Plot
from sklearn.model_selection import train_test_split
from ..utils.utils_ import *
from ..metrics.metrics_ import binary_score,multiclass_score
class GeneralModel:
def __init__(self):
self.trai... |
from snap7.client import Client as PlcClient
from opcua import Client
from index.models import Server
from snap7.snap7types import areas
from snap7.util import *
import time
import threading
from random import randint
import socket
class MyPlc:
area={ 'I' : 0x81, 'Q' : 0x82, 'M' : 0x83, 'D': 0x84 }
szs = { 'x'... |
from os.path import join as p
from textwrap import dedent
from unittest.mock import Mock
import pytest
try:
from paramiko import DSSKey, RSAKey, ECDSAKey, Ed25519Key, SSHException
from paramiko.hostkeys import HostKeyEntry
from cryptography.hazmat.primitives.asymmetric import ec
except ImportError:
py... |
from __future__ import absolute_import
import traceback
from .utils import Eval, latexify, arguments, removeSymPy, \
custom_implicit_transformation, synonyms, OTHER_SYMPY_FUNCTIONS, \
close_matches
from .resultsets import find_result_set, get_card, format_by_type, \
is_function_handled, find_learn_more_set
... |
import csv
import logging
import os
import yaml
from rdflib import Literal, URIRef
from rdflib.util import from_n3
from plastron import pcdm, namespaces, rdf
from plastron.files import LocalFileSource, RemoteFileSource
from plastron.exceptions import ConfigError
from collections import OrderedDict
nsm = namespaces.get... |
"""This module exposes the Authenticator, which acts as an interface for the IOController to interact with the
EGI Check-In authentication system."""
import json
from os import urandom
from time import time
from typing import Optional
from urllib.request import urlopen
import requests
from aarc_g002_entitlement impor... |
# -*- coding: utf-8 -*-
# Copyright 2018 by dhrone. All Rights Reserved.
#
import logging
import time
import uuid
import os
import configparser
from botocore.vendored import requests
import boto3
from boto3.dynamodb.conditions import Key, Attr
from botocore.exceptions import ClientError
# Set up logging
LOGLEVEL = l... |
import os
import sys
# Ensure parent folder is in PYTHONPATH
module_path = os.path.abspath(os.path.join('..'))
if module_path not in sys.path:
sys.path.append(module_path)
import matplotlib.pyplot as plt
import numpy as np
from copy import deepcopy
from sklearn.pipeline import Pipeline
from sklearn.compose impor... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
watcherlab threat intelligence feed client
"""
import os
import os.path
import json
import urllib.parse
import urllib.request
import urllib.error
import urllib.response
import ssl
import datetime
import hashlib
class __Base(object):
def __init__(self):
... |
#!/usr/bin/env python3
# Otro script para mostrar los datos del sensor MH-Z14A
# 2021 Josema - <EMAIL>
# Librerías necesarias
# pip install ephem
# pip3 install scrollphathd
# pip3 install pyserial
# sudo apt install libatlas-base-dev
# sudo apt install python3-smbus
import time
import serial
import scrollphathd
impo... |
# coding: utf-8
# Copyright 2014 jeoliva author. All rights reserved.
# Use of this source code is governed by a MIT License
# license that can be found in the LICENSE file.
import errno
import os
import logging
import sys
import argparse
import urllib
import m3u8
import requests
import coloredlogs
from parsers.bitr... |
import itertools
import os
import pickle
import re
from abc import ABCMeta, abstractmethod
from argparse import ArgumentParser
from collections import OrderedDict
class NotAToken(Exception):
""" We expected a single token, not multiple tokens """
class TransliterationNotUnderstood(Exception):
""" The websi... |
import os
import numpy as np
import pandas as pd
import time
from multiprocessing import Pool
fleet_sim_path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))))
try:
from src.routing.NetworkBasic import NetworkBasic as Network
except:
#fleet_sim_path = r'C:\Users\ge... |
"""
QemuXML - file ``/etc/libvirt/qemu/*.xml`` and ``/var/run/libvirt/qemu/*.xml``
==============================================================================
Parsers provided by this module are:
QemuXML - file ``/etc/libvirt/qemu/*.xml``
------------------------------------------
VarQemuXML - file ``/var/run/lib... |
"""
Copyright (c) Facebook, Inc. and its affiliates.
This file contains utility functions used for the generation pipeline.
"""
import random
import re
ABERRANT_PLURAL_MAP = {
"appendix": "appendices",
"barracks": "barracks",
"cactus": "cacti",
"child": "children",
"criterion": "criteria",
"d... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
TF-TRT Object detection with OpenCV.
Copyright (c) 2020 <NAME>
This software is released under the MIT License.
See the LICENSE file in the project root for more information.
"""
import argparse
import sys
import os
import time
import colorsys
impor... |
"""
Front end and game logic
"""
import pyglet
import numpy as np
from pyglet.window import key
from pyglet import shapes
import pkg_resources
from .solver import calculate_entropy, get_color_pattern
from .utilities import get_words
CELL_WIDTH = 200
CELL_HEIGHT = 200
alphabet = [
key.A,
key.B,
key.C,
... |
import numpy as np
import libs.configs.config_v1 as cfg
from PIL import Image, ImageFont, ImageDraw, ImageEnhance
from scipy.misc import imresize
FLAGS = cfg.FLAGS
_DEBUG = False
def draw_img(step, image, name='', image_height=1, image_width=1, rois=None):
img = np.uint8(image/0.1*127.0 + 127.0)
img = Image.f... |
# Copyright (c) OpenMMLab. All rights reserved.
from enum import IntEnum
from typing import List, Union
import cv2
import numpy as np
from mmpose.datasets import DatasetInfo
from .builder import NODES
from .frame_effect_nodes import BaseFrameEffectNode
class Mode(IntEnum):
NONE = 0,
SHUFFLE = 1,
CLONE =... |
import sys
from typing import List, Tuple
import re
import numpy as np
from abnumber.exceptions import ChainParseError
try:
from anarci.anarci import anarci
except ImportError:
# Only print the error without failing - required to import
print('ANARCI module not available. Please install it separately or ins... |
from compare_digits_models import FeatureExtractorDigits, DomainClassifierDANNDigits, DomainClassifierDigits, \
DataClassifierDigits, ResidualPhi
from data_shift.mnist_shift import get_mnist_shift
from data_shift.usps_shift import get_usps_shift
import numpy as np
def digits_expe_setting(setting, logger=None):
... |
#
# Copyright (C) 2011 - 2015 <NAME> <<EMAIL>>
# License: MIT
#
# suppress false-positive warn at '... pkg_resources ...' line:
# pylint: disable=no-member
"""A module to aggregate config parser (loader/dumper) backends.
"""
from __future__ import absolute_import
import itertools
import logging
import operator
import ... |
import itertools
import logging
import multiprocessing
import os
import typing
import numpy as np
import pandas as pd
import scipy.stats
from pyextremes.models.model_base import AbstractModelBaseClass
logger = logging.getLogger(__name__)
def get_fit_parameters(params) -> typing.List[tuple]:
n, fit_function, ex... |
"""
Widget to sit on the lock screen and show status of online/offline/syncing/updating/etc...
"""
import os
import sys
import time
import win32process
import win32ts
import util
from mgmt_EventLog import EventLog
global LOGGER
LOGGER = EventLog(os.path.join(util.LOG_FOLDER, 'ope-lockscreen.log'), service_name="OP... |
# Copyright (C) 2019-2020, TomTom (http://tomtom.com).
#
# 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 o... |
from PyQt4 import QtGui,QtCore
from PyQt4.QtCore import pyqtSlot,SIGNAL,SLOT
import sys
from os import listdir
from os.path import isfile, join
import cuffcomparegui
import subprocess
import cuff
import cuffquant
import cuffdiff
import cuffcompare
import cuffnorm
import cuffmerge
import allignment
import pickle
#impo... |
import pandas as pd
import numpy as np
import lightgbm as lgb
from sklearn.model_selection import KFold
from catboost import CatBoostRegressor
from utils import *
import argparse
from sklearn import preprocessing
import wordbatch
from wordbatch.extractors import WordBag
from wordbatch.models import FM_FTRL
... |
#!/usr/local/bin/python
#
# receive JT65.
#
# switches among bands if weakcat.py understands the radio.
# reports to pskreporter.info if mycall/mygrid defined in weak.ini.
#
# <NAME>, AB1HL
#
import jt65
import sys
import os
import time
import numpy
import threading
import re
import random
import copy
import weakcat
... |
from django.shortcuts import redirect, render
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.db.models import Q
from rest_framework import status, viewsets, permissions
from rest_framework.decorators import action
from rest_framework.response import Response
... |
"""Abstraction for managing multiple different IntervalSets.
This module provides IntervalSetMapping, which is a wrapper around a mapping
from keys to IntervalSets. They keys can be anything that's hashable in Python.
The most common use case is to restrict IntervalSet operations to be from the
same domain; for examp... |
# IDLEX EXTENSION
## """
## Squeezer - using this extension will make long texts become a small button.
##
## Copyright (c) 2011 <NAME>
## All rights reserved.
##
## Developed by: <NAME>
##
## Permission is hereby granted, free of charge, to any person obtaining a
## copy of this software... |
import argparse
import threading
import socket
import time
import _pickle as cpickle
import hashlib
import pygame
import copyreg
import ctypes
import lz4.frame
def get_ip_address():
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8", 80))
return s.getsockname()[0]
... |
# This game uses the pygame library. It may usually be installed
# by running something like "pip install pygame".
# The only controls are:
# Left arrow: turn left
# Right arrow: turn right
from random import randint
import pygame
class Direction:
west = (-1, 0)
east = (1, 0)
north = (0,... |
import os
import json
import time
import codecs
import plistlib
import subprocess
import lyrebird
from lyrebird import context
from lyrebird.log import get_logger
from . import wda_helper
from pathlib import Path
_log = get_logger()
ideviceinstaller = None
idevice_id = None
idevicescreenshot = None
ideviceinfo = None... |
import time
import datetime
import numpy as np
import pandas as pd
import random
import re
from sklearn.pipeline import Pipeline
from sklearn import grid_search
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.pipeline import FeatureUnion
from sklearn.decomposition import TruncatedSVD
from sklearn... |
#!/usr/bin/env python3
import basic_tools
from collections import namedtuple
import sys, os
import numpy
#from PySide.QtGui import *
import PySide.QtGui
import PySide.QtCore
_MAIN_WINDOW = None
def handle_xls(file_path:str) -> numpy.matrix :
import xlrd
book = xlrd.open_workbook(file_path, encoding_override="... |
#!/usr/bin/env python
"""Parses results from HAL lint"""
################################################################################
# stdlib
import argparse
import os
import re
import subprocess
import sys
################################################################################
# Bigger libraries (bette... |
import copy
import warnings
from collections import OrderedDict
from typing import List, Union
import numpy as np
import torch
__all__ = [
"normalize_image",
"channels_first",
"scale_intrinsics",
"pointquaternion_to_homogeneous",
"poses_to_transforms",
"create_label_image",
]
def normalize_i... |
#============================================================================
# Copyright (c) 2018 <NAME>. 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
#
# ... |
#!/usr/bin/python
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Library containing functions to access a remote test device."""
import logging
import os
import shutil
import stat
import time
... |
# Author: <NAME>
# Implementation 2 related
from relativeFactoredNudges import getNudges
from config import *
import pandas as pd
import subprocess, os, shutil, glob, time, fnmatch, multiprocessing, warnings, math, pickle
from modify_csv import modify_csv
from pandas.core.common import SettingWithCopyWarning
warning... |
"""Seawater salinity function.
This module provides the salinity of seawater (liquid water and salt) as
a function of temperature, pressure, and density.
:Examples:
>>> salinity(273.15,101325.,1028.)
3.50315257709e-2
:Functions:
* :func:`salinity`: Seawater salinity.
"""
__all__ = ['salinity']
import warnings
i... |
#!/usr/bin/env python3
# ------------------------------------------------------------------------
# Copyright (c) 2021 megvii-model. All Rights Reserved.
# ------------------------------------------------------------------------
import os, sys
from scipy.optimize import linear_sum_assignment
import numpy as np
def mas... |
#Importing the necessary libraries
import random
import matplotlib.pyplot as plt
import pandas as pd
#to read number of days
n=0
#Simulation of disease outbreaks
class Simulation():
def __init__(self):
#class attributes
self.day_number = 1
#Getting user input
pr... |
"""
Reflexive unit test the unit testing framework.
\LegalBegin
MIT
\LegalEnd
"""
import random
# import system under test
import aetherinstinct.testing.ut as sut
RArrow = sut.UTString.RARROW.value
NEq = sut.UTString.NEQ.value
# -----------------------------------------------------------------------------
... |
import keras
import tensorflow
import json
import os.path
from keras.models import Sequential
from keras.layers import Dense, Dropout, LSTM
from keras.optimizers import RMSprop
import os
from os import environ
from keras.callbacks import TensorBoard
from emetrics import EMetrics
import pandas as pd
from math import sqr... |
import streamlit as st
import pandas as pd
import pickle
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.figure import Figure
import seaborn as sns
import matplotlib
matplotlib.use("Agg")
from matplotlib.backends.backend_agg import RendererAgg
_lock = RendererAgg.lock
plt.style.use('default')
pickl... |
#!/usr/bin/env python
from telegram import (
InlineKeyboardButton,
InlineKeyboardMarkup,
ReplyKeyboardMarkup,
ReplyKeyboardRemove,
Update,
)
from telegram.ext import (
CallbackContext,
ConversationHandler,
Filters,
MessageHandler,
Updater,
)
from typing import Dict, Set
import g... |
import logging
import requests
from django.apps import apps as django_apps
from . import settings, exceptions
logger = logging.getLogger(__name__)
CREATE = '__create__'
UPDATE = '__update__'
RETRIEVE = '__retrieve__'
DELETE = '__delete__'
INFO = '__head__'
VERBS = {
RETRIEVE: 'GET',
CREATE: 'POST',
UPDA... |
import socket
import html
import base64
from datetime import datetime, timedelta
from contextlib import contextmanager
from typing import Any, Iterator, Union, Dict
import urllib3
from django.conf import settings
from django.utils import timezone
from celery import shared_task
from celery.task import BaseTask
import ... |
from typing import Any, Optional, Dict, List
from uuid import uuid4
import numpy as np
class Document:
def __init__(self, text: str,
id: Optional[str] = None,
score: Optional[float] = None,
probability: Optional[float] = None,
question: Optional... |
__copyright__ = """Copyright (C) 2020 University of Illinois Board of Trustees"""
__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 limitatio... |
import sys
home_dir = '/home/jbang36/eva_jaeho'
sys.path.append(home_dir)
## Need to load the modules
from loaders.uadetrac_loader import UADetracLoader
from logger import Logger
import os
import itertools
import time
import torch
from torch.optim.lr_scheduler import MultiStepLR
from eva_storage.baselines.indexing.... |
import json
import os
import pickle
from copy import deepcopy
from logging import getLogger
from typing import List
import numpy
from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split, GridSe... |
from distutils.command.build_ext import build_ext
from distutils import sysconfig
#from distutils.core import setup
from setuptools import setup, Extension
import os, sys
from os import chdir, getcwd
from os.path import abspath, dirname, split
import shlex, glob
from subprocess import check_output
import re
import ar... |
#!/usr/bin/env python3
#
# BLIS
# An object-based framework for developing high-performance BLAS-like
# libraries.
#
# Copyright (C) 2018, The University of Texas at Austin
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditio... |
import os
import trimesh
import xml.etree.ElementTree as ET
import pcp_utils
import numpy as np
import transformations
def indent(elem, level=0):
i = "\n" + level*" "
if len(elem):
if not elem.text or not elem.text.strip():
elem.text = i + " "
if not elem.tail or not elem.tail.st... |
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.autograd import Variable
import random
class ReplayBuffer:
def __init__(self, capacity):
self.capacity = capacity # 经验回放的容量
self.buffer = [] # 缓冲区
self.position = 0
... |
import torch
import torch.nn.functional as F
from einops import rearrange
def time_to_frames(time, frame_hz):
if isinstance(time, list):
time = torch.tensor(time)
frame = time * frame_hz
if isinstance(frame, torch.Tensor):
frame = frame.long().tolist()
else:
frame = int(frame... |
#
# This program is a stand-in for good intro docs. It just documents various
# basics of using Mitogen.
#
from __future__ import absolute_import
from __future__ import print_function
import hashlib
import io
import os
import spwd
import mitogen.core
import mitogen.master
import mitogen.service
import mitogen.utils... |
# Copyright 2014 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 agre... |
from __future__ import print_function
import sys
import os
import io
try:
from setuptools import setup, find_packages
from setuptools.command.install import install as _install
except ImportError:
from distutils.core import setup
from distutils.command.install import install as _install
def find... |
import ast
import sys
import os
import re
from typing import Callable, List, Tuple, Dict
class ParserResult:
summary = ""
body = ""
args = []
returns = []
arguments = []
def __str__(self):
value = f"({self.summary}){self.body}{self.args}"
return value
def __repr__(self):... |
import math
import numpy as np
import pylab as py
from astropy.table import Table
from astropy.io import fits
import pickle, glob
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
import os
from scipy import interpolate
import kai
def setup_phot(imageRoot, silent=False,
apertures=[25,50,... |
# -*- coding:utf-8 -*-
# @Author: wzy
# @Time: 2021/3/18
# 时间处理相关函数
__all__ = ["UTC", "BJT", "PDT", "PST", "JST", "TimeZones", "XLanguageMonth2En", "time_cost_decorator",
"utctime_form_iso8601", "utctime_form_x_format", "utc_today_zero", "utc_tomorrow_zero",
"utc_2_bjt", "timestamp_2_bjt"]
import... |
# Copyright 2021 Balanced DAO
#
# 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,... |
import asyncio
import os
from typing import Dict, List, Optional
import aiohttp
import aiosqlite
import discord
from discord.ext import commands, tasks
import ActivationInfoReader
import ArtifactInfoReader
import FlagInfoReader
import KindInfoReader
import ListSearch
from ErrorCatchingArgumentParser import ErrorCatch... |
#!/usr/bin/env python
# Copyright 2019 NXP
#
# SPDX-License-Identifier: BSD-3-Clause
#
# Author: <NAME>
# Mail: <EMAIL>
# description: Utils for file management and copy over serial
import os, sys, shutil
from os.path import isfile, join, isdir
import six
from subprocess import call
import subprocess
import hashlib
d... |
"""Train the model"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from datetime import datetime
import configuration
from ShowAndTellModel import build_model
from coco_utils import load_coco_data, sample_coco_minibatch, decode... |
# Copyright (c) The Johns Hopkins University/Applied Physics Laboratory
# 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/licen... |
from unittest import TestCase
from unittest.mock import MagicMock, patch, PropertyMock
import os
import requests
import pytest
from jumpscale import j
from s3 import S3, sort_by_master_nodes
from JumpscaleZrobot.test.utils import ZrobotBaseTest
from s3 import compute_minimum_namespaces
class TestS3Template(ZrobotB... |
#!/usr/bin/env python
import rospy
from geometry_msgs.msg import Pose, Point, Quaternion, Vector3
from sensor_msgs.msg import Image
from std_msgs.msg import ColorRGBA
from visualization_msgs.msg import Marker, MarkerArray
import cv2
from cv_bridge import CvBridge
import tf
import tf.transformations as tft
import numpy... |
"""
wrappers around samtools
"""
import sh
from bipy.utils import replace_suffix, append_stem, is_pair
from bcbio.utils import file_exists
from bcbio.distributed.transaction import file_transaction, _flatten_plus_safe
from bcbio.utils import memoize_outfile
import os
import pysam
from itertools import izip
from bipy.pi... |
import operator
def _unit_empty_map(value, empty):
"""
Map unit values for CoNLL-U columns to a string or None if empty.
Args:
value: The value to map.
empty: The empty representation for this unit.
Returns:
None if value is empty and value otherwise.
"""
return None if value == ... |
import sys
from amara.thirdparty import httplib2, json
from akara.util import first_item
import subprocess
import tempfile
import os
import shutil
import random
import string
import threading
import itertools
try:
import MoinMoin
except:
assert False, "Moinmoin needs to be installed for these tests to run"
... |
from datetime import datetime
from http import HTTPStatus
import pandas as pd
import pytest
from fastapi import HTTPException
from osiris.core.enums import TimeResolution
def test_get_all_dates_to_download():
from app.dependencies import get_all_dates_to_download
from_date = datetime(2021, 1, 1)
to_dat... |
#!/usr/bin/env python3
"""xtract_attachment.py
Utility to extract the attachment(s) from an "xml" file following the
Italian "Fattura Elettronica" format.
Can be used as a command line utility or imported as a module,
to be used inside other python programs.
NOTE: written and tested with Python... |
import os
import numpy as np
import collections
import megengine.module as M
import megengine.functional as F
import megengine as mge
from megengine.data.dataset import Dataset
from megengine.data import DataLoader
import hparams as hp
from megengine.data import Collator
class AsrDataset(Dataset):
def __init__(se... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.