filename
stringlengths
13
19
text
stringlengths
134
1.04M
the-stack_0_167
import re import os import struct import argparse import collections from nltk.tokenize import word_tokenize from nltk.corpus import stopwords from nltk.stem.wordnet import WordNetLemmatizer from tensorflow.core.example import example_pb2 from utils import is_num parser = argparse.ArgumentParser() # Path parser.add_...
the-stack_0_169
#!/usr/bin/env python3 from os import environ from curio import Channel, run syncword = environ.get('RRIDBOT_SYNC') chan = ('localhost', 12345) async def consumer(): ch = Channel(chan) c = await ch.accept(authkey=syncword.encode()) myset = set() while True: try: msg = await c.recv()...
the-stack_0_172
import aiohttp_csrf import pytest from aiohttp import web SESSION_NAME = COOKIE_NAME = 'csrf_token' FORM_FIELD_NAME = HEADER_NAME = 'X-CSRF-TOKEN' @pytest.yield_fixture def init_app(): def go( loop, policy, storage, handlers, error_renderer=None, ): app = web.A...
the-stack_0_174
""" sphinxcontrib.openapi.openapi30 ------------------------------- The OpenAPI 3.0.0 spec renderer. Based on ``sphinxcontrib-httpdomain``. :copyright: (c) 2016, Ihor Kalnytskyi. :license: BSD, see LICENSE for details. """ import copy import collections import collections.abc from datetime impo...
the-stack_0_175
from django.core.mail import EmailMultiAlternatives from django.template.loader import render_to_string def send_email(name,receiver): # Creating message subject and sender subject = 'Welcome to Our Neighbourhood' sender = 'emmahg6@gmail.com' #passing in the context vairables text_content = rend...
the-stack_0_176
"""Project: Eskapade - A python-based package for data analysis. Module: spark_analysis.data_conversion Created: 2017/05/30 Description: Converters between Spark, Pandas, and Python data formats Authors: KPMG Advanced Analytics & Big Data team, Amstelveen, The Netherlands Redistribution and use in source a...
the-stack_0_177
from sympy.combinatorics import Permutation as Perm from sympy.combinatorics.perm_groups import PermutationGroup from sympy.core import Basic, Tuple from sympy.core.compatibility import as_int from sympy.sets import FiniteSet from sympy.utilities.iterables import (minlex, unflatten, flatten) rmul = Perm.rmul class P...
the-stack_0_179
################################################################################ # 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...
the-stack_0_180
# # This file is part of ravstack. Ravstack is free software available under # the terms of the MIT license. See the file "LICENSE" that was provided # together with this source file for the licensing terms. # # Copyright (c) 2015 the ravstack authors. See the file "AUTHORS" for a # complete list. """Ravello Ironic co...
the-stack_0_182
from __future__ import print_function import numpy as np def q(y_true, y_pred): '''q value as described in Tropsha, Gramatica, Gombar: The Importance of Being Earnest''' y_true = np.array(y_true) y_pred = np.array(y_pred) y_mean = np.mean(y_true) return 1 - np.sum((y_true - y_pred) ** 2) / np.sum((y_true - y_mea...
the-stack_0_183
import os from dateutil.parser import parse as date_parser from flask import request, current_app from flask_restful.fields import Integer, List, Nested, Raw, String from werkzeug.utils import secure_filename from analysisweb.api import db from analysisweb_user.models import Measurement, MeasurementFile from . import...
the-stack_0_186
# -*- coding: utf-8 -*- """ pygments.lexers.haskell ~~~~~~~~~~~~~~~~~~~~~~~ Lexers for Haskell and related languages. :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re from pygments.lexer import Lexer, RegexLexer, bygroups, d...
the-stack_0_188
from disco import util from discodb import DiscoDB, Q from disco.worker.task_io import task_output_stream def Open(url, task=None): if task: disco_data = task.disco_data ddfs_data = task.ddfs_data else: from disco.settings import DiscoSettings settings = DiscoSettings() ...
the-stack_0_189
""" Python interface module for OSQP solver v0.6.2.post5 """ from __future__ import print_function from builtins import object import osqp._osqp as _osqp # Internal low level module import numpy as np import scipy.sparse as spa from warnings import warn from platform import system import osqp.codegen as cg import osqp...
the-stack_0_190
""" Base interface for a reader class """ import numpy as np import logging from pathlib import Path import matplotlib.pyplot as plt import pandas as pd logger = logging.getLogger(__name__) import PyFLOTRAN.utils.SubFishModule as subfish import seaborn as sns class BaseReader: data: np.ndarray # Hint of self.dat...
the-stack_0_194
# get human_ebv_tpms.py import pandas as pd import argparse import os import math import datetime import subprocess # get basename from a file and path string def get_basename(filepath): import os return os.path.basename(os.path.splitext(filepath)[0]) # get and format output directory def format_odir(odir...
the-stack_0_195
#!/usr/bin/env python """ Normalize site observed ancestry by genome-wide average. 2*ID_average - ExpectedCopiesOfPop1Ancestry. @Author: wavefancy@gmail.com Usage: HapmixEPop1NormalizedByIDAverage.py -a IDaverage HapmixEPop1NormalizedByIDAverage.py -h | --help | -v | --version | -f | ...
the-stack_0_196
# -*- coding: utf-8 -*- # Copyright 2021 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 require...
the-stack_0_197
"""Collection of services.""" from typing import Any, Dict, List, Optional from fastapi import HTTPException, status from tortoise import QuerySet from teached.users.models import Teacher from .models import ( # noqa I202 Announcement, Assignment, BookMark, Category, Course, CourseDetailPyda...
the-stack_0_198
from __future__ import absolute_import, division, print_function # LIBTBX_SET_DISPATCHER_NAME phenix.helix_sheet_recs_as_pdb_files import sys import iotbx.pdb from libtbx.utils import Sorry legend = """phenix.helix_sheet_recs_as_pdb_files: Given PDB file with HELIX/SHEET records output PDB files corresponding to ...
the-stack_0_199
# Author: Jacek Komorowski # Warsaw University of Technology import os import configparser import time import numpy as np class ModelParams: def __init__(self, model_params_path): config = configparser.ConfigParser() config.read(model_params_path) params = config['MODEL'] self.mo...
the-stack_0_200
from typing import Any from pyparsing import Word,nums,CaselessLiteral,ParseException from subprocess import Popen,PIPE,STDOUT,CREATE_NO_WINDOW from json import loads import os import errno def is_executable()->bool: """ Determine if the current script is packaged as an executable\n (EG: If packed into a ....
the-stack_0_201
import functools import json import logging import math import os import time from functools import cached_property from typing import Callable, Dict, List, Tuple, Type # https://github.com/prius/python-leetcode import leetcode.api.default_api # type: ignore import leetcode.api_client # type: ignore import leetcode....
the-stack_0_203
import pytest import saltext.credstash.sdbs.credstash as credstash_sdb @pytest.fixture def configure_loader_modules(): module_globals = { "__salt__": {"this_does_not_exist.please_replace_it": lambda: True}, } return { credstash_sdb: module_globals, } def test_replace_this_this_with_s...
the-stack_0_204
import itertools import networkx as nx from spacy.tokens import Token def syntactic_depth(token): '''Finds token depth in the syntactic tree''' if token._._syntactic_depth is None: depth = 0 current_word = token while not current_word == current_word.head: depth += 1 ...
the-stack_0_207
# 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_0_208
import os # cur_directory = print(getcwd()) # Return the current working directory # # print(cur_directory) # print(os.chdir) # Change current working directory # os.system('mkdir today') # Run the command mkdir in the system shell. # There was today folder created in the root folder. # print(dir(os)) ...
the-stack_0_210
#!/usr/local/bin/python3 from os import system, path, getcwd filePath = "assets/alexa-20180320.csv" print("read file: " + filePath) with open(filePath) as f: content = f.readlines() lines = [x.strip() for x in content] for i in range(0, 10): siteName = lines[i].split(",")[1] print("Dealing with " + str(i)...
the-stack_0_211
#!/usr/bin/python3 import sys def safe_print_integer_err(value): is_int = True try: print("{:d}".format(value)) except Exception as e: print("Exception:", e, file=sys.stderr) is_int = False return is_int
the-stack_0_213
import pyspark.sql.functions as psf from pyspark.sql import SparkSession, DataFrame from .data_link import DataLink class JdbcDataLink(DataLink): def __init__( self, environment: str, session: SparkSession, url: str, username: str, password: str, driver: st...
the-stack_0_219
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2021 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
the-stack_0_221
#from app import app, db from app import db from sqlalchemy.orm import relationship import datetime class Post(db.Model): """ Table schema """ __tablename__ = "posts" id = db.Column(db.Integer, primary_key=True, autoincrement=True) post_id = db.Column(db.Text(), nullable=False) origi...
the-stack_0_222
# -*- coding: utf-8 -*- """setup.py""" import os import sys from setuptools import setup from setuptools.command.test import test as TestCommand class Tox(TestCommand): user_options = [('tox-args=', 'a', 'Arguments to pass to tox')] def initialize_options(self): TestCommand.initialize_options(self) ...
the-stack_0_223
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
the-stack_0_224
class Solution: def decodeCiphertext(self, encodedText: str, rows: int) -> str: n = len(encodedText) cols = n // rows ans = [] matrix = [[' '] * cols for _ in range(rows)] for i in range(rows): for j in range(cols): matrix[i][j] = encodedText[i * cols + j] for col in range(col...
the-stack_0_226
import os import re import numpy as np from PIL import Image from keras.models import load_model from keras.preprocessing.image import img_to_array from sklearn.preprocessing import LabelEncoder class ModelManager(): def __init__(self, db, s3, graph, backup_model, backup_label_encoder, collection_name='models', bu...
the-stack_0_230
import numpy as np import tensorflow as tf from mlagents.envs import UnityEnvironment initKernelAndBias={ 'kernel_initializer' : tf.random_normal_initializer(0., .1), 'bias_initializer' : tf.constant_initializer(0.1) } class Actor(object): def __init__(self, sess, observationDim, actionDim, learning_rate=...
the-stack_0_231
# Resource object code (Python 3) # Created by: object code # Created by: The Resource Compiler for Qt version 6.2.0 # WARNING! All changes made in this file will be lost! from PySide6 import QtCore qt_resource_data = b"\ \x00\x00\x0b\x1b\ <\ ?xml version=\x221.\ 0\x22 encoding=\x22UTF\ -8\x22 standalone=\x22\ no\x22...
the-stack_0_234
from operator import attrgetter import pyangbind.lib.xpathhelper as xpathhelper from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType from pyangbind.lib.base import PybindBase from d...
the-stack_0_235
from __future__ import absolute_import import pynndescent from ann_benchmarks.algorithms.base import BaseANN class PyNNDescent(BaseANN): def __init__(self, metric, n_neighbors=10, n_trees=8, leaf_size=20): self._n_neighbors = int(n_neighbors) self._n_trees = int(n_trees) self._leaf_size = i...
the-stack_0_236
import os import json import uuid import boto3 from datasources.stac.query import STACQuery from datasources.sources.base import Datasource client = boto3.client('s3') bucket = 'usgs-lidar-public' class USGS3DEP(Datasource): stac_compliant = False tags = ['Elevation', 'Raster'] def __init__(self, man...
the-stack_0_238
from __future__ import absolute_import # Copyright (c) 2010-2018 openpyxl """Write the shared string table.""" from io import BytesIO # package imports from openpyxl2.xml.constants import SHEET_MAIN_NS from openpyxl2.xml.functions import Element, xmlfile, SubElement PRESERVE_SPACE = '{%s}space' % "http://www.w3.org/...
the-stack_0_239
""" Building Block ============== """ from __future__ import annotations import logging import os import typing import warnings from collections.abc import Collection from functools import partial import numpy as np import rdkit.Chem.AllChem as rdkit import vabene from ...utilities import OneOrMany, flatten, remak...
the-stack_0_240
#!/usr/bin/env python """ Entry point for starting Galaxy without starting as part of a web server. Example Usage: Start a job/workflow handler without a web server and with a given name using. galaxy-main --server-name handler0 Start as a daemon with (requires daemonized - install with 'pip install daemonize'): ga...
the-stack_0_241
# -*- coding: utf-8 -*- import sugartensor as tf import matplotlib.pyplot as plt # set log level to debug tf.sg_verbosity(10) # # hyper parameters # batch_size = 25 z_dim = 50 # # create generator # # random uniform seed z = tf.random_uniform((batch_size, z_dim)) with tf.sg_context(name='generator', size=5, stri...
the-stack_0_246
import turtle import os t = turtle.Pen() #t.speed(0) t.shape("turtle") t.left(90) for i in range(6): t.forward(100) t.right(60) for j in range(3): t.forward(20) t.backward(20) t.left(60) t.right(120) t.backward(100) t.left(60) os.system("Pause")
the-stack_0_247
############################################################################## # Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
the-stack_0_248
import os def align(step): path = os.getcwd() file_path = os.path.join(path, 'whales.txt') file1 = open(file_path, 'r') Lines = file1.readlines() initial_pos = [0] * 2000 final = 0 for line in Lines: input = line.strip() poss = input.split(",") prev_fuel = -1 ...
the-stack_0_250
#!/usr/bin/env python3 """ Convert $1 -- a markdown file to an HTML file in `/tmp/vim/<parent>/<basename>.html`. """ # Standard Library from os.path import realpath, basename, isfile, isdir, dirname, abspath import os import shutil import subprocess import sys import re import logging from logging import Logger from t...
the-stack_0_251
import logging from typing import Any, Dict, List, Optional from starlette.applications import Starlette from starlette.exceptions import HTTPException from starlette.requests import Request from starlette.responses import HTMLResponse, JSONResponse from starlette.routing import Mount, Route from pait.api_doc.html im...
the-stack_0_252
import hashlib import io import json import tempfile from random import randint from unittest.mock import Mock import pytest import requests from .shared import ( guess_mimetype, HashWrap, MogileFile, encode_int, future_waiter, make_bucket_map, maybe_update_max, md5_fileobj_b64, md...
the-stack_0_255
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import annotations import itertools from pants.backend.python.goals import lockfile from pants.backend.python.goals.lockfile import GeneratePythonLockfile from pants.back...
the-stack_0_256
import os from acres.model import topic_list def test_parse(): topics = topic_list.parse("tests/resources/test_topics.tsv") types = topic_list.unique_types(topics) assert 'EKG' in types def test_create_topic_list(ngramstat): filename = "tests/resources/ngram_topics.tsv" topic_list.create(filena...
the-stack_0_257
# Copyright 2011 10gen # # Modified by Antonin Amand <antonin.amand@gmail.com> to work with gevent. # # 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/LIC...
the-stack_0_259
from PyQt5 import QtWidgets from PyQt5.QtCore import QObject, pyqtSlot, pyqtSignal, QLocale, Qt from PyQt5.QtWidgets import QPushButton, QLabel from PyQt5.QtGui import QIcon, QPixmap import sys from pymodaq.daq_utils.parameter import utils as putils from pymodaq.daq_measurement.daq_measurement_main import DAQ_Measurem...
the-stack_0_260
# Author: Phyllipe Bezerra (https://github.com/pmba) clothes = { 0: "underwear", 1: "pants", 2: "belt", 3: "suit", 4: "shoe", 5: "socks", 6: "shirt", 7: "tie", 8: "clock", } graph = [[1, 4], [2, 4], [3], [], [], [4], [2, 7], [3], []] visited = [0 for x in range(len(graph))] stack ...
the-stack_0_261
# Copyright 2018 The Bazel 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 applicable la...
the-stack_0_264
import os.path as osp import time import joblib import numpy as np import tensorflow as tf from baselines import logger from collections import deque from baselines.common import set_global_seeds, explained_variance from baselines.common.runners import AbstractEnvRunner from baselines.common import tf_util from basel...
the-stack_0_267
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HugginFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this fil...
the-stack_0_271
#!/usr/bin/env python """ Easy Install ------------ A tool for doing automatic download/extract/build of distutils-based Python packages. For detailed documentation, see the accompanying EasyInstall.txt file, or visit the `EasyInstall home page`__. __ https://pythonhosted.org/setuptools/easy_install.html """ from...
the-stack_0_272
import matplotlib.pyplot as plt import math, cv2, glob import numpy as np class ImageVisualizer: # region vars # endregion def __init__(self, shape): self.shape = shape # to get a name of parameter variable to print a name in subplot def param_to_str(self, obj, namespace): return ...
the-stack_0_276
# Copyright 2014, Solly Ross (see LICENSE.txt) # Portions Copyright Python Software Foundation # (see COPYRIGHT.txt and PYTHON-LICENSE.txt) # main part import code import contextlib import doctest import getpass import linecache import pdb import re import sys import traceback import warnings import six from yalpt i...
the-stack_0_279
# Copyright (c) 2022 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 required by app...
the-stack_0_280
# Copyright 2016-2019 Dirk Thomas # Licensed under the Apache License, Version 2.0 from pathlib import Path import pytest from scspell import Report from scspell import SCSPELL_BUILTIN_DICT from scspell import spell_check spell_check_words_path = Path(__file__).parent / 'spell_check.words' @pytest.fixture(scope='...
the-stack_0_282
# -*- coding: utf-8 -*- """ sphinx.builders.gettext ~~~~~~~~~~~~~~~~~~~~~~~ The MessageCatalogBuilder class. :copyright: Copyright 2007-2015 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ from __future__ import unicode_literals from os import path, walk from codecs ...
the-stack_0_283
import json from pathlib import Path from typing import List, Optional class ConfJSON: def __init__(self, dir_path: Path, name: str, prefix: str): self._dir_path = dir_path self.name = f'{prefix.rstrip("-")}-{name}' self._file_path = dir_path / name self.path = str(self._file_path)...
the-stack_0_284
#!/usr/bin/env python3 # Copyright (c) 2018-2020 The Wflscoin 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 wflscoin with -h works as expected.""" from test_framework.test_framework import...
the-stack_0_285
import sys import click import json import random from .bakefile import Bakefile, TaskFilter from .exceptions import NoBakefileFound from .clint import eng_join import pygments import pygments.lexers import pygments.formatters from .constants import SKIP_NEXT, SAFE_ENVIRONS def indent(line): return f'{" " * 4}...
the-stack_0_286
#!/usr/bin/python3 ARD_DEVICE_ID = "1" ADC_READ_INTERVAL = 0.1 ADC_KEEP_VALS = 20 LIGHT_KEEP_VALS = 20 LOGFILE = "./logs/smarthome.log" # --- Unicodes --- # HOME = ' ⌂' HOMEON = ' ☗' KEY = ' ⚿' CLOUD = ' ☁' STAR = ' ★' SUN = ' ☀' REFRESH = ' 🗘' CHECKED = ' ✔' POINT = ' ☛' MISSING = ' ✘' MODESSYMBOL = ' ❖' MENUSYMB...
the-stack_0_288
import pytest import os import utils import io import numpy import json import pickle import gzip from utils import kfp_client_utils from utils import minio_utils from utils import sagemaker_utils def run_predict_mnist(boto3_session, endpoint_name, download_dir): """ https://github.com/awslabs/amazon-sagemaker-e...
the-stack_0_291
import random class PriQ(object): '''Binary-Heap based Priority Queue with uniquely named elements, name may \ be any hashable type. Defaults to min-heap, set maxpq=True for max-heap. \ Public methods: put, get, remove, update, contains, front, get_priority.''' def __init__(self, maxpq = False): ...
the-stack_0_292
# Lint as: python3 # Copyright 2019 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 ...
the-stack_0_293
# USAGE # python facial_landmarks.py --shape-predictor shape_predictor_68_face_landmarks.dat --image images/example_01.jpg # import the necessary packages from imutils import face_utils import numpy as np import argparse import imutils import dlib import cv2 # construct the argument parser and parse the arguments ap ...
the-stack_0_295
"""Support for Homematic thermostats.""" import logging from homeassistant.components.climate import ClimateDevice from homeassistant.components.climate.const import ( HVAC_MODE_AUTO, HVAC_MODE_HEAT, HVAC_MODE_OFF, PRESET_BOOST, PRESET_COMFORT, PRESET_ECO, SUPPORT_PRESET_MODE, SUPPORT_T...
the-stack_0_296
import os,re import requests import time import json class Connect(object): def __init__(self, name='Athus', icon="Zaika"): self.name = name self.icon = icon self.session = requests.session() def save_cookie(self, file_name): f = open(file_name, 'w+') f.write(str(self....
the-stack_0_297
from GlobalConstants import N_ROWS, N_COLS, FEATURE_COLOUR, FEATURE_SHAPE, FEATURE_SIZE, FEATURE_TEXT import numpy as np from scipy.spatial import distance from DisplayGenerator import DisplayGenerator class ObservationModel(object): def sample(self, action, current_display): """ Sample...
the-stack_0_298
# http://people.duke.edu/~ccc14/sta-663-2016/16A_MCMC.html import numpy as np import matplotlib.pyplot as plt from scipy import stats thetas = np.linspace(0, 1, 200) n = 100 h = 61 a = 10 b = 10 def target(lik, prior, n, h, theta): if theta < 0 or theta > 1: return 0 else: return li...
the-stack_0_299
import datetime as dt from unittest.mock import patch, call from model_bakery import baker from django.utils import timezone as djangotime from tacticalrmm.test import TacticalTestCase from .models import AutomatedTask from logs.models import PendingAction from .serializers import AutoTaskSerializer from .tasks impor...
the-stack_0_300
"""Ensure credentials are preserved through the authorization. The Authorization Code Grant will need to preserve state as well as redirect uri and the Implicit Grant will need to preserve state. """ from __future__ import absolute_import, unicode_literals import json import mock from oauthlib.oauth2 import (Mobile...
the-stack_0_301
import os import src.data.atomic as atomic_data import src.data.conceptnet as conceptnet_data import src.data.config as cfg import utils.utils as utils import pickle import torch import json start_token = "<START>" end_token = "<END>" blank_token = "<blank>" def save_checkpoint(state, filename): ...
the-stack_0_302
from .sir import SIR from common.config import data_type from common.linalg import as_array, as_matrix, init_weights from common.stats import RSS, MSPE, RMSE from numpy.random import normal, uniform from numpy import * from filtering.particlefilter import ParticleFilter class ParticleSIR(SIR): def __init__(s...
the-stack_0_303
from typing import Any, Dict, Optional, Set import great_expectations.exceptions as ge_exceptions from great_expectations.core.expectation_configuration import ExpectationConfiguration from great_expectations.rule_based_profiler.expectation_configuration_builder import ( ExpectationConfigurationBuilder, ) from gre...
the-stack_0_304
from tkinter import * from tkinter import messagebox root=Tk() root.title("TIC TAC TOE!") press=True flag=0 s1="0" s2="0" #main game logic def check(button): global press global flag global s1 global s2 #alternate player turn's logic if button["text"]=="" and press==True: ...
the-stack_0_305
from __future__ import unicode_literals import onedrivesdk from onedrivesdk.helpers import GetAuthCodeServer from PIL import Image import os input = getattr(__builtins__, 'raw_input', input) def main(): redirect_uri = "http://localhost:8080/" client_secret = "BqaTYqI0XI7wDKcnJ5i3MvLwGcVsaMVM" client = o...
the-stack_0_309
def report_generator(file_path1, file_path2): import numpy as np import pandas as pd from IPython.display import display # read excel files df1 = pd.read_excel(file_path1, sheet_name = 1, index_col= 0, header = 1, usecols = range(41), skipfooter = 17) df2 = pd.read_excel(file_path2, sheet_n...
the-stack_0_310
import copy import unittest from datetime import datetime from mltrace.db import Component, ComponentRun, IOPointer, Store class TestDags(unittest.TestCase): def setUp(self): self.store = Store("test") def testLinkedList(self): # Create chain of component runs expected_result = [] ...
the-stack_0_311
import io import uuid from mitmproxy.test import tutils from mitmproxy import tcp from mitmproxy import websocket from mitmproxy import controller from mitmproxy import http from mitmproxy import flow from mitmproxy.net import http as net_http from mitmproxy.proxy import context from wsproto.frame_protocol import Opc...
the-stack_0_312
# Copyright (c) 2017-present, Facebook, 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...
the-stack_0_314
""" Script for testing on CUB. Sample usage: python -m cmr.benchmark.evaluate --split val --name <model_name> --num_train_epoch <model_epoch> """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from absl import app from absl import flags import os import os...
the-stack_0_315
# -*- coding: utf-8 -*- """ Mesa Time Module ================ Objects for handling the time component of a model. In particular, this module contains Schedulers, which handle agent activation. A Scheduler is an object which controls when agents are called upon to act, and when. The activation order can have a serious...
the-stack_0_316
#!/usr/bin/env python3 # Copyright (c) 2015-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. """Utilities for doing coverage analysis on the RPC interface. Provides a way to track which RPC commands...
the-stack_0_317
import sys sys.path.append(os.path.join(os.path.dirname(__file__), '../../../libbeat/tests/system')) from beat.beat import TestCase class BaseTest(TestCase): @classmethod def setUpClass(self): self.beat_name = "heartbeat" self.beat_path = os.path.abspath(os.path.join(os.path.dirname(__file_...
the-stack_0_318
# This module contains a synchronous implementation of a Channel Access client # as three top-level functions: read, write, subscribe. They are comparatively # simple and naive, with no caching or concurrency, and therefore less # performant but more robust. import getpass import inspect import logging import selectors...
the-stack_0_319
import logging import os from django.core.files.base import ContentFile from django.utils.timezone import now from django.utils.translation import ugettext as _ from django_scopes import scopes_disabled from pretix.base.i18n import language from pretix.base.models import ( CachedCombinedTicket, CachedTicket, Even...
the-stack_0_322
# -------------------------------------------------------- # Tensorflow Faster R-CNN # Licensed under The MIT License [see LICENSE for details] # Written by Jiasen Lu, Jianwei Yang, based on code from Ross Girshick # -------------------------------------------------------- from __future__ import absolute_import from __...
the-stack_0_324
import json from .common import InfoExtractor from .youtube import YoutubeIE from ..compat import compat_b64decode from ..utils import ( clean_html, ExtractorError ) class ChilloutzoneIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?chilloutzone\.net/video/(?P<id>[\w|-]+)\.html' _TESTS = [{ ...
the-stack_0_326
# 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 # # Authors: # - Wen Guan, wen.guan@cern.ch, 2018 import json import logging import os import socke...
the-stack_0_327
""" swat-s1 topology """ from mininet.topo import Topo as TopoBase from srve import Srve from clie import Clie class Topoe(TopoBase): NETMASK = '/24' NODES = [Srve, Clie] def build(self): switch = self.addSwitch('s1') for node in Topoe.NODES: host = self.addHost( ...
the-stack_0_330
import typing from sqlalchemy import create_engine from sqlalchemy.exc import OperationalError from db_workers import DatabaseWorker from db_workers import MySQLWorker from db_workers import PostgreWorker from fields import DATABASE_NAME_FIELD_NAME from fields import FOLDER_NAME_FIELD_NAME from fields import LOCAL_TA...
the-stack_0_332
import os import unittest from datetime import datetime import requests_mock from dateutil.tz import tzutc from august.api import API_GET_DOORBELLS_URL, Api, API_GET_LOCKS_URL, \ API_GET_LOCK_STATUS_URL, API_LOCK_URL, API_UNLOCK_URL, API_GET_LOCK_URL, \ API_GET_DOORBELL_URL, API_GET_PINS_URL from august.lock ...