filename
stringlengths
13
19
text
stringlengths
134
1.04M
the-stack_106_27430
from featuretools.tests.plugin_tests.utils import ( import_featuretools, install_featuretools_plugin, uninstall_featuretools_plugin ) def test_plugin_warning(): install_featuretools_plugin() warning = import_featuretools('warning').stdout.decode() debug = import_featuretools('debug').stdout.de...
the-stack_106_27431
#! /usr/bin/python # -*- coding: utf-8 -*- import tensorflow as tf import tensorlayer as tl import numpy as np tl.logging.set_verbosity(tl.logging.DEBUG) # set gpu mem fraction or allow growth # tl.utils.set_gpu_fraction() # prepare data X_train, y_train, X_val, y_val, X_test, y_test = tl.files.load_mnist_dataset(s...
the-stack_106_27432
import os import sys import math # add dir dir_name = os.path.dirname(os.path.abspath(__file__)) sys.path.append(os.path.join(dir_name,'./auxiliary/')) print(dir_name) import argparse import options ######### parser ########### opt = options.Options().init(argparse.ArgumentParser(description='image denoising')).parse...
the-stack_106_27434
from h3map.header.map_reader import MapReader class SodReader(MapReader): def __init__(self, parser, version=28): self.version = version self.parser = parser self.towns = towns super().__init__(parser) def __repr__(self): return "Shadow of Death" towns = [ "cast...
the-stack_106_27436
# SPDX-License-Identifier: Apache-2.0 # # The OpenSearch Contributors require contributions made to # this file be licensed under the Apache-2.0 license or a # compatible open source license. import argparse import sys class BuildArgs: manifest: str snapshot: bool component: str keep: bool def _...
the-stack_106_27438
"""Loads run-time extensions These loads components are considered extensions as they extend the underlying AWS instances to add feature support and state maintenance. This composition avoids excessively large AWS instance classes as external objects can augment the AWS instances as needed to retain their information....
the-stack_106_27440
#!/bin/env python3 import glob import multiprocessing.dummy as multiprocessing import subprocess import sys import tempfile import time import json import os exec_cmd = lambda *cmd: subprocess.check_output(cmd).decode('utf-8') RED = exec_cmd('tput', 'setaf', '1') GREEN = exec_cmd('tput', 'setaf', '2') YELLOW = exec_c...
the-stack_106_27441
import copy from typing import Tuple import numpy as np import pytest import xarray as xr from gcm_filters import Filter, FilterShape, GridType from gcm_filters.filter import FilterSpec def _check_equal_filter_spec(spec1, spec2): assert spec1.n_steps_total == spec2.n_steps_total np.testing.assert_allclose(...
the-stack_106_27442
import numpy as np import tensorflow as tf from tensorflow.keras import Model from tensorflow.keras.layers import Dense, Flatten from tensorflow.keras.losses import SparseCategoricalCrossentropy from tensorflow.keras.metrics import SparseCategoricalAccuracy from tensorflow.keras.optimizers import Adam from tensorflow.k...
the-stack_106_27447
# Copyright (c) 2013, Kevin Greenan (kmgreen2@gmail.com) # 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 c...
the-stack_106_27449
""" This file contains primitives for multi-gpu communication. This is useful when doing distributed training. """ import pickle import torch import torch.distributed as dist def get_world_size(): if not dist.is_available(): return 1 if not dist.is_initialized(): return 1 return dist.get...
the-stack_106_27450
from pyspark.sql.functions import col import matplotlib.pyplot as plt def violating_precicts(nyc_data, enable_plot=True): nyc_precints = nyc_data.select('violation_precinct')\ .filter(col('violation_precinct') != 0)\ .groupBy('violation_precinct')\ ...
the-stack_106_27451
# coding: utf-8 """Test the contents webservice API.""" import base64 from contextlib import contextmanager import io import json import os import shutil from unicodedata import normalize pjoin = os.path.join import requests from ..filecheckpoints import GenericFileCheckpoints from traitlets.config import Config f...
the-stack_106_27453
from conans import ConanFile, tools, Meson, VisualStudioBuildEnvironment from conans.errors import ConanInvalidConfiguration from conan.tools.microsoft import msvc_runtime_flag import glob import os import shutil class GStLibAVConan(ConanFile): name = "gst-libav" description = "GStreamer is a development fram...
the-stack_106_27454
# Make dummy data from sklearn.linear_model import LinearRegression import numpy as np X = np.random.randn(500, 4) y = X.sum(axis = 1) print(y) np.savetxt('X.csv', X, delimiter= ',') np.savetxt('y.csv', y, delimiter=',') model = LinearRegression() model.fit(X, y) from skl2onnx import convert_sklearn from skl2onnx....
the-stack_106_27455
from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.keys import Keys from selenium import webdriver from bs4 import BeautifulSoup import re import sys link_start = "<a href=\"" link_end = "\" target=\"_blank\">블로그 링크</a>" visitor_start = "<a href=\"http://blog.naver.com/NVisitorgp4Aja...
the-stack_106_27457
import os import pytest from io import StringIO from pytest_mock import MockerFixture from vkbottle.modules import json from vkbottle.tools import ( Callback, CtxStorage, Keyboard, KeyboardButtonColor, LoopWrapper, TemplateElement, Text, load_blueprints_from_package, template_gen, ...
the-stack_106_27460
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst import gc import sys import copy from io import StringIO from collections import OrderedDict import pytest import numpy as np from numpy.testing import assert_allclose, assert_array_equal from astropy.io import fits from astropy....
the-stack_106_27461
'''texplain Create a clean output directory with only included files/citations. Usage: texplain [options] <input.tex> <output-directory> Options: --version Show version. -h, --help Show help. (c - MIT) T.W.J. de Geus | tom@geus.me | www.geus.me | github.com/tdegeus/texplain ''' __version_...
the-stack_106_27467
from __future__ import unicode_literals from mongoengine import * from flask_mongoengine.wtf import model_form from core.entities import Entity from core.database import TagListField, StringListField class Actor(Entity): aliases = ListField(StringField(), verbose_name="Aliases") DISPLAY_FIELDS = Entity.DI...
the-stack_106_27468
""" Copyright 2020 The Magma Authors. This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES O...
the-stack_106_27469
# pylint: disable = invalid-name """ Methods to parse strings/datatypes to find currencies """ import numpy as np from pandas.api.types import is_list_like import money from .dtypes import money_patterns def to_money(values, default_money_code=None): """Convert values to MoneyArray Parameters ---------- ...
the-stack_106_27470
#!/usr/bin/env python # Licensed under a 3-clause BSD style license - see LICENSE.rst import sys import glob import os import ah_bootstrap # noqa from setuptools import setup import builtins builtins._ASTROPY_SETUP_ = True from astropy_helpers.setup_helpers import register_commands, get_package_info from astropy_...
the-stack_106_27471
"""Utilities for the chimera_app tools""" import os import re import shutil import subprocess from datetime import datetime import psutil import chimera_app.context as context import chimera_app.shortcuts as shortcuts def ensure_directory(directory): if not os.path.isdir(directory): os.makedirs(directory,...
the-stack_106_27473
#!/usr/bin/env python3 import os import io import re import csv import json import hashlib import canonicaljson from pathlib import Path from digital_land.load import detect_encoding from digital_land.plugins.wfs import strip_variable_content resource_dir = "collection/resource" resource_log = {} def save(path, dat...
the-stack_106_27476
import importlib import os from django.db import connections, router from dj_anonymizer.conf import settings VENDOR_TO_TRUNCATE = { 'postgresql': 'TRUNCATE TABLE', 'mysql': 'TRUNCATE TABLE', 'sqlite': 'DELETE FROM', 'oracle': 'TRUNCATE TABLE', } def import_if_exist(filename): """ Check if ...
the-stack_106_27479
import unittest from streamlink.plugins.ard_live import ard_live class TestPluginard_live(unittest.TestCase): def test_can_handle_url(self): should_match = [ 'https://daserste.de/live/index.html', 'https://www.daserste.de/live/index.html', ] for url in should_match...
the-stack_106_27480
""" @name: Modules/House/__init__.py @author: D. Brian Kimmel @contact: D.BrianKimmel@gmail.com @copyright: (c) 2013-2020 by D. Brian Kimmel @license: MIT License @note: Created on Apr 10, 2013 @summary: Handle all of the information for a house. """ __updated__ = '2020-02-16' __version_info__ = (2...
the-stack_106_27483
# Lint as: python3 # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
the-stack_106_27484
# File: V (Python 2.4) from pandac.PandaModules import * from direct.interval.IntervalGlobal import * from direct.particles import ParticleEffect from direct.particles import Particles from direct.particles import ForceGroup import random from PooledEffect import PooledEffect from EffectController import EffectControl...
the-stack_106_27485
from django.urls import include, path from .views import (annotation, annotation_relations, auto_labeling, comment, example, example_state, export_dataset, health, import_dataset, import_export, label, project, relation_types, role, statistics, tag, task, use...
the-stack_106_27487
# -*- coding: utf-8 -*- import os import pytest from girder.models.setting import Setting from girder.models.user import User from girder.utility import mail_utils from girder.plugin import GirderPlugin from girder.settings import SettingKey class MailPlugin(GirderPlugin): def load(self, info): mail_uti...
the-stack_106_27489
import cv2 import rospy import sensor_msgs.point_cloud2 as pcl2 import time from numba import jit import numpy as np from cv_bridge import CvBridge, CvBridgeError from sensor_msgs.msg import Image from sensor_msgs.msg import CameraInfo from sensor_msgs.msg import PointCloud2 import message_filters import torch from ...
the-stack_106_27492
""" Auth module that contains all code needed for authentication/authorization policies setup. In particular: :includeme: Function that actually creates routes listed above and connects view to them :create_system_user: Function that creates system/admin user :_setup_ticket_policy: Setup Pyramid Au...
the-stack_106_27493
import datetime import re from typing import Any, Dict import kubernetes from dateutil.parser import parse from kubernetes.client import ApiClient from dagster import check from dagster.utils import frozendict def _k8s_value(data, classname, attr_name): if classname.startswith("list["): sub_kls = re.mat...
the-stack_106_27494
import hashlib import logging import textwrap from urllib.parse import unquote from django.contrib import messages from django.http import ( Http404, HttpResponse, HttpResponseNotModified, HttpResponsePermanentRedirect, HttpResponseRedirect, ) from django.urls import resolve, reverse from django.ut...
the-stack_106_27495
# -*- coding: utf-8 -*- # Copyright 1999-2020 Alibaba Group Holding 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 require...
the-stack_106_27496
import os import os.path import sys import torch import torch.utils.data as data import cv2 import numpy as np CLASSES = ( '__background__', 'face') class AnnotationTransform(object): """Transforms a VOC annotation into a Tensor of bbox coords and label index Initilized with a dictionary lookup of classnames...
the-stack_106_27500
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division import sys import json import math import fiona from fiona.errors import DriverError import rasterio import warnings from rasterio.transform import guard_transform from affine import Affine import numpy as np try: from sh...
the-stack_106_27502
# # This file is part of pysnmp software. # # Copyright (c) 2005-2018, Ilya Etingof <etingof@gmail.com> # License: http://snmplabs.com/pysnmp/license.html # import random random.seed() class Integer(object): """Return a next value in a reasonably MT-safe manner""" def __init__(self, maximum, increment=256):...
the-stack_106_27504
import csv import datetime import os import subprocess from golem.core import utils def new_directory_test_case(root_path, project, parents, test_name): parents = os.sep.join(parents) errors = [] if directory_already_exists(root_path, project, 'tests', parents, test_name): errors.append('A direct...
the-stack_106_27506
"""Implementation of Rule L052.""" from typing import List, NamedTuple, Optional from sqlfluff.core.parser import SymbolSegment from sqlfluff.core.parser.segments.base import BaseSegment, IdentitySet from sqlfluff.core.parser.segments.raw import NewlineSegment from sqlfluff.core.rules.base import BaseRule, LintResult...
the-stack_106_27508
""" This scripts for main function of supervised domain adaptation on image classification """ from utils.parse_args import parse_args_sda from train_val.training_sda import ClsModel, CCSA, dSNE def main(): """ Main function CCSA: ICCV 17 model V0: train on source and test on target V1: train on ...
the-stack_106_27512
"""Program to automate and optimise a workforce schedule.""" import sys import random import time from math import isclose from string import ascii_lowercase from enum import Enum, IntFlag, auto from pulp import * START_TIME = time.time() DEFAULT_OPTIMISATION_ACCURACY = .15 ID_LOWER_BOUND = 10000000 ID_UPPER_BOUND ...
the-stack_106_27513
import numpy as np import nibabel as nib import pandas as pd import pickle def calc_vertex_correlations(path_lh, path_rh): # load fmri data for left and right hemi lh_fmri=nib.load(path_lh) rh_fmri=nib.load(path_rh) #get image data and resize lh_imagedata=lh_fmri.get_data() lh_imagedata.re...
the-stack_106_27515
import numpy as np import csv import sys from sklearn import preprocessing import matplotlib.pyplot as plt import random import time as sleepy questionCount = 16 sampleCount = 125 names = ['u', 's0','s1','s2','s3','s4','s5','s6','s7','s8','s9','q0','q1','q2','q3','a0', 'qc'] user = "u" enjoy = "s0" skills = "s1" pre...
the-stack_106_27516
from datetime import datetime import xml.etree.ElementTree as ET import unicodedata as ud import enchant import re from stdnum import isbn from stdnum import exceptions # ----------------------------------------------------------------------------- def preprocessISBNString(inputISBN): """This function normalizes a g...
the-stack_106_27517
import bitmath from common.file_response import FileResponse class DatasetResponse(FileResponse): def get_headings(self): return ["Dataset", "Users", "Methods", "Accesses", "Size", "Activity Days"] def _write_xlsx(self, json_data, worksheet, date_format): worksheet.set_column(0, 0,...
the-stack_106_27519
from django import forms, template from django.conf import settings from django.db import models from modelcluster.fields import ParentalKey, ParentalManyToManyField from modelcluster.models import ClusterableModel from modelcluster.contrib.taggit import ClusterTaggableManager from taggit.models import TaggedItemBase ...
the-stack_106_27521
from pydantic import ValidationError from net_models.models import ( KeyBase, KeyChain, VLANModel, RouteTarget, VRFAddressFamily, VRFModel ) from tests.BaseTestClass import TestBaseNetModel, TestVendorIndependentBase class TestKeyBase(TestVendorIndependentBase): TEST_CLASS = KeyBase ...
the-stack_106_27522
"""Exercício Python 62: Melhore o DESAFIO 61; pergunte para o usuário se ele quer mostrar mais alguns termos. O programa encerrará quando ele disser que quer mostrar 0 termos.""" # dados do usuário primeiro = int(input('Primeiro termo: ')) razao = int(input('Razão da PA: ')) # variáveis termo = primeiro contador = 1...
the-stack_106_27524
'''This file is to matching the label with prediction and calculate evaluation metric for the algorithm''' import numpy as np class result_analysis: '''match_type: 'iou_match' or 'hit_match', iou_match can find match pairs with maximum iou value, while hit_macth can find matched pairs with maximum matched nu...
the-stack_106_27525
import json import boto3 def getGardenerInfo(event): params = event['queryStringParameters'] usr_id = event['requestContext']['authorizer']['claims']['cognito:username'] try: enviroment = params['env'] except: enviroment = 'dev' # Choosing enviroment. Production (online) or Dev...
the-stack_106_27526
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright 2016 The Cartographer 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 # # Unle...
the-stack_106_27527
import numpy as np from gym import utils from gym.envs.mujoco import mujoco_env class Walker2dEnv(mujoco_env.MujocoEnv, utils.EzPickle): def __init__(self, xml_file='walker2d.xml'): mujoco_env.MujocoEnv.__init__(self, xml_file, 4) utils.EzPickle.__init__(self) def step(self, a): posbe...
the-stack_106_27535
import datetime import sys from pytorch_pfn_extras.training import extension from pytorch_pfn_extras.training.extensions import util class ProgressBar(extension.Extension): """An extension to print a progress bar and recent training updater. This extension prints a progress bar at every call. It watches th...
the-stack_106_27538
import json import random import numpy import tensorflow as tf from tensorflow.contrib import rnn class DataSet(object): def __init__(self, cases, labels): self._num_examples = cases.shape[0] self._cases = cases self._labels = labels self._epochs_completed = 0 self._index_in...
the-stack_106_27539
# COVID simulation # Novice compartmental model with time-delay ODE, including incubation, quarantine, hospitalization, super spreader, quarantine leak, immunity, etc. # The parameters for the COVID-19 are generally referenced from other papers # -----Most parameters regarding medical containments are solely based on...
the-stack_106_27540
# coding: utf-8 # # Copyright 2021 The Oppia 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 requi...
the-stack_106_27542
#!/usr/bin/env python # ============================================================================= # GLOBAL IMPORTS # ============================================================================= import os import numpy as np import pandas as pd from pKa_macrostate_analysis import mae, rmse#, barplot_with_CI_errorba...
the-stack_106_27543
# fmt: off import logging import json from pathlib import Path import torch from farm.data_handler.data_silo import DataSilo, DataSiloForCrossVal from farm.data_handler.processor import TextClassificationProcessor from farm.modeling.optimization import initialize_optimizer from farm.modeling.adaptive_model import Adap...
the-stack_106_27546
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Model definition ''' from tensorflow.keras import Model from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Conv2D, MaxPooling2D, Flatten, Dense, Dropout import matplotlib.pyplot as plt def lenet5(dropout_prob=0.2): """Implements a...
the-stack_106_27547
import logging import sys from flask import Flask from fluffy import version app = Flask(__name__) app.config.from_envvar('FLUFFY_SETTINGS') app.logger.addHandler(logging.StreamHandler(sys.stderr)) app.logger.setLevel(logging.DEBUG) @app.context_processor def defaults(): from fluffy.component.assets import as...
the-stack_106_27549
import numpy as np from PIL import Image from torch.utils.data import Dataset from torchvision import transforms __all__ = ['P2PDataset'] class P2PDataset(Dataset): """ Pose to Pose dataset definition loads two frame/pose pairs """ def __init__(self, df=None, transform=None, data_path=''): ""...
the-stack_106_27550
from ... import Header from os import system, name def clear(): if name == 'nt': _ = system('cls') clear() import math class Line: def __init__(self,coor1,coor2): self.coor1 = coor1 self.coor2 = coor2 def distance(self): x1,y1 = self.coor1 x2,y2 = self...
the-stack_106_27552
import io import asyncio import contextlib import logging import math import html import cairo import os import time import gi gi.require_version('Pango', '1.0') gi.require_version('PangoCairo', '1.0') from gi.repository import Pango, PangoCairo import discord import random from discord.ext import commands from tle.u...
the-stack_106_27553
# Copyright 2018 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_27554
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) import pytest import spack.config import spack.modules.common import spack.paths import spack.spec import spack.util.path ...
the-stack_106_27555
# Copyright 2015 Hewlett-Packard Development Company, L.P. # # 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_27556
""" Alchemistry_toolkits A short description of the project. """ import sys from setuptools import setup, find_packages import versioneer short_description = __doc__.split("\n") # from https://github.com/pytest-dev/pytest-runner#conditional-requirement needs_pytest = {'pytest', 'test', 'ptr'}.intersection(sys.argv) p...
the-stack_106_27560
# -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available. Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. BK-BASE 蓝鲸基础平台 is licensed under the MIT License. License for BK-BASE 蓝鲸基础平台: ---------------------------------------------...
the-stack_106_27561
"""Emoji Available Commands: .ding""" from telethon import events import asyncio from userbot.utils import admin_cmd @borg.on(admin_cmd(pattern=r"ding")) async def _(event): if event.fwd_from: return animation_interval = 0.5 animation_ttl = range(0, 10) #input_str = event.pattern_mat...
the-stack_106_27562
from typing import Any, Dict, List from overrides import overrides import torch from allennlp.data import Vocabulary from allennlp.models.model import Model from allennlp.modules import ( Attention, FeedForward, Seq2SeqEncoder, Seq2VecEncoder, TextFieldEmbedder, ) from allennlp_semparse.domain_la...
the-stack_106_27564
#!/usr/bin/env python3 import copy import os import logging import datetime import filecmp import pathlib import json import shutil import base64 from io import BytesIO import jwt import pem import pycurl import re from git import Repo import git import validators # Checks to ensure a url is valid def urlIsValid(cand...
the-stack_106_27566
""" Core functions To-Do: - over limit for get_data """ import sys import pandas as pd from .. import config from .api import API from .util.clean import clean_dict_cols from ..util.z2h import str_z2h def get_list(statsCode=None, searchWord=None, outputRaw=False, key=None, lang=None, **kwargs): api = API(key...
the-stack_106_27569
# coding: utf-8 # YYeTsBot - bot.py # 2019/8/15 18:27 __author__ = 'Benny <benny.think@gmail.com>' import io import json import logging import re import tempfile import time from urllib.parse import quote_plus import telebot from apscheduler.schedulers.background import BackgroundScheduler from telebot import apihel...
the-stack_106_27571
import json import requests import logging import hashlib import time from fake_useragent import UserAgent from uuid import uuid4 from .camera import EzvizCamera # from pyezviz.camera import EzvizCamera COOKIE_NAME = "sessionId" CAMERA_DEVICE_CATEGORY = "IPC" DOORBELL_DEVICE_CATEGORY = "BDoorBell" EU_API_DOMAIN = "a...
the-stack_106_27576
from __future__ import print_function from __future__ import absolute_import import six input_name = '../examples/homogenization/perfusion_micro.py' from sfepy.base.testing import TestCommon class Test(TestCommon): @staticmethod def from_conf(conf, options): return Test(conf = conf, options = options...
the-stack_106_27578
""" Module for testing functionality associated with calculating the plasma frequency. - `~plasmapy.formulary.frequencies.plasma_frequency` - `~plasmapy.formulary.frequencies.plasma_frequency_lite` - `~plasmapy.formulary.frequencies.wp_` """ import astropy.units as u import numpy as np import pytest from astropy.cons...
the-stack_106_27579
################################################################################ ## Right widget files for automatic mode # Author: Maleakhi, Alex, Faidon, Jamie, Olle, Harry ################################################################################ from PyQt5.QtWidgets import * from PyQt5.QtGui import * from Py...
the-stack_106_27580
from urllib import request import json class PushNotif(): key, event = "","" def __init__(self,key,event): self.key = key self.event = event def send(self,value1 = "",value2="",value3=""): values = { "value1": value1, "value2": val...
the-stack_106_27581
#!/usr/bin/env python # Copyright 2014-2018 The PySCF Developers. 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 # # U...
the-stack_106_27582
#!/usr/bin/python # # Copyright 2018 Red Hat, Inc. # # This file is part of ansible-nmstate. # # ansible-nmstate is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your o...
the-stack_106_27583
"""day 7: I'm so worried about the baggage retrieval system they've got at Heathrow""" import networkx from collections import defaultdict from typing import Dict, List TEST_INPUT = """light red bags contain 1 bright white bag, 2 muted yellow bags. dark orange bags contain 3 bright white bags, 4 muted yellow bags. br...
the-stack_106_27584
import numpy as np import random import cv2 def vignette(img): # reading the image image = cv2.imread(img) # resizing the image according to our need resize() function takes 2 parameters, # the image and the dimensions # Extracting the height and width of an image rows, cols = image.shape[:2...
the-stack_106_27586
# Copyright (C) The Arvados Authors. All rights reserved. # # SPDX-License-Identifier: Apache-2.0 import logging import sys import threading import copy import re import subprocess from schema_salad.sourceline import SourceLine import cwltool.docker from cwltool.errors import WorkflowException import arvados.command...
the-stack_106_27587
import paho.mqtt.client as mqtt import time broker_address = "localhost" port = 8883 keep_alive_time = 60 topic = "new/temp" #path to CA crt CA_CERT = "ca.crt" #CLIENT_CERT = "" #CLIENT_KEY = "" #CIPHERS = "" def on_connect(client, userdata, flags, rc): print("Connected with result code: " + str(rc) ) if...
the-stack_106_27589
# Copyright (c) 2016 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 applic...
the-stack_106_27591
from __future__ import print_function from fabric.api import task, run, env, cd, sudo, put, get from fabric.tasks import execute, Task from .utils import hijack_output_loop from .deploy import Deployment from .project import Project # Fabric prints all the messages with a '[hostname] out:' prefix. # Hijacking it to re...
the-stack_106_27592
# qubit number=3 # total number=11 import numpy as np from qiskit import QuantumCircuit, execute, Aer, QuantumRegister, ClassicalRegister, transpile, BasicAer, IBMQ import networkx as nx from qiskit.visualization import plot_histogram from typing import * from pprint import pprint from math import log2 from collectio...
the-stack_106_27594
from questionary import prompt, Choice from click import clear as click_clear from os import scandir, DirEntry from posixpath import join from pdpp.styles.prompt_style import custom_style_fancy from pdpp.utils.ignorelist import ignorelist from pdpp.tasks.base_task import BaseTask from typing import List def...
the-stack_106_27596
__all__ = [ 'ps_output' ] import re import bg_helper as bh import input_helper as ih from input_helper.matcher import PsOutputMatcher _ps_output_matcher = PsOutputMatcher() def ps_output(): """Return a list of dicts containing info about current running processes""" cmd = 'ps -eo user,pid,ppid,tty,comm...
the-stack_106_27597
import os from map_retrieve import mapRetrieve from glob import glob # create the mapRetrieve object mr = mapRetrieve() zip_files = glob('/media/zac/Seagate Portable Drive/orders/f06d9ed2c630d7ad6ecfd53ecda4d412/CMS_LiDAR_AGB_California/data/*.zip') # for each zip file run the save_map method count = 10000 for zf in ...
the-stack_106_27598
#!/usr/bin/env python3 import tarfile from tarfile import TarFile, TarInfo import zipfile from zipfile import ZipFile, ZipInfo import json import os from io import BytesIO import stat from shutil import copyfileobj import time PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) with open(os.pa...
the-stack_106_27599
# 构建配置 keyValues = Properties() keyValues.load(loader.getResourceAsStream("data.properties")) keyValues.load(loader.getResourceAsStream("model/benchmark/randomguess-test.properties")) configurator = Configurator(keyValues) # 此对象会返回给Java程序 _data = {} # 构建排序任务 task = RankingTask(RandomGuessModel, configurator...
the-stack_106_27600
from ..utils import utils, constants from ..core.trajectorydataframe import * from sklearn.cluster import DBSCAN import numpy as np import inspect kms_per_radian = 6371.0088 # Caution: this is only true at the Equator! # This may cause problems at high latitudes. def cluster(tdf, clust...
the-stack_106_27601
""" Example of how to train the Behavioral Cloning (BC) algorithm from scratch. Also includes notes on how to resume training from an earlier checkpoint, perform testing/evaluation, and run the baselines from the model_zoo. """ import logging import os from ilpyt.agents.imitation_agent import ImitationAgent from ...
the-stack_106_27604
from __future__ import annotations from optparse import SUPPRESS_HELP, OptionParser import workflows import workflows.frontend import workflows.services import workflows.transport class ServiceStarter: """A helper class to start a workflows service from the command line. A number of hooks are provided so th...
the-stack_106_27605
# coding: utf-8 """ Algorithmia Management APIs APIs for managing actions on the Algorithmia platform # noqa: E501 OpenAPI spec version: 1.0.1 Contact: support@algorithmia.com Generated by: https://openapi-generator.tech """ import pprint import re # noqa: F401 import six class ScmConnecti...
the-stack_106_27607
from fasteners import ( InterProcessLock, try_lock, ) from contextlib import contextmanager from .path import exists from ..dochelpers import exc_str from ..utils import ( ensure_unicode, get_open_files, unlink, ) import logging lgr = logging.getLogger('datalad.locking') def _get(entry): """...