text
stringlengths
2
999k
# Copyright (c) 2018 Micro Focus or one of its affiliates. # Copyright (c) 2018 Uber Technologies, 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/L...
def test_get_empty_collection(client): empty_response = client.get('/data') assert empty_response.status_code == 200 assert 'json' in empty_response.content_type assert empty_response.is_json assert empty_response.json['href'].startswith('http') assert empty_response.json['href'].endswith('/data...
"""Discover and run doctests in modules and test files.""" import bdb import inspect import platform import sys import traceback import types import warnings from contextlib import contextmanager from pathlib import Path from typing import Any from typing import Callable from typing import Dict from typing import Gener...
#from pymel.core import factories #from pymel.all import mayautils import pprint import os.path import re import copy import pymel.core as pm import pymel.internal.factories as factories #import pymel.internal.mayautils as mayautils import pymel.internal.startup as startup import pymel.internal.cmdcache as cmdcache im...
""" This file offers the methods to automatically retrieve the graph Oscillibacter ruminantium. The graph is automatically retrieved from the STRING repository. References --------------------- Please cite the following if you use the data: ```bib @article{szklarczyk2019string, title={STRING v11: protein--prot...
# -*- coding: utf-8 -*- ''' Grains for junos. NOTE this is a little complicated--junos can only be accessed via salt-proxy-minion. Thus, some grains make sense to get them from the minion (PYTHONPATH), but others don't (ip_interfaces) ''' __proxyenabled__ = ['junos'] __virtualname__ = 'junos' def __virtual__(): ...
""" Copyright 2011 Lars Kruse <devel@sumpfralle.de> This file is part of PyCAM. PyCAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. PyCA...
#!/usr/bin/env python """ Module Name: test_bitonic_sorting_top.py Created date: 08/10/2020 Last Modified: 08/10/2020 Description: 2**n input comparing/sorting testbench Author: John Zhang Company: Shanghai Jiao Tong University """ from myhdl import * import os module_1 = 'input_2' module_2 = 'bitonic_sorting_recur...
from setuptools import setup, find_packages from pip.req import parse_requirements install_reqs = parse_requirements('requirements.txt', session=False) reqs = [str(ir.req) for ir in install_reqs] setup( version='0.1', name='lockbox', url='https://github.com/johnwheeler/lockbox', author='John Wheeler', ...
# -*- coding: UTF-8 -*- import yadll def test_hyperparameters(): hp = yadll.hyperparameters.Hyperparameters() hp('param1', 1, [1, 2, 3]) hp('param2', 20, [10, 20, 30]) hp('param3', 300, [100, 200, 300]) assert hp.param1 == 1 assert hp.param2 == 20 assert hp.param3 == 300 assert hp.to...
from pytest import mark from myia.ir import manage from myia.pipeline import scalar_debug_pipeline cconv_pipeline = scalar_debug_pipeline \ .select('resources', 'parse', 'resolve', 'cconv', 'export') def check_no_free_variables(root): mng = manage(root) for g, nodes in mng.nodes.items(): if not ...
#!/usr/bin/env python # ---- MODULE DOCSTRING __doc__ = """ (C) Hive, Romain Wuilbercq, 2017 _ /_/_ .'''. =O(_)))) ...' `. \_\ `. .'''X `..' .---. .---..-./`) ,---. ,---. .-''-. | | |_ _|\ .-.')| / | | .'_ _ \ | | ( ' )/ `-' \| | | .'...
"""AppConfig for admin.""" from __future__ import unicode_literals from django.apps import AppConfig from .app_settings import load_admin_settings class AdminConfig(AppConfig): """App configuration.""" name = "modoboa.admin" verbose_name = "Modoboa admin console" def ready(self): load_ad...
# MIT License # # Copyright (c) 2022 Quandela # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, pub...
"""Tests for the proper fractions kata""" import unittest from solutions.proper_fractions import proper_fractions class ProperFractionsTest(unittest.TestCase): """Proper fractions test suite""" def setUp(self): """Set up test cases from kata""" self.kataCases = [(1, 0), ...
"""Test whether all elements of cls.args are instances of Basic. """ # NOTE: keep tests sorted by (module, class name) key. If a class can't # be instantiated, add it here anyway with @SKIP("abstract class) (see # e.g. Function). import os import re from sympy import (Basic, S, symbols, sqrt, sin, oo, Interval, exp,...
from setuptools import find_packages, setup setup( name='src', packages=find_packages(), version='0.1.0', description='Wafer Project using MLops', author='harish2f', license='MIT', )
from django.conf.urls import include # noqa from django.conf.urls import patterns from django.conf.urls import url from openstack_dashboard.dashboards.project.pertino import views urlpatterns = patterns('', url(r'^$', views.IndexView.as_view(), name='index'), url(r'^display_list/(?P<display_type>[^/]+)/$', ...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import gym import logging import numpy as np from functools import partial from ray.tune.registry import RLLIB_MODEL, RLLIB_PREPROCESSOR, \ RLLIB_ACTION_DIST, _global_registry from ray.rllib.models.extra_...
# coding: utf-8 """ Subscriptions Subscriptions allow contacts to control what forms of communications they receive. Contacts can decide whether they want to receive communication pertaining to a specific topic, brand, or an entire HubSpot account. # noqa: E501 The version of the OpenAPI document: v3 ...
import unittest import json import os,sys parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.insert(0,parentdir) from QueryMyGene import QueryMyGene def get_from_test_file(filename, key): f = open(filename, 'r') test_data = f.read() try: test_data_dict = json.loads(...
# SPDX-FileCopyrightText: Melissa LeBlanc-Williams for Adafruit Industries # SPDX-License-Identifier: MIT # This example is for use on (Linux) computers that are using CPython with # Adafruit Blinka to support CircuitPython libraries. CircuitPython does # not support PIL/pillow (python imaging library)! # # Ported to ...
#!/usr/bin/env python3 from requests import get, put """ Cloudflare DDNS Updater Using requests PEP8 compliant "Simple is better than complex." """ current_ip = get('https://api.ipify.org').text api_url = ('https://api.cloudflare.com/client/v4/zones/' '__REPLACE__/dns_records/' ...
""" A federated learning client with support for Adaptive Synchronization Frequency. Reference: C. Chen, et al. "GIFT: Towards Accurate and Efficient Federated Learning withGradient-Instructed Frequency Tuning," found in papers/. """ from plato.config import Config from plato.clients import simple class Client(si...
# -*- coding: utf-8 -*- from django.conf import settings from django_lean.experiments.models import Experiment from django_lean.experiments.tests.utils import TestCase, TestUser class TestParticipants(TestCase): def testDisabledExperiment(self): # disabled test (unenrolled user) experiment = Expe...
import requests from django.contrib.auth.models import User from django.db.models.signals import m2m_changed, post_save from django.db.utils import IntegrityError from django.dispatch import receiver from django.shortcuts import get_object_or_404 from django_follow_system.models import Follow from github_auth.models im...
# -*- 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...
from datetime import datetime from typing import List from enum import Enum import pandas as pd import time import plotly.graph_objects as go ## Enum to identify platforms class Platforms(Enum): FTX = "FTX" ## Base class for platfrom wrappers. # Implements all common functionalities # for platforms and platform...
""" Copyright (c) 2013 The Regents of the University of California, AMERICAN INSTITUTES FOR RESEARCH All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the abo...
#!/usr/bin/env python """The setup script.""" from setuptools import find_packages, setup with open('README.rst') as readme_file: readme = readme_file.read() with open('HISTORY.rst') as history_file: history = history_file.read() requirements = [ 'Click>=7.0', 'lxml', 'requests', # Drop th...
from aoc2019.shared.solution import Solution from aoc2019.shared.intcode import getProgramFromFile from aoc2019.helpers.day17 import VacuumRobot, sumAlignmentParametersOfIntersections class Day17(Solution): def part1(self): program = getProgramFromFile(self._dirPath + "/../input/day17.txt") bot = ...
print ("this is just a new file")
#!python2 # Workflow to clean, split and standardize coverage shapefiles # Need Python 2.7 and ArcPy import arcpy, logging, sys from os import path, sep, makedirs, removedirs, getpid, listdir, remove from datetime import date, datetime from shutil import copy, rmtree arcpy.env.overwriteOutput = True #overwrite existi...
#----------------------------------------------------------------------------- # Copyright (c) 2005-2021, PyInstaller Development Team. # # Distributed under the terms of the GNU General Public License (version 2 # or later) with exception for distributing the bootloader. # # The full license is in the file COPYING.txt...
from keepmail import KeepmailSMTPFactory
""" Copyright 2012 Red Hat, 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 writing, software ...
from unittest.mock import Mock from pytest import mark, fixture from pyviews.core import InheritedDict, Node, XmlNode from pyviews.rendering.common import RenderingContext, use_context, get_rendering_context, pass_rendering_context @fixture def rendering_context_fixture(request): request.cls.context = Rendering...
import gym import gym.spaces from deeplog.environments import SupplyEnv import pandas as pd import numpy as np from deeplog.wrappers import Base from abc import ABC, abstractmethod class Model(Base): def __init__(self, env): Base.__init__(self, env) self.series: pd.DataFrame = pd.DataFrame({'d...
#!/usr/bin/env python """Download files from UPenn Butterflies of Costa Rica Web Site.""" import argparse import re import socket import urllib.request from urllib.error import HTTPError import pandas as pd from bs4 import BeautifulSoup from src.pylib.consts import DATA_DIR # Make a few attempts to download a page...
from qmcpy.true_measure._true_measure import TrueMeasure from qmcpy.util import DimensionError from ..discrete_distribution import Sobol from numpy import * class BernoulliCont(TrueMeasure): """ See https://en.wikipedia.org/wiki/Continuous_Bernoulli_distribution """ def __init__(self, sampler, lam=1/2, b=2):...
import pytest from django.urls import resolve, reverse from jrweb.users.models import User pytestmark = pytest.mark.django_db def test_detail(user: User): assert ( reverse("users:detail", kwargs={"username": user.username}) == f"/users/{user.username}/" ) assert resolve(f"/users/{user.us...
from hazelcast.serialization.bits import * from hazelcast.protocol.client_message import ClientMessage from hazelcast.protocol.codec.transactional_map_message_type import * REQUEST_TYPE = TRANSACTIONALMAP_GET RESPONSE_TYPE = 105 RETRYABLE = False def calculate_size(name, txn_id, thread_id, key): """ Calculates t...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import numpy as np import pandas as pd class ModelStats: ''' General class (not to be called outside of RegressionStats) for classes that generate model statistics, like RegressionStats Input: fitted_model - a scikit-learn LinearRegression fitted ...
from __future__ import unicode_literals from django.core.exceptions import ImproperlyConfigured from waffle.utils import get_setting from django.apps import apps as django_apps VERSION = (0, 13, 0) __version__ = '.'.join(map(str, VERSION)) def flag_is_active(request, flag_name): flag = get_waffle_flag_model()....
# -*- coding: utf-8 -*- # Generated by Django 1.11.1 on 2017-06-12 20:49 from __future__ import unicode_literals from django.db import migrations, models def copy_site_to_sites(apps, schema_editor): current_database = schema_editor.connection.alias PageBase = apps.get_model('wizard_builder.PageBase') for...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ('user_accounts', '0003_auto_20150504_1049'), ] operations = [ migrations.CreateModel( ...
import matplotlib.pyplot as plt import numpy as np np.random.seed(0) import pandas as pd num_samples = 100 ts = pd.Series(np.random.randn(num_samples), index=pd.date_range("1/1/2000", periods=num_samples)) # # print(ts.head()) # ts.plot() # plt.show() data = np.concatenate([np.random.randn(num_samples, 2), np.ran...
# -*- coding: utf-8 -*- # @Author: Jie Yang from SUTD # @Date: 2016-Jan-06 17:11:59 # @Last Modified by: Jie Yang, Contact: jieynlp@gmail.com # @Last Modified time: 2019-07-31 10:51:48 #!/usr/bin/env python # coding=utf-8 from tkinter import * from tkinter import ttk from tkinter.ttk import * #Frame, Button, L...
# This file contains driver code for generating passphrases from entropy # # Author: Josh McIntyre # import busio import board import digitalio import adafruit_matrixkeypad import adafruit_character_lcd.character_lcd_i2c as character_lcd import time import os import entropallib def init_keypad_mc(): cols = [digi...
########################################################################## # # Copyright (c) 2012, John Haddon. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of so...
# Copyright 2016 MongoDB, 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 writing, so...
# -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) 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 co...
# Copyright (C) 2003-2007 Robey Pointer <robeypointer@gmail.com> # # This file is part of paramiko. # # Paramiko 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 # Software Foundation; either version 2.1 of the License, or (a...
#!/usr/bin/env python # -*- encoding: utf-8 -*- import numpy as np import pytest from test_core import srand import librosa # Core viterbi tests def test_viterbi_example(): # Example from https://en.wikipedia.org/wiki/Viterbi_algorithm#Example # States: 0 = healthy, 1 = fever p_init = np.asarray([0.6,...
# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from __future__ import absolute_import, division, print_function, unicode_literals import logging import os import re import subprocess #...
""" Test CSS loaders """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from django.conf import settings from django.test import TestCase from django.test import override_settings from django_inlinecss.css_loaders im...
import csv import datetime import glob import json import os import pickle import sys limit = 1e10 if len(sys.argv) > 1: limit = int(sys.argv[1]) print(f'only generating data for last {limit} days') DAILY_REPORTS_DIR = ( 'inputs/COVID-19/csse_covid_19_data/csse_covid_19_daily_reports' ) NUMCOLS = ('confi...
class TestWriting(object): def test_writing_pdf(self): from signedpdf.pdfparser import PDF, Page from StringIO import StringIO s = StringIO() p = PDF() p1 = Page() p.pages.add_page(p1) p.write(s) print(s) import sys d = s.getvalue...
""" CryptoAPIs Crypto APIs 2.0 is a complex and innovative infrastructure layer that radically simplifies the development of any Blockchain and Crypto related applications. Organized around REST, Crypto APIs 2.0 can assist both novice Bitcoin/Ethereum enthusiasts and crypto experts with the development of thei...
# # Copyright (c) 2008-2015 Citrix Systems, 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 l...
import sqlite3 class DBHelper: def __init__(self, dbname="events.sqlite"): self.dbname = dbname self.conn = sqlite3.connect(dbname, check_same_thread=False) self.setup() def setup(self): print("creating table") stmt = """CREATE TABLE IF NOT EXISTS events ( ...
# Generated by Django 3.2.7 on 2021-09-16 09:50 from django.db import migrations, models import uuid class Migration(migrations.Migration): dependencies = [ ('imports', '0004_importbatch_id'), ] operations = [ migrations.AlterField( model_name='importbatch', name...
from __future__ import unicode_literals import base64 from datetime import datetime, timedelta try: from django.utils.six.moves import cPickle as pickle except ImportError: import pickle import string from django.conf import settings from django.core.exceptions import SuspiciousOperation from django.utils.cry...
#!/usr/bin/env python3 # Copyright (c) 2016-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 segwit transactions and blocks on P2P network.""" from binascii import hexlify import math import ...
#! /usr/bin/env python import os import sys import pysam import inspect from collections import defaultdict import argparse parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(description='analyze sam for mappability') # parser.add_argument('-i', required=True, help='input') parser.add_argument('-o', n...
#!/usr/bin/env python # Copyright 2017 The Forseti Security 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 # #...
import asyncio import uuid from typing import Dict from fastapi import WebSocket class RenderWorker: def __init__(self, ws: WebSocket): self.tag = uuid.uuid4() self.events = asyncio.Queue() self.handles: Dict[str, asyncio.Future] = {} self.ws = ws def __eq__(sel...
#/usr/bin/python # A pure Python implementation of the SHA-1 algorithm # Code adapted from Wikipedia https://en.wikipedia.org/wiki/SHA-1 # Not for use in production code :-) from struct import pack from struct import unpack class SHA1: # Initial values h0 = 0x67452301 h1 = 0xEFCDAB89 h2 = 0x98BADCFE h3 = 0x10...
''' File: GUI.py Description: load all class for medImgProc Contains externally usable class History: Date Programmer SAR# - Description ---------- ---------- ---------------------------- Author: w.x.chan@gmail.com 12JAN2019 - Created Author: w.x.chan@gmail.com 08OC...
# Copyright 2016 OpenStack Foundation # 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 requ...
""" @package mi.dataset.parser.test.test_optaa_dj_cspp @file marine-integrations/mi/dataset/parser/test/test_optaa_dj_cspp.py @author Joe Padula @brief Test code for a optaa_dj_cspp data parser Notes on test data: 11079364_ACS_ACS.txt and 11079364_ACD_ACS.txt are taken from the IDD as examples of recovered and teleme...
from document_management_03.project.category import Category from document_management_03.project.document import Document from document_management_03.project.topic import Topic class Storage: def __init__(self): self.categories: list = [] self.topics: list = [] self.documents: list = [] ...
#!/usr/bin/env python # Copyright (c) 2013-2015 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. from __future__ import division,print_function,unicode_literals import biplist from ds_store import DSStore...
from setuptools import (find_packages, setup) with open('README.md', 'r') as readme: long_description = readme.read() setup( author='amancevice', author_email='smallweirdnum@gmail.com', classifiers=[ 'Development Status :: 4 - Beta', 'Environment :: Console', 'Intended Audience...
# Copyright Pincer 2021-Present # Full MIT License can be found in `LICENSE` at the project root. """sent when a message is deleted in a subscribed text channel""" from __future__ import annotations from typing import TYPE_CHECKING from ..objects.events.message import MessageDeleteEvent from ..utils.conversion impor...
from urllib.parse import urlparse from typing import Tuple, Union, Optional, List from returns.result import Result, Success, Failure from mason.clients.engines.metastore import MetastoreClient from mason.clients.response import Response from mason.clients.s3.s3_client import S3Client from mason.clients.s3.storage im...
# qubit number=4 # total number=37 import cirq import qiskit from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister from qiskit import BasicAer, execute, transpile from pprint import pprint from qiskit.test.mock import FakeVigo from math import log2 import numpy as np import networkx as nx def bitwise_...
import datetime import email import logging import os import re import subprocess import time import warnings import mailbox from mailbox import mboxMessage from pathlib import Path from typing import Dict, List, Optional, Tuple, Union from urllib.parse import urljoin, urlparse import numpy as np import pandas as pd i...
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * from spack.pkg.builtin.singularityce import SingularityBase # Apptainer is the new name of Singular...
""" Django settings for meiduo project. Generated by 'django-admin startproject' using Django 2.1.4. For more information on this file, see https://docs.djangoproject.com/en/2.1/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/2.1/ref/settings/ """ import os #...
#PID CONTROL FOR RPM ONLY def background(self): def run(self): print("Starting Thread 1") thread1 = threading.Thread(target = pid_control, args = (self,)) thread1.daemon = True thread1.start() def pid_control(self): ### PID TARGET ...
# # Copyright(c) 2012-2021 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause-Clear # import pytest import unittest.mock as mock import stat import helpers as h import opencas @pytest.mark.parametrize( "line", [ "", " ", "#", " # ...
''' Module for outcome classes ''' import abc import collections import numbers import six import pandas from .util import Variable from ema_workbench.util.ema_exceptions import EMAError from ..util import get_module_logger # Created on 24 mei 2011 # # .. codeauthor:: jhkwakkel <j.h.kwakkel (at) tudelft (dot) nl> ...
from rest_framework import serializers from profiles_api import models class HelloSerializer (serializers.Serializer): """Serializes a name field for testing our APIView""" name = serializers.CharField(max_length=10) class UserProfileSerializer(serializers.ModelSerializer): """Serializes a user profile ...
# mylambdata/polos.py # Polo Class! # attributes / properties (NOUNS): size, color, price # methods (VERBS): wash, fold, sell class Polo(): def __init__(self, size, color): self.size = size self.color = color @property def full_name(): return {self.size} {self.color} @static...
""" 'Gofra' graph module. Contains all stuff releated to the generating graph file from the source. """ from typing import IO from os.path import basename from ..core.danger import * from ..core.other import try_open_file # Constants. __GRAPH_EXTENSION = ".dot" def __write_header(file: IO, name: str): ...
if __name__ == '__main__': a = 142 b = str(a) print(len(b))
from django.test import TestCase from django.contrib.auth import get_user_model class ModelTests(TestCase): def test_create_user_with_email_successful(self): email = "test@test.com" password = "Testpass_12345" user = get_user_model().objects.create_user( email_address=email, ...
from __future__ import print_function, division import os import numpy as np import numpy.random import datetime import torch import torch.optim as optim from torch.nn.functional import relu from lib.dataloader import DataLoader # modified dataloader from lib.model_train.model_pixelCT_ncnet_adap import ImMatchNet fro...
""" CCS811 Indoor Air Quality Sensor. Based on CCS811 datasheet. Inspired by Adafruit and Sparkfun libraries """ import logging import utime from micropython import const class CCS811: """CCS811 gas sensor. Measures eCO2 in ppm and TVOC in ppb.""" DRIVE_MODE_IDLE = const(0x00) DRIVE_MODE_1SEC = const(0x...
from myoperator import BlockOperator import re class output_DE(BlockOperator): """ Select one line per DE-cluster with the best quality description. Creates cluster_data column 'desc','genename' Inputs: data columns 'clusid','desc','FF','status' cluster_data column 'clu...
from daemonize import Daemonize import sys,base64,uuid from subprocess import Popen,PIPE pid = "/tmp/bbb_daemon_"+sys.argv[2] b64cmd=sys.argv[1] def main(): cmd=base64.b64decode(b64cmd) Popen(cmd, shell=True) daemon = Daemonize(app=b64cmd, pid=pid, action=main) daemon.start()
from __future__ import unicode_literals import itertools import os import random import unicodedata from collections import defaultdict from django.conf import settings from django.core.files import File from django.template.defaultfilters import slugify from faker import Factory from faker.providers import BaseProvi...
test = { 'name': 'q4a', 'points': 1, 'suites': [ { 'cases': [ {'code': '>>> np.random.seed(88);\n>>> group2pivotal == sum(grouptrials.column("voter piv2"))/ntrials #SOLUTION\nTrue', 'hidden': True, 'locked': False}, {'code': '>>> np.random.seed(88);\n>>> group3pivotal ...
import os import json import torch import shutil import logging import datetime import numpy as np from collections import defaultdict, deque from contextlib import contextmanager _CURRENT_STORAGE_STACK = [] def get_event_storage(): assert len( _CURRENT_STORAGE_STACK ), "get_event_storage() has to b...
#!/usr/local/bin/python3 import requests import time import random while True: tem = random.randint(30, 40) pre = 2 + random.random() log = {'temperature': tem, 'pressure': pre} print(log) body = {'username': 'daipei5', 'mac': 'b6:00:1d:d0:2c:34', 'log': log} r = requests.post('http://localho...
#! /usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals import logging import datetime from models import Post, Tag logger = logging.getLogger('data') ''' This file contains functions that help us create models with mostly default properties, but with the ability to configure any on...
# Python 3 SDK for the KUSANAGI(tm) framework (http://kusanagi.io) # Copyright (c) 2016-2021 KUSANAGI S.L. All rights reserved. # # Distributed under the MIT license. # # For the full copyright and license information, please view the LICENSE # file that was distributed with this source code. def test_lib_payload(): ...
import collections from typing import List, Tuple, Set from PIL import Image, ImageDraw import time def read_maze_from_file(f): maze = list() with open(f) as file: for line in file: maze.append(list(line.rstrip())) return maze def print_maze(maze: List[str]) -> None: for row in m...
#!/usr/bin/env python3 import argparse import collections import json def mk_obj(csr): """ Makes an object of dicts and lists from the registers var """ def make_dict(): return collections.defaultdict(make_dict); def set_path(d, path, value): if path[-1] in ['reset', 'issue', 'e...