text
stringlengths
2
999k
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT from __future__ import unicode_literals from ..featuredetection import DistanceMaps def test_DistanceMaps_inputs(): input_map = dict( args=dict(argstr='%s', ), environ=dict( nohash=True, usedefault=True, ), ...
# (C) Copyright 2016-2017 Hewlett Packard Enterprise Development LP # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
import json import pytest from model_mommy import mommy from rest_framework import status from usaspending_api.awards.models import Cfda @pytest.fixture def cfda_data(db): mommy.make( Cfda, program_number="10.117", popular_name="Biofuel Infrastructure Partnership (BIP)", program_...
""" WSGI config for discoreg 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.0/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETT...
import tkinter class ConfirmView: __DESCRIPTIONBORDER = 10 __DESCRIPTIONROW = 0 __BUTTONPADDING = 5 __NAMECOLUMN = 1 def __center(self): self.__root.withdraw() self.__root.update_idletasks() x = (self.__root.winfo_screenwidth() - self.__root.winfo_reqwidth()) / 2 y =...
# 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, ...
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT from __future__ import unicode_literals from ..utils import CreateJacobianDeterminantImage def test_CreateJacobianDeterminantImage_inputs(): input_map = dict(args=dict(argstr='%s', ), deformationField=dict(argstr='%s', mandatory=True, position=...
#!/usr/bin/env python import lsgtuner import re import opentuner import os import tuning_params class mst(lsgtuner.LSGBinary): binary = "./mst" inputs = ['../../inputs/USA-road-d.FLA.sym.gr', '../../inputs/rmat12.sym.gr'] params = [lsgtuner.IntegerStepParameter('FINDCOMPMINTWO_BLKSIZE', 32, 384, 32), ...
# Serializes issued currency amounts from string number representations, # matching the precision of the SGY Ledger. from decimal import getcontext, Decimal class IssuedAmount: MIN_MANTISSA = 10**15 MAX_MANTISSA = 10**16 - 1 MIN_EXP = -96 MAX_EXP = 80 def __init__(self, strnum): ...
from __future__ import division import argparse from mmcv import Config from mmcv.runner import load_checkpoint from mmfashion.apis import (get_root_logger, init_dist, test_geometric_matching, test_tryon) from mmfashion.datasets.utils import get_dataset from mmfashion.models import build_g...
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from textwrap import dedent from pants.backend.jvm.register import build_file_aliases as register_jvm from pants.backend.project_info.tasks.depmap import Depmap from pants.backend.python....
from bitcoin import random_key, privtopub, pubtoaddr private_key = random_key() print("Randomly Generated Private Key: " + private_key) public_key = privtopub(private_key) print("Derived from Private Key, Public Key: " + public_key) address = pubtoaddr(public_key) print("Bitcoin Address: " + address)
#!/usr/bin/python3 import errno import os import shutil import tempfile from .ExceptionDefinitions import * VERSION_NUMBER = "3.4.0" HELP_EMAIL = 'help@opensciencegrid.org' def atomic_write(filename, contents): """Write to a temporary file then move it to its final location """ temp_fd, temp_name = tem...
# This entry is mostly for convenience for add-on developers from .interface import * from .registrar import *
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** # Export this package's modules as members: from .config import * from .variavble import *
from hpctool import ComsolModel, Task, Solver import numpy as np from utils import grid, pretty_print_individual, get_multipoles_from_res import os import sys from loguru import logger from typing import List, Dict from scipy.optimize import differential_evolution import logging class SquaresModel(ComsolModel): d...
#!python3 import glob, csv, sys, os, argparse, gzip from datetime import datetime, timedelta, timezone from queue import PriorityQueue, Empty def eprint(*args, **kwargs): print(*args, file=sys.stderr, **kwargs) def noprint(*args, **kwargs): pass try: from lxml import etree except ImportError: eprint("ERROR: m...
from __future__ import annotations, print_function, unicode_literals import asyncio import csv import json import os from typing import Iterator import aiohttp import aiohue import asyncstdlib as a import tuyapower from aiohue.lights import Light from PyInquirer import prompt MODE_HS = "hs" MODE_COLOR_TEMP = "color_...
import ROOT as rt def tdrGrid( gridOn): tdrStyle.SetPadGridX(gridOn) tdrStyle.SetPadGridY(gridOn) #fixOverlay: Redraws the axis def fixOverlay(): gPad.RedrawAxis() def setTDRStyle(): tdrStyle = rt.TStyle("tdrStyle","Style for P-TDR") #for the canvas: tdrStyle.SetCanvasBorderMode(0) tdrSt...
"""Simulate ARFIMA process. This module allows simulation of the ARFIMA(p, d, q) processes: AR(B) (1-B)^d x = MA(B) epsi . If d = 1, the process becomes ARMA(p, q) process: x[t] = ar[1]*x[t-1] + ar[2]*x[t-2] + ... + ar[p]*x[t-p] + + ma[1]*epsi[t-1] + ma[2]*epsi[t-2] + ... + ma[q]*epsi[t-q] + ...
#!/usr/bin/env python import urllib import urllib2 import json import os import re from flask import Flask from flask import request from flask import make_response # Flask app should start in global layout app = Flask(__name__) intent_name="string" QR=['0','1','2','3','4','5','6'] @app.route('/webhook', methods=[...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models from django.conf import settings import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('contracts', '0014_auto_20150720_2020'), migrations.swappable_depend...
import numpy as np import pandas as pd import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import os import sys import math ranked_papers = pd.read_pickle('dblp_final_paper_rankings.pickle') keep_cols = ['authors', 'year', 'normalized_citation_score_scaled','SJR_Normalized','reach_normalized','id'...
""" 测试套件加载测试用例的方法 """ import sys from os.path import abspath,dirname sys.path.insert(0,dirname(dirname(abspath(__file__)))) import unittest from test_framework.unittest_demo.testcases.test_register import TestRegister from test_framework.unittest_demo.testcases import TestLogin #加载单个测试用例 def suite1(): # 测试套件 ...
import numpy as np from tqdm import tqdm from math import comb from gamexplainer import GamExplainer import lightgbm as lgbm import json def main(): with open("config.json") as f: config_dict = json.load(f) model_path = config_dict["model_path"] feat_sel_out = config_dict["feat_sel_out"] ...
def binary_search(a,k, low, high): mid = (low+high)//2 if len(a[low:high+1]) <=1: # print(a[low:high+1], a[0]) if a[mid] == k: return mid else: return -1 if a[mid] == k: return mid elif a[mid] >= k: return binary_search(a,k,low, mid...
#!/usr/bin/env python # -*- coding: utf-8 -*- from filer.help import _help from leaderf.utils import lfCmd, lfEval @_help.help("move the cursor upward") def command__down(manager): lfCmd("normal! j") manager._previewResult(False) @_help.help("move the cursor downward") def command__up(manager): lfCmd("...
# login script import sys import time import uiautomator2 as u2 def wait(seconds=10): for i in range(0, seconds): print("wait 1 second ..") time.sleep(1) if __name__ == '__main__': avd_serial = sys.argv[1] d = u2.connect(avd_serial) # d.WAIT_FOR_DEVICE_TIMEOUT = 70 d.app_start("...
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'Organization' db.create_table(u'account_organization', ( ...
""" define the IntervalIndex """ from __future__ import annotations from functools import wraps from operator import ( le, lt, ) import textwrap from typing import ( TYPE_CHECKING, Any, Hashable, cast, ) import numpy as np from pandas._config import get_option from pandas._libs import lib fr...
from .base_element import BaseElement from ....utilities.datamodel import Element class TimeFrame(BaseElement): def __init__(self, element: Element): super().__init__(element) @property def start(self): return self._element['start'] @property def duration(self): return se...
class Buffer: def __init__(self): self._buffer = bytearray() def write(self, data: bytes): self._buffer.extend(data) def read(self, size: int): data = self._buffer[:size] self._buffer[:size] = b"" return data def peek(self, size: int): return self._buf...
import operator from uuid import uuid4 from ee.clickhouse.models.event import create_event from ee.clickhouse.queries.funnels.funnel import ClickhouseFunnel from ee.clickhouse.queries.funnels.funnel_persons import ClickhouseFunnelPersons from ee.clickhouse.queries.funnels.test.breakdown_cases import funnel_breakdown_t...
# %% Packages import os import tensorflow as tf from typing import Tuple from tensorflow.keras.callbacks import TensorBoard, EarlyStopping # %% Callbacks # Loading callbacks def load_callbacks( name: str, monitor: str, patience: int ) -> Tuple[TensorBoard, EarlyStopping]: tensorboard = load_tensorboard(name...
""" Tests that work on both the Python and C engines but do not have a specific classification into the other test modules. """ import codecs from collections import OrderedDict import csv from datetime import datetime from io import BytesIO, StringIO import os import platform from tempfile import TemporaryFile impor...
import dis import inspect import sys from collections import namedtuple from _pydev_bundle import pydev_log from _pydevd_bundle.pydevd_constants import (IS_PY38_OR_GREATER, dict_iter_items, dict_iter_values) from opcode import (EXTENDED_ARG, HAVE_ARGUMENT, cmp_op, h...
#!/usr/bin/python # This Python file uses the following encoding: utf-8 ''' @author: Federico Tersigni ''' import justpy as jp import sys from Model.Run import Run from Model.Directory import Directory from Template.icons.iconList import startIcon from Template.icons.iconList import filtroIcon from Template.icons.ico...
# Copyright (c) Facebook, Inc. and its affiliates. import os import torch from detectron2.utils.env import TORCH_VERSION from detectron2.utils.file_io import PathManager from .torchscript_patch import freeze_training_mode, patch_instances def export_torchscript_with_instances(model, fields): """ Run :func:...
#!/usr/bin/env python3 # Copyright (c) 2019 The Khronos Group Inc. # SPDX-License-Identifier: Apache-2.0 from itertools import product from shared import PLATFORMS, TRUE_FALSE, VS_VERSION, make_win_artifact_name if __name__ == "__main__": for platform, uwp in product(PLATFORMS, TRUE_FALSE): print(make_w...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2014 Love Sharma <contact@lovesharma.com> # # 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/LI...
from tests import MISTRAL_TEST_DIR, run_tests, run_train_process # paths CACHE_DIR = f"{MISTRAL_TEST_DIR}/artifacts" RUNS_DIR = f"{MISTRAL_TEST_DIR}/runs" TRAIN_ARGS = { "nnodes": "1", "nproc_per_node": "1", "config": "conf/train.yaml", "training_arguments.fp16": "true", "training_arguments.per_d...
import datetime import math import random import pandas as pd import gym import numpy as np from gym import spaces from stable_baselines3.common.vec_env import DummyVecEnv from .util.log_render import render_to_file from .util.plot_chart import TradingChart class tgym(gym.Env): """forex/future/option trading g...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @file : model.py @author: zijun @contact : zijun_sun@shannonai.com @date : 2020/11/17 14:57 @version: 1.0 @desc : """ import torch from torch import nn from transformers import AutoModel, AutoConfig from datasets.collate_functions import collate_to_max_length cla...
import numpy as np def layer_init_uniform(*x): ret = np.random.uniform(-1., 1., size=x) / np.sqrt(np.prod(x)) return ret.astype(np.float32) def fetch(url): import requests, os, hashlib, tempfile fp = os.path.join(tempfile.gettempdir(), hashlib.md5(url.encode('utf-8')).hexdigest...
''' LeetCode No.64 Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path. Note: You can only move either down or right at any point in time. Input: [ [1,3,1], [1,5,1], [4,2,1] ] Output: 7 Explanation: Because the pat...
import numpy as np import numbers from manimlib.constants import * from manimlib.mobject.functions import ParametricCurve from manimlib.mobject.geometry import Arrow from manimlib.mobject.geometry import Line from manimlib.mobject.geometry import DashedLine from manimlib.mobject.geometry import Rectangle from manimlib...
default_app_config = 'emailapp.apps.EmailappConfig'
import io from typing import Union, Any import pytest from revpbuf import core def test_read_varint_normal_input() -> None: input1 = io.BytesIO(b"\x01") input2 = io.BytesIO(b"\x7f") input3 = io.BytesIO(b"\xff\x01") input4 = io.BytesIO(b"\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01") input5 = io.Byte...
# coding: utf-8 """ Isilon SDK Isilon SDK - Language bindings for the OneFS API # noqa: E501 OpenAPI spec version: 3 Contact: sdk@isilon.com Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re # noqa: F401 import six from isi_sdk_8_0.models.pools_poo...
#!/usr/bin/python3 def check_brackets_match(text): """ Checks, whether brackets in the given string are in correct sequence. Any opening bracket should have closing bracket of the same type. Bracket pairs should not overlap, though they could be nested. Returns true if bracket sequence is correct...
# coding: utf-8 import numpy as np import chainer import chainer.functions as F import testtools import numpy as np class A(chainer.Chain): def forward(self): y1 = np.zeros((3, 4), dtype=np.float32) return y1 # ====================================== def main(): testtools.generate_testcase(...
from __future__ import print_function import re import sqlparse from sqlparse.sql import IdentifierList, Identifier, Function from sqlparse.tokens import Keyword, DML, Punctuation cleanup_regex = { # This matches only alphanumerics and underscores. 'alphanum_underscore': re.compile(r'(\w+)$'), ...
from model.group import Group import allure def test_add_group(app, db, json_groups): group = json_groups with allure.step('Given a group list'): old_groups = db.get_group_list() with allure.step('When I add a group %s to the list' % group): app.group.create(group) with allure.step('Th...
#! /usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2017 The etcd 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 requ...
from django import forms from markedit.widgets import MarkEdit from pycon.models import PyConTalkProposal from pycon.forms import PyConProposalForm class PyConJPTalkProposalForm(PyConProposalForm): class Meta: model = PyConTalkProposal fields = [ "title", "category", ...
from flask import request from app.errors import bp from app import db import elasticsearch import sentry_sdk from .errors import NatlasServiceError, NatlasSearchError from .responses import get_response, get_supported_formats def build_response(err: NatlasServiceError): selected_format = request.accept_mimetype...
# Copyright 2014 IBM Corp. # # 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...
# MIT LICENSE # # Copyright 1997 - 2020 by IXIA Keysight # # 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, ...
# Generated by Django 2.0.6 on 2019-01-26 20:42 import cloudinary.models from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_US...
# Show, Attend and Tell Captioning Lightning Module # Author: Ali Gholami (https://aligholami.github.io) import torch.nn as nn from itertools import chain import torch.optim as optim from torchvision import transforms from lib.data.vocab import VocabTools from torch.utils.data import DataLoader from lib.callbacks impor...
""" Copyright 2019 EUROCONTROL ========================================== 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 an...
#!/usr/bin/env python # -*- coding: utf-8 -*- import json import os import shutil json_file = "splitcores.json" rbf_files = [] rbf_location = "/media/fat" # fid all rbf files print("Scanning {} for core files ...".format(rbf_location)) for root,d_names,f_names in os.walk(rbf_location): for filename in f_names:...
# -*- coding: utf-8 -*- """ 处理Markdown文件,自动加入Hexo博客所需标签等信息,自动加入"阅读更多"分割线 详细步骤: 1. 处理文件夹下文件名称 2. 在文件头部插入标签等信息 3. 在文件中间某行插入分隔符<!-- more --> """ import os path = "/Users/yangzhendong/Desktop/blog" files = os.listdir(path) datanames = os.listdir(path) for file_name in datanames: # 只取文件名 file_name_real = file_n...
import unittest import attr from itemadapter import ItemAdapter from itemloaders.processors import Compose, Identity, MapCompose, TakeFirst from scrapy.http import HtmlResponse, Response from scrapy.item import Item, Field from scrapy.loader import ItemLoader from scrapy.selector import Selector try: from datac...
from binance_f.model.order import * from binance_f.model.exchangeinformation import ExchangeInformation from binance_f.base.printobject import * from Settings import * from colorama import * from Methods import get_sl, get_tp def on_seconds(client, pos, exchange_info: ExchangeInformation, acc_balance: float): # T...
#!/usr/bin/env python #------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. #----------------------------------------------------------------...
import sys data = sys.stdin.read() transitions = { 1: { 'U': 1, 'D': 4, 'L': 1, 'R': 2 }, 2: { 'U': 2, 'D': 5, 'L': 1, 'R': 3 }, 3: { 'U': 3, 'D': 6, 'L': 2, 'R': 3 }, 4: { 'U': 1, 'D': 7, 'L': 4, 'R': 5 }, 5: { ...
import os import re import shutil def delete_all(delete_path): if not os.listdir(delete_path): pass else: for i in os.listdir(delete_path): path_file = os.path.join(delete_path, i) if os.path.isfile(path_file): os.remove(path_file) else: ...
# 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 may ...
""" Django settings for auladocker project. Generated by 'django-admin startproject' using Django 3.1.2. For more information on this file, see https://docs.djangoproject.com/en/3.1/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/3.1/ref/settings/ """ from path...
from setuptools import setup, find_packages setup( name='getl', version='0.3', description='', long_description=open('README.rst').read(), url='https://github.com/gregology/getl', author='Greg Clarke', author_email='greg@gho.st', license='MIT', classifiers=[ 'Development Status :: 4 - Beta', ...
import os import shutil import json def check_true(option): """Check if option is true. Account for user inputting "yes", "Yes", "True", "Y" ... """ option = option.lower() if 'y' in option or 't' in option: return True else: return False def process_bibtex(bibtex, tex_root): ...
""" @brief test log(time=65s) """ import os import unittest from logging import getLogger from pandas import DataFrame from pyquickhelper.loghelper import fLOG from pyquickhelper.pycode import get_temp_folder, ExtTestCase from sklearn.exceptions import ConvergenceWarning from sklearn.utils.testing import ignore_wa...
import os, sys os.environ['CUDA_VISIBLE_DEVICES'] = '0' import numpy as np import cv2 as cv import tensorflow as tf from tensorflow.keras import layers from tensorflow.keras.callbacks import ModelCheckpoint, LearningRateScheduler, EarlyStopping, TensorBoard from net import * from tensorflow.keras.optimizers imp...
############################################################################## # Copyright (c) 2015 Huawei Technologies Co.,Ltd. and others # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompanies this distribution, ...
from module.load import * from module.utility import * if __name__ == "__main__": arguments = input_arg() Data_transformer(download=arguments['Download'])
num1 = 10 num2 = 20 num3 = 30 print('hello world')
import numba as nb import numpy as np import cupy @nb.cuda.jit def _triangulate_terrain_kernel(verts, triangles, data, H, W, scale, stride): global_id = stride + nb.cuda.grid(1) if global_id < W*H: h = global_id // W w = global_id % W mesh_map_index = h * W + w val = data[h, -...
# Generated by Django 4.0.2 on 2022-02-28 23:57 from django.db import migrations, models import uuid class Migration(migrations.Migration): dependencies = [ ('users', '0003_rename_is_win_gameparticipation_is_alive_and_more'), ] operations = [ migrations.RemoveField( model_na...
from myqueue import CheckableQueue def bfs(start, bases, players): # a FIFO open_set open_set = CheckableQueue() # an empty set to maintain visited nodes closed_set = set() # a dictionary to maintain meta information (used for path formation) meta = dict() # key -> (parent state, action to rea...
import sys import logging from time import sleep from functools import wraps import requests from nebula.conf import NEBULA_API_URL, API_KEY, _init_conf_file ##################### API CALLS ###################### LOGIN = 'login' GET = 'get' DESTROY = 'destroy' STATUS = 'provisioning-status' LIST = 'list' ###########...
import os import sys import time import signal import logging import argparse class BaseApp: def __init__(self, desc, ver_num): signal.signal(signal.SIGINT, self.sig_handler) signal.signal(signal.SIGTERM, self.sig_handler) self.quit_flag = False sfile = sys.argv[0] ver = ("...
"""Herewithin lies the ability for ansible-runner to run the ansible-doc command """ from typing import Any from typing import Dict from typing import List from typing import Optional from typing import Tuple from typing import Union from ansible_runner import get_plugin_docs # type: ignore[import] from .base impor...
import pprint as pp def allConstruct(target, word_bank, memo=None): ''' input: target- String word_bank- array of Strings output: 2D array containing all of the ways that the target can be constructed by concatenating elements of the word_bank array. Each element of the 2D array should represent one combin...
import os import csv class Logger(object): ''' Logger saves the running results and helps make plots from the results ''' def __init__(self, log_dir): ''' Initialize the labels, legend and paths of the plot and log file. Args: log_path (str): The path the log files ''...
class Solution: def findAnagrams(self, s: str, p: str) -> List[int]: inputHash, strStart, firstPsum, currHash, res = 0, 0, 0, 0, [] if len(s) < len(p): return [] for subStr in p: inputHash += hash(subStr) for i in range(len(p)): firstPsum += hash(...
""" MapPlot ------- Make plots of the cube and interactively connect them to spectrum plotting. This is really an interactive component of the package; nothing in here is meant for publication-quality plots, but more for user interactive analysis. That said, the plotter makes use of `APLpy <https://github.com/aplpy/a...
#coding:utf-8 #author:wolf@future-sec import urllib2 def check(host,port,timeout): url = "http://%s:%d"%(host,int(port)) vul_url = url + '/%3f.jsp' try: res_html = urllib2.urlopen(vul_url,timeout=timeout).read() except: return 'NO' if "<h1>Directory of" in res_html: info = vu...
import unittest import uuid import gtirb class NodeFromUUIDTest(unittest.TestCase): def test_get_by_uuid_failed(self): bad_id = uuid.uuid4() node = gtirb.IR().get_by_uuid(bad_id) self.assertIsNone(node) def test_get_by_uuid(self): ir1 = gtirb.IR() ir2 = gtirb.IR() ...
#!/usr/bin/env python # -*- encoding: utf-8 -*- # flake8: noqa from __future__ import absolute_import from __future__ import print_function import io from os import path from setuptools import setup from setuptools.command.develop import develop from setuptools.command.install import install here = path.abspath(pat...
"""distutils.command.build_ext Implements the Distutils 'build_ext' command, for building extension modules (currently limited to C extensions, should accommodate C++ extensions ASAP).""" import contextlib import os import re import sys from distutils.core import Command from distutils.errors import * from distutils....
#!/usr/bin/env python # Copyright 2016 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...
#encoding: utf-8 import logging import time # time.time()返回1970/1/1日起的时间戳的(单位是秒) from .base import BasePlugin logger = logging.getLogger(__name__) class Heartbeat(BasePlugin): def __init__(self, config, *args, **kwargs): super(Heartbeat, self).__init__(config, 'heartbeat', 10, *args, **kwargs) def...
# Copyright 2020 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 import pandas as pd import numpy as np import sys import os import tushare as ts import matplotlib.pyplot as plt ts = pd.Series(np.random.randn(1000), index=pd.date_range('1/1/2000', periods=1000)) ts = ts.cumsum() ts.plot() ts.figure()
#### NOTICE: THIS FILE IS AUTOGENERATED #### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY #### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES from swgpy.object import * def create(kernel): result = Tangible() result.template = "object/tangible/ship/components/weapon_capacitor/shared_cap_mandal_powermaster_mk1.i...
import argparse import glob import sys from functools import partial import cv2 from multiprocess import Pool sys.path.append("../.") from boxdetect import config # NOQA E402 from boxdetect.pipelines import get_boxes # NOQA E402 if __name__ == "__main__": # construct the argument parse and parse the arguments...
#!/usr/bin/env python3 import gym from collections import namedtuple import numpy as np from tensorboardX import SummaryWriter import torch import torch.nn as nn import torch.optim as optim HIDDEN_SIZE = 128 BATCH_SIZE = 16 PERCENTILE = 70 class Net(nn.Module): def __init__(self, obs_size, hidden_size, n_actio...
""" Inception model. """ import numpy as np import tensorflow as tf import six from net import Net import ops class Inception(Net): """ Inception model. """ def __init__(self, cfgs, images, labels, mode='train', multi_gpu_mode=False): """ ResNet constructor. """ Net.__init__(self, cfgs, image...
from django.core.management.base import BaseCommand from django.utils import timezone #from mooring.models import RegisteredVessels from mooring import models from django.db.models.functions import Length from mooring.emails import send_registered_vessels_email from datetime import datetime import json from datetime ...