text
stringlengths
2
999k
#!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2021/9/29 21:11 Desc: 问财-热门股票排名 http://www.iwencai.com/unifiedwap/home/index """ import os import pandas as pd import requests from py_mini_racer import py_mini_racer def _get_js_path_ths(name: str = None, module_file: str = None) -> str: """ 获取 JS 文件的路径...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright (C) 2017-2021 KuraLabs S.R.L # # 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 # # ...
"""A post-transform for overriding the behaviour of sphinx reference resolution. This is applied to MyST type references only, such as ``[text](target)``, and allows for nested syntax """ import os from typing import Any, List, Tuple from typing import cast from docutils import nodes from docutils.nodes import docume...
try: from aldryn_search.helpers import get_plugin_index_data from aldryn_search.utils import get_index_base, strip_tags from django.utils.encoding import force_str from haystack import indexes from parler.utils.context import switch_language from .models import Post from .settings import ge...
import os from gym import error, spaces from gym.utils import seeding import numpy as np from os import path import gym try: import mujoco_py except ImportError as e: raise error.DependencyNotInstalled("{}. (HINT: you need to install mujoco_py, and also perform the setup instructions here: https://github.com/openai...
import os os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings') os.environ.setdefault('DJANGO_CONFIGURATION', 'Dev') from configurations.wsgi import get_wsgi_application application = get_wsgi_application()
from __future__ import annotations __all__ = ['Site'] import asyncio from asyncio import gather from collections import defaultdict from concurrent.futures.thread import ThreadPoolExecutor from logging import getLogger from os import getcwd from os.path import abspath from pathlib import Path from shutil import rmtre...
""" @file coi-services/mi.idk/driver_generator.py @author Bill French @brief Main script class for running the reinitializing the IDK environment """ from mi.idk.config import Config from mi.core.log import get_logger ; log = get_logger() class IDKRebase(): """ Main class for running the rebase proce...
import os import pickle from google.cloud import storage from bundestag import data, utils from bundestag.bundes_w2v import BundesW2V import pandas as pd import numpy as np from tensorflow import keras from tensorflow.keras import Sequential, layers from tensorflow.keras.callbacks import EarlyStopping from tensorflo...
""" API operations on Group objects. """ import logging from galaxy import web from galaxy.util import unicodify from galaxy.web.base.controller import BaseAPIController, url_for log = logging.getLogger(__name__) class GroupRolesAPIController(BaseAPIController): @web.legacy_expose_api @web.require_admin ...
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' filter_wordcounts.py (c) Will Roberts 30 March, 2014 Filters a list of word counts found in the SdeWaC corpus to include only those listed in GermaNet. ''' from collections import Counter import gzip import pymongo import re # strip the counts off # xzcat sdewac-wc...
import unittest from metrics.WebResource import WebResource import logging logging.basicConfig( level=logging.DEBUG, format="[%(asctime)s] {%(filename)s:%(lineno)d} %(levelname)-8s %(message)s", datefmt="%Y-%m-%d %H:%M:%S", ) class WebResourceTestCase(unittest.TestCase): @classmethod def tearDown...
# Copyright (c) 2015 Egor Tensin <Egor.Tensin@gmail.com> # This file is part of the "Simple interpreter" project. # For details, see https://github.com/egor-tensin/simple-interpreter. # Distributed under the MIT License. class ProgramNode: def __init__(self, stmt_list): self._stmt_list = stmt_list def...
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy.units import Quantity from ...utils.testing import assert_quantity_allclose from ...spectrum import cosmic_ray_flux def test_cosmic_ray_flux(): energy = Quantity(1, "TeV") actual = cosmic_ray_flux(energy, "proton") desired = Quan...
from django.urls import path from django.views.i18n import JavaScriptCatalog from locking.views import lock, unlock, is_locked, js_variables urlpatterns = [ path('<str:app>/<str:model>/<int:id>/lock/', lock), path('<str:app>/<str:model>/<int:id>/unlock/', unlock), path('<str:app>/<str:model>/<int:id>/is_l...
from random import shuffle import numpy as np import torch import torch.nn as nn import math import torch.nn.functional as F from PIL import Image from torch.autograd import Variable from torch.utils.data import DataLoader from torch.utils.data.dataset import Dataset from matplotlib.colors import rgb_to_hsv, hsv_to_rgb...
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Cub(Package): """CUB is a C++ header library of cooperative threadblock primitives and...
def fibonacci(n): a,b = 0,1 while b < n: print(b) a,b = b, a+b fibonacci(10)
# 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...
# Copyright 2020 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
from flask import Flask, request, jsonify, Blueprint, json, make_response from flask_restplus import Resource, reqparse, Api, Namespace, fields from ..models.product_model import Product from ..models.user_model import User from ..utils.auth import admin_required, token_required api = Namespace('Product_endpoints', de...
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
''' Micro Object Detector Net the author:Luis date : 11.25 ''' import os import torch import torch.nn as nn import torch.nn.functional as F from layers import * from .base_models import vgg, vgg_base class BasicConv(nn.Module): def __init__(self, in_planes, out_planes, kernel_size, stride=1, padding=0, dilation...
# -*- coding: utf-8 -*- """Only imports/exports""" from __future__ import print_function, absolute_import, unicode_literals, division from aws_federation_proxy.aws_federation_proxy import ( AWSFederationProxy, ConfigurationError, AWSError, PermissionError ) __all__ = ['AWSFederationProxy', ...
""" Django settings for app project. Generated by 'django-admin startproject' using Django 2.1.15. For more information on this file, see https://docs.djangoproject.com/en/2.1/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/2.1/ref/settings/ """ import os # Bu...
# Generated by Django 3.1.11 on 2021-07-13 14:07 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [("evaluation", "0006_auto_20210601_0802")] operations = [ migrations.RenameField( model_name="phase", old_name="show_publication_ur...
# Copyright 2012-2017 The Meson 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 law or agree...
# Copyright 2012-2016 Jonathan Paugh and contributors # See COPYING for license details from agithub.base import API, Client, ConnectionProperties class Maven(API): """ Maven Search API """ def __init__(self, *args, **kwargs): props = ConnectionProperties( api_url='search.maven.org...
# Copyright 2020 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# -*- coding: utf-8 -*- """ Construct elliptic curves as Jacobians An elliptic curve is a genus one curve with a designated point. The Jacobian of a genus-one curve can be defined as the set of line bundles on the curve, and is isomorphic to the original genus-one curve. It is also an elliptic curve with the trivial l...
import argparse from datetime import datetime from deepreg.train import train name = "grouped_mr_heart" # parser is used to simplify testing # please run the script with --no-test flag to ensure non-testing mode # for instance: # python script.py --no-test parser = argparse.ArgumentParser() parser.add_argument( ...
import numpy as np from sam import Body sun_mass = 1.989e+9 # yg masses = [0.3301e+3, 5.9726e+3, 2.7547e+3, 0.64174e+3, 0.4859e+3] # yg distances = [46e+6, 147.09e+6, 194.5e+6, 239.4e+6, 269.3e+6] # km velocities = [58.98, 30.29, 26.12, 23.54, 22.2] # km/s planets = ['Raisa', 'Alderaan', 'Delaya', 'Avirandel', 'Avish...
# Copyright 2011 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
# -*- coding: utf-8 -*- import re from distutils.util import strtobool from streamlink.compat import quote from streamlink.plugin import Plugin, PluginArguments, PluginArgument from streamlink.stream import HLSStream, HTTPStream from streamlink.plugin.api.useragents import CHROME from streamlink.plugin.api.utils impor...
# Copyright 2020-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 agre...
import itertools as it import numpy as np import pandas as pd import pytest from sklearn.utils import estimator_checks n_vals = (10, 100, 5000) k_vals = (1, 2, 5) np_types = (np.int32, np.float32, np.float64) transformer_checks = ( estimator_checks.check_transformer_data_not_an_array, estimator_checks.check_...
import base64 import builtins import os from collections import OrderedDict from distutils.version import LooseVersion from functools import wraps import matplotlib import numpy as np from yt.data_objects.data_containers import YTSelectionContainer from yt.data_objects.profiles import create_profile, sanitize_field_t...
from conans import CMake, ConanFile, tools from conans.errors import ConanInvalidConfiguration import os class RapidcheckConan(ConanFile): name = "rapidcheck" description = "QuickCheck clone for C++ with the goal of being simple to use with as little boilerplate as possible" url = "https://github.com/cona...
import argparse import os from math import log10 import pandas as pd import torch.optim as optim import torch.utils.data import torchvision.utils as utils from torch.autograd import Variable from torch.utils.data import DataLoader from tqdm import tqdm import pytorch_ssim from data_utils import TrainDatasetFromFolder...
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Matti Hamalainen <msh@nmr.mgh.harvard.edu> # Denis Engemann <denis.engemann@gmail.com> # Teon Brooks <teon.brooks@gmail.com> # # License: BSD (3-clause) from copy import deepcopy from itertools import count from math i...
"""Various utility tools.""" from .atlas import make_masker_from_atlas from .evaluation import (run_meg_spoc, run_ridge, run_stacking, run_stacking_spoc, train_stacked_regressor) from .file_parsing import get_area, get_thickness from .notebook import (plot_pred, plot_error_scatters, ...
from pds_pipelines.db import db_connect from pds_pipelines.config import upc_db, summaries_path import os import json import argparse queries = { 'volume_summary': """ SELECT d.instrumentid, d.targetid, t.targetname, t.system, i.instrument, i.mission, i.spacecraft, i.displayname, count(d.*) as imag...
""" Library for reading multiresolution micro-magellan """ import os import mmap import numpy as np import sys import json import platform import dask.array as da import dask import warnings from pycromanager.core import Bridge import struct from pycromanager.legacy_data import Legacy_NDTiff_Dataset import threading ...
# Simple Arp Handler v1 # Jack Zhao # s.zhao.j@gmail.com from ryu.base import app_manager from ryu.controller import ofp_event from ryu.controller.handler import CONFIG_DISPATCHER, MAIN_DISPATCHER from ryu.controller.handler import set_ev_cls from ryu.ofproto import ofproto_v1_3 from ryu.lib.packet import packet fr...
############################################################### # Autogenerated module. Please don't modify. # # Edit according file in protocol_generator/templates instead # ############################################################### from typing import Dict from ...structs.api.create_partitions_...
import numpy as np import PIL from PIL import ImageTk def value_to_string(value): if isinstance(value, str): return '"{}"'.format(value) return str(value) def value_from_string(text): txt_tmp = text.strip(" \"\'") if txt_tmp[0] == '(' or txt_tmp[0] == '[': txt_tmp = txt_tmp.strip('()...
# automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class SubOptions(object): __slots__ = ['_tab'] @classmethod def GetRootAsSubOptions(cls, buf, offset): n = flatbuffers.encod...
import os import pytest # Hacky, but it's non-trivial to pass commandline arguments to pytest tests. mpi4py_option = bool(os.environ.get('NRN_TEST_SPIKES_MPI4PY', '')) file_mode_option = bool(os.environ.get('NRN_TEST_SPIKES_FILE_MODE', '')) nrnmpi_init_option = bool(os.environ.get('NRN_TEST_SPIKES_NRNMPI_INIT', '')) ...
import time from PySide import QtGui, QtCore from gears import draw class Clock(object): """A clock capable of notifying observers of each tick.""" def __init__(self, interval, *observers): """Initialize a clock ticking at the given millisecond :interval:. Ticks of the clock will start approxim...
import os import cv2 def frames_to_video(path): image_folder = path # image_folder = 'C:\\Users\\Dell\\OneDrive\\Desktop\\test images\\Anger' video_name = 'Happiness.avi' images = [int(img[:-4]) for img in os.listdir(image_folder) if img.endswith(".jpg")] images.sort() for i in range(len(imag...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- def cylinder(): radius = int(input('Введите радиус цилиндра: ')) height = int(input('Введите высоту цилиндра: ')) def circle(): print('Площадь полной поверхности цилиндра: ', 2 * 3.14 * radius * height + 2 * 3.14 * radius ** 2) prin...
from ns_portal.database.meta import ( Main_Db_Base ) from sqlalchemy import ( Boolean, Column, DateTime, Integer, String, func ) from marshmallow_sqlalchemy import ( ModelSchema ) class TUsers(Main_Db_Base): __tablename__ = 'TUsers' TUse_PK_ID = Column( Integer, ...
"""Auto-generated file, do not edit by hand. OM metadata""" from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata PHONE_METADATA_OM = PhoneMetadata(id='OM', country_code=968, international_prefix='00', general_desc=PhoneNumberDesc(national_number_pattern='(?:5|[279]\\d)\\d{6}|800\\d{5,6}', p...
# Copyright 2017 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
# Copyright (c) 2021 PaddlePaddle 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 appli...
from ._stp import SpanningTree
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
#!//usr/bin/env python3 """Fetch a list of words from a URL. Args: url: the url of a UTF_8 text document. Returns: A list of strings conataining the words from the document """ import sys from urllib.request import urlopen def fetch_words(url): """Fetch a list of words from a URL. Args: url: the...
from spam.mod1 import Class3 __all__ = ('Class3',)
# -*- coding: utf-8 -*- import logging from importlib import import_module import typing from bravado_core.operation import Operation from bravado_core.response import IncomingResponse from bravado.response import BravadoResponseMetadata try: from typing import Type except ImportError: # Python 3.5.0 / 3.5.1...
import abc import os import inspect from six import with_metaclass class LoggerException(Exception): pass class AbstractLogger(with_metaclass(abc.ABCMeta, object)): @abc.abstractmethod def fatal(self, m): raise RuntimeError("Do not use me!") @abc.abstractmethod def error(self, m): ...
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Yue-Wen FANG' __maintainer__ = "Yue-Wen FANG" __email__ = 'fyuewen@gmail.com' __license__ = 'Apache License 2.0' __creation_date__= 'Dec. 26, 2018' """ Here, I rewrote the example dog.py in the book of Python Crash Couse. This example is not exactly same to ...
"""This module contains the general information for IqnpoolBlock ManagedObject.""" import sys, os from ...ucsmo import ManagedObject from ...ucscoremeta import UcsVersion, MoPropertyMeta, MoMeta from ...ucsmeta import VersionMeta class IqnpoolBlockConsts(): pass class IqnpoolBlock(ManagedObject): """This i...
# Generated by Django 3.2.4 on 2021-08-10 12:07 from django.db import migrations from django.db.models import F, Q def update_stocks(apps, schema_editor): LotV2 = apps.get_model('core', 'LotV2') lots = LotV2.objects.filter(year=2021).filter(Q(remaining_volume__lt=F('volume'))) for lot in lots: lot...
from code import app from flask import request, render_template from code.database import Database as database from code.observer import Observer class BlogList(Observer): def __init__(self): self.blogContent = self.displayBlogs() super().__init__() #abstract, inherited de...
import json import requests import os import csv class MakeDataSet: def __init__(self,data): self.data = data self.fileType = "" self.logError = { "errorVoc" : [], "errorId" : [], "errReport" : [] } # # errorVoc format => { ...
from ConfigSpace import ConfigurationSpace from ConfigSpace.hyperparameters import UniformFloatHyperparameter, UniformIntegerHyperparameter, \ CategoricalHyperparameter, UnParametrizedHyperparameter class Adaboost: def __init__(self, n_estimators, learning_rate, algorithm, max_depth, random_s...
"""This package includes all the modules related to data loading and preprocessing To add a custom dataset class called 'dummy', you need to add a file called 'dummy_dataset.py' and define a subclass 'DummyDataset' inherited from BaseDataset. You need to implement four functions: -- <__init__>: ...
# Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed # under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the Licens...
from typing import FrozenSet, Tuple import pysmt.typing as types from pysmt.environment import Environment as PysmtEnv from pysmt.fnode import FNode from utils import symb_to_next from hint import Hint, Location def transition_system(env: PysmtEnv) -> Tuple[FrozenSet[FNode], FNode, FNode, ...
# -*- coding: utf-8 -*- from girder.api import access from girder.api.describe import Description, autoDescribeRoute from girder.api.rest import Resource, filtermodel from girder.constants import AccessType, SortDir from girder.models.user import User from .models.job import Job as JobModel from . import constants cl...
#!/usr/bin/env python2 # Copyright (c) 2015 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. import hashlib import sys import os from random import SystemRandom import base64 import hmac if len(sys.a...
""" Some useful utility functions. """ import contextlib import importlib import sys from typing import List, Optional, Tuple @contextlib.contextmanager def saved_sys_path(): """ Contextmanager that will restore the value of :data:`sys.path` when leaving the ``with`` block. """ orig_path = lis...
""" Mesh net model. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from absl import app from absl import flags import os import os.path as osp import numpy as np import torch import torchvision import torch.nn as nn from torch.autograd import Variable ...
#!/usr/bin/python3 """ Open a pcap file. """ import pyshark def main(): # open the pcap file pythoncapture.pcap cap = pyshark.FileCapture("pythoncapture.pcap") # what protocol should we scan the pcap for? scanfor = input("What protocol should we scan the PCAP for (DNS, ICMP, TCP, etc.)? ") # loo...
import numpy as np from sklearn.linear_model import SGDClassifier from sklearn.metrics import roc_auc_score from sklearn.preprocessing import StandardScaler from multiprocessing import Pool import matplotlib.pyplot as plt import pickle def sample_and_split(raw_data, train_percentage=10, dev_percentage=10): np.ran...
import cv2 import numpy as np from PIL import Image img = cv2.imread('test.jpg') y, x = img.shape[:2] roi = img[] print('x = ' + str(x) + ' y = ' + str(y))
from rest_framework.response import Response from rest_framework import permissions from rest_framework.views import APIView from rest_framework.generics import ListAPIView, RetrieveAPIView from blog.models import BlogPost from blog.serializers import BlogPostSerializer class BlogPostListView(ListAPIView): queryse...
# -*- coding: utf-8 -*- # Generated by Django 1.10.6 on 2017-03-31 14:33 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('wagtailcore', '0032_add_bulk_delete_page_permission'), ] operations = [ migrations.AlterField( model_nam...
from __future__ import absolute_import from . import max import pymxs rt = pymxs.runtime class Importer(max.Importer): display_name = 'Arnold' plugin_name = 'Arnold' def __init__(self): super(Importer, self).__init__() @property def attributes(self): ''' import pymxs ...
from datetime import datetime import urllib.request, re #title regex (.+?)(?=\d{1,2} \w{3}, \d{4,}) [:-1].strip() titleRegex = "(.+?)(?=\d{1,2} \w{3}, \d{4,})" #date regex (\d{1,2} \w{3}, \d{4,})|(TBA) dateRegex = "(\d{1,2} \w{3}, \d{4,})|(TBA)" #url regex (http:.*) urlRegex = "(http:.*)" def fetchLates...
import getpass import socket from asynch.errors import LogicalError from asynch.proto import constants from asynch.proto.io import BufferedWriter class ServerInfo: def __init__( self, name: str, version_major: int, version_minor: int, version_patch: int, revision: ...
from django.db import models from django.contrib.auth.models import AbstractBaseUser from django.contrib.auth.models import PermissionsMixin from django.contrib.auth.models import BaseUserManager from django.conf import settings class UserProfileManager(BaseUserManager): """ Manager for user profiles. """ de...
from __future__ import annotations import typing import logging from typing import Any, Dict from contextlib import suppress import pathlib from silex_client.action.command_base import CommandBase from silex_houdini.utils.utils import Utils # Forward references if typing.TYPE_CHECKING: from silex_client.action.ac...
import math import numbers import random import warnings from collections.abc import Sequence from typing import Tuple, List, Optional import torch from torch import Tensor try: import accimage except ImportError: accimage = None from . import functional as F from .functional import InterpolationMode, _inter...
# -*- coding: utf-8 -*- ''' Module for gathering disk information on Windows :depends: - win32api Python module ''' from __future__ import absolute_import # Import python libs import ctypes import string # Import salt libs import salt.utils try: import win32api except ImportError: pass # Define the modul...
import sark from dumper_helper import dump_attrs import itertools def main(): print('Bytes') print(list(itertools.islice(sark.data.Bytes(), 10))) print() print('Bytes Until 0') print(list(sark.data.bytes_until())) print() print('Words') print(list(itertools.islice(sark.data.Words()...
# Python - 3.6.0 is_digit = lambda n: (len(n) == 1) and n.isdigit()
import os from typing import Dict, Optional, Tuple, Union import asyncpg import dotenv import humanize from quart import Quart, redirect, render_template, request, url_for from quart.helpers import flash from quart_csrf import CSRFProtect from quart_discord import AccessDenied, DiscordOAuth2Session, Unauthorized from ...
# Copyright 2018-2022 Streamlit Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
#! /usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function class RiggingDetectInfo(dict): def __init__(self, rigging_name, platform, image_with_tag): self.__setitem__("rigging_name", rigging_name) self.__setitem__("platform", platform) ...
import json f = open('./db/dictionary_alpha_arrays.json') data = json.load(f) """ Trie: https://leetcode.com/problems/implement-trie-prefix-tree/ """ class TNode(object): def __init__(self, val=None): self.val = val self.children = {} self.is_word = False class Trie(object...
import sqlalchemy from typing import List from application.database import global_db from core.job.helpers import expand_nodelist class Job(global_db.Model): __tablename__ = 'job' __table_args__ = ( global_db.Index('job_index', "job_id", "task_id") , global_db.UniqueConstraint('job_id', 'task_id', name='uniqu...
import contextlib import glob import os import platform import shutil import subprocess import sys import tempfile # dependencies that are always installed REQUIRED_DEPS = [ "git", "jupyter", "numpy", "matplotlib", "h5py", "cython", "nose", "sympy", "setuptools", ] # dependencies t...
# coding=utf-8 # Copyright 2021 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
import scipy as sp from limix.core.covar import Cov2KronSumLR from limix.core.covar import FreeFormCov from limix.core.gp import GP2KronSumLR from limix.core.gp import GP from limix.utils.preprocess import covar_rescale import time import copy import pdb if __name__=='__main__': # define row caoriance N = 100...
""" A tiny test graph with Book meta-data """ import rdflib import StringIO bookrdf=""" @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix book: <http://example.org/book/> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix vcard: <http:...
from gensim.models.keyedvectors import KeyedVectors import os dir = os.path.dirname(__file__) DIMENSIONS = 300 GLOVE_PATH = '../../data/glove.6B/glove.6B.%sd.txt' % DIMENSIONS word_vectors = KeyedVectors.load_word2vec_format(os.path.join(dir, GLOVE_PATH), binary=False) def similarity(tokens, includes=[], excludes=[...
from modeling.ranking_task import RankingTask from modeling.utils import format_context, format_targets from collections import defaultdict from numpy import asarray, split, concatenate from numpy.random import seed, shuffle from pickle import dump, load from re import findall from csv import writer from os import mak...
""" 'usb_scroll.py'. ================================================= control a NeoPixel using an (NEC) IR Remote requires: - adafruit_hid - simpleio """ import time import analogio import board import digitalio from adafruit_hid import mouse from simpleio import map_range button = digitalio.DigitalInOut(board.D6) p...