text
stringlengths
1
927k
# Written By Qaiser # Github :- https://github.com/TechQaiser # Youtube :- Tech Qaiser # Advance 100 sub special Command import marshal,zlib,base64
#!/usr/bin/env python3 # Copyright (c) 2014-2019 The Bitcoin Core developers # Copyright (c) 2017 The Bitcoin developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Run regression test suite. This module calls down into ind...
#!/usr/bin/env python3 import csv from os import path def get_miles_driven(): while True: miles_driven = float(input("Enter miles driven : ")) if miles_driven > 0: return miles_driven else: print("Entry must be greater than zero. Please try again.\n") ...
from allauth.socialaccount.providers.base import ProviderAccount from allauth.socialaccount.providers.oauth2_provider.provider import OAuth2Provider class InstagramAccount(ProviderAccount): PROFILE_URL = "http://instagram.com/" def get_profile_url(self): return self.PROFILE_URL + self.account.extra_...
from CalibMuon.DTCalibration.Workflow.addPoolDBESSource import addPoolDBESSource class config: pass config.runNumber = 186323 config.t0DB = 't0_correction_chamber_Wh-2_MB2_Sec12_Wh2_MB3_Sec12_Wh-1_MB4_Sec1_t0_186323.db' config.dbLabelRef = 't0Ref' config.refTag = 't0' #config.connect = 'sqlite_file:/afs/cern.ch/cms/C...
# # Copyright 2021 Red Hat Inc. # SPDX-License-Identifier: Apache-2.0 # """Test the download task.""" import json import logging import os import shutil import tempfile import time from datetime import date from datetime import timedelta from decimal import Decimal from unittest import skip from unittest.mock import AN...
# Copyright (C) 2019 The Raphielscape Company LLC. # # Licensed under the Raphielscape Public License, Version 1.d (the "License"); # you may not use this file except in compliance with the License. # # ReCode by @mrismanaziz # FROM Man-Userbot <https://github.com/mrismanaziz/Man-Userbot> # t.me/SharingUserbot & t.me/L...
#!/usr/bin/python3 # # This tool helps me to check the Linux kernel Kconfig option list # against my security hardening preferences for X86_64, ARM64, X86_32, and ARM. # Let the computers do their job! # # Author: Alexander Popov <alex.popov@linux.com> # # Please don't cry if my Python code looks like C. # # # N.B Har...
# 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 from ... import _utilities, _tables __a...
assoc_laguerre(n, a, x)
#!/usr/bin/env python import os, sys from django.core.management import execute_manager sys.path.insert(0, os.path.abspath('./..')) try: import settings # Assumed to be in the same directory. except ImportError: import sys sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containin...
# This file helps to compute a version number in source trees obtained from # git-archive tarball (such as those provided by githubs download-from-tag # feature). Distribution tarballs (built by setup.py sdist) and build # directories (produced by setup.py build) will contain a much shorter file # that just contains th...
#- # Copyright (c) 2011 William M. Morland # All rights reserved. # # This software was developed by SRI International and the University of # Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 # ("CTSRD"), as part of the DARPA CRASH research programme. # # @BERI_LICENSE_HEADER_START@ # # Licensed...
# # Copyright 2019 Xilinx 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...
# Shameless steal from: https://github.com/klicperajo/dimenet import numpy as np from scipy.optimize import brentq from scipy import special as sp try: import sympy as sym except ImportError: sym = None def Jn(r, n): return np.sqrt(np.pi / (2 * r)) * sp.jv(n + 0.5, r) def Jn_zeros(n, k): zerosj = ...
import abc from typing import List class IPCWrapper(abc.ABC): """ This public class defines the mosec IPC wrapper plugin interface. The wrapper has to at least implement `put` and `get` method. """ @abc.abstractmethod def put(self, data: List[bytes]) -> List[bytes]: """Put bytes to so...
from __future__ import print_function import os import sys import time import argparse import datetime import math import pickle import matplotlib.pyplot as plt import seaborn as sns import torchvision import torchvision.transforms as transforms from torch.utils.data import SubsetRandomSampler from utils.autoaugment...
from functools import reduce from operator import or_ from typing import NamedTuple, Set from .argument import Argument from .clause import Clause from .literal import Literal class ClauseParser(NamedTuple): """Class responsible for parsing input data. """ negate_marker: str = "~" or_splitter: str = ...
import mock import os import pandas as pd from datetime import datetime from flexmock import flexmock from sportsreference import utils from sportsreference.constants import HOME from sportsreference.nba.constants import BOXSCORE_URL, BOXSCORES_URL from sportsreference.nba.boxscore import Boxscore, Boxscores MONTH = ...
import uuid import json import os from glob import iglob from pprint import pprint mapping={} mapping['URL']=[] #Getting JSON file of initial Tika parsing containing list of file paths categorized by MIME types file="C:/Users/rahul/Documents/GitHub/Scientific-Content-Enrichment-in-the-Text-Retrieval-Conference-TREC-Po...
#!/usr/bin/env python3 import json import os CONFIGFILE = "/etc/snmp/pureftpd.json" pureftpwho_cmd = "/usr/sbin/pure-ftpwho" pureftpwho_args = "-v -s -n" output_data = {} output_data["version"] = 1 output_data["errorString"] = "" output_data["error"] = 0 if os.path.isfile(CONFIGFILE): with open(CONFIGFILE, "...
import sqlite3 conn = sqlite3.connect("mhd.db") def insert_user(name, password): global users users = count_users() conn.execute( "INSERT INTO USERS (ID,NAME,PASSWORD) VALUES (" + str(users + 1) + ", '" + name + "', '" + password + "')" ...
"""Compute quantum chemistry using Iowa State's GAMESS executable.""" import logging import pprint import re from decimal import Decimal from typing import Tuple import numpy as np import qcelemental as qcel from qcelemental.models import Molecule from qcelemental.molparse import regex from ..util import PreservingD...
# exc.py # Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php """ Module containing all exceptions thrown throughout the git package, """ from gitdb.exc import * ...
"""Staff reschedule message class""" from mysql_wrapper import Base class StaffRescheduleMessage(Base): """Staff reschedule message class""" __tablename__ = 'staff_reschedule_message' id = int() tournament_id = bytes() message_id = bytes() match_id = bytes() new_date = bytes() staff_i...
#!/usr/bin/env python3 #-*- coding:utf-8 -*- import sys import os from qiniu import Auth, put_file, etag, urlsafe_base64_encode import qiniu.config from qiniu.compat import is_py2, is_py3 ACCESS_KEY = os.getenv('QINIU_ACCESS_KEY') SECRET_KEY = os.getenv('QINIU_SECRET_KEY') BUCKET_NAME = os.getenv('QINIU_BUCKET_NAME'...
# coding=utf-8 # This code is modified based on generative.py at # # https://github.com/google-research/google-research/tree/master/genomics_ood # # Copyright 2021 University of Southern California. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance...
import sys import numpy import time import ctrigrid_bindings # this needs to be copied in the local directory s=0.5 cube_vertices=[ -s, -s, -s, s, -s, -s, s, s, -s, -s, s, -s, -s, -s, s, s, -s, s, s, s, s, -s, s, s, ] x=0.577350269 c...
#!/usr/bin/env python #------------------------------ """ :py:class:`CalibParsBaseEpix10kaV1` - holds basic calibration metadata parameters for associated detector ========================================================================================================= See: - :py:class:`GenericCalibPars` - :py:c...
from project.user import User class Library: def __init__(self): self.user_records: 'user objects' = [] self.books_available: '{authors: [books]}' = {} self.rented_books: '{usernames: {book names: days left}}' = {} self.days_to_return_book: '{book_name: [days]}' = {} self.u...
# # release.py # import yaml from io import StringIO import pprint from subprocess import Popen, PIPE import os import sys import argparse import json def pp(o): pprinter = pprint.PrettyPrinter(indent=4) pprinter.pprint(o) def getOpts(cmd_line_args): parser = argparse.ArgumentParser(description="Set se...
import torch import torch.nn as nn import numpy as np from functools import partial from scipy.special import eval_legendre from sympy import Poly, legendre, Symbol, chebyshevt def legendreDer(k, x): def _legendre(k, x): return (2*k+1) * eval_legendre(k, x) out = 0 for i in np.arange(k-1,-1,-2): ...
n = input() if n%2 != 0: print "Weird" elif n >= 2 and n <= 5: print "Not Weird" elif n >= 6 and n <= 20: print "Weird" elif n > 20: print "Not Weird"
from django.shortcuts import render from django.core.paginator import Paginator from .models import Main def Index(request): # busca e page '''busca = request.GET.get('search') page = request.GET.get('page') if busca: main = Main.objects.filter(nome__icontains=busca) paginator = Paginat...
# -*- coding: utf-8 -*- """ dicom2nifti @author: abrys """ from __future__ import print_function import pydicom import pydicom.uid import pydicom.dataset import logging import numpy import os import datetime from six import string_types, iteritems import dicom2nifti.compressed_dicom as compressed_dicom from dicom2ni...
# py2deb: Python to Debian package converter. # # Authors: # - Arjan Verwer # - Peter Odding <peter.odding@paylogic.com> # Last Change: August 6, 2020 # URL: https://py2deb.readthedocs.io """ The :mod:`py2deb.package` module contains the low level conversion logic. This module defines the :class:`PackageToConvert` ...
from typing import Iterable from tokenizers import decoders, Tokenizer from tokenizers.models import WordPiece from tokenizers.normalizers import Lowercase, NFD, Normalizer, Sequence, StripAccents from tokenizers.pre_tokenizers import Whitespace from tokenizers.trainers import WordPieceTrainer PAD_TOKEN = "[PAD]" UNK...
import requests from flask import current_app from .defaults import DEFAULT_EDITABLES, DEFAULT_FILE_TYPES, DEFAULT_TAGS def setup_requests_session(token): session = requests.Session() session.headers = {"Authorization": "Bearer {}".format(token)} if current_app.debug: session.verify = False r...
""" WSGI config for rm project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``WSGI_APPLICATION`` setti...
import unittest from unittest.mock import sentinel, DEFAULT class SentinelTest(unittest.TestCase): def testSentinels(self): self.assertEqual(sentinel.whatever, sentinel.whatever, 'sentinel not stored') self.assertNotEqual(sentinel.whatever, sentinel.whateverelse, 'sentinel...
# -*- coding: utf-8 -*- import json import ConfigParser import urllib2 import urllib sample_data = u'''{ "coord": { "lon": 34.98, "lat": 48.45 }, "weather": [{ "id": 701, "main": "Mist", "description": "туман", "icon": "50d" }], "base": "cmc stations", "main": { "temp": 7, "pressure": 1015, "hu...
from __future__ import absolute_import, print_function import glob import json import os import pkg_resources import re import shlex import shutil import subprocess import sys import tempfile import warnings from contextlib import contextmanager from datetime import datetime from fnmatch import fnmatch from .compat i...
"""empty message Revision ID: 455970924ed2 Revises: ab6b56596f03 Create Date: 2021-05-28 18:10:58.753066 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = '455970924ed2' down_revision = 'ab6b56596f03' branch_labels = None...
#!/usr/bin/env python3 import random import textwrap NUMCNT = 9 # How many numbers are we playing with? def main() -> None: print("REVERSE".center(72)) print("CREATIVE COMPUTING MORRISTOWN, NEW JERSEY".center(72)) print() print() print("REVERSE -- A GAME OF SKILL") print() if not input...
from django.db import models class Key(models.Model): public_key = models.CharField(max_length=100, unique=True) private_key = models.CharField(max_length=100, unique=True) def __unicode__(self): return 'Public Key: %s, Private Key: %s' % ( self.public_key, self.private_ke...
from unittest import TestCase from tests import get_data from pytezos.michelson.converter import build_schema, decode_micheline, encode_micheline, micheline_to_michelson class StorageTestKT1VwGoijY62ze1w9iTaCum7ybMyGcw2Uep5(TestCase): @classmethod def setUpClass(cls): cls.maxDiff = None cls....
import numpy as np import torch import torch.nn as nn from models.CCNet.CC import CC_module as CrissCrossAttention affine_par = True BatchNorm2d = nn.BatchNorm2d def outS(i): i = int(i) i = (i + 1) / 2 i = int(np.ceil((i + 1) / 2.0)) i = (i + 1) / 2 return i def conv3x3(in_planes, out_planes, s...
# event/legacy.py # Copyright (C) 2005-2021 the SQLAlchemy authors and contributors # <see AUTHORS file> # # This module is part of SQLAlchemy and is released under # the MIT License: https://www.opensource.org/licenses/mit-license.php """Routines to handle adaption of legacy call signatures, generation of deprecation...
import json # import requests # from pathlib import Path # import re with open('fetch_poslowie_from_sejm_gov_pl.json') as fp: sejm_content = json.load(fp) with open('fetch.json') as fp: target_content = json.load(fp) def normalize_name(v): parts = v.split(' ') return f"{parts[0]} {parts[-1]}" sejm_n...
import copy import numbers from ctypes import * from . import ops from .utils import fresh_name, fresh_bv import z3 from functools import reduce from .symbolic import CobbleSymVal, CobbleSymGen funcs = [ ('is_bv', [c_void_p], c_bool), ('get_bv_width', [c_void_p], ...
#!/usr/bin/env python # Software License Agreement (BSD License) # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditio...
from pypy.interpreter.pyparser.asthelper import get_atoms from pypy.interpreter.pyparser.grammar import Parser from pypy.interpreter.pyparser import error from fakes import FakeSpace def test_symbols(): p = Parser() x1 = p.add_symbol('sym') x2 = p.add_token('tok') x3 = p.add_anon_symbol(':sym') x4...
# Copyright The PyTorch Lightning 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 agreed to i...
# 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, ...
import os import logging import json import unittest from botocore.exceptions import ClientError from localstack.constants import TEST_AWS_ACCOUNT_ID from localstack.services.iam.iam_starter import ADDITIONAL_MANAGED_POLICIES from localstack.utils.aws import aws_stack from localstack.utils.common import short_uid from ...
import pandas as pd def convert_to_json(): kamusi = pd.read_csv( "words.csv", usecols=["Index", "Word", "Meaning", "Synonyms", "Conjugation"] ) kamusi = kamusi.set_index("Index") kamusi.to_json("kamusi.json", orient="index") if __name__ == "__main__": convert_to_json()
"""Top-level package for AutoAlchemy.""" __author__ = """Hayden Kotelman""" __email__ = "hay-kot@pm.me" __version__ = "0.1.0" from .auto-alchemy import auto_init from .config import AutoInitConfig
#!/usr/bin/env python ''' Contains all file-reading code and mapping code to generate results used for HRI17 and RSS17 papers. ''' import sys import os import time sys.path.append('../src') from entity import Entity from mapper import * from file_io import * from object_defs import * if __name__ == "__main__": # ...
import unittest import os import json from app import create_app from app.v1.v1 import business_model, user_model class AddBusinessTestCase(unittest.TestCase): """This class represents the api test case""" def setUp(self): """ Will be called before every test """ self.app = cr...
from typing import Dict, Union JirafsMacroAttributeValue = Union[str, float, bool] JirafsMacroAttributes = Dict[str, JirafsMacroAttributeValue]
""" Useful form fields for use with SQLAlchemy ORM. """ import operator from wtforms import widgets from wtforms.fields import SelectFieldBase from wtforms.validators import ValidationError from .tools import get_primary_key from flask_admin._compat import text_type, string_types from flask_admin.form import Form...
#!/usr/bin/env python from setuptools import setup, find_packages import os from azure_storage import __version__ PACKAGE_DIR = os.path.abspath(os.path.dirname(__file__)) os.chdir(PACKAGE_DIR) setup( name='django-azure-storage', version=__version__, url="https://github.com/Rediker-Software/django-azure-...
# Copyright (c) 2020-2021 NVIDIA CORPORATION. import numpy as np from geopandas import GeoSeries as gpGeoSeries from shapely.geometry import ( LineString, MultiLineString, MultiPoint, MultiPolygon, Point, Polygon, ) class GeoPandasAdapter: def __init__(self, geoseries: gpGeoSeries): ...
# Copyright 2013 OpenStack Foundation # 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 requ...
import pytest from fb_group.utils import parse_args class TestUtils: def test_parse_args(self): assert parse_args([]) == {} assert parse_args(["a=1"]) == {"a": "1"} assert parse_args(["a=1", "b=2"]) == {"a": "1", "b": "2"} assert parse_args(["a"]) == {} assert parse_args(["...
# # # Copyright (C) University of Melbourne 2012 # # # #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, ...
# Generated by Django 3.0.7 on 2020-06-30 16:07 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Question', fields=[ ...
''' Support utilities for (mostly) text data. ''' # TODO: This stuff should probably be merged into .utils. from .decorators import requires_nltk_corpus from .download import download_nltk_data from .download_embedding import download_embedding_data __all__ = [ 'requires_nltk_corpus', 'download_nltk_data', ...
# coding: utf8 import os from . import pycraft Version = '0.11.3-alpha' ROOT_PATH = [ os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', ''), # I'm in ./utils/ folder so ../ might be the path './', ] MilliSecondPerHour = 60 * 60 * 1000 BytePerKB = 1024 BytePerMB = BytePerKB * 1024 MinimumLegalFileSize =...
# Copyright (c) Facebook, Inc. and its affiliates. from collections import defaultdict import itertools import logging import numpy as np import operator import pickle import torch.utils.data from tabulate import tabulate from termcolor import colored from herbarium.config import configurable from herbarium.utils.comm...
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/73_callback.captum.ipynb (unless otherwise specified). __all__ = ['json_clean', 'IntegradedGradientsCallback', 'CaptumInsightsCallback'] # Cell import tempfile from ..basics import * from ..learner import Callback # Cell # Dirty hack as json_clean doesn't support Cate...
# -*- coding: utf-8 -*- # $Id: ja.py 78909 2010-03-13 10:49:23Z georg.brandl $ # Author: Hisashi Morita <hisashim@kt.rim.or.jp> # Copyright: This module has been placed in the public domain. # New language mappings are welcome. Before doing a new translation, please # read <http://docutils.sf.net/docs/howto/i18n.html...
from main import count_positives_sum_negatives,count_positives_sum_negatives1 def test1(benchmark): assert benchmark(count_positives_sum_negatives1,[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -11, -12, -13, -14, -15]) == [10, -65] def test(benchmark): assert benchmark(count_positives_sum_negatives, [1, 2, 3, 4, 5, ...
import json from collections import defaultdict from queue import Queue from unittest.mock import patch import redis from redis.exceptions import ConnectionError from CTFd.config import TestingConfig from CTFd.utils.events import EventManager, RedisEventManager, ServerSentEvent from tests.helpers import create_ctfd, ...
from cms.plugin_base import CMSPluginBase from cms.plugin_pool import plugin_pool from django.utils.translation import ugettext_lazy as _ from models import * bootstrap_module_name = _("Widgets") layout_module_name = _("Layout elements") generic_module_name = _("Generic") meta_module_name = _("Meta elements") class ...
#!/usr/bin/python # # Copyright (c) 2020 Fred-Sun, (@Fred-Sun) # # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type DOCUMENTATION = ''' --- module: azure_rm_virtualwan version_added: '1.5.0...
from typing import List class Solution: def orderOfLargestPlusSign(self, N: int, mines: List[List[int]]) -> int: banned = {tuple(mine) for mine in mines} dp = [[0] * N for _ in range(N)] ans = 0 for r in range(N): count = 0 for c in range(N): ...
from django.urls import path from . import views urlpatterns = [ # path('', views.show_book_list_view), # path('book/<int:book_id>/', views.show_book_by_pk_view), # path('book/create/', views.create_book_view), # path('book/update/<int:pk>/', views.update_book_view), # path('book/delete/<int:pk>/'...
import sys import types import pytest from pandas.compat._optional import ( VERSIONS, import_optional_dependency, ) import pandas._testing as tm def test_import_optional(): match = "Missing .*notapackage.* pip .* conda .* notapackage" with pytest.raises(ImportError, match=match): import_opt...
import pytest from portfolio_rebalance.skeleton import fib, main __author__ = "David Simmons" __copyright__ = "David Simmons" __license__ = "MIT" def test_fib(): """API Tests""" assert fib(1) == 1 assert fib(2) == 1 assert fib(7) == 13 with pytest.raises(AssertionError): fib(-10) def t...
# -*- coding: utf-8 -*- # 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...
from scripts.helpers import smart_get_account, LOCAL_BLOCKCHAIN_ENVIRONMENTS, approve_transfer from scripts.runAstroSwap import deploy_erc20 from brownie import network, accounts, config, MiniSwap, MockERC20 from brownie.network.contract import Contract fee = 400 def deploy_mini_swap(fee): account = smart_get_acc...
# encoding: utf-8 """ capability.py Created by Thomas Mangin on 2012-07-17. Copyright (c) 2009-2017 Exa Networks. All rights reserved. License: 3-clause BSD. (See the COPYRIGHT file) """ import sys # Do not create a dependency loop by using exabgp.bgp.message as import from exabgp.util import ordinal from exabgp.uti...
import BinWriter as bi import os class Cilindro: def __init__(self, nombre, pkeys, ikey, ruta): self.indx = [None]*30 self.longi = 30 self.nombre = nombre self.ruta = ruta+"/"+nombre+".b" self.icode = ikey self.pkeys = pkeys self.seguiente = ikey + 1 ...
""" ====================================================================== Crossbar.py ====================================================================== """ from pymtl3 import * class Crossbar( Component ): def construct( s, nports, dtype ): sel_nbits = clog2( nports ) s.in_ = [ InPort ( dtype ) ...
__all__ = ['logger', 'plotter', 'profiler', 'shell']
#!/usr/bin/env python # -*- coding: utf-8 -*- # # date: 2018/2/22 # author: he.zhiming # from __future__ import unicode_literals, absolute_import import random class RandomUtils: @classmethod def get_random_float(cls) -> float: """调整标准库命名 提示调用者, 会返回一个float :return: ...
__author__ = "Zhijing Jin" __copyright__ = "Copyright 2020, Zhijing Jin" __credits__ = ["git@github.com:shunk031/TedScraper.git"] __license__ = "MIT" __version__ = "1.0" __email__ = "zhijing.jin@connect.hku.hk" __status__ = "Production" ''' website is https://www.ted.com/participate/translate/our-languages stats of pr...
import os import warnings import sys import pandas as pd import numpy as np from sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score from sklearn.model_selection import train_test_split,cross_val_score from sklearn.model_selection import GridSearchCV,RandomizedSearchCV from sklearn.linear_model imp...
#!/usr/bin/env python # -*- encoding: utf-8 -*- from __future__ import absolute_import from __future__ import print_function import io import re from glob import glob from os.path import basename from os.path import dirname from os.path import join from os.path import splitext from setuptools import find_packages fro...
from __future__ import annotations from dataclasses import dataclass from anytree import NodeMixin from typing import Optional from slugify import slugify pattern_ltree_compatible = "[^-a-z0-9_]+" def identifier_from_string(a_string: str) -> str: return slugify(a_string, regex_pattern=pattern_ltree_compatible, se...
#coding=utf-8 #2017.6.13 #By JerCas # 导入plist文件解析模块 import plistlib def findDuplicates(fileName): """查找重复曲目""" print("Finding duplicate tracks in "+ fileName +" ...") # 读取播放列表 # P-list文件将对象表示为字典,而播放列表文件使用的是一个字典的字典字典(值仍为一个字典);readPlist读入一个P-list文件作为输入,返回一个字典字典 plist = plistlib.readPlist(fileName) ...
# Copyright 2020 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
"""Routines for Stage Two of CUSP: Training the Quantum Autoencoder.""" import numpy as np from multiprocessing import Pool from cirq import Circuit, MeasurementGate, ParamResolver from cirq.ops import * from cirq.google import ExpZGate, XmonQubit, XmonSimulator from cirq.circuits import InsertStrategy from cirq.cont...
#!/usr/bin/python """ SQLite Database Interface for Data Copyright (c) 2014, 2015 Andrew Hawkins 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...
# Copyright 2019-2022 ETH Zurich and the DaCe authors. All rights reserved. import dace import pickle import math import copy from typing import Generator, Dict, List, Tuple from collections import Counter from dace import SDFG, dtypes from dace.optimization import cutout_tuner from dace.sdfg.analysis import cutout a...
from .shortener import Shortener class TestShortener: def test_short(self): shortener = Shortener('https://mbasov.me') assert shortener.short().startswith('https://goo.gl')
# -*- coding: utf-8 -*- import numpy as np def get_axes_list(self): """Get the value of variables stored in Solution. Parameters ---------- self : SolutionMat an SolutionMat object Returns ------- axis_dict: list a list of axis names containing axis sizes """ re...
from datetime import ( date as Date, datetime as Datetime, time as Time, timedelta as Timedelta, timezone as Timezone, ) from decimal import Decimal from enum import Enum from ipaddress import ( IPv4Address, IPv4Network, IPv6Address, IPv6Network, ip_address, ip_network, ) fro...
# Copyright 2013-2020 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 PyCheroot(PythonPackage): """ Highly-optimized, pure-python HTTP server """ homepage...