text
stringlengths
1
927k
from easydict import EasyDict as edict # make training faster # our RAM is 256G # mount -t tmpfs -o size=140G tmpfs /train_tmp config = edict() config.margin_list = (1.0, 0.0, 0.4) config.network = "r100" config.resume = False config.output = None config.embedding_size = 512 config.sample_rate = 0.2 config.fp16 = Tr...
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ Interfaces for Trial. Maintainer: Jonathan Lange """ import zope.interface as zi class ITestCase(zi.Interface): """ The interface that a test case must implement in order to be used in Trial. """ failureException = zi.Att...
import textwrap import pytest from radon.visitors import HalsteadVisitor dedent = lambda code: textwrap.dedent(code).strip() SIMPLE_BLOCKS = [ (''' if a and b: pass ''', (1, 2, 1, 2)), (''' if a and b: pass elif b or c: pass ''', (2, 4, 2, 3)), (''' if a and b: pass ...
""" FactSet Ownership API No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ import io import json import logging import re import ssl fro...
""" Test require hardware breakpoints. """ import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil from functionalities.breakpoint.hardware_breakpoints.base import * class BreakpointLocationsTestCase(HardwareBreakpointTestBase): mydir = TestB...
############################################################################### # # Tests for XlsxWriter. # # Copyright (c), 2013-2021, John McNamara, jmcnamara@cpan.org # import unittest from io import StringIO from ...vml import Vml class TestWriteXColumn(unittest.TestCase): """ Test the Vml _write_column(...
import operator import os import queue import sys import textwrap import py import _pytest import pytest from _pytest._code.code import ExceptionChainRepr from _pytest._code.code import ExceptionInfo from _pytest._code.code import FormattedExcinfo try: import importlib except ImportError: invalidate_import_...
# 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 ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2019 Hiroshi Murayama <opiopan@gmail.com> import operator import gerber.excellon from gerber.excellon import ExcellonParser, detect_excellon_format, ExcellonFile, DrillHit, DrillSlot from gerber.excellon_statements import ExcellonStatement, UnitStmt, Coordina...
# -*- coding: utf-8 -*- from config import DATABASE_URL from tortoise import Tortoise, fields from tortoise.models import Model # init db function async def init(): await Tortoise.init( db_url=DATABASE_URL, modules={'models': ['modules.db']} ) await Tortoise.generate_schemas() # server m...
## @file ## @brief Monitoring system from metaL import * from dja import * ## @defgroup mony mony ## @brief Monitoring system ## @ingroup dja ## @{ MODULE = djModule() TITLE = Title('Monitoring System') MODULE['TITLE'] = TITLE ABOUT = """ Django-based (meta)project targets on building IT/sensor/IIoT monitoring sys...
# Modified by Chen Wu (chen.wu@icrar.org) from fast_rcnn.config import cfg, get_output_dir import argparse from utils.timer import Timer import numpy as np import cv2 from utils.cython_nms import nms, nms_new from utils.boxes_grid import get_boxes_grid from utils.project_bbox import project_bbox_inv import pickle impo...
import contextlib import importlib import itertools import json import operator import os import site import sys from pathlib import Path from sysconfig import get_paths, get_python_version import pkg_resources import pipenv from pipenv.environments import is_type_checking from pipenv.utils import make_posix, normal...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import ckeditor.fields import django.utils.timezone from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL),...
# Copyright 2018 Owkin, inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from pathlib import Path from typing import Optional from lisa import ( LisaException, Logger, PassedException, RemoteNode, SkippedException, TestCaseMetadata, TestSuite, TestSuiteMetadata, create_timer, s...
""" Contains all of the generic CRUD endpoints that can be generated programmatically for each resource. """ from typing import Dict, List from loguru import logger as log from sqlalchemy import update as _update, delete as _delete from sqlalchemy.future import select from sqlalchemy.dialects.postgresql import Insert ...
# Copyright (c) 2011 X.commerce, a business unit of eBay Inc. # Copyright 2011 Eldar Nugaev # 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://...
import argparse import os import random import yaml import time import logging import pprint import scipy.stats as stats import torch.backends.cudnn as cudnn import torch.optim as optim import torchvision.utils as vutils import numpy as np from torch.utils.tensorboard import SummaryWriter from torch.autograd import gr...
import datetime s = datetime.date.today().year s = int(s) print('\033[1;33;44m',20*'-=','\033[m') print('\033[1;34;43m',' FORÇAS ARMADAS DO BRASIL ','\033[m') print('\033[1;33;44m',20*'-=','\033[m') n = int(input('Qual seu ano de nascimento jovem? ')) i = s - n p = n + 18 if i < 18: print(f'Você tem {...
def isUnique(word): letter=[-1 for i in range(26)] for char in word: if(letter[ord(char)%26]==-1): letter[ord(char)%26]=1 else: return False return True print(isUnique("hello\n")) print(isUnique("abcdefg"))
class SQLConfig: host = '10.145.83.34' port = 49162 db = 'unno' username = 'root' pw = 'lxit' class ServiceConfig: backend_endpoint = 'http://10.145.83.34:8899' result_api = 'http://10.145.83.34:5011/api/v1/annotation' class MinioConfig: host = '10.145.83.34:9000' username = 'unn...
from functools import reduce from base64 import b64encode, b64decode from binascii import a2b_hex from Crypto.Cipher import AES from base import Component class Crypto(Component): KEY_SIZE = 32 def encrypt(self, key, data): data = self.__pad(data) key = self.__merge(key) iv = a2b_hex...
#!/usr/bin/env python """Demo imptee for chapter 12.""" foo = 'abc' def show(): """Simple importee demo.""" print 'foo from importee:', foo
# Burgers test evolution: just one import numpy from models import burgers from bcs import outflow from simulation import simulation from methods import weno3_upwind from rk import rk3, imex222 from grid import grid from matplotlib import pyplot Ngz = 3 Npoints = 200 tau = 0.05 beta = 0.8 L = 1 interval = grid([-L, L...
# Copyright 2015 Bob Callaway. 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 agr...
# Lint as: python3 # Copyright 2020, The TensorFlow Federated Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required ...
# -*- coding: utf-8 -*- ### # (C) Copyright [2020] 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 #...
from .accuracy import * from .sce import *
# Copyright (c) 2013 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 agreed to in writ...
# coding: utf-8 """Python data types for IB Flex format XML data. These class definitions are introspected by ibflex.parser to type-convert IB data. They're dataclasses, made immutable by passing `Frozen=True` to the class decorator. Class attributes are annotated with PEP 484 type hints. Except for the top-level ...
""" cTivoTelnetControl - a solution for controlling a TiVo over the internet Converts a single key press into a command for a TiVo box Charles Machalow - MIT License """ import telnetlib #for telnet connection import sys #for args import getch #local file for getch in Windows and Unix import socket #f...
import pandas, hashlib from util import DataSetting class SHA256(DataSetting): """ | 암호화 기술 중 단방향 암호화(SHA-256)를 구현한 클래스 | 모든 메소드는 생성자에 원본 데이터를 인자 값으로 넣으면 원본 데이터를 수정한다. Args: datas (pandas.DataFrame) : 단방향 암호화(SHA-256)를 적용할 DataFrame 지정 """ def run(self, column: str): """ ...
""" Atomic orbital model - the electron cloud. See: https://en.wikipedia.org/wiki/Atomic_orbital https://en.wikipedia.org/wiki/Ionization Package: RoadNarrows elemenpy package. File: electroncloud.py Link: https://github.com/roadnarrows-robotics/ Copyright: (c) 2019. RoadNarrows LLC http://www.roadna...
from django.contrib import admin # Register your models here. from .models import OAuthUser, OAuthConfig from django.urls import reverse from django.utils.html import format_html import logging logger = logging.getLogger(__name__) class OAuthUserAdmin(admin.ModelAdmin): search_fields = ('nikename', 'email') ...
"""my_gettext.py The usual pattern when using gettext is to surround strings to be translated by a call to a function named _, as in _("This string should be translated.") This is done when having gettext "install" a given language: it adds a function named _ to the global builtins. However, this can fail if som...
#!/usr/bin/env python """ Script to wait for an open GPU, then to run the job. Use with `tsp` (task-spooler) for a common workflow, by queuing a job that looks for a GPU and then runs the actual job. Make this executable: chmod +x allocate.py This stacks jobs on a single GPU if memory is available and the other p...
# coding: utf-8 """ Kubernetes No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: v1.14.4 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from pprint import pformat from six import iteritems import re...
from os.path import isfile from sqlite3 import connect from apscheduler.triggers.cron import CronTrigger DB_PATH = "./data/db/database.db" BUILD_PATH = "./data/db/build.sql" cxn = connect(DB_PATH, check_same_thread=False) cur = cxn.cursor() def with_commit(func): def inner(*args, **kwargs): func(*args, **kwargs...
import torch import torch.nn as nn import torch.backends.cudnn as cudnn import torch.optim import torch.utils.data as data import torchvision import numpy as np import cv2 import random import net import numpy from torchvision import transforms from utils import * import matplotlib.image as img def init_weights(m): ...
""" From https://stackoverflow.com/questions/62265351/measuring-f1-score-for-multiclass-classification-natively-in-pytorch with this modification https://stackoverflow.com/questions/62265351/measuring-f1-score-for-multiclass-classification-natively-in-pytorch#comment122867942_63358412 """ from typing import Tuple impo...
# -*- coding: utf-8 -*- """ Created on Thu Mar 17 20:42:44 2022 @author: Nicolas Pelletier-Côté """ from PyQt5 import QtWidgets from PyQt5.QtWidgets import QApplication, QMainWindow, QWidget from PyQt5.QtGui import QFont, QPixmap # import time # import sys SCREEN_WIDTH = 1920 SCREEN_HEIGTH = 1080 class StopMenu(QWi...
import sys import time import boto3 import json import logging from botocore.exceptions import ClientError from cfn_resource_provider import ResourceProvider logger = logging.getLogger() class CertificateProvider(ResourceProvider): """ A Custom CertificateManager Certificate provider for use with DNS valida...
x1 = float(input()) y1 = float(input()) x2 = float(input()) y2 = float(input()) width = max(x1, x2) - min(x1, x2) height = max(y1, y2) - min(y1, y2) print(width * height) print(2 * (width + height))
import os from setuptools import setup def read(fname): with open(os.path.join(os.path.dirname(__file__), fname)) as f: return f.read() setup( name='nasa-wildfires', version='0.0.5', description="Download wildfire data from NASA satellites", long_description=read('README.md'), long_d...
import logging import random import re import sys from flask_restx import Namespace, Resource, errors, fields, reqparse from repository import Superheroes, db api = Namespace("superheroes", description="Api for working with Superheroes") superhero_model = api.model( "Superhero", { "id": fields.Inte...
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # # Copyright 2018-2019 Fetch.AI Limited # # 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 ...
from .statement import Statement from .signature import Signature
# uncompyle6 version 2.9.10 # Python bytecode 2.7 (62211) # Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10) # [GCC 6.2.0 20161005] # Embedded file name: ScriptBinding.py """Extension to execute code outside the Python shell window. This adds the following commands: - Check module does a full syntax ...
#!/usr/bin/env python import sys from absl import app from absl import flags from agents import * import ppaquette_gym_super_mario FLAGS = flags.FLAGS flags.DEFINE_string("env", "ppaquette/SuperMarioBros-1-1-v0", "RL environment to train.") flags.DEFINE_string("agent", "a2c", "RL algorithm to use.") def _main(unu...
import getpass import os import platform import re import time import astropy.io.fits as fits import astropy.units as units import matplotlib.pyplot as plt import numpy as np import scipy.interpolate import scipy.ndimage try: import synphot _HAS_SYNPHOT = True except ImportError: synphot = None _HAS_SY...
import urllib.request,json # from .models import News,Article # Getting api key api_key = None # Getting the movie base url base_url = None article_url = None def configure_request(app): # global api_key,base_url,article_url # api_key = app.config['NEWS_API_KEY'] # base_url = app.config['NEWS_API_BASE_URL...
""" An example module for the homework (hint 1: you can read this comment using: `homeworkmodule.__doc__`) """ def func1(param1: int, param2: dict[str, int]): """ This function has two parameters (hint 2: you can read this comment using: `homeworkmodule.func1.__doc__`) (hint 3: you can read the annota...
# Copyright (c) 2017 VMware, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
# 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...
from django.db import models class BookManager(models.Manager): pass
# coding: utf-8 """Module for converting PIB PET of ADNI.""" def convert_adni_pib_pet( source_dir, csv_dir, dest_dir, conversion_dir, subjs_list=None, mod_to_update=False ): """Convert PIB PET images of ADNI into BIDS format. Args: source_dir: path to the ADNI directory csv_dir: path to ...
import re import sys import copy import types import inspect import keyword import builtins import functools import _thread __all__ = ['dataclass', 'field', 'Field', 'FrozenInstanceError', 'InitVar', 'MISSING', # Helper functions. 'fields',...
import subprocess import sys import setup_util import os root = os.getcwd() + "/nancy" app = root + "/src" def start(args, logfile, errfile): if os.name == 'nt': return 1 setup_util.replace_text(app + "/Web.config", "localhost", args.database_host) try: # build subprocess.check_call("rm -rf bin ...
""" mbed SDK Copyright (c) 2011-2016 ARM Limited Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in wr...
from a10sdk.common.A10BaseClass import A10BaseClass class Stats(A10BaseClass): """This class does not support CRUD Operations please use parent. :param recv_client_command_RCPT: {"description": "Recv client RCPT", "format": "counter", "type": "number", "oid": "23", "optional": true, "size": "8"} :pa...
from js_analyzer import JsMethod import logging log = logging.getLogger('JsClass') class JsClass: def __init__(self, data: object): self.name = data.id.name log.info('Found class %s' % self.name) self.methods = [] log.debug('Searching for methods...') self.find_methods(dat...
import os import pandas import numpy as np import argparse from deep_disfluency.load.load import load_word_rep, load_tags from feature_utils import load_data_from_disfluency_corpus_file from feature_utils import load_data_from_corpus_file from feature_utils import sort_into_dialogue_speakers def open_with_pandas_rea...
from pydbus import SystemBus from xml.etree import ElementTree as ET from . import error as bzerror from .bzutils import ORG_BLUEZ, BluezInterfaceObject import logging class BluezObjectManager(object): bus = SystemBus() logger = logging.getLogger(__name__) logging.basicConfig() logger.setLevel(loggin...
from django.views.generic.base import View from django.contrib.auth.mixins import LoginRequiredMixin from baseproject.settings import API_URL class BaseViewClass(LoginRequiredMixin, View): login_url = '/account/login/' logout_url = '/' api_url = API_URL headers = {'Content-Type': 'application/json; ...
# -*- coding: utf-8 -*- from pysqlite2 import dbapi2 as sqlite # データベースに接続(作成) con = sqlite.connect('test1.db') # テーブルの列要素: 名前、性別(male or female)、年齢 con.execute('CREATE TABLE people (name TEXT, sex TEXT, age INTEGER)') # テストデータの挿入(1行はタプルで) con.execute('INSERT INTO people VALUES ("Taro", "male", 22)') con.execute('INS...
"""Logging ========== A logger instance (variable :code:`logger`). """ import logging import os def create_handler(width=None): try: from rich.console import Console from rich.logging import RichHandler console = Console(width=width, stderr=True) return RichHandler(console=conso...
# Copyright 2017 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 applicab...
''' Author: Prakhar Mishra Date: 9/01/2016 ''' # Importing Packages import sys from tweepy.streaming import StreamListener from tweepy import OAuthHandler from tweepy import Stream from kafka import KafkaClient from kafka import SimpleProducer from kafka import SimpleConsumer # Twitter Credentials atoken = "<...
import sys import pytest import salt.proxy.restconf as restconf from tests.support.mock import patch @pytest.fixture def configure_loader_modules(): return {restconf: {}} @pytest.fixture def patch_conn_args(): with patch.dict( restconf.restconf_device, { "conn_args": { ...
# In-Process # Imports import discord import random from discord.ext import commands #Config from config import * class VoteMsg(commands.Cog): def __init__(self, bot): self.bot = bot self.vote_tracking_bot_id = 702134514637340702 self.vote_scraping_channel_id = VOTE_SCRAPING_CHANNEL ...
# Generated by Django 3.2.11 on 2022-03-09 20:54 from django.db import migrations import poc_django_stripe.users.managers class Migration(migrations.Migration): dependencies = [ ('users', '0003_alter_user_id'), ] operations = [ migrations.AlterModelManagers( name='user', ...
#!/usr/bin/env python """Downloads a prebuilt gn binary to a place where gn.py can find it.""" from __future__ import print_function import io import os try: # In Python 3, we need the module urllib.reqest. In Python 2, this # functionality was in the urllib2 module. from urllib import request as urllib_r...
from __future__ import unicode_literals import boto import sure # noqa from moto import mock_ec2_deprecated @mock_ec2_deprecated def test_virtual_private_gateways(): conn = boto.connect_vpc("the_key", "the_secret") vpn_gateway = conn.create_vpn_gateway("ipsec.1", "us-east-1a") vpn_gateway.should_not.be...
from node.myownp2pn import MyOwnPeer2PeerNode from lib.settings import the_settings def ndstart(port): node = MyOwnPeer2PeerNode("",port) node.debug = the_settings().debug_mode() node.start() def ndstop(): MyOwnPeer2PeerNode.main_node.stop() def ndconnect(ip,port): MyOwnPeer2PeerNode.main_no...
#!/usr/bin/env python # # Copyright 2016 BMC Software, 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 applicabl...
# Copyright 2019 Extreme Networks, 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 i...
from django.conf.urls import url from django.contrib import admin from . import views urlpatterns = [ # 构造一个qq登录的跳转路径 url(r'^qq/login/$', views.QQLoginView.as_view()), # qq跳转路由匹配 url(r'^oauth_callback/$',views.QQCallBackView.as_view()) ]
import os import shutil import subprocess import urllib2 def installmongo(): mongofileroot = "mongodb-linux-x86_64-3.2.8" mongofile = "{}.tgz".format(mongofileroot) mongodir = "mongodb" if os.path.exists(mongofile): os.remove(mongofile) if os.path.exists(mongodir): shutil.rmtree(mo...
#!/usr/bin/env python import unittest import numpy import ctf import os import sys def allclose(a, b): return abs(ctf.to_nparray(a) - ctf.to_nparray(b)).sum() < 1e-14 class KnowValues(unittest.TestCase): def test_partition(self): AA = ctf.tensor((4,4),sym=[ctf.SYM.SY,ctf.SYM.NS]) AA.fill_ran...
''' AnyChange event handler Generates occupancy event on any change to the item ''' from core.log import logging, LOG_PREFIX log = logging.getLogger("{}.item_event_anychange".format(LOG_PREFIX)) import personal.occupancy.areas.events.event_base reload (personal.occupancy.areas.events.event_base) from personal.occ...
#!/usr/bin/python3 #https://practice.geeksforgeeks.org/problems/stepping-numberswrong-output/0 def bfs(x, n, res): """ The stepping number is generated from existing stepping numbers for ex: 1 generates 12, 10 2 generates 21, 23 """ q = [] q.append(x) while q: p = q.p...
from .processed import *
# Collaborators (including web sites where you got help: (enter none if you didn't need help) # # Read temps.txt and print it without the blank line at the end with open ('temps.txt') as file_object: contents = file_object.read() print(contents.rstrip()) # Read temps.txt line by line and print with no whitespac...
""" CryptoAPIs Crypto APIs 2.0 is a complex and innovative infrastructure layer that radically simplifies the development of any Blockchain and Crypto related applications. Organized around REST, Crypto APIs 2.0 can assist both novice Bitcoin/Ethereum enthusiasts and crypto experts with the development of thei...
""" Module contenant les classes utiles à la simulation : Intersection, Route, Circulation et Reseau auteur : cmarichal """ from classes_graphes import * from typing import Tuple from random import choice, randrange from dijkstra import Dijkstra_Astar import fonctions_utilitaires class Intersection(Sommet): """So...
from __future__ import absolute_import import re class MessageTranslator(object): messages = {} def __init__(self): self.compiled_messages = dict([(m, re.compile(m)) for m in self.messages]) def translate_messages(self, messages): return [self.translate_message(m) for m in messages] ...
def get_dataset_split_name(im_file): parts = im_file.split("/") for p in parts[::-1]: if p in ['train', 'val', 'test']: return p return None
# coding: utf-8 # Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c...
# 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 ...
# -*- coding: utf-8 -*- # # Copyright (c) 2021 Jason Engman <jengman@testtech-solutions.com> # Copyright (c) 2021 Adam Solchenberger <asolchenberger@gmail.com> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal...
from util import read_puzzle_input def _parse_instruction(instruction_line): operation, argument = instruction_line.split() return ( operation, int(argument[1:]) if argument[0] == "+" else -1 * int(argument[1:]), ) def _parse_input(puzzle_input): return [_parse_instruction(line) for ...
import requests from bs4 import BeautifulSoup def main(): url = 'http://blog.castman.net/web-crawler-tutorial/ch2/blog/blog.html' resp = requests.get(url) soup = BeautifulSoup(resp.text, 'html.parser') # The following two lines are the same. # print(soup.find('h4')) print('Content of the firs...
n=int(input()) h=list(map(int,input().split())) dp=[0]*n dp[1]=abs(h[1]-h[0]) for i in range(2,n):dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2])) print(dp[-1])
#!/usr/bin/env python # -*- coding: utf-8 -*- """Update encrypted deploy password in Travis config file.""" from __future__ import print_function import base64 import json import os from getpass import getpass import yaml from cryptography.hazmat.primitives.serialization import load_pem_public_key from cryptography.h...
""" Test hardware breakpoints for multiple threads. """ import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil class HardwareBreakpointMultiThreadTestCase(TestBase): NO_DEBUG_INFO_TESTCASE = True mydir = TestBase.compute_mydir(__file__)...
# # PySNMP MIB module CT-PIC-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CT-PIC-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:29:05 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:...
import logging from fedml_api.distributed.fedgkt.message_def import MyMessage from fedml_core.distributed.client.client_manager import ClientManager from fedml_core.distributed.communication.message import Message class GKTClientMananger(ClientManager): def __init__(self, args, trainer, comm=None, rank=0, size=0...
''' 35. Search Insert Position Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You may assume no duplicates in the array. Example 1: Input: [1,3,5,6], 5 Output: 2 Example 2: Input: [1,3,5,6], 2 Output: 1 Exa...
import cv2 import gym from gym.core import ObservationWrapper from gym.spaces import Box from preprocessing import atari_wrappers from preprocessing.framebuffer import FrameBuffer ENV_NAME = "BreakoutDeterministic-v4" class PreprocessAtariObs(ObservationWrapper): def __init__(self, env): """A gym wrappe...