text stringlengths 3.07k 22.1k |
|---|
import torch
from mmcv.cnn import build_norm_layer
from torch import nn
from mmdet3d.ops import DynamicScatter
from ..registry import VOXEL_ENCODERS
from .utils import PFNLayer, get_paddings_indicator
@VOXEL_ENCODERS.register_module()
class PillarFeatureNet(nn.Module):
"""Pillar Feature Net.
The network pre... |
from contextlib import contextmanager
import logging
import os
import re
import shutil
import subprocess
import tempfile
from urllib.parse import urlparse, unquote, quote
import boto3
from dropbox.dropbox import Dropbox
from dropbox.files import CommitInfo, UploadSessionCursor
import requests
logger = logging.getLogg... |
# -*- coding: utf-8 -*-
#
# latent representations of typological features
#
import sys, os
import shutil
import codecs
import math
import json
import numpy as np
import random
import six
from argparse import ArgumentParser
from json_utils import load_json_file, load_json_stream
from mda import MatrixDecompositionAuto... |
"""
pint.facets.context.registry
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: 2022 by Pint Authors, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import annotations
import functools
from collections import ChainMap
from contextlib import contextmanager
fro... |
# -*- coding: utf-8 -*-
# Wifi_Main.py
import os
import re
import getpass
import threading
import subprocess
from Cli import *
class RunError(Exception):
pass
# 执行命令行指令函数
def cmd(cmd):
res = subprocess.Popen(
cmd, shell = True,
stdin = subprocess.PIPE,
stdout = sub... |
import argparse
import os
import sys
##############################################
parser = argparse.ArgumentParser()
parser.add_argument('--epochs', type=int, default=10)
parser.add_argument('--batch_size', type=int, default=64)
parser.add_argument('--lr', type=float, default=1e-2)
parser.add_argument('--eps', ty... |
import numpy as np
import pandas as pd
import os
import torch
import torch.nn.functional as F
from torch.utils.data import Dataset, TensorDataset, DataLoader
from torch.nn.utils.rnn import pad_sequence
from utils import build_dense_graph
# Graph-based Knowledge Tracing: Modeling Student Proficiency Using Graph Neural ... |
import os
import json
import shutil
from base64 import b64decode
from pathlib import Path
from collections import OrderedDict
from urllib.request import Request, urlopen
from bs4 import BeautifulSoup as BS
from selectolax.parser import HTMLParser
def extract_and_write_static(ctx, html_body, blog_post_dir, topic_file... |
"""Ethereum/defi protocol structures that need to be accessed from multiple places"""
import dataclasses
from typing import Any, Dict, NamedTuple, Optional, Tuple
from typing_extensions import Literal
from rotkehlchen.accounting.structures import Balance
from rotkehlchen.assets.asset import Asset, EthereumToken
from... |
# Nuthouse01 - 08/24/2020 - v5.00
# This code is free to use and re-distribute, but I cannot be held responsible for damages that it may or may not cause.
#####################
# second, wrap custom imports with a try-except to catch it if files are missing
try:
from . import nuthouse01_core as core
from . import nu... |
# Standard library imports
import os, sys
import logging
import socket
# ETS imports
from apptools.preferences.api import Preferences
from traits.api import HasTraits, HasStrictTraits, Int, Str, List, \
Dict, Tuple, Instance
# Local imports
from .util import accept_no_intr, receive, send_port, spawn_independent,... |
"""
Use this program as a template for experimenting with the Metropolis algorithm
applied to 2 parameters called theta1,theta2 defined on the domain [0,1]x[0,1].
"""
from __future__ import division
import numpy as np
from scipy.stats import beta
import matplotlib.pyplot as plt
plt.style.use('seaborn-darkgrid')
# Def... |
"""
Unit tests for Adobe Fonts profile.
"""
import os
from unittest.mock import patch
from fontTools.ttLib import TTFont
from requests.exceptions import ConnectionError
from fontbakery.checkrunner import WARN, FAIL, ERROR, PASS, SKIP
from fontbakery.codetesting import (
assert_PASS,
assert_results_contain,
... |
#!/usr/bin/python
#
# Copyright (c) 2017 Ericsson and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
from opnf... |
from __future__ import absolute_import, unicode_literals
import os
import subprocess
import tarfile
import gzip
import shutil
from typing import Dict
from data_refinery_common.models import File, BatchKeyValue
from data_refinery_workers.processors import utils
from data_refinery_common.logging import get_and_configure_... |
import mxnet as mx
import numpy as np
from mxnet import gluon
from mxnet import autograd as ag
from mxnet.gluon.data.vision import transforms
from insightface.utils.face_align import norm_crop
from insightface import model_zoo
import time
import gluonfr
from pathlib import Path
import os
from tqdm import tqdm
from dat... |
# -*- coding: utf-8 -*-
"""An implementation of the identification algorithm."""
from typing import List, Sequence
from .utils import Identification, Unidentifiable
from ...dsl import Expression, P, Probability, Product, Sum, Variable
def identify(identification: Identification) -> Expression:
"""Run the ident... |
import sys
import threading as threading
from multiprocessing import Process, Queue
import numpy as numpy
import PySide2.QtCharts
from os.path import basename
from PySide2.QtCore import QPoint, Qt, QRect, QTimer
from PySide2.QtWidgets import QAction, QMainWindow, QApplication, QPushButton, QMenu, QFileDialog
from PySi... |
#!/usr/bin/env python3
# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
import os
import re
import... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# 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 ... |
#!/usr/bin/env python
from __future__ import division
"""MODULE_DESCRIPTION"""
__author__ = "<NAME>"
__copyright__ = "Copyright 2015, Cohrint"
__credits__ = ["<NAME>", "<NAME>"]
__license__ = "GPL"
__version__ = "1.0.0"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Development"
import os
import sys
im... |
"""
Author: <NAME>
Sources: Class Material
Description: implementation file for modifying 'timeblock' lists
"""
import times
import arrow
from dateutil import tz
###################################
# make list of days between range
def getDayList(beginDate, endDate):
daysList = []
# turn into arrow objec... |
import io
import mimetypes
import os
import socket
import sys
import tempfile
import uuid
from subprocess import CalledProcessError
from subprocess import check_call
from tempfile import NamedTemporaryFile
from typing import BinaryIO
from typing import Iterable
from typing import Union
import select
from select import... |
"""Script to convert the outputs of Redshift queries into different formats."""
import argparse
import gzip
import os
import shutil
import sys
import zipfile
import loompy
import pandas
import s3fs
from matrix.common import date
from matrix.common.constants import MatrixFormat
from matrix.common.logging import Loggi... |
"""
Some necessary CPython 3 threading module classes
"""
import _thread
from collections import deque as _deque
from itertools import islice as _islice
_allocate_lock = _thread.allocate_lock
Lock = _allocate_lock
def RLock(*args, **kwargs):
"""Factory function that returns a new reentrant lock.
A reent... |
# ######################################################################################################################
# Copyright 2020 TRIXTER GmbH #
# ... |
# classify part of speech based on sentence context
import nltk
from nltk.corpus import brown
# define features for the "i"th word in the sentence, including three types of suffix
# and one pre-word
# the pos features function takes the sentence of untagged words and the index of a word i
# it creates features... |
from __future__ import print_function
import requests
import logging
import copy
from time import sleep
from dbaas_credentials.models import CredentialType
from util import get_credentials_for
LOG = logging.getLogger(__name__)
class RunJobError(Exception):
pass
class GetJobError(Exception):
pass
class W... |
import socket
import logging
import threading
import itertools
import os
PORT = 1337
BOT_STATES = {} # k = bot address, v = bot state
''' STATES
0 up and waiting
1 enrolled and ready to attack
2 busy attacking
'''
logging.basicConfig(level=logging.INFO,
format='%(asctime)s PID:%(process)d %(message)s'... |
import copy as cp
import numpy as np
from sklearn.tree import DecisionTreeClassifier
from skmultiflow.core import BaseSKMObject, ClassifierMixin, MetaEstimatorMixin
import warnings
def LearnNSE(base_estimator=DecisionTreeClassifier(), window_size=250, slope=0.5,
crossing_point=10, n_estimators=15, prun... |
#!/usr/bin/env python
from peyotl import read_as_json, write_as_json
import csv
import sys
import os
import re
ott_id_from_str = re.compile('^ott(\d+)')
def parse_degree_dist(fn):
header_pat = re.compile(r'Out-degree\S+Count')
dd = []
with open(fn, 'rU') as inp:
expecting_header = True
for... |
import numpy as np
import re
__all__ = [
'stack_data',
'stack_detector_data',
]
def stack_data(train, data, axis=-3, xcept=()):
"""Stack data from devices in a train.
For detector data, use stack_detector_data instead: it can handle missing
modules, which this function cannot.
The returned a... |
from models import *
from nxsim import NetworkSimulation
# import numpy
from matplotlib import pyplot as plt
import networkx as nx
import settings
import models
import math
import json
import operator
import community
POPULATION = 0
LEADERS = 1
HAVEN = 2
TRAINING = 3
NON_RADICAL = 0
NEUTRAL = 1
RADICAL = 2
########... |
# Copyright 2012 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 ... |
"""Copyright [2020] [<NAME> & <NAME>].
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, sof... |
import os
import torch
import numpy as np
from collections import defaultdict
from maskrcnn_voc import *
from utils import load_json, save_json_pretty, merge_dicts, save_json
def clean_label(label_str):
return label_str.replace(u"\u2019", "'").replace(u"\u2018", "'").lower()
def compute_temporal_iou(pred, gt):
... |
# coding: utf-8
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.http import HttpResponse, HttpResponseForbidden, QueryDict
from push.models import DeviceTokenModel, NotificationModel, Develop... |
import torch
from torch.utils.data import Dataset
from tqdm import tqdm
import os
from PIL import Image
from torchvision import transforms as T
from .ray_utils import *
def circle(radius=3.5, h=0.0, axis='z', t0=0, r=1):
if axis == 'z':
return lambda t: [radius * np.cos(r * t + t0), radius * np.sin(r * t... |
"""
A board of tiles.
:Author: <NAME>
:Version: v20181125
"""
import random
from enum import Enum
from .tile import Tile
class BoardMovements(Enum):
"""
Directions that the board can move in. Used internally by the
engine to signal movements to the Board.
"""
UP = 1
DOWN = 2
LEFT ... |
import tensorflow as tf
import prettytensor as pt
import gym
import numpy as np
import csv
import os
import random
from collections import deque
from agents import ddpg, spaces, replay_buffer
envName = 'Pendulum-v0'
solvedThreshold = -195.0 # over 100 consecutive trials
env = gym.make(envName)
print("[DDPG-Agent-Tes... |
# coding=utf-8
# Copyright 2021 The Google Research 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 applicab... |
import numpy as np
import math
import pandas as pd
class SVM:
def __init__(self, X, Y):
# load the data
self.X = X
self.Y = Y
self.example_num = self.X.shape[0] # len(self.X)
# init alpha and b
self.alpha = np.zeros(self.example_num)
self.b = 0
se... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Scaleway database backups management module
#
# Copyright (C) 2020 <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
DOCUM... |
import torch
from torch.utils import data
import numpy as np
from sklearn.metrics import r2_score, classification_report, roc_auc_score, average_precision_score
import datetime
OUTPUT_DIR = 'output/'
TENSORBOARDX_OUTPUT_DIR = 'tbxoutput/'
SAVEDMODELS_DIR = 'savedmodels/'
# time of importing this file, including micr... |
# Copyright (c) 2013 Mirantis, 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... |
"""
all status changes for each component are persisted and read from component_state.json
STARTUP:
- immediate success is achieved (no exceptions at launch) state=Running
- immediate failure occurs at launch state=Failed
SHUTDOWN
- on shutdown of an 'SDK component' ... |
# -*- coding: utf-8 -*-
import os
import re
import urllib
import urlparse
import requests
import cookielib
import socket
from HTMLParser import HTMLParser
from fileUtils import fileExists, setFileContent, getFileContent
import json
#------------------------------------------------------------------------------
socke... |
import pytest
from gpmap.gpm import GenotypePhenotypeMap
from gpgraph.base import GenotypePhenotypeGraph
import numpy as np
import os
@pytest.fixture(scope="module")
def test_data():
"""
Set of maps with different characteristics to test.
Lifted directly from gpmap conftest on 2021-08-31.
"""
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (c) 2018 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# t... |
import time
import threading
from unittest import SkipTest
from threading import Event
import param
from holoviews.core.spaces import DynamicMap
from holoviews.core.options import Store
from holoviews.element import Curve, Polygons, Path, HLine
from holoviews.element.comparison import ComparisonTestCase
from holovie... |
import warnings
import cv2
import numpy as np
from sklearn.cluster import MiniBatchKMeans
from scipy.stats.mstats import mquantiles
from scipy.spatial.distance import cdist
from sklearn.neighbors import KNeighborsClassifier
import seaborn as sns
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics i... |
import numpy
from amuse.lab import *
#from amuse import plot
from amuse.ext import cloud
from matplotlib import pyplot
from amuse import datamodel
from amuse.ext.sph_to_grid import convert_SPH_to_grid
from amuse.community.capreole.interface import Capreole
from amuse.units.generic_unit_converter import ConvertBetweenGe... |
import os
from abc import abstractmethod, ABCMeta
from collections import OrderedDict
from time import sleep
from urllib.parse import urljoin
import requests
from lxml import html
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from dokidokimd.models import Manga, Chapter, MangaS... |
import numpy as np
import torch
from rebar import arrdict, dotdict
import pandas as pd
__all__ = ['dataframe']
class MultiVector:
def __init__(self, n_agents, dim):
super().__init__()
self.shape = (n_agents, dim)
class MultiDiscrete:
def __init__(self, n_agents, n_actions):
super().... |
# -*- coding: utf-8 -*-
"""Immutable structures."""
from abc import abstractmethod
from typing import TYPE_CHECKING, TypeVar, cast
try:
import collections.abc as collections_abc
except ImportError:
import collections as collections_abc # type: ignore
from six import with_metaclass
from .._bases import fina... |
"""
Status: Jim is currently rewriting
https://stackoverflow.com/questions/40450591/converting-json-to-sql-table
DB
- create table
- add entries to table
- 1) for now, overwrite local
- 2) eventually, if any dirty, then fail (handle later)
"""
import math
import os
# Third party imports
... |
# encoding: utf-8
# Copyright 1999-2017 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... |
import argparse
import random
from typing import Any, Dict, List, Tuple
import segmentation_models_pytorch as smp
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchvision.transforms.functional import (InterpolationMode, hflip,
resized_crop, rota... |
#!/usr/bin/python
# Copyright 2018 the V8 project authors. All rights reserved.
'''
python %prog [options] [baseline_files]
Compare benchmark results from the benchmark runner against one or
more baselines. You can either pipe the result of the benchmark
runner directly into this script or specify the results file wi... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import re
from pathlib import Path
from assertpy import assert_that
from lisa import (
LisaException,
Logger,
Node,
SkippedException,
TestCaseMetadata,
TestSuite,
TestSuiteMetadata,
constants,
simple_requirem... |
# pyOCD debugger
# Copyright (c) 2015-2019 Arm Limited
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0... |
import AT42QT1110
import time
import board
#TODO:
# * force a recalibration when switching between USB and battery power (instead of when pressing the Volume key)
# * clean up and debug slider code. Make sure it doesn't fly around while lifting the finger.
# * Synchronize the main loop with the uc1 acquisition cycle
#... |
#-*-coding: utf-8;-*-
"""novel_editor.editor
エディタGUIクラス、関数定義
"""
from os import linesep
from os.path import basename, expanduser
from subprocess import Popen as call
from threading import Timer
from wx import (CANCEL, EVT_MENU, EVT_TEXT, ID_CANCEL, ID_OK, ID_YES, NO, OK,
TE_MULTILINE, YES, ... |
import argparse
import bert_score
import numpy as np
import tqdm
from sacrebleu import sentence_chrf
from table_utils import (
extract_table_by_name,
parse_text_to_table,
is_empty_table,
)
bert_scorer = None
metric_cache = dict() # cache some comparison operations
def parse_table_element_to_relation(t... |
import bottle
import model
import os
import datetime as dt
def nalozi_portfelj():
uporabnisko_ime = bottle.request.get_cookie('uporabnisko_ime')
if uporabnisko_ime:
return model.Portfelj.preberi_iz_datoteke(uporabnisko_ime)
else:
bottle.redirect("/prijava/")
def shrani_portfelj(portfelj)... |
"""Line numbering implementation for IDLE as an extension.
Includes BaseSideBar which can be extended for other sidebar based extensions
"""
import functools
import itertools
import tkinter as tk
from idlelib.config import idleConf
from idlelib.delegator import Delegator
def get_end_linenumber(text):
... |
# 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 use ... |
import os
import pickle
import yaml
import glob
from tempfile import mkdtemp
from shutil import copy, copyfile, rmtree, make_archive, unpack_archive
# default format for output
FORMAT = "zip"
from . import __version__
from .exceptions import PronunciationAcousticMismatchError, PronunciationOrthographyMismatchError
... |
"""
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES O... |
#
# Author: <NAME> (http://www.vmusco.com)
import csv
import os
import subprocess
import time
import re
from mlperf.clustering.tools import dumpDataOnCleanCsv
# https://www.mathworks.com/help/stats/kmeans.html
from mlperf.tools.config import MATLAB_EXE, JAVA_EXE, TEMPFOLDER, MLPACK_BIN, R_BIN
from mlperf.tools.static... |
#!/usr/bin/env python
"""
Based on Modbus Synchronous Server Example
--------------------------------------------------------------------------
Manage a simple board with a switch and a light bulb, each of which
are rendered using QT.
"""
# --------------------------------------------------------------------------- ... |
import curses
import random
import logging
import textwrap
from view import View
from wildcatting.colors import Colors
import wildcatting.game
import wildcatting.model
class DrillView(View):
log = logging.getLogger("Wildcatting")
def __init__(self, stdscr, site, setting):
self._stdscr = stdscr
... |
from drf_yasg import openapi
from drf_yasg.utils import swagger_auto_schema
from rest_framework import status
from rest_framework.generics import GenericAPIView
from rest_framework.parsers import MultiPartParser
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from co... |
import json
import numbers
import typing
import pytest
class Box:
"""Rectangular bounding box"""
_attrs = ['left', 'top', 'bottom', 'right']
def __init__(
self, left: float, top: float, right: float, bottom: float
) -> None:
if top > bottom or left > right:
raise ValueEr... |
import datetime
import json
import os
import re
import sys
import shutil
import subprocess
import csv
sys.path.insert(0, 'data/translator/')
from timeit import default_timer as timer
from bs4 import BeautifulSoup
from dateutil import parser
from dateutil.relativedelta import relativedelta
from modernize_module impor... |
import os
import torch
import cv2
import numpy as np
import matplotlib.pyplot as plt
import torch.nn.functional as F
def get_cam(model, target=None, input=None, args=None):
'''
Return CAM tensor which shape is (batch, 1, h, w)
'''
with torch.no_grad():
if input is not None:
_ = mod... |
import logging
from pprint import pformat
from typing import Optional, Union, Tuple, List
import waiting
import yaml
from kubernetes.client import ApiClient, CustomObjectsApi
from kubernetes.client.rest import ApiException
from test_infra import consts
from ...consts.kube_api import (CRD_API_GROUP, DEFAULT_WAIT_FOR_A... |
from copy import copy
from enum import Enum, unique
from functools import reduce
import itertools
from operator import add
import re
from django.utils.translation import gettext_lazy as _
class BootstrapException(Exception):
"""
Raised if arrangement of Bootstrap-4 elements would render weird results.
""... |
import gzip
import os
import re
import sys
import tarfile
from six.moves import urllib
import tensorflow as tf
from liftbridge import liftbridge_input
FLAGS = tf.app.flags.FLAGS
tf.app.flags.DEFINE_integer('batch_size', 3,
"""Number of images to process in a batch.""")
tf.app.flags.DEFI... |
'''
Created on Jun 7, 2019
@author: ptrtmv
'''
import numpy as np
import random
import copy
from collections import namedtuple, deque
import torch
import torch.nn.functional as F
import torch.optim as optim
from model import Actor, Critic
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
c... |
from functools import update_wrapper
import math
import scipy.special as osp_special
from jax import custom_transforms, defjvp, jit, lax, random, vmap
from jax.lib.xla_bridge import canonicalize_dtype
import jax.numpy as np
from jax.numpy.lax_numpy import _promote_args_like
from jax.scipy.linalg import solve_triangul... |
from triton.gamestate import Game, GameState
from triton.vector2d import Vector2d
from triton.sphere import Sphere
from common.starfield import Starfield
import pygame as pg
import pygame.gfxdraw
import sys, os
class Planet(Sphere):
mutable = True
color = pg.Color("Yellow")
def calc_gravity(self... |
#!/usr/bin/python3
import xml.etree.ElementTree as ET
from datetime import datetime
class LocationTable():
"""docstring for LocationTable."""
def __init__(self, tijd=datetime.now(), meetpunten=[]):#TODO datetime
super(LocationTable, self).__init__()
self.tijd_laatste_config_wijziging = tijd
... |
import json
from distutils.util import strtobool
from typing import NamedTuple
import numpy as np
from scipy import stats
def fixations(results_pkl):
"""munge fixation data from a results.pickle file
Parameters
----------
results_pkl : str
path to a results.pickle file
Returns
-----... |
from ctypes import byref
import pyglet
from pyglet import gl
from pyglet.image import ImageException
from pyglet.image.codecs import ImageEncodeException, get_encoders
from magical.pyglet_backport.image.imagebuffer import ( # noqa: F401
Framebuffer, Renderbuffer, get_max_color_attachments)
class AbstractImage:... |
import numpy
import glob
import subprocess
import sys
from amalgkit.util import *
def check_quant_output(sra_id, output_dir, args):
out_path = os.path.join(output_dir, sra_id+'_abundance.tsv')
is_output_present = os.path.exists(out_path)
if is_output_present:
print('Output file detected: {}'.forma... |
#!/opt/stack/bin/python3
from flask import Flask, request, jsonify, send_from_directory, render_template, redirect
from urllib.request import unquote
import os
import requests
import hashlib
import subprocess
import click
import logging
from logging import FileHandler
from time import sleep
app = Flask(__name__)
tr... |
from math import sqrt # square root function
from math import acos
from re import search # inverse of cosinus function
import numpy as np
import os
import math
from s_defaults import default_sample_num, default_inputs
INPUT_SIGNAL_TYPES_6 = [
"body_acc_x_",
"body_acc_y_",
"body_acc_z_",
"total_acc_x_... |
# =========================================================================
# Copyright 2012-present Yunify, Inc.
# -------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this work except in compliance with the Licens... |
#-*- coding:utf-8 _*-
"""
@author:charlesXu
@file: proprecess_money.py
@desc: 金额提取数据预处理
@time: 2018/08/08
"""
import csv
from enum import Enum, unique
import jieba
import re
from Chatbot_Model.Info_Extraction.Entity_Extraction import log
@unique
class Consts(Enum):
BUFFER_SIZE = 100
propertyKs = ('.+金$', '.+款... |
# -*- coding: utf-8 -*-
"""
Estimate Relaxation from Band Powers
This example shows how to buffer, epoch, and transform EEG data from a single
electrode into values for each of the classic frequencies (e.g. alpha, beta, theta)
Furthermore, it shows how ratios of the band powers can be used to estimate
mental state for... |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
from SimPEG import Mesh, Utils
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as patches
from scipy.sparse import spdiags,csr_matrix, eye,kron,hstack,vstack,eye,diags
impor... |
from __future__ import annotations
from discord.member import Member
from . import ReactionMenu
from ..bbConfig import bbConfig
from .. import bbGlobals, lib
from discord import Colour, NotFound, HTTPException, Forbidden, Guild, Role, Message, User
from datetime import datetime
from ..scheduling import TimedTask
from t... |
"""
.. hidden-code-block:: text
:label: View Licence Agreement <br>
sosw - Serverless Orchestrator of Serverless Workers
The MIT License (MIT)
Copyright (C) 2019 sosw core contributors <<EMAIL>>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software an... |
import math
import random
class CachedNodeData:
'''A simple cache for node-specific data used in evaluation and training
for a single labeled example.
For each field, the description of the field assumes the following:
1. The node in question is a function f(w_1, w_2, ..., w_k, z_1, z_2, ..., z_m),
... |
import json
import multiprocessing
import os
import pickle
import cv2
import numpy as np
import shapely.geometry as shgeo
from utils import json_load, get_root_logger, json_dump
logger = get_root_logger()
def divide(process_id, files, cfg):
output_dir = cfg.output_dir
thresh = cfg.thresh
size = cfg.size... |
import quandl
mydata = quandl.get("YAHOO/INDEX_DJI", start_date="2005-12-01", end_date="2005-12-05")
import pandas as pd
authtoken = '<PASSWORD>'
def get_data_quandl(symbol, start_date, end_date):
data = quandl.get(symbol, start_date=start_date, end_date=end_date, authtoken=authtoken)
return data
def... |
# License: MIT
import re
import numpy as np
from typing import List
from openbox.utils.config_space import Configuration, ConfigurationSpace
from ConfigSpace import ConfigurationSpace, UniformIntegerHyperparameter, UniformFloatHyperparameter, \
CategoricalHyperparameter, Constant
from ConfigSpace import EqualsCond... |
import json
import pandas as pd
import torch
import torch.nn as nn
import torch.optim as optim
import torch.utils.data as data
import sklearn.model_selection as sms
import src.dataset as datasets
from pathlib import Path
from iterstrat.ml_stratifiers import MultilabelStratifiedKFold
from src.criterion import Impro... |
import asyncio
import re
from collections import namedtuple
from pathlib import Path
from typing import Callable, Dict, List, Optional, Set
from urllib.parse import urlsplit, urlunsplit
import appdirs
import httpx
import toml
from rich.console import Console
from rich.progress import track
# https://regexr.com/3e6m0
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.