text
stringlengths
1
927k
# -*- coding: utf-8 -*- # # botocore documentation build configuration file, created by # sphinx-quickstart on Sun Dec 2 07:26:23 2012. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # Al...
import json import logging import random from typing import Dict from great_expectations.data_context.store import ConfigurationStore from great_expectations.data_context.types.base import CheckpointConfig from great_expectations.data_context.types.resource_identifiers import ( ConfigurationIdentifier, ) logger =...
from django.test.utils import override_settings from hc.api.models import Channel from hc.test import BaseTestCase @override_settings(TWILIO_ACCOUNT="foo", TWILIO_AUTH="foo", TWILIO_FROM="123") class AddSmsTestCase(BaseTestCase): url = "/integrations/add_sms/" def test_instructions_work(self): self.c...
#!/usr/bin/env python # -*- coding: utf-8 -*- import collections import sys from loguru import logger from pprint import pformat from typing import List import numpy as np import pandas as pd import scipy import six import sklearn.preprocessing as pre import torch import tqdm import yaml import augment import datase...
""" PASSENGERS """ numPassengers = 26956 passenger_arriving = ( (8, 5, 7, 6, 3, 4, 2, 0, 2, 0, 0, 0, 0, 10, 8, 3, 6, 4, 2, 4, 3, 1, 3, 1, 3, 0), # 0 (13, 9, 4, 9, 2, 2, 4, 2, 1, 2, 0, 0, 0, 6, 6, 5, 2, 3, 2, 1, 0, 4, 2, 0, 1, 0), # 1 (7, 3, 7, 13, 11, 6, 4, 3, 3, 1, 1, 0, 0, 10, 7, 6, 4, 4, 6, 3, 1, 5, 2, 1, 1, ...
import pytest import re import psycopg2.extras import damast from damast.postgres_rest_api.util import NumericRangeEncoder import flask import json from functools import namedtuple from conftest import get_headers from database.testdata import annotation_table, document_table, evidence_table, person_instance_table, pl...
# coding: UTF-8 """ Definition of class Element """ class Element: @property def description(self): """ :return: Description of the element :rtype: :obj:`str` """ return self._description def __init__(self, description): self._description = description
#!/usr/bin/env python3 from broker import cfg from broker._utils.tools import log from broker._utils.web3_tools import get_tx_status from broker.config import env from broker.errors import QuietExit from broker.utils import print_tb def _update_data_price(): Ebb = cfg.Ebb if not Ebb.does_provider_exist(env.P...
from .event_meta import event_meta from .evd_manager_base import evd_manager_base from .evd_manager_2D import evd_manager_2D from .evd_manager_3D import evd_manager_3D try: import pyqtgraph.opengl as gl # from .evdmanager import evd_manager_3D except: pass
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT license. from typing import Tuple, Mapping, Any from textworld.core import Environment, Wrapper class Limit(Wrapper): """ Environment wrapper to limit the number of steps. """ def __init__(self, env: Environment,...
from rest_framework import permissions class UpdateOwnProfile(permissions.BasePermission): """Allow users to edit their own profile""" def has_object_permission(self, request, view, obj): """Check user is trying to edit their own profile""" if request.method in permissions.SAFE_METHODS: ...
username = input() input_command = input() while input_command != "Sign up": tokens = input_command.split() command = tokens[0] if command == "Case": case = tokens[1] if case == "lower": username = username.lower() else: username = username.upper() pr...
#! /usr/bin/env python3 # -*- coding:utf-8 -*- ''' if_service_exists(): Boolean:服务是否存在 if_service_running(): Booleans:服务是否运行 start_run_service(): 无法以admin运行 ''' import os, subprocess, time import ctypes, sys # from tool import bat import zhangwei_helper.function.Os as self_os import zhangwei_helper.enum.SelfEnum as sel...
import re import numpy as np import pandas as pd import numpy import glob from tqdm import tqdm import random import pickle from numpy.core.fromnumeric import std import mir_eval from cfp import cfp_process from tensorflow import keras import os import tensorflow as tf from tensorflow.keras import backend as K from te...
# -*- coding: utf-8 -*- """ This is the basic GoogleScraper configuration file. All options are basic Python data types. You may use all of Python's language capabilities to specify settings in this file. """ """ [OUTPUT] Settings which control how GoogleScraper represents it's results and handles output. """ # How ...
"""Provide utilities related to offsets.""" import logging import math from maya import cmds from maya.api import OpenMaya import ftd.attribute import ftd.connection __all__ = [ "group", "inverse_group", "matrix", "matrix_to_group", "reset_matrix", "unmatrix", ] LOG = logging.getLogger(__nam...
from setuptools import setup setup( name='t4Playout', version='0.1', packages=['conf', 'Playout', 'Playout.Apps', 'Playout.Admin', 'Playout.Tests', 'Playout.Views', 'Playout.Models', 'Playout.management', 'Playout.management.commands', 'Playout.migrations', 't4Playout'], url='https://www....
LOG_WITHOUT_CONTEXT = {'metadata':{'module':'Tesseract-OCR'}} def init(): global app_context app_context = { 'application_context' : None }
""" Orchestration of Thousand Eyes agents on Catalyst 9000 """ from rich.table import Table from .progressbar import Progressbar from .netconf import Netconf from .configs import Configs from .deploy import Deploy from .status import Status from .undeploy import Undeploy class Thousandeyes: """ Class for Deploy a...
# # Copyright (c) 2017 SnappyData, 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...
import sys from string import ascii_uppercase letters = ['-'] + list(ascii_uppercase) for letter in sys.stdin: letter = letter.strip() print(letters.index(letter))
import numpy as np from numpy import sqrt as sqrt from numpy import cos as cos from numpy import sin as sin import matplotlib.pyplot as plt from matplotlib import cm as cm from matplotlib.ticker import LinearLocator as LinearLocator from matplotlib.ticker import FormatStrFormatter as FormatStrFormatter from numpy.fft i...
# read csv to model import tensorflow as tf import numpy as np import os def read_csv(batch_size, file_name, record_defaults=1): fileName_queue=tf.train.string_input_producer(os.path.dirname(__file__)+"/"+file_name) reader = tf.TextLineReader(skip_header_lines=1) key, value=reader.read(fileName_queue,name...
#!/usr/bin/env python # -*- coding: utf-8 -*- try: from setuptools import setup except ImportError: from distutils.core import setup with open('README.rst') as readme_file: readme = readme_file.read() with open('HISTORY.rst') as history_file: history = history_file.read().replace('.. :changelog:', ...
"""Implement applet loading, possibly asynchronous.""" import os import regex import string import urllib import urlparse from Tkinter import * from BaseReader import BaseReader from Bastion import Bastion # Pattern for valid CODE attribute; group(2) extracts module name codeprog = regex.compile('^\(.*/\)?\([_a-zA-Z...
""" Consensus Algorithm for 3 Mobile robots using MLP Model Cyclic Graph Implementation Scene: Robot 1, Robot 2, Robot 3 Inputs: Mx, My, Phix, Phiy Outputs: Ux, Uy """ import torch import MLP_Model import math import numpy as np import rclpy from rclpy.node import Node from tf2_msgs.msg import TFMessage from std_ms...
"""This package contains a collection of Mutagens. A Mutagen is a class that takes an input and generates an output. Typically the output has been mutated in some way from the input's original form. """
# Copyright (c) 2017-2020 Sony Corporation. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
import sys from pathlib import Path sys.path.insert(1, str(Path.cwd())) from GoBoard import Board from GoRandomPlayer import GoRandomPlayer from GoQLearner import GoQLearner from AlphaBeta import AlphaBeta from tqdm import tqdm #from PerfectPlayer import PerfectPlayer #from SmartPlayer import SmartPlayer PLAYER_BLAC...
import zipfile from os import listdir from os.path import isfile, join, splitext import concurrent.futures def unzip_file(file): try: print(f'Unzinping file: {file}') with zipfile.ZipFile(file, 'r') as zip_ref: zip_ref.extractall(splitext(file)[0]) return {'status':'OK', 'file...
# 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 abc import ABCMeta, abstractmethod class AbstractClient(metaclass=ABCMeta): @abstractmethod def connect(self): pass @abstractmethod def get(self, table_name, key): pass @abstractmethod def set(self, table_name, data): pass @abstractmethod def update(self...
# Generated by Django 3.1.6 on 2021-02-18 15:46 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('travelapp', '0011_auto_20210218_1837'), ] operations = [ migrations.AddField( model_name='trip', name='subbed', ...
"""scratch URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.0/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based...
import tempfile import os from PIL import Image from django.contrib.auth import get_user_model from django.test import TestCase from django.urls import reverse from rest_framework import status from rest_framework.test import APIClient from core.models import Recipe, Tag, Ingredient from recipe.serializers import ...
import os, sys sys.path.insert(0, os.path.abspath("..")) import pandas as pd import pytest import pycaret.datasets import pycaret.internal.preprocess def test(): # loading dataset data = pycaret.datasets.get_data("juice") target = "Purchase" # preprocess all in one pipe = pycaret.internal.preproc...
def add(a,b): return a+b def subtract(a,b): return a-b def multiply(a,b): return a*b def divide(a,b): try: return a/b except ZeroDivisionError: return "Zero Division Error" print("Select Operation") print("1.Add") print("2.Subtract") print("3.Multiply") print("4.Divide") choice = input("E...
""" WSGI config for admin project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application from dotenv import load_dotenv, find_...
# LyricsGenius # Copyright 2018 John W. Miller # See LICENSE for details. import sys import re from os import path from setuptools import find_packages, setup assert sys.version_info[0] == 3, "LyricsGenius requires Python 3." VERSIONFILE = "lyricsgenius/__init__.py" ver_file = open(VERSIONFILE, "rt").read() VSRE = r...
"""URLs for the Flexible Subscriptions app.""" # pylint: disable=line-too-long import importlib from django.conf.urls import url from . import views from .conf import SETTINGS # Retrieve the proper subscribe view SubscribeView = getattr( # pylint: disable=invalid-name importlib.import_module(SETTINGS['subscribe_...
from abc import abstractmethod, ABCMeta from collections import namedtuple from cairo import SolidPattern from zorro.di import has_dependencies, dependency from .bar import Bar from tilenol.theme import Theme @has_dependencies class Widget(metaclass=ABCMeta): bar = dependency(Bar, 'bar') stretched = False ...
# coding=utf-8 r""" This code was generated by \ / _ _ _| _ _ | (_)\/(_)(_|\/| |(/_ v1.0.0 / / """ from tests import IntegrationTestCase from tests.holodeck import Request from twilio.base.exceptions import TwilioException from twilio.http.response import Response class CountryTestCase(Integrati...
# ============================================================================= # # Main file for CellProfiler-Analyst # # ============================================================================= import sys import os import os.path import logging from cpa.dimensionreduction import DimensionReduction from cpa...
"""Trace support for automation.""" from __future__ import annotations from contextlib import contextmanager from typing import Any from homeassistant.components.trace import ActionTrace, async_store_trace from homeassistant.components.trace.const import CONF_STORED_TRACES from homeassistant.core import Context from...
import asyncio from collections import defaultdict import os import random import time import ray import ray.cloudpickle as pickle from ray.serve.backend_worker import create_backend_worker from ray.serve.constants import (ASYNC_CONCURRENCY, SERVE_ROUTER_NAME, SERVE_PROXY_NAME, SERVE_M...
#!/usr/bin/env python # encoding: utf-8 ''' @file: yolo2coco.py @author: wangjianong @time: 2020/2/21 16:04 @desc:yolo格式转coco ''' import os import cv2 import os import mmcv import random import tqdm from PIL import Image import re import datetime #data format must be:r #yolo: label_id(start from 0) xc yc w h #custom...
""" Copyright (c) Facebook, Inc. and its affiliates. """ """This file has functions to implement different dances for the agent. """ import time import math from .tasks import Move, Dance konami_dance = [ {"translate": (0, 1, 0)}, {"translate": (0, 1, 0)}, {"translate": (0, -1, 0)}, {"translate": (0,...
############################################################################### # _*_ coding: utf-8 # # Tests for XlsxWriter. # # Copyright (c), 2013-2020, John McNamara, jmcnamara@cpan.org # from __future__ import unicode_literals from ..excel_comparsion_test import ExcelComparisonTest from ...workbook import Workbook...
# rawmanifest.py # # Copyright 2013-2016 Facebook, Inc. # # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. """Output (a subset of) the manifest as a bser serialisation Outputs raw manifest data The manifest can be updated with the c...
from django_ontruck.notifiers import AsyncNotifier, Notifier from ..test_app.notifiers import DummySMSNotifier def test_sms_notifier(mocker): notifier = DummySMSNotifier(phone_number='123', delayed=False) assert isinstance(notifier, Notifier) notifier.send() def test_sms_async_notifier(mocker): not...
#!/usr/bin/env python # coding: utf-8 """ The Clear BSD License Copyright (c) – 2016, NetApp, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are met...
from setuptools import setup from codecs import open from os import path here = path.abspath(path.dirname(__file__)) with open(path.join(here, 'README.rst'), encoding='utf-8') as f: long_description = f.read() setup(name='robin_stocks_sun', version='0.9.8.8', description='A Python wrapper around the...
""" Tests for the git module. Author: Tom Fleet Created: 19/06/2021 """ import shutil import subprocess from pathlib import Path import pytest from pytest_mock import MockerFixture from pytoil.exceptions import GitNotInstalledError from pytoil.git import Git def test_git_instanciation_default(): git = Git() ...
# coding: utf-8 """该工具用于生成sqlite3测试数据 用法: gf_test_data 在当前目录下生成数据文件 gf_test_data -f /file/data 在指定目录下生成测试数据 """ import os import sys import sqlite3 import os.path import argparse from girlfriend.util.script import show_msg_and_exit CREATE_USER_TABLE = """ create table user ( id integer primary key not nul...
import sys sys.path.append("..") from CGPython import CodeGenerationTransformer from CGPython.Commands import ModifyMethodCommand from ast import ClassDef, FunctionDef, Name class TrueStaticTransformer(CodeGenerationTransformer): def Transform(self): def func(cmd:ModifyMethodCommand, name:str): return cmd.Decora...
from django.db import models # Create your models here. class Post(models.Model): title=models.CharField(max_length=120,null=True,blank=True) desc = models.CharField(max_length=250,null=True,blank=True)
#!/usr/bin/python # # Copyright 2017 Adam Witt # # 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...
"""Functionality shared between bytes/bytearray/unicode""" from rpython.rlib import jit from rpython.rlib.objectmodel import specialize, newlist_hint from rpython.rlib.rarithmetic import ovfcheck from rpython.rlib.rstring import ( find, rfind, count, endswith, replace, rsplit, split, startswith) from pypy.interpre...
import sys from datetime import datetime import re def print_usage(name): print("python3 {} <input_file>".format(name)) def find_most_asleep(notes): print("finding most asleep time...") sleeping_minutes = {} sleepiest_guard = {} guard_id = 0 asleep_time = 0 wake_time = 0 for tim...
## @file # process FFS generation from FILE statement # # Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR> # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text o...
model = dict( type='HybridTaskCascade', # pretrained='open-mmlab://resnext101_64x4d', backbone=dict( type='ResNeXt', depth=101, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, norm_cfg=dict(type='BN', requires_grad=True), norm_eval=True, ...
import datetime from taxi.timesheet import Entry from . import create_timesheet def test_to_lines_returns_all_lines(): contents = """10.10.2012 foo 09:00-10:00 baz bar -11:00 foobar""" t = create_timesheet(contents, True) lines = t.entries.to_lines() assert lines == ['10.10.2012', 'foo 09:00-1...
# 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 under t...
""" Copyright 2018-2020 National Geographic Society Use of this software does not constitute endorsement by National Geographic Society (NGS). The NGS name and NGS logo may not be used for any purpose without written permission from NGS. Licensed under the Apache License, Version 2.0 (the "License"); you ma...
""" Insert minion return data into a sqlite3 database :maintainer: Mickey Malone <mickey.malone@gmail.com> :maturity: New :depends: None :platform: All Sqlite3 is a serverless database that lives in a single file. In order to use this returner the database file must exist, have the appropriate sche...
import argparse import os.path from .defaults import get_default_config from ..utils import config_filename, experiment_subdir, weight_best_filename def _load_previous_experiment(config, exp_id, exp_log_dir): """ """ exp_log_dir = exp_log_dir if exp_log_dir else config.LOG_ROOT exp_subdir = experimen...
import math import time t1 = time.time() def digt(num): n = num digt = 0 while n > 0: digt += n%10 n = n//10 return digt temp = [] for i in range(2,200): for j in range(2,50-i//10): t = round(math.pow(i,j)) if digt(t) == i: temp.append(t) def quickSor...
""" Compatibility layer for Python 3/Python 2 single codebase """ import sys import hashlib from distutils.version import LooseVersion import nibabel if sys.version_info[0] == 3: import pickle import io import urllib from base64 import encodebytes _encodebytes = encodebytes _basestring = st...
from fake import BadPath assert(BadPath) # pragma: no cover
import time import os import requests from threading import Timer class TenvisTH661: def __init__(self, ip, username, password): self.ip = ip self.username = username self.password = password def pan_left(self, time=1.0): return self.move('left', time) def pan_right(self, time=1.0): retur...
#!/usr/bin/env python # # Use the raw transactions API to spend monetas received on particular addresses, # and send any change back to that same address. # # Example usage: # spendfrom.py # Lists available funds # spendfrom.py --from=ADDRESS --to=ADDRESS --amount=11.00 # # Assumes it will talk to a monetad or Monet...
__author__ = 'sarangis' from src.ir.exceptions import * from src.ir.validator import * from src.ir.instructions import Instruction, BasicBlock class Global: def __init__(self, name, initializer): self.__name = name self.__initializer = initializer @property def name(self): return...
from typing import Dict from starkware.cairo.lang.compiler.identifier_definition import ( IdentifierDefinition, MemberDefinition, OffsetReferenceDefinition, ReferenceDefinition) from starkware.cairo.lang.compiler.identifier_manager import ( IdentifierManager, IdentifierSearchResult) from starkware.cairo.lang.c...
from .register import * from .schedulers import * from .optimizers import * from .backbones import *
import pytest from datastructures import LinkedList @pytest.fixture def linked_list(): return LinkedList() def test_linked_list_size_is_initially_zero(linked_list): assert len(linked_list) == 0 def test_append_item_to_linked_list(linked_list): linked_list.append(1) assert len(linked_list) == 1 ...
import os from lib import shellcode def clone_source_files(): # move the source files of the beacon over # to the build directory # put us in the correct dir (this obviously needs to be inside docker) os.chdir("/root/shad0w/beacon") # why reinvent the wheel? lets jus use cp os.popen("cp src/...
import torch from torch import nn from torch.autograd import Variable class PairWise(nn.Module): def __init__( self, margin=1 ): super(PairWise, self).__init__() self.tanh = nn.Tanh() self.loss_fct = nn.MarginRankingLoss( margin=margin, reductio...
__author__ = 'Vishal' import os import shutil def copy_files(): current_dir = "" # Enter the path of the directory, from where you want to copy, here. destination_dir = "" # Enter the path of your destination directory. extensions = () # Enter the extensions of the files you want to copy. os.chdi...
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ Tests for L{twisted.internet.kqueuereactor}. """ import errno from zope.interface import implementer from twisted.trial.unittest import TestCase try: from twisted.internet.kqreactor import KQueueReactor, _IKQueue kqueueSkip = None...
from django.test import TestCase from django.template import loader, base import oscar class TestOscarCoreAppsList(TestCase): def test_includes_oscar_itself(self): core_apps = oscar.OSCAR_CORE_APPS self.assertTrue('oscar' in core_apps) def test_can_be_retrieved_through_fn(self): cor...
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Runs minion floscript ''' # pylint: skip-file import os import stat from ioflo.base.odicting import odict from ioflo.base.consoling import getConsole console = getConsole() import salt.daemons.flo FLO_DIR_PATH = os.path.join( os.path.dirname(os.path.dirname(os.p...
import os import base64 from nose.tools import istest, assert_equal import spur import tempman from .testing import test_path _local = spur.LocalShell() @istest def html_is_printed_to_stdout_if_output_file_is_not_set(): docx_path = test_path("single-paragraph.docx") result = _local.run(["mammoth", docx_pat...
''' https://www.geeksforgeeks.org/write-a-c-program-to-find-the-maximum-depth-or-height-of-a-tree/ https://practice.geeksforgeeks.org/problems/height-of-binary-tree/1 Height of Binary Tree Medium Accuracy: 65.76% Submissions: 100k+ Points: 4 Given a binary tree, find its height. Example 1: Input: 1 / \ ...
# Controll class to work with Flowmon API from core.FlowmonDDD import FlowmonDDD class ControllDDD: def __init__(self, app, master, slave, func, db, first): self.app = app self.first = first self.master = master self.slave = slave self.func = func self.db = db ...
import unittest from deploy import Unit class TestUnit(unittest.TestCase): def test_create(self): i = Unit('foo', 'inactive', 'spawn') self.assertEqual(i.__str__(), 'foo') self.assertEqual(i.name, 'foo') self.assertEqual(i.state, 'inactive') self.assertEqual(i.required_a...
import logging from awsgen.applications.profile import ProfileApp class ListProfiles(object): log = logging.getLogger(__name__) def __init__(self, parser=None): pass def action(self, args): ProfileApp().list()
""" Layout landscape PDF in 2 columns 5 rows (intended to print as a bisuness card) It won't work now and I think it should be rewrited, see 25up.pdf """ import sys import getopt from PyPDF2 import PdfFileWriter, PdfFileReader def main(argv): size = (91, 55) margin = (14, 11) padding = (5, 5, 5, 5) ou...
#!/usr/bin/env python """Tests for synonym.""" import unittest from synonym import synonym class SynonymTestCase(unittest.TestCase): def return_synonym(self, query): parser = synonym.get_parser() args = vars(parser.parse_args(query.split(' '))) return synonym.synonym(args) def setU...
import time import Queue import threading from contextlib import contextmanager from kivy.utils import platform from kivy.event import EventDispatcher from kivy.properties import (StringProperty, ObjectProperty) from kivy.clock import Clock, mainthread from ristomele.logger import Logger from ristomele.gui.error import...
#!/usr/bin/env python # See the explanation in # The key is, for d[n], if it's boundary # it stores the longest consecutive numbers. # whenever a new n inserted, the boundary which d[n] is in will be updated class Solution: def longestConsecutive(self, nums) -> int: from collections import defaultdict ...
import urllib.request import datetime import argparse import json import sqlite3 import os.path # --url=192.168.0.58 --method=OutdoorTemperature def get_page(path, sub_path): complete_url = 'http://' + path + '/' + sub_path with urllib.request.urlopen(complete_url) as response: full_response = respo...
# Generated by Django 2.2.16 on 2020-12-03 09:42 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('order', '0012_auto_20201203_1452'), ] operations = [ migrations.AddField( model_name='order', name='order_date', ...
#!/usr/bin/python # Copyright 2015 Oliver Kahrmann / Team I/O # 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 applicabl...
"""Оптимизатор портфеля.""" import numpy as np import pandas as pd from scipy import stats from poptimizer import config from poptimizer.portfolio import metrics from poptimizer.portfolio.portfolio import CASH, Portfolio class Optimizer: """Предлагает сделки для улучшения метрики портфеля.""" def __init__(s...
# coding:utf-8 # TODO: We should pass a read-only view of the cgroup instead to ensure # thread-safety. class RestartRequestedMessage(object): def __init__(self, cg): self.cg = cg class RestartCompleteMessage(object): def __init__(self, cg): self.cg = cg
# -*- 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...
""" WSGI config for personal_gallery project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJA...
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Tests for model evaluation. Compare the results of some models with other programs. """ # pylint: disable=invalid-name, no-member import pytest import numpy as np from numpy.testing import assert_allclose, assert_equal from astropy import units as u...
# 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...
""" Algorithms for finding k-edge-connected components and subgraphs. A k-edge-connected component (k-edge-cc) is a maximal set of nodes in G, such that all pairs of node have an edge-connectivity of at least k. A k-edge-connected subgraph (k-edge-subgraph) is a maximal set of nodes in G, such that the subgraph of G ...