text stringlengths 6.04k 39.5k |
|---|
import json
import os
import random
import signal
import string
import sys
import time
from functools import cmp_to_key
from pprint import pprint
from subprocess import check_call, CalledProcessError, Popen, PIPE, STDOUT, call
import psutil
from nni.package_utils import get_builtin_module_class_name, get_nni_installat... |
"""Define util functions."""
import os
import os.path as op
import shutil
import logging
import sys
from time import sleep
from pbcore.io import openDataSet, ContigSet
from pbcore.util.Process import backticks
def revcmp(seq):
"""Given a sequence return its reverse complement sequence."""
NTMAP = {'a': 't', ... |
import torch
import torch.nn as nn
import torch.optim as optim
import torch.autograd as autograd
import numpy as np
import imageio
import copy
class Generator(nn.Module):
def __init__(self, out_channels=1):
super(Generator, self).__init__()
self.out_channels = out_channels
self.fc = nn.S... |
from collections import defaultdict
from random import random, randint
from glob import glob
from math import log
import argparse
from nltk.corpus import stopwords
from nltk.probability import FreqDist
from nltk.tokenize import TreebankWordTokenizer
kTOKENIZER = TreebankWordTokenizer()
kDOC_NORMALIZER = True
import ... |
#
#
#
from __future__ import absolute_import, division, print_function, \
unicode_literals
from ipaddress import IPv4Address, IPv6Address
from logging import getLogger
import re
class Change(object):
def __init__(self, existing, new):
self.existing = existing
self.new = new
@property
... |
from joblib import load
import os
import pandas as pd
import numpy as np
from itertools import product
from mvmm.multi_view.block_diag.graph.bipt_community import community_summary
from mvmm_sim.simulation.Paths import Paths
from mvmm_sim.simulation.sim_viz import get_best_tune_expers
from mvmm_sim.simulation.utils i... |
"""
Module containing various utility functions:
`env_info`
Guess environment based on `sys.modules`.
`progress_bar`
Display a spinner or a progress bar.
`db`
Convenience function to calculate the 20*log10(abs(x)).
`cart2sph` / `sph2cart`
Transform cartesian into spherical coordinates and vice versa.
`... |
#!/usr/bin/env python
# coding: utf-8
# In[2]:
import sys
sys.path.append('..')
# In[3]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from datetime import timedelta, datetime, date
import os
from utils import data_paths, load_config
from pathlib import Path
from nltk.metrics import edit... |
#!/usr/bin/env python
u"""
jpl_ecco_sync.py
Written by <NAME> (10/2021)
Syncs ECCO Near Real-Time model outputs from the NASA JPL ECCO Drive server:
https://ecco.jpl.nasa.gov/drive/files/NearRealTime/Readme
https://ecco.jpl.nasa.gov/drive/files/NearRealTime/KalmanFilter/
https://ecco.jpl.nasa.gov/drive/fil... |
"""Python 3 functional programing experiments."""
import collections
import itertools
import inspect
import opcode
import types
__all__ = ["Let", "Expression", "Raise", "Where"]
def _make_closure_cell(value):
"""The types.FunctionType class ned a cell variable in the
closure argument. This function create... |
import io
import os
import sys
import json
import time
import Image
import base64
import photos
import numpy as np
import urllib.parse
from ui import WebView
from objc_util import *
import matplotlib.cm as cm
from math import atan, cos, floor
# Get your calibration values at https://eka.hn/calibration_test.html
config... |
import pandas as pd
import numpy as np
import glob
import cPickle as pickle
from scipy.integrate import odeint
import matplotlib.pyplot as plt
import os
import matplotlib as mpl
import argparse
parser = argparse.ArgumentParser(description='Plot simulation of MMP upon a treatment.')
parser.add_argument('--compound', nar... |
# ----------------------------------------------------------------------------
# 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... |
from collections import defaultdict, namedtuple
import copy
from mesa import Agent, Model
from mesa.time import RandomActivation
from mesa.datacollection import DataCollector
import numpy as np
from scipy.stats import multivariate_normal
class EpistemicLandscape:
"""
Represents the (noisy) epistemic landscap... |
#!/usr/local/bin/python3
# make sure we are using the right version
from sys import version
if version[0]!='3':
print("python 2 is deprecated, please use python 3")
exit()
# imports
from subprocess import run, check_output as call
from urllib.request import urlopen
import json; import base64; from sys import arg... |
"""This file is part of DeepLens which is released under MIT License and
is copyrighted by the University of Chicago. This project is developed by
the database group (chidata).
tiered_videoio.py uses opencv (cv2) to read and write files to disk. It contains
primitives to encode and decode archived and regular video f... |
import os
import random
import sys
import time
import pandas as pd
import numpy as np
from sklearn import svm
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import PolynomialFeatures
from sklearn.pr... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# #########################################################################
# Copyright (c) 2020, UChicago Argonne, LLC. All rights reserved. #
# #
# Copyright 2020. UChicago Argonne, LLC. This ... |
import numpy as np
import pandas as pd
from src import util
from datetime import datetime, timedelta
from collections import deque
def group(ts: pd.DataFrame, mode, value=None, time_key='time', agg_op=None):
"""
Groups data into specific time intervals, then returns aggregated values of
... |
bl_info = {
"name": "Knot generator",
"description": """Creates 3D meshes of knots from simple ASCII art descriptions.""",
"author": "<NAME>",
"version": (0, 0, 1),
"blender": (2, 7, 0),
"location": "3D View > Tools",
"warning": "", # used for warning icon and text in addons panel
"wiki_... |
#! /usr/bin/python3
# -*- coding: utf-8 -*-
#--------------------------------------------------------------------------------------------------
# Test cases
#
# Copyright 2020 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
# except in compliance with the License. ... |
#!/usr/bin/env python
import matplotlib.pyplot as plt
import matplotlib
import copy
from obspy.core import *
from .scnl import *
from .cf_fb import *
class FBPicker():
"""
FBpicker is designed to make picks based on the energy ratio of filtered data.
This algorithm is scripted by <NAME> and Guided by <NAME>... |
'''Data Source: https://www.kaggle.com/snap/amazon-fine-food-reviews'''
# Import attention layer
from attention import AttentionLayer
#Import the Libraries
import numpy as np
import pandas as pd
import re
from bs4 import BeautifulSoup
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequenc... |
import threading
from pyautogui import *
from pytesseract import *
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import QApplication, QMainWindow, QCheckBox, QDesktopWidget, QMessageBox, QStatusBar
from PyQt5.QtGui import QFont
from qt_material import apply_stylesheet
import pyautogui
import pydirectinput
i... |
# App for controlling and displaying the SLM
import matplotlib.pyplot as plt
import numpy as np
import threading,time,cv2,queue,tkinter,os
from tkinter import messagebox
from tkinter import *
from functools import partial
import PIL.Image, PIL.ImageTk
from tkinter.ttk import *
import SLM
def get_default_control_paramet... |
# Copyright 2014 Open Source Robotics Foundation, 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... |
# pip install watchdog
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
import time
import os
# pip install zipfile
import zipfile
# pip install clipboard
import clipboard
# pip
from svglib.svglib import svg2rlg
from reportlab.graphics import renderPDF, renderP... |
from __future__ import print_function, division, absolute_import
import numpy as np
from .base import BaseH2OTransformer, _frame_from_x_y, check_frame
from ..utils import is_numeric, flatten_all
from ..utils.fixes import is_iterable, dict_values
from ..preprocessing import ImputerMixin
from sklearn.externals import si... |
# plot_helper.py (python3)
# utilities for graphic display of training and evaluation of CNNs
# experiments in knowledge documentation; with an application to AI for ethnobotany
# March 2020 / 21
#-------------------------------------------------------------------------------
import os, sys, glob
from pyt_utilities imp... |
#!/usr/bin/env python3
"""
----------------------------------------------------------------
mahjong.py
----------------------------------------------------------------
Parse the Mahjong scores in {scores file}.txt and return a CSV of statistics
for full responsibility (全銃), one-n-two bucks (一二文), and half-spicy
incre... |
import numpy as np
#import matplotlib.pyplot as plt
class Network(object):
"""docstring for Network."""
def __init__(self, experiment_name, simulation_time=4, n_neurons_msi=20):
###### Variables ######
# Arguments
self.experiment_name = experiment_name
self.simulation_time =... |
import pandas as pd
from bidict import bidict
import random
pd.set_option('display.max_rows', 500)
pd.set_option('display.max_columns', 500)
pd.set_option('display.width', 1000)
pd.options.display.width = 0
import warnings
import copy
from collections import defaultdict
import operator
from sklearn.metrics import prec... |
from binaryninja import *
# from __future__ import print_function
from triton import *
import struct
import re
arch = Architecture['x86']
def is_opaque_predicate(instr):
tokens = instr.tokens
if tokens[0].text == 'xor' and tokens[2].text == tokens[4].text:
return True
if tokens[0... |
import logging
import inspect
import asyncio
import telepot
from telepot import glance, message_identifier
from telepot.namedtuple import ( InlineKeyboardMarkup
, InlineKeyboardButton
, ReplyKeyboardMarkup
, ReplyKeyboardRemove... |
import numpy as np
import cv2
# Identify pixels above the threshold
# Threshold of RGB > 160 does a nice job of identifying ground pixels only
def color_thresh(img, rgb_thresh=(160, 160, 160)):
# Create an array of zeros same xy size as img, but single channel
color_select = np.zeros_like(img[:,:,0])
# Req... |
import tensorflow as tf
tf.set_random_seed(123456)
def show_params(name, params):
print("Training Parameters for {}".format(name))
for para in params:
print(para.name + ': ' + str(para.get_shape()))
def embed_norm(x, axes):
norm2 = tf.reduce_sum(tf.square(x), axes, keep_dims=True)
norm = t... |
r"""PEG Parser
Implementation of PEG parser as described in paper "Parsing Expression
Grammars: A Recognition-Based Syntactic Foundation" (<NAME>, 2004).
PEG's grammar itself can be defined by PEG grammar::
# Hierarchical syntax
Grammar <- Spacing Definition+ EndOfFile
Definition <- Identifier LEFTARRO... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
# -*- coding: utf-8 -*-
"""
Optical Character Recognition
=============================
Extract text from images using Tesseract.
Module adapted by :-
author: <NAME>
email: <EMAIL>
from FigureDataExtractor (<CITATION>) :-
author: <NAME>
email: <EMAIL>
"""
from __future__ import absolute_import
from __future__ impor... |
from torch.utils.data import DataLoader, ConcatDataset
import copy
import math
import numpy as np
import time
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from torch.distributions import Normal
from torch.optim import *
import sys
import sp
def sp_vgg(model, ... |
import uvcx, logging, ctypes
# H264 extension GUID a29e7641-de04-47e3-8b2b-f4341aff003b
UVC_H264_GUID = b'\x41\x76\x9e\xa2\x04\xde\xe3\x47\x8b\x2b\xf4\x34\x1a\xff\x00\x3b'
VIDEO_CONFIG_PROBE = 0x01
VIDEO_CONFIG_COMMIT = 0x02
RATE_CONTROL_MODE = 0x03
TEMPORAL_SCALE_MODE = 0x04
SPATIAL_SCALE_MODE ... |
"""
Test the observation process load and write
"""
import os
import shutil
import numpy as np
import flopy
from nose.tools import raises
try:
import pymake
except:
print('could not import pymake')
cpth = os.path.join('temp', 't041')
# delete the directory if it exists
if os.path.isdir(cpth):
shutil.rmtre... |
"""
Dual-stick Shooter Example
A dual-analog stick joystick is the preferred method of input. If a joystick is
not present, the game will fail back to use keyboard controls (WASD to move, arrows to shoot)
If Python and Arcade are installed, this example can be run from the command line with:
python -m arcade.examples... |
#!/usr/bin/env python3
# Copyright (c) 2017-2021 The Particl Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from decimal import Decimal
from test_framework.test_particl import ParticlTestFramework
from test_frame... |
# coding: utf-8
from __future__ import unicode_literals
import hashlib
import random
import re
import time
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
ExtractorError,
int_or_none,
parse_duration,
try_get,
urlencode_postdata,
)
class NexxIE(InfoExtracto... |
"""Define the MyQ API."""
import asyncio
import logging
from bs4 import BeautifulSoup
from datetime import datetime, timedelta
from typing import Dict, Optional, Union, Tuple
from urllib.parse import urlsplit, parse_qs
from random import choices
import string
from aiohttp import ClientSession, ClientResponse
from aioh... |
from libs import *
def scatter_3d(df: pd.DataFrame, x_col: str, y_col: str, z_col: str,
traces: dict, title='') -> None:
"""
Usage Example:
scatter_3d(telcom, 'col1', 'col2', 'col3',
({'name': '1', 'text': '', 'filter': telcom[taget_col] == 1},
... |
#! /usr/bin/env python
# coding=utf-8
# Copyright (c) 2019 Uber Technologies, 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
... |
"""This file implements the gym environment for a quadruped. """
import datetime
import os
import time
# gym
import gym
import numpy as np
# pybullet
import pybullet
import pybullet_data
import pybullet_utils.bullet_client as bc
from gym import spaces
from gym.utils import seeding
import quadruped_spring.go1.configs... |
# -*- coding: utf-8 -*-
import logging
import os
import re
from pathlib import Path
from subprocess import PIPE, CompletedProcess, TimeoutExpired, run
from typing import List, Tuple, Union
import reusables
from box import Box, BoxError
from fastflix.exceptions import FlixError
from fastflix.language import t
from fas... |
# -*- coding: utf-8 -*-
"""Utilities and tools."""
import json
import logging
import pathlib
import platform
import sys
from datetime import datetime, timedelta
from itertools import zip_longest
from urllib.parse import urljoin
import click
import dateutil.parser
import dateutil.relativedelta
import dateutil.tz
from ... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright 2012 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not... |
from os import path
from behave import given, when, then
from test.behave_utils.utils import *
from mgmt_utils import *
# This file contains steps for gpaddmirrors and gpmovemirrors tests
# This class is intended to store per-Scenario state that is built up over
# a series of steps.
class MirrorMgmtContext:
def... |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
from __future__ import annotations
import json
from typing import NamedTuple, List, Tuple, NewType, Optional, Any
import numpy as np
from enum import IntEnum
class Pattern:
def __init__(self):
self.data = set()
self.hold_starts = set()
self.hold_ticks = set()
def add(self, position):... |
""" Multicut module of nifty
This module implements multicut
related functionality.
For more details, see seection :ref:`theory_multicut`.
"""
from __future__ import absolute_import
import sys
from functools import partial
#from . import _multicut as __multicut
from ._multicut import *
from .... import Configurat... |
import json
import math
import os
import subprocess
import time
from enum import IntEnum
from functools import cached_property
from pathlib import Path
from cereal import log
from common.gpio import gpio_set, gpio_init
from selfdrive.hardware.base import HardwareBase, ThermalConfig
from selfdrive.hardware.tici import ... |
# -*- coding: utf-8 -*-
"""
Evaluation functions
"""
import logging
import numpy as np
from sklearn.cluster import AgglomerativeClustering, KMeans
from .datasets.similarity import fetch_MEN, fetch_WS353, fetch_SimLex999, fetch_MTurk, fetch_RG65, fetch_RW, fetch_TR9856
from .datasets.categorization import fetch_AP, fet... |
"""Implementations of log-Gamma and related functions.
Author: <NAME>
Distributed under the same license as Scipy.
References
----------
[1] Hare, "Computing the Principal Branch of log-Gamma",
Journal of Algorithms, 1997.
[2] Julia,
https://github.com/JuliaLang/julia/blob/master/base/special/gamma.jl
[3] ... |
from BCDataStream import *
from enumeration import Enumeration
from base58 import public_key_to_bc_address, hash_160_to_bc_address
import logging
import socket
import time
from util import short_hex, long_hex
import struct
def parse_CAddress(vds):
d = {}
d['nVersion'] = vds.read_int32()
d['nTime'] = vds.read_uint... |
from typing import *
from .identify import neverPolicy
from .template import GraphTemplate
def new_graph(template: GraphTemplate, *bases: GraphTemplate):
"""
Create a graph from a template.
Use this function instead of invoking constructor directly.
:param template: A template of a graph.
:param... |
from __future__ import print_function
import torch
import numpy as np
from PIL import Image
import os
from collections import OrderedDict
from IPython import embed
# Converts a Tensor into an image array (numpy)
# |imtype|: the desired type of the converted numpy array
def tensor2im(input_image, imtype=np.uint8):
... |
# Copyright 2021 Toyota Research Institute. All rights reserved.
import torch
import torch.nn.functional as F
from fvcore.nn.smooth_l1_loss import smooth_l1_loss
from torch import nn
from detectron2.layers import Conv2d, cat
from detectron2.modeling.meta_arch.build import META_ARCH_REGISTRY
from detectron2.modeling.p... |
# Copyright 2020 StreamSets 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 writi... |
#!/usr/bin/env python3
import numpy as np
import copy as cp
from tqdm import tqdm
try:
import lib.metrics as metrics
except ModuleNotFoundError:
import metrics
import sklearn.model_selection as sk_modsel
import sklearn.utils as sk_utils
import sklearn.metrics as sk_metrics
import multiprocessing
def _para_... |
# Copyright 2018 D-Wave 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.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... |
# coding: utf-8
# In[1]:
import sklearn.mixture as mix
import scipy as sp
import numpy as np
import copy
'''
num:データの個数
dim:データの特徴量次元
state = {'FEATURE', 'LABEL', 'CLUSTER', 'SCORE', 'GM'}:ディクショナリ
feature:選択した特徴量を表すリスト
label:データをクラスタリングした際のラベル
clusters:データをいくつのクラスタに分類するか。Boumanのアルゴリズムによって求める。
score:評価値
'''
def sc... |
from collections import OrderedDict
import torch
from torch import nn
from torch.nn import init
import torch.nn.functional as F
from torchvision.ops import MultiScaleRoIAlign
from torchvision.ops import boxes as box_ops
from torchvision.models.detection.generalized_rcnn import GeneralizedRCNN
from torchvision.models... |
#! /usr/bin/env python
"""
The idea is based on <NAME> Keplerspline.pro
IDL module that iteratively fits 4th-orther B-splines
to the data to remove trends.
Breakpoints for each campaign come from A.V.
the `knots` utility program defines inner knots
and is based on <NAME>'s bspline_bkpts.pro
modified and simplified ... |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
import numpy as np
import numbers
import itertools
from scipy.spatial import cKDTree
import ase
import ase.geometry
from sitator import SiteNetwork, SiteTrajectory
from sitator.util.progress import tqdm
from sitator.util import PBCCalculator
from sitator.visualization import plot_atoms, plot_points
import surfato... |
from __future__ import annotations
import time
from queue import Empty, Queue
from typing import Any, Dict, List, Optional, Tuple
import grpc
import torch
import torch.nn as nn
from torch.autograd.function import once_differentiable
import hivemind
from hivemind.moe.client.beam_search import MoEBeamSearcher
from hiv... |
"""Dictionary with default tasks and their underlying functions."""
import os
import subprocess
import shlex
import shutil
import glob
import numpy as np
from skpar.core.utils import get_ranges, get_logger, islistoflists
from skpar.core.plot import skparplot
from skpar.core.parameters import update_parameters
from skpa... |
# -*- coding: utf-8 -*-
"""Parse the packet data received from the EnOcean device.
Copyright (c) 2017 <NAME> <<EMAIL>>
EnOceanデバイスから受信したパケットデータを解析してデータを抽出します。
動作確認しているデバイスは、STM431J, PTM210J, STM429J です。
パケットデータの解析の仕様は、以下のドキュメントを参照してください。
EnOcean Serial Protocol 3 (ESP3) Version 1.27
EnOcean Radio Protocol 2(... |
''' Handling the data io '''
import os
import argparse
import logging
import dill as pickle
import urllib
from tqdm import tqdm
import sys
import codecs
import spacy
import torch
import tarfile
import torchtext.data
import torchtext.datasets
try:
from torchtext.legacy.data import Field
from torchtext.legacy.dat... |
#!/usr/bin/env python3
# Copyright (C) 2017-2021 The btclib developers
#
# This file is part of btclib. It is subject to the license terms in the
# LICENSE file found in the top-level directory of this distribution.
#
# No part of btclib including this file, may be copied, modified, propagated,
# or distributed except... |
# %%
from typing import Generator
from libretto.baseblock import Block, Loop, RunSpec, import_load
from importlib import import_module
import pandas as pd
import logging
class SklClass(Block):
def __init__(self, cls:str=None, trainmethod:str=None, testmethod:str=None, scoremethod:str=None, keepcolnames=True, inita... |
import numpy as np
import torch
import torch.optim as optim
import torch.nn as nn
from torch.autograd import Variable
from torch.nn import functional as F
import argparse
import time
import re
import os
import sys
import bdcn
from datasets.dataset import Data
from datasets.utls import visualize_result
from xsploss impo... |
# -*- coding: utf-8 -*-
"""A UI to create, share, and organize presets. A "Preset" is a json file
of attribute: values information so it can be re-set on new nodes
TODO -
It would be nice to remove the QFilesystemModel. It is broken in PyQt5.9
If removed, it would allow more control of the recording of the indecies
If... |
#!/usr/bin/python
'''
Generates all data required to create a PixPlot viewer.
Documentation:
https://github.com/YaleDHLab/pix-plot
Usage:
python utils/process_images.py --image_files="data/*/*.jpg"
* * *
'''
from __future__ import division, print_function
from collections import defaultdict... |
# ~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
# MIT License
#
# Copyright (c) 2021 <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 res... |
import builtins
import math
import struct
from fractions import gcd
from _audioop_cffi import ffi, lib
_buffer = memoryview
class error(Exception):
pass
def _check_size(size):
if size != 1 and size != 2 and size != 4:
raise error("Size should be 1, 2 or 4")
def _check_params(length, size):
_... |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
import os, itertools, shutil, re, string, sys, inspect
import numpy as np
np_vars = vars(np)
np_fs = {_key:np_vars[_key] for _key in np_vars.keys() if inspect.isfunction(np_vars[_key])}
def boldblue(text):
return "\033[1m" + '\033[94m' + text + "\033[0m"
def str_2_num(num_str):
if num_str.count(".") == 0:
... |
#!/usr/bin/env python
#python imports
import time
import math
import traceback
import numpy as np
from scipy.spatial.transform import Rotation as R
from threading import Lock
#PX4flow import
from px_comm.msg import OpticalFlow
#ROS imports
import rospy
from geometry_msgs.msg import Twist, Vector3
from std_msgs.msg imp... |
from __future__ import annotations
import asyncio
import logging
from datetime import datetime, timezone
from decimal import Decimal
from enum import Enum, auto
from typing import Any, Awaitable, Optional, cast
import aiohttp
from pybotters.store import DataStore, DataStoreManager
from pybotters.typedefs import Item
... |
# Copyright (c) 2019 Uber Technologies, 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... |
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from fig2_spline import get_feats, get_P
matplotlib.rcParams.update({'font.size': 22})
matplotlib.rcParams['pdf.fonttype'] = 42
matplotlib.rcParams['ps.fonttype'] = 42
def make_legend_arrow(legend, orig_handle,
xdescent, ydes... |
try:
r2p = None
import r2lang
import os, sys
import esilsolve
import r2pipe
import z3
import json
import shlex
import colorama
r2p = r2pipe.open()
except ImportError as e:
#print("esplugin could not be loaded: " + str(e))
pass
add_shortcuts = True
class ESILSolvePlu... |
from collections import defaultdict, Counter
from datetime import datetime, timedelta
import threading
import itertools
import random
import time
import math
import re
from src.containers import UserDict, UserSet
from src.decorators import COMMANDS, command, event_listener, handle_error
from src.functions import get_... |
# coding=utf-8
# author hestyle
# desc 必须在终端直接执行,不能在pycharm等IDE中直接执行,否则看不到动态进度条效果
import os
import sys
import m3u8
import requests
import traceback
import threadpool
from Crypto.Cipher import AES
headers = {
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/... |
#!/usr/bin/env python3
import argparse
import math
import os
import random
import shutil
import sys
import matplotlib as mpl
import numpy as np
import torch
import torch.multiprocessing as mp
import torch.nn as nn
from common.config import Config
from common.environment import initialize_environment
from common.netw... |
# coding: utf-8
#
# Project: X-ray image reader
# https://github.com/silx-kit/fabio
#
#
# Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: <NAME> (<EMAIL>)
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this... |
import discord
from discord.ext import commands, tasks
import sys
import copy
sys.path.append('../')
from main import config_load, increment_command_counter, districts
from datetime import datetime, timedelta
from utils import time_diff_to_string
from utils import item_emojis
import json
import praw
config... |
import functools
import operator
import numpy as np
import scipy.special
import scipy.stats
def is_even(x):
return not is_odd(x)
def is_odd(x):
return int(x) & 1
def roundd_even(x):
return 2 * np.floor(0.5 * x)
def roundu_even(x):
return 2 * np.ceil(0.5 * x)
def roundd_odd(x):
x_even = r... |
#
# Copyright 2013 Quantopian, 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 wr... |
# coding=utf-8
# Copyright 2018 The TF-Agents Authors.
#
# 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... |
# Natural Language Toolkit: CONLL Corpus Reader
#
# Copyright (C) 2001-2019 NLTK Project
# Author: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
Read CoNLL-style chunk fileids.
"""
import textwrap
from nltk.tree import Tree
from nltk.util import ... |
import os
import pickle
import tempfile
from contextlib import contextmanager
import nbformat
import pytest
from dagster import execute_pipeline, pipeline
from dagster.check import CheckError
from dagster.core.definitions.events import PathMetadataEntryData
from dagster.core.definitions.reconstructable import Reconstr... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import logging
import pandas as pd
import numpy as np
from functools import lru_cache, wraps
from recommenders.utils.constants import (
DEFAULT_USER_COL,
DEFAULT_ITEM_COL,
DEFAULT_RATING_COL,
DEFAULT_LABEL_CO... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.