filename
stringlengths
13
19
text
stringlengths
134
1.04M
the-stack_106_18496
#!/usr/local/sbin/charm-env python3 # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2....
the-stack_106_18497
import os import pytest def test_list_command(script, data): """ Test default behavior of list command. """ script.pip( 'install', '-f', data.find_links, '--no-index', 'simple==1.0', 'simple2==3.0', ) result = script.pip('list') assert 'simple (1.0)' in result.stdout, str(...
the-stack_106_18498
# Copyright 2016 Canonical 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 in writing, s...
the-stack_106_18500
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright (c) 2020 OpenStack Foundation # 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.apac...
the-stack_106_18501
""" Incident Update Web Controller """ # Standard Library import os import markdown2 # Third Party Library from django.views import View from django.http import Http404 from django.shortcuts import render from django.utils.translation import gettext as _ # Local Library from app.modules.core.context import Context f...
the-stack_106_18502
"""Support for Freedompro climate.""" import json import logging from pyfreedompro import put_state from homeassistant.components.climate import ClimateEntity, ClimateEntityFeature from homeassistant.components.climate.const import ( ATTR_HVAC_MODE, HVAC_MODE_COOL, HVAC_MODE_HEAT, HVAC_MODE_OFF, ) fro...
the-stack_106_18503
# need a dict to set bloody .name field from io import BytesIO import logging import os import stat from unittest import SkipTest import uuid import git from git.cmd import Git from git.compat import ( string_types, defenc, is_win, ) from git.config import ( SectionConstraint, GitConfigParser, ...
the-stack_106_18504
#! usr/bin/python3 # -*- coding: utf-8 -*- # # Flicket - copyright Paul Bourne: evereux@gmail.com import os import string import random from flask import flash from werkzeug.utils import secure_filename from application import app, db from application.flicket.models.flicket_models import FlicketUploads from applicat...
the-stack_106_18505
from flask import Blueprint, jsonify from limbook_api.v1.auth.utils import requires_auth from limbook_api.v1.comments import Comment from limbook_api.v1.posts import Post stats = Blueprint('stats', __name__) # ==================================== # SECURE ROUTES # ==================================== @stats.route("...
the-stack_106_18511
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. # Set up custom environment before nearly anything else is imported # NOTE: this should be the first import (no not reorder) from maskrcnn_benchmark.utils.env import setup_environment # noqa F401 isort:skip import argparse import os import torch...
the-stack_106_18512
# (C) Datadog, Inc. 2018-present # All rights reserved # Licensed under Simplified BSD License (see LICENSE) import copy import logging import os from datadog_checks.base.stubs.aggregator import AggregatorStub from datadog_checks.base.utils.common import get_docker_hostname from datadog_checks.dev.docker import get_c...
the-stack_106_18513
from planner.frame.figure import Figure from planner.frame.aperture import Aperture from planner.frame.bulkhead import Bulkhead from svgwrite import shapes class RectFrame(Figure): """ Rectangle frame representation """ DEFAULT_PARAMS = {"stroke": "#000", "stroke-width": "2"} def __init__(self, x=0, y=...
the-stack_106_18514
# Copyright (c) 2020 Graphcore Ltd. All rights reserved. """Tutorial code to play around with graph recompilation and executable loading Parameters to play around with are CACHING, NOMULTISESSION, PLACEHOLDER, and SAMEBATCH. Some comments in the document refer to the underlying tutorial in the documentation portal. T...
the-stack_106_18515
#!/usr/bin/env python import os import sys import signal CURDIR = os.path.dirname(os.path.realpath(__file__)) sys.path.insert(0, os.path.join(CURDIR, 'helpers')) from client import client, prompt, end_of_block log = None # uncomment the line below for debugging #log=sys.stdout with client(name='client1>', log=log) ...
the-stack_106_18516
from django.contrib.auth import get_user_model from rest_framework import status from rest_framework.decorators import action from rest_framework.parsers import FormParser, JSONParser, MultiPartParser from rest_framework.permissions import AllowAny, IsAuthenticated from rest_framework.response import Response from bas...
the-stack_106_18522
from __future__ import annotations import logging from config import get_config, ConfigurationError, msgbox from split_export import get_files, ExportFile from repo import RepositorySourceItem from convert import setup_session, cleanup as cleanup_convert, convert from deployment import add_deployment def main(): ...
the-stack_106_18525
"""Tools for working with Q (Forbes) polynomials.""" # not special engine, only concerns scalars here from collections import defaultdict from scipy import special from .jacobi import jacobi, jacobi_sequence from prysm.mathops import np, kronecker, gamma, sign def g_qbfs(n_minus_1): """g(m-1) from oe-18-19-1970...
the-stack_106_18528
import numpy as np import seaborn as sns from matplotlib.colorbar import cm def color_picker(palette, center='light', n_colors=10, show=False): '''COLOR PICKER Provides access to several color palettes that will serve the purpose of most usecases with astetik plots. PARAMETERS ---------- pal...
the-stack_106_18531
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Mar 6 20:36:02 2020 @author: atekawade """ import numpy as np import os import sys from ct_segnet.data_utils import data_io import argparse from argparse import ArgumentTypeError from tqdm import tqdm import ast from shutil import rmtree import time ...
the-stack_106_18533
#!/usr/bin/python # -*- coding: utf-8 -*- ################################################################################ # # RMG - Reaction Mechanism Generator # # Copyright (c) 2002-2010 Prof. William H. Green (whgreen@mit.edu) and the # RMG Team (rmg_dev@mit.edu) # # Permission is hereby granted, free of c...
the-stack_106_18535
#!/usr/bin/python # @lint-avoid-python-3-compatibility-imports # # profile Profile CPU usage by sampling stack traces at a timed interval. # For Linux, uses BCC, BPF, perf_events. Embedded C. # # This is an efficient profiler, as stack traces are frequency counted in # kernel context, rather than passing ever...
the-stack_106_18537
# uncompyle6 version 3.2.0 # Python bytecode 2.4 (62061) # Decompiled from: Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)] # Embedded file name: pirates.teleport.InteriorDoorTeleportActorOV from pirates.piratesbase import PiratesGlobals from pirates.teleport.DoorTeleportActorOV im...
the-stack_106_18538
#!/usr/bin/env python # Test whether a valid CONNECT results in the correct CONNACK packet using an SSL connection. import socket import ssl import sys if sys.version < '2.7': print("WARNING: SSL not supported on Python 2.6") exit(0) import inspect, os # From http://stackoverflow.com/questions/279237/python...
the-stack_106_18539
import os import numpy as np from pynif3d.common.verification import check_path_exists, check_pos_int def load_pose_from_file(filename): check_path_exists(filename) pose = np.loadtxt(filename) pose = pose.reshape([4, 4]).astype(np.float32) return pose def load_poses_from_dir(poses_dir): check...
the-stack_106_18540
""" This module extends the folium Map class. It is designed to be used in Google Colab, as Google Colab currently does not support ipyleaflet. """ import os import ee import folium from folium import plugins from .common import * from .conversion import * from .legends import builtin_legends # More WMS basemaps can ...
the-stack_106_18542
from __future__ import absolute_import, division, print_function import os os.environ["CDF_LIB"] = "/usr/local/cdf" from spacepy import pycdf import numpy as np import h5py as h5 import re from glob import glob from tqdm import tqdm dataset = 'Human36' subjects = ['S1', 'S5', 'S6', 'S7', 'S8', 'S9', 'S11'] cameras =...
the-stack_106_18548
tests = [ ("python", "UnitTestFingerprints.py", {}), ("python", "UnitTestSimScreener.py", {}), ("python", "DbFpSupplier.py", {}), ] longTests = [] if __name__ == '__main__': import sys from rdkit import TestRunner failed, tests = TestRunner.RunScript('test_list.py', 0, 1) sys.exit(len(failed))
the-stack_106_18549
#!/usr/bin/env python3 # Copyright (c) 2018 The Libra Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Verify that starting libra with -h works as expected.""" from test_framework.test_framework import LibraTestF...
the-stack_106_18550
""" BSD 3-Clause License Copyright (c) 2019, Steven F. Hoover All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of con...
the-stack_106_18551
""" UBXReader class. Reads and parses individual UBX or NMEA messages from any stream which supports a read(n) -> bytes method. Returns both the raw binary data (as bytes) and the parsed data (as a UBXMessage or NMEAMessage object). 'protfilter' governs which protocols (NMEA and/or UBX) are processed 'quit...
the-stack_106_18554
import numpy as np import pytest import subprocess import sys from ...test.test_integrate import bwf_file def test_dump_axml(tmpdir): filename = str(tmpdir / 'test_axml.wav') axml = b"AXML" from ...fileio import openBw64 with openBw64(filename, 'w', axml=axml) as outfile: outfile.write(np.ze...
the-stack_106_18555
# coding: utf-8 """ This module contains task manager. """ from __future__ import absolute_import # Standard imports from multiprocessing.pool import ThreadPool import sys from traceback import format_exc class TaskManager(object): """ Task manager that manages a thread pool. It is used to run hotkey \ f...
the-stack_106_18556
#! /usr/bin/env python ############################################################################### # gmaps_directions.py # # Simple script to get directions using the Google Maps API # # Requires # * Python client library for Google Maps API Web Services to be installed # - https://github.com/googlemaps/google...
the-stack_106_18559
"""Classes for VeSync Switch Devices.""" import logging import json from abc import ABCMeta, abstractmethod from typing import Dict, Union from pyvesync.helpers import Helpers as helpers from pyvesync.vesyncbasedevice import VeSyncBaseDevice logger = logging.getLogger(__name__) feature_dict: Dict[str, Dict[str, Uni...
the-stack_106_18560
import glob import os from datetime import datetime import logging from libs import BNB_DATE_FORMAT logger = logging.getLogger("utils") def list_statement_files(dir, file_extension): statement_files = [] if not os.path.exists(dir): raise Exception(f"Statement directory[{dir}] doesn't exists.") ...
the-stack_106_18561
# -*- coding: utf-8 -*- """ Created on Wed Jun 10 19:00:23 2020 @author: ahmad """ # Cyclic rotation # param A, array # param K, intereger number of rotation def solution(A, K): try: for n in range(K,0,-1): temp = A[len(A)-1] for j in range(len(A)-1,0,-1): A[j] = A[...
the-stack_106_18562
#! /usr/bin/python3 import nltk import pdb import pickle import pandas as pd import numpy as np import json stemmer = nltk.stem.porter.PorterStemmer() stop_words = set(nltk.corpus.stopwords.words('english')) def is_alphanumeric(character): to_ord = ord(character) is_alpha = (to_ord >= ord('A') and to_ord <= o...
the-stack_106_18564
import os import sys import autograd.scipy.stats import autograd.scipy as sp import autograd.numpy as np from autograd import grad, jacobian, elementwise_grad base_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "../..") sys.path.append(base_dir) EPS = 1e-8 from src.contextualmodelings.base import Cont...
the-stack_106_18565
import pyaudio filename = "/home/pi/mytest.wav" FORMAT = pyaudio.paInt16 CHANNELS = 1 RATE = 8000 CHUNK = 1024 RECORD_SECONDS=10 audio = pyaudio.PyAudio() # start Recording stream = audio.open(format=FORMAT, channels=CHANNELS, rate=RATE, input=True, frames_per_buffer=CHUNK) frames...
the-stack_106_18566
#!/usr/bin/env python # # display live code coverage of DACMAN Colecovision game running in MAME # drawn as Hilbert curve # # $ mame -v coleco -video soft -cart /path/to/DACMAN.ROM -window -nomax -resolution 560x432 -debugger gdbstub -debug # $ ./dacman_live_hilbert /path/to/DACMAN.ROM # import os import sys import ma...
the-stack_106_18567
from __future__ import (division, absolute_import, print_function, unicode_literals) import os import numpy as np import gzip import os.path import nltk import logging from nltk import FreqDist from .WordEmbeddings import wordNormalize from .CoNLL import readCoNLL import sys if (sys.version_info > (3, 0)): import...
the-stack_106_18568
#!/usr/bin/env python ############################################################################## # Copyright (c) 2015 Huawei Technologies Co.,Ltd and other. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompani...
the-stack_106_18570
# Import my solver Code from solver import * #Creating a list to hold the levels and answers of Sudoku board list_lvl = ['easy','normal','hard','answer'] for level in list_lvl: print("Im starting with " + level + " boards") #Open file stream of the respective level sudoku filename = level.capit...
the-stack_106_18571
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not ...
the-stack_106_18572
#!/usr/bin/python # Copyright (c) 2020, 2022 Oracle and/or its affiliates. # This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license. # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # Apache License v2.0 # See LICENSE.TXT for d...
the-stack_106_18573
""" This module has functions to help processing the data from PacketIn and PacketOut. """ from pyof.foundation.basic_types import BinaryData from libs.tcpiplib.packet import Ethernet, VLAN, IP, TCP, LLDP, ARP, OessFvd def dissect_data(data, start=0): """ This function aims to dissect PacketIn a...
the-stack_106_18574
""" Don't see the standings during the contest!!! you will lose motivation. """ # ---------------------------------------------------Import Libraries--------------------------------------------------- import sys import time import os from math import sqrt, log, log2, ceil, log10, gcd, floor, pow, sin, cos, tan, pi...
the-stack_106_18575
# coding=utf-8 # MIT License # Copyright (c) 2020 Carnegie Mellon University, Auton Lab # 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_18577
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
the-stack_106_18578
"""A time estimator by running TensorFlow operators.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import time import logging import tensorflow as tf import numpy as np from six.moves import range from paleo.profilers.base import BaseProfiler, TimeMe...
the-stack_106_18579
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft and 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-stack_106_18580
from setuptools import setup with open('requirements.txt') as fp: requirements = fp.read().splitlines() setup( name='mrkd', description='Write man pages using Markdown, and convert them to Roff or HTML', version='0.1.3', author='Ryan Gonzalez', author_email='rymg19@gmail.com', license='B...
the-stack_106_18581
import lvgl as lv def set_value(bar, v): bar.set_value(v, lv.ANIM.OFF) def event_cb(e): dsc = lv.obj_draw_part_dsc_t.__cast__(e.get_param()) if dsc.part != lv.PART.INDICATOR: return obj= e.get_target() label_dsc = lv.draw_label_dsc_t() label_dsc.init() # label_dsc.font = LV_FONT_...
the-stack_106_18583
from openpyxl.descriptors.serialisable import Serialisable from openpyxl.descriptors import ( Typed, Integer, NoneSet, Set, Float, Bool, DateTime, String, Alias, Bool, Sequence, ) from openpyxl.descriptors.excel import ExtensionList, Relation from openpyxl.descriptors.nested...
the-stack_106_18584
from django.core.management.base import BaseCommand, CommandError from pybb import compat from pybb.models import Forum class Command(BaseCommand): help = "Set and remove moderator to all forums" args = "{add|del} username" def handle(self, *args, **kwargs): if len(args) != 2: raise ...
the-stack_106_18585
#!/usr/bin/env python # # Copyright 2007 Google 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 o...
the-stack_106_18587
import os import dash import dash_core_components as dcc import dash_html_components as html import pytest import pandas as pd import numpy as np from dash.dependencies import Input, Output from dash.testing.wait import until @pytest.mark.parametrize( "fmt", ("csv", "json", "html", "feather", "parquet", "stata"...
the-stack_106_18589
from django.contrib.auth.decorators import login_required from django.http import HttpResponse from django.shortcuts import render from bootcamp.activities.models import Notification from bootcamp.decorators import ajax_required @login_required def notifications(request): user = request.user notif...
the-stack_106_18590
import numpy as np from mpl_toolkits.basemap import Basemap import matplotlib as mpl import matplotlib.pylab as plt from mypy.grid_toolkit import shiftgrid from PySHTOOLS import SHExpandDH, MakeGrid2D from __init__ import * def test1(): mpl.rcParams['contour.negative_linestyle'] = 'solid' data = np.loadtx...
the-stack_106_18591
#!/bin/env python # -*- coding: utf-8 -*- ## # test_problem.py: Checks correctness of azure.quantum.optimization module. ## # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. ## import unittest from unittest.mock import Mock, patch from typing import TYPE_CHECKING from azure....
the-stack_106_18592
import torch.nn as nn import torch import torch.nn.functional as F class CpyAndW(nn.Module): def __init__(self, num_heads, seq_length, sample_length): super(CpyAndW, self).__init__() self.num_heads = num_heads self.seq_length = seq_length self.downsample = nn.Linear(seq_length,samp...
the-stack_106_18593
from numpy import log, outer, sqrt, zeros from numpy.random import shuffle from cogent3.format.table import formatted_cells, rich_html, simple_format from cogent3.maths.stats import chisqprob from cogent3.maths.stats.test import G_fit, G_ind from cogent3.util.dict_array import DictArray, DictArrayTemplate __author__...
the-stack_106_18594
import logging import logging.handlers def setup_logger(logger_name, log_file, level=logging.DEBUG): logger = logging.getLogger(logger_name) formatter = logging.Formatter("[%(levelname)s : %(filename)s - %(lineno)s : %(asctime)s ]: %(message)s") fileHandler = logging.handlers.RotatingFileHandler(log_file, ...
the-stack_106_18597
# /usr/bin/env python3.5 # -*- mode: python -*- # ============================================================================= # @@-COPYRIGHT-START-@@ # # Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification,...
the-stack_106_18598
# -*- coding: utf-8 -*- """Reuters topic classification dataset. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from ..utils.data_utils import get_file from ..preprocessing.sequence import _remove_long_seq import numpy as np import json import warnings ...
the-stack_106_18599
# # 27. Remove Element # # Given an array nums and a value val, remove all instances of that value in- # place and return the new length. # # Do not allocale extra space for another array, you must do this by modifying # the input array in-place with O(1) extra memory. # # The order of elements can be changed. It doesn...
the-stack_106_18601
from __future__ import unicode_literals """ Copyright OpenSearch Contributors SPDX-License-Identifier: Apache-2.0 """ import click import re import pyfiglet import os import json from prompt_toolkit.completion import WordCompleter from prompt_toolkit.enums import DEFAULT_BUFFER from prompt_toolkit.shortcuts import ...
the-stack_106_18603
#!/usr/bin/env python import rospy import cv2 as cv import numpy as np from cv_bridge import CvBridge, CvBridgeError from sensor_msgs.msg import Image import tf from tf.broadcaster import TransformBroadcaster import tf_conversions from mycobot_communication.srv import ( GetCoords, SetCoords, GetAngles, ...
the-stack_106_18604
""" Default statement functions. """ from muddery.statements.statement_func_set import BaseStatementFuncSet import muddery.statements.action as action import muddery.statements.condition as condition import muddery.statements.attribute as attribute import muddery.statements.rand as rand import muddery.statements.skill...
the-stack_106_18606
from argparse import ArgumentParser import os report_name = "report.html" survivor_graph = "log.png" net_extension = ".svg" def write_header(output_file): html_code = f""" <html> <head> <style> table, th, td {{ border: 1px solid black; border-collapse: collapse; ...
the-stack_106_18608
# coding: utf-8 # # Applying Neutrophil and Monocyte Signatures using Top Features # # **Gregory Way, 2018** # # Instead of focusing only on two compressed features, like we did in [notebook 3](https://github.com/greenelab/BioBombe/blob/master/8.gtex-interpret/3.apply-signatures.ipynb), we apply all of the signatur...
the-stack_106_18609
import random import re import socket from collections import OrderedDict from django.conf import settings from django.core.cache.backends.base import DEFAULT_TIMEOUT, get_key_func from django.core.exceptions import ImproperlyConfigured from django.utils.encoding import smart_text from django.utils.module_loading impo...
the-stack_106_18610
from setuptools import setup, find_packages install_requires = [ 'arrow<1.0', # Guard against losing py3.5 compat announced for v1.0. 'Babel', 'csvw>=1.0', 'clldutils>=3.5', 'pycldf>=1.5.1', 'setuptools>=25', 'pyramid>=1.10', 'pyramid_mako>=1.0', 'pyramid_tm', 'SQLAlchemy>=1.0....
the-stack_106_18611
import os import re import platform from conans.client import conan_api from cpt.packager import ConanMultiPackager from cpt.tools import split_colon_env from cpt.remotes import RemotesManager # from cpt.ci_manager import * from cpt.printer import Printer from bincrafters.build_paths import BINCRAFTERS_REPO_URL, BINCRA...
the-stack_106_18612
#!/usr/bin/env python # encoding: utf-8 from __future__ import print_function import numpy as np from collections import defaultdict import fire, pickle, random, time, math, os, lzma from dynet import * from .utils import buildVocab, strong_normalize, shuffled_balanced_stream from .modules import UPOSTagger, XPOSTagg...
the-stack_106_18615
import kivy from kivy.app import App from kivy.uix.widget import Widget import kivent_core from kivy.properties import NumericProperty, StringProperty from math import pi, cos, sin def get_triangle_data(side_length): return { 'vertices': {0: {'pos': (-side_length/2., -side_length/2.), ...
the-stack_106_18618
import click import datetime from random import randint from math import floor from flask.cli import with_appcontext from .models import Proposal, db from grant.milestone.models import Milestone from grant.comment.models import Comment from grant.utils.enums import ProposalStatus, Category, ProposalStage from grant.us...
the-stack_106_18620
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from torch import nn from torch.autograd import Function import torch.nn.functional as F import dynamicconv_cuda from fairseq_mo...
the-stack_106_18621
def createWordList(filename): text_file= open(filename,"r") temp = text_file.read().split("\n") text_file.close() temp.pop() #remove the last new line return temp def canWeMakeIt(myWord, myLetters): listLetters=[] for letter in myLetters: listLetters.append (letter) for x in m...
the-stack_106_18622
from collections import deque, defaultdict class Solution: def ladderLength(self, beginWord: str, endWord: str, wordList: List[str]) -> int: '''Time: O(m^2*n) Space: O(m^2*n)''' if endWord not in wordList: return 0 if beginWord not in wordList: wordList.append(beginWo...
the-stack_106_18623
import collections.abc import re from typing import ( Any, Callable, Dict, List, Mapping, MutableMapping, Optional, Sequence, Type, Union, IO, ) import warnings from io import BytesIO from datetime import datetime from base64 import b64encode, b64decode from numbers import In...
the-stack_106_18624
b = 8.0/3 r = 40.0 sigma = 10.0 dt = 0.01 x = y = 0.01 z = t = 0.0 xOld = zOld = 0.0 first = True def setup(): size(640, 480) background(100, 100, 100) colorMode(HSB, 100) def draw(): global x, y, z, t, xOld, zOld global first strokeWeight(1) stroke(t, 100 - t, 100) dx = -sigma*(x - y)...
the-stack_106_18625
#!/usr/bin/env python3 # Danny Rorabaugh, 2018 Dec import argparse import numpy as np import pandas as pd import skgstat as skg from os import path, listdir from time import time t0 = time() def mean(df): return df.mean() def std(df): return df.std() def mx(df): return df.max() def mn(df): return ...
the-stack_106_18627
""" This module houses the GeoIP object, a ctypes wrapper for the MaxMind GeoIP(R) C API (http://www.maxmind.com/app/c). This is an alternative to the GPL licensed Python GeoIP interface provided by MaxMind. GeoIP(R) is a registered trademark of MaxMind, LLC of Boston, Massachusetts. For IP-based geoloca...
the-stack_106_18630
#!/usr/bin/python3 """ @Author: Liu Shaoweihua @Site: https://github.com/liushaoweihua """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import time import json import numpy as np import tensorflow as tf from pyclue.tf1.models.engine.hooks im...
the-stack_106_18631
from sentry.auth.exceptions import IdentityNotValid from sentry.auth.providers.oauth2 import ( OAuth2Callback, OAuth2Provider, OAuth2Login ) from .client import GenericApiError, GenericClient from .constants import ( AUTHORIZE_URL, ACCESS_TOKEN_URL, CLIENT_ID, CLIENT_SECRET, SCOPE, UNIQUE_USERID_FIELD ) f...
the-stack_106_18636
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- import os...
the-stack_106_18637
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
the-stack_106_18639
# Copyright 2016 Twitter. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
the-stack_106_18641
import datetime import itertools import logging import time from decimal import Decimal from typing import Iterable, List, Literal, Optional, Tuple from tilapia.lib.basic.functional.require import require from tilapia.lib.basic.functional.timing import timing_logger from tilapia.lib.basic.functional.wraps import error...
the-stack_106_18642
#!/usr/bin/env python # -*- coding: utf-8 -*- from numpy.core.fromnumeric import ravel from numpy.lib.type_check import real import rospy import tf import math from nav_msgs.srv import GetMap from sensor_msgs.msg import LaserScan from nav_msgs.msg import Odometry from visualization_msgs.msg import MarkerArray,Marker f...
the-stack_106_18647
import sys from samples.classification.ram.architecture.ram_modules import ( Actor, CoreRNN, GlimpseSensor, Locator, SignalBaseline, ) from samples.classification.ram.ram_params import get_ram_config from draugr import pil_img_to_np_array sys.path.append("..") import torch if __name__ == "__mai...
the-stack_106_18648
#!/usr/bin/env python3 import json import time import pprint from sys import argv, exit from os import environ from collections import OrderedDict from prometheus_http_client import Prometheus from prometheus_client import CollectorRegistry, Gauge, push_to_gateway def get_series(p, series): m = p.series([serie...
the-stack_106_18649
# %% from itertools import permutations import matplotlib.pyplot as plt import numpy as np from PIL import Image from ml_for_programmers.config import Config # %% config = Config() # %% colors = Image.open(config.data_dir_path / "raw/colors.png") # %% colors # %% plt.imshow(colors) # %% color_array = np.array(co...
the-stack_106_18650
__all__ = [ 'Namespace', 'SubcommandHelpFormatter', 'UsageHelpFormatter', 'create_parser_dry_run', 'create_parser_filter_dates', 'create_parser_local', 'create_parser_logging', 'create_parser_meta', 'create_parser_yes', 'custom_path', 'merge_defaults', 'parse_args' ] import argparse import os from pathlib ...
the-stack_106_18651
# # Copyright (C) 2018 The Android Open Source Project # # 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 la...
the-stack_106_18655
#!/usr/bin/python # # Copyright 2019 Polyaxon, 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 o...
the-stack_106_18656
# -*- coding:utf-8 -*- from meiduo_mall.libs.yuntongxun.CCPRestSDK import REST # 说明:主账号,登陆云通讯网站后,可在"控制台-应用"中看到开发者主账号ACCOUNT SID _accountSid = '8aaf0708669b101e0166a61092640aa1' # 说明:主账号Token,登陆云通讯网站后,可在控制台-应用中看到开发者主账号AUTH TOKEN _accountToken = 'a4d7ae4833554c0cbab6012abaa1dac9' # 请使用管理控制台首页的APPID或自己创建应用的APPID _appI...
the-stack_106_18657
# 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
the-stack_106_18663
from typing import Any, Iterable, List, Optional import pytest from di.api.dependencies import DependantBase from di.api.executor import AsyncTask, State, SyncTask, Task from di.dependant import Dependant from di.executors import AsyncExecutor, SyncExecutor class TestAsyncTask(AsyncTask): def __init__( ...