filename
stringlengths
13
19
text
stringlengths
134
1.04M
the-stack_106_29683
""" 在数字列表中查找最大的数字 算法: [170 , 160 , 180 , 165] 假设第一个就是最大值 使用假设的和第二个进行比较, 发现更大的就替换假设的 使用假设的和第三个进行比较, 发现更大的就替换假设的 使用假设的和第四个进行比较, 发现更大的就替换假设的 最后,假设的就是最大的. """ list01 = [170, 160, 180, 165] max_value = list01[0] for i in range(1, len(list01)):# 1 2 3 if max_value < list01[i]: ...
the-stack_106_29684
from __future__ import absolute_import, division, print_function import matplotlib.pyplot as plt import example_helpers import drms # Series name, timespan and wavelength series = 'aia.lev1_euv_12s' series_lev1 = 'aia.lev1' wavelen = 335 #tsel = '2015-01-01T00:00:01Z/1h' #tsel = '2015-01-01T00:00:01Z/1d' #tsel = '201...
the-stack_106_29687
#!/usr/bin/env python3 # Add the current folder to PYTHONPATH by Yiming import os import sys sys.path.append( os.path.abspath( os.path.join( os.path.abspath(os.path.join(os.getcwd(),os.pardir)), os.pardir))) from baselines.common.cmd_util import gym_ctrl_arg_parser, make_gym_control_env from b...
the-stack_106_29688
# ! /usr/bin/python # -*- coding: utf-8 -*- # Copyright 2019 NVIDIA. 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 #...
the-stack_106_29691
from turtle import Turtle from functions import setupScreen, gradient_color, format_color screen = setupScreen(720,1280) tl = Turtle() tl.speed(0) tl.hideturtle() def run(): tl.penup() tl.back(150) tl.pendown() color_ini = [0xff, 0x00, 0x99] color_fim = [0x42, 0x86, 0xf4] for k in range(3): ...
the-stack_106_29695
# ---------------------------------------------------------------------------- # Copyright (c) 2020, Franck Lejzerowicz. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, distributed with this software. # -----------------------------------------------------------...
the-stack_106_29696
import json import numpy as np from pycocotools import mask from skimage import measure import os, json import cv2 import pandas as pd from shutil import copyfile import re from imantics import Polygons, Mask fishial_dataset = r'resources/new_part' os.makedirs(fishial_dataset, exist_ok=True) mask_dir = r'resources/ol...
the-stack_106_29698
import speech_recognition as sr import face_recognition as fc import numpy as np import pandas as pd import cv2 as cv import time as t import vlc import random as r import pyttsx3 as sx import wikipedia from datetime import date from googlesearch import search import webbrowser as wb import requests, json import geocod...
the-stack_106_29699
#!/usr/bin/env python # =========================================================================== # Copyright 2017 `Tung Thanh Le` # Email: ttungl at gmail dot com # # Heterogeneous Architecture Configurations Generator for Multi2Sim simulator # (aka, `HeteroArchGen4M2S`) # `HeteroArchGen4M2S` is free software, whic...
the-stack_106_29703
from django import forms PRODUCT_QUANTITY_CHOICES = [(i, str(i)) for i in range(1, 26)] class CartAddProductForm(forms.Form): quantity = forms.TypedChoiceField(label='Количество:', choices=PRODUCT_QUANTITY_CHOICES, coerce=int, widget=forms.Select( attrs={'class': 'form-control'} )) upda...
the-stack_106_29704
# -*- coding: utf-8 -*- # Copyright 2021 Cohesity Inc. class BackupJobProtoDRToCloudParams(object): """Implementation of the 'BackupJobProto_DRToCloudParams' model. A Proto needed in case objects backed up by this job need to DR to cloud. "Fail over" signifies the mechanism to move the workload to cloud...
the-stack_106_29705
from tensorflow.keras.layers import Dropout, MaxPool1D, MaxPool2D, Conv1D, Conv2D, Dense from tensorflow.keras.models import load_model from pathlib import Path def writeShape(shape): return ", ".join(str(s) for s in shape[1:]) def getName(layer): if isinstance(layer, Conv2D): return "Convolution 2D"...
the-stack_106_29706
# author: Eric S. Tellez <eric.tellez@infotec.mx> import os import json import numpy as np import logging from itertools import combinations try: from tqdm import tqdm except ImportError: def tqdm(x, **kwargs): return x logging.basicConfig(format='%(asctime)s : %(levelname)s :%(message)s') class F...
the-stack_106_29707
# Copyright 2017 Mycroft AI 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 writin...
the-stack_106_29708
import tensorflow as tf from tensorflow.keras.layers import Conv1D, Input, Dense, Reshape, ReLU, Permute from tensorflow.keras.layers import Conv1D, Input, LSTM, Embedding, Dense, TimeDistributed, Bidirectional, \ LayerNormalization from tensorflow.keras.models import Model from globals import * def softmax(logits...
the-stack_106_29715
from Jumpscale import j try: import digitalocean except: j.builders.runtimes.python3.pip_package_install("python-digitalocean") import digitalocean from .DigitalOceanVM import DigitalOceanVM from .Project import Project class DigitalOcean(j.baseclasses.object_config): _SCHEMATEXT = """ @url = j...
the-stack_106_29718
# -*- coding: utf-8 -*- """ sphinx.quickstart ~~~~~~~~~~~~~~~~~ Quickly setup documentation source to work with Sphinx. :copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ from __future__ import print_function from __future__ import absolute...
the-stack_106_29719
#!/usr/bin/env python3 # Party inspired by https://github.com/CUN-bjy/gym-ddpg-keras import rospy import gym import rospkg import time import numpy as np from ddpg import ActorNet, CriticNet from ddpg_utils import MemoryBuffer, OrnsteinUhlenbeckProcess from utils import tcolors import rosnode import task_arm_office ...
the-stack_106_29720
from setuptools import setup, find_packages from os import path from io import open here = path.abspath(path.dirname(__file__)) with open(path.join(here, 'README.md'), encoding='utf-8') as f: long_description = f.read() setup( name='spotifyscraper', version='1.0.5', description='Spotify Web Player Sc...
the-stack_106_29722
import cv2 import numpy as np import scipy.ndimage from sklearn.externals import joblib from tools import * from ml import * import argparse # Arguments parser = argparse.ArgumentParser() parser.add_argument('--mode', '-mode', help="Mode : train or predict", type=str) parser.add_argument('--a', '-algorithm', help="alg...
the-stack_106_29723
import re import pytest import pandas as pd @pytest.mark.filterwarnings( # openpyxl "ignore:defusedxml.lxml is no longer supported:DeprecationWarning" ) @pytest.mark.filterwarnings( # html5lib "ignore:Using or importing the ABCs from:DeprecationWarning" ) @pytest.mark.filterwarnings( # fastparqu...
the-stack_106_29724
from app import create_app, db from flask_script import Manager,Server from app.models import User,Role,Comment,Blog from flask_migrate import Migrate,MigrateCommand #Create app instance app = create_app('production') app.secret_key = '12' manager = Manager(app) manager.add_command('server',Server) migrate = Mig...
the-stack_106_29726
# -*- coding: utf-8 -*- from random import randint import sys reload(sys) sys.setdefaultencoding('utf8') #Numero Antes def numeroAntes(minn, maxn): numero = randint(minn,maxn) pregunta = '¿Qué número está antes del ' + str(numero) + '?' respuesta = numero - 1 return [pregunta, respuesta, None] #Numer...
the-stack_106_29728
import taichi as ti import sys import math import numpy as np import os import taichi as tc import matplotlib.pyplot as plt real = ti.f32 ti.set_default_fp(real) max_steps = 2048 vis_interval = 64 output_vis_interval = 2 steps = 1024 assert steps * 2 <= max_steps vis_resolution = 1024 scalar = lambda: ti.var(dt=rea...
the-stack_106_29730
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe, os, copy, json, re from frappe import _ from frappe.modules import get_doc_path from frappe.core.doctype.access_log.access_log import make_access_log from frappe....
the-stack_106_29731
# # This file is part of the GROMACS molecular simulation package. # # Copyright (c) 2015, by the GROMACS development team, led by # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, # and including many others, as listed in the AUTHORS file in the # top-level source directory and at http://www.gromacs.or...
the-stack_106_29732
# SPDX-FileCopyrightText: Fondazione Istituto Italiano di Tecnologia # SPDX-License-Identifier: BSD-3-Clause import os import yarp import argparse import numpy as np from adherent.trajectory_control import trajectory_controller from adherent.trajectory_control.utils import define_foot_name_to_index_mapping from adhere...
the-stack_106_29733
#!/usr/bin/env python import torch.nn from deepinpy.utils import utils class Conv2dSame(torch.nn.Module): def __init__(self, in_channels, out_channels, kernel_size, bias=True, padding_layer=torch.nn.ReflectionPad2d): super().__init__() ka = kernel_size // 2 kb = ka - 1 if kernel_size % 2...
the-stack_106_29734
""" This script simply runs the intersection driving environment. In this example, the ego vehicle first stops at the intersection and the continues to drive after 35 s. """ import numpy as np import sys sys.path.append('../src') import parameters_intersection as p from intersection_env import IntersectionEnv p.sim_...
the-stack_106_29736
# coding:utf-8 # Copyright (c) 2020 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 requ...
the-stack_106_29739
import re import sys import warnings from urllib.parse import urlparse import joblib from googlesearch import search from newspaper import Article from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.metrics.pairwise import cosine_similarity from sklearn.model_selection import train_test_split war...
the-stack_106_29741
#!/usr/bin/env python3 """This is an example to train a task with TRPO algorithm (PyTorch). Uses Ray sampler instead of OnPolicyVectorizedSampler. Here it runs InvertedDoublePendulum-v2 environment with 100 iterations. """ import torch from metarl.experiment import LocalRunner, run_experiment from metarl.np.baselines...
the-stack_106_29742
import numpy as np from .. import util from ..element import Element from ..ndmapping import NdMapping, item_check, sorted_context from .dictionary import DictInterface from .interface import Interface, DataError class MultiInterface(Interface): """ MultiInterface allows wrapping around a list of tabular dat...
the-stack_106_29743
from typing import Any, Callable, Dict, List, Optional from chia.consensus.block_record import BlockRecord from chia.consensus.pos_quality import UI_ACTUAL_SPACE_CONSTANT_FACTOR from chia.full_node.full_node import FullNode from chia.full_node.mempool_check_conditions import get_puzzle_and_solution_for_coin from chia....
the-stack_106_29744
from typing import Optional from great_expectations.core.expectation_configuration import ExpectationConfiguration from great_expectations.expectations.util import render_evaluation_parameter_string from ...render.renderer.renderer import renderer from ...render.types import RenderedStringTemplateContent from ...rend...
the-stack_106_29748
# -*- coding: utf-8 -*- from setuptools import setup, find_packages long_desc = ''' This contrib extension, sphinxcontrib.httpdomain provides a Sphinx domain for describing RESTful HTTP APIs. You can find the documentation from the following URL: http://pythonhosted.org/sphinxcontrib-httpdomain/ ''' requires = [ ...
the-stack_106_29750
# Author: Aretas Gaspariunas from typing import List, Dict, Optional, Iterable, Union, Tuple, Any import warnings import os from contextlib import redirect_stderr from anarci import anarci import pandas as pd from pandarallel import pandarallel with redirect_stderr(open(os.devnull, "w")): # disable Keras messages ...
the-stack_106_29751
# coding=utf-8 # Copyright 2021 The Google Research 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 by applicab...
the-stack_106_29752
import math import os from concurrent.futures import Future, ThreadPoolExecutor, as_completed, wait from dataclasses import dataclass from pathlib import Path from typing import List, Literal, Sequence, Union from google.cloud import storage as gcs from tqdm import tqdm from practipy.text import remove_prefix """ TO...
the-stack_106_29754
import os import platform import argparse import urllib.request # import nightsawayforms code import campdeets import configuration import defaults import equipment import header import health import kitlist import menu import programme import riskassessment import nanform def set_up(): """Check local environmen...
the-stack_106_29758
#!/usr/bin/env python __author__ = "alvaro barbeira" import logging import os import re import pandas import numpy import gzip from timeit import default_timer as timer from pyarrow import parquet as pq from genomic_tools_lib import Logging, Utilities from genomic_tools_lib.data_management import TextFileTools from ...
the-stack_106_29760
#!/usr/bin/env python3 from pydbusbluez.device import Device, Adapter from pydbusbluez.error import BluezDoesNotExistError, BluezError, DBusTimeoutError from pydbusbluez.gatt import Gatt, FormatUint8, FormatBitfield from pydbusbluez.gatt_generic import device_information import sys from gi.repository.GLib import Main...
the-stack_106_29762
import typing from .model.snowflake import Snowflake class CacheContainer: def __init__(self, default_expiration_time=None, **max_sizes): self.default_expiration_time = default_expiration_time self.__cache_dict: typing.Dict[str, typing.Union[dict, CacheStorage]] = {"guild_cache": {}} self....
the-stack_106_29764
# Copyright 2021 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...
the-stack_106_29765
import os import unittest from openprocurement.agreement.core.tests.base import BaseAgreementWebTest from openprocurement.agreement.cfaua.tests.base import TEST_AGREEMENT class Base(BaseAgreementWebTest): relative_to = os.path.dirname(__file__) initial_data = TEST_AGREEMENT initial_auth = ('Basic', ('bro...
the-stack_106_29766
import socket import sys sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) addr = ('localhost', int(sys.argv[1])) print >>sys.stderr, 'listening on %s port %s' % addr sock.bind(addr) while True: buf, raddr = sock.recvfrom(4096) print >>sys.stderr, buf if buf: sent = sock.sendto(buf, raddr)
the-stack_106_29768
# -*- coding: utf-8 -*- # Resource object code # # Created by: The Resource Compiler for PyQt5 (Qt v5.15.2) # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore qt_resource_data = b"\ \x00\x00\x69\x54\ \x89\ \x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\ \x00\x01\xe0\x...
the-stack_106_29771
""" Python Interchangeable Virtual Instrument Library Copyright (c) 2013-2014 Alex Forencich 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...
the-stack_106_29772
import random import threading import time from statistics import mean from typing import Optional from cereal import log from common.params import Params, put_nonblocking from common.realtime import sec_since_boot from selfdrive.hardware import HARDWARE from selfdrive.swaglog import cloudlog from selfdrive.statsd imp...
the-stack_106_29774
"""suplerlists URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.1/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-b...
the-stack_106_29775
import tensorflow as tf import pointnet_cls_basic as pointnet import utils.tf_util as tf_util pcl_feat_size = 16 bn_decay = 0.9 weight_decay = 0.005 def placeholder_inputs(batch_size, num_points, num_steps): ''' Returns placeholders for both geometry and state prediction modules. ''' pcl_pl = tf.place...
the-stack_106_29776
# -*- coding:UTF-8 -*- import wget import requests import urllib.request import numpy as np import os import cv2 import json import math #--------------Driver Library-----------------# import RPi.GPIO as GPIO import OLED_Driver as OLED #--------------Image Library---------------# from PIL import Image from PIL import...
the-stack_106_29778
#!/usr/bin/env python # -*- encoding: utf-8 -*- """A module with utility functions for working with collections.""" import itertools from typing import Callable, Dict, Iterable, Iterator, List, Tuple, TypeVar T = TypeVar("T") K = TypeVar("K") def Flatten(iterator: Iterable[Iterable[T]]) -> Iterator[T]: """Flatten...
the-stack_106_29781
"""Supporting definitions for the Python regression tests.""" if __name__ != 'test.support': raise ImportError('support must be imported from the test package') import collections.abc import contextlib import errno import faulthandler import fnmatch import functools import gc import importlib import importlib.uti...
the-stack_106_29782
import sys import csv import copy import numpy as np import pandas as pd from lib.visualize import TrainHistoryPlot def from_dataframe(dataframe): #only return numpy array seq = [] for i in range(len(dataframe)): seq.append(dataframe.iloc[i]) return np.asarray(seq) def grab_FThis(dataframe_l...
the-stack_106_29783
import os.path from data.base_dataset import BaseDataset from data.image_folder import make_dataset class CelebaDataset(BaseDataset): def get_paths(self, opt, phase="train"): root = opt.dataroot assert phase == "train", "Only training data is available for this dataset" seg_dir = os.path...
the-stack_106_29784
#!/usr/bin/env python3 # Copyright (c) 2012-2016 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. ''' Extract _("...") strings for translation and convert to Qt stringdefs so that they can be picked up by...
the-stack_106_29786
# # 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 # ...
the-stack_106_29787
# -*- coding: utf-8 -*- """Model unit tests.""" import datetime as dt import pytest from blockflix.store.models import Staff, Country, City, Address, Actor, Category,\ Customer, Film, Language, Payment, \ Rental, Store, Role from .factories import StaffF...
the-stack_106_29790
import os from setuptools import setup, find_packages ROOT = os.path.realpath(os.path.join(os.path.dirname(__file__))) about = {} with open(os.path.join(ROOT, "awseipext", "__about__.py")) as f: exec (f.read(), about) setup( name=about["__title__"], version=about["__version__"], author=about["__auth...
the-stack_106_29791
from fusedwind.interface import base, implement_base def configure_planform(cls, file_base, planform_nC=6, spline_type='pchip'): """ method that adds a ``SplinedBladePlanform`` instance to the assembly Parameters ---------- cls: class instance Instance of an OpenMDAO Assembly that the ana...
the-stack_106_29792
from __future__ import absolute_import import sys import inspect from collections import OrderedDict import attr is_py3 = sys.version_info.major >= 3 inspect_iscoroutinefunction = getattr( inspect, 'iscoroutinefunction', lambda f: False) class temporal_property(object): '''Assiginable property''' def ...
the-stack_106_29793
# Copyright 2020 DeepMind Technologies Limited # Copyright 2021 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 requi...
the-stack_106_29796
""" Run this file for Problem 1 """ import torch import torch.nn as nn from torch.utils.data import TensorDataset import logging import cv2 import numpy as np import pandas as pd import matplotlib.pyplot as plt; plt.style.use('seaborn-darkgrid') from copy import deepcopy from pusher_goal import PusherEnv from pusher_mo...
the-stack_106_29797
__author__ = ["Nurendra Choudhary <nurendrachoudhary31@gmail.com>","Anoop Kunchukuttan <anoop.kunchukuttan@gmail.com>"] __license__ = "GPLv3" """ Transliterate texts between unicode and standard transliteration schemes. Transliterate texts between non-latin scripts and commonly-used latin transliteration schemes. Uses...
the-stack_106_29798
from codecs import open from setuptools import setup, find_packages from os import path REQUIREMETS_DEV_FILE = 'requirements_dev.txt' REQUIREMETS_TEST_FILE = 'requirements_test.txt' REQUIREMETS_FILE = 'requirements.txt' PROJECTNAME = 'aio_windows_patch' VERSION = '0.0.1' DESCRIPTION = 'simple tools' URL = 'https://git...
the-stack_106_29801
from setuptools import setup, find_packages classifiers = [ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Education', 'Operating System :: OS Independent', 'License :: OSI Approved :: MIT License', 'Programming Language :: Python :: 3' ] keywords = ['Data Structure', 'dsa', 'Algorith...
the-stack_106_29803
# -*- coding: utf-8 -*- # vim:set et tabstop=4 shiftwidth=4 nu nowrap fileencoding=utf-8: from unittest import TestCase from devicehive.client.ws import WsCommand class WsCommandCreateTestCase(TestCase): def test_dict_expected(self): self.assertRaises(TypeError, WsCommand.create, None) def test_para...
the-stack_106_29806
# 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) import collections import contextlib import errno import inspect import itertools import os import os.path import shutil i...
the-stack_106_29807
# -*- coding: utf-8 -*- from __future__ import unicode_literals from collections import namedtuple from logging import NullHandler, getLogger from pkg_resources import resource_stream from six import text_type import yaml from .serializer import get_yaml_loader logger = getLogger(__name__) logger.addHandler(NullHan...
the-stack_106_29808
def counter(start=0): count = start def incr(): nonlocal count count += 1 return count return incr if __name__ == '__main__': a = counter() print(a()) b = counter(10) print(b()) print(a()) print(b())
the-stack_106_29809
#!/usr/bin/env python3 import re from pwn import * p = remote("2018shell.picoctf.com",1225) ''' pwntools 공식 문서 : 설치법 $sudo -i #apt-get update #apt-get install python3 python3-pip python3-dev git libssl-dev libffi-dev build-essential #python3 -m pip install --upgrade pip #python3 -m pip install --upgrade pwn...
the-stack_106_29810
import inspect from typing import Dict, Generator, Tuple, Any, Set, List, Union from pathlib import Path from pydantic import BaseModel from openpyxl import Workbook from openpyxl.worksheet.worksheet import Worksheet from openpyxl.styles import Border, Alignment from openpyxl.cell import Cell BORDER_ATTRIBUTES: Set[s...
the-stack_106_29812
# Copyright 2017 Intel Corporation # # 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 wri...
the-stack_106_29813
################################################################ ## In principle all you have to setup is defined in this file ## ################################################################ from configManager import configMgr from ROOT import kBlack,kWhite,kGray,kRed,kPink,kMagenta,kViolet,kBlue,kAzure,kCyan,kTeal...
the-stack_106_29814
from uuid import uuid4 import pytest from pydent.marshaller.base import add_schema from pydent.marshaller.base import ModelRegistry from pydent.marshaller.fields import Alias from pydent.marshaller.fields import Callback from pydent.marshaller.fields import Field from pydent.marshaller.fields import Nested from pyden...
the-stack_106_29815
# Copyright (c) 2008-2009 Pedro Matiello <pmatiello@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 in the Software without # restriction, including without limitation the rights to use, # copy,...
the-stack_106_29816
#!/usr/bin/env python3 import json import os import subprocess import time import numpy as np import unittest from collections import Counter from pathlib import Path import cereal.messaging as messaging from cereal.services import service_list from common.basedir import BASEDIR from common.timeout import Timeout from...
the-stack_106_29817
from typing import List from catalyst.dl.callbacks import MeterMetricsCallback from catalyst.tools import meters class AUCCallback(MeterMetricsCallback): """Calculates the AUC per class for each loader. .. note:: Currently, supports binary and multi-label cases. """ def __init__( s...
the-stack_106_29818
import torch import torchvision.datasets as dsets from torchvision import transforms class Data_Loader(): def __init__(self, train, dataset, image_path, image_size, batch_size, shuf=True): self.dataset = dataset self.path = image_path self.imsize = image_size self.batch =...
the-stack_106_29819
# -*- coding: utf-8 -*- import collections import datetime import logging import os import dateutil.parser import dateutil.tz from auth import Auth from elasticsearch import RequestsHttpConnection from elasticsearch.client import Elasticsearch from six import string_types logging.basicConfig() elastalert_logger = log...
the-stack_106_29820
""" Utilities for end-users. """ from __future__ import absolute_import import __main__ from collections import namedtuple import logging import traceback import re import os import sys from parso import split_lines from jedi import Interpreter from jedi.api.helpers import get_on_completion_name READLINE_DEBUG = F...
the-stack_106_29822
# -*- 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...
the-stack_106_29823
import os import torch from ignite.exceptions import NotComputableError from ignite.metrics import RootMeanSquaredError import pytest def test_zero_div(): rmse = RootMeanSquaredError() with pytest.raises(NotComputableError): rmse.compute() def test_compute(): rmse = RootMeanSquaredError() ...
the-stack_106_29824
############################################################################### # # Tests for XlsxWriter. # # Copyright (c), 2013-2015, John McNamara, jmcnamara@cpan.org # from ..excel_comparsion_test import ExcelComparisonTest from ...workbook import Workbook class TestCompareXLSXFiles(ExcelComparisonTest): """...
the-stack_106_29825
import numpy as np import pandas as pd from statsmodels.genmod.bayes_mixed_glm import BinomialBayesMixedGLM def glmm_model(data, features, y, random_effects): model = BinomialBayesMixedGLM.from_formula(f'{y} ~ {features}', random_effects, data) result = model.fit_vb() return result def call_glmm_model(d...
the-stack_106_29827
import os def to_head( projectpath ): pathlayers = os.path.join( projectpath, 'layers/' ).replace('\\', '/') return r""" \documentclass[border=8pt, multi, tikz]{standalone} \usepackage{import} \subimport{"""+ pathlayers + r"""}{init} \usetikzlibrary{positioning} \usetikzlibrary{3d} %for including external im...
the-stack_106_29828
# Copyright 2019 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...
the-stack_106_29829
# :coding: utf-8 # :copyright: Copyright (c) 2014 ftrack import functools import FnAssetAPI.ui.implementation import FnAssetAPI.ui.constants import FnAssetAPI.ui import ftrack_connect_foundry.ui.browser import ftrack_connect_foundry.ui.inline_picker import ftrack_connect_foundry.ui.workflow_relationship import ftrac...
the-stack_106_29830
# # Copyright (c) 2018 Bobby Noelte # # SPDX-License-Identifier: Apache-2.0 # from extract.globals import * from extract.directive import DTDirective ## # @brief Manage directives in a default way. # class DTDefault(DTDirective): def __init__(self): pass ## # @brief Extract directives in a defau...
the-stack_106_29831
# TODO deadline reminder for all students # Copyright (c) 2021 War-Keeper # This functionality provides various methods to manage reminders (in the form of creation, retrieval, updation and deletion) # A user can set up a reminder, check what is due this week or what is due today. He/She can also check all the due home...
the-stack_106_29832
# from importlib import reload # -*- coding:utf-8 -*- import os import json import threading import numpy as np from PIL import Image import tensorflow as tf from keras import losses from keras import backend as K from keras.utils import plot_model from keras.preprocessing import image from keras.preprocessing.sequenc...
the-stack_106_29835
from __future__ import print_function import time import zlib import errno import select import signal import logging import tempfile import threading import subprocess from agent_module import queue, noraise mod_name = "cli" __version__ = (1, 0) logger = logging.getLogger("agent.cli") class Proc(object): ...
the-stack_106_29836
import builtins import numpy as np from yt._maintenance.deprecation import issue_deprecation_warning from yt.config import ytcfg from yt.funcs import get_brewer_cmap, mylog from yt.units.yt_array import YTQuantity from yt.utilities import png_writer as pw from yt.utilities.exceptions import YTNotInsideNotebook from y...
the-stack_106_29837
# This file is part of the MapProxy project. # Copyright (C) 2010 Omniscale <http://omniscale.de> # # 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...
the-stack_106_29839
import asyncio import os from concurrent.futures import ThreadPoolExecutor from multiprocessing import Process from multiprocessing import Queue from typing import Callable from typing import Dict from typing import Any class Executor(): MAX_WORKERS = 10 processes = MAX_WORKERS or os.cpu_count() executor ...
the-stack_106_29840
from smilPython import * import time # Load an image imIn= Image("https://smil.cmm.minesparis.psl.eu/images/DNA_small.png") imThresh = Image(imIn) imDist = Image(imIn) imIn.show() imThresh.show() imDist.showLabel() def displMax(): print("Distance max value: " + str(rangeVal(imDist)[1])) links = lin...
the-stack_106_29841
## www.pubnub.com - PubNub Real-time push service in the cloud. # coding=utf8 ## PubNub Real-time Push APIs and Notifications Framework ## Copyright (c) 2010 Stephen Blum ## http://www.pubnub.com/ import sys from Pubnub import PubnubTornado as Pubnub publish_key = len(sys.argv) > 1 and sys.argv[1] or 'demo' subscri...
the-stack_106_29843
# ------------------------------------------------------------------------------ # Copyright (c) Microsoft # Licensed under the MIT License. # Written by Bin Xiao (Bin.Xiao@microsoft.com) # ------------------------------------------------------------------------------ from __future__ import absolute_import from __futu...
the-stack_106_29845
"""This module contains the general information for PkiTP ManagedObject.""" from ...ucscmo import ManagedObject from ...ucsccoremeta import UcscVersion, MoPropertyMeta, MoMeta from ...ucscmeta import VersionMeta class PkiTPConsts(): CERT_STATUS_CERT_CHAIN_TOO_LONG = "certChainTooLong" CERT_STATUS_EMPTY_CERT ...