text stringlengths 6.04k 39.5k |
|---|
#!/usr/bin/env python3
"""
A python .epub ebook reader
Used to be based on prompt_toolkit, but since version 1.9 is based on py_cui.
"""
from .htmlParser import Chapter, StyleHandler
import py_cui as pycui
from ebooklib import epub
import json, os, ebooklib, argparse
from multiprocessing import Pool, cpu_count
from .na... |
from itertools import count
import numpy as np
import tensorflow as tf
import lib.ops
from lib.oracle import get_optimal_inserts, inserts_coo_to_tensor, batch_inserts_to_coo
from lib.util import nested_flatten, nested_map, make_batch_placeholder
class BeamSearchInserts:
def __init__(self, model, is_train=False)... |
from copy import deepcopy
from typing import Any, Dict, List, Optional, Union
import datasets
import numpy as np
from numpy.random import default_rng
from pytorch_lightning.utilities.exceptions import MisconfigurationException
from torch.utils.data import Dataset
class EnergizerSubset:
"""This is a shallow reimp... |
# rdate: Alternative to standard datetime library.
# Copyright: (c) 2018, <EMAIL>. All rights reserved.
# License: MIT, see LICENSE for details.
import calendar as _calendar
import datetime as _datetime
import enum as _enum
import re as _re
__all__ = ['Period', 'Weekday', 'set_first_day_of_week', 'Time', 'Date', 'Da... |
import os
import logging
import logging.config
def command_string_builder(argument_dictionary, prepend, append="",
flags_list="", argument_delimiter="-"):
"""This function dynamically builds a shell executable command string, so that
you don't have to manually build strings using th... |
import collections
import functools
import inspect
import typing
from types import NoneType
from types import UnionType
import attr
import dis_snek
from dis_snek.utils.input_utils import _quotes
from . import converters
from . import errors
@attr.s(slots=True)
class CommandParameter:
name: str = attr.ib(default... |
"""Main FLOWER simulation logic"""
import collections
import logging
import warnings
from typing import List
import matplotlib.pyplot as plt
import numpy as np
from wsnsims.core import segment
from wsnsims.core.cluster import closest_nodes
from wsnsims.core.comparisons import much_greater_than
from wsnsims.core.envi... |
#! /usr/bin/env python3
__format_spec__ = '.4g'
__info__ = {\
'mappability':
{'ID': 'MAPPABILITY', 'Number': 1, 'Type': 'Float', 'Description': '"UMAP mappability score at the candidate site (k=24)"'},
'type':
{'ID': 'TYPE', 'Number': 1, 'Type': 'String', 'Description': '"type of the c... |
# -*- coding: utf-8 -*-
"""
This is the python script to run all tests.
Run with puthon -m tests.run from parent directory.
For the tests to run we create virtual devices and test all the api calls,
with many combiniations. For each api call a status code and a text response
is returned. If DEUBG==True then status co... |
# MIT License
#
# Copyright (c) 2017 <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
# to use, copy, modify, merge, publi... |
"""Collection of nodes used in tests.
If any of the components become useful for examples and more general use
please move it to `deltalanguage.lib`.
"""
import time
import migen
import deltalanguage as dl
from deltalanguage import DeltaRuntimeExit
# Add: 2 inputs, 1 output
@dl.DeltaBlock(allow_const=True)
def a... |
#!/usr/bin/env python3
import argparse
import configparser
import os
import os.path
import sys
import json
from json import JSONEncoder
class Package:
def __init__(self):
self.package_name = None
self.package_version = None
self.recipe_name = None
self.license_string = None
... |
import torch
import torch.nn as nn
import onmt
from onmt.modules.Transformer.Models import TransformerEncoder, TransformerDecoder, Transformer
from onmt.modules.Transformer.Layers import PositionalEncoding
from onmt.utils import change_paranames
init = torch.nn.init
MAX_LEN = onmt.Constants.max_position_length # This... |
# Copyright 2014 Google Inc. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... |
import numpy as np
from seisig import*
def create_timewedgeModel(seismic, model, dtc, Theta, Beta, tBottom, tTop, wedgeAngle, Q=False):
print('\n\n Cálculos del modelo de cuña sintético\n\n')
FreqVel = model.vp[0]
for z in range(seismic.zLen):
print(('CDP #{} de {}').format(z+1, seismic.zLen))
... |
import math
from math import pi
from typing import List
import numexpr
import numpy
def icc(theta: float, a: float, b: float, c: float = 0, d: float = 1) -> float:
"""Item Response Theory four-parameter logistic function [Ayala2009]_, [Magis13]_:
.. math:: P(X_i = 1| \\theta) = c_i + \\frac{d_i-c_i}{1+ e^{-... |
from mibody.processor import BodyDataRow
from unittest import TestCase
from mibody import BodyData
import subprocess
import datetime
import json
import csv
import sys
import os
THIS_FILE_DIR = os.path.dirname(os.path.abspath(__file__))
PROJECT_DIR = os.path.realpath(os.path.join(THIS_FILE_DIR, '..'))
PYTHON_INTERPRET... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Plot ranks of top 100 users in the cyberbullying dataset
Usage: python plot_fig4_top_entities.py
Input data files: ../data/[app_name]_out/complete_user_[app_name].txt, ../data/[app_name]_out/user_[app_name]_all.txt
Time: ~8M
"""
import sys, os, platform
from collecti... |
import inspect
import io
import pathlib
import struct
from uuid import uuid4
import crcmod
class ParseError(Exception):
"""There was an error during parsing"""
def __init__(self, data, fmt):
self.data = data
self.fmt = fmt
def __str__(self):
return 'ParseError: fmt="{s.fmt}" dat... |
import logging
import os
import numpy as np
from astropy import units
from astropy.io import fits
from astropy.table import Table
from astropy.time import Time
from scipy import ndimage
def get_filename(basename, extension='ast', exists=False):
cnt = 0
answer = None
while True:
cnt += 1
f... |
# package(s) for data handling
import pandas as pd
import numpy as np
# *** General functions
def report_element(Terminal, Element, year):
elements = 0
elements_online = 0
element_name = []
list_of_elements = find_elements(Terminal, Element)
if list_of_elements != []:
for element in list_o... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
# -*- coding: utf-8 -*-
"""
# @Time : 2019/12/09
# @Author : xiaxia.wang
# @File : data_process.py
# @Software: PyCharm
"""
import json
import argparse
import nltk
import os
import pickle
import sys, logger
sys.path.insert(... |
import warnings
from functools import lru_cache
from typing import Optional
import numpy as np
import scipy.sparse as sp
from numba import njit
from tqdm import tqdm
from torch_geometric.data import Data
from graphwar import Surrogate
from graphwar.attack.targeted.targeted_attacker import TargetedAttacker
... |
"""
The wntr.network.base module includes base classes for network elements and
the network model.
.. rubric:: Contents
.. autosummary::
AbstractModel
Subject
Observer
Node
Link
Registry
NodeType
LinkType
LinkStatus
"""
import logging
import six
from six import string_types
impo... |
"""
mspaceExp
=======================
Qt4 interface for mspace explorer
To browse alib in a more user-friendly way
Item.data(1,0) stores its data, i.e. a str or another alib
"""
# NOTE: the actual command documentation is collected from docstrings of the
# commands and is appended to __doc__ after the class has been... |
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2021, <NAME> (@ajpantuso) <<EMAIL>>
#
# 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 Software Foundation, either version 3 of the License, or
# (at your option) any later versi... |
"""Running the BiDAF models."""
import atexit
import errno
import gzip
import json
import numpy as np
import os
import pickle
import requests
import socket
import sys
import subprocess
import time
import eval_squad
ROOT_DIR = 'bi-att-flow-dev'
GLOVE_DIR = 'glove_shortlists'
SAVE_DIR = 'save'
MODEL_NUM = 37 # Use thi... |
import re
"""
<s-expr> ::= <num>
| (+ <s-expr> <s-expr>)
| (- <s-expr> <s-expr>)
| (if0 <s-expr> <s-expr> <s-expr>)
| (with (<sym> <s-expr>) <s-expr>)
| (fun (<sym>) <s-expr>)
| (set <sym> <s-expr>)
| (seqn <s-expr> <s-expr>)
| (<s-expr> <s-expr>)... |
import csv
import logging
import math
import shutil
import tempfile
import typing
from collections import defaultdict
from dataclasses import dataclass
from pathlib import Path
import librosa
import torch
from phonemes2ids import phonemes2ids
from torch.utils.data import Dataset
from vits_train.config import Training... |
# Copyright (c) 2014 OpenStack Foundation
# 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 ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 11 12:26:07 2019
@author: Kazuki
nejumi_solution_PublicLB0.701
"""
import numpy as np
import pandas as pd
import os, gc
from tqdm import tqdm
from category_encoders import OrdinalEncoder, TargetEncoder
import utils
utils.start(__file__)
PREF = ... |
# ##
# Copyright 2016 <NAME>, 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 applica... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import sys
import platform
import time
import Xlib.X
import Xlib.display
import ewmh
import pyautogui
from pygetwindow import PyGetWindowException, pointInRect, BaseWindow, Rect, Point, Size
DISP = Xlib.display.Display()
ROOT = DISP.screen().root
EWMH = ewmh.EWMH(_di... |
import collections
import configargparse
from flask import Flask, Response, send_from_directory
from flask_cors import CORS
import jinja2
import json
import os
import pandas as pd
import pkg_resources
import pkgutil
import re
import requests
import shutil
import sys
from flipbook.utils import get_relative_directory_to... |
from asyncio.locks import BoundedSemaphore
import csv
import json
from collections import namedtuple
from typing import Any, List, Tuple, Set, Dict
import asyncio
import httpx
from enum import Enum, auto
from jwcrypto import jwk as _jwk
IssuerEntry = namedtuple('IssuerEntry', 'name iss website canonical_iss')
IssuerEnt... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2021 Idiap Research Institute, http://www.idiap.ch/
# Written by <NAME> <<EMAIL>>
#
import re
import copy
import logging
import torch
import torch.nn as nn
import numpy as np
import jsonpickle
from . import IDENTIFIER
from .Config import Config
from .FF... |
"""
I3DRSGM python package
This module is for using I3DR Semi-Global Matcher in Python.
"""
import os
import subprocess
import shutil
import numpy as np
import cv2
import wget
import zipfile
import sys
# Exceptions
'''
class ImageSizeNotEqual(Exception):
"""Image size not equal exception"""
def __str__(self):... |
# coding: utf-8
# # Graded Programming Assignment
#
# In this assignment, you will implement re-use the unsupervised anomaly detection algorithm but turn it into a simpler feed forward neural network for supervised classification.
#
# You are training the neural network from healthy and broken samples and at later ... |
import sys
import os
import traceback
import boto3
import numpy as np
import io
import argparse
from PIL import Image
import math
import shortuuid as su
import json
import scipy.ndimage as nd
from skimage import io
from skimage.filters import gaussian
from skimage.exposure import histogram
from skimage.filters import t... |
# ***************************************************
# This is an example program for
# a Word Clock using Raspberry Pi B+, Waveshare ePaper Display and ProtoStax enclosure
# --> https://www.waveshare.com/product/modules/oleds-lcds/e-paper/2.7inch-e-paper-hat-b.htm
# --> https://www.protostax.com/products/pro... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import base64
import json
import logging
import threading
import ssl
import os
import sys
import websocket
import time
from . import exceptions
from . import application
from . import wake_on_lan
from .utils import LogIt, LogItWithReturn
logger = logging.... |
from flask import Flask, Blueprint, render_template, request, send_file, Response
from flask_bower import Bower
import io
from os import environ
import datetime
import string
import json
import sys
import azure
import os
import requests
import time
import re
import operator
import numpy as np
from requests import get, ... |
from SVG_lib import point, Line
from CurveManip import rotate, mirror
from New_Spline import Spline
import os
from numpy import ceil, log10
from Supports import pinned, roller
from collections import namedtuple
Corners = namedtuple("Corners","left top width height")
def adjust_viewbox(corners, support_points, deformed... |
# Copyright 2021 <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, softwar... |
# https://deeplearningcourses.com/c/deep-reinforcement-learning-in-python
# https://www.udemy.com/deep-reinforcement-learning-in-python
from __future__ import print_function, division
from builtins import range
# Note: you may need to update your version of future
# sudo pip install -U future
import copy
import gym
im... |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import re... |
# Copyright 2019 Nokia
# Licensed under the BSD 3 Clause Clear license
# SPDX-License-Identifier: BSD-3-Clause-Clear
import pandas as pd
import numpy as np
from datetime import datetime
import math
# increments = 0
# search_range = 0
# P7_NUM = 0
# current_date = 0
# qq_plot_start = 5
# qq_plot_end = ... |
#!/usr/bin/env python
#
# Copyright (c) 2018 SAP SE
# 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
#
# ... |
import sys
from datastorage import DataStorage as ds
from sr import undulator
from sr import abcd
import numpy as np
from matplotlib import pyplot as plt
def source_id18(period=20, length=2.5, energy=8):
u = undulator.get_cpmu(period=period, length=length)
pars = u.find_harmonic_and_gap(energy)[0]
b = u.p... |
#
# PrototypeModel_Similarities_ClusteringAlgorithm.py
#
#
# Copyright 2017 <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 re... |
import kivy
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.gridlayout import GridLayout
from kivy.uix.button import Button
from kivy.uix.label import Label
from kivy.uix.tabbedpanel import TabbedPanel
from kivy.uix.textinput import TextInput
from kivy.properties import ObjectPro... |
"""
Generates mean distance error (MDE) curve for the given detections and ground truth BB3TXT files.
The script generates several files - a PDF plot, PNG plot and CSV files with the values specifying
the curve.
This measure was introduced in [Mousavian, Arsalan, et al. "3D Bounding Box Estimation Using Deep
Learning ... |
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 23 16:55:18 2019
@author: fede
"""
#The N modes gaussian states are represented as Z, a NxN complex valued adjacency matrix as described in https://arxiv.org/abs/1007.0725
#or as CM, a 2Nx2N covariance matrix.
#The notation for the quadratures is to stack the position ve... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# @uthor : TheAsouka
# BTC address : 16Jg3VFJsWVkip2c5yCHo2bEBustkxQZpW
# ETH address : 0x3FF703Af55f5Ee0870f44A51d08f753A1f192Fcd
# Feel free to be generous
import re, sys, os, json, argparse, time
from urllib.request import urlopen
from random import randint
def Argum... |
"""Interface to Sage accounting ODBC
This provides an interface to extract data from the accounting system.
It works by extracting the data into a Pandas dataframe and then doing queries from that.
"""
import json
import numpy as np
import pandas as pd
import pyodbc
import os
from dotenv import load_dotenv, find_do... |
from keras.models import *
from keras.layers import *
from keras.optimizers import *
from keras.callbacks import EarlyStopping, ReduceLROnPlateau, ModelCheckpoint
import matplotlib.pyplot as plt
def BatchActivate(x):
x = BatchNormalization()(x)
x = Activation('relu')(x)
return x
def convolution_block(x, ... |
import logging
import re
from asyncio import get_event_loop, iscoroutinefunction, AbstractEventLoop
from concurrent.futures import Executor
from functools import wraps
from inspect import isawaitable, getattr_static
from traceback import format_exception
from typing import (
Optional, Callable, Any, Sequence, Dict,... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
clean_ti_strategies
This module contains strategies to parse and clean time indexes in worksheets
cotaining time data series.
Warning! Do not import other classes directly "from module import Class",
except if they are custom exceptions.
Rather import the module in w... |
# Copyright (c) 2020 PaddlePaddle 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 appli... |
import logging
import json
import os
import argparse
import csv
import hashlib
import sys
try:
from mapping_classes import InputClass
except ImportError:
sys.path.insert(0, os.path.abspath(os.path.join(os.path.split(__file__)[0], os.path.pardir, "src")))
from mapping_classes import InputClass
from mapping_cl... |
import copy
from rlcard.games.doudizhu.utils import CARD_TYPE
#from douzero.dmc.utils import act
EnvCard2RealCard = {3: '3', 4: '4', 5: '5', 6: '6', 7: '7',
8: '8', 9: '9', 10: 'T', 11: 'J', 12: 'Q',
13: 'K', 14: 'A', 17: '2', 20: 'B', 30: 'R'}
RealCard2EnvCard = {'3': 3, '4': ... |
import re
import sqlite3
from datetime import timedelta
from math import ceil
from time import sleep
from typing import Callable, Dict, List, Tuple, Union
import pendulum
import requests
from bs4 import BeautifulSoup, Tag
from more_itertools import grouper
import config
EXAMPLE_MAIN = 'example-urgent_quests.html'
E... |
#
# Copyright (c) 2018-2020 FASTEN.
#
# This file is part of FASTEN
# (see https://www.fasten-project.eu/).
#
# 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 ownershi... |
import ast
import re
from math import ceil, floor
import simpleeval
from simpleeval import DEFAULT_NAMES, EvalWithCompoundTypes, IterableTooLong, SimpleEval
from api.avrae.cogs5e.funcs.dice import roll
from api.avrae.cogs5e.models.errors import ConsumableException, EvaluationError, FunctionRequiresCharacter, InvalidA... |
#!/usr/bin/env python
# MIT License
# Copyright (c) 2018 <NAME> (@disloops)
# 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... |
#!/usr/local/bin/python3.4
#
# <NAME>, Revision 2016-01-06
"""Classes for GISTEMP data.
Primarily, the classes herein support monthly temperature series.
Typically these are either for stations (station records) or subboxes
(subbox series). In either case the same class is used, `Series`,
differing in what keyword a... |
# -*- coding: utf-8 -*-
"""
TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-权限中心(BlueKing-IAM) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance with th... |
from typing import List, Optional, cast
import dash_bootstrap_components as dbc
from dash import ALL, MATCH, Input, Output, State, callback, dcc, html, no_update
from dash.development.base_component import Component
from envinorma.models import AMMetadata, AMSource, AMState, Classement, Regime
from envinorma.utils imp... |
from __future__ import division
import argparse
import json
import sys
from enum import Enum
from pyomo.environ import *
from pyomo.opt import SolverFactory
letters = "qwertyuiopasdfghjklzxcvbnm,./;" # TODO read as input / from config
weights = [[3.5, 2.4, 2.0, 2.2, 3.4, 3.4, 2.2, 2.0, 2.4, 3.5],
[1.5, 1.2,... |
### fetches.py
##
## Copyright (c) 2010 - 2022 Regents of the University of Colorado
##
## fetches.py is part of CUDEM
##
## 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 restrict... |
import stat
from enum import Enum
import pathlib
from pathlib import PurePosixPath, PureWindowsPath
from typing import (Callable, Generator, Iterable, List, Optional, Tuple,
TYPE_CHECKING, Union)
if TYPE_CHECKING:
from cerulean.file_system_impl import FileSystemImpl
class EntryType(Enum):
... |
from threading import Thread
from spock.client import Client
from spock.plugins import DefaultPlugins
from spock.plugins.core.event import EventPlugin
from spock.plugins.helpers.clientinfo import ClientInfoPlugin
from spock.plugins.helpers.move import MovementPlugin
from spock.plugins.helpers.world import WorldPlugin
... |
#!/usr/bin/env python
from sys import argv
import os, csv, json
import pandas as pd
import numpy as np
import subprocess
from pathlib import Path
def user_init(my_parameters_file, my_input_file, user_data):
pd.set_option("mode.chained_assignment", None)
user_folder = user_data + os.path.basename(my_input_file... |
""" This file contain function who configures web services """
import time
from colorama import Fore, Style
from .logic_actions_utils import wget, create_execute_command_remote_bash, change_permission, change_fileorfolder_user_owner, change_fileorfolder_group_owner, update, install, upload_file, restart_service, delete... |
"""
Author: <NAME> 2019
"""
# TODO handle empty test suite (empty, not included or excluded)
import time
from io import StringIO
from sys import exc_info
from inspect import getsource
from unittest import TestLoader
from unittest.case import SkipTest
from threading import Lock, Event
from collections import defaultdi... |
import torch
import torch.nn as nn
from torch import Tensor
class Sinkhorn(nn.Module):
r"""
Sinkhorn algorithm turns the input matrix into a bi-stochastic matrix.
Sinkhorn algorithm firstly applies an ``exp`` function with temperature :math:`\tau`:
.. math::
\mathbf{S}_{i,j} = \exp \left(\fr... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
""" `pipeline` module provides tools to create a pipeline of tasks
a pipeline can be composed of one or several branches, but
everything runs in a single thread. The initial goal of this
framework is to provide a simple and direct way of defining task
typ... |
'''
root/code/factory.py
Overview:
factory class will be tasked with building/__init__ all the other classes.
that way we can wrap other debugging + logging items around the init of each class
Rules:
mention any assumptions made in the code or rules about code structure should go here
'''
### packages
import os
impo... |
# Source package: "py3dbp" hosted on PyPI
# (c) <NAME>
# https://github.com/enzoruiz/3dbinpacking
# License: MIT License
# Credits:
# - https://github.com/enzoruiz/3dbinpacking/blob/master/erick_dube_507-034.pdf
# - https://github.com/gedex/bp3d - implementation in Go
# - https://github.com/bom-d-van/binpacking - imple... |
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
""" Evaluation routine for 3D object detection with SUN RGB-D and ScanNet.
"""
import os
import sys
import numpy as np
from datetime import datetime
import argparse
import importlib
import torch... |
'''Train Fer2013 with PyTorch.'''
# 10 crop for data enhancement
from __future__ import print_function
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "1"
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import torch.backends.cudnn as cudnn
import torchvision
import transfor... |
import copy
import time
import itertools
from MrBasicWff import *
##### printing
print_option = True
output_string = ""
def printer(str):
global print_option
if print_option:
print(str)
else:
global output_string
output_string = output_string + str + '\n'
##### determining whethe... |
import mxnet as mx
import numpy as np
import time
import os
import logging
from datetime import datetime
from subprocess import call
from types import ModuleType
def setGPU(gpus):
len_gpus = len(gpus.split(','))
os.environ['CUDA_VISIBLE_DEVICES'] = gpus
gpus = ','.join(map(str, range(len_gpus)))
return... |
"""
Based on Deit: Facebook, Inc.
https://github.com/facebookresearch/deit/blob/main/main.py
"""
import argparse
import datetime
import time
import os
import logging
import torch.backends.cudnn as cudnn
import json
import torch
import numpy as np
from pathlib import Path
from timm.data import Mixup
from timm.models i... |
# coding: utf-8
""" rawqc_atropos: A wrapper of Atropos to trim adapters with automatic
detection of adapters.
"""
import os
import shutil
import subprocess as sp
import tempfile
import uuid
from collections import OrderedDict
import click
from rawqc import Atropos
from rawqc import logger
def _create_tmp_fastq(r... |
"""The enumeration of charset code pages"""
# -*- coding:utf-8 -*-
class EncodingInfo(object):
"""Represents a charset/encoding page."""
all_charsets = {}
_all_charsets_lower_cased_name = {}
# the name of the charset
name: str = None
# the code page of the charset
code_page: str = None... |
#!/usr/bin/env python
#-------------------------------------------------------------------------------
# Name: Sequitr
# Purpose: Sequitr is a small, lightweight Python library for common image
# processing tasks in optical microscopy, in particular, single-
# molecule imaging, super-resolution... |
"""
Functions to download example data from public repositories.
"""
from .base import InputFiles, InputFilesWithSession
import os
import os.path as op
from pathlib import Path
def get_dataset(output_dir, source='HBN'):
if source in ['HBN']:
get_hbn_data(output_dir)
else:
raise ValueError('In... |
from jinja2 import Template
from shutil import which
from time import gmtime, strftime
import argparse
import fnmatch
import functools
import getpass
import logging
import operator
import os
import pwd
import re
import shlex
import signal
import socket
import subprocess
import sys
import time
"""
TODO:
- More option... |
import argparse
from tqdm import tqdm
import numpy as np
from allennlp import pretrained
import json
import typing
import copy
import pandas as pd
from typing import List, Dict, Union, Any
import spacy
from collections import defaultdict, Counter
import pickle as pkl
# Pandas helper functions
def count_unique(df, col... |
from bin.TrainingData import TrainingData
from bin.Agent import Agent
from bin.Util import writeMemoryintodisk, readDataintoDisk, group2test
from numpy.random import choice, seed, normal
import os
import numpy as np
from bin import Parameter
maxRunLength = 100
np.seterr('raise')
def init(mTestID, file, l):
global... |
from tina.advans import *
from voxelizer import MeshVoxelizer
@ti.func
def list_subscript(a, i: ti.template()):
if ti.static(isinstance(i, ti.Expr)):
k = i
ret = sum(a) * 0
for j in ti.static(range(len(a))):
if k == j:
ret = a[j]
return ret
else:
... |
# -*- coding: utf-8 -*-
from src.env import DATA
from src.postproc.utils import load_elec_file, order_dict
from analysis.fig1_fig2_and_stats import plot_matrix, multipage
from analysis.bha import cross_modularity
import os
from os.path import join as opj
import numpy as np
import scipy.io as sio
from matplotlib import... |
# -*- coding: utf-8 -*-
from collections import defaultdict
from datetime import timedelta, datetime, date
from dateutil.relativedelta import relativedelta
import pandas as pd
from pytz import utc
from odoo import models, fields, api, _
from odoo.http import request
from odoo.tools import float_utils
ROUNDING_FACTOR ... |
from sklearn import datasets
import numpy as np
import matplotlib.pyplot as plt
from logistic import init, getInsampleLoss, getOutsampleLoss
def genY(mu):
return np.random.binomial(1, 1 / (1 + np.exp(-mu)))
def generate_synthetic_data(n, p, gamma):
# General a toy dataset: true logistic-based two classes but w... |
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # for removing unnecessary warnings
from absl import logging
logging._warn_preinit_stderr = 0
logging.warning('...')
import tensorflow as tf
import numpy as np
import pandas as pd
from scipy import interpolate
from tensorflow import keras
import evidential_de... |
import asyncio
import concurrent.futures
import inspect
import traceback
import sys
from typing import (
List,
Tuple
)
from src import exceptions
from src.discovery import discover_suite
from src.enums import Status
from src.logger import SuiteLogManager
from src.models.result import (
Result,
TestMeth... |
from pulp import *
from allc.node import *
from collections import OrderedDict
import math
LpVariable.__truediv__ = LpVariable.__div__
def visit_helper(node, func, visitor=None):
if not isinstance(node, Node):
return node
if visitor:
return Node(node.op, *[func(arg, visitor) for arg in node.a... |
"""
This is a chunk which includes all steps for
preprocessing of sentinel-1 GRD or sentinel-2 products.
Author: <NAME>
Maintainer: <NAME> (<EMAIL>)
"""
import sys
import logging
import shutil
import time
import multiprocessing as mp
from datetime import datetime
from os.path import exists
from .sentinel_client import... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 21 15:49:29 2019
@author: gsolana
https://oceanpython.org/2013/02/11/plot-a-ctd-profile/
https://ocefpaf.github.io/python4oceanographers/blog/2013/07/29/python-ctd/
https://matplotlib.org/3.1.1/tutorials/introductory/lifecycle.html#sphx-glr-tutori... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.