text
stringlengths
3.07k
22.1k
#!/usr/bin/env python # MIT License # # Copyright The SCons Foundation # # 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...
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file acc...
"""Quantum mechanical operators. TODO: * Fix early 0 in apply_operators. * Debug and test apply_operators. * Get cse working with classes in this file. * Doctests and documentation of special methods for InnerProduct, Commutator, AntiCommutator, represent, apply_operators. """ from sympy import Expr from sympy.pri...
# 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 applica...
import functools from django.core.exceptions import FieldDoesNotExist from django.db.models import ForeignKey, Prefetch from django.db.models.constants import LOOKUP_SEP from graphene.types.resolver import attr_resolver from graphene_django import DjangoObjectType from graphene_django.fields import DjangoListField fro...
import os # import tensorflow as tf import tensorrt as trt from tensorrt.parsers import uffparser import pycuda.driver as cuda # import uff import cv2 import numpy as np from tqdm import tqdm TEST_PATH = "/media/andy/Data/DevWorkSpace/Projects/imageClassifier/data/test/" # TEST_PATH = "/home/andy/caffe/examples/myda...
"""Example showing how one can implement a simple self-play training workflow. Uses the open spiel adapter of RLlib with the "connect_four" game and a multi-agent setup with a "main" policy and n "main_v[x]" policies (x=version number), which are all at-some-point-frozen copies of "main". At the very beginning, "main"...
import numpy as np import pytest from randomgen import PCG64, PCG64DXSM, LCG128Mix, SeedSequence from randomgen.pcg64 import DEFAULT_DXSM_MULTIPLIER, DEFAULT_MULTIPLIER try: from numba import cfunc, types MISSING_NUMBA = False except ImportError: MISSING_NUMBA = True SEED = 12345678909876543321 C_SOURC...
import os from flask import Flask, render_template, request, session, redirect, flash from flask_session import Session from tempfile import mkdtemp import sqlite3 from werkzeug.security import check_password_hash, generate_password_hash from werkzeug.utils import secure_filename from PIL import Image, ImageOps from fu...
# nuScenes dev-kit. # Code written by <NAME>, 2019. # Licensed under the Creative Commons [see license.txt] """ Export 2D annotations (xmin, ymin,xmax, ymax) from re-projections of our annotated 3D bounding boxes to a .json file. """ from nuscenes.nuscenes import NuScenes from nuscenes.utils.geometry_utils import vie...
#!BlockchainNodeRunner Class """ This class serves as service API for each blockchain node. It is Flask based REST APIs provider which runs as server. It exposes APIS forthe following: 1) Node Registration - This post API allows peer to peer node registration whereas each node manages its own copy of block chain 2...
import os import sys import glob import multiprocessing as mp import numpy as np import matplotlib.pyplot as plt from ctypes import c_float import math import util import util_feature_IO import util_batch import util_geometry import util_meta import util_amira import constants import calc_features_mp def getEmptySta...
from torch.utils.data import DataLoader, Dataset, Sampler from pathlib import Path from collections import defaultdict import json import random from multiprocessing import Pool import h5py import pickle import math from tqdm import tqdm import torch import numpy as np from copy import deepcopy from torch.utils.data.d...
# Copyright 2013 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
import unittest import subprocess as sp from . import settings from squad_client.core.api import SquadApi from squad_client.core.models import Squad, Group, Project, Build, Environment, Test, TestRun, Metric from squad_client.utils import first PASS = 'pass' FAIL = 'fail' XFAIL = 'xfail' SKIP = 'skip' class SquadS...
# BEGIN_COPYRIGHT # # Copyright 2009-2014 CRS4. # # 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 a...
""" **Module - Common Application Utilities** utilities for commonly performed tasks """ __developer__ = "mobius-crypt" __email__ = "<EMAIL>" __twitter__ = "@blueitserver" __github_repo__ = "https://github.com/freelancing-solutions/memberships-and-affiliate-api" __github_profile__ = "https://github.com/free...
#----------------------------------------------------------------------------- # Copyright (c) 2012 - 2022, Anaconda, Inc., and Bokeh Contributors. # All rights reserved. # # The full license is in the file LICENSE.txt, distributed with this software. #-------------------------------------------------------------------...
#!/usr/bin/env python # import libs from types import ListType, DictType, IntType, FloatType import warnings # import classes import analytics.utils.misc as misc from analytics.core.map.dataitemmap import DataItemMap from analytics.core.map.clustermap import ClusterMap from analytics.core.map.elementmap import Element...
# -*- coding: utf-8 -*- """ seach.py --- functions dealing with searching jen Copyright (C) 2017, Jen This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the Lice...
# Copyright 2019 The TensorFlow Authors, Intel Corporation. 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 ...
# -*- coding: utf-8 -*- import io import os import bz2 from lxml import etree from tqdm import tqdm import re import csv # # English-specific parser # # Common pronunciation definition # * {{a|RP}} {{IPA|/pɔːtˈmæn.təʊ/|lang=en}} # * {{a|US}} {{enPR|pôrtmă'ntō}}, {{IPA|/pɔːɹtˈmæntoʊ/|lang=en}}; {{...
import math from itertools import permutations import matplotlib.pyplot as plt import py3dbp from mpl_toolkits.mplot3d.art3d import Poly3DCollection def create_containers(max_dim: int = 12) -> list: """Creates containers for all permutations of dimensions. The maximum dimension for any side is set by max_di...
import argparse import numpy as np import imageio import torch from tqdm import tqdm import scipy import scipy.io import scipy.misc from lib.model_testGCN import D2Net #from lib.model_test import D2Net from lib.utils import preprocess_image from lib.pyramid import process_multiscale import cv2 import matplotlib....
import sqlite3 import os import time from . import ret_models import random import string import json from typing import List from threading import RLock import re def generate_randstring(num=8): value = ''.join(random.sample(string.ascii_letters + string.digits, num)) return(value) class YcmQuery: def _...
# event/registry.py # Copyright (C) 2005-2019 the SQLAlchemy authors and contributors # <see AUTHORS file> # # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """Provides managed registration services on behalf of :func:`.listen` arguments. ...
"""Convert Noorlib library html to OpenITI mARkdown. This script subclasses the generic MarkdownConverter class from the html2md module (based on python-markdownify, https://github.com/matthewwithanm/python-markdownify), which uses BeautifulSoup to create a flexible converter. The subclass in this module, NoorlibHtml...
from functools import partial from django import forms from django.contrib import admin from django.contrib.postgres.forms.array import SplitArrayField from django.db import models from django.forms.fields import CharField from django.urls import path from django.utils.html import format_html_join from django.utils.sa...
"""Module to keep static function that should usually stay in the library module. Examples: torch.stack, torch.argmax """ # stdlib from typing import Callable from typing import Dict from typing import List from typing import Optional from typing import Tuple from typing import Union from uuid import UUID # third par...
"""The bot""" import asyncio import aiohttp from datetime import datetime, timedelta import discord from discord.ext import commands import importlib from modules.utils import utils import os import sys # Useful functions if sys.platform == "win32" or sys.platform == "win64": def clear(): ...
import base64 import pickle import warnings import numpy as np import pandas as pd import streamlit as st from sklearn.decomposition import FastICA from sklearn.ensemble import GradientBoostingClassifier from sklearn.metrics import (accuracy_score, classification_report, confusio...
# Modified from https://github.com/karpathy/char-rnn # This version is for cases where one has already segmented train/val/test splits from __future__ import print_function, division import codecs import numpy as np from os import path import gc import re from collections import Counter, OrderedDict, namedtuple enco...
# Copyright (c) 2014-present PlatformIO <<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 by applicable law or ag...
from __future__ import unicode_literals, division, absolute_import from builtins import * # pylint: disable=unused-import, redefined-builtin from future.moves.urllib.parse import unquote import copy from math import ceil from flask import jsonify, request from flask_restplus import inputs from flexget.api import ap...
# 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 use ...
""" This submodule contains a helper class for feature flag evaluation, as well as some implementation details. """ from collections import namedtuple import hashlib import logging from typing import Optional, List, Any import sys from ldclient import operators from ldclient.util import stringify_attrs from ldclient...
from django.core.exceptions import ObjectDoesNotExist from rbBot.models import User, Temp, PlanningSession, Location, Route from decimal import Decimal # hid keys in local _secrets.py NOT PUSHED TO GITHUB try: # HERE API Keys import rb.settings._secrets as secure SECRET_KEY_3 = secure.SECRET_KEY_3 SEC...
import numpy as np from enum import Enum class Dir(Enum): up = 0 down = 1 left = 2 right = 3 class Snake: def __init__(self, name, body, width, height, health): self.name = name self.health = 100 self.head = body[0] self.tail = body[len(body) - 1] self.len...
from __future__ import absolute_import from __future__ import division from __future__ import print_function from compas.geometry import add_vectors from compas.geometry import centroid_points from compas.geometry import cross_vectors from compas.geometry import length_vector from compas.geometry import normalize_vect...
# Copyright 2020 Google LLC. 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 a...
#!/usr/bin/env python # Copyright (C) 2012 The CyanogenMod Project # Copyright (C) 2012-2017 AICP Project # Copyright (C) 2018-2020 BaikalOS Project # # 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 Licen...
# -*- coding: utf-8 -*- # Authors: <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # # License: BSD (3-clause) import os.path as op from io import BytesIO, SEEK_SET from gzip import GzipFile import numpy as np from scipy import sparse from .tag import read_tag_info, read_tag, Tag, _call_dict_names from .tree import mak...
import logging import os import sys import time from decimal import Decimal import ccxt import sqlalchemy from ccxt import NetworkError from sqlalchemy.orm import sessionmaker from src.BalanceQueue import BalanceQueue, QueueType from src.CcxtOrderImporter import CcxtOrderImporter from src.CsvOrderImporter import CsvO...
# -*- coding: utf-8 -*- from mitmproxy.net.http import Headers from mitmproxy.test.tutils import treq, raises from .test_message import _test_decoded_attr, _test_passthrough_attr class TestRequestData: def test_init(self): with raises(ValueError): treq(headers="foobar") assert isinst...
#!/usr/bin/env python3 import os import sys import yaml import inflection """ Generate dSpace CRD from templates and configuration file (model.yaml). TBD: a principled version from k8s code generators. """ _header = """ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: name: {name} spec...
# Run with caffe2_Nov_2018 conda env import glob import os.path as osp import json from gen_utils import mkdir_p import numpy as np from tqdm import tqdm import logging import subprocess from functools import partial import re import cPickle as pkl from collections import defaultdict, OrderedDict from itertools import...
import random import numpy as np import subprocess import audiosegment import inflect from num2words import num2words PAD = '_' EOS = '~' PUNC = '!\'(),-.:;?`' SPACE = ' ' SYMBOLS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' en_symbols = SYMBOLS + PAD + EOS + PUNC + SPACE _symbol_to_id = {s: i for i, s in ...
# Libraries from pathlib import Path import sys import yaml # Modules import sequestrum.directories as directories import sequestrum.symlink as symlink import sequestrum.arguments as arguments import sequestrum.options as options import sequestrum.logging as logging # For Later packages_to_unlink = [] # Global const...
# Copyright 2017 The Sonnet Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
#!/usr/bin/env python3 from argparse import ArgumentParser import os import sys sys.path.append(os.path.join(os.path.dirname(__file__), "..")) import pickle import matplotlib matplotlib.use('Agg') matplotlib.rcParams['text.usetex'] = True import matplotlib.pyplot as plt import numpy as np import pandas as pd import pm...
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## # # See COPYING file distributed along with the PyMVPA package for the # copyright and license terms. # ### ### ### ### ###...
#!/usr/bin/env python import numpy as np import matplotlib.pyplot as plt from matplotlib.ticker import AutoMinorLocator import os from math import ceil def _ax_plot(ax, x, y, secs=10): ax.set_xticks(np.arange(0,11,0.2)) ax.set_yticks(np.arange(-2,3,0.5)) ax.minorticks_on() ax.xaxis.set_min...
# =================================================================== # # Copyright (c) 2015, Legrandin <<EMAIL>> # 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...
from multirunnable import set_mode, RunningMode from multirunnable.adapter.context import context as adapter_context from multirunnable.persistence.file import SavingStrategy, CSVFormatter from multirunnable.persistence.file.layer import BaseFao from multirunnable.persistence.file.saver import _Done_Flag, _Do_Nothing_F...
#!/usr/bin/env python3 # Copyright 2014-2018 Open Source Robotics Foundation, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unle...
#!/usr/bin/env python3 # This file is subject to the terms and conditions defined in # file 'LICENSE.txt', which is part of this source code package. # # 本程式檔據隨附於套件的的「LICENSE.txt」檔案內容授權,感謝你遵守協議。 import os import glob import argparse import logging import cv2 import numpy as np import tensorflow as tf X_FEATURE_KEY =...
# -*- coding: utf-8 -*- # # Copyright © Spyder Project Contributors # Licensed under the terms of the MIT License # (see spyder/__init__.py for details) """ Text encoding utilities, text file I/O Functions 'get_coding', 'decode', 'encode' and 'to_unicode' come from Eric4 source code (Utilities/__init___.py)...
import sys, time, math, os, os.path import wx import wx.adv _ = wx.GetTranslation import wx.propgrid as wxpg import cad class PropertyMapItem: def __init__(self, prop = None): self.prop = prop self.children = {} # map from key string to PropertyMapItem self.properties = ...
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 """ Purpose Demonstrates how to set up an Amazon S3 bucket for versioning, and how to perform basic tasks on a version-enabled bucket. For more detail, including usage and testing instructions, see the README. ...
# coding: utf-8 import hashlib import json import uuid from datetime import timedelta as td from django.conf import settings from django.contrib.auth.models import User from django.db import models from django.urls import reverse from django.utils import timezone from hc.api import transports from hc.lib import email...
import sys import streamlit as st import textwrap import networkx as nx import pandas as pd import altair as alt import nx_altair as nxa import inspect from autogoal.kb import build_pipeline_graph @st.cache(allow_output_mutation=True) def eval_code(code, *variables): locals_dict = {} exec(code, globals(), lo...
""" Some codes from https://github.com/Newmu/dcgan_code """ import math import os import errno import json import random import pprint import scipy.misc import numpy as np from time import gmtime, strftime import tensorflow as tf pp = pprint.PrettyPrinter() get_stddev = lambda x, k_h, k_w: 1/math.sqrt(k_w*k_h*x.get_s...
# -*- coding: utf-8 -*- import logging import warnings from compiler.ast import flatten from django.db import IntegrityError from django.contrib import admin from django.utils import timezone from django.conf import settings from django.contrib.sites.models import Site from django.contrib.auth import get_user_model fro...
#!/usr/bin/env python # Copyright (c) 2020 by # <NAME> <<EMAIL>> # # Permission to use, copy, modify, and/or distribute this software # for any purpose with or without fee is hereby granted, provided # that the above copyright notice and this permission notice appear # in all copies. # # THE SOFTWARE IS PROVIDED "AS I...
from setup import * class ExtractSoundCloud(ProgressBar): _regex_track = r'''(?x)^(?:https?://)? (?:(?:(?:www\.|m\.)?soundcloud\.com/ (?!stations/track) (?P<uploader>[\w\d-]+)/ (?!(?:tracks|popu...
# Copyright 2022 MosaicML Composer authors # SPDX-License-Identifier: Apache-2.0 """Logs metrics to the console and show a progress bar.""" from __future__ import annotations import sys from dataclasses import asdict, dataclass from typing import Any, Callable, Dict, List, Optional, TextIO, Union import tqdm.auto ...
# coding=utf-8 # Copyright 2019 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import absolute_import, print_function import os from collections import deque from textwrap import dedent from pex import third_party from pex.common impo...
# # Python stuff to improve portability # from __future__ import print_function # # Generic python packages used # from math import log10, floor import time import os # # XDD packages # from xdd.constants import XDD_SINK_TO_SOURCE_DELAY from xdd.core import XDDError from xdd.profiletrial import ProfileTrial from xdd...
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import numpy as np import matplotlib.pyplot as plt "Example of solving (U,V,P)" def conv_loss(domain_size=32, dtype=torch.FloatTensor): "convolutional loss function based on steady heat equation" K = torch.tensor([[...
"""Tests for resistics.common""" from typing import List, Callable, Union from pathlib import Path import pytest import pandas as pd from resistics.errors import NotFileError, NotDirectoryError from resistics.sampling import datetime_to_string, datetime_from_string Timestamp = pd.Timestamp Timedelta = pd.Timedelta rs...
"""Contains functions that are needed for the WA estimator.""" import numpy as np import pandas as pd import skillmodels.model_functions.transition_functions as tf from patsy import dmatrix def loadings_from_covs(data, normalization): """Factor loadings of measurements of one factor in the first. Calculate ...
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # # Copyright 2022 <NAME> # Copyright 2018-2021 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You...
# -*- coding:utf-8 -*- # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # This program is free software; you can redistribute it and/or modify # it under the terms of the MIT License. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the ...
import csv import pytz import datetime from six.moves import StringIO from wsgiref.util import FileWrapper from django.utils import timezone from django.core.mail import EmailMessage from django.conf import settings from mooring.models import Booking, BookingInvoice, OutstandingBookingRecipient, BookingHistory from le...
import abc import logging import typing from decimal import Decimal from solana.publickey import PublicKey from baseCli import BasketToken, Group, Token, TokenValue from Context import Context from TradeExecutor import TradeExecutor from Wallet import Wallet class TargetBalance(metaclass=abc.ABCMeta): def __ini...
# Copyright (c) 2021 Huawei Technologies Co.,Ltd. All rights reserved. # # StratoVirt is licensed under Mulan PSL v2. # You can use this software according to the terms and conditions of the Mulan # PSL v2. # You may obtain a copy of Mulan PSL v2 at: # http:#license.coscl.org.cn/MulanPSL2 # THIS SOFTWARE IS PRO...
import numpy as np import torch from torch import nn as nn import torch.nn.functional as F import rlkit.torch.pytorch_util as ptu def _product_of_gaussians(mus, sigmas_squared): ''' compute mu, sigma of product of gaussians ''' sigmas_squared = torch.clamp(sigmas_squared, min=1e-7) sigma_squared...
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import warnings import pytest import torch from pytest import approx from torch.distributions import constraints from pyro.generic import distributions as dist from pyro.generic import infer, ops, optim, pyro, pyro_backend from t...
""" Working on scyscrapers' problem """ def read_input(path: str): """ Read game board file from path. Return list of str. # >>> read_input("check.txt") # ['***21**', '452453*', '423145*', '*543215', '*35214*', '*41532*', '*2*1***'] """ file_txt = open(path, "r", encoding = "UTF-8") f...
import math import time from about_time import about_time from .utils import bordered, extract_fill_graphemes, fix_signature, spinner_player from ..utils.cells import VS_15, combine_cells, fix_cells, has_wide, is_wide, join_cells, \ mark_graphemes, split_graphemes, strip_marks, to_cells from ..utils.colors import...
import demistomock as demisto from CommonServerPython import * from CommonServerUserPython import * from typing import Dict, Any, List, Optional, Tuple # Disable insecure warnings requests.packages.urllib3.disable_warnings() ''' CONSTANTS ''' VENDOR = 'Threat Crowd' DATE_FORMAT = '%Y-%m-%dT%H:%M:%SZ' # ISO8601 form...
"""A collection of classes that are commonly used across multiple aspects of Dungeons & Dragons 5th edition. Classes: Ability: Enumeration of the basic abilities. Skill: Enumeration of ability based skills. Tool: Enumeration of skill based tools. AbilitySet: A collection of ability scores used by a pla...
import pytest import pymongo import typing from mongoapi import MongoDBHandler from bson.objectid import ObjectId from pymongo.results import InsertOneResult, InsertManyResult class Test(): """ """ def __init__(self): host = '10.60.1.140' port = 6080 user = 'root' ...
from panda3d.core import CollisionSphere, CollisionNode, CollisionRay, CollisionSegment, CollisionHandlerQueue, CollisionTraverser from panda3d.core import BitMask32 from panda3d.core import Vec3 from panda3d.core import OmniBoundingVolume from panda3d.core import Shader from panda3d.core import TextNode from panda3d.c...
import re import os import itertools from six import ensure_binary, itervalues, iteritems from collections import defaultdict MYPY = False if MYPY: # MYPY is set to True when run under Mypy. from typing import Any from typing import Dict from typing import Iterable from typing import List from ...
#!/usr/bin/env python3 """ File: datasets.py Author: <NAME> Email: <EMAIL> Github: https://github.com/lgalke Description: Parsing and loading for all the data sets. """ import pandas as pd import numpy as np import os from html.parser import HTMLParser from abc import abstractmethod, ABC from collections import defaul...
"""Heterograph NN modules""" import torch as th import torch.nn as nn __all__ = ['HeteroGraphConv'] class HeteroGraphConv(nn.Module): r"""A generic module for computing convolution on heterogeneous graphs. The heterograph convolution applies sub-modules on their associating relation graphs, which reads t...
""" keycloak ~~~~~~~~~~ Keycloak login helpers and management features """ import os from posixpath import join as urljoin import requests from requests import codes import logging import webbrowser from typing import Optional, Dict, List, Any from .exceptions import ServerError, AuthServerError from .utils import ho...
import json import numpy as np import re # defining regex pattern # pattern = re.compile(r"[^\u0E00-\u0E7F0-9]|^'|'$|''") path = 'D:/Users/Patdanai/th-qasys-db/tokenized_wiki_corpus/' # default development path def load_article(dir_path, art_id): with open(dir_path + str(art_id) + '.json', 'r', encoding='utf-8', ...
import numpy as np from astropy.cosmology import Planck15 from astropy.units import allclose from skypy.power_spectrum import eisenstein_hu import skypy.halo.mass as mass # Precomputed values for the test, for a Planck15 cosmology at redshift 0 and a # power spectrum given by the Eisenstein and Hu fitting formula # ...
# # Copyright 2021 Red Hat Inc. # SPDX-License-Identifier: Apache-2.0 # """OCP utility functions.""" import copy import json import logging import os from enum import Enum import ciso8601 import pandas as pd from dateutil import parser from dateutil.relativedelta import relativedelta from api.models import Provider f...
#!/usr/bin/python # Copyright 2012 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy # of the License at: http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
import requests, json, re, subprocess from bs4 import BeautifulSoup, SoupStrainer from html import escape import codecs class BoilerPlate: def __init__(self, token): self.token = token self.api_url = "https://api.telegram.org/bot{}/".format(token) def get_updates(self, offset=0, timeout=10000)...
import os import sys import time import horovod.tensorflow as hvd import numpy as np import tensorflow as tf import graphics os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' def tensorflow_session(): # Init session and params config = tf.ConfigProto() config.gpu_options.allow_growth = True # Pin GPU to loca...
# Copyright 2018 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Handler for ingestion.""" import collections import json import logging import os import os.path # pylint: disable=no-name-in-module, import-error, wr...
# coding: utf-8 import cv2, os, sys from PIL import Image import numpy as np import os from tensorflow import keras from tensorflow.keras.layers import Input from .Models import GoogLeNetModel from .Models import VGG16Model from .Models import InceptionV3Model from .Models import MobileNetModel from .Mod...
# coding=utf-8 # Copyright 2021 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...
#!/usr/bin/python3 """ Module for reading out CO2Meter USB devices via a hidraw device under Linux https://github.com/heinemml/CO2Meter """ import sys import fcntl import getopt import threading import time import weakref import urllib.request # required by onion omega import encodings.idna CO2METER_CO2 = 0x50 CO2MET...
# Copyright 2018 Iguazio # # 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, softwa...
# coding: utf-8 # 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"...