text stringlengths 8.04k 46.5k |
|---|
# pylint: disable=missing-docstring,invalid-name
# pylint: disable=protected-access
import pytest
import mhtml
def test_get_content_type():
# more verbose construction
mock_headers = mhtml.ResourceHeader()
mock_headers['Content-Type'] = 'text/html'
assert mhtml.get_content_type(mock_headers) == 'tex... |
from __future__ import division
import logging
import time
import pyomo.environ as pyo
import plotly.express as px
import pandas as pd
import datetime
from model import Patient
class Planner:
def __init__(self, timeLimit, gap, solver):
self.model = pyo.AbstractModel()
self.modelInstance = None
... |
import ast
from ctypes import c_int8, c_int16, c_int32, c_int64
from ctypes import c_uint8, c_uint16, c_uint32, c_uint64
from dataclasses import dataclass
from typing import Any, Dict, List, Tuple, cast, Set, Optional
from py2many.analysis import get_id
from py2many.ast_helpers import create_ast_node, unparse
from py... |
#############################################################################
# Copyright (C) 2020-2021 German Aerospace Center (DLR-SC)
#
# Authors: <NAME>, <NAME>
#
# Contact: <NAME> <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the... |
#!/usr/bin/env python
"""
s3-object-encryption-cleanup: checks a set of inventory buckets in account(s), downloads all inventories present for all buckets, and checks for the encryption state of all objects
Usage:
s3-object-encryption-cleanup audit <filename> [--accounts=<accounts>] [--buckets=<>] [--inventory_acco... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Timing argument calculations
Author: <NAME>.
"""
import numpy as np
import scipy.optimize as sp
import matplotlib.pyplot as plt
import sys
import math
# r = physical distance between MW and M31
# This evolves according to a differential equation involving G... |
import csv
from pathlib import Path
import shutil
import itertools
from judge import Judge
from student import Student
from util import (
PresentationAssignmentError,
OutputVerificationError,
time_slot_to_time,
column_name_to_date,
date_and_time_to_index,
index_to_datetime,
index_to_datetim... |
from __future__ import print_function, absolute_import
import os
import sys
import time
import fcntl
import select
import datetime
import traceback
import pickle
import gi
gi.require_version('GLib', '2.0')
from gi.repository import GLib
from multiprocessing import Process, Queue
from . import c_base
from . import db... |
import re
import numbers
import six
from pprint import pprint
from Athena import AtUtils
from Athena import AtConstants
class Process(object):
"""Abstract class from which any Athena User Process have to inherit.
The Process object define default instance attributes for user to use and that are managed thr... |
from datetime import datetime, timezone
import json
import math
import os
import time
import traceback
from abc import ABC, abstractmethod
from collections import defaultdict
from typing import Callable, Dict, Optional
from binance.client import Client
from binance.exceptions import BinanceAPIException
from cachetools... |
# -------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
# ----------------------------------------------------------------------... |
# -*- coding: utf-8 -*-
"""
This module contains methods for generating statistics about the alignments generated by amplimap.
This includes the number of reads and read families per probe, per sample as well as data on off-target
alignments.
"""
# python 3 compat
# http://python-future.org/compatible_idioms.html
from... |
import copy
import os
from functools import partial
from pathlib import Path
from typing import List, Tuple
import hydra
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import pytorch_lightning as pl
import scipy
import torch
from hydra.utils import get_original_cwd
from omegaconf import DictCon... |
import numpy as np
from copy import deepcopy
import cctk
from cctk.helper_functions import align_matrices
class Ensemble:
"""
Class representing a collection of molecules. They do not all need to have the same atoms or bonds.
Ensembles are composed of molecules and properties. Molecules are ``Molecule``... |
'''Database models for the application.
Portions of the code (when specified in the docstring/comments)
are adapted from:
<NAME>, Flask Web Development, [Beijing etc.], 2018.
'''
__name__ = 'models'
__all__ = ['Permissions', 'Role', 'User', 'AnonymousUser', 'Language',
'Document', 'DocumentType', 'Collecti... |
from __future__ import annotations
from typing import Iterable, Optional
import collections
import contextlib
import copy
import functools
import itertools
import networkx as nx
import numpy as np
import os
import pathlib
import tempfile
import rdkit
import rdkit.Chem
import rdkit.Chem.AllChem
import scipy.interpolate... |
# Copyright 2015 The TensorFlow 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 app... |
import numpy as np
from scipy.constants import mu_0
# TODO: make this to take a vector rather than a single frequency
def rTEfunfwd(n_layer, f, lamda, sig, chi, depth, HalfSwitch):
"""
Compute reflection coefficients for Transverse Electric (TE) mode.
Only one for loop for multiple layers.
... |
# PlayStation RSD export plug-in v1.00
# Written by Lameguy64/TheCodingBrony of Meido-Tek Productions.
#
# Notes:
# - All polygons of the model must only be triangles (3 point polygons) or
# quads (4 point polygons).
# - Textures must be applied through the UV/Image Editor panel as materials are not
#... |
# -*- coding:utf-8 -*-
# --
# Copyright (c) 2012-2014 Net-ng.
# All rights reserved.
#
# This software is licensed under the BSD License, as described in
# the file LICENSE.txt, which you should have received as part of
# this distribution.
# --
import json
import itertools
from functools import partial
from nagare.i... |
# -*- coding: utf-8 -*-
"""
Created on Jul 29, 2012
@author: marko
"""
from PIL import Image, ImageTk
from Tkconstants import RIGHT, LEFT, BOTH, E, W, HORIZONTAL
from Tkinter import Frame, Label, Button, Toplevel, OptionMenu, Scale, Entry, \
Message, Spinbox, IntVar, StringVar, DoubleVar
from matplotlib.backends.b... |
__copyright__ = "Copyright (C) 2019 <NAME>"
__license__ = """
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, mer... |
import numpy as np
import os
import torch
from isaacgym import gymutil, gymtorch, gymapi
from isaacgym.torch_utils import *
from tasks.base.vec_task import VecTask
from isaacgymenvs.utils.torch_jit_utils import *
import time
class CubeBot_TargPos(VecTask):
def __init__(self, cfg, sim_device, graphics_device_id, h... |
import unittest
from artalk.parser import Parser, Code, BlockFactory
class ParserTest(unittest.TestCase):
def test_parse(self):
document = """
[Constant RAM Writes]
01234567 89ABCDEF
11234567 000089AB
21234567 00000089
[Conditional 32-Bit Code Types]
31234567 89ABCDEF
41234567 89ABCDEF
51234567 89ABCDEF
... |
"""Functions for multiobjective tabu search."""
import json
import numpy as np
np.set_printoptions(precision=3, linewidth=np.inf)
def hj_move(x, dx):
"""Generate a set of Hooke and Jeeves moves about a point.
For a design vector with M variables, return a 2MxM matrix, each variable
having being perturbe... |
###
###
###
### AMBReader.py is a script I've been using to explore & experiment with AMB files. In the process I've also built it up as an AMB reader, though
### it's by no means a user friendly format loading library.
### BASIC USAGE: First set civ3_root_dir below to your Civ 3 install directory. Then run the ... |
"""
@file name_handler.py
@details Contains common functions for working on names
@package name_handler
@copyright 2020-21 PMFuzz Authors
SPDX-license-identifier: BSD-3-Clause
"""
import doctest
import re
import tempfile
from os import path
from helper.common import *
AFL_DIR_NM = '.afl-results'... |
"""
A module that provides core algorithm for optimal matching of backgrounds of
N-dimensional images using (multi-variate) polynomials.
:Author: <NAME> (contact: <EMAIL>)
:License: :doc:`../LICENSE`
"""
import numpy as np
from .utils import create_coordinate_arrays
__all__ = ['build_lsq_eqs', 'pinv_solve', 'rlu_... |
import os
from collections import OrderedDict
from rpython.jit.codewriter.effectinfo import EffectInfo
from rpython.jit.metainterp.optimizeopt.util import args_dict
from rpython.jit.metainterp.history import Const, ConstInt
from rpython.jit.metainterp.jitexc import JitException
from rpython.jit.metainterp.optimizeopt.... |
# Copyright 2020 The TensorFlow 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... |
import numpy as np
from enum import IntEnum
import ctypes
from ctypes.util import find_library
import platform
from PyQt5 import QtWidgets, QtCore
from easydict import EasyDict as edict
from pymodaq.daq_viewer.utility_classes import DAQ_Viewer_base
from pymodaq.daq_utils.daq_utils import ThreadCommand, DataFromPlugins... |
#!/usr/bin/env python3
# coding=utf-8
"""
* Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED.
* 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... |
# -*- coding: utf-8 -*-
"""
Transform clusters into TableRegion/TableCells and populate them with TextLines
Created on August 2019
Copyright NAVER LABS Europe 2019
@author: <NAME>
"""
import sys, os
from optparse import OptionParser
from collections import defaultdict
from lxml import etree
import numpy as np
impo... |
import glob
from functools import partial
from pathlib import Path
from typing import Dict, List, Optional, Tuple
import albumentations as albu
import librosa
import librosa.display
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import pytorch_lightning as pl
import scipy
from hydra.utils impor... |
# Copyright 2016, Yahoo Inc.
# Licensed under the terms of the Apache License, Version 2.0. See the LICENSE file associated with the project for terms.
"""Generic utilities, exceptions and :term:`operation` & :term:`plottable` base classes.
.. doctest::
:hide:
.. Workaround sphinx-doc/sphinx#6590
>>> fro... |
# -*- coding: utf-8 -*-
import os, cv2
import matplotlib.pyplot as plt
import numpy as np
from tqdm import tqdm
import skimage.io as skio
import skimage.transform as skt
from skimage.measure import ransac
from skimage import exposure
from skimage.util import img_as_ubyte
# %%
# ============================... |
# from https://github.com/likecoffee/VariationalAutoRegressive
#import ipdb
import torch
import numpy as np
from torch import nn
from torch.nn import functional
from torch.autograd import Variable
import torch.nn.functional as F
import math
from model import rnn_cell
#import rnn_cell
class Configuration(object):
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#from tkinter import *
from sys import argv,exit
from os import getcwd
from platform import system
import getopt
# custom
#from tlrm2e.inspect import App as Inspector
# in-file settings
if system().lower().startswith("win"):
... |
"""
pancake_flipping.py
This file runs The Harried Waiter game.
Developed on Python 3.7.6
<NAME>
"""
import pygame
import random
# --- Global constants ---
BLACK = ( 0, 0, 0)
WHITE = (255, 255, 255)
LT_BROWN = (236, 162, 77)
DK_BROWN = (180, 83, 38)
SCREEN_WIDTH = 750
SCREEN_HEIGHT = 550
# Regular: h... |
# coding: utf-8
# Distributed under the terms of the MIT License.
""" This file implements the base class Spatula that calls the scrapers
and interfaces with the MongoDB client.
"""
import os
import collections
import tempfile
import random
import datetime
import copy
import traceback as tb
import logging
import sy... |
import os
from rpython.rlib import rgc
from rpython.rlib.objectmodel import we_are_translated, specialize
from rpython.rlib.rarithmetic import ovfcheck
from rpython.rtyper.lltypesystem import lltype, llmemory, rffi, rstr
from rpython.rtyper import rclass
from rpython.rtyper.lltypesystem import llgroup
from rpython.rtyp... |
import itertools
import textwrap
import warnings
from datetime import datetime
from inspect import getfullargspec
from typing import Any, Iterable, Mapping, Tuple, Union
import numpy as np
import pandas as pd
from ..core.options import OPTIONS
from ..core.utils import is_scalar
try:
import nc_time_axis # noqa: ... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import copy
from dataclasses import dataclass, field
from enum import Enum
from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union, cast
from dataclasses_json import (
CatchAll,
DataClassJsonMixin,
Undefined,
... |
# coding=utf-8
"""
A simple VTK widget for PyQt or PySide.
See http://www.trolltech.com for Qt documentation,
http://www.riverbankcomputing.co.uk for PyQt, and
http://pyside.github.io for PySide.
This class is based on the vtkGenericRenderWindowInteractor and is
therefore fairly powerful. It should also play nicely w... |
import os
import json
import hashlib
import sys
import argparse
import shutil
import subprocess
import re
import logging
from django.utils.timezone import now as timezone_now
from typing import Any, Dict, List, Tuple
from zerver.models import UserProfile, Realm, Stream, UserMessage, \
Subscription, Message, Recipi... |
from __future__ import annotations
from itertools import chain, product
from typing import Callable, cast, Dict, Iterator, List, Optional, Tuple, Union
import z3
from networkx import DiGraph # type: ignore
import syntax
from syntax import Scope, Binder, Expr, Bool, Int, UnaryExpr, BinaryExpr, NaryExpr
from syntax ... |
# coding=utf-8
# 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,... |
#!/usr/bin/env python
"""Helper functionality for gui testing."""
import atexit
import binascii
import functools
import logging
import os
import threading
import time
from urllib import parse as urlparse
from absl import flags
import portpicker
from selenium import webdriver
from selenium.common import exceptions
fro... |
import scipy.sparse
import scipy.io
import sparse
import os
import glob
import numpy
import itertools
import shutil
import numpy as np
import math
from pathlib import Path
from dataclasses import dataclass
HOSTNAME = os.environ['HOSTNAME']
def round_sparse(x):
if 0.0 <= x < 1:
return 1
elif 0.0 > x ... |
import bpy
from enum import Enum
from .tools.utils import flag_list_to_int, flag_prop_to_list, int_to_bool_list
class SollumType(str, Enum):
NONE = "sollumz_none"
FRAGMENT = "sollumz_fragment"
FRAGGROUP = "sollumz_fraggroup"
FRAGCHILD = "sollumz_fragchild"
FRAGLOD = "sollumz_lod"
DRAWABLE_DI... |
"""
A jGrid is a georeferenced nD array (n >= 3) chunked into fractions along its
x/y axes AND the time axis (and NOT chunked over the other axes).
It is suitable to process pixels as timeseries.
It can be viewed as a nD array (e.g. [width, height, ndates]).
A jGrid consists of a header (a .jghdr3 file, which is just... |
# TODO(matt): Reformat script.
# flake8: noqa
"""
Big Data Training
=================
"""
###############################################################################
# train
###############################################################################
import argparse
import os
import sys
import time
from typing... |
# Copyright (C) 2021 Intel Corporation. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
import ctypes
import logging
import lxml.etree
from collections import defaultdict
from acpiparser import parse_dsdt, parse_resource_data, parse_pci_routing
from acpiparser.aml.tree import Visitor, Direction
impor... |
import numpy as np
import argparse
from glob import glob
from copy import copy
import random
import pickle
import sys
# network
import torch
import torch.nn.functional as F
torch.manual_seed(0)
# GPU config
GPU = False
device = torch.device("cuda" if GPU else "cpu")
mb = 1
opt = "Adam" # SGD, Adam
# lr, iteration
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import tempfile
import os
from django import forms
from django.contrib import admin
from django.contrib.admin.views.main import ChangeList
from django.core.exceptions import ValidationError
from django.core.files.storage import FileSystemStorage
from dja... |
"""
.. module: security_monkey.watcher
:platform: Unix
:synopsis: Slurps the current config from AWS and compares it to what has previously
been recorded in the database to find any changes.
.. version:: $$VERSION$$
.. moduleauthor:: <NAME> <<EMAIL>> @monkeysecurity
"""
from botocore.exceptions import Cli... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Tests for model evaluation.
Compare the results of some models with other programs.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import types
try:
import cPickle as pickle
exce... |
import torch
import torch.nn as nn
from torch.nn import functional as F
import torch.distributions as dist
from paper_experiments.malaria.diva.pixel_cnn_utils import log_mix_dep_Logistic_256
from paper_experiments.malaria.resnet_blocks_batchnorm import *
# Decoders
class px(nn.Module):
def __init__(self, d_dim, ... |
## Usage
## copy paste it into the whole file of sawywer_push_nips.py
from collections import OrderedDict
import numpy as np
from gym.spaces import Box, Dict
import mujoco_py
import random
from multiworld.core.serializable import Serializable
from multiworld.envs.env_util import (
get_stat_in_paths,
create_sta... |
#!/usr/bin/env python3
# Copyright (c) 2003-2012 CORE Security Technologies
#
# This software is provided under under a slightly modified version
# of the Apache Software License. See the accompanying LICENSE file
# for more information.
#
"""
Stripped down version of: https://github.com/CoreSecurity/impacket/blob/pyt... |
import numpy as np
import cv2
from collections import deque
import pickle
import os
class ImageProcessor:
"""
Class used to process an image for the LaneDetector. Applies both color and gradient thresholding and produces a set of
images (undistored, thresholded and warped) that can be used for debugging.
... |
import FWCore.ParameterSet.Config as cms
from PhysicsTools.NanoAOD.common_cff import *
from PhysicsTools.JetMCAlgos.TauGenJets_cfi import tauGenJets
from PhysicsTools.JetMCAlgos.TauGenJetsDecayModeSelectorAllHadrons_cfi import tauGenJetsSelectorAllHadrons
##################### Updated tau collection with MVA-based ta... |
import math
from collections import deque
import numpy as np
import torch
from torch import nn
import torch.nn.functional as F
from torchvision import models
from decoder import SegDecoder, DepthDecoder
from resnet import *
class ImageCNN2(nn.Module):
""" Encoder network for image input list.
Args:
... |
# Copyright (c) 2020, <NAME>PORATION. 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 autoprotocol.container import Container, WellGroup, Well
from autoprotocol.container_type import _CONTAINER_TYPES
from autoprotocol.unit import Unit
from misc_helpers import flatten_list
from rectangle import binary_list, chop_list, max_rectangle, \
get_quadrant_binary_list, get_well_in_quadrant
from collectio... |
# coding=UTF-8
"""
Contains non-skilling player behaviors.
"""
import logging as log
import pathlib
import random as rand
import sys
import time
import cv2
import numpy as np
import pyautogui as pag
from ocvbot import banking
from ocvbot import inputs
from ocvbot import misc
from ocvbot import startup as start
from o... |
#!/usr/bin/env python
from pysam import FastaFile
from Meth5py import Meth5py
#import subprocess as sp
import numpy as np
import multiprocessing as mp
from functools import partial
from quicksect import IntervalTree
from teamRNN.constants import gff3_f2i, gff3_i2f, contexts, strands, base2index, te_feature_names
from ... |
import pickle
import queue
import time
from pathlib import Path
import numpy as np
from analysis_util import get_numpy_array, BaseFeatureHelper, \
get_sample_feature_value
from util.constants import NEWS_ROOT_NODE, RETWEET_EDGE, REPLY_EDGE, RETWEET_NODE, REPLY_NODE
from util.util import tweet_node
def get_post_... |
# Copyright 2019-2020 kubeflow.org.
#
# 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... |
# vim: set et sw=4 sts=4 fileencoding=utf-8:
#
# Copyright (c) 2013-2017 <NAME> <<EMAIL>>
# Copyright (c) 2013 Mime Consulting Ltd. <<EMAIL>>
# All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to... |
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
# file: main.py
import re
import difflib
import numpy as np
import pandas as pd
from os.path import isfile
from IPython.display import HTML
from .strongs3.abnum.remarkuple import helper as h
from .strongs3 import hebrew as hbr
from .strongs3.abnum import find_cumulative_... |
import math
import cv2
import matplotlib.cm
import numpy as np
from scipy.ndimage.filters import gaussian_filter, maximum_filter
from scipy.ndimage.morphology import generate_binary_structure
# It is better to use 0.1 as threshold when evaluation, but 0.3 for demo
# purpose.
cmap = matplotlib.cm.get_cmap('hsv')
# He... |
"""
This module defines some classes to perform a calculation using BigDFT
using binding (GIBinding) or using system call (SystemCalculator).
"""
# In our case for the class SystemCalculator which uses system calls:
# * We define posinp (equivalent of Atoms)
# * We have a python dictionary for the parameter
# * We de... |
import logging
from dataclasses import dataclass, field
from itertools import chain, combinations
from typing import Optional
import numpy as np
from mdsea import quicker
from mdsea.config import Config
from mdsea.constants import DTYPE
from mdsea.core import SysManager
from mdsea.gen import PosGen, VelGen
from mdsea.... |
# Copyright 2016 <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
import os
import sys
if sys.platform == 'win32' or 'NOFORKING' in o... |
# coding: utf-8
# pylint:
# author: <NAME>
# mail: <EMAIL>
import datetime as dt
import math
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import MinMaxScaler
from utils import parse_args, save2pickle
np.random.seed(1)
def _check_4_dimension... |
from __future__ import absolute_import
try:
import itertools.izip as zip
except ImportError:
pass
import numpy as np
import param
from .. import util
from ..dimension import redim, Dimension, process_dimensions
from ..element import Element
from ..ndmapping import OrderedDict
from ..spaces import HoloMap, Dy... |
import pandas as pd
import numpy as np
from copy import deepcopy
import json
from pathlib import Path
from kipoi.data import Dataset
# try:
# import torch
# from bpnet.data import Dataset
# torch.multiprocessing.set_sharing_strategy('file_system')
# except:
# print("PyTorch not installed. Using Dataset from kipoi.d... |
"""Interval class
<NAME>, June 2005
Interval objects have attributes:
name: str (variable label, which DOES NOT have to be unique)
typestr: 'int' or 'float' (immutable) - doesn't handle 'complex' yet
type: type
_loval (low endpoint val): numeric
_hival (hi endpoint val): numeric
_abseps... |
#!/ usr/bin/env
# coding=utf-8
#
# Copyright 2019 ztosec & https://www.zto.com/
#
# 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 r... |
# -*- coding: utf-8 -*-
"""
斗地主拆牌模块
@author 江胤佐
"""
from __future__ import annotations
import math
from abc import ABCMeta
from collections import defaultdict
from copy import deepcopy
from functools import cmp_to_key
from typing import Optional
from duguai.card.cards import *
from duguai.card.cards import card_lt2, ... |
'''
Copyright 2020 Sensetime X-lab. All Rights Reserved
Main Function:
1. Implementation for action_type_head, including basic processes.
2. Implementation for delay_head, including basic processes.
3. Implementation for queue_type_head, including basic processes.
4. Implementation for selected_units_t... |
# Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
import math
from collections import OrderedDict, defaultdict
from functools import reduce
import numpy as np
import funsor
import funsor.ops as ops
from funsor.affine import affine_inputs, extract_affine, is_affine
from funsor.delta ... |
# Copyright (c) 2020 Graphcore Ltd. All rights reserved.
# Original paper:
# Training Deep AutoEncoders for Collaborative Filtering
# By <NAME> and <NAME>
# https://arxiv.org/pdf/1708.01715.pdf
import argparse
import os
import time
from collections import namedtuple, deque
import numpy as np
import tensorflow.compat.... |
""" making grid for plot depending on manifold and latent distribution """
import numpy as np
from scipy.special import i0
def true_density(data, manifold, latent_distribution):
if manifold == 'sphere':
theta = data[1]
phi = data[0]
if latent_distribution == 'mixture':
kappa = ... |
#!/usr/bin/env python3
desc="""Requiggle basecalled FastQ files and features in BAM file.
For all reference bases we store (as BAM comments):
- normalised signal intensity mean [tag si:B,f]
- reference base probability [tag tr:B:C] retrieved from guppy (trace scaled 0-255)
- dwell time [tag dt:B:C] in signal step cap... |
# python3.7
"""Contains the implementation of discriminator described in StyleGAN.
Paper: https://arxiv.org/pdf/1812.04948.pdf
Official TensorFlow implementation: https://github.com/NVlabs/stylegan
"""
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.cuda.amp import a... |
# -*- coding: utf-8 -*-
#!/usr/bin/env bash
#
# Author: XuMing <<EMAIL>>
# Brief: corrector with spell and stroke
import codecs
import os
import pdb
import time
import math
import sys
import argparse
import jieba.posseg as pseg
from collections import defaultdict
from pypinyin import lazy_pinyin
pwd_path = os.path.abs... |
import math
import numpy as np
import torch
from torch.nn.parameter import Parameter
from torch import nn
from torch.nn import functional as F
from torch.utils import model_zoo
from copy import deepcopy
from .resnet12 import resnet12
eps = 1e-10
class CNNEncoder(nn.Module):
def __init__(self, in_c=3):
s... |
from execution import Occurance, Command, Continuation
class Game():
"""This is the root object containing the game state.
word_length - the length of Word object text
rooms - list of Rooms (but not 'inventory')
inventory - a Room holding the player's inventory
player_room - the room the player i... |
"""
# mindoc.py
A minimalistic python and SQL documentation tool.
* [GitHub page](https://minchulkim87.github.io/mindoc/)
* [Source code on GitHub](https://github.com/minchulkim87/mindoc)
This program converts .py, .sql, and .md files into .html documentation files with minimal work on the developer's part... |
# ------------------------------------------------------------------------------------------------
# Copyright (c) 2016 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 Softwa... |
from __future__ import print_function
"""
Manage configuration information for the CEA. The Configuration class is built dynamically based on the type information
in ``default.config``.
"""
import os
import re
import json
import ConfigParser
import cea.inputlocator
import collections
import datetime
__author__ = "<NA... |
"""
dump - Buffer hex display functions
===================================
This module contains buffer storage display functions
- most notably dump() used for logging buffers
- classes/methods for reversing readable SYSUDUMP data
into virtual storage
- diffdump for printing differences in buffers using difflib
"... |
# Copyright 2020 The FedLearner 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 applica... |
"""
SHERPA is a Python library for hyperparameter tuning of machine learning models.
Copyright (C) 2018 <NAME>, <NAME>, and <NAME>.
This file is part of SHERPA.
SHERPA 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 Founda... |
#
# 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 ... |
"""
Serve ingstion statistics for consumption in to a Sheets spreadsheet.
Development:
$ adev runserver server.py
"""
import asyncio
import csv
import logging
import os
import sys
from datetime import datetime
from io import StringIO
import stripe
from aiohttp import web
from aiohttp.web_request import Request
from ... |
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Miscellaneous node types.
"""
from __future__ import print_function
import os.path
import re
import sys
import six
from grit import constants
from... |
import lost
import json
import os
from lost.db import dtype, state, model
from lost.logic.anno_task import set_finished, update_anno_task
from datetime import datetime
from lost.logic.file_man import FileMan
__author__ = "<NAME>"
def get_first(db_man, user_id, media_url):
""" Get first image anno.
:type db_man... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.