text stringlengths 6.04k 39.5k |
|---|
import hashlib
import io
import os
import pathlib
import re
from io import BytesIO
from .buttons import ButtonMethods
from .messageparse import MessageParseMethods
from .users import UserMethods
from .. import utils, helpers
from ..tl import types, functions, custom
class _CacheType:
"""Like functools.partial bu... |
import sublime, sublime_plugin, os, re, string, time, json
from os import listdir
UCF_IS_ACTIVE = {}
ALLOWED_EXTENSIONS = ["php", "html", "xhtml", "js"]
class UnusedCssFinderCommand(sublime_plugin.TextCommand):
def run(self, edit, **args):
self.debug = args['debug'] if 'debug' in args else False
subli... |
# Authors: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# License: BSD (3-clause)
from functools import partial
import struct
import numpy as np
from scipy import sparse
from .constants import (FIFF, _dig_kind_named, _dig_cardinal_named,
_ch_kind_named, _ch_coil_type_named, _ch_unit_named,
... |
# Copyright 2009-2012 Yelp
# Copyright 2013 <NAME>
# Copyright 2015-2018 Yelp
# Copyright 2019 Yelp
#
# 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-... |
# encoding:utf-8
# AlgoPlus量化投资开源框架
# 微信公众号:AlgoPlus
# 官网:http://algo.plus
from time import sleep, perf_counter as timer
from AlgoPlus.CTP.TraderApiBase import TraderApiBase
from AlgoPlus.CTP.FutureAccount import FutureAccount
from AlgoPlus.utils.base_field import to_bytes, to_str
from AlgoPlus.CTP.ApiStruct import *... |
""" In the name of Allah, the Most Gracious, the Most Merciful """
# *****************
# Modules
# *****************
import os
from datetime import datetime
# scientific
import numpy as np
# torch
import torch
import torch.nn as nn
# sklearn
from sklearn.metrics import accuracy_score, confusion_matrix
from torch... |
# -*- coding: utf-8 -*-
import os
from urllib.parse import quote_plus
from plexapi import media, utils
from plexapi.base import Playable, PlexPartialObject
from plexapi.exceptions import BadRequest
from plexapi.mixins import (
AdvancedSettingsMixin, SplitMergeMixin, UnmatchMatchMixin, ExtrasMixin, HubsMixin, Ratin... |
# -*- coding:utf-8 -*-
"""
OKEx Future Trade module 交易模块
https://www.okex.me/docs/zh/
注意:当前OKEx Future的Trade模块,只支持全仓模式,不支持逐仓模式;
Author: HuangTao
Date: 2019/01/19
"""
import time
import zlib
import json
import copy
import hmac
import base64
from urllib.parse import urljoin
from quant.error import Error
from quant... |
import enum
import os
import pickle
from collections.abc import Sequence
from multiprocessing import Process, Queue
from numbers import Number
from typing import Any, Callable, Dict, List, Optional, Tuple
import numpy as np
import urllib
from ray import logger
from ray.tune import Trainable
from ray.tune.function_runn... |
import bisect
import configparser
import os
import re
from i3pystatus import IntervalModule, formatp
from i3pystatus.core.command import run_through_shell
from i3pystatus.core.desktop import DesktopNotification
from i3pystatus.core.util import lchop, TimeWrapper, make_bar, make_glyph, make_vertical_bar
class UEventP... |
import random
import logging
import pathlib
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions.normal import Normal
from torch.distributions.studentT import StudentT
from torch.distributions.negative_binomial import NegativeBinomial
import ... |
from qutip import *
import numpy as np
import scipy
import itertools
import random
import matplotlib.pyplot as plt
from itertools import permutations
import pickle
#Pauli matrices
s = [sigmax(), sigmay(), sigmaz()]
s_dict = {'X': sigmax(), 'Y': sigmay(), 'Z': sigmaz()}
PX = [s[0].eigenstates()[1][0] * s[0].eigenstate... |
from os import path
import yaml
from collections import OrderedDict
from profit import defaults
from abc import ABC
import warnings
VALID_FORMATS = ('.yaml', '.py')
"""
yaml has to be configured to represent OrderedDict
see https://stackoverflow.com/questions/16782112/can-pyyaml-dump-dict-items-in-non-alphabetical-o... |
import calendar
import time
import numpy as np
import pandas as pd
from gisutils import shp2df
from shapely.geometry import MultiPolygon, Polygon
from mfsetup import wells as wells
from mfsetup.discretization import get_layer, get_layer_thicknesses
from mfsetup.grid import get_ij
from mfsetup.mf5to6 import get_model_... |
"""
Protein-Ligand Interaction Profiler - Analyze and visualize protein-ligand interactions in PDB files.
supplemental.py - Supplemental functions for PLIP analysis.
Copyright 2014-2015 <NAME>, <NAME>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with th... |
import taichi as ti
import time
import math
ti.init(arch=ti.cpu)
n_dim = 2
n_ptr = 8
dt = 1e-3
steps = 50
ht = dt * 0.5 # half of dt
max_num_particles = 1024*4
bottom_y = 0.05
top_y = 0.95
left_x = 0.05
right_x = 0.95
gravity = ti.Vector.field(n_dim, ti.f32, shape=())
num_pa... |
# -*- coding: utf-8 -*-
"""Copyright 2015 <NAME>.
Code supporting the book
Kalman and Bayesian Filters in Python
https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python
This is licensed under an MIT license. See the LICENSE.txt file
for more information.
"""
from __future__ import (absolute_import, divis... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.checkpoint as checkpoint
from timm.models.layers import DropPath, to_2tuple, trunc_normal_
'''
https://github.com/JegZheng/MS-MLP/blob/main/models/ms_mlp.py
'''
class MixShiftBlock(nn.Module):
r""" Mix-Shifting Block.
Args:
... |
import argparse
import re
import datetime
from dateutil.parser import parse as parsetime
from dateutil.relativedelta import relativedelta
def subcmds(subparsers):
# modification related methods not supported yet
parser = subparsers.add_parser('attachment',
help='get an attachment')
parser.set_de... |
import re
def convert(text, case):
words = to_words(text)
if case == "hyphenated":
return "-".join(words)
elif case == "snake":
return "_".join(words)
elif case == "scream_snake":
return "_".join(map(lambda word: word.upper(), words))
elif case == "dot":
return ".".join(words)
elif case ==... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import abc
import shutil
import traceback
from pathlib import Path
from typing import Iterable, List, Union
from functools import partial
from concurrent.futures import ThreadPoolExecutor, as_completed, ProcessPoolExecutor
import fire
import num... |
# Generated by Django 2.0.7 on 2018-10-08 08:48
# This works for initial data migration
from django.conf import settings
from django.db import migrations
def save_languages(apps, schema_editor):
if not settings.MIGRATE_INITIAL_DATA:
return
Language = apps.get_model('dashboard', 'Language')
la... |
import logging
import os
import os.path as osp
import torch
from torch.cuda.amp import autocast, GradScaler
import mmcv
import time
import numpy as np
from collections import OrderedDict
from detectron2.utils.events import EventStorage
from detectron2.checkpoint import PeriodicCheckpointer
from detectron2.evaluation i... |
# Copyright (c) 2014 <NAME>, 2020 <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,... |
"""
Standalone script for converting umbrella sampling output files into free energy profiles via pymbar
"""
import os
import sys
import numpy as np, numpy
import scipy
import pymbar
import glob
import re
import copy
import argparse
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.colors as colors
... |
import numpy as np
from matplotlib.patches import Ellipse
import matplotlib.lines as mlines
import matplotlib.patheffects as pe
import xarray as xr
from pyart.core.transforms import cartesian_to_geographic
import cartopy.crs as ccrs
from tint.grid_utils import get_grid_size, get_grid_alt
def gen_embossed_text(
... |
#
# This file is part of LUNA.
#
# Copyright (c) 2020 Great S<NAME> <<EMAIL>>
# SPDX-License-Identifier: BSD-3-Clause
""" Low-level USB transciever gateware -- control request components. """
import unittest
import functools
import operator
from nmigen import Signal, Module, Elaboratable, Cat
from nmige... |
import sys
import tensorflow as tf
from model.transformer_utils import create_encoder_padding_mask, create_mel_padding_mask, create_look_ahead_mask
from utils.losses import weighted_sum_losses, masked_mean_absolute_error, new_scaled_crossentropy
from preprocessing.text import Pipeline
from model.layers import Decoder... |
import tvm._ffi
import json
import heapq
import numpy as np
from tvm.runtime import Object
from ..hw_abstraction import ComputeDAG
from .intrin_match import IntrinMatchResult
from .. import _ffi_api
from ..search import CDParamGenerator, Entry, SAEntryGenerator
from ..utils import bi_product, substitute_inputs, softmax... |
import os
import json
import numpy as np
import pandas as pd
from glob import glob
from write_to_json import write_data_to_json
from sqlalchemy import create_engine, MetaData, Table
from pyxdameraulevenshtein import damerau_levenshtein_distance_ndarray
def load_psiturk_data(db_url, table_name, event_dir, data_column_... |
# Copyright 2021 University College London. 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 appl... |
import torch
from ..domain import Domain, BoundaryDomain
from ...spaces import Points
class Triangle(Domain):
'''Class for triangles.
Parameters
----------
space : Space
The space in which this object lays.
origin, corner_1, corner_2 : array_like or callable
The three corners of t... |
from contextlib import contextmanager
import inspect
import numpy as np
import pandas as pd
import tensorflow as tf
import tensorflow_probability as tfp
from tqdm import tqdm
import flamedisx as fd
export, __all__ = fd.exporter()
o = tf.newaxis
@export
class Source:
n_batches = None
n_padding = None
t... |
# -*- coding: utf-8 -*-
from django.contrib.auth.models import User, Group
from django.db import models
from django.contrib import admin
from dateutil.relativedelta import relativedelta
from django.utils.translation import ugettext_lazy as _, string_concat
from api.models_languages import LANGUAGE_CHOICES
from django.c... |
#!/usr/bin/env python3
import torch, random, sys, os, pickle, argparse
import numpy as np, pathos.multiprocessing as mp
import gym_util.common_util as cou
import polnet as pnet, util_bwopt as u
from collections import defaultdict
from poleval_pytorch import get_rpi_s, get_Ppi_ss, get_ppisteady_s
def main():
arg = ... |
# recipe.py (lciafmt)
# !/usr/bin/env python3
# coding=utf-8
"""
This module contains functions needed to compile LCIA methods from the
ReCiPe model
"""
import pandas as pd
import xlrd
import lciafmt.cache as cache
import lciafmt.df as dataframe
import lciafmt.xls as xls
from .util import datapath, aggregate_factors_... |
# -*- coding: utf-8 -*-
"""
Created on Tue May 22 05:28:25 2018
@author: IvanA
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import pylab
wine_data = pd.read_csv("winequality-red.csv", header=0)
wine_data_original = wine_data
print(wine_data.head())
###################... |
# -*- coding: utf-8 -*-
# Copyright 2014 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Uploads performance data to the performance dashboard.
The performance dashboard is owned by Chrome team and is available here... |
from munch import Munch
import numpy as np
import pandas as pd
from zest import zest
from plaster.tools.utils import utils
from plaster.run.call_bag import CallBag
from plaster.tools.log.log import debug
def zest_prs_at_prec():
def it_computes_prs_no_ties():
p = np.array([0.3, 0.2, 0.2, 0.2, 0.1])
... |
import torch
import copy
import torch.nn as nn
import numpy as np
from operator import sub
from pcdet.ops.votr_ops import votr_utils
from pcdet.models.backbones_2d.swin_helpers import GELU
from pcdet.models.backbones_3d.vfe.pillar_vfe import PFNLayer
def scatter_nd(indices, updates, shape):
"""pytorch edition of... |
# Copyright 2017 The Abseil Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
# coding=utf-8
# The MIT License (MIT)
# Copyright (c) Microsoft Corporation
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# t... |
# Copyright (C) 2017 <NAME> and <NAME>
#
# This file is part of WESTPA.
#
# WESTPA 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 version.
#
# ... |
# coding: utf-8
from django.db import models
try:
sorted
except NameError:
from django.utils.itercompat import sorted # For Python 2.3
class Author(models.Model):
name = models.CharField(max_length=100)
age = models.IntegerField()
friends = models.ManyToManyField('self', blank=True)
def ... |
import os
import shutil
import time
import pickle
from datetime import datetime
from filelock import Timeout, FileLock
import zarr
from numcodecs import Blosc
import pandas as pd
import numpy as np
import scipy as sp
import scanpy as sc
import anndata as ad
from anndata._io.zarr import read_dataframe, read_attribute,... |
## hazardCadreRisk.py
## precision proportional hazards model written to allow separate specification
## of cadre-assignment and target-prediction features
## data input assumed to be a pandas.DataFrame
from __future__ import division, print_function, absolute_import
import time
import numpy as np
import tensorflow a... |
import numpy as np
from pyctp import saftvrmie
import scipy.linalg as lin
from scipy.constants import Boltzmann, Avogadro
from scipy.integrate import quad
from pykingas import cpp_KineticGas, bcolors, suppress_stdout
from pykingas.OmegaDb import OmegaDb
import warnings, sys, time, atexit
FLT_EPS = 1e-12
def check_val... |
# The MIT License (MIT)
# Copyright (c) 2018 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify... |
#!/usr/bin/env python
# encoding: utf-8
"""
This module of native functions is implemented for
compatability with 010 editor functions. Some of these functions
are nops, some are fully implemented.
"""
import six
import sys
from pfp.native import native
import pfp.errors as errors
import pfp.utils as utils
import co... |
from imageai.Detection.Custom import CustomObjectDetection, CustomDetectionUtils
import cv2
import os
import json
class CustomVideoObjectDetection:
"""
This is the object detection class for videos and camera live stream inputs using your custom trained detection models. It provides support for your custom Y... |
# coding=utf-8
import logging
import calendar
import dateutil.tz
import dateutil.parser
from datetime import datetime, timedelta
from collections import defaultdict
from .dictionary import Dictionary
class Task(object):
"""Single task."""
def execute(self, bot, slack):
pass
class SendMessage(Task)... |
import copy
import glob
import os
import time
import pickle
from collections import deque
import gym
import gym_compete
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from a2c_ppo_acktr import algo, utils
from a2c_ppo_acktr.algo import gail
from a2c_p... |
import itertools
import json
import os
import pytest
from _pytest.main import ExitCode
pytest_plugins = ["pytester"]
EXAMPLE_SUITE_TEST_COUNT = 10
@pytest.fixture
def example_suite(testdir):
testdir.makepyfile("".join(f"def test_{num}(): pass\n" for num in range(1, EXAMPLE_SUITE_TEST_COUNT + 1)))
yield tes... |
import os
import tempfile
import pytest
import torch
from asr.common.params import Params
from asr.engine import Trainer
from asr.nn import SequenceWise
from asr import losses
from asr.data import Alphabet
from asr.exceptions import ConfigurationError
from asr.metrics import Metrics
from asr.engine import hvd
import ... |
import unittest
import ocal
import episgos
from gospel import fixed as gospel_fixed
from gospel import movable as gospel_movable
from epistle import fixed as epistle_fixed
from epistle import movable as epistle_movable
j=ocal.julian
def checkocal(oc):
# movable inherits everything from ocal, so
# give it a on... |
import math
import time
import heapq
import config
import json
import os
# IID is the index of the node in nodeList
ASDATA_PATH = config.LOCAL_ASDATA_PATH
class Edge:
nfrom = 0 # IID
nend = 0 # IID
dist = 0
name = ""
toinstantnode = None
color = (0, 0, 0)
def __init__(self, nodefrom, ... |
import time
from grove.i2c import Bus
_COMMAND_MODE = 0x80
_DATA_MODE = 0x40
_NORMAL_DISPLAY = 0xA6
_DISPLAY_OFF = 0xAE
_DISPLAY_ON = 0xAF
_INVERSE_DISPLAY = 0xA7
_SET_BRIGHTNESS = 0x81
BasicFont = [[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00],
[0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, 0x00, 0x00],
... |
from typedb.client import TypeDB, SessionType, TransactionType
import os
import csv
def build_museum_recsys_chatbot_graph(inputs):
with TypeDB.core_client("localhost:1729") as client:
with client.session("museum_recsys_chatbot", SessionType.DATA) as session:
for input in inputs:
... |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
import torch.nn.functional as F
# from utils.model_utils import *
from model_utils import *
from models.pcn import PCN_encoder, PCN_encoder_label
# proj_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)... |
import pandas as pd
import numpy as np
import psycopg2
from sqlalchemy import create_engine
import datetime
import logging
class SQLConnector(object):
# functions creating connection to the Database
def __init__(self,db_cred):
global db_credentials
db_credentials = db_cred
self.logger= ... |
# 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, software
# distributed under the Li... |
from __future__ import annotations
from typing import Callable
import numpy as np
from pyglet.window import key as PygletWindowKeys
from manimlib.constants import FRAME_HEIGHT, FRAME_WIDTH
from manimlib.constants import LEFT, RIGHT, UP, DOWN, ORIGIN
from manimlib.constants import SMALL_BUFF, MED_SMALL_BUFF, MED_LARG... |
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
from handcam.ltt.util.TFTools import _DatasetInitializerHook, shuffle_dataset
import tensorflow as tf
import random
from random import shuffle
import glob
import sys
import numpy as np
import six
import os
import pickle
import datetime
from handcam.ltt.network.model.Wide_ResNet import (
wide_resnet_tf_official as ... |
#!/usr/bin/python
"""
This bot creates a pages with links to disambig pages with ref counts.
Wikipedysta:MastiBot/Statystyka martwych linków
Wikipedysta:MastiBot/Statystyka martwych linków/ogólne
Call:
python pwb.py masti/ms-deadlinks.py -cat:"Niezweryfikowane martwe linki" -ns:1 -outpage:"Wikipedysta:MastiBot/Statyst... |
# Copyright (c) 2014, Fundacion Dr. <NAME>
# 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 of conditions and... |
import logging
from pathlib import Path
import numpy as np
import pandas as pd
TEST_RESULT_DATA_PATH = 'data/unibo-powertools-dataset/unibo-powertools-dataset/test_result.csv'
TEST_RESULT_TRIAL_END_DATA_PATH = 'data/unibo-powertools-dataset/unibo-powertools-dataset/test_result_trial_end.csv'
# (test_name, record_id)... |
# cython: auto_pickle=False,embedsignature=True,always_allow_keywords=False
"""
Greenlet-local objects.
This module is based on `_threading_local.py`__ from the standard
library of Python 3.4.
__ https://github.com/python/cpython/blob/3.4/Lib/_threading_local.py
Greenlet-local objects support the management of green... |
# -*- coding: utf-8 -*-
# Copyright (C) 2006 <NAME>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
"""Utility classes for Mutagen.
You should not rely on the interfaces here bei... |
import logging
import typing as tp
from collections import namedtuple, OrderedDict
import numpy as np
from pgdrive.utils import get_np_random
PGBoxSpace = namedtuple("PGBoxSpace", "max min")
PGDiscreteSpace = namedtuple("PGDiscreteSpace", "number")
PGConstantSpace = namedtuple("PGConstantSpace", "value")
"""
This fi... |
# Copyright 2008-2018 pydicom authors. See LICENSE file for details.
"""Unit tests for the pydicom.tag module."""
import pytest
from pydicom.tag import BaseTag, Tag, TupleTag, tag_in_exception
class TestBaseTag:
"""Test the BaseTag class."""
def test_le_same_class(self):
"""Test __le__ of two classe... |
# filemerge.py - file-level merge handling for Mercurial
#
# Copyright 2006, 2007, 2008 <NAME> <<EMAIL>>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
from node import short
from i18n import _
import util, simplemerge, match, er... |
"""
Prepare data as required for the summary frontend templates.
"""
import os
from django.conf import settings
from django.contrib.auth import get_user_model
from django.core.exceptions import ObjectDoesNotExist
from django.template.loader import render_to_string
from django.templatetags.static import static
from dja... |
import io
import sys
import unittest
import warnings
import numpy as np
from numpy.random.mtrand import RandomState
from pycompss.api.api import compss_wait_on
from sklearn.datasets import make_blobs, load_iris
from sklearn.exceptions import ConvergenceWarning
import dislib as ds
from dislib.cluster import GaussianMi... |
# Copyright 2013 Cisco Systems, 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 to in writin... |
# ==========================================================================================
# ==========================================================================================
# By <NAME>.
# Modified on Nov 26, 2021
# Used to produce the numerical results in the following paper:
# <NAME>, <NAME> "M... |
# write documentation in LaTeX format
import sys
import os
import os.path
import re
import datetime, time
import decimal
# template details
THIS_DIR = os.path.dirname(os.path.abspath(__file__))
TEMPLATE_DIR = os.path.abspath(THIS_DIR + '/templates')
HEADER = os.path.join(TEMPLATE_DIR, 'header.tex')
FOOTER = os.path.jo... |
import inspect
import logging
import warnings
from typing import Callable, Dict, List, Optional, Sequence, Union
import numpy as np
import pandas as pd
import torch
from scvi._compat import Literal
logger = logging.getLogger(__name__)
Number = Union[int, float]
class DifferentialComputation:
"""
Unified c... |
#
# Copyright 2015 <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
#
"""Configuration dialogs based on dynamic programming.
"""... |
from __future__ import division
import glob
import itertools
import json
import logging
import math
import os
import re
import shutil
import subprocess
from typing import Optional, Tuple, Sequence, Dict, Union
import numpy as np
import torch
import constants
try:
from reprlib import repr
except ImportError:
... |
"""Utilities for parsing files in CoNLL-U format.
"""
import sys, os
import re
import ast
from typing import List, Tuple, Dict, Union
from pathlib import Path
from logger import logger
from helpers.sentence import Sentence
from helpers.token import Token
import pyconll
_OUT_DIR = Path('tests', 'out')
_OUT_DIR.mkdir(... |
from email.policy import default
import logging
from typing import Dict, List, Optional
import torch
import torch.nn as nn
import torch.nn.functional as F
from fairseq import utils
from fairseq.models import (
register_model,
register_model_architecture,
)
from fairseq.models.transformer import DEFAULT_MIN_PA... |
"""Defines the forms for the ``jwql`` web app.
Django allows for an object-oriented model representation of forms for
users to provide input through HTTP POST methods. This module defines
all of the forms that are used across the various webpages used for the
JWQL application.
Authors
-------
- <NAME>
- <NAM... |
from abc import abstractmethod
from typing import (
Type, List as List_, Dict, Optional, Any, Tuple as Tuple_, Union, TYPE_CHECKING
)
from ..abstract_value import AbstractValue
from .python_values import (
PythonValue, AbstractMutVal, AttrsMutContainer, AttrsTopContainer
)
from ...errors import TypeCheckLogger... |
import re
import sys
import ssl
import json
import socket
import logging
import requests
from os import path
from getpass import getpass
from collections import defaultdict
from multiprocessing.pool import ThreadPool
from requests.compat import urlparse, urljoin, quote_plus
from argparse import ArgumentPars... |
#! /home/wli/env python3
# -*- coding: utf-8 -*-
"""
Title: lesion based prediction
==============================
Created: 10-31-2019
Python version: 3.5/3.6
Description:
------------
This module is used to extract the location (coordinates) and
probability of individual predicted lesions from heatmaps.
... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import os
import logging
import argparse
import datetime
import json
import random
import time
from datetime import timedelta
from pathlib import Path
import numpy as np
import torch
from torch.utils.data import DataLoader, DistributedSampler
impo... |
import numpy as np
import os
import sys
from scipy import misc
import tqdm
import pickle
import tensorflow as tf
# The MNIST images are always 28x28 pixels.
slim = tf.contrib.slim
FLAGS = tf.app.flags.FLAGS
DATA_FLDR = "data/hpl-devnagari-iso-char-offline"
"""
Helper to load lipitk data and network definition to p... |
import unittest
import itertools
from migen import *
from litedram.common import LiteDRAMNativePort
from rowhammer_tester.gateware.bist import Reader, Writer, PatternMemory
# DUT ----------------------------------------------------------------------------------------------
class BISTDUT(Module):
def __init__(se... |
#!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
# Note that PyPy contains also a built-in module 'md5' which will hide
# this one if compiled in.
"""A sample implementation of MD5 in pure Python.
This is an implementation of the MD5 hash function, as specified by
RFC 1321, in pure Python. It was implemented using... |
"""
Yatao (<NAME> <<EMAIL>>
yataobian.com
May 13, 2019.
"""
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import os, sys
sys.path.append('./' )
import datetime
import pickle
from collections import defaultdict
from absl import flags
from absl import app
from functions import utils
from itert... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
import base64
from datetime import timedelta, datetime
import falcon
try:
# This is an optional dependency. To use JWTAuthBackend be sure to add
# [backend-jwt] to your falcon-auth requirement.
# See https://w... |
# -*- coding: utf-8 -*-
# Copyright (c) 2021 <NAME>, Sat Aug 28 16:26:04 2021
# This module is a set of utils for data prepprocessing
# released under a MIT- licence.
# @author: @Daniel03 <<EMAIL>>
import os
import hashlib
import tarfile
import warnings
import pickle
import joblib
import datetime... |
"""The Iteration/Expression Tree (IET) hierarchy."""
from __future__ import absolute_import
import inspect
from collections import Iterable, OrderedDict
import cgen as c
from sympy import Eq, Indexed, Symbol
from devito.cgen_utils import ccode
from devito.ir.iet import (IterationProperty, SEQUENTIAL, PARALLEL,
... |
import csv
import importlib
import sys
sys.path.append('..')
import os
import json
import argparse
from enum import IntEnum
from datetime import datetime
import numpy as np
import scipy.integrate as solve
import scipy.optimize as opt
import matplotlib.pylab as plt
from scripts.tsv import parse as parse_tsv
from paths... |
from argparse import ArgumentParser
import random
import sys
import warnings
import os
import pytorch_lightning as pl
import torch
warnings.filterwarnings("ignore", category=DeprecationWarning)
import spacetimeformer as stf
_MODELS = ["spacetimeformer", "mtgnn", "lstm", "lstnet", "linear", "s4"]
_DSETS = [
"as... |
import struct
from ctypes import create_string_buffer
def add_tesla_crc(msg,msg_len):
"""Calculate CRC8 using 1D poly, FF start, FF end"""
crc_lookup = [0x00, 0x1D, 0x3A, 0x27, 0x74, 0x69, 0x4E, 0x53, 0xE8, 0xF5, 0xD2, 0xCF, 0x9C, 0x81, 0xA6, 0xBB,
0xCD, 0xD0, 0xF7, 0xEA, 0xB9, 0xA4, 0x83, 0x9E, 0x25, 0x38, 0x1F,... |
# SPDX-License-Identifier: BSD-3-Clause
# Depthcharge: <https://github.com/nccgroup/depthcharge>
"""
This module provides the base Operation class atop which different types of operation
implementations (e.g. memory read, memory write) are constructed, along with related
exceptions and peripheral classes.
"""
import ... |
"""api endpoints"""
import cProfile
import pstats
import io
import sqlalchemy
import json
from sqlalchemy import desc
from datetime import datetime, timedelta
from flask import jsonify, request, url_for, current_app
from flask_sqlalchemy import get_debug_queries
from redis import RedisError
from .. import db, cache, wa... |
from tpp.Semantic import T, S, A, O
from llvmlite import ir
from llvmlite import binding as llvm
class G:
INT = ir.IntType(32)
ZERO_INT = ir.Constant(INT, 0)
FLOAT = ir.FloatType()
ZERO_FLOAT = ir.Constant(FLOAT, 0.0)
VOID = ir.VoidType()
COMPARE_SYMBOLS = {
O.GRANTER: '>',
O.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.