text stringlengths 3.07k 22.1k |
|---|
import os
import tempfile
import shutil
import pytest
from urllib.error import URLError, HTTPError
from rdflib import URIRef, Graph
from rdflib.store import VALID_STORE
from rdflib.exceptions import ParserError
from rdflib.plugin import PluginException
from rdflib.namespace import Namespace
from test.testutils import ... |
import numpy as np
import spacy
from past.builtins import xrange
class EnvTextEncoder:
def __init__(self, env, state_word2id):
self.word2id = state_word2id
self.id2template = env.get_id2template()
self.template2id = env.get_template2id()
self.id2obj = env.get_id2act_word()
... |
"""
PSF Utilities
"""
from photonpy.cpp.estimator import Estimator
import numpy as np
import matplotlib.pyplot as plt
from photonpy.utils.findpeak1D import gaussianpeak
import tqdm
from photonpy.cpp.phasor import Localize as PhasorLocalize
def upscale_fft(A, axes, factor):
fA = np.fft.fftshift(np.fft.fftn(A,ax... |
import time
import typing
import numpy as np
from manim.utils.hashing import get_hash_from_play_call
from .. import config, logger
from ..camera.camera import Camera
from ..mobject.mobject import Mobject
from ..scene.scene_file_writer import SceneFileWriter
from ..utils.exceptions import EndSceneEarlyException
from ... |
"""HypergridHarness for MetaClassifiers."""
import common_python.constants as cn
from common_python.experiment.experiment_harness import ExperimentHarness
from common_python.classifier.hypergrid_harness \
import Vector, Plane
from common_python.classifier.random_hypergrid_harness \
import RandomHypergridHarn... |
# Copyright 2018 The Texar 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 applicable ... |
import datetime
import time
import logging
import random
import simport
import six
from winchester.db import DBInterface, DuplicateError, LockError
from winchester.config import ConfigManager, ConfigSection, ConfigItem
from winchester.definition import TriggerDefinition
from winchester.models import StreamState
from w... |
# *****************************************************************************
#
# Copyright (c) 2019, the Perspective Authors.
#
# This file is part of the Perspective library, distributed under the terms of
# the Apache License 2.0. The full license can be found in the LICENSE file.
#
from __future__ import print_f... |
#!/usr/bin/python3
"""
Generate rollsum chunking modelling graphs.
Usage: %(cmd)s [dir]
"""
from chunker import *
import pickle
import sys
import matplotlib
matplotlib.use('svg')
import matplotlib.pyplot as plt
from matplotlib.ticker import *
# Dimensions for graphs;
#
# chunker (chunker, Weibull1, Weibull2, FastCDCC... |
from typing import TYPE_CHECKING
from selenium.webdriver.support.select import Select
from grouper.entities.group import GroupJoinPolicy
from itests.pages.base import BaseElement, BaseModal, BasePage
from itests.pages.exceptions import NoSuchElementException
from itests.pages.permissions import PermissionGrantRow
if... |
import datetime
from collections import OrderedDict
from pkg_resources import parse_version
import regex as re
import pandas as pd
from google.api_core.exceptions import NotFound
import google.cloud.bigquery as bq
from multipledispatch import Dispatcher
import ibis
import ibis.common as com
import ibis.expr.opera... |
"""
Provides some minimal help with building loss expressions for training or
validating a neural network.
Five functions build element- or item-wise loss expressions from network
predictions and targets:
.. autosummary::
:nosignatures:
binary_crossentropy
categorical_crossentropy
squared_error
b... |
import re
import sys
from waflib import Options
import os.path as osp
from waflib import Logs
from waflib import Context
from waflib import Errors
def options(ctx):
import optparse
grp = ctx.parser.get_option_group("--gcc")
if grp == None:
grp = optparse.OptionGroup(ctx.parser, "compiler options")... |
from concurrent.futures.process import BrokenProcessPool
import numpy as np
import pandas as pd
from munch import Munch
from plaster.tools.utils.utils import listi
from plaster.tools.zap import zap
from zest import MockFunction, zest
def test1(a, b, c):
return a + b + c
def test2(a, b, c):
raise ValueError
... |
import os
import re
from wencai.util.utils import ech, sort_filename
from PIL import Image
from tqdm import tqdm
def create_dest(dest, type=None):
if not dest:
dest = os.path.join(os.getcwd(), f'combined{type}')
os.makedirs(os.path.dirname(dest), exist_ok=True)
return dest
def pdf2jpg(pdfPath, i... |
import ast
import inspect
import logging
import math
import os
import torch
import numpy as np
import skyline.protocol_gen.innpv_pb2 as pm
from skyline.analysis.static import StaticAnalyzer
from skyline.exceptions import AnalysisError, exceptions_as_analysis_errors
from skyline.profiler.iteration import IterationProf... |
# Python 3
import fileinput
import glob
import shutil
import sys
import os
import re
import distutils.dir_util
VERSION_SHORT = "v.28"
VERSION_FULL = VERSION_SHORT + ", released 29 Nov 2020"
EXEC_UGLIFYJS_WIN = "{2}/lib/uglifyjs.cmd --parse bare_returns --compress --mangle toplevel --mangle-props keep_quoted,reserved... |
# -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# 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... |
# -*- coding: utf-8 -*-
"""
Parse and translate an EBNF grammar into a Python parser for
the described language.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import codecs
import argparse
import os
import sys
import importlib
from tatsu._version import __version__
from tatsu.u... |
#!/Users/nordin/anaconda3/bin/python
"""
Print tasks organized by project for specified date(s).
usage: byproject.py [-h] [-f FILE] [-v]
[-p PREV | -d DAY | -m MONTH | -w WEEK | -r RANGE RANGE | -a]
[-i INCLUDE [INCLUDE ...] | -x EXCLUDE [EXCLUDE ...]]
optional arguments:
-h,... |
import inspect
from collections import namedtuple
from sanic import Blueprint
from sanic import Sanic
from sanic_jwt import endpoints
from sanic_jwt import exceptions
from sanic_jwt.authentication import Authentication
from sanic_jwt.configuration import Configuration
from sanic_jwt.decorators import inject_user
fro... |
from __future__ import annotations
from dataclasses import dataclass
from typing import (
AbstractSet,
Callable,
Collection,
Iterable,
Iterator,
Mapping,
MutableSet,
Sequence,
cast,
)
from .codeblock import CodeBlock, Store
from .codeblock_builder import SemanticsCodeBlockBuilder
f... |
"""Routines to run cloth simulation in Maya + Qualoth"""
# Basic
from __future__ import print_function
import time
import os
# Maya
from maya import cmds
# My modules
from pattern.core import BasicPattern
import mayaqltools as mymaya
from mayaqltools import qualothwrapper as qw
# ----------- High-level requests --... |
# scripts for plotting various interpolation methods
import warnings
import numpy as np
import pandas as pd
import xarray as xr
## HELPER METHODS ##
# drop final year if any months within are missing or all nan, else skip
def drop_incomplete_first_year_wet_dry(ds):
try:
# tell user
print('Checking ... |
import os
import pickle
import gym
import numpy as np
import pandas as pd
import tensorflow as tf
import load_policy
def _get_env_policy(gym_envname):
fp_policy = os.path.join('experts', gym_envname + '.pkl')
policy_fn = load_policy.load_policy(fp_policy)
env = gym.make(gym_envname)
return env, p... |
#!/usr/bin/env python3
import os
import re
import torch
import random
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.svm import SVC
from sklearn.linear_model import LinearRegression
from sklearn import preprocessing
from sklearn.model_selection import train_test_split, KFold
f... |
import os as os
import cPickle as cPickle
import matplotlib.pyplot as plt
import numpy as np
from py_dp.dispersion.binning import get_cdf_from_bins
def get_histogram(plume, bins):
n, bins = np.histogram(plume, bins=bins, density=True)
return n
def plot_side_byside_plumes(ax, x_vals, plume_list, label_list, s... |
# RT - Force Pinned Message
from __future__ import annotations
from typing import TypeAlias, Any
from time import time
from discord.ext import commands, tasks
import discord
from orjson import loads, dumps
from core import RT, Cog, t, DatabaseManager, cursor
from rtutil.utils import artificially_send
from rtutil... |
#!/usr/bin/env python
import time
from jinja2 import Environment, PackageLoader, select_autoescape
from operator import itemgetter
from sanic import Blueprint
from sanic.response import redirect, html, text, json
from owllook.config import RULES, LOGGER, REPLACE_RULES, ENGINE_PRIORITY, CONFIG
from owllook.database.mo... |
# Copyright (c) 2018 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 applicabl... |
from typing import List
import itertools
# The interface.
import math
import torch
from overrides import overrides
from propara.propara.data.prostruct_dataset_reader import Action
ABLATE_HARD_CONSTRAINTS = False
class ValidActionGenerator(object):
def __init__(self, name="stepper name not filled in yet."):
... |
import asyncio
import string
import random
import time
import asyncio
import math
import copy
import psutil
import os
import logging
from quart import Quart, g, websocket, session, redirect, request, url_for, jsonify, render_template, send_file, abort
from rockutils import rockutils
import ujson as json
config = roc... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import sys
from colour.utilities.deprecation import ModuleAPI, Renamed
from colour.utilities.documentation import is_documentation_building
from .cam02_ucs import (JMh_CIECAM02_to_CAM02LCD, CAM02LCD_to_JMh_CIECAM02,
JMh_CIECAM02_... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
To run bandits example in multiprocess mode:
$ python3 examples/bandits/launcher.py --multiprocess
To run bandit... |
import json
import sys
sys.path.append('.')
import argparse
import logging
import torch
import numpy as np
from tqdm import tqdm
from easydict import EasyDict as edict
from evaluate_metric import TransformationLoss, ClassificationLoss
from dataset import ThreeDLoader
from benchmark_utils import set_seed, icp_refine
fro... |
# -*- coding: utf-8 -*-
'''
The Utils class contains many functions for project-wide use.
'''
import os
import sys
import urllib.request, urllib.parse, urllib.error
import random
import logging
import re
from concurrent import futures
from math import log
import shutil
DEFAULT_LOGGER_CREATED = False
def combine_file... |
from collections import namedtuple
from typing import Dict, Union
import torch
from torch import nn as nn
from transformers import PreTrainedModel, PretrainedConfig
from transformers import AutoModel
class ColBERTerConfig(PretrainedConfig):
model_type = "ColBERT"
bert_model: str
dropout: float = 0.0
... |
# Copyright 2020 - 2021 MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in wri... |
import torch
from torch import nn
import torch.nn.functional as F
from torch.distributions.categorical import Categorical
from torch.distributions.transforms import *
from torch.distributions.uniform import Uniform
from torch.distributions.transformed_distribution import TransformedDistribution
from convolutional_enco... |
# Copyright 2020 InterDigital Communications, 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 ... |
# Plugin for Intezer Analyze in Ghidra (python 3.8 - Ghidra Bridge)
# @author 4rchib4ld
# @category Analysis
# @keybinding
# @menupath
# @toolbar
import os
import sys
class PluginException(Exception):
pass
class Proxy:
def __init__(self, api_key):
self._api_key = api_key
self._session = No... |
import collections
import copy
import json
import os
import re
import subprocess
import sys
import threading
import time
import traceback
import pytest
import requests
from pytest_localserver.http import WSGIServer
from werkzeug.serving import WSGIRequestHandler
SYMBOLICATOR_BIN = [os.environ.get("SYMBOLICATOR_BIN") ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import abc
import json
import datetime
import logging
import hashlib
import uuid
from optparse import OptionParser
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from . import fields
from . import scoring
from .store import Storage
SALT = "Otus"
ADMIN_SAL... |
import six
import datetime as dt
import collections
from pathlib import Path
"""
Raven configuration
-------------------
The RV class is used to store Raven parameters for emulated models.
Each model should subclass RV to define the parameters it expects using a namedtuple class. For example::
class MyModel(RV)... |
#
# Copyright The NOMAD Authors.
#
# This file is part of NOMAD.
# See https://nomad-lab.eu for further info.
#
# 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/lic... |
""" Module for arc line plots
"""
from __future__ import (print_function, absolute_import, division, unicode_literals)
import numpy as np
import os
import pdb
from matplotlib import pyplot as plt
import matplotlib.gridspec as gridspec
from matplotlib.backends.backend_pdf import PdfPages
from arclines import utils as... |
#
# Copyright 2016 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://aws.amazon.com/apache2.0
#
# or in the "license" file accom... |
"""Parse Suffolk County data file and emit OpenElections CSV.
@author <EMAIL>
@date 2017-07-11
"""
import sys
def parse_information_record(line):
"""Type I. Read and parse information record data."""
information = line[5:].rstrip()
return {'information': information}
def parse_office_record(line):
... |
import argparse
import os
import torch
import json
from tqdm import tqdm
from torch.utils.data import DataLoader
from model import ConcatenatedClassifier
from data_loader import CustomDataset
from transformers import (
AdamW,set_seed
)
import gc
import pandas as pd
from transformers import get_linear_schedule_with_... |
from django.db import models
import django.core.validators
from django.core.exceptions import ValidationError
import Company.models
from Registration.models import Account
from math import ceil
import string
from nltk.corpus import stopwords
from nltk.stem.porter import *
from random import *
from datetime import date
... |
# Copyright 2018 The Cirq Developers
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
#!/usr/bin/env python
# ----------------------------------------------------------------- #
# The HMM-Based Speech Synthesis System (HTS) #
# developed by HTS Working Group #
# http://hts.sp.nitech.ac.jp/ #
# ----------------... |
#%%
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader
from torch.utils.data import Dataset
from torch.nn.utils import clip_grad_norm_
from torch.nn import TransformerEncoder, TransformerEncoderLayer
import spacy
from collections import Counter
from torchtext.vocab i... |
# Volatility
# Copyright (C) 2007-2013 Volatility Foundation
# Copyright (c) 2010, 2011, 2012 <NAME> <<EMAIL>>
#
# This file is part of Volatility.
#
# Volatility 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... |
import os
import sys
import glob
import numpy as np
import pandas as pd
import setigen as stg
import blimpy as bl
import matplotlib.pyplot as plt
import tqdm
import collections
from astropy import units as u
from astropy.stats import sigma_clip
import scipy.stats
from turbo_seti.find_doppler.find_doppler import FindD... |
"""Apply Black to Jupyter notebooks."""
# Original work Copyright © 2018-2020 <NAME>
# Modified work Copyright © 2019-2020 <NAME>, <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 wit... |
"""
Authors: <NAME>, <NAME>
Licensed under the CC BY-NC 4.0 license (https://creativecommons.org/licenses/by-nc/4.0/)
"""
import numpy as np
import torch
import torch.nn.functional as F
from utils.common_config import get_feature_dimensions_backbone
from utils.utils import AverageMeter, confusion_matrix
from data.custo... |
"""
PolyClipper module.
Binds the PolyClipper geometry operations for clipping polygons & polyhedra.
"""
from PYB11Generator import *
import types
# Include files.
PYB11includes = ['"Geometry/polyclipper.hh"']
PYB11namespaces = ["PolyClipper"]
PYB11opaque = ["std::vector<char>",
"std::vector<unsigne... |
import asyncio
import json
import logging
from abc import abstractmethod
from functools import partial
from http import HTTPStatus
from typing import (Any, Awaitable, Callable, Dict, Final, Iterator,
MutableMapping, Optional, Protocol, Tuple, Union,
runtime_checkable)
import aio... |
"""This is an implementation of an on policy batch sampler.
Uses a data parallel design.
Included is a sampler that deploys sampler workers.
The sampler workers must implement some type of set agent parameters
function, and a rollout function.
"""
from collections import defaultdict
import itertools
impor... |
# Lint as: python3
"""Wrapper for HuggingFace implementation of T5."""
import re
from typing import List
import attr
from lit_nlp.api import model as lit_model
from lit_nlp.api import types as lit_types
from lit_nlp.lib import utils
import tensorflow as tf
import transformers
from rouge_score import rouge_scorer
d... |
"""TODO(discofuse): Add a description here."""
from __future__ import absolute_import, division, print_function
import csv
import os
import tensorflow as tf
import nlp
# TODO(discofuse): BibTeX citation
_URL_ = "https://storage.googleapis.com/discofuse_dataset_v1/"
_CITATION = """\
@InProceedings{GevaEtAl2019,
... |
import asyncio
try:
import ssl
from asyncio import sslproto
except ImportError: # pragma: nocover
_has_ssl = False
else: # pragma: nocover
_has_ssl = True
from aiosmtpd.smtp import SMTP, log
class SessionContext:
peer =... |
#!/usr/bin/env python
# Copyright 2017 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 require... |
# Copyright (c) Facebook, Inc. and its affiliates.
import logging
from abc import ABC, abstractmethod
from dataclasses import asdict, dataclass, field
from typing import Any, Dict, List, NamedTuple, Optional, Tuple, Type
from mmf.common.registry import registry
from mmf.models import BaseModel
from mmf.modules.encode... |
from __future__ import unicode_literals
import hashlib
import io
import logging
import os
import re
from collections import namedtuple
from random import randint
from django.conf import settings
from django.core import checks
from django.core.cache import cache
from django.core.exceptions import ValidationError
from ... |
import torch
import torch.nn.functional as F
from torch import nn
from vgg import B2_VGG
class R3Net(nn.Module):
def __init__(self):
super(R3Net, self).__init__()
vgg = B2_VGG()
self.layer0 = vgg.conv1
self.layer1 = vgg.conv2
self.layer2 = vgg.conv3
self.layer3 = v... |
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
"""
manorm.region
-------------
Module for genomic regions and MAnorm peaks.
"""
import logging
import os
from manorm.region.parsers import get_region_parser
from manorm.stats import xy_to_ma, ma_to_xy, manorm_p
logger = logging.getLogger(__name__)
REGION_FORMATS = ['bed', 'bed3-summit', 'macs', 'macs2', 'narrowpe... |
# Copyright (c) 2010 - 2020, Nordic Semiconductor ASA
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list o... |
"""Cell ranger scRNA-Seq analysis."""
import os
from shutil import move
from plumbum import TEE
from resolwe.process import (
Cmd,
DataField,
DirField,
FileField,
FileHtmlField,
IntegerField,
Process,
SchedulingClass,
StringField,
)
class CellRangerMkref(Process):
"""Referenc... |
import json
import weakref
from pathlib import Path
import typing
import copy
import lazy_dataset
class Database:
"""Base class for databases.
This class is abstract!
"""
def __init__(self):
self._dataset_weak_ref_dict = weakref.WeakValueDictionary()
@property
def data(self):
... |
import os, shutil, sys, time
import pickle
import json
# Global variables
# utility_name = 'erbackup'
# er_save_file_name = 'ER0000.sl2'
# compression_method = '.zip'
# STEAM_UUID = "76561198037994630"
g_desc_dict = None
backup_name = ''
reserved_names = ['_last_load_backup']
with open('config.json', 'r'... |
"""Tests for `cookiecutter.hooks` module."""
import os
import stat
import sys
import textwrap
import pytest
from cookiecutter import hooks, utils, exceptions
def make_test_repo(name):
"""Create test repository for test setup methods."""
hook_dir = os.path.join(name, 'hooks')
template = os.path.join(name... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import unittest
from hwt.hdl.constants import Time
from hwt.simulator.simTestCase import SingleUnitSimTestCase
from hwtLib.amba.datapump.interconnect.wStrictOrder import WStrictOrderInterconnect
from hwtLib.amba.datapump.sim_ram import AxiDpSimRam
from pyMathBitPrecise.b... |
#!/usr/bin/python
import optparse
import os
import os.path
import signal
import subprocess
from rime.basic import consts
from rime.core import codes
from rime.core import taskgraph
from rime.util import files
class CodeBase(codes.Code):
"""Base class of program codes with various common methods."""
def __i... |
#!/usr/bin/env python -*- coding: utf-8 -*-
import os
import re
import sys
import json
import urllib
import urllib3
import logging
import argparse
from arc_eager import arcEager
from ssf_reader import SSFReader
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
def getAttributeValueP... |
""" High-level classes for reading HDF5 files. """
from collections import deque
from collections.abc import Mapping, Sequence
import os
import posixpath
import numpy as np
from .core import Reference
from .dataobjects import DataObjects
from .misc_low_level import SuperBlock
class Group(Mapping):
"""
An ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""":Mod: shchema_org
:Synopsis:
:Author:
servilla
:Created:
8/16/18
"""
import json
import os.path
from lxml import etree
import requests
from webapp.config import Config
from webapp.eml import Eml
import webapp.utility as utility
open_tag = '<script type="ap... |
"""
This file defines actions, i.e. functions the URLs are mapped into
The @action(path) decorator exposed the function at URL:
http://127.0.0.1:8000/{app_name}/{path}
If app_name == '_default' then simply
http://127.0.0.1:8000/{path}
If path == 'index' it can be omitted:
http://127.0.0.1:8000/
The pa... |
# coding=utf-8
# Copyright 2020 The Uncertainty Baselines 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 ap... |
# This test generates all variants of wmma intrinsics and verifies that LLVM
# generates correct instructions for them.
# RUN: python %s > %t.ll
# RUN: llc < %t.ll -march=nvptx64 -mcpu=sm_70 -mattr=+ptx61 | FileCheck %t.ll
from itertools import product
from string import Template
def make_wmma_slice_ty(abcd, itype):... |
# Author: Yubo "Paul" Yang
# Email: <EMAIL>
# Routines to roughly process scalar Dataframes.
# Mostly built around pandas's API.
#
# note: A scalar dataframe (scalar_df) is expected to contain the raw data,
# i.e. block-resolved expectation values, of a SINGLE calculation.
# If multiple runs are collected in the same ... |
"""
Creates a multiprocess, multithread application to detect high
readings.
See https://www.assemblesoftware.com/examples/
"""
import sys
import os
import math
sys.path.append(os.path.abspath("../../IoTPy/agent_types"))
sys.path.append(os.path.abspath("../../IoTPy/core"))
sys.path.append(os.path.abspath("../../Io... |
#!/usr/bin/env python
"""Tests for `pytorch_tabular` package."""
import numpy as np
import pytest
import torch
from sklearn.preprocessing import PowerTransformer
from pytorch_tabular import TabularModel
from pytorch_tabular.categorical_encoders import CategoricalEmbeddingTransformer
from pytorch_tabular.config import... |
from __future__ import annotations
import numpy as np
import pandas as pd
from lamarck.genes import GeneCollection
from lamarck.population import Blueprint, Population
from lamarck.utils import ParentOverloadException
def select_parent(pop_data, n, rank_column):
popsize = len(pop_data)
idx = np.random.choic... |
'''
BVH Parser Class
By <NAME>
Created: June 12, 2017
Based on: https://gist.github.com/johnfredcee/2007503
'''
import re
import numpy as np
from analysis.pymo.data import Joint, MocapData
class BVHScanner():
'''
A wrapper class for re.Scanner
'''
def __init__(self):
def identifier(scanner,... |
"""Task: Rearrange Dice
The goal of this task is to arrange multiple dice into a given pattern.
The pattern is given as a list of N target positions where N is the number of
dice:
.. code-block:: Python
goal = [
(0.10, 0.04, 0.01),
(0.04, -0.08, 0.01),
(0.0, 0.15, 0.01),
...
... |
import time
import logging
import math
try:
import pygame
from pygame.locals import K_r
from pygame.locals import K_p
from pygame.locals import K_ESCAPE
except ImportError:
raise RuntimeError('cannot import pygame, make sure pygame package is installed')
try:
import numpy as np
except ImportEr... |
import torch
from torch import nn
from torch.nn.init import xavier_uniform
import math
import numpy as np
class Identity(torch.nn.Module):
def forward(self, input):
return input
def parse_stage_config(stage_cfg):
if isinstance(stage_cfg, int):
return (stage_cfg,), stage_cfg
elif isinstan... |
import datetime
import mongoengine
from werkzeug import exceptions as HTTPException
from flask_restful import Resource
from cerberus import Validator
from flask import request
from api import config, model
from api.db import ConnectedMixin
from api.cache import CacheMixin
from api.utils import switch_dict_keys_to_sna... |
from JumpScale import j
from functools import partial
import re
import os
import jinja2
import os.path
import copy
fs = j.system.fs
jenv = jinja2.Environment(variable_start_string="${", variable_end_string="}")
class HeaderTools():
@staticmethod
def getHeadnr(line):
if line.find(".") != -1:
... |
import hashlib
import json
from typing import List, Set
import numpy as np
import pandas as pd
import torch
from scipy import sparse as sp
import src.config as cfg
# since they are used for check
blacklisted_clients = set(
[
"000012768d",
"000036f903",
"00010925a5",
"0001f552b0",
... |
#!/usr/bin/env python3
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program 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 2
# of the License, or (at your option) any later version.
#
# This... |
'''
Name: covid_data_handler
Purpose: Hosts the webapplication and manages the covid data
Author: <NAME>
Created: 02/11/2021
Completed: 12/12/2021
'''
import json
import sched
import time
import logging
from flask import Flask
from flask import render_template
from flask impo... |
# Author: <NAME>
# University of Montreal (2012)
# RNN-RBM deep learning tutorial
# More information at http://deeplearning.net/tutorial/rnnrbm.html
from __future__ import print_function
import glob
import os
from constants import *
import sys
import numpy
try:
import pylab
except ImportError:
print ("pyla... |
import numpy as np
from pycbc import waveform, psd, detector
from scipy.stats import betaprime, uniform, randint
from scipy.special import erf, erfinv
import time
from scipy.interpolate import interp1d
import scipy.interpolate as si
from gwcosmo import priors as p
from scipy.stats import truncnorm
from astropy... |
# Copyright (c) 2017 nexB Inc. and others. All rights reserved.
# http://nexb.com and https://github.com/nexB/vulnerablecode/
# The VulnerableCode software is licensed under the Apache License version 2.0.
# Data generated with VulnerableCode require an acknowledgment.
#
# You may not use this software except in compli... |
from django.shortcuts import render
from .models import *
from random import *
from datetime import datetime, timedelta, date
# Create your views here.
def index(request):
return render(request,'doctor_app/doctor-panel/index.html')
def patient_home(request):
email=request.session['email']
uid = User.objec... |
"""
"""
from enum import Enum
from .concepts import Concept, Role, NullaryAtom
from ..utils.algorithms import compute_min_distance
from ..utils.hashing import consistent_hash
class FeatureValueChange(Enum):
ADD = "Add"
DEL = "Del"
INC = "Inc"
DEC = "Dec"
NIL = "Nil"
INC_OR_NIL = "Inc_or_Nil"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.