text stringlengths 3.07k 22.1k |
|---|
import os
import six
import itertools
from dftinputgen.data import STANDARD_ATOMIC_WEIGHTS
from dftinputgen.utils import get_elem_symbol
from dftinputgen.utils import get_kpoint_grid_from_spacing
from dftinputgen.qe.settings import QE_TAGS
from dftinputgen.qe.settings.calculation_presets import QE_PRESETS
from dftinp... |
import os
import random
from PIL import Image
import numpy as np
from torch.utils.data import Dataset
from torch.utils.data import DataLoader
from torch.utils.data.sampler import SubsetRandomSampler
import torchvision.transforms as transforms
from data_aug.gaussian_blur import GaussianBlur
from data_aug.cutout import ... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import pickle
import numpy as np
import random
import pprint
from dataloader import XLMRUDDataloader, dataloader
from IPython import embed
from sklearn.metrics import f1_score
from model import MorphologicalTagger
from collec... |
import sys
from concurrent.futures import Future
from contextlib import nullcontext, suppress
from functools import partial
from typing import (
Any,
Callable,
Dict,
List,
Optional,
Set,
Type,
TypeVar,
Union,
get_origin,
)
from typing_extensions import get_args, get_type_hints
... |
from typing import List
from pyhcl.ir.low_ir import *
from pyhcl.ir.low_prim import *
from pyhcl.passes._pass import Pass, PassException, Error
from pyhcl.passes.utils import times_f_f
from pyhcl.passes.wir import WrappedType
# Custom Exceptions
class SubfieldNotInBundle(PassException):
def __init__(self, info: I... |
from pkgutil import iter_modules, walk_packages
from importlib import import_module
import importlib.util as imp
import ast
import itertools as it
import os.path as osp
import os
import networkx as nx
MODULE_SEPARATOR = '.'
CLASS_METHOD_SEPARATOR = '.'
AST_FUNCTION_CLASS = ast.FunctionDef
AST_CLASS_CLASS = ast.Clas... |
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 23 12:30:52 2021
@author: zzhang
"""
import pandas as pd
import numpy as np
import yaml
from schimpy.schism_setup import create_schism_setup
def read_source_sink_yaml(yaml_fn):
"""
Parameters
----------
yaml_fn : STR
source_sink.yaml filename.
... |
# Copyright (c) 2021, NVIDIA CORPORATION. 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 applic... |
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 12 13:19:35 2018
@author: stlk
"""
#%%
#%%
#### Motivation
## Alternative approach:
### In fact, use of selenium wasn't necessarian: even despite the fact that urls provided
### in archive redirect to the non-existing page. Best approach is to parse urls from the pag... |
# File format:
# 0. Tagline
# Optional: <!-- ZK<optional string> -->
# 1. Header (enclosed in '---')
# Mandatory: Date, ID
# Optional: Author, Modified, Tags, Title
# Example:
# ---
# Date: 2019-02-10 16:22:16
# Modified: 2019-02-11 18:24:10
# Author: <NAME>
# ... |
import copy
import time
from time import sleep
import math3d as m3d
import urx
from math import pi
import numpy as np
# from GTac_Data import gtac_data
import GTac_Data
def safty_check(robot, goal_tool, x_lim, y_lim, z_lim):
# units: meter
goal_tool_transform = m3d.Transform(goal_tool)
# print('To execute ... |
import torch
import torchvision.transforms as transforms
import numpy as np
import os
import math
import random
import time
import pyrr
import sys
import copy
from GQN.model import GenerativeQueryNetwork
from argparse import ArgumentParser
from util.datasets import RTRenderedDataset
from util.config import configure, ... |
"""
Script for running simulations in the binary effort, unbiased agents setting.
@author: <NAME> <<EMAIL>>
"""
from numpy import ones
from statistics import mean, median, variance
import json
from setup import initialize_student_list, shuffle_students, initialize_submission_list
from grading import assign_grades, a... |
from torch import nn
import torch
from torch import autograd
import torch.nn.functional as F
from src.config import conf
class LabelSmoothing(nn.Module):
"""
NLL loss with label smoothing.
"""
def __init__(self, smoothing=0.1):
"""
Constructor for the LabelSmoothing modu... |
import asyncio
import threading
from functools import partial
import time
import pytest
@pytest.mark.asyncio
async def test_aio_event_lock(listener, sender):
loop = asyncio.get_event_loop()
sender.register_event('on_test')
sender.bind(on_test=listener.on_event)
letters = 'abcdefghijkl'
sender.em... |
# -*- coding: utf-8 -*-
"""
Visualize.py
"""
import matplotlib.pyplot as plt
import geopandas as gpd
from bokeh.plotting import figure, save
from bokeh.models import ColumnDataSource, HoverTool, LogColorMapper
from bokeh.palettes import Plasma256 as palette
import pysal as ps
from shapely.geometry import ... |
#import numpy as np
#import matplotlib
import networkx as nx
import sys
from osgeo import ogr
import time
shapefile = sys.argv[1]
#shapefile = "D://pc//Documents//ENSG//IT2//Projet Développement//donnees//1854_emprise.shp"
#shapefile = "D://pc//Documents//ENSG//IT2//Projet Développement//donnees//1871_L... |
import torch
import dill
import os
import numpy as np
import pandas as pd
from tqdm import tqdm
from sklearn.metrics import average_precision_score
from Networks import Encoder
from Networks import DecoderGRUCover, DecoderSumCover
from Parameters import Params
params = Params()
class Evaluation... |
from __future__ import annotations
import dataclasses
import os
from contextlib import ExitStack
from dataclasses import dataclass
from typing import AnyStr, List, Tuple, Union, Sequence
from ._fs import ffi, lib
from .fs import build_error, ioctl
from .util import check_nonnegative
__all__ = ['fideduperange', 'dedu... |
from typing import Dict, List, Set, Union
from collections import defaultdict, Counter
import re
from fuzzy_search.fuzzy_string import SkipGram, text2skipgrams
def is_valid_label(label: Union[str, List[str]]) -> bool:
"""Test whether label has a valid value.
:param label: a phrase label (either a string or ... |
#
# Copyright (c) 2014 <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, publish, distribu... |
import cv2
import dlib
import argparse
import os
import sys
import numpy as np
from dialogue_box import *
# command line arguments
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--input_video", help="The relative path of the video", required=True)
parser.add_argument("-s", "--save_path", help="The path ... |
import nltk.lm as lm
from nltk.lm.preprocessing import padded_everygram_pipeline
from nltk.lm import MLE, KneserNeyInterpolated
from nltk.corpus import brown, reuters, gutenberg, treebank
import os
from nltk.tokenize import sent_tokenize, word_tokenize
import sys
from kneserngram import KneserNeyNGram
from math import ... |
import argparse
from distutils.util import strtobool
import numpy as np
import torch
from pathlib import Path
from torch.utils.data import DataLoader
from torch.utils.data.dataset import Subset
from l5kit.evaluation import write_pred_csv
from l5kit.data import LocalDataManager, ChunkedDataset
from l5kit.dataset impor... |
# Date: 06/07/2018
# Author: Pure-L0G1C
# Description: Interface for the master
from os import path
from re import match
from lib import const
from . import ssh, sftp
from hashlib import sha256
from time import time, sleep
from os import urandom, path
from threading import Thread
from datetime import datet... |
from Input.preprocess import *
from vehicle import Vehicle
from Output.save_to_excel import *
from Simulation.BSS_environment import Environment
import copy
import pandas as pd
from openpyxl import load_workbook
start_hour = 7
no_stations = 200
branching = 7
subproblem_scenarios = 10
simulation_time = 960 # 7 am to ... |
#!/usr/bin/python2.7
# coding: utf-8
import matplotlib.pyplot as plt
import xlrd
import numpy
import math
import operator
import re # exoressions régulières
import copy
from scipy import stats
import gestion_figures
def enum(*sequential, **named):
enums = dict(zip(sequential, range(len(sequential))), **named)
... |
#!/bin/python
import sympy
from scipy.io import wavfile
import numpy as np
from rich import print
import pretty_errors
import random
from matplotlib import pyplot as plt
import math
import soundfile as sf
#####################################################################################
# Important Variables
####... |
# GENERATE IDA-FORMAT OBSERVATIONS FILE
# ----------------------------------------------------------------------
# Copyright (c) 2017 <NAME>.
#
# See the LICENSE file for details
# ----------------------------------------------------------------------
#--------------------
# System wide imports
# -------------------... |
"""geolocation functionality."""
import itertools
import json
import requests
from geographies_list import (
ALL_COUNTRIES,
CITY_COUNTRY_DICT,
CODE_COUNTRY_DICT,
STATE_ABBREV,
STATE_NAMES,
CITY_COUNTRY_STRINGS,
METRO_AREA_COUNTRY_DICT,
SPECIAL_CITIES,
)
GITHUB_USERNAME = "jspeed-meye... |
import cv2
import numpy as np
def mask_pixels(Image: np.array, mask: np.array):
"""
This function extracts the pixels inside the mask and returns a 3D image with a single row.
It also returns the indices belonging to the extracted pixels for reconstruction
:param: Image : The RGB image in format (-,-,... |
#!/usr/bin/env python3.6
import os
import json
from glob import glob
from hashlib import md5
from functools import wraps
import robobrowser
import rdflib
from pyontutils.core import makeGraph
from pyontutils.scigraph import Vocabulary
from pyontutils.namespaces import makePrefixes
# ilx api implementation (will chang... |
import l5kit
assert l5kit.__version__ == "1.1.0"
import numpy as np
import pandas as pd
import os
import torch
import time
from torch import nn, optim
from torch.utils.data import DataLoader
from torchvision.models.resnet import resnet50
from tqdm.notebook import tqdm
from typing import Dict
from l5kit.data import L... |
#!/usr/bin/env python
import sys
import os
try:
import readline; assert readline
except:
pass
import platform
import os.path as op
from uuid import uuid4
from copy import deepcopy
from datetime import datetime
from socket import gethostname
from hashlib import sha256
import peewee as pw
import click
STORAGE_DB ... |
from django.shortcuts import render, get_list_or_404
from django.http import HttpResponse
from .models import SkinType, SkinConcern, Option, Question, Questionnaire, QuestionnaireUserData, QuestionnaireEntry
from home.models import Ingredient, Base, MixingAgent, Recipe, FacePack, CustomFacePack, SkinTypeIngredient, Sk... |
import pytest
from scipy.optimize import check_grad
import numpy as np
import jax.numpy as jnp
from itea.regression import ITExpr_regressor, ITEA_regressor
from jax import grad, vmap
from sklearn.datasets import make_regression
from sklearn.linear_model import LinearRegression
from s... |
"""
Defines classes for handling the inputs to underlying algorithms.
:author: <NAME>
:date: Nov 2021
"""
from .exceptions import *
from .validators import *
# TODO: MID, Check to see if the "directedness" of the algorithm could depend on the networkx.Graph at the input so that the parameter value is set automatica... |
import os
# Write a function to return a list of the first n numbers in the Fibonacci string.
# F{n}=F{n-1}+F{n-2}
def first_n_numbers_in_fibonacci(n):
if n < 1:
return []
if n is 1:
return [0]
if n is 2:
return [0, 1]
fibonacci = [0, 1]
for i in range(2, n):
fi... |
import pandas as pd
import numpy as np
from keras.models import load_model
from keras.wrappers.scikit_learn import KerasClassifier
from sklearn.model_selection import cross_val_score
from sklearn.preprocessing import StandardScaler
from sklearn.preprocessing import LabelEncoder
from sklearn.model_selection import KFold... |
# This file is part of the pyMOR project (http://www.pymor.org).
# Copyright 2013-2016 pyMOR developers and contributors. All rights reserved.
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
import numpy as np
from pymor.core.logger import getLogger
from pymor.core.interfaces import Immu... |
import signal
import operator
from functools import reduce
from weakref import ref, WeakKeyDictionary
import types
from inspect import Parameter, Signature
import itertools
from collections import OrderedDict, Iterable
import sys
import numpy as np
from cycler import cycler
import logging
logger = logging.getLogger(__n... |
from subprocess import Popen, PIPE
from math import *
import random
import random as pr
import numpy as np
from copy import deepcopy
##from types import ListType, TupleType, StringTypes
import itertools
import time
import math
import argparse
import subprocess
from rdkit.Chem.QED import qed
from load_model import load... |
# python3
# make_train_dev_test.py
# Mars Target Encyclopedia
# This script makes within-sentence container examples for training, development and test set.
#
# <NAME>
# July 30, 2021
# Copyright notice at bottom of file.
import re, pickle, sys, argparse, random, json, os
from sys import stdout
from copy import deepco... |
# This file is part of qdpy.
#
# qdpy is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# qdpy is distributed ... |
# -*- coding: utf-8 -*-
# -*- author: JeremySun -*-
# -*- dating: 21/4/9 -*-
"""AVL树的旋转实现"""
class BiTreeNode(object):
def __init__(self, data):
self.data = data
self.lchild = None
self.rchild = None
self.parent = None
class BST(object):
def __init__(self, li... |
import torch
import torch.nn.functional as F
import argparse
import cv2
import numpy as np
from glob import glob
import copy
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from collections import OrderedDict
Class_label = ['akahara', 'madara']
Class_N = len(Class_label)
img_height, img_width = 128, 128
cha... |
"""FRDR Harvester
Usage:
harvest.py [--openrefine-import | --onlyharvest | --onlyexport | --init] [--only-new-records] [--dump-on-failure] [--export-filepath=<file>] [--export-format=<format>] [--repository-id=<id>] [--openrefine-csv=<file>]
Options:
--openrefine-import Don't harvest or export normally; imp... |
import torch
import torch.nn.functional as F
from torch import nn
from torch.distributions import Normal
from torch.nn.utils import spectral_norm as snorm
'''
Classifier for categorizing the adversarial examples, (similar to the classifier in MagNet: https://arxiv.org/pdf/1705.09064.pdf)
MNIST accuracy: 0.993100
Fash... |
from policy_driven_attack import policy
from policy_driven_attack.models.standard_model import StandardPolicyModel
import math
import numpy as np
import h5py
import dill
import torch
import os.path as osp
def load_weight(model, fname):
if len(fname) == 0 or not osp.exists(fname):
raise ValueError('Invalid... |
import argparse
import io
import select
import sys
import time
from functools import partial
from typing import List, Callable
import bcrypt
import bluetooth
import boto3
import picamera
import RPi.GPIO as GPIO
from botocore.exceptions import ClientError
relay_ch1_pin = 37
face_similarity_threshold = 80.0
class Bu... |
import sys
import numpy as np
import math
from copy import copy, deepcopy
import time
from CalcDistPointToCubic import calcDistPointToCubic
class CubicFunction :
def __init__(self, a, b, c, d, lower, upper):
self.a = a
self.b = b
self.c = c
self.d = d
self.domain_lower = lower
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
#######################################
# Script que permite la generación de mapas
# meteorológicos extremos
# Author: <NAME>
# Email: <EMAIL>
# Date: Created on Thu Sep 28 08:38:15 2017
# Version: 1.0
#######################################
"""
import numpy as np
im... |
from models import UMNNMAFFlow
import torch
import lib.toy_data as toy_data
import numpy as np
import matplotlib.pyplot as plt
from timeit import default_timer as timer
import os
import lib.utils as utils
import lib.visualize_flow as vf
green = '#e15647'
black = '#2d5468'
white_bg = '#ececec'
def summary_plots(x, x_te... |
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright SAS Institute
#
# 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 logic
from logic import Solver, Diagram
import syntax
from syntax import Expr
import relaxed_traces
from translator import Z3Translator
import utils
import copy
import argparse
from typing import Iterable, List, Tuple, Optional, Set
def get_cti(s: Solver, candidate: Expr) -> Optional[Tuple[Diagra... |
from collections import defaultdict
from typing import Dict
import pytest
@pytest.mark.parametrize(
"input_string, expected",
[
("", ""),
("ABC", "ABC"),
("ABC\n", "ABC"),
("ABC\n\n", "ABC"),
("ABC\n\nAB -> C", "ABC"),
],
)
def test_parse_polymer_template(input_str... |
import torch
import torch.nn as nn
from .backbones.resnet import ResNet, Bottleneck
from .backbones.resnet_ibn_a import resnet50_ibn_a,resnet101_ibn_a,resnet50_ibn_a_LeakyRelu
from .backbones.efficientnet import EfficientNet
from .backbones.resnest import resnest101, resnest50, resnest200, resnest269
from .backbones.re... |
import cv2, pickle
import numpy as np
import tensorflow as tf
from cnn_tf import cnn_model_fn
import os
import sqlite3
from keras.models import load_model
import constants
from PIL import Image, ImageTk
from threading import Thread
import util
import time
import pyttsx3
speaking = True
vstream = raw = None
os.environ... |
"""
Addition operator.
Example usage
-------------
Distribution and a constant::
>>> distribution = chaospy.Normal(0, 1) + 10
>>> print(distribution)
Add(Normal(mu=0, sigma=1), 10)
>>> print(numpy.around(distribution.sample(5), 4))
[10.395 8.7997 11.6476 9.9553 11.1382]
>>> print(numpy.aro... |
"""
Authors: <NAME> (<EMAIL>),
<NAME> (<EMAIL>)
Copyright © 2021, United States Government, as represented by the Administrator
of the National Aeronautics and Space Administration. All rights reserved.
The HybridQ: A Hybrid Simulator for Quantum Circuits platform is licensed under
the Apache License, Versio... |
from flask import Blueprint, render_template, request, jsonify
from applications.common import curd
from applications.common.helper import ModelFilter
from applications.common.utils.http import table_api, success_api, fail_api
from applications.common.utils.rights import authorize
from applications.common.utils.valida... |
import os
import random
from collections import deque
from statistics import mean
import numpy as np
import torch
import torch.nn.functional as F
from torch import nn
from ubikagent.agent.abc import Agent
from ubikagent.noise import OUNoise
from ubikagent.buffer import ReplayBuffer
device = torch.device("cuda:0" if ... |
"""
@author <NAME>
"""
import copy
import functools
from matrix_calculus.matrix_expr import *
from matrix_calculus.matrix_expr_match import match_deepest, translate_case
CANONICAL_VERBOSE = True
def massage2canonical(expr, verbose=True):
"""
Massages the given expression
to canonical form with the dX
... |
"""
----------------------------------------------------------------------------------------------
(c) Copyright IBM Corporation 2020, 2021. All Rights Reserved.
IBM Spectrum Protect Family Software
Licensed materials provided under the terms of the IBM International Program
License Agreement. See the Software l... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# written by <NAME>
# 2016-10-16
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d.axes3d import Axes3D
import sys, os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from optimize import Optimize_linear
from growing... |
#BEGIN_LEGAL
#
#Copyright (c) 2019 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.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... |
import scipy.sparse as sparse
import scipy.sparse.linalg as spLA
from numpy import linalg as npLA
import numpy as np
import majoranaJJ.modules.constants as const
"""Descritized k-x operator"""
def kx(coor, ax, ay, NN, NNb = None):
row = []; col = []; data = []
N = coor.shape[0]
xmax = max(coor[:, 0])
... |
import numpy as np
import torch
from torch import nn
class SH_SelfAttention(nn.Module):
""" single head self-attention module
"""
def __init__(self, input_size):
super().__init__()
# define query, key and value transformation matrices
# usually input_size is equal to embed_... |
# generate a banner for the LAS Ecliptic
import gzip
import svgwrite
from math import atan2, cos, pi, sin, sqrt
bkgr_attrs = { # SVG attributes of background rectangle
'fill': '#060c64', # from LAS logo
'stroke': 'none',
}
eclpt_attrs = { # SVG attributes of ecliptic line
'stroke': '#ffc000', # '#01... |
import json
from uuid import uuid4
from django.conf import settings
from django.contrib import messages
from django.db import transaction
from django.http import HttpResponseRedirect, JsonResponse
from django.shortcuts import redirect, render, reverse
from django.utils.decorators import method_decorator
from django.ut... |
import os
import pathlib
import re
import shutil
import sys
def folder_processing(path, protected_folders):
"""Create list with all files"""
fileCollections = []
def __handler(path, protected_folders):
p = pathlib.Path(path)
if p not in protected_folders:
fileCollections.appen... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# NOTE: fab --show=debug if you need to debug stuff
import sys
import os
import pprint
import re
import string
# import collections
import time
from fabric.operations import sudo, os
from fabric.api import (
abort,
cd,
env,
get,
hide,
hosts,
l... |
readMe = '''This is a script to create a CSV file with all of the client devices in an organization.
The CSV file will be created in the same folder where this script is located. The script makes no attempt
to remove or combine duplicate entries. If you see the same client being reported several times, this is
... |
import wx
from nltk.tokenize import RegexpTokenizer
def combine_indexes(words_list_stemmed, files_list):
index, freq_word = create_inverted_index(files_list)
sum_freq = 0
index_list = []
print(words_list_stemmed)
for term in words_list_stemmed:
if term in index.keys():
print("... |
'''
This protocol can be used to find the rmsd between the residues in the binding pocket of every pair of structures of a protein
Only the residues within 4 angstroms of either structures' ligands are considered
# how to run this file:
# ml load chemistry
# ml load schrodinger
# $SCHRODINGER/run python3 rmsd_calculat... |
import argparse
import datetime
import logging
import os
import random
import shutil
from mir.commands import base
from mir.protos import mir_command_pb2 as mirpb
from mir.tools import annotations, checker, hash_utils, metadatas, mir_repo_utils, mir_storage_ops, revs_parser
from mir.tools.code import MirCode
from mir.... |
# -*- coding: utf-8 -*-
#
# Copyright 2015 AirPlug 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 applic... |
"""
https://github.com/LeMinhThong/blackbox-attack/blob/master/boundary_attack.py
"""
import time
import random
import numpy as np
import torch
import torch.nn as nn
import torchvision.datasets as dsets
import torchvision.transforms as transforms
from torch.autograd import Variable
import torch.nn.functional as F
from... |
import os
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
class DKVMN_IRT(nn.Module):
"""Adapted from the TensorFlow implementation.
https://github.com/ckyeungac/DeepIRT/blob/master/model.py
"""
def __init__(
self,
device,
ba... |
#
# nuna_sql_tools: Copyright 2022 Nuna Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020 CERN.
#
# CDS-ILS is free software; you can redistribute it and/or modify it under
# the terms of the MIT License; see LICENSE file for more details.
"""CDS-ILS EBL Importer dojson rules."""
import re
import pycountry
from dojson.errors import IgnoreKey
from dojson.util... |
"""
mod
~~~
Functions for modifying names.
"""
import base64 as b64
from functools import partial
from typing import Callable, Mapping, Optional, Sequence
from mkname.constants import CONSONANTS, PUNCTUATION, SCIFI_LETTERS, VOWELS
from mkname.dice import roll, seed
# Simple mods.
# Simple mods only require one para... |
import collections
import datetime
import itertools
import logging
import random
import re
import sqlite3
from rtmbot.core import Plugin
from .komida_parser import KomidaUpdate
def get_campus(text):
"""
Check which campus is mentioned in the given text.
A campus can be denoted by its full name or by it... |
from utils.build_utils import build_model, build_iterator, load_checkpoint, accumulate_batch
from utils.model_utils import validate
from utils.loss_utils import LabelSmoothingLoss
import re
import os
import copy
import math
import pickle
import numpy as np
import pandas as pd
from datetime import datetime
import torc... |
import pytest
import ebl.transliteration.domain.atf as atf
from ebl.lemmatization.domain.lemmatization import (
LemmatizationError,
LemmatizationToken,
)
from ebl.tests.asserts import assert_token_serialization
from ebl.transliteration.application.token_schemas import OneOfTokenSchema
from ebl.transliteration.... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Description:
Autor: <NAME>
Date: 2021-01-18 23:21:07
LastEditors: <NAME>
LastEditTime: 2021-04-05 17:36:50
'''
import numpy as np
import torch
np.random.seed(666)
torch.manual_seed(666)
torch.cuda.manual_seed_all(666)
torch.backends.cudnn.deterministic=True
torch.bac... |
#!/usr/bin/python3 -u
# -*- coding: utf-8 -*-
# Source: <NAME> USB monitor at
# https://github.com/dhylands/usb-ser-mon/blob/master/usb-ser-mon.py
"""Program which auto-connects to USB serial devices.
This program waits for the device to be connected and when the device
is disconnected, then it will go back to waiti... |
#!/usr/bin/env python3
import argparse
import copy
import json
import logging
import os
import textwrap
logging.basicConfig(level=logging.INFO)
def make_storage_update(storage_update, content):
if 'storage' not in content:
return storage_update
storage_update_template = textwrap.dedent('''
(en... |
import math
import random
from math import frexp, copysign
from sys import float_info
# Audio
def sound_load(filename):
px8_audio.sound_load(filename)
def sound_play(filename):
px8_audio.sound_play(filename)
def sound_stop(filename):
px8_audio.sound_stop(filename)
globals()["sound_load"] = sound_load
gl... |
import numpy as np
from random import sample, seed
from sklearn.base import BaseEstimator, RegressorMixin
from sklearn.exceptions import NotFittedError
import tensorflow as tf
def splitData(series, steps_ahead, fit_range, ratio = 0.7):
'''
Creates X_train, y_train, X_test, y_test, X_total
'''
seed(10)
... |
#!/usr/bin/env python
# Copyright (c) 2020 NVIDIA Corporation. All rights reserved.
# This work is licensed under the NVIDIA Source Code License - Non-commercial. Full
# text can be found in LICENSE.md
"""Test a PoseCNN on images"""
import torch
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import to... |
# 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
from shutil import which
import pytest
from smartsim.settings import (
MpiexecSettings,
MpirunSettings,
OrterunSettings,
RunSettings,
)
from smartsim.settings.settings import create_run_settings
def test_create_run_settings_local():
# no run command provided
rs = create_run_se... |
import sympy
from sympy.abc import x
from ._misc import hamming_weight
from ._zechlogs import get_representatives
__all__ = ['is_primitive', 'generate_primitives', 'get_associate_poly',
'lfsr_from_poly', 'seq_decimation', 'poly_decimation', 'get_special_state']
def is_primitive(poly):
"""
Checks w... |
def icp(a, b,
max_time=1
):
import cv2
import numpy
# import copy
# import pylab
import time
import sys
import sklearn.neighbors
import scipy.optimize
def res(p, src, dst):
T = numpy.matrix([[numpy.cos(p[2]), -numpy.sin(p[2]), p[0]],
... |
#!/usr/bin/env python
# coding: utf-8
# # N-BEATS
#
# ### Uses nbeats model as prediction of future.
# In[1]:
import os, sys
from tqdm import tqdm
from subseasonal_toolkit.utils.notebook_util import isnotebook
if isnotebook():
# Autoreload packages that are modified
get_ipython().run_line_magic('load_ext',... |
import numpy as np
import tensorflow as tf
from tensorflow.contrib.framework.python.ops import arg_scope, add_arg_scope
@add_arg_scope
def linear(name, x, num_units, init_scale=1., init=False):
with tf.variable_scope(name):
if init:
# data based initialization of parameters
v = tf.... |
# Copyright 2020-2021 ETH Zurich and the DaCe-VSCode authors.
# All rights reserved.
#####################################################################
# Before importing anything, try to take the ".env" file into account
import os
import re
import sys
try:
import dotenv
import re
import sys
# Firs... |
import sys
import argparse
import autopy
import datetime
from time import sleep
from screeninfo import get_monitors
from gtts import gTTS
from playsound import playsound
DEFAULT_WAIT = 1
SUPPORTED_RESOLUTIONS = ['2560 x 1440', '1920 x 1080']
def checkout(guest: bool = False):
if guest:
pas... |
import asyncio, discord, datetime, re
from geopy.geocoders import Nominatim
from discord.ext import commands
from Cogs import Message, PickList, Nullify, DL
def setup(bot):
# Add the bot
bot.add_cog(Weather(bot))
# This is the Weather module
class Weather(commands.Cog):
# Init with the bo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.