content
stringlengths
5
1.05M
#!/usr/bin/env python3 from setuptools import find_packages, setup setup( author="Jerome Van Der Linden", license="MIT-0", name="verifyAddress", packages=find_packages(), install_requires=["requests"], setup_requires=["pytest-runner"], test_suite="tests", tests_require=["pytest", "pytes...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This module provide high-level class that provides simplified APIs for conducting different experiment. """ import os import pathlib import bluesky import ophyd import epics import databroker import numpy as np from bluesky.callbacks.best_effort import BestEffortCa...
# Copyright 2014-2016 Andreas Riegg - t-h-i-n-x.net # # 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 ...
from django.shortcuts import render, redirect from django.contrib import messages from .models import User, Character, Item, Obstacle import bcrypt def render_register(request): return render(request, 'register.html') def register(request): errors = User.objects.register_validator(request.POST) hashed = b...
# standard library import sys from typing import Dict, Union import json import os # local from utils import run_bash from file import resolve_bare_text_file from standard_column_order import STANDARD_COLUMN_ORDER # # # # # # # # # # # # # # # # # # # # # # # # # # # #...
ix.enable_command_history() ix.api.SdkHelpers.revert_items_overrides(ix.application) ix.disable_command_history()
""" Author: Towaha Email: soft@hotmail.co.uk """ import numpy as np import sys sys.path.append("..") from libs.utils import load_dataset_mnist, preprocess_data, Trainer from libs.mnist_lib import MNIST from optimizations_algorithms.optimizers import SGD from nn_components.activations import softmax from nn_components.l...
import pandas as pd import numpy as np import matplotlib.pyplot as plt df = pd.read_csv("titanic (1).csv") data = pd.get_dummies(df, columns =['Siblings/Spouses', 'Pclass', 'Sex', 'Age', 'Fare']) x = data.iloc[:, 1:].values y = data.iloc[:, 0].values from sklearn.model_selection import train_test_split x_train, x_t...
"""append.py unit tests.""" import pytest from pypyr.context import Context from pypyr.dsl import PyString from pypyr.errors import (ContextError, KeyInContextHasNoValueError, KeyNotInContextError) from pypyr.steps import append # region validation def test_append_...
import re import os import requests import csv SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) DIST_DIR = os.path.join(SCRIPT_DIR, '..', 'dist') default_user_agent = """Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.246""" generic_u...
from keras.preprocessing.image import ImageDataGenerator import numpy as np import keras import cv2 import os, os.path import random default_validation_options = { 'rescale' : 1./255, \ 'samplewise_center': True, \ 'samplewise_std_normalization':True \ } default_...
# -*- coding: utf-8 -*- # Copyright 2012-2013 UNED # # 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 a...
from __future__ import absolute_import, division, print_function, unicode_literals from cosrlib.sources import Source import requests class UrlSource(Source): """ Source that actually fetches an URL. Use with caution! """ def get_partitions(self): if self.args.get("urls"): return [{ ...
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """ Linear filter(s). For the moment, only a Gaussian smoothing filter """ from __future__ import absolute_import import gc import numpy as np import numpy.fft as fft import numpy.linalg as npl from nip...
""" Afterglow Core: API v1 photometry views """ from flask import Response, request from numpy import array from astropy.wcs import WCS from .... import app, auth, errors, json_response from ....resources.data_files import ( get_exp_length, get_gain, get_data_file_data) from ....resources.photometry import get_p...
# Jetfuel Game Engine- A SDL-based 2D game-engine # Copyright (C) 2018 InfernoStudios # # 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...
from .authorization_token import AuthorizationToken, AuthorizationTokenSet
from conans import ConanFile, CMake class TypelistUtilsConan(ConanFile): name = "typelist_utils" version = "0.0.2" # Optional metadata license = "MIT" author = "Leo Ghafari" url = "https://github.com/Yuki-cpp/typelist_utils" description = "Small header only library allowing to manipulate ...
"""Coding_Machine URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/dev/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Cl...
from . import logger
#!/usr/bin/env python # coding: utf-8 # # Introduction # # The issue of keeping one's employees happy and satisfied is a perennial and age-old challenge. If an employee you have invested so much time and money leaves for "greener pastures", then this would mean that you would have to spend even more time and money ...
import inspect import io class socket(): __slots__ = ['conn', 'fp'] def __init__(self, conn, data, *args, **kwargs): if not type(data) == dict or 'status' not in data: return self.conn = conn self.fp = io.BytesIO() response = 'HTTP/1.1 '+str(data['status'])+' '+data...
from pathlib import Path with (Path(__file__).parent / "input.txt").open() as puzzle_input_file: puzzle_input_raw = puzzle_input_file.read() from collections import defaultdict limit = 1_000_000 houses = defaultdict(int) number = int(puzzle_input_raw) for elf in range(1, number): for house in range(elf, min...
import torch import torch.nn.functional as F from torch_geometric.nn import SplineConv from gnn_model import GnnModel import numpy as np import os import matplotlib.pyplot as plt class MinimalSplineConvModel(GnnModel): def __init__(self, config, train_writer, v...
import io import pyqrcode from base64 import b64encode def getqr(data): img = pyqrcode.create(data) buffers = io.BytesIO() img.png(buffers, scale=10) encoded = b64encode(buffers.getvalue()).decode("ascii") return "data:image/png;base64,"+encoded
#Faça um Programa que pergunte quanto você ganha por hora e o número de horas trabalhadas no mês. Calcule e mostre o total do seu salário no referido mês, sabendo-se que são descontados 11% para o Imposto de Renda, 8% para o INSS e 5% para o sindicato, faça um programa que nos dê: #salário bruto. #quanto pagou ao INSS....
# Good analizer must just check code, but not execute! # The lines below is a simple test for this requirement f = open('123','w') f.write('bug!') f.close() # Test begin def func(a, b, c, d): return a + d func(1, 2, 3, "aaa")
# File: pendulum.py # import torch from mechamodlearn.rigidbody import AbstractRigidBody from mechamodlearn.models import ControlAffineLinearForce, ViscousJointDampingForce, GeneralizedForces class SimplePendulumMM(torch.nn.Module): def __init__(self, l): """ Arguments: - `l`: length of...
from .utils import split_combined_polys from .mask_target import mask_target from .mask_transform import get_seg_masks, get_seg_masks_with_boxes, aligned_bilinear __all__ = ['split_combined_polys', 'mask_target', 'get_seg_masks', 'get_seg_masks_with_boxes', 'aligned_bilinear']
from nonebot import on_keyword, on_command from nonebot.typing import T_State from nonebot.adapters.cqhttp import Message, Bot, Event # 这两个没用的别删 from nonebot.adapters.cqhttp.message import MessageSegment import requests from nonebot.permission import * from aiocqhttp.exceptions import Error as CQHttpError ani...
#!/usr/bin/env python3 print('----------------------------------------------------------------') print('- Baxter speech onset steganography demo -') print('- MAR 2021, Halmstad U., Martin Cooney -') print('----------------------------------------------------------------')...
import pytest import pathlib import os import displayio from PIL import Image from unittest import mock from common import utils from adafruit_display_shapes.rect import Rect from adafruit_display_shapes.circle import Circle from adafruit_display_shapes.roundrect import RoundRect from .test_helper...
from flask_cors import CORS import requests from pprint import pprint def test_feature_1(): response = requests.get("http://localhost:5000/feature-hunt/features") assert b'Create product page' in response.content def test_feature_2(): response = requests.get("http://localhost:5000/disentry/features") ...
import cv2 import os import numpy as np import argparse import time import imutils parser = argparse.ArgumentParser() parser.add_argument('-i' , '--input' , required = True , help = 'input path to the video') parser.add_argument('-o' , '--output' , required = True , help = 'output path to the video') parser...
# Copyright (c) OpenMMLab. All rights reserved. runner = dict( # Basic configurations of the runner name='Human Pose and Effects', camera_id=0, camera_fps=30, # Define nodes. # # The configuration of a node usually includes: # 1. 'type': Node class name # 2. 'name': Node name ...
import torch import torch.nn as nn import torch.nn.functional as F import torch.autograd as autograd import torch.optim as optim import numpy as np import os from torch.autograd import Variable from torch.utils import data import copy import math import sys import pandas as pd class Dataset(data.Dataset): 'Charact...
#!/usr/bin/env python # --------------------------------------------------- # # This is a program for Passive Buzzer Module # It will play simple songs. # You could try to make songs by youselves! # # Passive buzzer Pi # VCC ----------------- 3.3V # GND ------------------ GND # SIG ---------------- Pin 11 # # --...
from django.db import models import json # Create your models here. class Data(models.Model): key = models.CharField(max_length=100, verbose_name="键") value = models.TextField(verbose_name="值", blank=True) createtime = models.DateTimeField(auto_now_add=True, verbose_name="创建时间") updatetime = models.D...
# Generated by Django 3.0.11 on 2021-04-05 19:23 from django.db import migrations def sync_team_event_names_and_properties(apps, schema_editor): Team = apps.get_model("posthog", "Team") for team in Team.objects.all(): try: # importing locally in case the code ever moves from p...
# Copyright 2021 The Fairseq Authors and The HuggingFace Inc. team. 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 # #...
""" From lldpd/tests/integration/fixtures/namespaces.py https://github.com/lldpd/lldpd/blob/11c5322cdce727219f88806dbada7795175aa319/tests/integration/fixtures/namespaces.py#L145 """ # All allowed namespace types NAMESPACE_FLAGS = dict(mnt=0x00020000, uts=0x04000000, ipc=0x...
import numpy as np from collections import defaultdict, OrderedDict import operator from src.embedding import Embedding class Rewards_env(): """Rewards environment for biology sequence. Attributes ------------------------------------------------- rewards_dict: dict of list keys: string of embe...
from flask import Flask, render_template, flash, request import requests from os import environ app = Flask(__name__) def tfserving_request(req_input, model_name): # Use this if using Docker compose # url = f"http://server:8501/v1/models/{model_name}:predict" # This is configured to match the kubernetes ...
from django import forms from . import models class ContactCreateForm(forms.ModelForm): class Meta: model = models.Contact fields = ['first_name', 'last_name', 'email', 'address']
# Copyright 2018-2022 Streamlit Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
PolypodalConference = lambda L:max(*L,sum(sorted(L)[:2]))/2 """ An international conference of polypodal creatures is organized on the top of the Glass Mountain. The numbers of legs of the participants, a1, ... ,an, all are positive even numbers. The side of the Glass Mountain is slippery. Each of the creatures gather...
""" Example training to the SNAP database for Tantalum. This script was designed for an exteranl dataset available at https://github.com/FitSNAP/FitSNAP For info on the dataset, see the following publication: Thompson, A. P., Swiler, L. P., Trott, C. R., Foiles, S. M., & Tucker, G. J. (2015). Spectral neighbor analys...
import json, requests import certifi def get_fstv(region): url = requests.get("https://powerful104.pythonanywhere.com/recomm/get_fstv?region="+region, verify = certifi.where()) text = url.text data = json.loads(text) return data['festivals'] ''' test = get_fstv("강원_동해시") print(test[0]) '''
# -*- coding: utf-8 -*- # Generated by Django 1.11.6 on 2017-11-06 21:19 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ("mpesa_core", "0006_auto_20171106_2339"), ] operations = [ migrations.RemoveField( ...
#!/usr/bin/python3 """ zipcam.py This script is for zipping up EAGLE CAM files for OSH Park (and further record keeping). Just point this at an EAGLE project folder and you're good to go. (It takes inspiration from my earlier script---zipboard.py--- for Magzor that checked for naming compliance and a bunch of other th...
#!/bin/python3 import socket HOST = '127.0.0.1' PORT = 7777 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((HOST, PORT))
# -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available. Copyright (C) 2017-2020 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file except in co...
import re def to_hash(n): key = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" res = "" r = n % 62 n /= 62 while n > 0: res = key[r] + res r = n % 62 n /= 62 res = key[r] + res return res def fix_link(l): if re.match(r"[a-zA-z]+://.+", l): ret...
import matplotlib.pyplot as plt x = [1, 2, 4, 5, 6] y = [1.5, 1, 2, 2, 3] titulo = "Gráfico com pontos" eixox = "Eixo X" eixoy = "Eixo Y" plt.title(titulo) plt.xlabel(eixox) plt.ylabel(eixoy) plt.scatter(x, y, label="Meus pontos", color="k") plt.plot(x, y, color="g", linestyle="-.") plt.legend() #plt.show() plt.savefi...
######## # Copyright (c) 2014 GigaSpaces Technologies Ltd. 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...
import os testdir = os.path.dirname(__file__) import unittest import shutil import uuid import json import random import jobChomper.runGraph def createTestBase(): testBase = os.path.join(testdir, str(uuid.uuid4())) os.mkdir(testBase) testTmp = os.path.join(testBase, "tmp") os.mkdir(testTmp) testVar = os....
from django.conf.urls.defaults import patterns, include, url from blongo.blogapp.views import * from blongo.registration import * # Uncomment the next two lines to enable the admin: # from django.contrib import admin # admin.autodiscover() urlpatterns = patterns('', # Examples: # url(r'^$', 'blongo.views.home...
from scipy.spatial import distance as dist from imutils import face_utils import numpy as np import imutils import time import dlib import cv2 def eye_ratio(eye): A = dist.euclidean(eye[1], eye[5]) B = dist.euclidean(eye[2], eye[4]) C = dist.euclidean(eye[0], eye[3]) ratio = (A + B) / (2.0 * C) return ratio ...
# This is my association rule mining algorithm implementation for my # Data Mining course CSCI4144 at Dalhousie for Winter 2018. import sys import assign3_functions as a3f #this flag is turned to True if the user enters an invalid input flag = False dataInput = input("What is the name of the file containing your dat...
class vehicle: def general_usuage(self): print("General Use : Transpotation") class Car(vehicle): #this is called inheratance, here we inherit the parent class Vehicle and Car here is derived class def __init__(self): self.wheels=4 self.roof = True def specific_usuage(se...
from decimal import Decimal from jtune.jtune import median from jtune.jtune import mean from jtune.jtune import stdev def test_median_empty(): """An empty median() is 0""" assert median([]) == 0 def test_median_modulo(): """median [2048, 4096, 49152, 64738] is 26624.0""" assert median([2048, 4096...
from pprint import pformat from sqlalchemy import (Column, ForeignKeyConstraint, Integer) from sqlalchemy.orm import relationship from .base import Base class SchoolCourse(Base): __tablename__ = 'school_course' __table_args__ = ( ForeignKeyConstraint(['schoolid'], ['schools.school_number']), ...
# # SPDX-License-Identifier: Apache-2.0 # from .create_node import create_node from .delete_node import delete_node from .fabric_ca_register import fabric_ca_register
from flask import Blueprint, render_template, g, request, jsonify from time import gmtime, strftime from flask_login import login_required, current_user from app.models import Month, DreamDay, Dream import datetime pomodoro_module = Blueprint('pomodoro', __name__, template_folder='templates') @pomodoro_module.route...
from .required_item_schema import RequiredFileSchema, RequiredFolderSchema from .listener_schema import ListenerSchema
n = int(input()) x, y = list(zip(*[tuple(input().split()) for _ in range(n)])) x = all(x[0] == a for a in x) y = all(y[0] == a for a in y) print("YES" if x or y else "NO")
''' 假设按照升序排序的数组在预先未知的某个点上进行了旋转。 ( 例如,数组 [0,1,2,4,5,6,7] 可能变为 [4,5,6,7,0,1,2] )。 搜索一个给定的目标值,如果数组中存在这个目标值,则返回它的索引,否则返回 -1 。 你可以假设数组中不存在重复的元素。 你的算法时间复杂度必须是 O(log n) 级别。 示例 1: 输入: nums = [4,5,6,7,0,1,2], target = 0 输出: 4 示例 2: 输入: nums = [4,5,6,7,0,1,2], target = 3 输出: -1 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/...
import os import argparse import platform from subprocess import Popen, PIPE def get_property(config_file, property_name): with open(config_file) as i_file: for line in i_file: if line == "\n" or line.find("=") == -1: continue values = line.strip("\n").strip(" ").s...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- if "__main__" != __name__: def _private(): def _make_base(): import sys import typing import inspect from . import import_module as _import_module class _Types(object): Factory = typ...
# !/usr/bin/env python3 # encoding: utf-8 """ @version: 0.1 @author: feikon @license: Apache Licence @contact: crossfirestarer@gmail.com @site: https://github.com/feikon @software: PyCharm @file: problem_0000.py @time: 2017/6/10 9:39 """ # Problem describe:add number to top right of a image # Problem solve step: # ...
############################################################################## # # Copyright (c) 2003-2018 by The University of Queensland # http://www.uq.edu.au # # Primary Business: Queensland, Australia # Licensed under the Apache License, version 2.0 # http://www.apache.org/licenses/LICENSE-2.0 # # Development unti...
# # Copyright (C) 2012 - 2015 Satoru SATOH <ssato @ redhat.com> # License: MIT # # pylint: disable=missing-docstring from __future__ import absolute_import import anyconfig.backend.tests.ini try: import anyconfig.backend.yaml as TT except ImportError: TT = None from anyconfig.compat import OrderedDict as ODic...
# -*- coding: utf-8 -*- # Copyright (c) 2021, Wahni Green Technologies and contributors # For license information, please see license.txt import frappe import json from erpnext.stock.doctype.stock_reconciliation.stock_reconciliation import get_items from frappe.utils.data import today, nowtime, format_date, format_time...
from .domino import * from .players import * from .rules import * from .training import * from .tournaments import *
#-*-coding:utf-8-*- import tensorflow as tf import cv2 import numpy as np import time from lib.helper.init import init from train_config import config class Shufflenet(): def __init__(self,pb): self.PADDING_FLAG=True self.ANCHOR_SIZE=0 self._pb_path=pb self._graph = tf.Graph() ...
from django.db.models.signals import post_save from django.dispatch import receiver from .models import Result, Parameter, Data #here we set up the receiver functions # check also the initalisation in the apps.py @receiver(post_save, sender=Parameter) def params_saved(sender,**kwargs): print("Parameters have been...
import runway from model import BiSeNet import torch import os import os.path as osp import numpy as np from PIL import Image import torchvision.transforms as transforms import cv2 @runway.setup(options={'checkpoint': runway.file(extension='.pth')}) def setup(opts): net = BiSeNet(n_classes=19) net.cuda() ...
"""PEbot core module""" import time import random from selenium import webdriver # from selenium.webdriver.common.by import By # from selenium.webdriver.support.ui import WebDriverWait # from selenium.webdriver.support import expected_conditions as EC from bs4 import BeautifulSoup URL = "https://wellness.sfc.keio.ac....
from setuptools import setup def readme(): with open("README.md") as f: return f.read() setup( name="scpidev", version="0.0.1a1", author="Simon Bertling", author_email="simon.bertling@gmx.de", description="A python package to turn your device into an SCPI instrument.", keywords="sc...
# Copyright Contributors to the Amundsen project. # SPDX-License-Identifier: Apache-2.0 import unittest from unittest.mock import MagicMock from amundsen_common.models.search import Filter, HighlightOptions from elasticsearch_dsl import Search from search_service import create_app from search_service.proxy.es_proxy_...
#!/usr/bin/env python3 """Tests for the starstruct class""" import enum import struct import unittest import pytest from starstruct.message import Message # from starstruct.modes import Mode class SimpleEnum(enum.Enum): """Simple enum class for testing message pack/unpack""" one = 1 two = 2 three ...
from sklearn.metrics import accuracy_score from sklearn.model_selection import train_test_split from sklearn.neural_network import MLPClassifier import pandas as pd from sklearn.datasets import load_iris iris = load_iris() data = pd.DataFrame(iris.data, columns=iris.feature_names) data["species"] = pd.DataFrame(iris....
# This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative wo...
#!/usr/bin/env python3 #**************************************************************************************************************************************************** # Copyright (c) 2016 Freescale Semiconductor, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without #...
#nomes e notas '''f = open ('surf.txt') for linha in f: print (linha.strip()) f.close() ''' #maior nota '''f = open ('surf.txt') maior = 0 for linha in f: nome, pontos = linha.split() if float(pontos) > maior: maior = float (pontos) f.close() print (maior) ''' #três notas '''f = open ('surf.txt') no...
from .. import utils as U from ..core import GenLearner from ..imports import * from .data import show_image class ImageClassLearner(GenLearner): """ ``` Main class used to tune and train Keras models for image classification. Main parameters are: model (Model): A compiled instance of keras.engin...
# Define here the models for your scraped items # # See documentation in: # https://docs.scrapy.org/en/latest/topics/items.html import scrapy from crawler.models import News from scrapy_djangoitem import DjangoItem class DailystarbotItem(DjangoItem): # define the fields for your item here like: # name = scrap...
import argparse import torch import torch.nn as nn import torch.nn.parallel from models import modules, net, resnet, densenet, senet import loaddata import util import numpy as np import sobel def main(): model = define_model(is_resnet=False, is_densenet=False, is_senet=True) # model = torch.nn.DataParallel(...
import os import uuid from flask import Flask, url_for, redirect, session from flask_sslify import SSLify from flask_saml2.sp import ServiceProvider import flask_login from flask_saml2.utils import certificate_from_string, private_key_from_string from structlog import get_logger from .admin import init_admin from .em...
""" Sets Color Mode of all Point Cloud Instances in View to Normal. TESTED REVIT API: 2017 Author: Gui Talarico | github.com/gtalarico This file is shared on www.revitapidocs.com For more information visit http://github.com/gtalarico/revitapidocs License: http://github.com/gtalarico/revitapidocs/blob/master/LICENSE....
# -------------------------------------------------------- # Compute metrics for detectors using ground-truth data # Written by Wang Xueyang (wangxuey19@mails.tsinghua.edu.cn), Version 20200321 # Based on pycocotools (https://github.com/cocodataset/cocoapi/) # -------------------------------------------------------...
#!/usr/bin/env python __author__ = 'Kanishka Ganguly' __version__ = '1.0.0' __date__ = 'May 25 2017' import time class file_io: ''' FILE IO ''' def open_file(self, root_dir, glove_type=None, cam=None): if cam is not None: text_file = ('%s/Cam%dTimestamp.txt') % (root_dir, cam) ...
import numpy as np import matplotlib.pyplot as plt fig, ax = plt.subplots(figsize=(6, 3), subplot_kw=dict(aspect="equal")) recipe = ["225 g flour", "90 g sugar", "1 egg", "60 g butter", "100 ml milk", "1/2 package of yeast"] data = [225, 90, 50, 60, 100, 5] wedges, ...
# Elf helper functions # Author: Matej Kastak import os from debug import debug_enabled, debug_print from context import Context from subprocess import check_call, CalledProcessError def rr(cmd): return check_call(cmd, shell=True) def r(cmd): if debug_enabled: debug_print(cmd) os.system(cm...
import logging import os def get_root_dir() -> str: """Returns parent directory of module. If structure is: parent/ .git config.ini module/ __init__.py code1.py code2.py Then will return top level 'parent' directory path Returns: st...
MOUDLE_NUM=26 PAYLOAD_NUM=55 # AlibabaCanal from Moudle.AlibabaCanal import Alibaba_Canal_Info_Leak # Apache from Moudle.Apache import CVE_2021_41773 # Confluence from Moudle.Confluence import CVE_2021_26084 # Demo from Moudle.Demo import Demo from Moudle.Demo import Test # Discuz from Moudle.Discuz import discuz_...
import os import time from pprint import pprint from utils.enocean_driver import EnOcean_J def view_packet_loop(): eo = EnOcean_J() while True: try: packet = eo.get_packet() if packet: print("\n") pprint(packet) except Excep...
import torch import torch.nn as nn from .base_module import BaseModule class BottleneckResidual(BaseModule): def __init__(self,in_feature,out_featue,hidden_feature=None,stride=1,**kwargs): super(BottleneckResidual,self).__init__(in_feature,out_featue,stride,**kwargs) if hidden_feature is None: ...
# -*- coding: utf-8 -*- from __future__ import absolute_import from builtins import * # noqa import click import logging from .libs.fs import Watcher, DummyScheme, GitScheme @click.group('fs') @click.pass_obj def cli(g): """FileSystem management tools.""" level = 'DEBUG' if g.verbose else 'INFO' logg...
#!/usr/bin/python3 import requests import json # define the URL we want to use GETURL = "http://validate.jsontest.com/" def main(): # test data to validate as legal json mydata = {"fruit": ["apple", "pear"], "vegetable": ["carrot"]} ## the next two lines do the same thing ## we take python, convert ...