text stringlengths 3.07k 22.1k |
|---|
import torch
import torch.distributed as dist
import torch.multiprocessing as mp
from math import ceil
from torch.utils.data import DataLoader
from data import Vocab, MyDataset, STR, END, CLS, SEL, rCLS, sparsify_batch, worker_init_fn
from generator import Generator
from extract import LexicalMap
from adam import Ada... |
from utils import (
setup_logging,
status_by_mid,
getenv,
)
import json
from urllib.parse import parse_qs
import time
import hmac
import hashlib
import requests
import traceback
from .blocks import (
slack_help_menu_blocks,
slack_results_blocks,
RESULTS_PER_REQUEST,
MAX_RECORDS_PER_MSG,
)
i... |
import re
import os
import json
from collections import defaultdict
from functools import singledispatch
import numpy as np
import pandas as pd
from plio.utils.utils import is_number, convert_string_to_float
def socetset_keywords_to_dict(keywords, ell=None):
"""
Convert a SocetCet keywords.list file to JSON
... |
from pysal.lib import cg
import numpy as np
def compute_length(v0, v1):
"""Compute the euclidean distance between two points.
Parameters
----------
v0 : tuple
sequence in the form x, y
vq : tuple
sequence in the form x, y
Returns
--------
euc_di... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import cv2
import os
from shutil import copyfile
import random
from sklearn.utils import shuffle
from sklearn.metrics import confusion_matrix, classification_report
import tensorflow as tf
from tensorflow.keras.models import Sequential
... |
#===============================================================================
# Copyright 2020 Intel Corporation
#
# 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... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2016, <NAME> <<EMAIL>>
# (c) 2015, <NAME> <<EMAIL>>
# (c) 2014, <NAME> <<EMAIL>>
#
# This file is part of Ansible
#
# Ansible 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 Softwar... |
import numpy
from chainer.backends import cuda
from chainer import configuration
from chainer import function
from chainer.utils import type_check
def _as4darray(arr):
if arr.ndim == 0:
return arr.reshape(1, 1, 1, 1)
elif arr.ndim == 4:
return arr
else:
return arr.reshape(arr.sha... |
import curses
from curses import wrapper
from curses.textpad import Textbox
import random
import locale
import math
import base64
import hashlib
def hex2RGB(h, scale = 1000/256):
h = h.lstrip('#')
rgb = [int(int(h[i : i + 2], 16) * scale) for i in (0, 2, 4)]
return rgb
def assignColors(mapping):
c... |
import base64
import boto3
from datetime import datetime
import time
import pickle
import urllib.request
import json
# AWS Lambda functions for transfer Kinesis to Transcription and send back message though AWS IoT
TEMP_S3_INDEX = "income/sound_temp_index.tmp_"
TEMP_S3_LAST_SOUND_KEY = "income/sound_temp_last_key.t... |
# ========================================================================= #
# Copyright 2018 National Technology & Engineering Solutions of Sandia,
# LLC (NTESS). Under the terms of Contract DE-NA0003525 with NTESS,
# the U.S. Government retains certain rights in this software.
#
# Licensed under the Apache... |
from __future__ import (
absolute_import,
unicode_literals,
)
import unittest
from pysoa.test.plan.errors import StatusError
from pysoa.test.plan.grammar.tools import (
get_all_paths,
path_get,
path_put,
substitute_variables,
)
class TestPathAccessors(unittest.TestCase):
def test_001_sim... |
"""Drop-in replacement for dataclasses.dataclass with version annotation and checks."""
import types
from typing import *
import copy
import json
import argparse
from distutils.version import LooseVersion
import warnings
import yaml
from dataclasses import dataclass as _dataclass
from dataclasses import is_dataclass, a... |
#!/home/wyf/anaconda3/envs/test/bin/python
#!coding=utf-8
import rospy
import cv2
import numpy as np
from sensor_msgs.msg import Image
import cv_bridge
from cv_bridge import CvBridge, CvBridgeError
import traffic_count.test.test as test
from traffic_count.detector.detector import Detector
import traffic_count.tracker... |
# -*- coding:utf-8 -*-
"""
一些能够帮你提升效率的辅助函数
"""
from __future__ import unicode_literals, division
from copy import deepcopy
from datetime import timedelta
from threading import Thread
import requests
import requests.exceptions
from six.moves import urllib
from .log import logger
from .value import ENV
__all__ = ['ge... |
#Tone detection shamelessly stolen from:
#https://benchodroff.com/2017/02/18/using-a-raspberry-pi-with-a-microphone-to-hear-an-audio-alarm-using-fft-in-python/
#!/usr/bin/env python
import pyaudio
from numpy import *
from scipy import fft
from time import sleep
from collections import deque
import paho.mqtt.client as m... |
#!/usr/bin/python3
# number of output figures = 7
import numpy as np
import matplotlib.patches
import helper.basis
from helper.figure import Figure
import helper.grid
import helper.plot
def plotSGScheme(b, n, showDiagonal=True, highlightedSubspaces=None,
highlightedPoints=None, whiteMode=False, wi... |
from unittest import TestCase
import calibration_tools
import os
import filecmp
import pandas as pd
import datetime
import matplotlib.pyplot as plt
def read_flow_csv(f):
df = pd.read_csv(f)
df.index = df.apply(
lambda x: datetime.datetime(int(x['Year']), int(x['Month']), int(x['Day']), int(x['Hour']),... |
import itertools
from ..strips import KnowledgeState, Problem
from ..action import NopAction
from ..logic import AND, NOT, Predicate
from ..utils import PriorityQueue
import copy
import time
def graph_plan(problem: Problem, max_depth=1000, print_debug=False):
graph = PlanningGraph(problem)
if graph.check_goal... |
import graph_cpp
V = 20
beer_prob = 0.2
# build and preprocess graph
G = graph_cpp.graph(V, beer_prob)
G.build_dual(1)
G.build_graph()
G.preprocess()
D = graph_cpp.dag()
########################################################################################
# build vertex elements json
list_vertex... |
"""
Helpers for GraphQL Queries and Mutations
"""
import base64
import functools
from json import dumps, loads
import re
import warnings
import requests
class Compatible():
"""
Compatibility of Kili playground version with Kili API version
"""
# pylint: disable=dangerous-default-value
def __init... |
from operations import LinearLayer
import torch
import torchvision.models as models
import torch.nn as nn
import pretrainedmodels
from torchsummary import summary
from torch.autograd import Variable
from collections import OrderedDict
import pandas as pd
import networkx as nx
import matplotlib.pyplot as plt
import util... |
import os
import asyncio
import logging
import threading
from concurrent.futures import Future
from queue import Queue
try:
from grpc import aio as aiogrpc
except ImportError:
from grpc.experimental import aio as aiogrpc
import ray.experimental.internal_kv as internal_kv
import ray._private.utils
from ray._pr... |
import os
import logging
import argparse
import copy
from itertools import chain
from eight_mile.utils import read_config_stream, str2bool
from baseline.utils import import_user_module, normalize_backend
import mead
from mead.utils import convert_path, parse_extra_args, configure_logger, parse_and_merge_overrides
DEFA... |
"""
Opengl project demonstrating Lighting and Smooth Shading
Using GLU primitive shapes
Written in python because C++ did not work for me
PyOpengl and Pygame are the anly two requirements to run the program
********CONTROLS********
* Press UP ARROW or DOWN ARROW to adjust the slices and stacks of the primitive shapes ... |
import asyncio
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast
from asgiref.sync import async_to_sync
from django.apps import apps
from django.core.exceptions import ValidationError as DjangoValidationError
from mypy_extensions import TypedDict
from ..utils.cache import element_cache
... |
# doctest: +NORMALIZE_WHITESPACE
"""
Process a vector file to produce positive and negative samples.
"""
from __future__ import division, print_function
import os
import fiona
import numpy as np
import pandas as pd
import rasterio
import rasterio.errors
import rasterio.features
import rasterio.transform
import shape... |
import argparse
import yaml
from utils import *
from bounds import UniformBounds, StatBasedInputBounds
from deepconcolic_fuzz import deepconcolic_fuzz
import datasets
import filters
def deepconcolic(criterion, norm, test_object, report_args,
engine_args = {},
norm_args = {},
... |
'''
---------------------------
Licensing and Distribution
---------------------------
Program name: Pilgrim
Version : 2021.5
License : MIT/x11
Copyright (c) 2021, <NAME> (<EMAIL>) and
<NAME> (<EMAIL>)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associat... |
import copy
import logbook
import time
import threading
from enum import Enum
from six.moves import queue
from six.moves import xmlrpc_server
from ..utils.python import unpickle
from .. import log
from ..ctx import context
from ..runner import _get_test_context
from .. import hooks
from ..conf import config
_logger = ... |
"""
Training code for Adversarial patch training
"""
import PIL
import load_data
from tqdm import tqdm
from load_data import *
from unity_dataset import UnityDataset
import gc
import matplotlib.pyplot as plt
from torch import autograd
from torchvision import transforms
from torch.utils.tensorboard i... |
import numpy as np
from pyhsmm.models import _HMMGibbsSampling, _HMMEM, _HMMMeanField
from pyhsmm.internals.initial_state import UniformInitialState
from autoregressive.models import _ARMixin
from autoregressive.util import AR_striding
from pyslds.models import _SLDSGibbsMixin, _SLDSVBEMMixin, _SLDSMeanFieldMixin
f... |
import copy
import glob
from ase.io import read, write
from maze.perfect_zeolite import PerfectZeolite
from maze.zeolite import Zeolite
import os
from pathlib import Path
import json
from maze.index_mapper import IndexMapper
from typing import List, Iterable, Dict, Optional, Sequence, Tuple
import shutil
import math
fr... |
import os
import torch
from torchtext import data
# We will work with a dataset from the torchtext package consists of data processing utilities and popular datasets for NLP
from torchtext import datasets
import random
import torch.nn as nn
import time
import math
import torch.optim as optim
# We fix the seeds to get ... |
from __future__ import print_function
import sys
import time
import traceback
import json
import csv
def get_full_class_name(obj):
module = obj.__class__.__module__
if module is None or module == str.__class__.__module__: # type: ignore
return obj.__class__.__name__
return module + '.' + obj.__c... |
# Copyright 2020 by <NAME>, <NAME>, <NAME>, <NAME>, and <NAME>
# This software is distributed under the 3-clause BSD License.
# NOTE: this file has some "legacy" functions with wrappers
# (but it even has some legacy wrappers....)
import os
from pyomo.dataportal import DataPortal
import mpisppy.scenario_tree as s... |
"""
Copyright 2020, CCL Forensics
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sub... |
#!/usr/bin/env python3
# standards
from contextlib import contextmanager
from itertools import count
import re
# canif
from .utils import undefined
NAMED_CONSTANTS = {
'undefined': undefined,
'NotImplemented': NotImplemented,
}
BACKSLASH_ESCAPES = {
# Using http://json.org/ as a reference
'\\': (r... |
from flask import Flask, request, render_template, session, redirect, url_for, flash, jsonify
from werkzeug.security import check_password_hash
from werkzeug.utils import secure_filename
import os
import stripe
import json
import Mail
stripe.api_key = '<---YOUR_SECRET_STRIPE_API_KEY--->'
import db_operatoins
app = ... |
"""set of functions to manipulate ontology graphs"""
import logging
import math
from collections import defaultdict
from typing import List, Union, Dict, Any
from ontobio.assocmodel import AssociationSet
from ontobio.ontol import Ontology
from genedescriptions.commons import CommonAncestor
logger = logging.getLogger... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 14 17:12:06 2019
Li-Stephens genotype simulation
@author: nbaya
"""
import hail as hl
from hail.typecheck import typecheck, oneof, nullable
from hail.matrixtable import MatrixTable
def get_mt(chr_ls):
variants = hl.import_table('gs://nbaya... |
from dataclasses import dataclass
from typing import Any, Dict, List, Optional, Tuple, cast
import dash
import dash_bootstrap_components as dbc
from dash import MATCH, Input, Output, State, dcc, html
from dash.development.base_component import Component
from envinorma.models import StructuredText
from envinorma.models... |
"""
Python implementation of decentralized update algorithm
author: <NAME> (@The-chosen)
"""
import sys
sys.path.insert(0, '../')
import argparse
import yaml
from math import fabs
from itertools import combinations
from copy import deepcopy
from cbs.a_star import AStar
import time
from cbs.cbs import *
DYNAMIC_O... |
# -*- coding: utf-8 -*-
"""
quart_session.sessions
~~~~~~~~~~~~~~~~~~~~~~
Server-side Sessions and SessionInterfaces.
:copyright: (c) 2014 by <NAME>.
:copyright: (c) 2020 by Sander.
:license: BSD, see LICENSE for more details.
"""
import time
from typing import Optional
from uuid import uuid4,... |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from utils import *
class Analysis(nn.Module):
""" Computes F^T rho F x, where rho is some non-linearity. Takes care of normalization of frame atoms. """
def __init__(self, input_type: TensorType, frame_size, non_linearity, ... |
# parts of the code are based on https://www.pyimagesearch.com/2016/01/04/unifying-picamera-and-cv2-videocapture-into-a-single-class-with-opencv/
# before running the code install imutils for python3 (from https://github.com/pawelplodzpl/imutils)
# in case of problems with camera image run:
# sudo systemctl restart nv... |
from machin.model.nets.base import static_module_wrapper as smw
from machin.frame.algorithms.rainbow import RAINBOW
from machin.utils.logging import default_logger as logger
from machin.utils.helper_classes import Counter
from machin.utils.conf import Config
from machin.env.utils.openai_gym import disable_view_window
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""This script test `BaseTrainer` by inherition.
XXX
C.f. https://www.tensorflow.org/get_started/mnist/beginners.
"""
import os
import tensorflow as tf
from tensorflow.python import debug as tf_debug
from .base_trainer import BaseTrainer
from .utils import ensure_direct... |
from typing import Optional
import csv
import os
import re
import time
from os.path import join
from datetime import date
import psycopg2
import json
from .candle import Candle
from .utils import TimeFrame, stringify, Logger
TEMPLATE_FILE_NAME = "{}-{}_{:02d}_{:02d}-{}_{:02d}_{:02d}.csv"
DB_INSERTION_TITLE = "{}-{}_{... |
#!/usr/bin/env python
#
# Tester for mdtest
#
#/*****************************************************************************\
#* *
#* Copyright (c) 2003, The Regents of the University of California *
#* See the file COPYRIGHT f... |
# GPTune Copyright (c) 2019, The Regents of the University of California,
# through Lawrence Berkeley National Laboratory (subject to receipt of any
# required approvals from the U.S.Dept. of Energy) and the University of
# California, Berkeley. All rights reserved.
#
# If you have questions about your rights to use o... |
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
from config import Config
def loadData(cfg):
data = pd.read_csv(cfg.dataFile)
rawData = data.copy()
data = data.loc[:,cfg.keeps]
dtypes = list(data.dtypes)
names = list(data.columns)
for i,dt in enumerate(dtypes)... |
#!/usr/bin/env python3
"""
Simple script to get all blocks of a blockchain.
Note that this is currently done sequentially.
The script will create (or replace) the following files:
1) `blockchain.json`: An ordered (desc) JSON array of all the blocks
2) `blockchain-bad-load.json`: An ordered (desc) list of bloc... |
# -*- coding: utf-8 -*-
from math import atan2
from ..Qt import QtGui, QtCore
from ..Point import Point
from .. import functions as fn
from .GraphicsObject import GraphicsObject
from .UIGraphicsItem import UIGraphicsItem
from .TextItem import TextItem
from .ScatterPlotItem import Symbols, makeCrosshair
from .ViewBox im... |
#!/usr/bin/env python3
"""
The `covertfs` module extends the `pyfilesystem` package, using the `MemoryFS`
file system.
The MemoryFS file system stores all directory and file info in main memory,
to allow for instantaneous file access as well as to avoid writing any FS
information to disk. This allows for plausible den... |
import ast
import collections
import contextlib
import inspect
import numpy
from ..utils.list import EventedList
from ..utils.event import EmitterGroup, Event
class RunList(EventedList):
"""
A list of BlueskyRuns.
"""
__slots__ = ()
def __contains__(self, run):
uid = run.metadata["star... |
# Copyright (c) 2021, <NAME>
# License: MIT License
from typing import Callable, Optional, Dict
import abc
import sys
import os
import glob
import signal
import logging
from pathlib import Path
from ezdxf import recover
from ezdxf.lldxf import const
from ezdxf.lldxf.validator import is_dxf_file
__all__ = ['get', 'a... |
import glob
import numpy as np
from tqdm import tqdm
def opticflow(x1, y1, x2, y2):
# caculate the optic flow of 2 opints
# return dx dy
# checked
dx = x2 - x1
dy = y2 - y1
return dx, dy
def get_opticflow(data_before, data, model, kp_num, people_num = 0):
# one people
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Reads trajectory files and gives a csv file of the endpoint data for easy use.
Trajectory files must have been generated using backtrack_sinking_particles.py
using parcels 2.1.6. Other trajectory files might contain different variable
names and have different file na... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (c) 2019 Idiap Research Institute, http://www.idiap.ch/
# Written by <NAME> <<EMAIL>>
#
import os
import numpy as np
import scipy
from scipy.stats import norm
import math
import subprocess
import operator as op
from functools import reduce
def makedirs_saf... |
"""
Copyright 2020 EUROCONTROL
==========================================
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
... |
"""
A module for working with the .wily/ cache directory.
This API is not intended to be public and should not be consumed directly.
The API in this module is for archivers and commands to work with the local cache
TODO: Version .wily/ cache folders?
"""
import json
import os.path
import pathlib
import shutil
from... |
"""
Name: create_semantic_images.py
Desc: Creates semantically tagged versions standard RGB images by using the matterport models and
semantic labels.
This reads in all the point#.json files and rendering the corresponding images with semantic labels.
"""
# Import these two first so that we can import o... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
"""
=================
desiutil.funcfits
=================
Module for fitting simple functions to 1D arrays
<NAME>, UC Santa Cruz
Fall 2015
"""
from __future__ import (print_function, absolute_import, division,
... |
from train import null_augment
from model import *
from dataset import *
from common import *
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
# https://www.kaggle.com/c/siim-acr-pneumothorax-segmentation/discussion/97225#latest-570515
# https://www.kaggle.com/c/siim-acr-pneumothorax-segmentation/overview/evaluatio... |
import numpy
import pdb
def _gen_sum_vector(datasize, filtersize):
"""Generate base down sampling vector (down sampling operator for one element)
"""
### for mean down sampling
# generate 1D zero vector to calculate first element of down sampled ancestor
base_dsvector = numpy.zeros(shape=numpy.prod... |
import os
import pandas as pd
import numpy as np
from collections import ChainMap
import matplotlib.pyplot as plt
from . import database, meta
from .settings import DATASET_NAMES, FIGURE_DIR
def convert_year_month_to_labels(table, year_col, month_col):
table.rename_axis(index = {
... |
# 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 ... |
"""
* 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 notice, this
* list of conditions and the following disclaimer.
*
* - Redistributions in bina... |
import argparse
import shutil
import tempfile
import os
import sys
import subprocess
import sample_pools
class MSStitch(object):
def __init__(self):
self.temp_wd = None
self.outdir = os.getcwd()
self.parser = argparse.ArgumentParser()
self.parser.add_argument('--command', dest='co... |
import torch
import torch.nn as nn
import torchvision.models as models
from typing import *
import copy
import PIL
from PIL import Image
import numpy as np
from pathlib import Path
from .datamodule import transform_fn
from . import utils
import onnx
import onnxruntime as ort
import numpy as np
class MobileNetClassify... |
"""Tests for param_search module.
"""
import logging
import os
import unittest
import numpy as np
from catch.pool import param_search
from catch.utils import pool_probes_io
__author__ = '<NAME> <<EMAIL>>'
class TestHelperFunctions(unittest.TestCase):
"""Tests helper functions for searching for optimal paramet... |
# -*- coding: utf-8 -*-
"""
celery.events
~~~~~~~~~~~~~
Events is a stream of messages sent for certain actions occurring
in the worker (and clients if :setting:`CELERY_SEND_TASK_SENT_EVENT`
is enabled), used for monitoring purposes.
"""
from __future__ import absolute_import
import os
import tim... |
import boto3
import botocore
import re
from rich.prompt import Confirm
import sys
import os
from os import path
from haws.services.setup_helper import setup_cli
from rich.console import Console
from typing import List
from haws.config.leanix_policies import leanix_policies
from haws.main import logger, runtime
from haw... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, 2018 <NAME> <<EMAIL>>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.1',... |
# %% IMPORTS
import os
import re
import json
import tempfile
import glob as gb
import numpy as np
import pandas as pd
import yfinance as yf
import nltk as nl
import altair as alt
import streamlit as st
import plotly.express as px
import plotly.graph_objs as go
from wordcloud import WordCloud
from collections import ... |
"""
Jasper DR (Dense Residual) for ASR, implemented in Gluon.
Original paper: 'Jasper: An End-to-End Convolutional Neural Acoustic Model,' https://arxiv.org/abs/1904.03288.
"""
__all__ = ['JasperDr', 'jasperdr5x3', 'jasperdr10x4', 'jasperdr10x5']
import os
from mxnet import cpu
from mxnet.gluon import nn, Hyb... |
# Copyright 2019-2020 The Kale 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 or agree... |
import string
from nltk.corpus import stopwords
import ast
from nltk.tokenize import sent_tokenize, word_tokenize
import gensim
from gensim.models import Word2Vec
import numpy as np
from numpy.linalg import norm
from bert_embedding import BertEmbedding
import torch
import json
import pdb
from nltk.stem import WordNetLe... |
#!/usr/bin/env python3
import math
from typing import Iterable, Optional, Tuple, Union
import numpy as np
from analysis import time_domain_response
from utils import utils
from unit_test import unit_test
from processor import ProcessorBase
from generation import signal_generation
DEFAULT_CHECK_LINEAR... |
# -*- coding: utf-8 -*-
"""
This module supports data from the CARISMA magnetometer array. Downloads data from CARISMA website.
Loads XYZ data and rotates into HDZ. Will load data downloaded from the CARISMA website.
Directory structure is assumed
local_dir\\magnetometer\\CARISMA\\YYYY\\MM\\DD\\file
local_dir is set... |
# File: time.py
# Creation: Saturday January 23rd 2021
# Author: <NAME>
# ------
# Copyright (c) 2021 <NAME>
# Basic imports
from datetime import datetime, timedelta
import calendar
import math
import numpy as np
import pandas as pd
__all__ = [
"gnsstime"
]
DATETIME_1970 = datetime(1970, 1, 1, 0, 0, 0, 0)
DAT... |
from statistics import mode
from typing import Tuple, List, Callable
import pytest
@pytest.mark.parametrize(
"input_string, expected",
[
("", []),
("1", [1]),
("1, 2", [1, 2]),
("3, 1, 4, 1, 5", [3, 1, 4, 1, 5]),
("1, 2\n\n1 2 3", [1, 2]),
],
)
def test_parse_bingo... |
# -*- coding: utf-8 -*-
# Authors: <NAME> <<EMAIL>>
# simplified BSD-3 license
import os.path as op
import inspect
import numpy as np
from numpy.testing import assert_array_equal, assert_allclose, assert_equal
import pytest
from scipy import io as sio
from mne import find_events, pick_types
from mne.io i... |
import os
import cv2
import gibson2
import numpy as np
import py360convert
from configs.data_config import IG59CLASSES
from utils.transform_utils import points2bdb2d, contour2bfov
hdr_texture = os.path.join(
gibson2.ig_dataset_path, 'scenes', 'background', 'probe_02.hdr')
hdr_texture2 = os.path.join(
gibson2... |
from typing import Tuple
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
def percentile_plot(y: np.ndarray,
y_hat: np.ndarray,
title: str = '') -> Tuple[mpl.figure.Figure, mpl.axes._subplots.Axes]:
"""Plot the time series of simulated percentile... |
import cv2
import math
import numpy as np
def isRotationMatrix(R):
''' checks if a matrix is a valid rotation matrix(whether orthogonal or not)
'''
Rt = np.transpose(R)
shouldBeIdentity = np.dot(Rt, R)
I = np.identity(3, dtype = R.dtype)
n = np.linalg.norm(I - shouldBeIdentity)
return n < 1e... |
#! python3
# -*- coding: utf-8 -*-
"""Graphical debugger
of the phoenix, by the phoenix, for the phoenix
Author: <NAME> <<EMAIL>>
"""
from __future__ import division, print_function
from __future__ import unicode_literals
from __future__ import absolute_import
from functools import wraps
from pdb import Pdb, bdb
impo... |
import pandas as pd
from nltk import word_tokenize
from nltk import pos_tag
from nltk.corpus import stopwords
from sklearn.svm import LinearSVC, SVC
from sklearn import pipeline
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.pipeline import FeatureUnion
from sklearn.decomposition import Truncated... |
# Copyright 2020 The Weakly-Supervised Control 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 la... |
import os
import sys
import json
import time
import boto3
import subprocess
from datetime import datetime, timezone
PLATFORM = os.environ['PLATFORM']
OUTPUT_PLUGIN = os.environ['OUTPUT_PLUGIN'].lower()
TESTING_RESOURCES_STACK_NAME = os.environ['TESTING_RESOURCES_STACK_NAME']
PREFIX = os.environ['PREFIX']
LOGGER_RUN_TI... |
# -*- coding: utf-8 -*-
#
# 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, softw... |
# Copyright 2015 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 agreed ... |
#!/usr/bin/python2
import os
import sys
import argparse
test_list = []
parser = argparse.ArgumentParser()
parser.add_argument('--src', dest="src_dir", required = True)
parser.add_argument('--name-prefix', dest="prefix", required = True)
parser.add_argument('--cfg-dir', dest="cfg_dir", required = True)
parser.add_argu... |
"""Provides a Qt-based GUI for browsing Wiretap servers and nodes.
@author <NAME>
@date May 2014
@todo Implement node creation, deletion, and display filters.
@defgroup modWiretapBrowser WiretapBrowser
@{
"""
import sys
from PySide import QtGui
from wiretap import WireTapClientInit, WireTapClientUninit, WireTapExcep... |
"""
Cement core handler module.
"""
import re
from abc import ABC
from ..core import exc, meta
from ..utils.misc import minimal_logger
LOG = minimal_logger(__name__)
class Handler(ABC, meta.MetaMixin):
"""Base handler class that all Cement Handlers should subclass from."""
class Meta:
"""
... |
from temba_client.v2 import TembaClient
from google.cloud import bigquery
from google.oauth2 import service_account
from google.api_core.exceptions import BadRequest
import os
from datetime import datetime, timedelta
from fields import (
GROUP_CONTACT_FIELDS, FLOWS_FIELDS,
FLOW_RUNS_FIELDS, FLOW_RUN_VALUES_FI... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
**Project Name:** MakeHuman
**Product Home Page:** http://www.makehumancommunity.org/
**Github Code Home Page:** https://github.com/makehumancommunity/
**Authors:** <NAME>, <NAME>, <NAME>, <NAME>
**Copyright(c):** MakeHuman Team 2001-2019
*... |
# import functions
from random import randint
from math import ceil
# define game-play functions
def print_welcome():
print("\n\n\n\n")
print("#################################################################")
print("##### Welcome to PyShipwrecking! #####")
print("########... |
########################################################################
# Threes! is a game by by <NAME>, <NAME>, <NAME>, #
# and Hidden Variable. This is created so that AI/ML strategies for #
# the game can be developed and tested easier, and is not intended as #
# a replacement of the original game. Please sup... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.