text
stringlengths
1
927k
from utils import * #Network definition def conv_bn(c_in, c_out, bn_weight_init=1.0, **kw): if kw['use_bn']: conv_block = { 'conv': nn.Conv2d(c_in, c_out, kernel_size=3, stride=1, padding=1, bias=False), 'bn': batch_norm(c_out, bn_weight_init=bn_weight_init, **kw), 're...
# 给定一组非负整数,重新排列它们的顺序使之组成一个最大的整数。 # 示例 1: # 输入: [10,2] # 输出: 210 # 示例 2: # 输入: [3,30,34,5,9] # 输出: 9534330 # 说明: 输出结果可能非常大,所以你需要返回一个字符串而不是整数。 from typing import List class Solution: def largestNumber(self, nums: List[int]) -> str: nums = self.bubble_sort_mod(nums) return "".join([str(x) ...
#-------------------------------------# # 对单张图片进行预测 #-------------------------------------# from yolo import YOLO from PIL import Image # aaa yolo = YOLO() while True: img = input('Input image filename:') try: image = Image.open(img) except: print('Open Error! Try again!') con...
import os import shutil from .namespace import * from .function import CompilationError MCMETA = '''{ "pack" : { "pack_format" : 3, "description" : "data pack generated by EasyDatapacks" } } ''' LOADTICK = '''{ "values" : [ %s ] }''' def compile(destination, files, verbose=False...
#!/usr/bin/env python """Django's command-line utility for administrative tasks.""" import os import sys def main(): os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'amara_app_32756.settings') try: from django.core.management import execute_from_command_line except ImportError as exc: rais...
class PandasDataWrapper(): """ A DataWrapper with a Pandas DataFrame as its underlying data """ def __init__(self, underlying, field_names): self.underlying = underlying self.field_names = field_names def slice_on_column_names(self, column_names): """ Returns a Pand...
# -*- coding: utf-8 -*- # # Copyright (C) Hewlett Packard Enterprise Development LP # # 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 # # Unles...
from django.contrib.auth.models import User from django.test import TestCase from dfirtrack.settings import BASE_DIR from dfirtrack_config.models import SystemImporterFileCsvConfigModel from dfirtrack_main.tests.system_importer.config_functions import set_csv_import_filename, set_csv_import_path import os import urllib...
from __future__ import absolute_import # Copyright (c) 2010-2015 openpyxl """Reader for a single worksheet.""" from io import BytesIO # compatibility imports from openpyxl.xml.functions import iterparse # package imports from openpyxl.cell import Cell from openpyxl.worksheet import Worksheet, ColumnDimension, RowDim...
#!/usr/bin/env python # -*- coding: utf-8 -*- from enum import Enum, unique import numpy as np from day import Day from intcode import Intcode class Day13(Day): @unique class TileType(Enum): NOTHING = 0 WALL = 1 BLOCK = 2 PADDLE = 3 BALL = 4 class GameMap: def __init__(self): ...
from django.contrib.auth import get_user_model from django.urls import reverse from django.test import TestCase from rest_framework import status from rest_framework.test import APIClient from core.models import Ingredient from recipe.serializers import IngredientSerializer INGREDIENTS_URL = reverse('recipe:ingredi...
# coding: utf-8 """ Isilon SDK Isilon SDK - Language bindings for the OneFS API # noqa: E501 OpenAPI spec version: 3 Contact: sdk@isilon.com Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re # noqa: F401 import six from isi_sdk_8_0.models.ads_provi...
import collections import pprint import os import glob class Machine: def __init__(self, name, value): self.name = name self.value = value def compare(sets): machines = [] for current_set in sets: my_string = repr(sets[current_set]) machines.append(Machine(current_set, my...
import csv from serach_function import search_the_word search_word = "antony" # the word to be searched names = [] # Create a "names" list that is used as the search list with open("baby-names.csv", "r") as csv_file: csv_reader = csv.reader(csv_file, delimiter=',') line_count = 0 for row in csv_reader: ...
import unittest import pytest import requests_mock import os from audiomate import corpus from audiomate.corpus import io from audiomate.corpus.io import musan from audiomate.corpus import assets from tests import resources @pytest.fixture() def tar_data(): with open(resources.get_resource_path(['sample_files', ...
""" This library is a linter for AWS IAM policies. """ __version__ = "0.4.6" import os import json import yaml import re import fnmatch import pkg_resources # On initialization, load the IAM data iam_definition_path = pkg_resources.resource_filename(__name__, "iam_definition.json") iam_definition = json.load(open(iam...
# Generated by Django 2.2.4 on 2019-08-20 22:50 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('base', '0052_pylog'), ] operations = [ migrations.DeleteModel( name='PyArticle', ), migrations.DeleteModel( ...
# This file is part of Androguard. # # Copyright (C) 2012, Anthony Desnos <desnos at t0t0.fr> # 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...
# -*- coding: utf-8 -*- # # django-textplusstuff documentation build configuration file, created by # sphinx-quickstart on Mon Feb 9 09:12:04 2015. # # 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 # autogenerate...
#!/usr/bin/python3 import PIL from PIL import ImageTk import sys import os import json import re from validate_email_address import validate_email # Checks for libraries that might not be installed try: try: import tkinter as tk except: import Tkinter as tk except: print("You need to instal...
import numpy as np import pandas as pd def numerical_summary(series: pd.Series) -> dict: """ Args: series: series to summarize Returns: """ aggregates = [ "mean", "std", "var", "max", "min", "median", "kurt", "skew", ...
import importlib import os import shlex import traceback from xml.dom import minidom from .util import make_dirs, remove_tree def get_rerun_targets(xml_file: str): test_targets = [] doc = minidom.parse(xml_file) if doc.documentElement.nodeName == "testsuites": root = doc.documentElement else:...
#!/usr/bin/env python3 import flask import surfagenda import exchangelib import exchangelib.errors import json import configparser import base64 from pprint import pprint def read_config(): config = configparser.ConfigParser() config.read('webapp.config') if not ( config.has_section('config') and config....
class Factory: class __Factory: def __init__(self): self._extend_registry = {} self._class_registry = {} def extend(self, object_name, extend_class, parent_class): if object_name not in self._extend_registry: self._extend_registry[object_name] = [...
import yaml from basepy.config import Settings def load_yaml(content_str): ret = yaml.safe_load(content_str) return ret def load(): Settings.register_loader('.yaml', load_yaml) Settings.register_loader('.yml', load_yaml)
#Equação de Segundo grau #CLS def cls(): import os os.system('cls') #FUNÇÕES def delta(a,b,c): delta = (b**2) - (4*a*c) return {"delta":delta} def raizes(a,b,c,delta): x1 = (-b+ delta**(1.0/2.0)) / (2.0*a) x2 = (-b- delta**(1.0/2.0)) / (2.0*a) return {"x1":x1,"x2":x2} def vertices(a,b,delta)...
import os import pdb import argparse import numpy as np PEND_ORIG = 'orig' # PEND_NEW = 'splat' PEND_ATT = 'adv' PEND_ATT_FAIL = 'adv_f' PEND_ATT2D = '2dimg' PEND_PRED = 'pred' parser = argparse.ArgumentParser( description='test shape net show image') parser.add_argument('--img_dir', default='../log', type=str)...
from typing import Union, Optional, Callable, Dict, Mapping, TypeVar, Type from types import MappingProxyType import yaml from mashumaro.serializer.base import DataClassDictMixin DEFAULT_DICT_PARAMS = { 'use_bytes': False, 'use_enum': False, 'use_datetime': False } EncodedData = Union[str, bytes] Encode...
class Queue: def __init__(self): self.items = [] def add(self): self.items.append(item) def remove(self): self.items = self.items[1:] def peek(self): return self.items[0] def isEmpty(self): return self.items == [] def
# -*- coding: utf-8 -*- from urllib import quote, urlencode from urlparse import urljoin, urlsplit, parse_qs from scrapy.spider import Spider from scrapy.http import Request from scrapy.selector import Selector from megafon_phones.items import PhoneItem class PhoneSpider(Spider): name = "megafon_phones" all...
#!/usr/bin/env python # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # # Michael A.G. Aivazis # California Institute of Technology # (C) 1998-2003 All Rights Reserved # # <LicenseText> # # ~~~~~~~~~~...
# Copyright 2022 The TensorFlow Recommenders 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 applicable law ...
from graphite_feeder.handler.event.appliance.sound.player.fade_in import ( volume, playlist, )
import abc def yad(decorators): def decorator(f): for d in reversed(decorators): f = d(f) return f return decorator class Callable(object): def __init__(self, f): self.f = f self.__name__ = f.__name__ def __call__(self, *args, **kwargs): return s...
# -*- coding: utf-8 -*- """ TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-权限中心(BlueKing-IAM) available. Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file except in compliance with th...
from floodsystem.stationdata import build_station_list from floodsystem.geo import rivers_by_station_number stations = build_station_list() def test_rivers_by_station_number(): x = rivers_by_station_number(stations, 9) assert len(x) > 0
ERRCODE = { 'SUCCEED': 0, 'NO_DUPLICATED_EDGE': 4 } class Node: name = '' next_name_list = {} def __init__(self, name: str): self.name = name self.next_name_list = {} def add_next(self, name: str): if name in self.next_name_list.keys(): return ERRCODE['NO_...
from featuretools.primitives.base import TransformPrimitive class NewPrimitive(TransformPrimitive): """A primitive that should not currently exist for testing.""" pass
from kivy.animation import Animation from kivy.app import App from kivy.core.text import DEFAULT_FONT from kivy.metrics import dp from kivy.uix.boxlayout import BoxLayout from kivy.uix.behaviors import ButtonBehavior from kivy.uix.button import Button from kivy.uix.checkbox import CheckBox from kivy.uix.gridlayout impo...
""" Lovasz-Softmax and Jaccard hinge loss in PyTorch Maxim Berman 2018 ESAT-PSI KU Leuven (MIT License) """ from __future__ import print_function, division from typing import Optional import torch import torch.nn.functional as F from torch.autograd import Variable from torch.nn.modules.loss import _Loss from .constan...
from .core import * from .layers import * from .learner import * from .initializers import * model_meta = { resnet18:[8,6], resnet34:[8,6], resnet50:[8,6], resnet101:[8,6], resnet152:[8,6], vgg16:[0,22], vgg19:[0,22], resnext50:[8,6], resnext101:[8,6], resnext101_64:[8,6], wrn:[8,6], inceptionresnet_2:...
#!/usr/bin/env python import argparse, sys, os, datetime from smartcard.CardType import AnyCardType from smartcard.CardRequest import CardRequest from smartcard.CardConnection import CardConnection from smartcard.util import toHexString, HexListToBinString # parse arguments parser = argparse.ArgumentParser(add_help=F...
# (c) Copyright 2017-2018 SUSE 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 agreed to in writ...
"""Some helpers for deprecation messages""" import warnings import inspect from scrapy.exceptions import ScrapyDeprecationWarning def attribute(obj, oldattr, newattr, version='0.12'): cname = obj.__class__.__name__ warnings.warn("%s.%s attribute is deprecated and will be no longer supported " "in Scr...
""" Tests for the molecule module. """ import pytest import molecool def test_molecular_mass(): symbols = ['C', 'H', 'H', 'H', 'H'] calculated_mass = molecool.calculate_molecular_mass(symbols) actual_mass = 16.04 assert pytest.approx(actual_mass, abs=1e-2) == calculated_mass
# %% [markdown] # # 📝 Exercise M5.02 # # The aim of this exercise is to find out whether a decision tree # model is able to extrapolate. # # By extrapolation, we refer to values predicted by a model outside of the # range of feature values seen during the training. # # We will first load the regression data. # %% imp...
import os from django.conf import settings from django.http import HttpResponse def get_election_fixture(request): out = open(os.path.join(settings.BASE_DIR, "data/elections.json")).read() return HttpResponse(out, status=200, content_type="application/json")
#!/usr/bin/env python # Copyright 2020 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Reports binary size metrics for LaCrOS build artifacts. More information at //docs/speed/binary_size/metrics.md. """ import argpars...
print("___Real Convertor___") x = float(input("How many Dollar do you have? ")) y = x* 3.27 print('You have U${} can buy R${} now'.format(x, y))
#!/usr/bin/env python # 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 # "Li...
# Copyright Contributors to the Amundsen project. # SPDX-License-Identifier: Apache-2.0 import logging import os import subprocess from setuptools import setup, find_packages BASE_DIR = os.path.abspath(os.path.dirname(__file__)) PACKAGE_DIR = os.path.join(BASE_DIR, 'amundsen_application', 'static') def is_npm_inst...
constants.kgf
import numpy as np from IPython.parallel import Reference, interactive from SimPEG import Survey, Problem, Mesh, Solver as SimpegSolver from SimPEG.Parallel import RemoteInterface, SystemSolver from SimPEG.Utils import CommonReducer from zephyr.Survey import SurveyHelm from zephyr.Problem import ProblemHelm import netw...
# -*- coding: utf-8 -*- # Copyright (c) 2016 Bolke de Bruin # # 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 la...
def add(num1, num2): return num1 + num2
import pandas as pd import lyricwikia sw = pd.read_csv('Steven Wilson.csv') pt = pd.read_csv('Porcupine Tree.csv') sw_songs = sw['name'] pt_songs = pt['name'] sw_lyrics = [] pt_lyrics = [] for song in sw_songs: try: lyrics = lyricwikia.get_lyrics('Steven Wilson', song) clean = lyrics.replace('\...
""" ================= Fancytextbox Demo ================= """ import matplotlib.pyplot as plt plt.text(0.6, 0.7, "eggs", size=50, rotation=30., ha="center", va="center", bbox=dict(boxstyle="round", ec=(1., 0.5, 0.5), fc=(1., 0.8, 0.8), ) ...
# Copyright 2018 OpenStack Foundation # # 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 l...
#!/usr/bin/env python import datetime import json from eumssi_converter import EumssiConverter import click def transf_date(x): '''convert from string in DD.MM.YYYY (or YYYY-MM-DD) format''' try: return datetime.datetime.strptime(x, "%d.%m.%Y") except ValueError: return datetime.datetime.s...
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest import time import os import tempfile import shutil import random import codecs from pabot import pabot from robot.utils import PY2 from robot import __version__ as ROBOT_VERSION s = pabot.SuiteItem t = pabot.TestItem class PabotTests(unittest.TestCase): ...
#!/usr/bin/python # Ingmar Steen, 2016 # This tests the LDR Rd, =label pseudo-instruction on ARM. # Github issue: #46 # Author: Ingmar Steen from keystone import * import regress class TestARM(regress.RegressTest): def runTest(self): # Initialize Keystone engine ks = Ks(KS_ARCH_ARM, KS_MODE_ARM...
""" StackSet via CloudFormation """ # Next ToDo: # Allow for stack Retention import boto3 from time import sleep from botocore.exceptions import ClientError import os import crhelper # initialise logger logger = crhelper.log_config({"RequestId": "CONTAINER_INIT"}) logger.info('Logging configured') # set global to t...
from django.urls import path from django.views.decorators.csrf import csrf_exempt from . import views app_name = "mdm" urlpatterns = [ # setup views path('', views.IndexView.as_view(), name='index'), path('root_ca/', views.RootCAView.as_view(), name='root_ca'), # p...
#! /usr/bin/python # -*- coding: iso-8859-1 -*- # Copyright (C) 2013 Dr. Ralf Schlatterbeck Open Source Consulting. # Reichergasse 131, A-3411 Weidling. # Web: http://www.runtux.com Email: office@runtux.com # All rights reserved # **************************************************************************** # This progr...
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
from django.utils.html import strip_tags from rest_framework import serializers from dataworkspace.apps.datasets.constants import DataSetType from dataworkspace.apps.datasets.models import ( SourceTable, ToolQueryAuditLog, ToolQueryAuditLogTable, ) _PURPOSES = { DataSetType.DATACUT: "Data cut", Da...
import pytest import torch import torch.nn import numpy as np import copy from memcnn.models.affine import AffineAdapterNaive, AffineAdapterSigmoid from memcnn import ReversibleBlock def set_seeds(seed): np.random.seed(seed) torch.manual_seed(seed) @pytest.mark.parametrize('coupling', ['additive', 'affine']...
from discord.ext.commands import Converter class Command(Converter): async def convert(self, ctx, arg): return ctx.bot.get_command(arg)
__all__ = ['copy_image_info', 'set_origin', 'get_origin', 'set_direction', 'get_direction', 'set_spacing', 'get_spacing', 'image_physical_space_consistency', 'image_type_cast'] import os import numpy as np from functools import par...
import threading import cv2 # src = "http://192.168.0.4:8080/video" class VideoCaptureThreading: def __init__( self, src="http://192.168.0.4:8080/video", # Enter current the url from ip webcam or enter ) or 1 to use local pc webcam width=1920, height=1080): ...
from tkge.models.loss import Loss import torch @Loss.register(name="margin_ranking_loss") class MarginRankingLoss(Loss): def __init__(self, config): super().__init__(config) self.margin = self.config.get("train.loss.margin") self.reduction = self.config.get("train.loss.reduction") ...
#LordLynx #Part of PygameLord import pygame,os from pygame.locals import* pygame.init() #Loading Objects ''' Parse_Locations(file) file: Your text file, use a .txt # Like in Python will be ingored thusly follow this example #Coment ./File/File ./File/Other File ... ''' def Parse_Locations(file): file = open(file,...
"""Support for Toon thermostat.""" from datetime import timedelta import logging from typing import Any, Dict, List from homeassistant.components.climate import ClimateDevice from homeassistant.components.climate.const import ( HVAC_MODE_HEAT, PRESET_AWAY, PRESET_COMFORT, PRESET_HOME, PRESET_SLEEP, SUPPORT_PR...
import json import pytest import sdk_cmd import sdk_hosts import sdk_install import sdk_marathon import sdk_metrics import sdk_networks import sdk_plan import sdk_tasks import sdk_upgrade import sdk_utils from tests import config, test_utils @pytest.fixture(scope="module", autouse=True) def configure_package(config...
# Change upm # Jens Kutilek 2013-01-02 from mojo.roboFont import version def scalePoints(glyph, factor): if version == "1.4": # stupid workaround for bug in RoboFont 1.4 for contour in glyph: for point in contour.points: point.x *= factor point.y *= fact...
import app_config import jwt import time import os import requests from flask import Flask # Define the Flask app app = Flask(__name__) # Load configuration app.config.from_object(app_config) def add_org_member(username): """ Add a user to the GitHub Organization Parameters ---------- access_tok...
# hacked script for converting my original csv format data to json import sys, copy, json f = open(sys.argv[1],'r') lines = f.readlines() f.close() data_types = lines[0].split() aa_dict = {aa:0.0 for aa in "ACDEFGHIKLMNPQRSTVWY"} data = {k:{"values":copy.deepcopy(aa_dict)} for k in data_types} for l in lines[1:]...
from django.conf import settings MAX_IMPORTANCE = getattr(settings, 'MAX_IMPORTANCE', 30) MIN_IMPORTANCE = getattr(settings, 'MAX_IMPORTANCE', 1) ERROR_MESSAGES = { 'required': 'This field is required.', 'max_value': 'Ensure this value is less than or equal to %(limit_value)s.', 'min_value': 'Ensure this ...
# http://developer.intel.com/software/products/compilers/flin/ from __future__ import division, absolute_import, print_function import sys from numpy.distutils.ccompiler import simple_version_match from numpy.distutils.fcompiler import FCompiler, dummy_fortran_file compilers = ['IntelFCompiler', 'IntelVisualFCompile...
#!/usr/bin/env python """Test DIMSE-C operations.""" from io import BytesIO import logging import pytest from pydicom.dataset import Dataset from pydicom.uid import UID from pynetdicom.dimse_messages import ( C_STORE_RQ, C_STORE_RSP,C_MOVE_RQ, C_MOVE_RSP, C_ECHO_RQ, C_ECHO_RSP, C_FIND_RQ, C_FIND_RSP, C_GET_...
import dill as pickle import inspect import numpy as np import types from os import makedirs, listdir from os.path import join, exists import dali.core as D class RunningAverage(object): def __init__(self, alpha=0.95): self.alpha = alpha self.value = None def update(self, measurement): ...
# python -m unittest -v test/torch_test.py import unittest from unittest import TestCase import random import syft as sy import numpy as np from syft.core.frameworks.torch import utils as torch_utils from syft.core.frameworks import encode from syft.core.frameworks.torch.tensor import _GeneralizedPointerTensor impo...
# python3 # 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 ...
import re test_string = 'hello123' pattern = re.compile(r'_?\d') matches = pattern.finditer(test_string) for match in matches: print(match)
from dateutil import parser from flask import Flask, request, Response from feedgen.feed import FeedGenerator from unidecode import unidecode import requests import json import re app = Flask(__name__) # This mapping doesn't need to exist, but it does make the app more robust, i.e., url.com/feed/EngrXiv would work # ...
import math import datetime try: from OpenGL.GLUT import * from OpenGL.GL import * from OpenGL.GLU import * except: print(''' ERROR: PyOpenGL not installed properly. ''') sys.exit() def glutBitmapCharacters(font, ss): # print('ord(j) =', ord('j')) # print('s =', ss) for c in ss: # prin...
#!/usr/bin/python #!/usr/bin/env python # # GrovePi Python Setup # # The GrovePi connects the Raspberry Pi and Grove sensors. You can learn more about GrovePi here: http://www.dexterindustries.com/GrovePi # # Have a question about this example? Ask on the forums here: http://forum.dexterindustries.com/c/grovepi # '...
import unittest import io import tempfile import torch import torch.utils.show_pickle from torch.testing._internal.common_utils import IS_WINDOWS class TestShowPickle(unittest.TestCase): @unittest.skipIf(IS_WINDOWS, "Can't re-open temp file on Windows") def test_scripted_model(self): class MyCoolModu...
""" Demo platform that offers fake meteorological data. For more details about this platform, please refer to the documentation https://home-assistant.io/components/demo/ """ from homeassistant.components.weather import WeatherEntity from homeassistant.const import (TEMP_CELSIUS, TEMP_FAHRENHEIT) CONDITION_CLASSES = ...
#!/usr/bin/env python # oculus.py # Subscribes to camera output, publishes data about what it sees. # Determines what to look for based on what is being subscribed to. import rospy from cv_bridge import CvBridge from sensor_msgs.msg import Image, CompressedImage from riptide_vision import RiptideVision from gate_proce...
import sys sys.path.append('..') import subprocess from load.lib import auto_decode def execute(args, stdin='', timeout=1) -> dict: ''' Pass stdin input to executable w/ args and get return code, stdout, stderr string ''' with subprocess.Popen(args, stdin=subprocess.PIPE, ...
#!/usr/bin/env python3 import sys from functools import reduce tree_encounter_check = lambda pos: 1 if pos == "#" else 0 def main(forest): slope_mode = [ (1, 1), (3, 1), (5, 1), (7, 1), (1, 2), ] mode_to_result = [(mode, resolve_encounters(forest, *mode)) for mode ...
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Martin Luessi <mluessi@nmr.mgh.harvard.edu> # Denis Engemann <denis.engemann@gmail.com> # # License: BSD (3-clause) from collections import defaultdict from colorsys import hsv_to_rgb, rgb_to_hsv from os import path as op impor...
""" VirusShare API v2 ================= Support for version 2 of the VirusShare API. This API is fully documented here: https://virusshare.com/apiv2_reference An exception is raised in the case the status code is not 200 (Success) or 204 (Rate limited). Please add try/except clauses around calls to this library to ...
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
from __future__ import absolute_import from __future__ import print_function import os import sys import collections import functools import veriloggen.core.vtypes as vtypes from veriloggen.core.module import Module from veriloggen.core.submodule import Submodule from veriloggen.seq.subst_visitor import * from verilog...
import unittest from my_program import make_it_uppercase, get_first_word, return_a_list class TestMyProgram(unittest.TestCase): def test_hello_world(self): result = make_it_uppercase("hello world") self.assertEqual(result, 'HELLO WORLD') def test_first_word_in_sentence(self): sentenc...
from __future__ import division from sympy import * import numpy as np import nibabel as nib def middle_reg(a,b): A = nib.load(str(a)) AA = np.array(A.dataobj) B = [] for x in range(AA.shape[0]): for y in range(AA.shape[1]): for z in range(AA.shape[2]): if AA[x][y...
# Copyright (c) 2012 NetApp, Inc. # 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...
#!/usr/bin/env python3 def countdown(n): if n <= 0: print() return print(n, end=' ') countdown(n-1) countdown(5) print(list(range(5, 0, -1))) print(list(x for x in range(5, 0, -1))) def countdown2(n): if n <= 0: yield 'stop' else: yield n for i in countdo...