content
stringlengths
5
1.05M
import os ############################################# # BenchMark Bike ############################################# os.system('python STMeta_Obj.py -m STMeta_v0.model.yml -d bike_nyc.data.yml ' '-p graph:Distance-Correlation-Interaction') os.system('python STMeta_Obj.py -m STMeta_v0.model.yml -d bike_ch...
from base64 import b64decode from Crypto.Cipher import AES from S2C09 import pkcs7_pad, pkcs7_unpad from S1C07 import aes_ecb_decrypt def aes_ecb_encrypt(data, key): """Encrypts the given data with AES-ECB, using the given key. The data is always PKCS 7 padded before being encrypted. """ cipher = AES....
"""Configuration classes""" import collections import json import typing from dataclasses import dataclass, field from pathlib import Path from dataclasses_json import DataClassJsonMixin @dataclass class AudioConfig(DataClassJsonMixin): filter_length: int = 1024 hop_length: int = 256 win_length: int = 10...
# Generated by Django 3.0.8 on 2020-07-17 03:25 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('app_portfolio_skills', '0002_auto_20200717_0322'), ] operations = [ migrations.AlterModelOptions( name='skill', options={'or...
DesignA = False DesignB = False DesignC = True N_DOMAINS=1 execfile('Analysis.py')
# https://leetcode.com/contest/weekly-contest-67/problems/partition-labels/ # 基本思路是首先找到每个字符的最后出现的位置 # 然后从字符串头开始遍历这个字符串,要保证当前的字符的位置要小于此字符出现的最后位置,在遍历的过程中,要动态更新最后的位置。 # 时间复杂度就是O(n) class Solution: def partitionLabels(self, S): """ :type S: str :rtype: List[int] """ output=[] ...
import urllib def digitalRead(port, url='http://127.0.0.1/arduino'): return urllib.urlopen(url + "/digital/" + str(port)).read() def digitalWrite(port, state, url='http://127.0.0.1/arduino'): return urllib.urlopen(url + "/digital/" + str(port) + "/" + str(state)).read() def analogRead(port, url='http://127.0...
#map seq = range(8) newseq = map(lambda x : x*x, seq); print newseq #reduce rseq = range(16) rnewseq = reduce(lambda x,y: x + y, rseq) print rnewseq rnewseq2 = reduce(lambda x,y: x + y, [], 8) print rnewseq2 #filter fseq = range(16) fnewseq = filter(lambda x: x % 2 == 0, fseq) print fnewseq #mapoverstring def f(x):...
from panther import lookup_aws_account_name def rule(event): return (event['eventName'] == 'ConsoleLogin' and event['userIdentity'].get('type') == 'Root' and event.get('responseElements', {}).get('ConsoleLogin') == 'Failure') def title(event): return 'AWS root login failed from [{ip}...
class Solution: def isStrobogrammatic(self, num: str) -> bool: strobogrammatic = { '1': '1', '0': '0', '6': '9', '9': '6', '8': '8' } for idx, digit in enumerate(num): if digit not in strobogrammatic or strobogrammatic[...
# test/unit/sort_search/utils_test.py # # Author: Daniel Clark, 2016 ''' Unit test module to perform testing on utils module ''' # Import packages import unittest class AMergeBTestCase(unittest.TestCase): ''' TestCase for the sorting module ''' # Set up test case def setUp(self): ''' ...
#! /usr/bin/python # coding: utf-8 # Copyright 2018 IBM 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 re...
def read_file(file_name): data = "" with open(file_name, "r") as file: data = file.read() return data def banks_string_representation(banks): return ' '.join(str(x) for x in banks) def is_infinite_loop(banks, previous_allocations): return banks_string_representation(banks) in previous_al...
import discord from discord.ext import commands, tasks from itertools import cycle cl = commands.Bot(command_prefix='%') stats = cycle(['Stat1', 'Stat2']) @cl.event async def on_ready(): print('ready') @tasks.loop(seconds = 3) async def changeStat(): await cl.change_presence(activity=discord.Game(next(stats)...
class Solution: def plus_one(self, digits: list): # 最后一位不是9的标记位 length = len(digits) - 1 while digits[length] == 9: digits[length] = 0 length -= 1 if length < 0: digits = [1] + digits else: digits[length] += 1 return dig...
from jutge import read def Square1(n): for i in range(n): print(str(n) * n) size = read(int) if size is not None: Square1(size) size = read(int) while size is not None: print("") Square1(size) size = read(int)
# Server Connections Alert COG from __future__ import annotations import discord from discord.ext import commands, tasks from glob import glob import os, json, time import traceback from .webhook_formatter import format_push_hook GIT_HOOK_DUMPS_DIR = "/git-hooks" CHANNEL_ID = int(os.environ.get("DISCORD_CHANNEL_ID"))...
# This is a sample Python script. # Press Shift+F10 to execute it or replace it with your code. # Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. import cv2 import numpy as np import argparse import time def load_yolo(): net = cv2.dnn.readNet("yolov3.weights...
from collections import OrderedDict import keyword #TODO: can we just sub-class tuple and be a tuple of tuples with attributes? class Choices(object): """ An enum-type class for creating immutable choices for django CharFields. Usage: MY_CHOICES = Choices([('YES', 'Yes'), ('NO', 'No'), ('MAYBE', 'M...
"""Python Libraries/Modules/Packages""" import csv import os from rdflib import * """Imported Functions""" from functions.admin_metadata_functions import admin_metadata_mapping from functions.boolean_functions import class_test from functions.formatting_functions import edit_kiegel from functions.split_by_spa...
from django.test import RequestFactory, TestCase, override_settings from django.views.debug import CLEANSED_SUBSTITUTE from jellyglass.models import Spoon from jellyglass.utils import record_spoon class SensitivePostParametersTest(TestCase): def setUp(self): rf = RequestFactory() self.request = ...
###################################################################################################################### # Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # ...
import numpy as np import cv2 # Helper to identify HSV parameters of XRay images def nothing(): pass cv2.namedWindow("Tracking") cv2.createTrackbar("LH", "Tracking", 0, 255, nothing) cv2.createTrackbar("LS", "Tracking", 0, 255, nothing) cv2.createTrackbar("LV", "Tracking", 0, 255, nothing) cv2.createTrackbar("UH...
# Note. # Highly unoptimized code which really needs factoring, but work nonetheless from math import floor, ceil class Node: def __init__(self, literal = True, left = None, right = None, val = 0, parent = None, isLeftchild = True) -> None: self.literal = literal self.val = val self.left ...
# -*- coding: utf-8 -*- import scrapy class BioonSpider(scrapy.Spider): name = "bioon" start_urls = ['http://news.bioon.com/mobileMedical/research-%d.html'%x for x in range(1,51)] start_urls.extend(['http://news.bioon.com/mobileMedical/company-%d.html'%x for x in range(1,39)]) start_urls.extend(['htt...
import numpy as np import scipy.ndimage as ndi from skimage import morphology from numba import jit, prange from tqdm import tqdm import torch @jit(nopython=True) def _local_thick_2d(mask, med_axis, distance, search_extent, sampling): out = np.zeros_like(mask, dtype=np.float32) nonzero_x = np.nonzero(mask) ...
import weakref import os import utils import unittest TOPDIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) utils.set_search_paths(TOPDIR) from Qt.QtWidgets import QTreeView, QPushButton, QCheckBox # noqa: E402 from Qt.QtCore import QModelIndex, Qt # noqa: E402 import src # noqa: E402 import src...
# -*- coding: utf-8 -*- """Chemical Engineering Design Library (ChEDL). Utilities for process modeling. Copyright (C) 2016, Caleb Bell <Caleb.Andrew.Bell@gmail.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal...
from setuptools import setup setup(name='pyW215', version='0.4', description='Interface for d-link W215 Smart Plugs.', url='https://github.com/linuxchristian/pyW215', author='Christian Juncker Brædstrup', author_email='christian@fredborg-braedstrup.dk', ...
from django.conf.urls import url from . import views urlpatterns = [ # Let React Router handle the url routing. url(r'.*', views.index, name='index'), ]
import re import html import subprocess import tempfile import unidecode from django.conf import settings from ingredient_phrase_tagger.training import utils def parse_ingredients(input_text): with tempfile.NamedTemporaryFile(mode='w') as input_file: input_file.write(utils.export_data(input_text)) ...
#!/usr/bin/env python3 from distutils.core import setup setup(name='sptrader', version='0.10.0', description='SharpPoint trading system', author='Joseph C Wang', author_email='joequant@gmail.com', url='https://github.com/joequant/sptrader', packages=['sptrader'], install_requ...
from pyod.models.iforest import IForest from pyod.utils.data import generate_data from pyod.utils.example import visualize X_train, X_test, y_train, y_test = generate_data(n_train=2000, n_test=1000, n_features=2, behaviour="new") clf_name = 'IsolationForest' clf = IForest() clf.fit(X_train) y_train_pred = clf.labe...
import argparse from hio import help from hio.base import doing from keri.app import directing, indirecting from keri.app.cli.common import existing from keri.vdr import registering logger = help.ogler.getLogger() parser = argparse.ArgumentParser(description='Initialize a prefix') parser.set_defaults(handler=lambda...
#!/usr/bin/env python # coding: utf-8 # In[ ]: import dask import numpy as np import numpy.typing as npt from typing import * # Dask multithreading is only suited for mostly non-Python code (like pandas, numpy, etc.) #tag::threads[] dask.config.set(scheduler='threads') #end::threads[] #tag::process[] dask.config.set...
url_map = { 'https://media.services.pbs.org/api/v1/episodes/0057421c-9655-405c-b63e-144153d46666/': 'test_fixtures/nova_episodes_0057421c-9655-405c-b63e-144153d46666.json', 'https://media.services.pbs.org/api/v1/episodes/0057421c-9655-405c-b63e-144153d46666/assets/': 'test_fixtures/nova_episodes_0057421c-9655-4...
from enum import Enum import numpy as np class KEY(Enum): UP = 0, DOWN = 1, LEFT = 2, RIGHT = 3, PICKUP = 4, TRANSFORM = 5, USE_1 = 5, USE_2 = 6, USE_3 = 7, USE_4 = 8, USE_5 = 9, QUIT = 'q' WHITE = (255, 255, 255) LIGHT = (196, 196, 196) GREEN = (80, 160, 0) DARK = (1...
#! /usr/bin/env python from distutils.core import setup, Extension import os import sys pwd = os.getcwd() project_top_dir = os.getenv('PROJECT_TOP_DIR') if project_top_dir is None: project_top_dir = os.path.join(pwd, '/../') include_dir = os.path.join( project_top_dir, 'include' ) src_python_dir = os.path.join...
from setuptools import find_packages, setup def requirements(filename): with open(filename) as f: lines = f.read().splitlines() return lines setup( name="contrail-vcenter-manager", version="0.1dev", packages=find_packages(), package_data={'': ['*.html', '*.css', '*.xml', '*.yml']}, ...
import json def loadFile(filename): with open('./sophyAssistant/src/'+filename) as json_file: data = json.load(json_file) return data
''' re模板:2.2.1 requests模板:2.18.4 bs4模板:4.6.0 json模板:2.0.9 爬取百度新闻所有的新闻的前1页 标题和URL地址 ''' import requests import json from bs4 import BeautifulSoup import re #获得每页新闻标题和新闻地址 def getPageInfo(url,page): newurl=url + str(page) res = requests.get(newurl) jd = json.loads(res.text) list1 = jd['data']['list'] ...
import abjad from .underfull_duration import underfull_duration def selection_is_full(selection: abjad.Selection) -> bool: r"""Returns a :obj:`bool` representing whether the last measure of an input |abjad.Selection| is fully filled in or not. Basic usage: Returns ``True`` if the last measure of...
import string import secrets population = set().union(string.ascii_lowercase, string.ascii_uppercase, string.digits) len_password = 20 print(f"Population size: {len(population)}. Output size: {len_password}.") print("".join(secrets.SystemRandom().choices(tuple(population), weights=None, cum_weights=None, k=len_passw...
import os import sys import traceback from PyQt5.QtWidgets import QMainWindow, QDesktopWidget, QApplication, \ QFileDialog, QMessageBox from PyQt5 import uic from PyQt5.QtCore import QUrl, QSettings, Qt from PyQt5.QtGui import QDesktopServices from copasi_petab_importer import convert_petab class PETabGui(QMainW...
from flask import Flask, render_template, jsonify from flask_cors import CORS import os app = Flask(__name__) port = int(os.getenv("PORT", 9099)) CORS(app) @app.route('/') def index(): return render_template('index.html'), 200 @app.route('/section.html') def section(): return render_template('section.html')...
# 15 shades of grey display.fill(0) for r in range(0, 16): display.framebuf.fill_rect(0, r*6, 96, 6, r) display.show()
import pytest from flask import g, session def test_login(client, auth): # test that viewing the page renders without template errors response = client.get('/auth/login') assert response.status_code == 200 assert b"Login" in response.data assert b"Username" in response.data assert b"Password" ...
from notipy_me import Notipy from repairing_genomic_gaps import cae_500, build_multivariate_dataset_cae, train_model if __name__ == "__main__": with Notipy(): model = cae_500() train, test = build_multivariate_dataset_cae(500) model = train_model(model, train, test, path="multivariate_gaps"...
import re class gtf_data: def __init__(self, gtf_filename='lib/Saccharomyces_cerevisiae.EF4.70.gtf'): self.has_introns = set() self.intron_list = {} self.txpt_ranges = {} self.read_file(gtf_filename) def read_file(self, gtf_filename): # GTF files are 1-based. ...
# Acorn tree reactor | edelstein REQUEST_FROM_A_DOCTOR = 23003 WHOLE_ACORN = 4034738 reactor.incHitCount() if reactor.getHitCount() >= 3: if sm.hasQuest(REQUEST_FROM_A_DOCTOR) and not sm.hasItem(WHOLE_ACORN, 2): sm.dropItem(WHOLE_ACORN, sm.getPosition(objectID).getX(), sm.getPosition(objectID).getY()) sm.remo...
# Window that opens when you pick one of the removal options from PyQt5.QtCore import QProcess from PyQt5.QtWidgets import QDialog, QVBoxLayout, QLabel, QHBoxLayout, QPushButton, QPlainTextEdit class RemoverWindow(QDialog): def __init__(self, selected_kernels: list = []): super(QDialog, self).__init__() ...
import pytest from mikefm_skill.model import ModelResult from mikefm_skill.observation import PointObservation from mikefm_skill.metrics import root_mean_squared_error, mean_absolute_error @pytest.fixture def klagshamn(): fn = "tests/testdata/smhi_2095_klagshamn.dfs0" return PointObservation(fn, item=0, x=36...
#!/usr/bin/env python """Run a worker for the job queue. :Copyright: 2014-2022 Jochen Kupperschmidt :License: Revised BSD (see `LICENSE` file for details) """ from rq import Worker from byceps.application import create_app from byceps.util.jobqueue import connection, get_queue if __name__ == '__main__': app = ...
#!/usr/bin/env python3 # # Copyright (c) 2020 Project CHIP 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 # # Unl...
# -*- coding: utf-8 -*- from dataclasses import dataclass from typing import Optional @dataclass class TranslationData: homepage: Optional[str] overview: Optional[str] title: Optional[str] def __str__(self) -> str: return self.title @dataclass class Translation: data: Optional[Translati...
# -*- coding: utf-8 -*- # @Author: freefly801213 # @Date: 2022-01-03 00:02 from flask_restful import Resource, reqparse, marshal_with from service.GeneralService import GeneralService from common import Commons, HttpCommons class GeneralApi(Resource): """ 通用图片/PDF的OCR处理接口 """ def __init__(self): ...
from .screen_point import * from .locate_points import InteractivePositionLocator
from functools import partial import pytest from .vm_test_helpers import run_test run_control_flow_ops_vm_test = partial( run_test, "tests/fixtures/LegacyTests/Constantinople/VMTests/vmIOandFlowOperations", ) @pytest.mark.parametrize( "test_file, check_gas_left", [ ("jump0_jumpdest0.json", ...
import os os.chdir("D:\\Programmes\\Boxes\\KaliLinux\\FCSC2020\\forensics\\CryptoLocker") f = open("flag.txt.enc", "rb") encoded = f.read() f.close() f = open("key.txt", "rb") key = f.read() f.close() flag = "" for j in range(len(key)): flag = "" for i in range(len(encoded)): flag += chr((encoded[i]...
from .interface import res
"""File storage support.""" from collections import defaultdict import datetime import os import re import constants as cn from database import model from PIL import Image, ExifTags PHOTO_TYPE = ["jpg"] def _from_exif_real(value): """Gets value from EXIF REAL type = tuple(numerator, denominator)""" return value...
import logging import random import time log = logging.getLogger(__name__) class LoadTest(object): def __init__(self, gun): self.gun = gun def case1(self, task): with self.gun.measure(task): log.info("Shoot case 1: %s", task.data) time.sleep(random.random()) def ...
from collections import defaultdict import six from chainercv.chainer_experimental.datasets.sliceable.sliceable_dataset \ import _as_tuple from chainercv.chainer_experimental.datasets.sliceable import SliceableDataset class TupleDataset(SliceableDataset): """A sliceable version of :class:`chainer.datasets.Tu...
#Author: Nicolas Schapeler #Github: https://github.com/nschapeler #Problem Statement: https://www.hackerrank.com/challenges/matrix-script/problem import re first_multiple_input = input().rstrip().split() n = int(first_multiple_input[0]) m = int(first_multiple_input[1]) matrix = [] for _ in range(n): matrix_item...
#!/usr/bin/env python # MIT License # (c) baltasar 2016 from google.appengine.ext import ndb class Photo(ndb.Model): added = ndb.DateProperty(auto_now_add=True) title = ndb.StringProperty(required=True) image = ndb.BlobProperty() tags = ndb.StringProperty(repeated=True)
#!/usr/bin/env python3 import argparse import genanki import glob import mistune import os import re import sys from HighlightRenderer import HighlightRenderer markdown = mistune.create_markdown(renderer=HighlightRenderer()) cardSeparator = "---" frontBackSeparator = "%" md_file_ext = (".md", ".markdown") media_file...
from neighapp.models import Business, Neighbourhood, Post, Profile from django import forms from django.contrib.auth.models import User from django.contrib.auth.forms import UserCreationForm class RegistrationForm(UserCreationForm): email=forms.EmailField() class Meta: model = User fields = ['u...
#system libraries import pickle def writepickle(data, filename, mode): if mode == 'lambda': import boto3 s3 = boto3.client('s3') serializedListObject = pickle.dumps(data) s3.put_object(Bucket='weather-lambda-myapp',Key=filename,Body=serializedListObject) else: #local ...
import streamlit as st import numpy as np import matplotlib.pyplot as plt from matplotlib import dates from datetime import datetime,date import pyowm from pyowm import OWM from matplotlib import rcParams from pytz import timezone from pyowm.utils import timestamps weather_api='0833f103dc7c2924da06db624f745...
# RailFence Cipher using Python # Author : wh0am1 # GitHub : https://github.com/wh0th3h3llam1 import math import os import platform import random import string def encrypt(strng, rails): strng = strng.replace(" ", "") len_enc = math.ceil(len(strng) / rails) w, h = len_enc, rails encrypte...
from __future__ import annotations from .core import ECSBase # We start with a simple manager like entity, i.e. it does not encapsulate creation/ factory # TODO: finalize # TODO: adapt to asset management like graphics, and audio # TODO: make this a singleton # https://python-3-patterns-idioms-test.readthedocs.io/en...
# RUN: test-lexer.sh %s # NOTE: "import" isn't a proper keyword yet. import module1 # LEXER-LABEL: >0 import module1 import module2 # LEXER-NEXT: >0 import module2 global_y = 1 # LEXER-NEXT: >0 global_y = 1n def my_func(x): # LEXER-NEXT: >0 >de...
#!/usr/bin/env python # -*- coding: utf-8 -*- import re def get_extractor(url): if re.search('xingyan.panda', url): from .import xingyan as s else: from .import panda as s return s.site
file_ = '$DATA_FILE' log_file = '$LOG_FILE' import sys import os from PyQt5.QtWidgets import (QLineEdit, QApplication, QInputDialog, QMessageBox) import base64 from cryptography.fernet import Fernet, InvalidToken from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import hashes ...
from __future__ import absolute_import, division, print_function from six.moves import range def exercise_specific(): from libtbx.topological_sort import stable from libtbx.topological_sort import strongly_connected_components as scc connections = [ ("a", ["b", "d"]), ("b", []), ("c", []), ("d", [...
from dotenv import load_dotenv from datetime import datetime import os from pathlib import Path from tkinter import Tk, Canvas, Entry, Text, Button, PhotoImage # Import namespaces import azure.cognitiveservices.speech as speech_sdk global targetLanguage targetLanguage = '' def gui(): # from tkinter import * ...
class Transaction: def __init__(self, db): self.db = db def __enter__(self): self.db.__enter__() self.cursor = self.db.cursor() self.cursor.__enter__() return self.cursor def __exit__(self, type, value, traceback): self.cursor.__exit__(type, value, traceba...
# Generated by sila2.code_generator; sila2.__version__: 0.8.0 from __future__ import annotations from typing import Any, NamedTuple class MoveToHomePosition_Responses(NamedTuple): pass class StopMoving_Responses(NamedTuple): pass class MoveToPosition_Responses(NamedTuple): pass Position = Any
"""Gaussian process utlilities for gpytorch.""" import torch import hessian import gpytorch import numpy as np from torch.nn import ModuleList from gpytorch.distributions import MultivariateNormal from safe_exploration.state_space_models import StateSpaceModel from .utilities import compute_jacobian __all__ = ['Ba...
import os from core.database import Database from core.seed import create_tables from telegram.ext import Updater, MessageHandler, CommandHandler, CallbackQueryHandler, Filters from barcode import Code128 from barcode.writer import ImageWriter from dotenv import load_dotenv from core.clients import Clients, Client from...
# Generated by Django 2.1.1 on 2018-10-05 10:51 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ('django_workflow', '0013_auto_20180925_1334'), ] operations = [ migrations.CreateModel( name='ApprovalGroup',...
""" The main window for the GUI. """ from msl.qt import ( QtWidgets, QtGui, Qt, Signal, convert, prompt, application, ) from msl.qt.utils import ( screen_geometry, drag_drop_paths, ) from msl.io import read from .line_edit import LineEdit from .. import logger from .equipment import...
print("Hello World, I am Farhan")
import sys import os import gc import musdb import itertools import torch import museval from functools import partial import numpy as np import random import argparse from xumx_slicq.transforms import make_filterbanks, NSGTBase, phasemix_sep, ComplexNorm from tqdm import tqdm import scipy from scipy.signal import stf...
import os import zipfile from glob import glob from pathlib import Path import boto3 import pandas as pd import xarray as xr import mkgu_packaging from brainio_base.assemblies import BehavioralAssembly from brainio_base.stimuli import StimulusSet from brainio_collection.lookup import pwdb from brainio_collection.know...
from presidio_analyzer.predefined_recognizers import SpacyRecognizer class StanzaRecognizer(SpacyRecognizer): def __init__(self, **kwargs): self.DEFAULT_EXPLANATION = self.DEFAULT_EXPLANATION.replace("SpaCy", "Stanza") super().__init__(**kwargs)
import cv2 import pafy import tensorflow as tf import numpy as np import glob from hitnet import HitNet, ModelType, draw_disparity, draw_depth, CameraConfig out = cv2.VideoWriter('outpy2.avi',cv2.VideoWriter_fourcc('M','J','P','G'), 30, (881*3,400)) # Get image list left_images = glob.glob('DrivingStereo images/left/...
#! /usr/bin/python3 """Challenge #2 in Python.""" # coding: utf-8 list_with_chars = [2, 'a', 'l', 3, 'l', 4, 'k', 2, 3, 4, 'a', 6, 'c', 4, 'm', 6, 'm', 'k', 9, 10, 9, 8, 7, 8, 10, 7] list_with_numbers = [2, 3, 4, 2, 3, 5, 4, 6, 4, 6, 9, 10, 9, 8, 7, 8, 10, 7] def search_list(list_provided): ...
from gym_quadrotor.dynamics import Euler from gym_quadrotor.wrappers.angular_control import attitude_to_motor_control from gym_quadrotor.dynamics.copter import DynamicsState, CopterParams from gym_quadrotor.dynamics.dynamics import simulate_quadrotor import numpy as np import pytest @pytest.mark.parametrize("yaw", np...
import re from dataclasses import InitVar, asdict, dataclass, field from datetime import datetime from typing import Dict, Optional REGEX = r'(?P<month>[A-Z][a-z]{2}) (?P<day>[0-9]{,2}) ' \ + r'(?P<time>[0-9]{2}:[0-9]{2}:[0-9]{2}) mail postfix/[a-z]+\[[0-9]+\]: ' \ + r'(?P<mail_id>[A-Z0-9]+): to=<(?P<to_addre...
from setuptools import setup, find_packages setup(name='shared', version='1.3', packages=find_packages())
"""d2lib is a tool for retrieving information from Diablo 2 data files. These files contain info about the character, items and their properties. Currently supported: .d2s - Diablo 2 save files; .d2x - PlugY personal stash files; .sss - PlugY shared stash files. """ __name__ = 'd2lib' __version__ = '0.2.4...
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! import grpc from github_com.TheThingsNetwork.api.protocol.lorawan import device_pb2 as github_dot_com_dot_TheThingsNetwork_dot_api_dot_protocol_dot_lorawan_dot_device__pb2 from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 ...
"""Simple wrapper to upgrade the files by github URL""" import json import logging import os import re import shutil import subprocess import urllib from hashlib import md5 from typing import Tuple, List import requests import tensorflow as tf # TODO: install file properly with `pip install -e .` import sys sys.pat...
"""Backward-compatibility version of FCNTL; export constants exported by fcntl, and issue a deprecation warning. """ import warnings warnings.warn("the FCNTL module is deprecated; please use fcntl", DeprecationWarning) # Export the constants known to the fcntl module: from fcntl import * # and *only* ...
from dataclasses import dataclass import psycopg2 from mangum.backends.base import WebSocketBackend @dataclass class PostgreSQLBackend(WebSocketBackend): def __post_init__(self) -> None: self.connection = psycopg2.connect(self.dsn, connect_timeout=5) self.cursor = self.connection.cursor() ...
def test_parse_json_urls_file( json_urls_provider, expected_urls_in_json_file, expected_regexp_in_json_file ): parsed_urls = set() parsed_regexp_list = set() for url_data in json_urls_provider: parsed_urls.add(str(url_data.url)) parsed_regexp_list.add(url_data.regexp) assert parsed_...
""" TASK 4: The telephone company want to identify numbers that might be doing telephone marketing. Create a set of possible telemarketers: these are numbers that make outgoing calls but never send texts, receive texts or receive incoming calls. Print a message: "These numbers could be telemarketers: " <list of number...
#!/usr/bin/env python3 """ The p2p connection frontend """ import os import json import hashlib import logging from kademlia.network import Server from twisted.internet import asyncioreactor import asyncio from twisted.internet.defer import Deferred from asyncio.tasks import ensure_future # asyncioreactor.install(eve...
# Databricks notebook source # MAGIC %md # MAGIC # Model Registry # MAGIC # MAGIC MLflow Model Registry is a collaborative hub where teams can share ML models, work together from experimentation to online testing and production, integrate with approval and governance workflows, and monitor ML deployments and their per...