filename
stringlengths
13
19
text
stringlengths
134
1.04M
the-stack_0_14492
import numpy as np import tensorflow as tf def _to_int32(a): return np.int32(np.ceil(a)) def extract_patches(detector: tf.keras.models.Model, img: tf.TensorArray, min_score: float = 0.4, max_boxes: int = 10): shape = tf.shape(img) im_height, im...
the-stack_0_14493
""" ## This script is for run tesing and test NYU dataset """ # %matplotlib inline """ ## This script is for run tesing and test MSRA dataset """ # %matplotlib inline "" import numpy as np import torch import torch.nn as nn import torch.optim as optim import torch.backends.cudnn as cudnn import argparse import os ...
the-stack_0_14494
import os import signal import time from dataclasses import dataclass, field from typing import Any, List, Optional import gevent import gevent.util import structlog from gevent._tracer import GreenletTracer from gevent.hub import Hub from raiden.exceptions import RaidenUnrecoverableError LIBEV_LOW_PRIORITY = -2 LIB...
the-stack_0_14499
import battlecode as bc import behaviour_tree as bt import random import units class Knight(units.Unit): """The container for the knight unit.""" def __init__(self, unit, gc): super().__init__(unit, gc) self._targeted_enemy = None def generate_tree(self): """Generates the tree for...
the-stack_0_14503
import ast import os import shutil from distutils.dir_util import copy_tree import matplotlib.pyplot as plt import numpy as np import pandas as pd import tensorflow as tf from tensorflow.keras.models import load_model import tensorflow_hub as hub from tqdm import tqdm class PseudoLabelGenerator: """ Class to...
the-stack_0_14504
import subprocess import tempfile import inspect import random import shutil import time import json import sys import os KWARGS = "k" RESULT = "r" VALUE = "v" ARGS = "a" # !!! Dekoratörde, fonksiyon okunduktan sonra dosyalarını silebilirsin aslında # Ya da aradan belli bir süre geçtiyse, dosyayı sil gitsin, loop'tan...
the-stack_0_14505
import urllib.request import urllib.error import urllib.parse import json from arbitrage.public_markets.market import Market class GDAX(Market): def __init__(self, currency, code): super().__init__(currency) self.code = code self.update_rate = 30 def update_depth(self): url = '...
the-stack_0_14507
"""Tensorflow trainer class.""" import logging import math import os from typing import Callable, Dict, Optional import numpy as np import tensorflow as tf from .modeling_tf_utils import TFPreTrainedModel, shape_list from .optimization_tf import GradientAccumulator, create_optimizer from .trainer_utils import PREFIX...
the-stack_0_14508
class TableFormat: """This class handles all related things to the visual presentation of a table.""" def __init__(self): self._widths = [] self._columns = [] self._rows = [] def set(self, columns): self._columns = columns self._widths = [len(column) + 2 for column ...
the-stack_0_14516
import logging import datetime from ipyc import AsyncIPyCHost, AsyncIPyCLink host = AsyncIPyCHost() # logging.basicConfig(level=logging.DEBUG) @host.on_connect async def on_connection(connection: AsyncIPyCLink): connection_idx = len(host.connections) print(f'We got a new connection! ({connection_idx})') ...
the-stack_0_14517
import pathlib import os import shutil from flask import Flask import logging import dash import dash_bootstrap_components as dbc import dash_core_components as dcc import dash_daq as daq import dash_html_components as html import numpy as np import plotly.graph_objs as go import roslibpy import time from dash.dependen...
the-stack_0_14518
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
the-stack_0_14519
from mavetools.validators import dataset_validators def validate_all(countfile=None, scorefile=None, scorejson=None): """ By calling other helper functions, this function runs all of the validation code """ validate_dataset(countfile, scorefile, scorejson) def validate_dataset(countfile=None, scoref...
the-stack_0_14521
import shutil import pytest import yaml from click.testing import CliRunner from kedro.extras.datasets.pandas import CSVDataSet from kedro.io import DataCatalog, MemoryDataSet from kedro.pipeline import Pipeline, node @pytest.fixture def fake_load_context(mocker): context = mocker.MagicMock() return mocker....
the-stack_0_14522
"""Dyson test configuration.""" from unittest.mock import patch import pytest from . import CREDENTIAL, HOST, SERIAL from .mocked_mqtt import MockedMQTT @pytest.fixture() def mqtt_client(request: pytest.FixtureRequest) -> MockedMQTT: """Return mocked mqtt client.""" device_type = request.module.DEVICE_TYPE...
the-stack_0_14523
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger # Yields a list chunk of size n from list def group(list, n): for i in range(0, len(list), n): yield list[i:i+n] # Takes requested data and breaks it up into a number of pages, # each with n pages def pagebreak(request, data, n): pagi...
the-stack_0_14524
import torch import torch.nn as nn import torch.nn.functional as F import pdb from collections import OrderedDict class LinearFeatureBaseline(nn.Module): """Linear baseline based on handcrafted features, as described in [1] (Supplementary Material 2). [1] Yan Duan, Xi Chen, Rein Houthooft, John Schulman...
the-stack_0_14525
import random from collections import Iterable from dynaconf import settings def lang_raw(lang_code, *path): package = settings.LANG[lang_code] for p in path: package = package[p] return package def lang(lang_code, *path): package = settings.LANG[lang_code] for p in path: packag...
the-stack_0_14527
""" Code for `daugman_visual_explanation.ipynb` """ import cv2 import numpy as np import matplotlib.pyplot as plt import itertools import random from daugman import daugman from daugman import find_iris from typing import List, Tuple, Iterable class DaugmanVisualExplanation: def __init__(self, img_path: str, st...
the-stack_0_14528
import math import torch.nn as nn class VGG(nn.Module): ''' VGG model ''' def __init__(self, features): super(VGG, self).__init__() self.features = features self.classifier = nn.Sequential( nn.Dropout(), nn.Linear(512, 512), nn.ReLU(True), ...
the-stack_0_14530
"""Very simple breakout clone. A circle shape serves as the paddle, then breakable bricks constructed of Poly-shapes. The code showcases several pymunk concepts such as elasitcity, impulses, constant object speed, joints, collision handlers and post step callbacks. """ import math, sys, random import os ...
the-stack_0_14531
""" Module for Optuna hyperparameter optimization (optuna.org) """ from __future__ import print_function from __future__ import unicode_literals from __future__ import division from __future__ import absolute_import from builtins import zip from builtins import range from builtins import open from builtins import s...
the-stack_0_14532
# Standard library imports import sqlite3 from dataclasses import asdict # Third party imports import pandas as pd from spotify_flows.spotify.artists import read_artists_from_id from spotify_flows.database import SpotifyDatabase # Main body def main(): db = SpotifyDatabase("data/spotify.db", op_table="operatio...
the-stack_0_14533
import glob import os import pytest from cli.src.helpers.build_io import get_build_path from cli.src.helpers.data_loader import load_schema_obj, load_all_schema_objs, load_all_schema_objs_from_directory,\ load_template_file, load_json_obj, types, SCHEMA_DIR from tests.unit.helpers.constants import CLUSTER_NA...
the-stack_0_14534
import tempfile from unittest import TestCase from qtlayoutbuilder.lib.multiline_string_utils import MultilineString from qtlayoutbuilder.lib.original_file_rewriter import OriginalFileReWriter class TestOriginalFileReWriter(TestCase): # Lower level functions first. def test_add_backup_location_comment(self...
the-stack_0_14537
from PIL import ImageGrab #Used to screenshots #it takes board number 1-6!! def screen_board(board_no): grab_displays = ((10,50,630,380), (650,50,1270,380), (1290,50,1910,380), (10,590,630,920), (650,590,1270,920), (1290,590,1910,920)) #Screenshot of w...
the-stack_0_14538
# -*- coding: utf-8 -*- settings = { 'source': 'csv', #'source': 'mongodb', 'data_path': './data', 'stock_commission': 3 / 10000.0, 'future_commission': 1 / 10000.0, 'tick_test': False, } class ConfigLog(object): log_level = 'INFO' log_to_file = True log_to_console = True log_...
the-stack_0_14539
# _ _ # | | | | # ___ ___ _ __ ___| |_ __ _ _ __ | |_ ___ # / __/ _ \| '_ \/ __| __/ _` | '_ \| __/ __| # | (_| (_) | | | \__ \ || (_| | | | | |_\__ \ # \___\___/|_| |_|___/\__\__,_|_| |_|\__|___/ # """ constants.py various fixed val...
the-stack_0_14540
import datetime from typing import List from unittest.mock import patch import pytz from django.core import mail from django.core.exceptions import ImproperlyConfigured from django.test import TestCase from django.utils import timezone from freezegun import freeze_time from posthog.email import EmailMessage from post...
the-stack_0_14542
"""Given a folder with subfolders, run the schizo test and report on the min, max, etc statistics of each subfolder. """ import argparse import collections import multiprocessing import os import re import subprocess progdir = os.path.dirname(os.path.abspath(__file__)) mainscript = os.path.join(progdir, '../main.py')...
the-stack_0_14543
from __future__ import absolute_import, print_function from django.conf.urls import include, patterns, url from .endpoints.accept_project_transfer import AcceptProjectTransferEndpoint from .endpoints.organization_dashboards import OrganizationDashboardsEndpoint from .endpoints.relay_heartbeat import RelayHeartbeatEnd...
the-stack_0_14544
""" Copyright 2020 The OneFlow 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 law or agr...
the-stack_0_14545
import sys import re import numpy as np import pandas as pd from scipy.stats import pearsonr from sklearn.preprocessing import scale import pytest from nibabel import Nifti1Image from nilearn.input_data import NiftiMasker from nilearn.interfaces.fmriprep import load_confounds from nilearn.interfaces.fmriprep.load_confo...
the-stack_0_14546
# Copyright (c) 2018, NVIDIA CORPORATION. from __future__ import print_function, division import inspect import pytest import numpy as np import pandas as pd from pandas.util.testing import assert_frame_equal from itertools import product import cudf from cudf import queryutils from cudf.dataframe import DataFrame ...
the-stack_0_14547
#!/usr/bin/env python # # Copyright 2020 Confluent 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...
the-stack_0_14548
import argparse import os import numpy as np import math import torchvision.transforms as transforms from torchvision.utils import save_image from PIL import Image from torch.utils.data import DataLoader from torchvision import datasets from torch.autograd import Variable from datasets import * from models import * ...
the-stack_0_14549
# -*- coding: utf-8 -*- """ Created on Sun Apr 22 14:23:32 2018 CSV module handles parsing better as delimiter can be part of data as well @author: dongrp2 """ import csv with open('names.csv','r') as names_csv: csv_reader = csv.reader(names_csv) next(csv_reader) # to loop over the first line which i...
the-stack_0_14551
# -*- coding: utf-8 -*- from tests import HangulizeTestCase from hangulize.langs.slk import Slovak class SlovakTestCase(HangulizeTestCase): lang = Slovak() def test_people(self): self.assert_examples({ 'Ján Bahýľ': '얀 바힐', 'Štefan Banič': '슈테판 바니치', 'Anton Bernolá...
the-stack_0_14552
import urllib import itertools import json import jinja2 from datasette.plugins import pm from datasette.database import QueryInterrupted from datasette.utils import ( CustomRow, MultiParams, append_querystring, compound_keys_after_sql, escape_sqlite, filters_should_redirect, is_url, p...
the-stack_0_14553
from datetime import datetime import time if __name__ == "__main__": # get now time now = datetime.now() # convert time into timestamp timstart = datetime.timestamp(now) print("now is ", now,"<<<>", timstart) now_end = datetime.now() timend = now_end.timestamp() print('second ===>', i...
the-stack_0_14554
import numpy as np import matplotlib.pyplot as plt Nx = 81 Nz = 81 Lx = 91.42 Lz = 100.0 xn = np.linspace(0,Lx,Nx) Liton = -0.8*Lz + 0.02*Lz*np.cos(np.pi*xn/Lx) Liton = Liton*1000 f = open("interfaces_creep.txt","w") f.write("C 1.0 1.0\n") f.write("rho -1000. 0.\n") f.write("H 0.0E-12 0.0E-12\n") f.write("A 0.0 ...
the-stack_0_14555
import json import re import time import typing import warnings import inspect import numpy as np import zmq from weakref import WeakSet import threading import copy import sys class DataSocket: """ Wrapper for ZMQ socket that sends and recieves dictionaries """ def __init__(self, context, port, type...
the-stack_0_14558
# pylint: disable=no-self-use,invalid-name import pytest from allennlp.common import Params from allennlp.common.checks import ConfigurationError from allennlp.data.iterators import BucketIterator from allennlp.tests.data.iterators.basic_iterator_test import IteratorTest class TestBucketIterator(IteratorTest): #...
the-stack_0_14559
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import satchmo_utils.fields class Migration(migrations.Migration): dependencies = [ ('product', '0001_initial'), ] operations = [ migrations.CreateModel( name='CustomProd...
the-stack_0_14563
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PyTetoolkit(PythonPackage): """TEToolkit is a software package that utilizes both unambigu...
the-stack_0_14567
import json import os import pycspr # A known casper test-net node address. _NODE_ADDRESS = os.getenv("CASPER_NODE_ADDRESS", "3.136.227.9") # A known block hash. _BLOCK_HASH: bytes = bytes.fromhex("c7148e1e2e115d8fba357e04be2073d721847c982dc70d5c36b5f6d3cf66331c") # A known block height. _BLOCK_HEIGHT: int = 2065...
the-stack_0_14568
from __future__ import absolute_import from selenium import webdriver from shishito.runtime.environment.shishito import ShishitoEnvironment class ControlEnvironment(ShishitoEnvironment): """ Local control environment. """ def get_capabilities(self, config_section): """ Return dictionary of capabili...
the-stack_0_14569
# stdlib import sys from typing import Any from typing import Dict from typing import List from typing import Optional from typing import Tuple from typing import Union # third party from google.protobuf.reflection import GeneratedProtocolMessageType from nacl.signing import SigningKey from nacl.signing import VerifyK...
the-stack_0_14570
#!/usr/bin/env python3 """websocket cmd client for wssrv.py example.""" import argparse import asyncio import signal import sys import aiohttp async def start_client(loop: asyncio.AbstractEventLoop, url: str) -> None: name = input("Please enter your name: ") # input reader def stdin_callback() -> None: ...
the-stack_0_14573
import os import signal import psutil from rest.api.loghelpers.message_dumper import MessageDumper from rest.service.fluentd import Fluentd class ProcessUtils: def __init__(self, logger): self.logger = logger self.fluentd_utils = Fluentd(logger) self.message_dumper = MessageDumper() ...
the-stack_0_14575
import discord import sqlite3 import re from datetime import datetime from discord import Message, TextChannel, Member, PartialEmoji from discord.ext import commands class Music(commands.Cog, name="Please don't stop the music"): def __init__(self, client): self.client = client @commands.command(a...
the-stack_0_14576
# -*- coding: utf-8 -*- """ simulation script for benchmark data """ #%% import sys import os sys.path.insert(0, ".." + os.sep + ".." + os.sep) from benchmarking.benchmarking_tools import SurfaceCodeBenchmarkingTool from qiskit.providers.aer.noise import NoiseModel from qiskit.providers.aer.noise.errors import pauli_e...
the-stack_0_14577
import requests from bs4 import BeautifulSoup import pytest import time import hashlib def find_playstation_price(url): response = requests.get(url) soup = BeautifulSoup(response.text, 'html.parser') price = soup.find(class_='psw-t-title-m').text return price def find_apple_store_price(url): res...
the-stack_0_14578
import os import threading import queue import asyncio def convert_video(Q,file): if not Q.empty(): async def covert_720p(): os.system('ffmpeg -i ' + file + ' -r 30 -b 2M -s 1280x720 ' + file + '_720.mp4') print(threading.currentThread()) return '720P covert successfull...
the-stack_0_14579
import click import py42.sdk.queries.alerts.filters as f from py42.exceptions import Py42NotFoundError from py42.sdk.queries.alerts.alert_query import AlertQuery from py42.sdk.queries.alerts.filters import AlertState from py42.sdk.queries.alerts.filters import RuleType from py42.sdk.queries.alerts.filters import Severi...
the-stack_0_14581
""" Functions for creating and restoring url-safe signed JSON objects. The format used looks like this: >>> signing.dumps("hello") 'ImhlbGxvIg:1QaUZC:YIye-ze3TTx7gtSv422nZA4sgmk' There are two components here, separated by a ':'. The first component is a URLsafe base64 encoded JSON of the object passed to dumps(). T...
the-stack_0_14582
import os import sys import miind.include as include import miind.algorithms as algorithms import miind.nodes as nodes import miind.connections as connections import miind.simulation as simulation import miind.variables as variables import xml.etree.ElementTree as ET import argparse import miind.directories as director...
the-stack_0_14583
# -*- coding: utf-8 -*- """ Code source: https://github.com/KaiyangZhou/deep-person-reid """ from __future__ import division, print_function, absolute_import import math import numpy as np from itertools import repeat from collections import namedtuple, defaultdict import torch __all__ = ['compute_model_complexity'] "...
the-stack_0_14586
import os PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) PACKAGE_ROOT = os.path.abspath(os.path.dirname(__file__)) BASE_DIR = PACKAGE_ROOT DEBUG = True TEMPLATE_DEBUG = DEBUG DATABASES = { "default": { "ENGINE": "django.db.backends.sqlite3", "NAME": "dev.db", ...
the-stack_0_14587
#! /usr/bin/env python3 # -*- coding: utf-8 -*- import os import sys import time try: import frida except ImportError: sys.exit('install frida\nsudo python3 -m pip install frida') def err(msg): sys.stderr.write(msg + '\n') def on_message(message, data): if message['type'] == 'error': err('[!] ' + message['stac...
the-stack_0_14590
import asyncio import base64 import binascii import hashlib import json import logging import os import random import requests import sys import time from urllib.parse import urlparse from qrcode import QRCode from aiohttp import ClientError from uuid import uuid4 from datetime import date sys.path.append(os.path.d...
the-stack_0_14593
# -*- coding: utf-8 -*- """ module to do uiauto """ import json import re import codecs import time from urllib2 import URLError from appium import webdriver from selenium.common.exceptions import WebDriverException from logger import logger from emulator import ADB from db import DB from smartmonkey import Navigato...
the-stack_0_14594
from setuptools import find_packages, setup with open('README.md') as readme_file: readme = readme_file.read() with open('requirements.txt') as requirements_file: requirements = requirements_file.read().split('\n') setup( author='Philipp Bode, Christian Warmuth', classifiers=[ 'Development St...
the-stack_0_14597
# coding: utf-8 import os import re from time import gmtime, localtime, strftime, time from django import forms from django.contrib import messages from django.contrib.admin.views.decorators import staff_member_required from django.core.files.storage import (DefaultStorage, FileSystemStorage, ...
the-stack_0_14598
''' Module for gathering and managing network information ''' # Import python libs import logging # Import salt libs from salt.utils.socket_util import sanitize_host __outputter__ = { 'dig': 'txt', 'ping': 'txt', 'netstat': 'txt', } log = logging.getLogger(__name__) def __virtual__(): ''' ...
the-stack_0_14601
from nintendo.nex import backend, authentication, friends, nintendo_notification from nintendo import account import rpc import time client_id = '472185292636291082' rpc_obj = rpc.DiscordIpcClient.for_platform(client_id) print("RPC connection successful.") # Wii U Console Details DEVICE_ID = 1111111111 SERIAL_NUMBER...
the-stack_0_14602
"""The Met Office integration.""" import asyncio import logging import datapoint from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_API_KEY, CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME from homeassistant.core import HomeAssistant from homeassistant.exceptions import ConfigEntryNot...
the-stack_0_14603
# Copyright 2016-2017 Workonline Communications (Pty) Ltd. All rights reserved. # # The contents of this file are 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/license...
the-stack_0_14605
import dbProvider as db import json from operator import itemgetter from flask import Flask, url_for, render_template, abort, make_response, redirect app = Flask(__name__) serverName = '146.185.179.193:5000' # serverName = 'otkachkaseptika.ru' def getStaticPath(relativePath): # return '/static/' + relativePath ...
the-stack_0_14609
#!/usr/bin/env python3 # Copyright (c) 2017-2018 The Bitcoin Core developers # Copyright (c) 2019 Chaintope Inc. # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Tests NODE_NETWORK_LIMITED. Tests that a node configured with -pru...
the-stack_0_14610
import os import argparse import numpy as np from algos import construct_classifier, classifier_types from utils.data_utils import get_dataset, dataset_names from utils.misc import increment_path from utils.tf_utils import launch_tensorboard from utils.vis_utils import plot_embeddings masterdir = "/tmp/fairml-farm/" b...
the-stack_0_14612
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ' a test module' __author__ = 'DANTE FUNG' import sys def test(): args = sys.argv if len(args) == 1: print('Hello world!') elif len(args) == 2: print('Hello, %s!' % args[1]) else: print('Too many arguments!') if __name__ == '__m...
the-stack_0_14613
from typing import List, Any def quick_sort(array: List[Any], arr_length: int) -> List[Any]: def __quick_sort(start: int, end: int) -> None: if start >= end: return pivot = array[(start + end) // 2] left, right = start, end while left <= right: while array...
the-stack_0_14614
#!/usr/bin/env python # -*- coding: utf-8 -*- import datetime import json import os import random as _random import sys import traceback from getopt import getopt, GetoptError from multiprocessing import Process from os import environ from wsgiref.simple_server import make_server import requests as _requests from json...
the-stack_0_14617
# Copyright (c) University of Utah from IPython.display import display from traitlets import Bool, Dict, HasTraits, Instance, Int, List, Tuple, Unicode, observe, Set, link from ipywidgets import HBox, VBox, IntRangeSlider, FloatRangeSlider import ipywidgets as widgets from . import BaseTreeView from .filters import At...
the-stack_0_14619
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under th...
the-stack_0_14621
from typing import TypeVar, Optional T = TypeVar("T") def ensure(value: Optional[T]) -> T: if value is None: raise RuntimeError("Expected a non-None value to be present.") return value
the-stack_0_14622
import collections.abc import copy import datetime import decimal import operator import uuid import warnings from base64 import b64decode, b64encode from functools import partialmethod, total_ordering from django import forms from django.apps import apps from django.conf import settings from django.core import checks...
the-stack_0_14623
data = ( 'jjwaels', # 0x00 'jjwaelt', # 0x01 'jjwaelp', # 0x02 'jjwaelh', # 0x03 'jjwaem', # 0x04 'jjwaeb', # 0x05 'jjwaebs', # 0x06 'jjwaes', # 0x07 'jjwaess', # 0x08 'jjwaeng', # 0x09 'jjwaej', # 0x0a 'jjwaec', # 0x0b 'jjwaek', # 0x0c 'jjwaet', # 0x0d 'jjwaep',...
the-stack_0_14624
import matplotlib.pyplot as plt import numpy as np import pandas as pd from matplotlib.ticker import MultipleLocator from mpl_toolkits.mplot3d import Axes3D import hanshu proapp=pd.read_excel("C:\\Users\\eric\\Desktop\\月报数据\\月报数据.xlsx",'省公司每月检测缺陷密度') proapp0=hanshu.zyzh(proapp) print(proapp0) fig = plt.fig...
the-stack_0_14625
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # --- # jupyter: # jupytext: # text_representation: # extension: .py # format_name: light # format_version: '1.4' # jupytext_version: 1.1.4 # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # # s_dy...
the-stack_0_14630
# Something, something words with digit N times import re pattern_word = re.compile(r'\b\w+\b') pattern_sentence = re.compile(r'^[A-Z].*[\.\!\?]$') criteria = list(input()) letter, times = criteria[0], int(criteria[1]) result = [] while True: user_input = input() if user_input == 'end': break ...
the-stack_0_14631
# ---------------------------------------------------------------------------- # CLASSES: nightly # # Test Case: queriesOverTime.py # # Tests: queries - Database # # Defect ID: none # # Programmer: Kathleen Bonnell # Date: March 31, 2004 # # Modifications: # # Hank Childs, Tue Apr 13 13:00...
the-stack_0_14633
from pydub import AudioSegment import requests import easygui # get the stuff for making the mp3 text = easygui.enterbox(msg='Enter the text for the spooky man to say.', title='Damon, I love you!', default='', strip=True) headers = { 'Connection': 'keep-alive', 'Accept': '*/*', 'Origin': 'http...
the-stack_0_14634
#!/usr/bin/env python # encoding: utf-8 # Modifications copyright Amazon.com, Inc. or its affiliates. # Carlos Rafael Giani, 2006 (dv) # Tamas Pal, 2007 (folti) # Nicolas Mercier, 2009 # Matt Clarkson, 2012 import os, sys, re, tempfile from waflib import Utils, Task, Logs, Options, Errors from waflib.Logs import deb...
the-stack_0_14635
import logging import numpy as np import torch import torch.utils.data as data import torchvision.transforms as transforms from .datasets import CIFAR10_truncated logging.basicConfig() logger = logging.getLogger() logger.setLevel(logging.INFO) # generate the non-IID distribution for all methods def read_data_distr...
the-stack_0_14637
# pylint: disable=protected-access, unused-argument import os import glob import radical.utils as ru from .test_common import setUp from radical.pilot.agent.launch_method.jsrun import JSRUN try: import mock except ImportError: from unittest import mock # ------------------------------------...
the-stack_0_14638
from setuptools import setup with open("README.md", "r", encoding="utf-8") as f: long_description = f.read() ## edit below variables as per your requirements - REPO_NAME = "Movie-Recommender-System" AUTHOR_USER_NAME = "Nitin" SRC_REPO = "src" LIST_OF_REQUIREMENTS = ['streamlit'] setup( name=SRC_REPO, ve...
the-stack_0_14640
import os import pathlib import subprocess from sphinx.ext.doctest import (Any, Dict, DocTestBuilder, TestcodeDirective, TestoutputDirective, doctest, sphinx) from sphinx.locale import __ class JavaDocTestBuilder(DocTestBuilder): """ Runs java test snippets in the documentatio...
the-stack_0_14641
import numpy as np k = lambda x:3*np.sin(x)*np.exp(np.sqrt(x))/(2*x) def cordes_para(f,x0,epsilon,gamma,maxiter=50): xn = x0 for i in range(maxiter): xn_ = xn xn = xn-f(xn)/gamma print(xn, f(xn)) return (xn, np.abs(xn_-xn)<epsilon) print(cordes_para(lambda x:k(x)-0.25, 3.5, 1, 5))
the-stack_0_14644
#!/usr/bin/env python # -*- coding: utf-8 -*- # # hydroengine documentation build configuration file, created by # sphinx-quickstart on Fri Jun 9 13:47:02 2017. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this #...
the-stack_0_14645
import sys import torch from setuptools import setup, find_packages from torch.utils.cpp_extension import BuildExtension, CUDAExtension, CppExtension def trt_inc_dir(): return "/usr/include/aarch64-linux-gnu" def trt_lib_dir(): return "/usr/lib/aarch64-linux-gnu" ext_modules = [] exclude_dir = ["torch2trt/co...
the-stack_0_14646
from train import CoordParser def cluster(file_list, output, n_clusters=None, max_files=None): import warnings warnings.filterwarnings("ignore", category=DeprecationWarning) from mpl_toolkits.basemap import Basemap import numpy as np if n_clusters is None: n_clusters = 100 # Parse the coordinates parser = C...
the-stack_0_14648
# # Licensed to Dagda under one or more contributor # license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright # ownership. Dagda licenses this file to you under # the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance...
the-stack_0_14652
import os import sys module_path = os.path.abspath(os.path.join('..')) if module_path not in sys.path: sys.path.append(module_path) from src.PanelMethod import * import numpy as np from scipy.special import exp1 def wave_source(x,y,xs,ys,K): "Source plus generated free surface waves" r2 = (x-xs)**2+(y-ys)**2 ...
the-stack_0_14653
"""Support for Tellstick sensors.""" from collections import namedtuple import logging from tellcore import telldus import tellcore.constants as tellcore_constants import voluptuous as vol from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.const import CONF_ID, CONF_NAME, CONF_PROTOCOL, TE...
the-stack_0_14654
""" Author: Alex Kiernan Desc: Fact model """ from app import db class Fact(db.Model): __tablename__ = 'prediction_facts' pf_date = db.Column('pf_date', db.Date, primary_key=True) pf_time_of_day = db.Column('pf_time_of_day', db.Integer, primary_key=True) user_id = db.Column('user_id', db.Inte...
the-stack_0_14655
# -*- coding: utf-8 -*- # # Copyright (C) 2005-2020 Edgewall Software # Copyright (C) 2005-2006 Christian Boos <cboos@edgewall.org> # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms # are also available at http...
the-stack_0_14657
from tridesclous import get_dataset from tridesclous.peakdetector import get_peak_detector_class import time import itertools import scipy.signal import numpy as np import sklearn.metrics.pairwise from matplotlib import pyplot from tridesclous.tests.test_signalpreprocessor import offline_signal_preprocessor from t...
the-stack_0_14658
from urllib.request import urlopen, Request import os import src.util as util def save_image_tag(bs_object, conf): # Header for passing header checker if conf['site_name'] == conf['comic_sites'][0]: headers = conf['headers']['m'] elif conf['site_name'] == conf['comic_sites'][1]: header...