text
stringlengths
2
999k
import pytest import wolframalpha @pytest.fixture(scope='module') def temp_result(client): return client.query('30 deg C in deg F') def test_basic(temp_result): res = temp_result assert len(list(res.pods)) > 0 (result,) = res.results assert result.text == '86 °F (degrees Fahrenheit)' asser...
""" tempserver.sender ~~~~~~~~~~~~~~~~~ The sender gets the temperature from a file and sends it via the CAN Bus. :copyright: (c) 2014 by Peter Justin. :license: BSD, see LICENSE for more details. """ def send_temperature(bus, input_file): """Sends a temperature over the CAN Bus. :p...
# The MIT License (MIT) # # Copyright (c) 2015 Frederic Jacob # # 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, mo...
# Generated by Django 3.1.2 on 2020-11-02 04:02 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Annonce', fields=[ ('id', models.AutoField(...
# this file is nothing import datetime import random import re import sqlite3 import time import requests from robobrowser import RoboBrowser from pipeline import output # const NEXT_PAGE = '下一頁' TODAY = '今天' YESTERDAY = '昨天' PATTERN = '草榴官方客戶端|來訪者必看的內容|发帖前必读|关于论坛的搜索功能|文学区违规举报专贴' R_START = 5 R_END = 10 host = 'htt...
import json from datetime import datetime from elasticsearch import Elasticsearch from confluent_kafka import ( Consumer, KafkaError, OFFSET_BEGINNING, OFFSET_END, TopicPartition, ) kafka_config = { "group.id": "air_quality_ws_server", "auto.offset.reset": "latest", "bootstrap.servers"...
#coding: latin1 #< full from algoritmia.problems.binpacking.firstfitbinpacker import FirstFitBinPacker w = [1, 2, 8, 7, 8, 3] packer = FirstFitBinPacker() x = packer.pack(w, 10) packer.show_solution(x, w) #> full
import os basedir = os.path.abspath(os.path.dirname(__file__)) class Config: SECRET_KEY=os.environ.get('SECRET_KEY') or 'fhvnbmgmgkh9ttolslso' WEATHER_API_KEY=os.environ.get('WEATHER_API_KEY') or 'a778d9642410a11ed2cbd17c20c246bc' SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or \ 'sqli...
import pytest @pytest.fixture(scope='function') def pkconfig_setup(monkeypatch): import py.path import sys def res(cfg=None, env=None): # Can't import anything yet data_dir = py.path.local(__file__).dirpath('pkconfig_data') for k, v in (env or {}).items(): monkeypatch.s...
# Pyrogram - Telegram MTProto API Client Library for Python # Copyright (C) 2017-2020 Dan <https://github.com/delivrance> # # This file is part of Pyrogram. # # Pyrogram is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published # by the Free...
# -*- Python -*- """Build macro that compiles a TensorFlow graph into a cc_library. To use from your BUILD file, add the following line to load the macro: load("//tensorflow/compiler/aot:tfcompile.bzl", "tf_library") Then call the macro like this: tf_library( name = "test_graph_tfmatmul", config = "test_gr...
# coding: utf-8 # Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c...
""" 数据集加载器 @Author: Bao Wenjie @Email: bwj_678@qq.com @Date: 2020/10/31 """ from torch.utils.data import DataLoader from torch.nn.utils.rnn import pack_padded_sequence import torch def collate_func(X): """ batch数据处理 (snntence, length, label) @param: :pre_X (tensor):从大到小排列的pre :pre_length (...
import codecs from xml.sax.saxutils import escape class XMLDictWriter: # save as XML (legacy code) order=['group','element','vr','vm','name'] def open(self, filename): #with open(oxml,'w') as out_file: #with codecs.open(oxml, "w", "utf-8-sig") as out_file: self.out_file = codecs.open(filename, "w", "...
"""Create modules of co-signaling cytokines for analysis of multiplexed cytokine data (e.g. Luminex)""" """Common data types: - rawDf: pd.DataFrame with cytokines as columns and sample IDs along the index - cyDf: same as rawDf, but with missing values filled (if needed), log-transformed and possibly normalized ...
import collections import functools import itertools import threading import warnings from typing import Optional, TypeVar, Type, List, Union, TYPE_CHECKING, Any, cast from sys import modules import numpy as np from pandas import Series import scipy.sparse as sps import theano.sparse as sparse from theano import thean...
AVAILABLE_LOCALES = ['en_US', 'it_IT', 'fr_FR', 'pt_BR', 'en_CA'] DEFAULT_LOCALE = AVAILABLE_LOCALES[0] DEFAULT_PROVIDERS = ( 'lorem', 'address', 'person', 'date_time', 'company', 'internet', 'miscelleneous', 'phone_number', 'user_agent', 'file', 'python', 'credit_card'...
# PROBER IDS PROBER_IPERF = 0x0001 PROBER_PING = 0x0002 PROBER_SIPP = 0x0003 PROBER_IPERF3 = 0x0004 PROBER_PKTGEN = 0x0005 PROBER_TCPREPLAY = 0x0006 #Monitor IDs LISTENER_HOST = 0x0010 LISTENER_DOCKER = 0x0011 LISTENER_PROCESS = 0x0012 LISTENER_DNS = 0x0013 LISTENER_SURICATA = 0x0014
import sys import os import sphinx_rtd_theme import recommonmark from recommonmark.transform import AutoStructify from os.path import abspath, join, dirname sys.path.insert(0, abspath(join(dirname(__file__)))) # -- RTD configuration ------------------------------------------------ on_rtd = os.environ.get("READTHE...
import output import animation import itertools from gridFractal import GridFractal def chunk(seq): return (seq[0:3], seq[3:6], seq[6:9]) def flatten(grid): return grid[0] + grid[1] + grid[2] def empty_grid(): return [[False for _ in range(3)] for __ in range(3)] value = lambda grid: sum(2**idx for idx...
import pytest from keras.preprocessing import image from PIL import Image import numpy as np import os import shutil import tempfile class TestImage: def setup_class(cls): img_w = img_h = 20 rgb_images = [] gray_images = [] for n in range(8): bias = np.random.rand(img_...
# -*- coding: utf-8 -*- # ############################################################################### # Copyright (c) Lawrence Livermore National Security, LLC and other Ascent # Project developers. See top-level LICENSE AND COPYRIGHT files for dates and # other details. No copyright assignment is required to contr...
# coding=utf-8 """ Test FRQ3: Activity may not be included and pending at the process end""" import unittest import cc_dcr import eventlog_parser from conf_data import ConformanceAnalysisData from graph import DCRGraph class EvaluateFRQ3Test1(unittest.TestCase): """ First test case, activity a is initially p...
# -*- coding: utf-8 -*- import unittest2 from erppeek import issearchdomain, searchargs class TestUtils(unittest2.TestCase): def test_issearchdomain(self): self.assertFalse(issearchdomain(None)) self.assertFalse(issearchdomain(42)) self.assertFalse(issearchdomain('42')) self.asse...
from tensorflow.keras.layers import Input, Conv2D, MaxPooling2D, BatchNormalization, Activation, Dropout, Dense, Flatten from tensorflow.keras.models import Model def conv_block(input_tensor, filters, n_blocks=2, kernel_size=3, padding='same'): x = input_tensor for _ in range(n_blocks): x = Conv2D(fi...
from qtpy import QtCore from qtpy import QtGui from qtpy import QtWidgets class ThreshWidget(QtWidgets.QSpinBox): def __init__(self, value=5): super(ThreshWidget, self).__init__() self.setButtonSymbols(QtWidgets.QAbstractSpinBox.UpDownArrows) self.setRange(5, 100) self.setSuffix('...
#!/usr/bin/env python # # Copyright 2015 Quantopian, 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 ...
from Automator import Automator position_dictionary = { "skill_1": (54, 432), "skill_2": (123, 432), "skill_3": (192, 432), "skill_4": (291, 432), "skill_5": (362, 432), "skill_6": (432, 432), "skill_7": (530, 432), "skill_8": (600, 432), "skill_9": (672, 432), "mast...
#!/usr/bin/env python ''' This script subscribes to all notifications and prints out the type of notification which was received ''' #============================ adjust path ===================================== import sys import os if __name__ == "__main__": here = sys.path[0] sys.path.insert(0,...
# python3 # Copyright 2018 DeepMind Technologies Limited. 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...
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest import numpy as np from numpy.testing import assert_allclose from astropy.table import Column, Table from astropy.time import Time from gammapy.estimators import LightCurve from gammapy.stats.variability import compute_chisq, compute_fvar fro...
import procrunner def test(dials_data, tmp_path): input_filename = ( dials_data("centroid_test_data", pathlib=True) / "imported_experiments.json" ) result = procrunner.run( ["dials.estimate_gain", f"input.experiments={input_filename}"], working_directory=tmp_path, ) assert...
from multiprocessing import Process class BaseHTTP2BackendThread(Process): def __init__(self, requests_queue, responses_queue, backend_layer_config): super(Process, self).__init__(daemon=True) self.requests_queue = requests_queue self.responses_queue = responses_queue self.backend...
# Generated by Django 3.0.2 on 2020-02-07 17:21 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('Question', '0013_auto_20200207_1713'), ] operations = [ migrations.AddField( model_name='question', name='Date', ...
#@ utils CLI calls rc = testutil.call_mysqlsh(["--", "util", "check-for-server-upgrade"], "", ["MYSQLSH_TERM_COLOR_MODE=nocolor"]) rc = testutil.call_mysqlsh(["--", "util", "check-for-server-upgrade", "--outputFormat=whatever"], "", ["MYSQLSH_TERM_COLOR_MODE=nocolor"]) rc = testutil.call_mysqlsh(["--", "util", "check-f...
# Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved. import dace import numpy as np from common import compare_numpy_output # M = dace.symbol('M') # N = dace.symbol('N') M = 10 N = 20 @dace.program def empty(): return np.empty([M, N], dtype=np.uint32) def test_empty(): out = empty()...
from __future__ import with_statement from pypy.interpreter.baseobjspace import Wrappable from pypy.interpreter.typedef import TypeDef, GetSetProperty from pypy.interpreter.gateway import interp2app, unwrap_spec from pypy.interpreter.error import wrap_oserror, OperationError from pypy.rpython.lltypesystem import rffi, ...
#! /usr/bin/env python # # This script is part of khmer, https://github.com/dib-lab/khmer/, and is # Copyright (C) Michigan State University, 2009-2015. It is licensed under # the three-clause BSD license; see LICENSE. # Contact: khmer-project@idyll.org # # pylint: disable=invalid-name,missing-docstring """ Subsample s...
""" Django settings for transcoder project. Generated by 'django-admin startproject' using Django 1.9.2. For more information on this file, see https://docs.djangoproject.com/en/1.9/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.9/ref/settings/ """ import os...
# -*- coding: utf-8 -*- # # @Author: Florian Briegel (briegel@mpia.de) # @Date: 2021-06-24 # @Filename: lvmnps/switch/iboot/powerswitch.py # @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause) from sdsstools.logger import SDSSLogger from lvmnps.switch.iboot.iboot import iBootInterface from lvmnps...
""" Test suite for the ciscoeox.base_api module """ import datetime import json import pytest import requests from requests.models import Response from app.ciscoeox import base_api from app.ciscoeox.base_api import CiscoHelloApi, CiscoApiCallFailed, CredentialsNotFoundException, \ InvalidClientCredentialsException,...
"""ultra/learning_algorithm/README.md generater.""" from pathlib import Path import tabulate import inspect import pandas as pd import sys sys.path.append(".") import ultra def _generate(): full = _make_title() for model_class in ultra.learning_algorithm.list_available(): full += _make_model_class_s...
import requests from bs4 import BeautifulSoup import pickle import csv import urllib.request import json from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer from selenium import webdriver from webdriver_manager.chrome import ChromeDriverManager import datetime import time import argparse import os ...
from datetime import datetime from enum import IntEnum from flask_login import UserMixin from app import db import app.constants as constants from .settings import Settings class User(UserMixin, db.Document): class Status(IntEnum): NO_ACTIVE = 0 ACTIVE = 1 BANNED = 2 meta = {'collec...
VALID_USER = { "username": "Test", "email": "test@email.com", "password": "Test@123", "password2": "Test@123", }
""" Given an m x n grid of characters board and a string word, return true if word exists in the grid. The word can be constructed from letters of sequentially adjacent cells, where adjacent cells are horizontally or vertically neighboring. The same letter cell may not be used more than once. Example 1: Input:...
import urllib.request import urllib.parse import json url = "https://gitlab.com/api/v4/runners" payload = {"description": "python_register_runner_1", "tag_list": "python, urllib_request", "token": "<GITLAB_RUNNER_TOKEN>"} data = urllib.parse.urlencode(payload) data = data.encode('ascii') with u...
from typing import List from collections import OrderedDict class LRUCache: def __init__(self, capacity: int): self.capacity = capacity self.dict = OrderedDict() def get(self, key: int) -> int: if key not in self.dict: return -1 v = self.dict.pop(key) self...
#------------------------------------------------------------------------------ # # Copyright (c) 2005, Enthought, Inc. # All rights reserved. # # This software is provided without warranty under the terms of the BSD # license included in enthought/LICENSE.txt and may be redistributed only # under the condi...
# Generated by Django 3.1.13 on 2021-09-01 00:04 import django.contrib.auth.validators from django.db import migrations, models import uuid class Migration(migrations.Migration): initial = True dependencies = [ ('auth', '0012_alter_user_first_name_max_length'), ] operations = [ mig...
"""Django integration. Captures HTTP requests and SQL queries. Automatically used in pytest tests. To enable remote recording, add appmap.django.Middleware to MIDDLEWARE in your app configuration and run with APPMAP=true set in the environment. """ import django from django.core.handlers.base import BaseHandler from ...
from app.db.base_class import Base from app.models import User, Organization from sqlalchemy_oso.roles import resource_role_class OrganizationRoleMixin = resource_role_class( Base, User, Organization, ["ADMIN", "LEAD", "MEMBER"] ) class OrganizationRole(Base, OrganizationRoleMixin): pass
__author__ = 'mecharius'
# # Copyright (C) 2014 Dell, 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 wri...
#!/usr/bin/env python """ @package mi.dataset.parser.dosta_abcdjm_mmp_cds @file marine-integrations/mi/dataset/parser/dosta_abcdjm_mmp_cds.py @author Mark Worden @brief Particle for the DostaAbcdjmMmpCds dataset driver Release notes: initial release """ from mi.core.log import get_logger from mi.core.common import ...
# 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 # -*- encoding: utf-8 -*- """ @Description: 亚马逊相关关键词获取 @Date :2021/09/24 @Author :xhunmon @Mail :xhunmon@gmail.com """ import re from urllib.parse import quote_plus import scrapy from my_fake_useragent import UserAgent class AlibabaSpider(scrapy.Spider): name = 'alibaba' ...
#!/usr/bin/python # @lint-avoid-python-3-compatibility-imports # # tcpretrans Trace or count TCP retransmits and TLPs. # For Linux, uses BCC, eBPF. Embedded C. # # USAGE: tcpretrans [-c] [-h] [-l] [-4 | -6] # # This uses dynamic tracing of kernel functions, and will need to be updated # to match kernel...
import socket BUFSIZE = 2 client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) while True: msg = input(">> ").strip() ip_port = ('127.0.0.1', 9999) client.sendto(msg.encode('utf-8'), ip_port) data, server_addr = client.recvfrom(BUFSIZE) print('客户端recvfrom ', data, server_addr) client.close()
# coding=utf-8 import unittest import configparser from letterparser import conf def build_raw_config_for_testing(value_name, value): "build a config object with one value and return the defaults for testing" config = configparser.ConfigParser(interpolation=None) config["DEFAULT"][value_name] = value ...
from qube.common.suggest_similar_commands import SIMILARITY_SUGGEST_FACTOR, SIMILARITY_USE_FACTOR def levensthein_dist(input_command: str, candidate: str) -> int: """ This function implements the Levenshtein algorithm to determine, in case of a non-existing handle, if theres a very similar command to sugg...
#!/usr/bin/env python # encoding: utf-8 from util.influxdb_writer import Writer from util.temperatures import get_cpu_temperature, get_gpu_temperature, get_temperatures from datetime import datetime import time import os import json import sys def main(): db = 'System-Resources' hostname = os.uname()[1] ...
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.parameter import Parameter import numpy as np from collections import Ordere...
# Copyright (c) 2019 PaddlePaddle 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 app...
# -*- coding: utf-8 -*- # Copyright (c) 2016-2021 by University of Kassel and Fraunhofer Institute for Energy Economics # and Energy System Technology (IEE), Kassel. All rights reserved. import csv import random from functools import reduce from pandapower.auxiliary import ADict import numpy as np import pandas impo...
""" Copyright (C) Microsoft Corporation. All rights reserved.​ ​ Microsoft Corporation (“Microsoft”) grants you a nonexclusive, perpetual, royalty-free right to use, copy, and modify the software code provided by us ("Software Code"). You may not sublicense the Software Code or any use of it (except to your affiliates...
import copy import itertools as it import random import sys import moderngl from functools import wraps import numpy as np from manimlib.constants import * from manimlib.utils.color import color_gradient from manimlib.utils.color import get_colormap_list from manimlib.utils.color import rgb_to_hex from manimlib.utils...
#!/usr/bin/env python3 # encoding: utf-8 # # Copyright (c) 2008 Doug Hellmann All rights reserved. # """ """
from typing import Tuple from ..entity import Date, Entity, Text from .type_scoring import date_likeness MINIMUM_SCORE = 0.7 def get_dates(entities: Tuple[Entity, ...]) -> Tuple[Date, ...]: """Get date-like entities from the given Entities. Args: entities: Should be Words or Phrases. """ def make_dat...
# Copyright 2017 Open Source Robotics Foundation, 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...
# -------------------------------------------------------------------------- # # Copyright (c) Microsoft Corporation. All rights reserved. # # The MIT License (MIT) # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the ""Software""), ...
""" WSGI config for TheIndex 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/2.0/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETT...
from dface.mtcnn import MTCNN from dface.facenet import FaceNet
#!/usr/bin/env python """Django's command-line utility for administrative tasks.""" import os import sys def main(): """Run administrative tasks.""" os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'school_management_system.settings') try: from django.core.management import execute_from_command_lin...
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 5/15/20 4:49 PM # @File : grover.py # qubit number=4 # total number=11 import cirq import cirq.google as cg from typing import Optional import sys from math import log2 import numpy as np #thatsNoCode def make_circuit(n: int, input_qubit): c = cirq.Ci...
'''Simple test of graphing OSIS data. Just plots attendance over time without labels. Can do more.''' from datetime import datetime, timedelta from os.path import exists import matplotlib.pyplot as plt from sys import argv def get_oses(start=datetime(2014,1,1), end=datetime(2018,1,1)): '''Uses the log data from lo...
def problem295(): pass
import unittest import numpy as np from paderbox.array import tbf_to_tbchw class TestTBFtoTBCHW(unittest.TestCase): def setUp(self): self.data = np.random.uniform(0, 1, (30, 2, 5)) def test_shape_even_context(self): x = tbf_to_tbchw(self.data, 3, 3, 1) self.assertEqual(x.shape, (30, ...
# Copyright (c) OpenMMLab. All rights reserved. import numpy as np import torch from mmcv.runner import get_dist_info from torch import distributed as dist from mmdet.apis import train_detector from mmseg.apis import train_segmentor def init_random_seed(seed=None, device='cuda'): """Initialize random seed. ...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import division, unicode_literals import argparse from onmt.utils.logging import init_logger from onmt.translate.translator import build_translator import onmt.inputters import onmt.translate import onmt import onmt.model_builder import onmt.modules impor...
#!/usr/bin/env python3 # Copyright (c) 2014-2018 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 zapwallettxes functionality. - start two compchaind nodes - create two transactions on node 0...
from __future__ import unicode_literals, absolute_import from django.conf import settings from django.utils.module_loading import import_string from huey.consumer import Consumer, EVENT_FINISHED, EVENT_STARTED from huey.exceptions import ConfigurationError from time import sleep from datetime import timedelta, datetim...
def are_symmetric(root1, root2): if root1 is None and root2 is None: return True elif((root1 is None) != (root2 is None)) or root1.val != root2.val: return False else: return are_symmetric(root1.left, root2.right) and are_symmetric(root1.right, root2.left) def is_symmetric(root): ...
import json import logging import time from pathlib import Path from eosapi import Client import click import requests from haiku_node.blockchain_helpers.accounts import ( AccountManager, make_default_accounts, create_public_data) from haiku_node.blockchain.eos.mother import UnificationMother from haiku_node.bl...
# # Unpacker for Dean Edward's p.a.c.k.e.r, a part of javascript beautifier # by Einar Lielmanis <einar@jsbeautifier.org> # # written by Stefano Sanfilippo <a.little.coder@gmail.com> # # usage: # # if detect(some_string): # unpacked = unpack(some_string) # """Unpacker for Dean Edward's p.a.c.k.e.r""" import r...
import warnings from numbers import Integral, Number import numpy as np from tlz import concat, get, partial from tlz.curried import map from ..base import tokenize from ..highlevelgraph import HighLevelGraph from ..layers import ArrayOverlapLayer from ..utils import derived_from from . import chunk, numpy_compat fro...
from sympy import (residue, Symbol, Function, sin, I, exp, log, pi, S, factorial, sqrt, Rational, tan, cot, tanh) from sympy.testing.pytest import XFAIL, raises from sympy.abc import x, z, a, s def test_basic1(): assert residue(1/x, x, 0) == 1 assert residue(-2/x, x, 0) == -2 assert res...
import os from threading import Thread from time import sleep from djitellopy import Tello import argparse import picamera ap = argparse.ArgumentParser() ap.add_argument('-p', '--output', required=True, help='path to export video') tello_conn = None FIFO_Images = "/tmp/images.fifo" class Drone(objec...
#!/usr/bin/env python3 import sys, os, re sys.path.append("../../../utils/") from segmaker import segmaker segmk = segmaker("design.bits") cache = dict() print("Loading tags") ''' module,loc,n clb_NFFMUX_O5,SLICE_X12Y100,3 clb_NFFMUX_AX,SLICE_X13Y100,2 clb_NFFMUX_O6,SLICE_X14Y100,3 ''' f = open('params.csv', 'r') f...
import os import pytest from .. import storages from bobsled.utils import get_env_config def test_get_env_config_basic(): os.environ["FAKE_TEST_KEY"] = "DatabaseStorage" os.environ["BOBSLED_DATABASE_URI"] = "test://" Cls, args = get_env_config("FAKE_TEST_KEY", None, storages) assert Cls is storages.Da...
# Generated by Django 2.0.2 on 2018-02-21 16:15 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('chirp', '0013_rename_field_label_on_filter_to_title'), ] operations = [ migrations.AddField( model_name='aggregationframework', ...
#!/usr/bin/env python3 import sys, os sys.path.append(os.path.abspath("pydate")) from pydate import Year, Date, Time, DateTime demo_year = Year() demo_date = Date() demo_time = Time() demo_datetime = DateTime() demo_year.set_year_UTC() print("Demo Year: ", demo_year.tostring()) demo_date.set_year_UTC() demo_date....
import numpy as np import pandas as pd import pubchempy as pc def cid_df_to_smiles(df, cid_colname): """ Args: df : pandas dataframe with SID numbers column_name (str) : name of column that contains PubChem SID numbers Returns: df : modified with columns containing CID and SMILES...
#!/usr/bin/env python __author__ = "Yaroslav Litvinov" __copyright__ = "Copyright 2016, Rackspace Inc." __email__ = "yaroslav.litvinov@rackspace.com" import os import psycopg2 import bson import logging from logging import getLogger from bson.json_util import loads #from datetime import datetime import datetime #from...
from django.shortcuts import render def home(request): return render( request, 'index.html', { 'title': 'Home', 'name': 'Chandler G. Beck', } ) def about(request): return render( request, 'about.html', { 'title': ...
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ (NOTE: To use this class, please follow the tutorial here: http://parl.ai/static/docs/tutorial_worlds.html#mu...
""" Python 3 Web Application OAuth 2.0 example. This example can be run from the command line and will show you how the OAuth 2.0 flow should be handled if you are a web based application. Prerequisites: * Create an SSO application at developers.eveonline.com with the scope "esi-characters.read_bluep...
# Complete order def complete(x): execute('XADD', 'queue:complete', '*', 'order', x['id'], 'customer', x['value']['customer']) execute('XDEL', 'queue:customers', x['value']['customer']) execute('DECR', 'product') product = execute('GET', 'product') if int(product) < 1000: execut...
# -*- coding: utf-8 -*- # pidlockfile/pidlockfile.py # PID lock file implementation for use with # ‘python-daemon’, an implementation of PEP 3143. # # Copyright © 2018 Alexei Igonine <aigonine@gmail.com> # # This is free software: you may copy, modify, and/or distribute this work # under the terms of the Apache Lice...
import numpy as np import tensorflow as tf def count_line(file_path): counter = 0 with open(file_path, 'r', encoding='utf8') as f: for _ in f: counter += 1 return counter def valid_vocab_file(file_path): with open(file_path, 'r', encoding='utf8') as f: zero_index_word = ...