text stringlengths 6.04k 39.5k |
|---|
# Copyright 2019, The TensorFlow Federated 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 o... |
# -*- coding: utf-8 -*-
# Copyright 2018 Google LLC
#
# 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 o... |
# coding=utf-8
# Copyright (c) 2019 NVIDIA CORPORATION. All rights reserved.
# Copyright 2018 The Google AI Language Team Authors and The HugginFace Inc. 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 o... |
# -*- coding: utf-8 -*-
import torch
from torch import nn
from support_DynamicNet import getActivationList, getPoolingList, convOutputShape
import numpy as np
from tqdm import tqdm
import matplotlib.pyplot as plt
class DynamicCNN(nn.Module):
def __init__(self, parameters, print_var = False, tracking_inpu... |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... |
# 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... |
# -*- coding: utf-8 -*-
import MaxPlus
from anima.env.base import EnvironmentBase
def get_max_version():
"""Encapsulates the very cumbersome 3ds Max version string retrieval
process and returns a simple string that contains the current MAX
version.
:return:
"""
versions_LUT = {
17000... |
#!/usr/bin/env python3
"""Prototype for HPE Container Platform API.
Required this functionality to be more usable: https://github.com/google/python-fire/issues/255
Example configuration file (~/.hpecp.conf):
[default]
api_host = 127.0.0.1
api_port = 8080
use_ssl = True
verify_ssl = False
warn_ssl = True
[demosrv]... |
# *************************************************
# |docname| - LTI Endpoint for integrating with LMS
# *************************************************
#
# Imports
# =======
# These are listed in the order prescribed by `PEP 8
# <http://www.python.org/dev/peps/pep-0008/#imports>`_.
#
# Standard library
# ----------... |
import argparse
import json
import logging
import operator
import os
import re
import sys
import traceback
import yaml
from collections import defaultdict
from greent.servicecontext import ServiceContext
from greent.graph import Frame
from greent.graph import TypeGraph
from greent.graph_components import KNode, KEdge
f... |
from ctypes import Structure, c_ulong, string_at, byref, sizeof, c_char, c_size_t, POINTER
from struct import pack, unpack
class AssembleError(Exception):
'Exception related to QPU assembler'
#============================== Encoding tables ===============================
# Signaling bits.
_SIGNAL = {
name: c... |
# -*- coding: utf-8 -*-
"""
Created on Sun May 19 18:18:31 2019
@author: Lee
"""
# Modules will pull all of the temperature versus time data from the original runs
# Should put the data into HDF5 tables as discussed in class
# Create a rank of the maximum average temperature (on full pot body)
# This ... |
"""
Tools for converting Cran packages to conda recipes.
"""
from __future__ import absolute_import, division, print_function
import requests
import yaml
import re
import sys
from os import makedirs, listdir
from os.path import join, exists, isfile, basename, isdir
from itertools import chain
import subprocess
from... |
import json
import logging
import plistlib
from urllib.parse import unquote
from cryptography import x509
from cryptography.hazmat.primitives import hashes
from django.core.files.storage import default_storage
from django.db import transaction
from django.http import FileResponse, HttpResponse, HttpResponseRedirect, Js... |
import numpy as np
import os
from abc import ABC, abstractmethod
import matplotlib.pyplot as plt
from argparse import ArgumentParser
import astropy.constants as const
import astropy.units as units
# i don't understand how to make this work correctly...
# from . import utils
# from . import transformation as transform
... |
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2015, ARM Limited and contributors.
#
# 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
#
# ... |
# Copyright 2019-2020 the ProGraML authors.
#
# Contact <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/licenses/LICENSE-2.0
#
# Unless required... |
from django.shortcuts import render, redirect
from django.contrib import messages
from django.http import HttpResponse
from . import forms
from django.views.generic.edit import FormView
from django.views.generic import TemplateView
from .models import Application
import locale
import datetime
class ExtraContextView(Te... |
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from extensions.ops.MatMul import FullyConnected
from extensions.ops.activation_ops import Tanh, Sigmoid
from extensions.ops.elementwise import Add, Mul
from extensions.ops.split import Split
from mo.front.caffe.extra... |
#!/usr/bin/env python3
#
# Copyright (c) 2018 <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:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of... |
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
from core import utils
import os
import codecs
import pickle
import threading
import logging
from time import sleep
import hashlib
from nltk.tokenize import RegexpTokenizer
from stop_words import get_s... |
#**
# * Copyright (c) 2020-2021 <NAME>
# *
# * This file is part of pywpsrpc.
# *
# * This file is distributed under the MIT License.
# * See the LICENSE file for details.
# *
#*
import sipbuild
import os
import sys
import shutil
import re
import platform
var_pattern = re.compile(
rb"(\s+::([a-zA-Z0-9_]+::)?[a-z... |
#!/usr/bin/env python3
# Copyright 2021 The IREE Authors
#
# Licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
"""iree_generated_trace_runner_test generator for e2e matmul tests.
"""
import ... |
#! -*- coding: utf-8 -*-
# 主要模型
import numpy as np
from bert4keras.layers import *
from functools import partial
import json
Model = keras.models.Model
class BertModel(object):
"""构建跟Bert一样结构的Transformer-based模型
这是一个比较多接口的基础类,然后通过这个基础类衍生出更复杂的模型
"""
def __init__(
self,
vocab_... |
############################
# 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 (th... |
#!/usr/bin/env python3
"""runmfdn00.py -- running h2mixer + MFDn
Example runs of h2mixer (for setup) followed by MFDn, for 4He.
Instructions are provided below:
Setup
Phase 0
Phase 1
Common problems
----------------------------------------------------------------
... |
import os
from functools import partial
import numpy as np
import gc
import time
import open3d as o3d
import pymp
import torch.utils.data
from data_source import DataSource
from dh_grid import DHGrid
from sphere import Sphere
from tqdm.auto import tqdm, trange
from tqdm.contrib.concurrent import process_map, thread_m... |
import torch
from torch import nn, LongTensor
import torch.nn.functional as F
from fastai.vision.image import ImageBBox
from fastai.vision.data import ObjectCategoryList, ObjectItemList
from fastprogress import progress_bar
import numpy as np
import random
def conv_params(in_size, out_size):
filters = [3,2,5,4]
... |
# -*- coding=utf-8 -*-
import itertools
import re
import sys
from collections import namedtuple
from traceback import format_tb
import six
from . import environments
from ._compat import decode_for_output
from .patched import crayons
from .vendor.click.exceptions import (
ClickException, FileError, UsageError
)... |
'''
Parse the Versa Literate (Markdown) serialization of Versa
Proper entry point of use is versa.serial.literate
see: doc/literate_format.md
'''
import re
import itertools
import markdown
from amara3 import iri # for absolutize & matches_uri_syntax
from amara3.uxml import html5
from amara3.uxml.tree import treeb... |
# -*- coding: utf-8 -*-
"""General linear model
author: <NAME>
"""
import numpy as np
from numpy.linalg import eigvals, inv, solve, matrix_rank, pinv, svd
from scipy import stats
import pandas as pd
from patsy import DesignInfo
from statsmodels.compat.pandas import Substitution
from statsmodels.base.model import Mod... |
# Copyright 2022 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/python
# Copyright 2020 <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
#
# Unless required by applicable law or agree... |
import os
import itertools
import multiprocessing as multi
from ._dl import gd
# from ._lowess_smooth import lowess_smooth
from .. import remove_outliers, interp2d, LinterpMulti
from ..utils import nd_to_columns, columns_to_nd, scale_min_max
from .. import rolling_mean2d, peaks_valleys2d, group_peaks_valleys2d
# from ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2018-2019, <NAME> (@Andersson007) <<EMAIL>>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_... |
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 19 13:47:01 2019
@author: abibeka
Read data from Node Data files
Get the GEH for every 15 mins - in the 3 hour analysis period.
"""
#0.0 Housekeeping. Clear variable space
from IPython import get_ipython #run magic commands
ipython = get_ipython()
ipython.magic("reset -f... |
import json
import logging
import os
from argparse import Namespace
import click
import torch
from torch.utils.data import DataLoader, RandomSampler
from torch.utils.data.distributed import DistributedSampler
from tqdm import tqdm
from transformers import WEIGHTS_NAME
from luke.utils.entity_vocab import MASK_TOKEN
fr... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
import operator
from functools import reduce
from django.core.cache import cache, utils
from django.contrib import messages
from django.contrib.admin.utils import label_for_field
from django.db import models
# from django.db.models import fie... |
import torch.nn as nn
import torch.nn.functional as F
import torch
import numpy as np
from ptsemseg.models.utils import pyramidPooling
# from utils.helpers import maybe_download
# from utils.layer_factory import conv1x1, conv3x3, CRPBlock, RCUBlock
IMG_SCALE = 1./255
IMG_MEAN = np.array([0.485, 0.456, 0.406]).resha... |
"""
Matrix Synapse Password Provider Based on EuroPython Conference User Auth
This module is a Matrix Synapse password provider that uses the EuroPython
conference website (e.g. ep2021.europython.eu) to authenticate users.
The basic flow is as follows: users authenticate on the EuroPython conference
website (e.g. htt... |
import ctypes
from turtle import distance
import _ctypes
import pygame
import pygame.freetype
import sys
import time
import math
import threading
from queue import Empty, Queue
from dataclasses import dataclass
from pykinect2 import PyKinectV2, PyKinectRuntime
from pykinect2.PyKinectV2 import *
from PyQt5.QtCore impor... |
# Copyright 2021 Huawei 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 applicable law or agreed to... |
from typing import Optional
from fastapi import APIRouter, Response, status
from fastapi.responses import JSONResponse
import requests, json, os
from loguru import logger
from bson import ObjectId
from app.db import mongo_setup_admin
from app.bootstrap import setup_issuer, setup_vc_schema
#from app.authentication imp... |
import argparse
import glob
import json
import os
import pdb
import pytorch_lightning as pl
import random
import torch
from num2words import num2words
from pytorch_lightning.callbacks import ModelCheckpoint
from transformers import AutoModelForSeq2SeqLM
from transformers import AutoTokenizer
from torch.utils.data imp... |
import copy
import numpy as np
from dolfin import *
import hilbertcurve.hilbertcurve as hilbert
import hilbert_cython
import sur_array_cython
def u2alpha(u_bangs, u):
assert u.ndim == 1
assert u_bangs.ndim == 1
assert np.linalg.norm(np.sort(u_bangs) - u_bangs) == 0.0
u = copy.deepcopy(u)
u = np... |
#!/usr/bin/env python
"""
Copyright (c) 2006-2015 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import threading
import time
from extra.safe2bin.safe2bin import safecharencode
from lib.core.agent import agent
from lib.core.common import Backend
from lib.core.common impo... |
#
# For licensing see accompanying LICENSE file.
# Copyright (C) 2020 Apple Inc. All rights reserved.
#
'''Train CIFAR10 with PyTorch.'''
# import os
# os.environ['CUDA_LAUNCH_BLOCKING'] = "1"
# pip install pytorch-warmup
# Num epochs=600, lr scheduler after every 100 epochs
# CUDA_VISIBLE_DEVICES=0 python3 main1.py --... |
import unittest
from robot.errors import DataError
from robot.utils.asserts import (assert_equal, assert_false,
assert_raises_with_msg, assert_true)
from robot.variables.search import (search_variable, unescape_variable_syntax,
VariableIterator)
cl... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
TRMOKE_V20.py
Author: <NAME>, <NAME>
Last Edited: 06.12.2018
Python Version: 3.6.5
PyQt Version: 5.9.2
Pyqtgraph Version: 0.10.1
Application to measure Time Resolved and Static Hysteresis.
Structure of this module:
1) Imports
2) Debug Settings
3) Global Variables
4... |
from hydra_base import JSONObject, Dataset
import json
import datetime
import logging
log = logging.getLogger(__name__)
def build_network(conn, name=None, project_id=None, num_nodes=10):
"""
Create a network with the correct
"""
#Does nothing if project id is None, just returns the project i... |
import cv2
import numpy as np
import os
import re
import skimage.io
import torch
from torch.utils.data import Dataset
from torchvision.transforms import ColorJitter
from torchvision.transforms.functional import to_pil_image, to_tensor
import xml.etree.ElementTree as ET
from utils.transforms import affine_transform
fro... |
# -*- coding: utf-8 -*-
#
# Author: <NAME> <<EMAIL>>
#
# Array utilities
from sklearn.utils import validation as skval
import numpy as np
import pandas as pd
from ..compat import DTYPE
from ._array import C_intgrt_vec
__all__ = [
'as_series',
'c',
'check_endog',
'check_exog',
'diff',
'diff_i... |
import configparser
import os
from invoke import task
from ecs.tasks import *
config = configparser.ConfigParser()
config.read('.ini')
AWS_PROFILE = 'iotile_cloud'
AWS_REGION = 'us-east-1'
# See .ini.sample for example of expected .ini
AWS_ACCOUNT = config['DEFAULT']['AWS_ACCOUNT']
DEFAULT_SERVER_APP_NAME = 'ioti... |
# test_config.py -- Tests for reading and writing configuration files
# Copyright (C) 2011 <NAME> <<EMAIL>>
#
# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
# General Public License as public by the Free Software Foundation; version 2.0
# or (at your option) any later version. You can redi... |
# Natural Language Toolkit: Chart Parser for Feature-Based Grammars
#
# Copyright (C) 2001-2021 NLTK Project
# Author: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
Extension of chart parsing implementation to handle grammars with
feature structure... |
"""
Date 02.2021
@author: Chair of Functional Materials - Saarland University - Saarbrücken, <NAME>
@version 1.1
"""
__author__ = '<NAME>'
#######################################################################################################################
#
# The MIT License (MIT)
#
# Copyright (c) 2021 ... |
#!/usr/bin/python
# To kick off the script, run the following from the python directory:
# PYTHONPATH=`pwd` python DriveDaemon.py start
#
#standard python libs
import logging
import time
import datetime
import socket
import threading
import os
import io
import atexit
#from cStringIO import StringIO
import scipy.mis... |
''' Schemdraw base Element class '''
from collections import ChainMap
import numpy as np
from ..backends.mpl import Figure
from ..adddocs import adddocs
from ..segments import SegmentText, BBox
from ..transform import Transform, mirror_point, flip_point
gap = [np.nan, np.nan] # Put a gap in a path
def angle(a, b)... |
#!/usr/bin/python
import math
import sys
import os
import re
import subprocess
import numpy as np
import pandas as pd
import argparse
import operator
import mxnet as mx
import struct
import cv2
from collections import namedtuple
import scipy.io
import matplotlib.pyplot as plt
import matplotlib as mpl
import pylab
impo... |
# Copyright 2013-2015 ARM 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/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... |
#!/usr/bin/env python
import argparse
import common
import dxpy
import logging
import numpy as np
import pandas as pd
import os
from constants import (
LIMIT_ALL_JSON,
REPORT_TYPES,
REPORT_TYPE_DETAILS
)
from output import get_outputter
def make_url(base_url, query, additional=LIMIT_ALL_JSON):
'''
... |
"""
Consensus Algorithm for Six mobile robots Fully Connected Adjancency Matrix
"""
import math
import numpy as np
import rclpy
from rclpy.node import Node
from tf2_msgs.msg import TFMessage
from std_msgs.msg import Float32
# importing the required module
import matplotlib.pyplot as plt
import time
import csv
k = 1... |
import numpy as np
import pandas as pd
import pickle
import os
from math import ceil
import matplotlib
import matplotlib.gridspec as gridspec
import matplotlib.pyplot as plt
import seaborn as sns
import warnings
import copy
from scipy.stats import entropy
from matplotlib.ticker import FormatStrFormatter
import statsmod... |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
import json
import logging as log
from pathlib import Path
import requests
from typing import Dict, List, Union
from urllib.parse import urljoin
import numpy as np
import astropy.time
from calibration import CalibrationTables
from striptease import (
STRIP_BOARD_N... |
from os import walk, chdir, listdir, path
from requests.auth import HTTPBasicAuth
from requests import post, put, get
import json
import google.auth
import google.auth.impersonated_credentials
from google.api_core.exceptions import BadRequest
from googleapiclient.errors import HttpError
from googleapiclient.discovery ... |
# Copyright 2017 <NAME>. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... |
import csv
import os
import numpy as np
import torch
from torch.autograd import Variable, grad
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from tqdm import tqdm
import models
import argparse
from torchvision import transforms
from utils import *
import torch.backends... |
"""Graph utility functions."""
import geopandas as gpd
import networkx as nx
import numpy as np
import pandas as pd
from collections import Counter
from itertools import chain
from shapely.geometry import LineString
from shapely.geometry import Point
from . import distance
from . import utils
def graph_to_gdfs(G, no... |
"""Matcher from the SMEFT 'Warsaw up' basis to the WET JMS basis.
Based on arXiv:1709.04486."""
import numpy as np
from math import sqrt, pi
from wilson import wcxf
import wilson
from wilson.parameters import p as default_parameters
from wilson.util import smeftutil, wet_jms
# Based on arXiv:1709.04486
# CONSTANTS... |
#from jupyter_dash import JupyterDash
from dash import Dash
from dash import html, dcc, Input, Output, State
from dash import dash_table, callback_context
import numpy as np
#from dash.dependencies import Input, Output
#import dash_html_components as html
#import dash_core_components as dcc
import dash_bootstrap_compon... |
import gc
import os
import numpy as np
import pandas as pd
import csv
import re
#from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
from nltk.stem.snowball import SnowballStemmer
from sklearn import model_selection
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.featur... |
# GPTune Copyright (c) 2019, The Regents of the University of California,
# through Lawrence Berkeley National Laboratory (subject to receipt of any
# required approvals from the U.S.Dept. of Energy) and the University of
# California, Berkeley. All rights reserved.
#
# If you have questions about your rights to use o... |
#!/usr/bin/env python
import sys
import os
import difflib
import copy
from itertools import product, count
from multiprocessing import Pool, cpu_count
from heapq import heappush, heappop
# Compatibility with Python < 2.6
#
try:
from heapq import heappushpop
except ImportError:
def heappushpop(heap, item):
heap... |
import numpy as np
from scipy.special import expi, gammainc
from .ssp_basis import SSPBasis
__all__ = ["CSPBasis", "StepSFHBasis", "CompositeSFH", "LinearSFHBasis"]
# change base
from .constants import loge
class CSPBasis(object):
"""
A class for composite stellar populations, which can be composed from
... |
"""Rules for building DV infrastructure."""
load(":verilog.bzl", "ToolEncapsulationInfo", "VerilogInfo", "flists_to_arguments", "gather_shell_defines", "get_transitive_srcs")
DVTestInfo = provider(fields = {
"sim_opts": "Simulation options to carry forward.",
"uvm_testname": "UVM Test Name; passed to simulato... |
# Copyright (c) 2009-2014, <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:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions a... |
from __future__ import absolute_import, division # makes KratosMultiphysics backward compatible with python 2.6 and 2.7
# Importing the Kratos Library
import KratosMultiphysics
# Import applications
import KratosMultiphysics.FluidDynamicsApplication as KratosCFD
# Import base class file
from KratosMultiphysics.Flui... |
# coding: utf-8
# # Pipeline processing using serial workflows.
#
# This is a serial unrolled version of the predict step
# In[1]:
#get_ipython().run_line_magic('matplotlib', 'inline')
import os
import sys
sys.path.append(os.path.join('..', '..'))
from data_models.parameters import arl_path
from mpi4py import ... |
"""
Morgan.
authors: <NAME> and <NAME>
contact: dangeles at caltech edu
"""
import pandas as pd
import warnings as wng
import numpy as np
import pymc3 as pm
# import theano
###############################################################################
# ----------------------------------------------------------------... |
"""************************************************************************
* *
* Algorithmic C (tm) Datatypes *
* *
* Software Ver... |
from tornado.testing import AsyncTestCase, bind_unused_port, get_async_test_timeout
from tornado.httpserver import HTTPServer
from tornado.httpclient import AsyncHTTPClient, HTTPError, HTTPRequest
from tornado.websocket import websocket_connect
from tornado.ioloop import IOLoop
from . import sign
from . admin import R... |
import torch
from torch.autograd import Variable
CUDA = torch.cuda.is_available()
def _inflate(tensor, times, dim):
"""
Given a tensor, 'inflates' it along the given dimension by replicating each slice specified number of times (in-place)
Args:
tensor: A :class:`Tensor` to inflate... |
from __future__ import division, absolute_import
import cStringIO
import sys
def format_none(format, null_value=0, replace_with="None"):
assert isinstance(replace_with, str)
value_width = len(replace_with)
return " " * max(0, len(format % null_value) - value_width) + replace_with
def format_value(format, value... |
import numpy as np
import scipy
import json
import os
import pickle
from nbodykit.cosmology import Planck15, LinearPower
from nbodykit.lab import *
from vmad.lib.fastpm import ParticleMesh
from pmesh.pm import RealField, ComplexField
def a2z(a):
"""
scale factor to redshift
"""
return 1./a-1
def z2a(... |
#!/usr/bin/python
"""
Group Submission
----------------
<NAME>
21239525
MSc. AI
GitHub: https://github.com/kakashi336/ARC
AND
<NAME>
21230080
MSc. AI
GitHub: https://github.com/mayankd1/ARC
"""
import os, sys
import json
import numpy as np
import re
### YOUR CODE HERE: write at least three functions which s... |
"""Fixtures for Plex tests."""
from unittest.mock import patch
import pytest
from homeassistant.components.plex.const import DOMAIN, PLEX_SERVER_CONFIG, SERVERS
from homeassistant.const import CONF_URL
from .const import DEFAULT_DATA, DEFAULT_OPTIONS, PLEX_DIRECT_URL
from .helpers import websocket_connected
from .mo... |
from torch.utils.data import Dataset
from SyntheticDataGenerator.structuredgraph import StructuredGraph
from torch.utils.data import DataLoader
from SyntheticDataGenerator.structural_equation import binary_noisy_lin_generator, NoisyLinear, \
noisy_lin_hidden_lin_obs_generator, noisy_lin_hidden_neural_net_obs_genera... |
# -*- coding: utf-8 -*-
import torch
import torch.nn.functional as F
import numpy as np
import random
from prettytable import PrettyTable
from itertools import combinations
from rxn_yield_context.train_multilabel.args_train import TrainArgs_rxn
from rxn_yield_context.train_multilabel.model_utils import Reacti... |
from bs4 import BeautifulSoup
import urllib.request
import ssl
import requests
import json
import csv
context = ssl._create_unverified_context()
# print('context', context)
def get_new_feed():
url = 'https://ncov.moh.gov.vn/web/guest/trang-chu'
# page = urllib.request.urlopen(url, context=context)
page = r... |
import math
from copy import deepcopy
import gin
import gym
import numpy as np
from .helpers import fill_n
from .features_xy import dict_to_arr, obs_features_handcoded
class DelayedExecutor(object):
"""Execute stored commands after a pre-defined number of steps."""
def __init__(self):
self.queue = [... |
# code was heavily based on https://github.com/clovaai/stargan-v2
# Users should be careful about adopting these functions in any commercial matters.
# https://github.com/clovaai/stargan-v2#license
import paddle
from paddle import nn
import paddle.nn.functional as F
from .builder import GENERATORS
import numpy as np
i... |
# coding=utf-8
# Copyright (c) 2019 NVIDIA CORPORATION. All rights reserved.
# Copyright 2018 The Google AI Language Team Authors and The HugginFace Inc. 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 ... |
import os
import sys
import time
import shutil
import random
import subprocess
from itertools import starmap
from tempfile import mkdtemp, NamedTemporaryFile
from .. import FlowSpec
from ..current import current
from ..metaflow_config import DATATOOLS_S3ROOT
from ..util import is_stringish,\
to_byte... |
# -*- coding: ISO-8859-1 -*-
#===============================================================================
# VLC Player Plugin by <NAME> 2007
# modified by <NAME> 2008
#
# This is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as publishe... |
from __future__ import print_function
from __future__ import absolute_import
import random
import warnings
import numpy as np
from PIL import Image
from math import ceil
try:
import cPickle as pickle
except:
import pickle
import scipy.special as scsp
from scipy import stats as scst
import matplotlib.pyplot as ... |
import lib.PySimpleGUI as sg
from lib.AUConfig import AUConfig, GameHostOptions, PlayerStats
from __version__ import __version__
from os import environ
from lib.data_indexes import hats_dict, skins_dict, visors_dict, pets_dict, nameplates_dict, color_indexes
import sys
import ctypes
from os import path
from lib.datacla... |
import warnings
from django.contrib.auth.models import Permission
from django.conf.urls import url
from django.core.urlresolvers import reverse
from django.core.exceptions import ImproperlyConfigured
from django.db.models import Model
from django.forms.widgets import flatatt
from django.utils.translation import ugette... |
import xml.etree.ElementTree as ET
import os
import subprocess
from message_util import get_phone_test, cancel_all_recv, get_code, add_black
from config import message_token
import asyncio
import time
import random
from telethon import TelegramClient
from telethon.sessions import StringSession
import config
import te... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import division
from __future__ import print_function
from __future__ import with_statement
import pkg_resources
from pkg_resources import resource_filename
import os
import sys
import re
from pathlib import Path, PurePosixPath
import argparse
import er... |
"""
Code borrowed from https://github.com/shubhtuls/toe/blob/master/data/base.py
Base data loading class.
Should output:
- img: B X 3 X H X W
- mask: B X H X W
- kp (optional): B X nKp X 2
- sfm_pose (optional): B X 7 (s, tr, q)
(kp, sfm_pose) correspond to image coordinates in [-1, 1]
"""
from __f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.