text stringlengths 3.07k 12.6k |
|---|
import graphene
class Query(graphene.ObjectType):
hello = graphene.String(name=graphene.String(default_value="stranger"))
def resolve_hello(self, info, name):
return 'Hello ' + name
schema = graphene.Schema(query=Query)
result = schema.execute('{ hello ( name: "Test" )}')
print(result.data['hello'... |
# coding=utf-8
# Copyright 2020 The TF-Agents Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
import os
import re
import sys
import time
import json
import math
import random
import pickle
import logging
import argparse
import subprocess
from collections import defaultdict
import lxml.html as html
import requests
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
parser = argparse.ArgumentParser()
parser.... |
# built-in
from collections import ChainMap
from logging import getLogger
from typing import Optional
# app
from ..models.dependency import Dependency
from ..models.root import RootDependency
logger = getLogger(__name__)
class Layer:
def __init__(self, level: int, *deps):
self.level = level
sel... |
# -*- coding: utf-8 -*-
"""High-level API for nomenclature."""
import logging
from functools import lru_cache
from typing import Callable, List, Mapping, Optional, Set, TypeVar
from .alts import get_primary_identifier
from .utils import get_version
from ..getters import NoBuild, get_ontology
from ..identifier_utils ... |
# -*- coding: utf-8 -*-
"""
Created on Sun May 14 11:11:17 2017
@author: john
"""
from pygaussmarkov.CombinedSolver import CombinedSolver
import numpy as np
import matplotlib.pyplot as plt
class CircleSolver(CombinedSolver):
""" fits a circle with a combined solver """
def __init__(self, xPos, yPos, xPosUnce... |
from abc import ABC, abstractmethod
import h5py
import numpy as np
from tqdm import trange
def load_image_stack(path, resolution_level=0, time_point=0, channel=0):
with h5py.File(path, "r") as h5:
dataset = h5[f"DataSet/"]
resolution_group = dataset[f"ResolutionLevel {resolution_level}"]
... |
import json
import os
import numpy as np
import nilearn as nl
import nilearn.plotting
from math import ceil, floor
import numpy as np
import torch
import torch.utils.data as data
from torch import Tensor
from typing import Optional
def load_scenes(path: str) -> list:
with open(path, "r") as f:
result = []... |
"""
Copyright 2021 by <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 agreed to in writing, software
distributed... |
""" Contains ContextBrokerHandler class """
import http.client
import json
import logging
import threading
import requests
# third party imports
from fiwareobjectconverter.object_fiware_converter import ObjectFiwareConverter
# local imports
from tasksupervisor.endpoint.broker_connector import BrokerException
logger... |
#!/usr/bin/env python
from ansible.module_utils.hashivault import hashivault_argspec
from ansible.module_utils.hashivault import hashivault_auth_client
from ansible.module_utils.hashivault import hashivault_init
from ansible.module_utils.hashivault import hashiwrapper
ANSIBLE_METADATA = {'status': ['stableinterface'],... |
from dataclasses import dataclass
from typing import List
import numpy as np
import qubovert as qv
import applications_superstaq
from applications_superstaq import superstaq_client
@dataclass
class MinVolOutput:
best_portfolio: List[str]
best_ret: float
best_std_dev: float
qubo: qv.QUBO
def read_j... |
from collections import defaultdict
from typing import TYPE_CHECKING, Any, Iterable
from json import JSONEncoder, dumps
from .tokenizer import Token, Tokenizer
from .exception import JMCSyntaxWarning
from .log import Logger
if TYPE_CHECKING:
from .lexer import Lexer
logger = Logger(__name__)
NEW_LINE = '\n'
c... |
from unicodedata import name
import numpy as np
import os
from datetime import datetime
import pathlib
import pandas as pd
from matplotlib import pyplot as plt
plt.rcParams.update({'font.family': 'serif', 'mathtext.fontset':'dejavuserif'})
def traintime_from_trainsession(dir_: str) -> float:
'''
Returns ho... |
from collections import Counter
import json
import logging
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import platalea.schedulers
import platalea.dataset as D
from platalea.decoders import TextDecoder
from platalea.encoders import SpeechEncoder
import platalea.loss
import plat... |
#!/usr/bin/python
# encoding: utf-8
from __future__ import print_function
import sys
import json
class Node(object):
def __init__(self, key, value):
self.key = key
self.value = value
self.prev = None
self.next = None
def __str__(self):
return '(%s : %s)' % (self.key, ... |
#!/usr/bin/env python3
#
# Copyright (c) 2015, <NAME>, <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, t... |
# -*- coding: utf-8 -*-
"""
model_110_basicHySt.py: erosion model with stochastic
rainfall and hybrid alluvial incision.
Model 110 BasicHySt
The hydrology aspect models discharge and erosion across a topographic
surface assuming (1) stochastic Poisson storm arrivals, (2) single-direction
flow routing, and (3) Hortoni... |
import django
from django.db import models
from django.db.backends.util import typecast_timestamp
from django.db.models.sql.compiler import SQLCompiler
from django.db.models.sql.constants import MULTI
from django.db.models.sql.datastructures import Date
from django.db.models.sql.subqueries import AggregateQuery
from d... |
import numpy as np
import csv
# Use this one
def getConstr(k,M,n,x,u,y,g,z,w,model,num_smpl,shift_length):
H = np.array([[1, 1, 1, -2], [1,-1,-1,0], [-1, 1, -1,0], [-1, -1, 1, 0]])
print('-------------- Adding constrains -----------')
for idx_smpl in range(num_smpl):
model.addCons... |
import maya.cmds as cmds
import json
import os
import maya.mel as mel
def list_all_lamps():
lamps = cmds.ls(selection=True)
if not lamps:
cmds.confirmDialog(title='Confirm', message='Please select any Light')
else:
return lamps
def attribute_generator(lamps):
lamp_dict = []
supp... |
from pdfminer.converter import PDFPageAggregator
from pdfminer.layout import *
from pdfminer.pdfdevice import PDFDevice
from pdfminer.pdfinterp import PDFPageInterpreter
from pdfminer.pdfinterp import PDFResourceManager
from pdfminer.pdfpage import PDFTextExtractionNotAllowed
from pdfminer.pdfpage import PDFPage
from p... |
import time
import datetime
import calendar
import re
import os
from io import BytesIO
from .common import *
from django.db.models import Q
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from django.http.response import HttpResponse, JsonResponse, Http404
from django.conf... |
# 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 ... |
"""(c) All rights reserved. ECOLE POLYTECHNIQUE FEDERALE DE LAUSANNE, Switzerland, VPSI, 2017"""
import pytest
from epflldap.ldap_search import get_username, get_sciper, get_units, is_unit_exist, get_unit_name, get_email, \
get_unit_id
from epflldap.utils import EpflLdapException
def test_get_sciper():
# Suc... |
import functools
import pickle
import numpy as np
from typing import Tuple
from IMLearn.metalearners.adaboost import AdaBoost
from IMLearn.learners.classifiers import DecisionStump
from utils import *
import plotly.graph_objects as go
from plotly.subplots import make_subplots
import matplotlib.pyplot as plt
from IMLea... |
# -*- coding: utf-8 -*-
"""
Copyright (c) 2011, <NAME> <<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:
* Redistributions of source code must retain the above copyright
notice, this li... |
import json
from functools import wraps
from flask import (current_app, flash, make_response, redirect,
render_template, request, session, url_for)
from flask_login import current_user, login_user, logout_user
from flask_oauthlib.client import OAuthException
from jose import jwt
from benwaonline.au... |
from __future__ import annotations
import gzip
import logging
import os
from collections import defaultdict
from csv import reader
from functools import partial
from typing import Optional
from homeassistant.components import light
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_COLOR_MODE,... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import datetime
from enum import Enum
import typing as t
from dataclasses import dataclass, field, asdict
from mypy_boto3_dynamodb.service_resource import Table
from boto3.dynamodb.conditions import Attr, Key, And
from botocore.exceptions import C... |
"""
Methods for handling syllable data using PyTorch.
Meant to be used in conjunction with `ava.models.vae.VAE` objects.
"""
__date__ = "November 2018 - August 2019"
import h5py
import joblib
import numpy as np
import os
from scipy.interpolate import interp1d, interp2d
from scipy.io import wavfile
from scipy.ndimage ... |
"""Support for flax.struct dataclasses."""
# Flax is a high-performance neural network library for JAX
# see //third_party/py/flax
#
# Since flax.struct.dataclass uses dataclass.dataclass internally, we can simply
# reuse the dataclass overlay with some subclassed constructors to change the
# module name.
#
# NOTE: fl... |
from gtts import gTTS
from playsound import playsound
from pytchat import LiveChat
import os
from google_trans_new import google_translator
translator = google_translator()
import keyboard
import threading
import time
"""
import pyttsx3
engine = pyttsx3.init()
engine.setProperty("rate", 110)
voices = engine.getPrope... |
import requests
import json
import numpy as np
from oauthlib.oauth2 import BackendApplicationClient
from requests_oauthlib import OAuth2Session
TOKEN_URL = 'https://consent.swisscom.com/o/oauth2/token'
client_id = 'vjM3xDUK2Con9zy4D8d8SqZjS3jYEQ28'
client_secret = 'rsConE5RAlKqD6QB'
# See https://requests-oauthlib.read... |
# Copyright 2016 Hewlett Packard Enterprise Development LP
#
# 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 os
import pickle
import argparse
import yaml
import numpy as np
from collections import OrderedDict
from pathlib import Path
from tqdm import tqdm
import torch
from PIL import Image
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import DataLoader
from utils.preprocess import minmax_n... |
import asyncio
import multiprocessing
import os.path
import traceback
from asyncio import Lock
from logging import Logger
from typing import Optional, Set, Dict, Tuple
import aiofiles
GOVERNOR_FILE_PATTERN = '/sys/devices/system/cpu/cpu{}/cpufreq/scaling_governor'
GOVERNOR_PERFORMANCE = 'performance'
def get_cpu_co... |
import numpy as np
import os
import cv2
import sys
import glob
import pandas as pd
from PIL import Image
from keras.datasets import cifar10
from multiprocessing import Pool, cpu_count, freeze_support
from keras.layers import Dense
from keras.layers import Dropout
from keras.layers import Flatten
from keras.constraints ... |
import unittest2 as unittest
from datetime import datetime
from dateutil.tz import tzlocal, tzutc
import os
import numpy as np
from pynwb import NWBContainer, get_manager, NWBFile, NWBData
from pynwb.form.backends.hdf5 import HDF5IO
CORE_NAMESPACE = 'core'
container_tests = dict()
def container_test(container):
... |
import xml.etree.ElementTree as ET
from enum import Enum
from typing import Callable, Dict, List
import sphinx_thrift.thrift_ast as ast
class Tag(Enum):
NAMESPACE = 'namespace'
CONSTANT = 'const'
TYPEDEF = 'typedef'
ENUM = 'enum'
FIELD = 'field'
ARG = 'arg'
STRUCT = 'struct'
EXCEPTION... |
#!/usr/bin/env python
import argparse
from collections import defaultdict
try:
from .conversion import SIMPLE_CONVERSION, PSEUDOKNOT_CONVERSION, LETTERS
except (SystemError, ImportError):
from rnalign2d.conversion import SIMPLE_CONVERSION, PSEUDOKNOT_CONVERSION, \
LETTERS
OPENING_BRACKETS = "([{<ABCD"... |
import numpy as np
import itertools as it
import copy
import anytree
from anytree import AnyNode as Node
from anytree import RenderTree, findall
class CalculateScore:
def __init__(self, c_init, c_base):
self.c_init = c_init
self.c_base = c_base
def __call__(self, curr_node, child):
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2021, Myriota Pty Ltd, All Rights Reserved
# SPDX-License-Identifier: BSD-3-Clause-Attribution
#
# This file is licensed under the BSD with attribution (the "License"); you
# may not use these files except in compliance with the License.
#
# You may obtain ... |
# -*- coding: utf-8 -*-
"""
"""
import datetime
import pprint
pp = pprint.pprint
import pdb
import objc
import Foundation
NSObject = Foundation.NSObject
NSURL = Foundation.NSURL
NSMutableDictionary = Foundation.NSMutableDictionary
NSUserDefaults = Foundation.NSUserDefaults
NSBundle = Foundation.NSBundle
import ... |
import os
import time
import pyautogui
import cv2
import round
import utils
import constants
class Game:
def __init__(self, inputWindow = None):
self.poolRegion = (0, 0, 0, 0)
self.gameWindow = inputWindow
self.holeLocation = {constants.img_trh: (0, 0), constants.img_tmh: (0, 0), constant... |
import torch
import torch.optim as optim
import torch.nn as nn
from torchtext.data import Field
from torchtext.data import TabularDataset
from torchtext.data import BucketIterator
import os
import argparse
import random
import models
import utils
parser = argparse.ArgumentParser(description='Implemention of \'A Con... |
# encoding: utf-8
"""
parse_genotypes will try to collect and merge information from vcf with
genotypes called by multiple variant callers. This is a complex problem,
especially for Structural Variants. I will try to explain some of the specific
problems here.
## cnvnator
Calls copy number events such as deletions and... |
#!/usr/bin/python
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# di... |
# -*- coding: utf-8 -*-
"""
This module is dedicated to MDNS
class:
mDNS_BrowserThread(Used to continuously check mDNS)
"""
import time
from PySide2.QtCore import *
from zeroconf import ServiceBrowser, Zeroconf
class mDNS_BrowserThread(QThread):
"""
This is a QT thread that ge... |
#!/usr/bin/env python
import json
from posttroll.subscriber import Subscribe
from posttroll.message import datetime_encoder
from pprint import pprint
from datetime import timedelta, datetime
from dateutil import parser
from pyorbital.orbital import Orbital
from mpop.utils import debug_on
from trollsched.satpass import... |
import nltk
import re
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize,sent_tokenize
import math
# text = input("enter text")
## Pre-processing function
'''
removes special characters from within a string
parameters : s(str): Single input string
return : stripped s(str): A string wi... |
"""
Utility tool for computing the second possible strike, rake, and dip in a focal mechanism,
given the strike, rake, and dip of the first focal plane.
Inspiration from <NAME>'s website.
"""
# Internal information:
# Variable "a" is the reference strike azimuth.
# Variable "b" is the unit vector toward the reference ... |
# -*- coding: utf-8 -*-
#
# Copyright 2017 Ricequant, 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 ... |
"""Tests for noncommutative symbols and expressions."""
import pytest
from diofant import (I, adjoint, cancel, collect, combsimp, conjugate, cos,
expand, factor, pi, posify, radsimp, ratsimp, rcollect,
simplify, sin, symbols, transpose, trigsimp)
from diofant.abc import x, y,... |
import mimetypes
import os
import re
import sqlite3
import sys
import aiosql
from flask import Flask, redirect, render_template, request, url_for
from flask_mobility import Mobility
from flask_restful import Api, Resource
from flask_wtf import FlaskForm
from wtforms import IntegerField, StringField, SubmitField
THIS_... |
from __future__ import absolute_import, division, print_function
import os
import sys
import tensorflow.compat.v1 as tfv1
from attrdict import AttrDict
from xdg import BaseDirectory as xdg
from src.flags import FLAGS
from .gpu import get_available_gpus
from .logging import log_error
from .text import Alphabet, UTF8A... |
from math import radians, cos, sin, asin, sqrt
import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.express as px
import pandas as pd
import numpy as np
from datetime import date, timedelta
from pandas.tseries.offsets import DateOffset
from math import radians, cos, sin, asin... |
from .samtools import make_reply_reader, sam_send, pack_datagram, parse_reply_dest
from errno import EACCES
class SourceError(OSError):
def __init__(self, message):
super().__init__(EACCES, message)
def it_leaks(func):
def f(self, *args, **kwargs):
human_error = func(self, *args, **kwargs) + ... |
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
from django.shortcuts import render, redirect,get_object_or_404
from django.contrib.auth import login, authenticate
from .forms import SignupForm,ProfileForm,NeighbourForm,BusinessForm,Post... |
#!/usr/bin/env python3
#-*- coding: utf-8 -*-
#=======================================================================================
# Imports
#=======================================================================================
import importlib
import sys
import os
import configparser
from lib.localization impo... |
# -*- coding: utf-8 -*-
# Copyright 2019 The Blueoil 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
#
# Unles... |
# 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... |
# CTK: Cherokee Toolkit
#
# Authors:
# <NAME> <<EMAIL>>
#
# Copyright (C) 2009 <NAME>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
# License as published by the Free Software Foundation.
#
# This program is distributed in the h... |
import logging
import re
import urllib
import enum
import munch
# Slack folks say to keep attachments to less than 20, so we'll
# start splitting into more than one message at 20.
MAX_ATTACHMENTS = 20
class ChannelKind(enum.Enum):
UNKNOWN = 0
PUBLIC = 1
DIRECTED = 2
@classmethod
def convert(cls... |
import bpy
import math
from bpy.props import StringProperty
from . import fileio
bl_info = {
'name': 'Motor Protein Placement',
'author': '<NAME>',
'location': 'View3D > UI panel > Add meshes',
'category': 'User',
}
def create_protein_at(location):
bpy.ops.mesh.primitive_uv_sphere_add()
o... |
"""
End-to-end tests for Student's Profile Page.
"""
from datetime import datetime
from common.test.acceptance.pages.common.auto_auth import AutoAuthPage
from common.test.acceptance.pages.common.logout import LogoutPage
from common.test.acceptance.pages.lms.learner_profile import LearnerProfilePage
from common.test.... |
import numpy as np
from matplotlib import pyplot as plt
import cv2
import scipy.misc
import os, glob
from PIL import Image
def averageMultiImage(path):
list_images = [cv2.imread(file) for file in glob.glob(path)]
# Assuming all images are the same size, get dimensions of first image
w, h = 256, 256
N ... |
from __future__ import annotations
from abc import abstractstaticmethod
from typing import Any, Callable, Generic, Iterable, List, Optional, Tuple, TypeVar
from typing import Union as Union_
from typing import cast
import array
from .util import IComparable, equals
T = TypeVar("T")
class FSharpRef(Generic[T]):
... |
import argparse
import json
import logging
import os
import random
from io import open
import numpy as np
import sys
sys.path.append("../../../")
from tensorboardX import SummaryWriter
from tqdm import tqdm
from bisect import bisect
import yaml
from easydict import EasyDict as edict
import sys
impo... |
#!/usr/bin/env python
"""Sample script of word embedding model.
This code implements skip-gram model and continuous-bow model.
Use ../ptb/download.py to download 'ptb.train.txt'.
"""
import argparse
import collections
import time
import numpy as np
import six
import chainer
from chainer import cuda
import chainer.fu... |
from django.contrib.auth import get_user_model
from rest_framework.test import APIClient
from django.test import TestCase
from django.urls import reverse
from rest_framework import status
from .. import models
from school.api import serializers
import random
EMP_URL = reverse('api_school:employees-list')
def school... |
import os, sklearn, collections
from sklearn.metrics.pairwise import pairwise_distances
from sklearn.externals import joblib
from utils import io_handler
import pandas as pd
import numpy as np
from data_postp import similarity_computations
class Memory:
def __init__(self, memory_df, base_dir, label_col="category",... |
import pytest
from dagster import InputDefinition, lambda_solid, pipeline
from dagster.core.errors import DagsterInvalidSubsetError
from dagster.core.selector.subset_selector import (
MAX_NUM,
Traverser,
generate_dep_graph,
parse_clause,
parse_solid_selection,
parse_step_selection,
)
@lambda_s... |
#!/usr/bin/env python3
# This file is part of Androguard.
#
# Copyright (C) 2010, <NAME> <desnos at t0t0.fr>
# All rights reserved.
#
# Androguard is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either... |
import argparse, json, os, requests, sys, time
from pathlib import Path
class PluginManager:
def __init__(self):
connectionParams = json.load(open('manage_plugin.json', 'r'))
self.vcdUrlBase = connectionParams['vcdUrlBase']
self.username = connectionParams['username']
self.org = con... |
import numpy as np
import pandas as pd
from tqdm import tqdm
import math
class Model_regression:
def __init__(self, input_shape, units):
"""
units: (10, 11, 12)
=> 3 couches avec 10 neurones pour la premiere
"""
nb_output = input_shape
self.weights = []
... |
import pytest
from django.urls import reverse
from django.contrib.auth.models import User
from rest_framework import status
from rest_framework.test import APITestCase
from rest_framework.test import APIClient
from rest_framework.authtoken.models import Token
from django.contrib.gis.geos import GEOSGeometry
from lr.mod... |
# -*- coding: utf-8 -*-
"""
@author: <NAME>
In this file we write functions used for replicating experiments
from Sutton and Barto's book for the nonstationary variant of the 10-armed
testbed.
All the code is the same as for the stationary case except that
we added the possibility of plugging any environment being a ... |
import datetime
from braces.views import LoginRequiredMixin, SuperuserRequiredMixin
from django.contrib import messages
from django.db.models import Q
from django.http import Http404
from django.shortcuts import get_object_or_404, redirect
from django.utils import timezone
from django.views.generic import ListView, De... |
# encoding: utf-8
from __future__ import annotations
import logging
from typing import Any, Optional, cast
from flask import Blueprint
import ckan.lib.base as base
import ckan.lib.helpers as h
import ckan.logic as logic
import ckan.model as model
from ckan.common import _, g, request
from ckan.views.user import _ext... |
import re
import sqlite3
from dataclasses import dataclass, astuple
from pathlib import Path
from typing import Union, List
DB_PATH = Path(__file__).parent / 'zengin.db'
CONN = sqlite3.connect(DB_PATH.absolute())
DB = CONN.cursor()
kana_table = str.maketrans(
'ぁあぃいぅうぇえぉおかがきぎくぐけげこごさざしじすずせぜそぞただちぢっつづてでとどなにぬねのはばぱひびぴ... |
import numpy as np
from sklearn.neighbors import NearestNeighbors
from .utils import *
class Neighbors:
"""
An object representing a serializable set of nearest neighbors within an
embedding. The Neighbors object simply stores a matrix of integer IDs, where rows
correspond to points in the embedding an... |
"""
Based on https://github.com/keithito/tacotron
"""
import re
from unidecode import unidecode
from .numbs import normalize_numbers
_punctuation_quote_1 = re.compile(r"(\b «)(?=[A-ZА-Я](?:\S*[^»] ){2,}(?:\S+»|\S+$))") # поиск ёлочек, открывающих фразу
_punctuation_quote_2 = re.compile(r"(\b „)(?=[A-ZА-Я](?:\S*[^“... |
import re
import os
import sys
from urllib.parse import urlparse
import logging
from .cache import zf
zf.util = sys.modules['zeekofile.util']
logger = logging.getLogger("zeekofile.util")
html_escape_table = {
"&": "&",
'"': """,
"'": "'",
">": ">",
"<": "<",
}
def html_es... |
from typing import List
import sys
sys.path.append('.')
from tasks import mimic_utils
import pandas as pd
import os
import string
from nltk.corpus import stopwords
from functools import reduce
def dia_plus_mimic(mimic_dir: str, save_dir: str, seed: int, admission_only: bool):
"""
Extracts information needed... |
#!/usr/bin/env python3
# -*-encoding: utf-8-*-
# Author: <NAME>
"""
Main module for `argplus`. Defines entry-point function `build_parsers_tree`
which, reliably on default schema in `cli_tree_schema` builds CLI for cast
"""
# TODO: perhaps actual schema has to be an argument to main function, rather
# then some... |
#
# The MIT License (MIT)
#
# Copyright (c) 2016 GrantedByMe
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, mod... |
#
# Copyright (c) 2019 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
# Copyright (c) 2022 <NAME>, Intel Corporation
# SPDX-License-Identifier: Apache-2.0
# Use git to retrieve a more meaningful last updated date than the usual
# Sphinx-generated date that's actually just the last published date.
# Inspired by a shell script by <NAME>.
#
# Add the extension to your conf.py file:
# ex... |
#!/usr/bin/env python
from subprocess import *
from concurrent.futures import ThreadPoolExecutor as Pool
import os
import sys
import resource
import psutil
from random import *
import time
import math
from os import system
from glob import glob
call(['make','-j'])
call(['make','-j','count_tasks'])
SUCCESS, TLE, MLE... |
# Copyright (c) 2001-2022 Aspose Pty Ltd. All Rights Reserved.
#
# This file is part of Aspose.Words. The source code in this file
# is only intended as a supplement to the documentation, and is provided
# "as is", without warranty of any kind, either expressed or implied.
import re
import aspose.words as aw
from ap... |
import json
import uuid
from datetime import datetime
from functools import partial
from inspect import signature
from typing import Any, Dict, List, Optional, Union
from opal_client.config import opal_client_config
from opal_client.logger import logger
from opal_common.schemas.policy import PolicyBundle
from opal_com... |
# 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 applicable law or ... |
import sys
import os
# os.chdir(os.path.join(os.getenv('HOME'), 'RAFT'))
sys.path.append('./core')
import argparse
import cv2
import glob
import numpy as np
import torch
from PIL import Image
from raft import RAFT
from utils.utils import InputPadder
import yaml
def file_path(string):
if os.path.isfile(string):
... |
######
# Important implementation note: https://en.wikipedia.org/wiki/A*_search_algorithm
# Once a node is in the explored set, and later reached by a shorter parth, it needs to
# be added to the frontier again. This is important when heuristic is admissible but not
# consistent. If the h(n) is admissible + consi... |
from wxpy import *
import os
import cv2
import dlib
import numpy as np
import time
bot = Bot(console_qr = 1, cache_path = True)
myFriend = bot.friends()
hat_img = cv2.imread("hat2.png",-1)
def add_hat_func(img,hat_img):
# 分离rgba通道,合成rgb三通道帽子图,a通道后面做mask用
r,g,b,a = cv2.split(hat_img)
rgb_hat = cv2.merge(... |
# Copyright 2018 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 applicable law or a... |
from typing import List
from ..layers import GradientReversal
from ..utils import common_functions as c_f
from .base import BaseHook, BaseWrapperHook
from .cdan import CDANDomainHook, get_cdan_features_hooks, get_entropy_reducer
from .classification import CLossHook, SoftmaxHook
from .domain import DomainLossHook, Fea... |
'''
Transfer Ubuntu Dialog Corpus to the same input data format with Twitter data
as the input data of HybridNCM model
1 Only use positive context/response pairs
2 To avoid too long context, transfer context to multiple (context, response)
pairs (u1,u2,u3,r) -> 3 context/response pairs (u1,u2), (u2,u3), (u3,r)
3 After... |
from datetime import datetime, date
import logging
from pathlib import Path
import re
from collections import OrderedDict
from typing import NamedTuple, Optional, Sequence, Dict, Mapping, Any, Tuple, TypeVar, Callable, Union, List
Dateish = Union[datetime, date]
def link(*, url: str, title: str) -> str:
"""
>... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.