filename
stringlengths
13
19
text
stringlengths
134
1.04M
the-stack_106_21499
import os import unittest import importlib import datetime import pytz import logging from django.test import TestCase from django.conf import settings from accounts.models import ( RcLdapUser, RcLdapGroup ) from accounts.models import User def assert_test_env(): """Helper method to verify that tests ar...
the-stack_106_21500
import random from datetime import datetime import zeeguu_core from zeeguu_core_test.model_test_mixin import ModelTestMixIn from zeeguu_core_test.rules.exercise_rule import ExerciseRule from zeeguu_core_test.rules.outcome_rule import OutcomeRule from zeeguu_core_test.rules.user_rule import UserRule from zeeguu_core.wo...
the-stack_106_21501
import pytest, allure from driver import startdriver from pageElements import lenovo_product_page from pageElements import lenovo_popup @allure.story('Testing Reevoo modules on Lenovo product page') class TestProductPage(): start_page = 'https://www.lenovo.com/gb/en/laptops/thinkpad/x-series/ThinkPad-X1-Carbon-6...
the-stack_106_21503
import functools import os import sqlite3 import threading import typing from pprint import pprint from core import utils, config from core.objects.annotation import Annotation from core.objects.book import Book from core.objects.file import File _threadlocal = threading.local() class DataExtractor: @classmeth...
the-stack_106_21507
import logging import traceback import uuid from collections import defaultdict import pymongo from blitzdb.backends.base import Backend as BaseBackend from blitzdb.backends.base import NotInTransaction from blitzdb.document import Document from blitzdb.helpers import delete_value, get_value, set_value from .queryse...
the-stack_106_21510
import os import yaml from yacs.config import CfgNode as CN _C = CN() # Base config files _C.BASE = [''] # ----------------------------------------------------------------------------- # Data settings # ----------------------------------------------------------------------------- _C.DATA = CN() # Batch size for a si...
the-stack_106_21511
# -*- coding: utf-8 -*- from __future__ import absolute_import, print_function, unicode_literals import io import os import re import shutil import sys import tempfile from typing import (Dict, Iterator, List, Match, Optional, # noqa Pattern, Union, TYPE_CHECKING, Text, IO, Tuple) import warnings ...
the-stack_106_21512
# script gets all Australian BoM weather station observations # ... and applies an interpolated temperature to all GNAF points in a 100m grid # TODO: # 1. remove temperature biases due to altitude differences # a. Add SRTM altitudes to GNAF # b. Add interpolated altitude from weather stations to GNAF # ...
the-stack_106_21514
import os import re import time from bs4 import BeautifulSoup import logging from gensim.models import word2vec import gensim from nltk.corpus import stopwords import nltk.data from sklearn.cluster import KMeans import time THIS_FILE_FOLDER = os.path.join(os.path.dirname(os.path.realpath(__file__))) NLTK_SAVE_DIR = o...
the-stack_106_21517
""" Plotting class to be used by Log. """ import time import numpy as nm from sfepy.base.base import Output, Struct def draw_data(ax, xdata, ydata, label, plot_kwargs, swap_axes=False): """ Draw log data to a given axes, obeying `swap_axes`. """ def _update_plot_kwargs(lines): plot_kwargs['co...
the-stack_106_21518
#!/usr/bin/env python import cv2 as cv import numpy as np import sys import rospy from std_msgs.msg import Int16 def servo_move_pub(): freq = 30 pub = rospy.Publisher('stepper', Int16, queue_size=10) rospy.init_node('stepper_move_pub', anonymous=False) rate = rospy.Rate(freq) # Frequency in Hz c...
the-stack_106_21519
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ create YOLOv3 models with different backbone & head """ import warnings from functools import partial import tensorflow.keras.backend as K from tensorflow.keras.layers import Input, Lambda from tensorflow.keras.models import Model from tensorflow.keras.optimizers impo...
the-stack_106_21520
import numpy as np import os from skimage.color import rgba2rgb from skimage.transform import resize, rescale LOOKUP = {'overflowed': 'bin_pos', 'bin other': 'bin_other', 'bin': 'bin_neg', 'ahead only': 'traffic_sign_ahead_only', 'caution children': 'traffic_sign_caution_childr...
the-stack_106_21521
"""Identify program versions used for analysis, reporting in structured table. Catalogs the full list of programs used in analysis, enabling reproduction of results and tracking of provenance in output files. """ from __future__ import print_function import os import contextlib import subprocess import sys import yaml...
the-stack_106_21522
# -*- coding: utf-8 -*- # This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any...
the-stack_106_21523
#! /usr/bin/env python # coding=utf-8 # Copyright (c) 2019 Uber Technologies, 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 # # Unles...
the-stack_106_21524
import sys, os try: import Queue as Queue except ImportError: import queue as Queue import multiprocessing import threading import zipfile from xml.dom.minidom import parseString from xml.sax.saxutils import escape import datetime, time import traceback import inspect import json import jam.common as common im...
the-stack_106_21525
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2015 Edgewall Software # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms # are also available at http://trac.edgewall.com/license.html. # # This s...
the-stack_106_21526
# -*- 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_21527
#!/usr/bin/env python3 # Copyright (c) 2014-2016 The Bitcoin Core developers # Copyright (c) 2018-2020 The Ion Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test node disconnect and ban behavior""" from test_f...
the-stack_106_21532
# -------------------------------------------------------- # DaSiamRPN # Licensed under The MIT License # Written by Qiang Wang (wangqiang2015 at ia.ac.cn) # -------------------------------------------------------- import cv2 import torch import numpy as np def to_numpy(tensor): if torch.is_tensor(tensor): ...
the-stack_106_21533
#%% #%matplotlib auto import numpy as np import matplotlib.pyplot as plt import sensor_fusion as sf import robot_n_measurement_functions as rnmf import pathlib import seaborn as sns import matplotlib.patches as mpatches from scipy.linalg import expm import lsqSolve as lsqS import pathlib sns.set() #%% parent_path = pat...
the-stack_106_21535
# 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 ...
the-stack_106_21536
# Copyright 2014 OpenStack Foundation # # 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 ...
the-stack_106_21539
import sys import pytest import logging from sentry_sdk.integrations.logging import LoggingIntegration other_logger = logging.getLogger("testfoo") logger = logging.getLogger(__name__) @pytest.fixture(autouse=True) def reset_level(): other_logger.setLevel(logging.DEBUG) logger.setLevel(logging.DEBUG) @pyt...
the-stack_106_21542
from .test import BaseTest, ValidatorError import random class Test_Region_Pixels(BaseTest): label = 'Region specified by pixels' level = 1 category = 2 versions = [u'1.0', u'1.1', u'2.0', u'3.0'] validationInfo = None def run(self, result): try: match = 0 for i...
the-stack_106_21544
from datetime import datetime from unittest import mock from requests_mock import Mocker import pytest from pyairtable import Table from pyairtable.orm import Model from pyairtable.orm import fields as f def test_model_missing_meta(): with pytest.raises(ValueError): class Address(Model): str...
the-stack_106_21546
# !/usr/bin/python # Copyright 2017 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 by...
the-stack_106_21550
import KratosMultiphysics as km import KratosMultiphysics.KratosUnittest as UnitTest import KratosMultiphysics.kratos_utilities as kratos_utilities from KratosMultiphysics.RANSApplication.test_utilities import RunParametricTestCase class FlowSolverTestCase(UnitTest.TestCase): @classmethod def setUpCase(cls, w...
the-stack_106_21551
from flask import Flask, request, redirect, g, render_template, make_response, session, url_for from datetime import datetime, timedelta, date from pytz import timezone import urllib import urllib.parse import secrets import string import requests from urllib.parse import urlencode import json import base64 from os imp...
the-stack_106_21552
"""Plots class-activation maps (CAM).""" import numpy from gewittergefahr.gg_utils import grids from gewittergefahr.gg_utils import error_checking DEFAULT_CONTOUR_WIDTH = 2 DEFAULT_CONTOUR_STYLE = 'solid' def plot_2d_grid( class_activation_matrix_2d, axes_object, colour_map_object, min_contour_level...
the-stack_106_21553
# Copyright 2019 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, ...
the-stack_106_21554
#!/usr/bin/env python3 # Copyright (c) 2014-2020 The Ocvcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Helpful routines for regression testing.""" from base64 import b64encode from binascii import unhexlif...
the-stack_106_21555
from django.shortcuts import render, redirect, get_object_or_404 from blog.models import Company, City, Meeting, UserNorm, PhoneCalls, Activity from django.db.models import Q from blog.forms import PostForm, PlanPhoneCallForm, ActivityForm from django.contrib import messages from django.contrib.auth import login, logou...
the-stack_106_21559
import py from pypy.tool.bench.pypyresult import ResultDB, BenchResult import pickle def setup_module(mod): mod.tmpdir = py.test.ensuretemp(__name__) def gettestpickle(cache=[]): if cache: return cache[0] pp = tmpdir.join("testpickle") f = pp.open("wb") pickle.dump({'./pypy-llvm-39474-O...
the-stack_106_21560
# # tests/test_http_request.py # import pytest import growler from unittest import mock @pytest.fixture def rt(): return growler.middleware.ResponseTime() @pytest.fixture def req(): return mock.MagicMock() @pytest.fixture def res(): m = mock.MagicMock() m.headers = [] return m def test_stan...
the-stack_106_21561
import scipy.misc import random xs = [] ys = [] #points to the end of the last batch train_batch_pointer = 0 val_batch_pointer = 0 #read data.txt with open("driving_dataset/data.txt") as f: for line in f: xs.append("driving_dataset/" + line.split()[0]) #the paper by Nvidia uses the inverse of the...
the-stack_106_21562
#!/usr/bin/env python # -*- no-plot -*- """ Calculate Mandelbrot set using OpenCL """ import pyopencl as cl from timeit import default_timer as timer import numpy as np import gr platform = cl.get_platforms() gpu_devices = platform[0].get_devices(device_type=cl.device_type.GPU) info_value = gpu_devices[0].get_info...
the-stack_106_21563
from random import random import numpy as np from math import sqrt class Blob(object): """Blob is the creature that is evolving in this simulation""" def __init__(self, x, y, speed, size, energy, sense, name='000'): self.speed = speed self.size = size self.energy = energy self.sense = sense self.food = 0 ...
the-stack_106_21565
import json import os from flask import Blueprint from flask import current_app from flask import redirect from flask import render_template from flask import url_for from flask_login import login_required from modules.box__default.settings.helpers import get_setting from modules.box__default.settings.helpers import s...
the-stack_106_21567
########################################################################## # # pgAdmin 4 - PostgreSQL Tools # # Copyright (C) 2013 - 2017, The pgAdmin Development Team # This software is released under the PostgreSQL Licence # ########################################################################## import simplejson...
the-stack_106_21568
#!/usr/bin/env python import os import re import fire pre_release_placeholder = 'SNAPSHOT' version_filepath = os.path.join('.', 'VERSION.txt') version_pattern = re.compile(fr'^\d+.\d+.\d+(-{pre_release_placeholder})?$') def get(with_pre_release_placeholder: bool = False): with open(version_filepath, 'r') as ve...
the-stack_106_21571
# coding=utf-8 # Copyright 2018 The TF-Agents 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 applicable law...
the-stack_106_21572
from ..check import Check _REQUIRED_FIELDS = set(['description']) _OPTIONAL_FIELDS = set([ 'author', 'es5id', 'es6id', 'esid', 'features', 'flags', 'includes', 'info', 'locale', 'negative', 'timeout' ]) _VALID_FIELDS = _REQUIRED_FIELDS | _OPTIONAL_FIELDS class CheckFrontmatter(Check): '''Ensure tests have...
the-stack_106_21573
# Copyright 2013 OpenStack Foundation # # 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...
the-stack_106_21574
# Copyright 2016 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...
the-stack_106_21575
#!/usr/bin/python3 import pygame import os from Target import * class Tracks(pygame.sprite.Sprite, Target): def __init__(self,x,y): pygame.sprite.Sprite.__init__(self) Target.__init__(self, False,'tracks') self.image= pygame.image.load(os.path.join('Images','tracks.png')).convert_alpha() ...
the-stack_106_21576
class CollectionFinder: def __init__(self, tokens, intents, filters_intent): self.tokens = tokens self.intents = intents self.filters_intent = filters_intent self.score = 0 def collection(self): query_collection = None # Format user query collection = ne...
the-stack_106_21577
# -*- coding: utf-8 -*- # !/usr/bin/env python # Based on MS-OXMSG protocol specification # ref: https://blogs.msdn.microsoft.com/openspecification/2010/06/20/msg-file-format-rights-managed-email-message-part-2/ # ref: https://msdn.microsoft.com/en-us/library/cc463912(v=EXCHG.80).aspx import email import json import os...
the-stack_106_21578
import matplotlib.pyplot as plt import numpy as np import pandas as pd import matplotlib.ticker as mtick from matplotlib.collections import LineCollection ############################################################################### #Non-Standard Imports #######################################...
the-stack_106_21579
from unittest import TestCase from unittest.mock import MagicMock, patch import logging import trafaret from smtpush import validate, redis_receiver, sendmail class TestSMTPush(TestCase): def test_validate_errors(self): with self.assertRaises(trafaret.DataError): validate({}) with s...
the-stack_106_21581
# Copyright 2019 Alexander L. Hayes """ Clean individual variables. """ import logging import numpy as np LOGGER = logging.getLogger(__name__) class VariableCleaner: """ Clean individual variables in-place. """ def __init__(self, data_frame): self.frame = data_frame def clean(self, op...
the-stack_106_21584
"""Functions for authenticating, and several alternatives for persisting credentials. Both auth and reauth functions require the following kwargs: client_id client_secret base_url """ import datetime import httplib2 import json default_expires_in = 900 _datetime_format = "%Y-%m-%d %H:%M:%S" # assume UT...
the-stack_106_21585
#coding:utf-8 import numpy as np import tensorflow as tf from .Model import Model import logging l1 = logging.getLogger('root') l1.setLevel(logging.WARNING) # l1.setLevel(logging.DEBUG) gv_log = logging.FileHandler('y_and_res.log') gv_log.setLevel(logging.DEBUG) l1.addHandler(gv_log) class ComplEx_freeze(Model): ...
the-stack_106_21586
# Copyright 2016-2020 The GPflow Contributors. 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...
the-stack_106_21587
#! /usr/bin/env python3 # -*- coding: utf-8 -*- # # Turku University (2018) Department of Future Technologies # Foresail-1 / PATE Monitor / Middleware (PMAPI) # PSU controller daemon # # control.py - Jani Tammi <jasata@utu.fi> # 0.1 2018.11.14 Initial version. # 0.2 2018.11.18 Added status. # 0.3 20...
the-stack_106_21593
n = int(input()) tree = list(map(int,input().split())) tree.sort() tree.reverse() x = 0 for i in range(2,n+2): t = tree[i-2]+i if t>x: x=t print(x)
the-stack_106_21597
import unittest import numpy from eig.battleship import Ship, BattleshipHypothesis, \ Parser, Executor from eig.battleship.program import ProgramSyntaxError class TestParser(unittest.TestCase): def test_parse_basic(self): question = Parser.parse("(== (color 1-1) Blue)") reference ...
the-stack_106_21598
#!/usr/bin/env python """ Benchmark script to measure time taken to set values using a variety of different methods (set, set_bulk). """ import os, sys sys.path.insert(0, os.path.dirname(os.path.dirname(__file__))) import contextlib import time from ukt import * server = EmbeddedServer(quiet=True) server.run() db ...
the-stack_106_21599
""" ======================== Merge moves with HDP-HMM ======================== How to try merge moves efficiently for time-series datasets. This example reviews three possible ways to plan and execute merge proposals. * try merging all pairs of clusters * pick fewer merge pairs (at most 5 per cluster) in a size-bias...
the-stack_106_21600
''' Setup.py for creating a binary distribution. ''' from __future__ import print_function from setuptools import setup, Extension from setuptools.command.build_ext import build_ext try: import subprocess32 as subprocess except ImportError: import subprocess from os import environ from os.path import dirname,...
the-stack_106_21601
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function from sqlalchemy import Integer, Column, ForeignKey, Sequence, String, Date, Unicode from sqlalchemy.orm import relationship, subqueryload from json import JSONEncoder import regex from . import Base class ORMEncoder(JSONEncoder): ...
the-stack_106_21602
import json import os import base64 import datetime import hashlib import copy import itertools import codecs import random import string import tempfile import threading import pytz import sys import time import uuid from bisect import insort from importlib import reload from moto.core import ( ACCOUNT_ID, Ba...
the-stack_106_21604
A='HamzaShabbirisCool' stack_Memory=[] Reverse_stack=[] b='' for i in range(len(A)): # pushing into stack stack_Memory.append(A[i]) print(stack_Memory) for i in range(len(stack_Memory)): # popping from stack Reverse_stack.append(stack_Memory.pop()) print(stack_Memory) print(Reverse_stack) b=b.join...
the-stack_106_21605
# 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
the-stack_106_21606
"""modelos actualizado Revision ID: 175c80bee699 Revises: None Create Date: 2016-05-19 10:38:47.632650 """ # revision identifiers, used by Alembic. revision = '175c80bee699' down_revision = None from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto generated by Alembic - please adjus...
the-stack_106_21609
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # "Timer" - a chapter of "The Fuzzing Book" # Web site: https://www.fuzzingbook.org/html/Timer.html # Last change: 2021-06-02 17:56:35+02:00 # # Copyright (c) 2021 CISPA Helmholtz Center for Information Security # Copyright (c) 2018-2020 Saarland University, authors, and ...
the-stack_106_21610
from .libcrocoddyl_pywrap import * from .libcrocoddyl_pywrap import __version__ from .deprecation import * import pinocchio import numpy as np import time import warnings def rotationMatrixFromTwoVectors(a, b): a_copy = a / np.linalg.norm(a) b_copy = b / np.linalg.norm(b) a_cross_b = np.cross(a_copy, b_c...
the-stack_106_21612
"""Support for AdGuard Home.""" from __future__ import annotations import logging from typing import Any from adguardhome import AdGuardHome, AdGuardHomeConnectionError, AdGuardHomeError import voluptuous as vol from homeassistant.components.adguard.const import ( CONF_FORCE, DATA_ADGUARD_CLIENT, DATA_AD...
the-stack_106_21614
import asyncio import discord import random import socket import logging import datetime import time import inspect import traceback import yaml import shutil import os import re try: import pip._internal as pip # pip 10 compat except: import pip from logging.handlers import RotatingFileHandler from distutil...
the-stack_106_21615
# Copyright 2020 The TensorFlow Ranking 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 applicable law or ag...
the-stack_106_21616
import pytest import dask import dask.multiprocessing from dask import persist import numpy as np import dask.array as da from dask_glm.algorithms import (newton, lbfgs, proximal_grad, gradient_descent, admm) from dask_glm.families import Logistic, Normal, Poisson from dask_glm.regula...
the-stack_106_21617
#!/usr/bin/env python # -*- coding: utf-8 -*- import os from pathlib import Path from itertools import product, chain from operator import add, sub import numpy as np import tensorflow as tf from dotenv import load_dotenv from annotation.piece import Piece from annotation.direction import (Direction, get_eight_direc...
the-stack_106_21618
# -------------------------------------------------------- # Flow-Guided Feature Aggregation # Copyright (c) 2016 by Contributors # Copyright (c) 2017 Microsoft # Licensed under The Apache-2.0 License [see LICENSE for details] # Modified by Yuwen Xiong # -------------------------------------------------------- import ...
the-stack_106_21619
import logging import voluptuous as vol from homeassistant.helpers import config_validation as cv from .const import DOMAIN, LANGUAGE_CODES from .model.kind import TraktKind def build_config_schema(): return vol.Schema( {DOMAIN: build_config_domain_schema()}, extra=vol.ALLOW_EXTRA, ) def b...
the-stack_106_21620
#!/usr/bin/env python """ SlipStream Client ===== Copyright (C) 2014 SixSq Sarl (sixsq.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/LICENSE-...
the-stack_106_21621
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012 Cloudbase Solutions Srl # # 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/LICE...
the-stack_106_21622
import nltk import nltk.tokenize as nltk_tokenize from nltk.stem import WordNetLemmatizer from nltk.corpus import stopwords, wordnet from typing import List from collections import Counter import itertools from threading import Lock import unicodedata import sys import string import datetime unicode_punctuation = ''.j...
the-stack_106_21623
# pylint: disable=missing-function-docstring import unittest from unittest.mock import MagicMock from dealership_review.core.review_sorter import sort_reviews, SortType class TestSortReviews(unittest.TestCase): """ Tests for the sort_review function """ def setUp(self) -> None: self.highest...
the-stack_106_21624
import _plotly_utils.basevalidators class ColorValidator(_plotly_utils.basevalidators.ColorValidator): def __init__(self, plotly_name="color", parent_name="contourcarpet.line", **kwargs): super(ColorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, ...
the-stack_106_21625
from pathlib import Path import os import shutil class Node: def __init__(self, filename): self.filename = filename self.items = [] def number_prefix(int): result = str(int) + "_" if int < 10: result = "0" + result return result # return an array of Nodes that are included in page's ToC...
the-stack_106_21628
from collections import Counter class Solution: def minWindow(self, s, t): """ :type s: str :type t: str :rtype: str """ n = len(s) start = end = 0 dict_t = Counter(t) missing = sum(dict_t.values()) dict_s = {} min_distance, sub...
the-stack_106_21630
import os import numpy as np import json import sys # Root directory of the project ROOT_DIR = os.path.abspath("../../") # sys.path.append(ROOT_DIR) from guv import GUVDataset, GUVConfig from frcnn.utils import extract_bboxes import frcnn.model as modellib import frcnn.utils as utils # Directory to save logs and m...
the-stack_106_21631
import inspect import json import os from copy import deepcopy import empty_files def get_adjacent_file(name: str) -> str: calling_file = inspect.stack(1)[1][1] directory = os.path.dirname(os.path.abspath(calling_file)) filename = os.path.join(directory, name) return filename def write_to_temporary_...
the-stack_106_21633
import requests import csv from bs4 import BeautifulSoup url = "http://api.irishrail.ie/realtime/realtime.asmx/getCurrentTrainsXML" page = requests.get(url) soup = BeautifulSoup(page.content, 'xml') retrieveTags=['TrainStatus', 'TrainLatitude', 'TrainLongitude', 'TrainCode', ...
the-stack_106_21634
"""Secrets Provider for AWS Secrets Manager.""" import base64 import json try: import boto3 from botocore.exceptions import ClientError except (ImportError, ModuleNotFoundError): boto3 = None from django import forms from nautobot.utilities.forms import BootstrapMixin from nautobot.extras.secrets import...
the-stack_106_21635
from datetime import datetime, date, timedelta from django.test import TestCase from selvbetjening.core.user.models import SUser from selvbetjening.core.events.models import Attend, Event, OptionGroup from selvbetjening.core.events.options.dynamic_selections import dynamic_selections_form_factory, _pack_id, SCOPE, \ ...
the-stack_106_21639
import json import codecs MENU_INDENTATION_LEVEL = 4 def get_menu_item_by_id(menu_list, menu_id): menu = [menu for menu in menu_list if menu['id'] == menu_id] return menu[0] def build_tree_string(menu_id, title, indent_level, options, tree_trunk="", program_name=""): if indent_level != 0: inden...
the-stack_106_21640
### ENVIRONMENT ==== ### . modules ---- import openeo import georaster import matplotlib.pyplot as plt import numpy as np ### . openeo ---- connection = openeo.connect("https://openeo.vito.be").authenticate_basic("test", "test123") ### PROCESSING ==== ### . ndwi ---- sentinel2_data_cube = connection.load_col...
the-stack_106_21645
from pygments.style import Style from pygments.token import ( Comment, Error, Keyword, Literal, Name, Number, Operator, String, Text ) class Base16Style(Style): base00 = '#001100' base01 = '#003300' base02 = '#005500' base03 = '#007700' base04 = '#009900' base05 = '#00bb00' base06 = '#...
the-stack_106_21647
#!/usr/bin/env python3 from itertools import combinations import pickle from random import choice, shuffle from remi import gui, start, App from survey_utils import (ExperimentType, User, Experiment, TlxComponent, Tlx, Question, Survey) class MyApp(App): def __init__(self, *args): ...
the-stack_106_21649
import pandas as pd import numpy as np def construct_freq_df(df_copy): ''' Construct a dataframe such that indices are seperated by delta 1 min from the Market Data and put it in a format that markov matrices can be obtained by the pd.crosstab() method ''' #This is here in case user passes the...
the-stack_106_21650
# This file helps to compute a version number in source trees obtained from # git-archive tarball (such as those provided by githubs download-from-tag # feature). Distribution tarballs (build by setup.py sdist) and build # directories (produced by setup.py build) will contain a much shorter file # that just contains t...
the-stack_106_21651
from . import Databricks class Dashboards(Databricks.Databricks): def __init__(self, url, token=None): super().__init__(token) self._url = url self._api_type = 'preview/sql' def listDashboards(self, page_size=None, page=None, order=None, q=None): if order and (order not in ("name", "created_at")): ...
the-stack_106_21652
# # Copyright 2021 W. Beck Andrews # # MIT License # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge...
the-stack_106_21657
#!/usr/bin/env python ##################################################################################### # # Copyright 2022 Quantinuum # # 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 htt...
the-stack_106_21658
from pandac.PandaModules import * from direct.showbase.DirectObject import DirectObject from direct.interval.IntervalGlobal import * from direct.distributed.ClockDelta import globalClockDelta from direct.distributed.ClockDelta import NetworkTimePrecision import random from direct.task.Task import Task from direct.direc...
the-stack_106_21659
import argparse import rebuild_categories as rbldc_ctg import render_categories as rndr_ctg # Definition of arguments program parser = argparse.ArgumentParser(description='An eBay category tree displayer') parser.add_argument('--rebuild', action='store_true', default=False, \ help='Downloads a category tree from eBay...
the-stack_106_21660
# Copyright 2020 MONAI Consortium # 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...
the-stack_106_21663
''' Created on Apr 15, 2016 Evaluate the performance of Top-K recommendation: Protocol: leave-1-out evaluation Measures: Hit Ratio and NDCG (more details are in: Xiangnan He, et al. Fast Matrix Factorization for Online Recommendation with Implicit Feedback. SIGIR'16) @author: hexiangnan ''' import math imp...