text stringlengths 3.07k 22.1k |
|---|
import abc
from types import SimpleNamespace
from rpy2.robjects.robject import RObjectMixin
import rpy2.rinterface as rinterface
from rpy2.rinterface import StrSexpVector
from rpy2.robjects import help as rhelp
from rpy2.robjects import conversion
_get_exported_value = rinterface.baseenv['::']
getmethod = _get_exporte... |
r"""
Bijection classes for type `E_{6,7}^{(1)}`
Part of the (internal) classes which runs the bijection between rigged
configurations and KR tableaux of type `E_{6,7}^{(1)}`.
AUTHORS:
- <NAME> (2011-04-15): Initial version
TESTS::
sage: from sage.combinat.rigged_configurations.bij_type_E67 import KRTToRCBiject... |
# encoding: utf-8
class FastCGIError(Exception):
pass
# Values for type component of FCGI_Header
FCGI_BEGIN_REQUEST = 1
FCGI_ABORT_REQUEST = 2
FCGI_END_REQUEST = 3
FCGI_PARAMS = 4
FCGI_STDIN = 5
FCGI_STDOUT = 6
FCGI_STDERR = 7
FCGI_DATA = 8
FCGI_GET_VALUES = 9
F... |
from typing import Any, Iterable, Tuple, Type, Union
from urllib import parse as urlparse
import pkg_resources
from django import forms
from django.contrib.admin.filters import FieldListFilter
from django.core import checks, exceptions
from django.db.models.fields import BLANK_CHOICE_DASH, CharField
from django.utils.... |
# Copyright 2020 <NAME> <<EMAIL>>
#
# 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, d... |
"""
sphinx.builders.epub3
~~~~~~~~~~~~~~~~~~~~~
Build epub3 files.
Originally derived from epub.py.
:copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import html
from os import path
from typing import Any, Dict, List, NamedTuple, Set,... |
from __future__ import unicode_literals
import re
import json
from .common import InfoExtractor
from ..compat import (
compat_str,
compat_HTTPError,
)
from ..utils import (
ExtractorError,
int_or_none,
parse_iso8601,
parse_qs,
)
class VevoBaseIE(InfoExtractor):
def _extract_json(self, we... |
#!/usr/bin/env python
import json
import logging
import ldap
import os
import pygerduty.v2
import requests
import time
from ldap.controls.libldap import SimplePagedResultsControl
from pagerduty_user_delete import main as lfepp_delete_pagerduty_user
logger = logging.getLogger('pagerduty_ldap_sync')
# configurable as ... |
# Copyright (c) 2020, <NAME>, Honda Research Institute Europe GmbH, and
# Technical University of Darmstadt.
# 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 mus... |
from __future__ import division
import logging
import os
import random
import torch
import torchtext
from torch import optim
import torch.nn.functional as F
import seq2seq
from seq2seq.evaluator import Evaluator
from seq2seq.loss import NLLLoss
from seq2seq.optim import Optimizer
from seq2seq.util.checkpoint import C... |
import qinfer
import random
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm
import qmla.model_building_utilities as model_building_utilities
import qmla.logging
__all__ = ["gaussian_prior", "prelearned_true_parameters_prior"]
def log_print(to_print_list, log_file, log_identifier="Dis... |
# --------------------------------------------------------
# Tensorflow Phrase Detection
# Licensed under The MIT License [see LICENSE for details]
# Written by <NAME> based on code from <NAME>
# --------------------------------------------------------
from __future__ import absolute_import
from __future__ import divis... |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2014 <NAME>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitati... |
'''
Created on Oct 4, 2015
@author: kevinchien
'''
import threading
import inspect
from time import sleep
import time
from pykafka import KafkaClient as PyKafkaClient
from pykafka import BalancedConsumer
from pykafka.partitioners import hashing_partitioner
from tornado.gen import coroutine, Return
from src.common.... |
# NB: do NOT import utils as this disables eager execution that seems
# to be required for proper operations of `tf.summary`.
import os
import tensorflow as tf
import numpy as np
from sklearn.model_selection import train_test_split
# ---
default_datadir = os.getenv ('DC_DATADIR') or \
os.getenv ('TM... |
# coding=utf-8
# Copyright 2017 The Tensor2Tensor 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... |
#TODO:
import tensorflow as tf
import os
import argparse
import sys
import random
import math
import logging
import operator
import itertools
import datetime
import numpy as np
import pandas as pd
from csv import reader
from random import randrange
FLAGS = None
#FORMAT = '%(asctime)s %(levelname)s %(message)s'
#lo... |
import cv2
import gym
import numpy as np
from collections import deque
from gym import spaces
class NoopResetEnv(gym.Wrapper):
def __init__(self, env=None, noop_max=30):
"""Sample initial states by taking random number of no-ops on reset.
No-op is assumed to be action 0.
"""
super... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import re
import sys
import json
import collections
import conll
from utils.utils import flatten_list_of_lists
class DocumentState(object):
def __init__(self):
self.doc_key = None
self.te... |
#import RPi.GPIO as GPIO
# -*- coding: utf-8 -*-
import sys,tty,termios, curses, argparse
from subprocess import call
class Wartosci:
def __init__(self):
self.throttle = 0
self.yaw = 0
self.pitch = 0
self.roll = 0
class Procentowe(Wartosci):
def setDefaultStates(self):
... |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modif... |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... |
# -*- encoding: utf-8 -*-
# Copyright (c) 2015 b<>com
#
# Authors: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# 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/licen... |
# !-*- coding: utf-8 -*-
# SimBERT 相似度任务测试
# 基于LCQMC语料
import numpy as np
from collections import Counter
from bert4keras.backend import keras, K
from bert4keras.models import build_transformer_model
from bert4keras.tokenizers import Tokenizer
from bert4keras.snippets import sequence_padding
from bert4keras.snippets i... |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... |
import threading
import pprint
import serial
import traceback
import os
import HartMoteConnector as HartMoteConnectorOriginal
#============================ decide whether can run ==========================
CLIB_PATHS = [
os.path.join('libdn_whmt'),
os.path.join('..','..','..','sm_clib','sm_clib','libdn_whmt'... |
#! /usr/bin/python
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.feature_selection import RFECV
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import GridSearchCV
from sklearn.neighbors import KNeighborsClassifier
from sklear... |
from datetime import datetime
from clize import run
from molecules.transformers import DocumentVectorizer
import numpy as np
from collections import defaultdict
import pandas as pd
import torch
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.utils.rnn as rnn_utils
import spacy
from visdom... |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
import numpy as np
from pymatgen.core.operations import MagSymmOp, SymmOp
from pymatgen.electronic_structure.core import Magmom
from pymatgen.util.testing import PymatgenTest
class SymmOpTestCase(PymatgenTe... |
# -*- coding: utf-8 -*-
import numpy as np
from scipy.spatial import cKDTree
def in_box(pts, box):
x_in = np.logical_and(box[0] <= pts[:, 0], pts[:, 0] <= box[1])
y_in = np.logical_and(box[2] <= pts[:, 1], pts[:, 1] <= box[3])
index = np.logical_and(x_in, y_in)
return pts[index, :].copy()
class Pse... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
__... |
from talon import Context, Module, actions, app, imgui, registry, settings
ctx = Context()
mod = Module()
mod.list("code_functions", desc="List of functions for active language")
mod.list("code_types", desc="List of types for active language")
mod.list("code_libraries", desc="List of libraries for active language")
s... |
import mailcap
import os
import shutil
import test.support
import unittest
# Location of mailcap file
MAILCAPFILE = test.support.findfile("mailcap.txt")
# Dict to act as mock mailcap entry for this test
# The keys and values should match the contents of MAILCAPFILE
MAILCAPDICT = {
'application/x-movie... |
# Copyright 2019 The Keras Tuner 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... |
from typing import Dict, Optional, Tuple, Callable
from dbt.logger import (
GLOBAL_LOGGER as logger,
DbtStatusMessage,
TextOnly,
get_timestamp,
)
from dbt.node_types import NodeType
from dbt.tracking import InvocationProcessor
from dbt import ui
from dbt import utils
from dbt.contracts.results import ... |
# © All rights reserved. ECOLE POLYTECHNIQUE FEDERALE DE LAUSANNE,
# Switzerland, Laboratory of Experimental Biophysics, 2016-2018
# See the LICENSE.txt file for more details.
import pathlib
from bstore import config
from abc import ABCMeta, abstractmethod, abstractproperty
from os.path import splitext
import importli... |
# Copyright 2020 IBM Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
# coding=utf-8
# Copyright 2019 The Google AI Language Team 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 ... |
#https://github.com/tommyfms2/pix2pix-keras-byt
#http://toxweblog.toxbe.com/2017/12/24/keras-%e3%81%a7-pix2pix-%e3%82%92%e5%ae%9f%e8%a3%85/
#tommyfms2/pix2pix-keras-byt より
import os
import argparse
import numpy as np
import h5py
import time
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pylab as plt
fro... |
from transformers.models.bert.modeling_flax_bert import FlaxPreTrainedModel, FlaxBertEncoder, FlaxBertPooler, FlaxBaseModelOutputWithPooling
from transformers.models.vit.modeling_flax_vit import FlaxViTModule
from typing import Tuple, Optional
from flax.core.frozen_dict import FrozenDict
import jax
import flax.linen as... |
"""
Chombo-specific fields
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, yt Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#--------------------... |
'''For logging file'''
from colorama import init, Fore, Back
init(autoreset=True) #to convert termcolor to wins color
from pathlib import Path
from os import stat, SEEK_END
from os.path import exists, getsize
from time import time, ctime
from contextlib import suppress
import inspect, json, wrapt
__author__ = "<NAME... |
#!/usr/bin/python
#
# (c) 2015, <NAME> <<EMAIL>>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later ve... |
# Copyright 2017 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 applica... |
#!/usr/bin/env vpython3
# coding=utf-8
# 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.
"""Unit tests for fetch.py."""
import contextlib
import logging
import optparse
import os
import subprocess
import... |
"""The multiscrape component."""
import asyncio
import logging
import os
from datetime import timedelta
import voluptuous as vol
from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN
from homeassistant.components.button import DOMAIN as BUTTON_DOMAIN
from homeassistant.components.sensor imp... |
import math
import torch
import torch.nn as nn
import torch.functional as F
import torch.optim as optim
from package.model.variational_dropout import VariationalDropout
from package.model.vgg import vgg16
from package.loss.triplet_loss import _Triplet_loss, _Ranking_loss
class GaussianNoiseLayer(nn.Module):
def ... |
import numpy as np
import tensorflow as tf
from tensorflow.keras.losses import sparse_categorical_crossentropy
import graphgallery as gg
from graphgallery import functional as gf
from graphgallery.utils import tqdm
from graphgallery.attack.targeted import TensorFlow
from ..targeted_attacker import TargetedAtta... |
# -*- coding: utf-8 -*-
"""A collection of function that are used to parse the output of Quantum Espresso Neb.
The function that needs to be called from outside is parse_raw_output_neb(). The functions mostly work without aiida
specific functionalities. The parsing will try to convert whatever it can in some dictionar... |
'''
Sample usage to track changes in a thread.
import threading
import time
watcher = fsnotify.Watcher()
watcher.accepted_file_extensions = {'.py', '.pyw'}
# Configure target values to compute throttling.
# Note: internal sleep times will be updated based on
# profiling the actual applicat... |
import datetime
import json
import time
from typing import List, Optional, Tuple
import arrow
import s2sphere
from monitoring.monitorlib import fetch, geo, rid
from monitoring.monitorlib.infrastructure import DSSTestSession
from monitoring.monitorlib.typing import ImplicitDict
from monitoring.rid_qualifier.reports im... |
# coding: utf-8
from __future__ import unicode_literals
import re
import json
from .common import InfoExtractor
from ..utils import (
ExtractorError,
int_or_none,
qualities,
)
class IviIE(InfoExtractor):
IE_DESC = 'ivi.ru'
IE_NAME = 'ivi'
_VALID_URL = r'https?://(?:www\.)?ivi\.ru/(?:watch/(?... |
#!/usr/bin/env python
#===================================================================================================
# This script checks a given file (argument) which is assumed to be located on the remote Tier-2
# storage and checks whether it is readable and has the number of events that are expected as
# deri... |
"""
A lot of overrides on top of KubernetesJobWatcher
1. handling resource version management
2. handling of problems during Pending/Running stages
3. fixing dbnd sig term handlers
"""
import logging
import os
import signal
import time
import typing
import attr
from airflow.contrib.executors.kubernetes_executor impo... |
import json
import logging
import os
from datetime import timedelta
from django.conf import settings
from django.core.mail import send_mail
from django.core.management import call_command
from django.utils.timezone import now
import basket
import waffle
from celery import chain, group, shared_task, Task
from celery.e... |
# -*- coding: utf-8 -*-
import numpy as np
import os
import xgboost as xgb
import pytest
import json
from pathlib import Path
import tempfile
import testing as tm
dpath = 'demo/data/'
rng = np.random.RandomState(1994)
class TestBasic:
def test_compat(self):
from xgboost.compat import lazy_isinstance
... |
from pathlib import Path
import tensorflow as tf
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.metrics import confusion_matrix, classification_report, accuracy_score, precision_score, recall_score
from sklearn.metrics import roc_auc_score, matthews_corrcoef, f1_score, average_prec... |
# ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by <NAME> (<EMAIL>)
# Modified by <NAME> (<EMAIL>)
# ------------------------------------------------------------------------------
from __future__ import absolute_impo... |
# -*- coding: utf-8 -*-
"""
.. module:: dag
:synopsis: Enhanced support for directed acyclic graphs and dendrograms.
.. moduleauthor:: <NAME> <<EMAIL>>
"""
import collections
import copy
import itertools
import networkx as nx
import numpy as np
class DAG(nx.DiGraph):
def roots(self):
return [node ... |
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import path
from numpy import linspace
class foreground():
# Contains coor, areas, numpts, dx,dy,dz and right and left boundaries for areas
def __init__(self, coor, vols, xyx_numpts_vec, dx_vec, dy_vec, dh_vec, xr, xl, yr, yl, hr, hl):
... |
###
# Copyright 2021 New H3C Technologies Co., Ltd.
#
# 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... |
# coding=utf-8
# Copyright (C) 2020 NumS Development Team.
#
# 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... |
"""
HiddenLayer
Implementation of the Graph class. A framework independent directed graph to
represent a neural network.
Written by <NAME>. Additions by <NAME>.
Licensed under the MIT License
"""
from __future__ import absolute_import, division, print_function
import os
import re
from random import getrandbits
import... |
'''
MIT License
Copyright (c) 2021 Futurewei Cloud
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, publis... |
# copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve.
#
# 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... |
# coding: utf-8
"""
twitcher.oauth2
---------------
This module implements the `OAuth2 <https://oauthlib.readthedocs.io/en/latest/oauth2/oauth2.html>`_
model to generate access tokens.
These tokens are used to access the compute services (*scope=compute*).
The compute services are accessed via the OWS proxy.
The impl... |
from arche.readers.schema import TaggedFields
from arche.rules.result import Result, Outcome
from arche.tools.helpers import is_number, ratio_diff
import pandas as pd
def compare_was_now(df: pd.DataFrame, tagged_fields: TaggedFields):
"""Compare price_was and price_now tagged fields"""
price_was_fields = tag... |
#!/usr/bin/python
#
# (c) 2013, RSD Services S.A
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later ve... |
import pytest
import cleantext
def test_normalize_whitespace():
text = "Hello, world! Hello...\t \tworld?\n\nHello:\r\n\n\nWorld. "
proc_text = "Hello, world! Hello... world?\nHello:\nWorld."
assert cleantext.normalize_whitespace(text, no_line_breaks=False) == proc_text
assert cleantext.normalize_wh... |
"""
This module lets you practice various patterns
for ITERATING through SEQUENCES, including selections from:
-- Beginning to end
-- Other ranges (e.g., backwards and every-3rd-item)
-- The COUNT/SUM/etc pattern
-- The FIND pattern (via LINEAR SEARCH)
-- The MAX/MIN pattern
-- Looking two places in the seq... |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... |
# Copyright (C) 2019 The Raphielscape Company LLC.
#
# Licensed under the Raphielscape Public License, Version 1.d (the "License");
# you may not use this file except in compliance with the License.
#
""" Userbot module containing commands related to android"""
import asyncio
import json
import math
import os
import r... |
# Copyright The PyTorch Lightning team.
#
# 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 i... |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
"""
Copyright (c) 2016-present, Facebook, Inc.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of patent rights can be found in the PATENTS file in the same directory.
"""
import logging
from typing ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Software License Agreement (BSD License)
#
# Copyright (c) 2014, Ocean Systems Laboratory, Heriot-Watt University, UK.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the follow... |
# -*- coding: utf-8 -*-
import os
import mock
import yaml
import json
# Graphene API
from grapheneapi import exceptions
from grapheneapi.api import Api, Websocket, Http
# Graphenebase
import graphenebase.ecdsa as ecdsa
from graphenebase.aes import AESCipher
from graphenebase.base58 import (
Base58,
base58deco... |
import enum
from collections import OrderedDict
from copy import deepcopy
import gym
import numpy as np
from gym.spaces import Box, Dict
def update_obs_space(env, delta):
spaces = env.observation_space.spaces.copy()
for key, shape in delta.items():
spaces[key] = Box(-np.inf, np.inf, (np.prod(shape),)... |
import sys
import re
import math
import json
import copy
import numpy as np
import chainer
import chainer.functions as F
import chainer.links as L
from chainer import initializers
# nn.Dropout2d is replaced with F.dropout by ignoring differences
def gelu(x):
return 0.5 * x * (1 + F.tanh(math.sqrt(2 / math.pi)
... |
"""
A connection between object logger and background k8s-event poster.
Everything logged to the object logger (except for debug information) is also
posted as a k8s-event -- in the background by `kopf._core.engines.posting`.
This eliminates the need to log & post the same messages, which complicates
the operators' c... |
import os
import sys
import time
import shutil
import argparse
import cv2
cv2.setNumThreads(0)
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader as DataLoader
from torch.nn.utils import clip_grad_norm_
from tensorboardX import SummaryWriter
from config import cf... |
import logging
from threading import Lock
from .base import BaseFolder, MISSING_FOLDER_ERRORS
from .collections import FolderCollection
from .known_folders import MsgFolderRoot, NON_DELETABLE_FOLDERS, WELLKNOWN_FOLDERS_IN_ROOT, \
WELLKNOWN_FOLDERS_IN_ARCHIVE_ROOT
from .queryset import SingleFolderQuerySet, SHALLOW... |
import asyncio
import contextlib
import logging
import random
import re
from functools import partial
from io import BytesIO
from typing import Callable, List, Optional, Sequence, Union
import discord
from discord import Message, MessageType, Reaction, User
from discord.errors import HTTPException
from discord.ext.com... |
import cv2
import numpy as np
import matplotlib.pyplot as plt
import os, sys
import matplotlib.ticker as plticker
import pandas as pd
from collections import OrderedDict
from random import randint
from PIL import Image, ImageChops
from scipy.ndimage.measurements import center_of_mass
def visualize_grid(img, width, he... |
from copy import deepcopy
from django.core.exceptions import ValidationError as DjangoValidationError
from django.conf import settings
from django.core.files.images import ImageFile
from django.db import models
from django.db.models import QuerySet, ManyToManyRel
from django.db.models.fields.files import ImageFieldFile... |
import imgaug
import cv2
import numpy as np
from shapely.geometry import Polygon
import pyclipper
def draw_thresh_map(polygon, canvas, mask, shrink_ratio=0.4):
polygon = np.array(polygon)
assert polygon.ndim == 2
assert polygon.shape[1] == 2
polygon_shape = Polygon(polygon)
if polygon_shape.area ... |
# aes.py Demonstrates how to perform AES encryption and decryption.
#
# https://www.pycryptodome.org/en/latest/src/cipher/aes.html
# https://www.pycryptodome.org/en/latest/src/examples.html#encrypt-data-with-aes
# https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38a.pdf - Contains sample data at th... |
# -*- coding: utf-8 -*-
from __future__ import print_function
from collections import namedtuple
from ethereum import slogging
from raiden.settings import DEFAULT_SETTLE_TIMEOUT
from raiden.utils import sha3, profiling
from raiden.network.transport import UDPTransport
from raiden.network.discovery import Discovery
f... |
from __future__ import absolute_import, division, print_function
# ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed ... |
# Copyright 2016 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 applica... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# SVG transformation list parser
#
# Copyright 2010 <NAME>
#
# This file is part of Scour, http://www.codedread.com/scour/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You ... |
import numpy as np
import queue as Q # queue for ver>3
from functools import total_ordering
@total_ordering
class Node:
def __init__(self, n=1, r_e=0, R_0=0, born_time=0, parent=None,
speciation_time=None, left=None, right=None, index=0):
self.n = n # niche
self.r_e = r_e # bou... |
"""
Backdrop
========
Tooltips display informative text when users hover over, focus on,
or tap an element.
Copyright (c) 2015 <NAME> and KivyMD contributors -
KivyMD library up to version 0.1.2
Copyright (c) 2019 <NAME> and KivyMD contributors -
KivyMD library version 0.1.3 and higher
For suggestions and qu... |
import gym
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from replay_memory import ReplayBuffer, PrioritizedReplayBuffer
from logx import EpochLogger
from logx import setup_logger_kwargs
import random
import os
import pickle
import time
from collections import deque
import matplo... |
# Copyright 2021 The Flax 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 wri... |
from time import sleep
from helpers import setup_logger
logger = setup_logger(__name__, "warning")
import string
from utils import to_be_foreground
from canvas import Canvas
from base_ui import BaseUIElement
class CharArrowKeysInput(BaseUIElement):
"""
Implements a character input dialog which allows to inp... |
## TODO: define the convolutional neural network architecture
import torch
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
# can use the below import should you choose to initialize the weights of your Net
import torch.nn.init as I
# helper conv() function to set up a convolu... |
# Copyright 2020 QuantStack
# Distributed under the terms of the Modified BSD License.
import logging
import logging.config
import os
from distutils.util import strtobool
from secrets import token_bytes
from typing import (
Any,
Dict,
Iterable,
List,
NamedTuple,
NoReturn,
Optional,
Type... |
#%%
# uncomment this block for google colab
# !pip install psyneulink
# !pip install stroop
# !pip install seaborn
#%%
# import os
import time
import numpy as np
import psyneulink as pnl
from Scripts.Debug.Jason_Stroop_Stimuli import get_stimulus_set, TASKS, COLORS, CONDITIONS
# import matplotlib.pyplot as plt
# f... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
from const import use_cuda
class EncoderRNN(nn.Module):
def __init__(self, input_size, lstm_dim, embed_dim_que, num_layers):
super(EncoderRNN, self).__init__()
self.lstm_dim = ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.