text
stringlengths
1
927k
import math class Solution: def countPrimes(self, n): """ :type n: int :rtype: int 厄拉多塞筛法 比如求20以内质数的个数, 首先0,1不是质数。 2是第一个质数,然后把20以内所有2的倍数划去。 2后面紧跟的数即为下一个质数3,然后把3所有的倍数划去。 3后面紧跟的数即为下一个质数5,再把5所有的倍数划去,以此类推。 """ if n < 2: return...
from typing import List class Solution: def numMagicSquaresInside(self, grid: List[List[int]]) -> int: R = len(grid) C = len(grid[0]) count = 0 for r in range(R-2): for c in range(C-2): r1c1 = grid[r][c] r1c2 = grid[r][c+1] ...
# -*- coding: utf-8 -*- __author__ = 'Ben, Ryan, Michael' import numpy as np from collections import defaultdict import pandas as pd import energyPATHWAYS from energyPATHWAYS.time_series import TimeSeries import unittest from matplotlib import pyplot as plt class TestTimeSeries(unittest.TestCase): def setUp(self...
"""Tests for certbot.plugins.storage.PluginStorage""" import json import unittest import mock from certbot import errors from certbot.compat import os from certbot.compat import filesystem from certbot.plugins import common from certbot.tests import util as test_util class PluginStorageTest(test_util.ConfigTestCase...
# 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 ...
"""Useful Job for the task queue. Include this file in the ``task_paths`` list if you need them """ import sys import os import tempfile from pq.api import job @job() async def execute_python(self, code=None): """Execute arbitrary python code on a subprocess. For example: tasks.queue_task('execute.pyth...
# --- # jupyter: # jupytext: # text_representation: # extension: .py # format_name: percent # format_version: '1.5' # jupytext_version: 1.7.1 # kernelspec: # display_name: Python 3 # name: python3 # --- # %% [markdown] # ```{note} # If running in Colab, think of changing the run...
import builtins import datetime from files_sdk.api import Api from files_sdk.exceptions import InvalidParameterError, MissingParameterError, NotImplementedError class Style: default_attributes = { 'id': None, # int64 - Style ID 'path': None, # string - Folder path This must be slash-delimit...
''' Classes for read / write of matlab (TM) 5 files The matfile specification last found here: https://www.mathworks.com/access/helpdesk/help/pdf_doc/matlab/matfile_format.pdf (as of December 5 2008) ''' ''' ================================= Note on functions and mat files ================================= The doc...
from django.conf.urls import url from . import views urlpatterns = [ # URL pattern for the UserListView url(regex=r'^$', view=views.UserListView.as_view(), name='list'), # URL pattern for the UserRedirectView url(regex=r'^~redirect/$', view=views.UserRedirectView.as_view(), name='redirect'), # URL...
# *** References *** # Gholami & Mohammadi, A Novel Combination of Bees and Firefly Algorithm to Optimize Continuous Problems # Türker Tuncer, LDW-SCSA: Logistic Dynamic Weight based Sine Cosine Search Algorithm for Numerical Functions Optimization # https://arxiv.org/ftp/arxiv/papers/1809/1809.03055.pdf # Hartmut ...
# Copyright Indra Soluciones Tecnologías de la Información, S.L.U. # 2013-2019 SPAIN # # 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...
# Importing the libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd import random # Importing the dataset dataset = pd.read_csv('kidney_disease2.csv') X = dataset.iloc[:,:-1].values y = dataset.iloc[:,24].values #handling missing data from sklearn.preprocessing import Imputer imputer =...
#! /usr/bin/env python # Copyright (c) 2013-2018, Rethink Robotics 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 ...
import logging import pytest logger = logging.getLogger(__name__) def check(expanded, exp_len): return 1 <= len(expanded) <= exp_len def test_qe_emb_expand(qe_obj, topn): q_str = "security clearance" exp = qe_obj.expand(q_str) logger.info(exp) assert check(exp, topn) def test_qe_emb_empty(qe...
class Solution(object): def boldWords(self, words, S): words.sort(key = len, reverse = True) hit = [0] * (len(S)+2) for i in xrange(len(S)): for w in words: if S.startswith(w, i): hit[i+1] += 1 hit[i+1+len(w)] -= 1 ...
import os import sys py_version = sys.version_info[:2] if py_version < (2, 7): raise RuntimeError('On Python 2, Supervisor requires Python 2.7 or later') elif (3, 0) < py_version < (3, 4): raise RuntimeError('On Python 3, Supervisor requires Python 3.4 or later') from setuptools import setup, find_packages ...
import logging from pyrogram import Client as LuciferMoringstar_Robot, filters as Worker, emoji from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, InlineQueryResultCachedDocument from LuciferMoringstar_Robot.database._utils import get_size from LuciferMoringstar_Robot.database.autofilter_db import g...
# This file was auto generated; Do not modify, if you value your sanity! import ctypes # can1_options class can1_options(ctypes.Union): _pack_ = 2 _fields_ = [ ('bExtended', ctypes.c_uint32, 1), # [Bitfield] ('DWord', ctypes.c_uint32), ] # Extra names go here: # End of extra names # can...
class Solution: def maxSubArray(self, nums: List[int]) -> int: ans = nums[0] sub_sum = 0 for num in nums: sub_sum += num ans = max(sub_sum, ans) if sub_sum < 0: sub_sum = 0 return ans
# Copyright 2014 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 ...
# Copyright (c) 2016 Mirantis, 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...
# Generated by Django 2.2 on 2020-12-18 13:14 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('profiles_api', '0001_initial'), ] operations = [ migrations.CreateModel( ...
# coding: utf-8 # # Copyright 2014 The Oppia 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 requi...
#!/usr/bin/env python3 # Copyright (c) 2010 ArtForz -- public domain half-a-node # Copyright (c) 2012 Jeff Garzik # Copyright (c) 2010-2017 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Educacoin P2...
# -*- coding: utf-8 -*- """ Created on Thu Aug 3 21:08:49 2017 Author: Josef Perktold """ import numpy as np from numpy.testing import assert_allclose from statsmodels.discrete.discrete_model import (Poisson, NegativeBinomial, NegativeBinomialP) from statsmodels.tools...
from modsim import * def calc_total_infected(results, system): s_0 = results.S[0] s_end = results.S[system.t_end] return s_0 - s_end
import os.path from .gbtile import GBTile from .gbtileset import GBTileset from .gbtilemap import GBTilemap from .c_export import generate_c_file, generate_c_header_file from .version import VERSION def generate_tileset( input_images, output_c=None, output_h=None, output_image=None, ...
# Copyright (c) OpenMMLab. All rights reserved. # Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -----------------------...
""" Copyright 2011 Ben Russell & contributors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions ...
# $Id: hashlib.py 66094 2008-08-31 16:35:01Z gregory.p.smith $ # # Copyright (C) 2005-2007 Gregory P. Smith (greg@krypto.org) # Licensed to PSF under a Contributor Agreement. # __doc__ = """hashlib module - A common interface to many hash functions. new(name, data=b'') - returns a new hash object implementing the...
from functools import lru_cache, update_wrapper from typing import Any, Callable, Dict, List, NamedTuple, Optional, Sequence, Set, Union, cast from dagster import check from dagster.core.decorator_utils import format_docstring_for_description from dagster.core.errors import DagsterInvalidDefinitionError from dagster.c...
from fastapi import Request, Response async def main(request: Request): return Response()
# 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 u...
# Copyright 2014-2015 Canonical Limited. # # This file is part of charm-helpers. # # charm-helpers is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License version 3 as # published by the Free Software Foundation. # # charm-helpers is distributed in the hope ...
import studentapp.views as studentapp from django.urls import path app_name = 'studentapp' urlpatterns = [ path('', studentapp.student, name='student'), ]
from setuptools import setup, find_packages from os import path here = path.abspath(path.dirname(__file__)) def get_version(): with open(path.join(here, "annot_gnomad/version.py")) as hin: for line in hin: if line.startswith("__version__"): version = line.partition('=')[2] ...
import os import torch import numpy as np import unittest import timeit import functools from tinygrad.tensor import Tensor, DEFAULT_DEVICE, Device def helper_test_op(shps, torch_fxn, tinygrad_fxn, atol=1e-6, rtol=1e-3, grad_atol=1e-6, grad_rtol=1e-3, forward_only=False, vals=None, a=-0.5, b=20): torch.manual_seed(0...
# coding: utf-8 """ Kubernetes No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: v1.12.4 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import sys import os i...
import unittest import requests_mock from canvasapi import Canvas from canvasapi.todo import Todo from tests import settings @requests_mock.Mocker() class TestTodo(unittest.TestCase): def setUp(self): self.canvas = Canvas(settings.BASE_URL, settings.API_KEY) self.todo = Todo( self.c...
r""" This module contains :py:meth:`~sympy.solvers.ode.dsolve` and different helper functions that it uses. :py:meth:`~sympy.solvers.ode.dsolve` solves ordinary differential equations. See the docstring on the various functions for their uses. Note that partial differential equations support is in ``pde.py``. Note t...
# -*- coding: utf-8 -*- """Distutils setup file, used to install or test 'sparksteps'.""" import textwrap from setuptools import setup, find_packages with open('README.rst') as f: readme = f.read() setup( name='sparksteps', description='Workflow tool to launch Spark jobs on AWS EMR', long_description...
from typing import Tuple from pydantic import BaseModel, validator class PodpingSettings(BaseModel): """Dataclass for settings we will fetch from Hive""" hive_operation_period: int = 3 max_url_list_bytes: int = 7500 diagnostic_report_period: int = 60 control_account: str = "podping" control_...
from gensim.corpora.dictionary import Dictionary from gensim.models.coherencemodel import CoherenceModel from gensim.models import KeyedVectors import gensim.downloader as api from scipy.spatial.distance import cosine import abc from contextualized_topic_models.evaluation.rbo import rbo import numpy as np import itert...
""" The MIT License (MIT) Copyright (c) 2013-2017 pgmpy Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p...
from direct.directnotify import DirectNotifyGlobal from panda3d.core import * from direct.interval.IntervalGlobal import * import FishGlobals class DirectRegion(NodePath): notify = DirectNotifyGlobal.directNotify.newCategory('DirectRegion') def __init__(self, parent = aspect2d): NodePath.__init__(self...
# -*- coding: utf-8 -*- """ sceptre.context This module implements the SceptreContext class which holds details about the paths used in a Sceptre project. """ from os import path class SceptreContext(object): """ SceptreContext is a place that holds data that is relevant to the project, including refer...
# Copyright 2010 The Emscripten Authors. All rights reserved. # Emscripten is available under two separate licenses, the MIT license and the # University of Illinois/NCSA Open Source License. Both these licenses can be # found in the LICENSE file. """A small wrapper script around the core JS compiler. This calls tha...
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
# Copyright (c) 2012-2021, Mark Peek <mark@peek.org> # All rights reserved. # # See LICENSE file for full license. # # *** Do not modify - this file is autogenerated *** # Resource specification version: 47.0.0 from . import AWSObject, AWSProperty from .validators import boolean, double, integer class ADMChannel(AW...
import sys from os.path import join from SCons.Script import (ARGUMENTS, COMMAND_LINE_TARGETS, AlwaysBuild, Default, DefaultEnvironment) env = DefaultEnvironment() platform = env.PioPlatform() board = env.BoardConfig() env.Replace( AR="riscv-nuclei-elf-gcc-ar", AS="riscv-nuclei-elf...
# Copyright (C) 2021 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # import importlib from collections import OrderedDict from contextlib import contextmanager import torch _is_nncf_enabled = importlib.util.find_spec('nncf') is not None def is_nncf_enabled(): return _is_nncf_enabled def check_nncf...
''' Key Detection involves determining the underlying key (distribution of notes and note transitions) in a piece of music. Key detection algorithms are evaluated by comparing their estimated key to a ground-truth reference key and reporting a score according to the relationship of the keys. Conventions ----------- K...
import sys sys.path = ['./rllab/'] + sys.path print (sys.path) import pickle import os,time from collections import deque import tensorflow as tf import numpy as np import lunzi.nn as nn from lunzi.Logger import logger from slbo.utils.average_meter import AverageMeter from slbo.utils.flags import FLAGS from slbo.utils....
""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP855.TXT' with gencodec.py. """#" import codecs ### Codec APIs class Codec(codecs.Codec): def encode(self,input,errors='strict'): return codecs.charmap_encode(input,errors,encoding_map) def decode(self,input,errors='strict'): ...
from typing import FrozenSet from collections import Iterable from math import log, ceil from mathsat import msat_term, msat_env from mathsat import msat_make_constant, msat_declare_function from mathsat import msat_get_integer_type, msat_get_rational_type, msat_get_bool_type from mathsat import msat_make_and, msa...
# Generated by Django 3.1.7 on 2021-04-27 11:52 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('checkout', '0004_checkout_completed'), ] operations = [ migrations.AddField( model_name='orderitem', name='completed...
# 2) Write a script that generates all the possible ungapped alignments of two sequences, scores them and identifies # the best scoring ones. # # These are all the possible ungapped alingments of the two sequences: TCA and GA: # # --TCA -TCA TCA TCA TCA- TCA-- # GA--- GA-- GA- -GA --GA ---GA # # Using the fol...
import numpy as np # TODO remove dependency from collections import namedtuple from itertools import chain from sklearn import metrics as skmetrics from util import unique from logging import warn BinaryClassificationCounts = namedtuple('BinaryClassificationCounts', 'tp t...
# -*- coding: utf-8 -*- import logging import os import re import time from collections import OrderedDict LOG = logging.getLogger(__name__) def md5sum_command(directory='.', find_type='f', match='', not_match=''): return ' '.join([i for i in [ 'find', directory, ('-type %s' % find_type) if find...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Copyright 2018 Fedele Mantuano (https://twitter.com/fedelemantuano) 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/lice...
#!/usr/bin/env python2.7 import sys from collections import defaultdict, deque from scipy.stats.stats import pearsonr from math import log import argparse ## THIS PARTICULAR SCRIPT IS DEPRECATED ## It is now under the name strandSwitchMetrics.py in PufferFish suite. ## Created circa June 11, 2014. ## Former sc...
# flake8: noqa """A Python library for controlling YeeLight RGB bulbs.""" from yeelight.enums import BulbType, CronType, LightType, PowerMode, SceneClass from yeelight.flow import Flow, HSVTransition, RGBTransition, SleepTransition, TemperatureTransition from yeelight.main import Bulb, BulbException, discover_bulbs f...
from __future__ import absolute_import import numpy as np import scipy as sp from six.moves import range from six.moves import zip def to_categorical(y, nb_classes=None): '''Convert class vector (integers from 0 to nb_classes) to binary class matrix, for use with categorical_crossentropy. ''' if not n...
from django.core.management.base import AppCommand class Command(AppCommand): help = 'Test Application-based commands' requires_model_validation = False args = '[appname ...]' def handle_app(self, app, **options): print 'EXECUTE:AppCommand app=%s, options=%s' % (app, sorted(options.items()))
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import conman.routes.validators class Migration(migrations.Migration): dependencies = [ ('routes', '0002_remove_slug_parent'), ] operations = [ migrations.AlterField( mod...
""" Base Player character """ from pycs.creature import Creature from pycs.spell import SpellAction from pycs.races import Human from pycs.util import check_args from pycs.constant import Condition from pycs.constant import DamageType ############################################################################## clas...
# 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! *** from ... import _utilities import typing # Export this package's modules as members: from ._enums import * from .access_control_record import * from .b...
import logging from data.logs_model.table_logs_model import TableLogsModel from data.logs_model.document_logs_model import DocumentLogsModel from data.logs_model.combined_model import CombinedLogsModel logger = logging.getLogger(__name__) def _transition_model(*args, **kwargs): return CombinedLogsModel(Document...
from nornir import InitNornir from nornir.plugins.tasks.networking import netmiko_send_command from nornir.plugins.functions.text import print_result def failed_task(task): print() print("-" * 60) print(f"This is a host that earlier failed: {task.host.name}") print("-" * 60) print() if __name__ ...
from schematic.utils.curie_utils import expand_curie_to_uri, expand_curies_in_schema, extract_name_from_uri_or_curie, uri2label from schematic.utils.df_utils import update_df from schematic.utils.general import dict2list, find_duplicates, str2list, unlist from schematic.utils.google_api_utils import download_creds_file...
# Copyright (C) 2014 Nippon Telegraph and Telephone Corporation. # Copyright (C) 2014 YAMAMOTO Takashi <yamamoto at valinux co jp> # # 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:...
#!/usr/bin/env python3 import sys import hashlib import hmac import base64 import secrets import re import datetime from datetime import timezone import math from GoogleOTP import GoogleOTP # Implementation of Google Authenticator verification # To generate secrets: # secret = generateSecret() # print( secret )...
from __future__ import unicode_literals import hashlib try: from importlib import import_module except ImportError: from django.utils.importlib import import_module # Django 1.6 / py2.6 from django import VERSION from django.conf import settings from django.core.exceptions import ValidationError if VERSION < ...
import os import wget import tempfile import numpy as np import scipy.io as sio import scipy.ndimage as nd from PIL import Image from sklearn.svm import SVC from sklearn.utils import resample from sklearn.decomposition import PCA from sklearn.model_selection import train_test_split from sklearn.metrics import classifi...
from pyspark.sql.types import StructType import pyspark.sql.functions as F from pyspark.sql.functions import explode from pyspark.sql.functions import split from pyspark.sql import SparkSession,SQLContext from pyspark import SparkContext,SparkConf spark = SparkSession \ .builder \ .appName("task1") \ .get...
# Lint as: python2, python3 # Copyright 2018 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 # ...
""" A program to judge whether an integer is odd or even.""" def main(): # Input the number with integer type. number = int(input('Input number: ')) # Assuming the reminder of the number dividing by 2 is 0, # the number is even and print it out. if number % 2 == 0: print(number, 'is even')...
# # Copyright (c) nexB Inc. and others. All rights reserved. # VulnerableCode is a trademark of nexB Inc. # SPDX-License-Identifier: Apache-2.0 # See http://www.apache.org/licenses/LICENSE-2.0 for the license text. # See https://github.com/nexB/vulnerablecode for support or download. # See https://aboutcode.org for mor...
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
# -*- coding: utf-8 -*- """ Created on Fri Jul 17 21:16:08 2020 @author: wmonteiro92 """ from xgboost import XGBRegressor, XGBClassifier def train_ml_model(X, y, algorithm, random_state=0): """Train one dataset in Python. :param X: the input values. :type X: np.array :param y: the target values. ...
""" Model classes """ import numpy as np import sys import inspect # Used for storing the input from .aquifer import Aquifer from .aquifer_parameters import param_maq, param_3d from .constant import ConstantStar from .util import PlotTim import multiprocessing as mp __all__ = ['Model', 'ModelMaq', 'Model3D'] class...
# Module 'ntpath' -- common operations on WinNT/Win95 pathnames """Common pathname manipulations, WindowsNT/95 version. Instead of importing this module directly, import os and refer to this module as os.path. """ import os import sys import stat import genericpath import warnings from genericpath import * __all__ ...
import torch import torch.nn as nn class ValueNet(nn.Module): """ The part of the actor critic network that computes the state value. Also, returns the hidden layer before state valuation, for use in action network. """ def __init__(self, n_inputs: int, n_hidden: int = None): """ ...
#!/bin/python import math import os import random import re import sys if __name__ == '__main__': n = int(input().strip()) if n % 2: # odd. print("Weird") elif n < 5: # All the elif never come if number is odd. print("Not Weird") elif n < 21: # If number in 2 to 5 than above wi...
import sublime import sublime_plugin import re class SurroundWindowCommand(sublime_plugin.WindowCommand): """ Base class for surround window commands """ def run(self, sel=None): self.sel = sel self.window.show_input_panel( self.caption(), "", self.callback, None, None) class Su...
# Copyright (C) 2009 The Android Open Source 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
import argparse import time from . import encode_file, decode_file from .utils import get_file from .wav import Wave parser = argparse.ArgumentParser("pysilk", description="encode/decode your silk file") parser.add_argument("-sr", "--sample-rate", default=24000, help="set pcm samplerate") parser.add_argument("-q", "-...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # PTF Main framework look and feel # # main module imports from src.core import * import sys import readline import os import time import getpass try: import pexpect pexpect_check = 1 except: print("[!] python-pexpect not installed, gitlab will not work") ...
from .TLiDB_dataset import TLiDB_Dataset from tlidb.TLiDB.metrics.all_metrics import Accuracy class clinc150_dataset(TLiDB_Dataset): """ CLINC150 dataset This is the full dataset from https://github.com/clinc/oos-eval Input (x): - text (str): Text utterance Target (y): - label (li...
import aesara from aesara import tensor as at from aesara.gradient import DisconnectedType from aesara.graph.basic import Apply from aesara.graph.op import Op from aesara.graph.opt import TopoOptimizer, copy_stack_trace, local_optimizer def get_diagonal_subtensor_view(x, i0, i1): """ Helper function for Diago...
# 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 u...
# -*- coding: utf-8 -*- """Top-level package for delicious treat.""" __author__ = """Sam Briggs""" __email__ = 'briggySmalls90@gmail.com' __version__ = '0.1.0'
# -*- coding: utf-8 -*- """ CSF Ip tables management ======================== :depends: - csf utility :configuration: See http://download.configserver.com/csf/install.txt for setup instructions. .. code-block:: yaml Simply allow/deny rules: csf.rule_present: ip: 1.2.3.4 method: allow """...
# -*- coding: utf-8 -*- from util import WebHelpersTestCase import unittest from nose.tools import eq_ from webhelpers.text import * class TestTextHelper(WebHelpersTestCase): def test_excerpt(self): self.assertEqual("...lo my wo...", excerpt("hello my world", "my", 3)) ...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
import numpy as np import torch, os import torch.nn.utils.rnn as rnn_utils from typing import Tuple import torch.nn as nn import torch.nn.functional as F from PIL import Image import torchvision from torchvision import transforms def flatten(x): ''' flatten high dimensional tensor x into an array :param x...
#!/usr/bin/env python2 # Copyright (c) 2014-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. # # Test proper accounting with a double-spend conflict # from test_framework.test_framework import Outb...
import os import time import shutil import hashlib import mimetypes from django.core.files.storage import FileSystemStorage from . import settings class VersionGenerationError(Exception): pass class Conveyor(object): # convention: storage should operate files on local filesystem # to allow processors us...
import os import sys sys.path.insert(0, (os.getcwd()))