text
stringlengths
1
927k
# 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 ...
from machine import ADC, Pin import time class LDR: """This class read a value from a light dependent resistor (LDR)""" def __init__(self, pin, min_value=0, max_value=100): """ Initializes a new instance. :parameter pin A pin that's connected to an LDR. :parameter min_value A ...
# -*- coding: utf-8 -*- # PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN: # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code from ccxt.async_support.base.exchange import Exchange import math from ccxt.base.errors import ExchangeError from ccxt.base.errors import A...
import shutil, zipfile, os, time def delFile(path): for root, dirs, files in os.walk(path, topdown=False): for name in files: os.remove(os.path.join(root, name)) for name in dirs: os.rmdir(os.path.join(root, name)) for root, dirs, files in os.walk(path, topdown=False): ...
import unittest from conans.server.crypto.jwt.jwt_credentials_manager import JWTCredentialsManager from conans.server.crypto.jwt.jwt_manager import JWTManager from datetime import timedelta import time import jwt from jwt import DecodeError class JwtTest(unittest.TestCase): def setUp(self): unittest.Test...
# Generated by Django 3.0.5 on 2020-09-24 09:38 import api.models import datetime from django.db import migrations, models import django.db.models.deletion import django.utils.timezone class Migration(migrations.Migration): initial = True dependencies = [ ('user', '0002_customer'), ] opera...
from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType import copy as _copy class Font(_BaseLayoutHierarchyType): # class properties # -------------------- _parent_path_str = "layout.annotation" _path_str = "layout.annotation.font" _valid_props = {"color", "family", ...
# 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 nussl import ml, datasets, evaluation import tempfile from torch import optim import numpy as np import logging import os import torch from matplotlib import pyplot as plt logging.basicConfig( format='%(asctime)s,%(msecs)d %(levelname)-8s [%(filename)s:%(lineno)d] %(message)s', datefmt='%Y-%m-%d:%H:%M:%S'...
#Import Libs import pandas as pd # Inputs #col_name = input('What is the name of the column to convert to columns?: ') #keyz = input('what are the names of the columns that uniquely identify a row? (seperate these with pipes "|"):') #keyz.split('|') file_dir = r'data.xlsx' output_dir = r'data-out.xlsx' list_key_cols =...
IntxLNK../../../../../micropython-lib/umqtt.simple/umqtt/simple.py
"""Graph a class for graph manipulation """ import vflib from Matcher import Matcher # for now these molecules will be immutable def is_remove(list, object): """remove objects from a list using is equivalence instead of comparison equivalence""" result = [] for e in list: if object is not e...
from django.shortcuts import render,redirect from django.db import connection from django.core.files.storage import FileSystemStorage from django.contrib.auth import get_user_model,authenticate from django.contrib import messages,auth from django.conf import settings from .models import Profile, Appointments, Prescript...
from distutils.core import setup setup( name = 'CombiParser', packages = ['CombiParser'], version = '0.4', license='MIT', description = 'A simple combinator parser.', author = 'Sam Harding', author_email = 'samueljames.harding@icloud.com', url = 'https://github.com/sam-james-harding/CombiParser', dow...
from setuptools import setup setup( name='python-i18n', version='0.3.9', description='Translation library for Python', long_description=open('README.md').read(), long_description_content_type='text/markdown', author='Daniel Perez', author_email='tuvistavie@gmail.com', url='https://githu...
## MIT License # Copyright (c) 2017 John Williamson # Copyright (c) 2008 Cournapeau David # 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 t...
# encoding: utf-8 # module PySide.QtXml # from C:\Python27\lib\site-packages\PySide\QtXml.pyd # by generator 1.147 # no doc # imports import Shiboken as __Shiboken class QXmlDTDHandler(__Shiboken.Object): # no doc def errorString(self, *args, **kwargs): # real signature unknown pass def notation...
""" This file contains a minimal set of tests for compliance with the extension array interface test suite, and should contain no other tests. The test suite for the full functionality of the array is located in `pandas/tests/arrays/`. The tests in this file are inherited from the BaseExtensionTests, and only minimal ...
from django.apps import AppConfig #from infinityroom.models import GlobalVars class InfinityroomConfig(AppConfig): name = 'infinityroom' def ready(self): print('shaeed khan') #g = GlobalVars.objects.all() #for a in g: # a.delete()
# Generated by Django 3.0.3 on 2020-04-01 23:55 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Video', fields=[ ('id', models.AutoField(au...
# -*- coding: utf-8 -*- import unittest import wikipediaapi from tests.mock_data import wikipedia_api_request class TestWikipediaPage(unittest.TestCase): def setUp(self): self.wiki = wikipediaapi.Wikipedia("en") self.wiki._query = wikipedia_api_request def test_repr_before_fetching(self): ...
""" Copyright 2018-present, Facebook, 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,...
from unittest import TestCase import operator from aoc_utils.data import data_text class Coordinates(object): def __init__(self, coordinates): self.coordinates = coordinates[:] def __str__(self): return "{}".format(self.coordinates) def __getitem__(self, item): return self.coordi...
from __future__ import print_function from oauth2client.client import OAuth2WebServerFlow import gmusicapi from mopidy import commands class GMusicCommand(commands.Command): def __init__(self): super(GMusicCommand, self).__init__() self.add_child('login', LoginCommand()) class LoginCommand(co...
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file '../include/mainwindow.ui' # # Created: Wed Mar 30 17:46:45 2016 # by: PyQt4 UI code generator 4.10.4 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8...
"""Thermistor calculation methods, Semitec 103AT-2 thermistor using ADS1x15 ADC I2C Driver for Raspberry PI & MicroPython""" from math import log def steinhart_hart(r, a, b, c, degrees='celcius'): """Calculate temperature from a resistance based on the Steinhart-Hart equation. Defaults to degres in Celcius ...
# 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 "License"); you may not use ...
def findDecision(obj): #obj[0]: Passanger, obj[1]: Time, obj[2]: Coupon, obj[3]: Education, obj[4]: Occupation, obj[5]: Bar, obj[6]: Restaurant20to50, obj[7]: Direction_same, obj[8]: Distance # {"feature": "Direction_same", "instances": 23, "metric_value": 0.9986, "depth": 1} if obj[7]<=0: # {"feature": "Coupon", "...
#!/usr/bin/env python """WAL-E is a program to assist in performing PostgreSQL continuous archiving on S3: it handles pushing and fetching of WAL segments and base backups of the PostgreSQL data directory. """ def gevent_monkey(*args, **kwargs): import gevent.monkey gevent.monkey.patch_socket(dns=True, aggre...
import sys import django.core.validators import django.db.models.deletion import taggit.managers from django.db import migrations, models SITE_STATUS_CHOICES = ( (1, 'active'), (2, 'planned'), (4, 'retired'), ) RACK_TYPE_CHOICES = ( (100, '2-post-frame'), (200, '4-post-frame'), (300, '4-post-...
""" Copyright (c) Facebook, Inc. and its affiliates. """ # fmt: off ''' Every template contains an ordered list of TemplateObjects. TemplateObject is defined in template_objects.py Dig templates are written for a Location and represent the intent for the action: Dig. This action intends to dig a hole at a certain loc...
from django import forms from django.utils.translation import ugettext as _ from .models import LegalItem from app.validators import FileSizeValidator class LegalItemForm(forms.ModelForm): """ Legal item update form. Only platform administrator users can submit this form. The 'notify_users' field mus...
class IceFeature(object): def __init__(self): self.gmlId = None self.geometry = None def get_geometry(self): return self.__geometry def set_geometry(self, value): self.__geometry = value def get_gml_id(self): return self.__gmlI...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Apr 1 10:40:28 2020 @author: Nic Pittman This code will reproduce Figure 4 in Pittman et al., 2021. Trends and pvalues are calculated on the fly and not saved anywhere, however could be done easily. regridded data is required for this process This ...
import os import shutil import argparse ORIG_FEAT = 'ResNet-152-imagenet' parser = argparse.ArgumentParser() parser.add_argument("--name", default="ResNet-152-imagenet") parser.add_argument("--dim", default="2048") parser.add_argument("--src-dir", default="r2r_src") args = parser.parse_args() print("Get ORIG files:...
import warnings class SentinelCommands: """ A class containing the commands specific to redis sentinel. This class is to be used as a mixin. """ def sentinel(self, *args): """Redis Sentinel's SENTINEL command.""" warnings.warn(DeprecationWarning("Use the individual sentinel_* meth...
""" Some basic tests for mflistfile.py module (not super rigorous) """ import os import flopy import numpy as np from nose.tools import raises def test_mflistfile(): pth = os.path.join("..", "examples", "data", "freyberg") list_file = os.path.join(pth, "freyberg.gitlist") assert os.path.exists(list_file...
from cansat import ReadLog import re import math as m temperatura = [] presion = [] aceleracion = [] ax = [] ay = [] az = [] orientacion = [] orientacionFloat =[] oy = [] oz =[] alt = [] cont = 0 #Esta funcion valida que los datos del documento sean numeros #Si no lo son retorna un string Nan #NOTA IMPORTANTE: Solo f...
from __future__ import division import numpy as np from scipy.ndimage.morphology import binary_erosion, binary_fill_holes def hu_to_grayscale(volume): volume = np.clip(volume, -512, 512) mxmal = np.max(volume) mnval = np.min(volume) im_volume = (volume - mnval) / max(mxval - mnval, 1e-3) im_volume ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jan 26 12:25:25 2018 Toy datasets. @author: jlsuarezdiaz """ import numpy as np import pandas as pd from six.moves import xrange from sklearn.preprocessing import LabelEncoder import seaborn as sns import matplotlib.pyplot as plt from sklearn.datasets...
from django import forms from django.forms import ModelForm, Form from census_paleo.models import occurrence, taxonomy, measured_values, specimen from ajax_select import make_ajax_field class OccurrenceForm(ModelForm): taxon = make_ajax_field(occurrence, "taxon", "taxonLookup") ref = make_ajax_field(occurren...
# -*- coding: utf-8 -*- # Copyright 2016 OpenMarket Ltd # # 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...
"""Test cases for the pricing of scheduled cashflows."""
# Copyright (c) 2021 Angus Gratton # # SPDX-License-Identifier: Apache-2.0 # # This module contains device-level interface to Canalyst-II import ctypes import logging import usb.core import time from . import protocol logger = logging.getLogger(__name__) # "Fast" lookups to go from channel to USB endpoint number CHA...
#---------------------------------------- #--------- Torch Related Imports -------- #---------------------------------------- import torch import torch.distributed as distributed #---------------------------------------- #--------- Import Wandb Here ------------ #---------------------------------------- import wandb ...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import torch def cross_entropy_dist_epoch(reduction='mean', **_): cross_entropy_fn = torch.nn.CrossEntropyLoss(reduction=reduction) l1_fn = torch.nn.L1Loss(reduction=reduction) def loss_fn(output...
def escreverPratos(): for i in range(0, t): op = int(input("\nEscolha o prato de sua preferência: ")) if op == 1: vet.append("Bobó de Camarão") vetPrecoPrato.append(25.90) if op == 2: vet.append("Moqueca de Camarão") vetPrecoPrato.append(29.90)...
# # Copyright (C) 2020 Arm Mbed. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # import json import pathlib import tempfile from unittest import TestCase from mbed_tools.build._internal.config.source import ( Source, _namespace_data, _filter_target_overrides, _decode_json_file, ) class T...
n = int(input()) brancas = pretas = 0 if n % 2 == 0: brancas = pretas = n * n / 2 else: brancas = int(n * n / 2) + 1 pretas = brancas - 1 print(f"{brancas:.0f} casas brancas e {pretas:.0f} casas pretas")
from datetime import datetime, timedelta import iso8601 from celery.exceptions import Retry from flask import current_app, json from notifications_utils.statsd_decorators import statsd from sqlalchemy.orm.exc import NoResultFound from app import notify_celery, statsd_client from app.clients.email.aws_ses import get_a...
''' Module: utility Author: David Frye Description: Contains a variety of helper Classes. ''' import enum import random class Direction(enum.Enum): ''' Enum: Direction Description: Represents the four primary cardinal directions (North, East, South, and West) ''' NORTH = 0 EAST = 1 SOUTH = 2 WEST = 3 def ge...
# Copyright 2017 reinforce.io. 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 applicable law or...
""" A module to implement the evolutionary algorithm for a feedforward neural network. Crossover and mutation """ from __future__ import absolute_import from __future__ import print_function import sys import math import csv import warnings import numpy as np import random import copy from datetime import datetime war...
""" Instrument aiopg to report a span for each executed Postgres queries:: from ddtrace import Pin, patch import aiopg # If not patched yet, you can patch aiopg specifically patch(aiopg=True) # This will report a span with the default settings async with aiopg.connect(DSN) as db: with...
from dataclasses import dataclass from functools import reduce from parse import findall from aocd import get_data @dataclass class Fold: x_or_y: str value: int def fold(self, coordinates): return {self._transform(x, y) for x, y in coordinates} def _transform(self, x, y): if self.x_...
from lime import lime_tabular, lime_image from scipy.misc import imresize import numpy as np import tensorflow as tf class TabularExplainer: def __init__(self, dataset, verbose=True): train_dataset, training_labels = dataset.make_numpy_array(dataset.get_train_file()) mode = dataset.get_mode() ...
# Copyright 2021 MosaicML. All Rights Reserved. """The CIFAR ResNet torch module. See the :doc:`Model Card </model_cards/resnet>` for more details. """ # Code below adapted from https://github.com/facebookresearch/open_lth # and https://github.com/pytorch/vision from typing import List, Tuple import torch import t...
# Copyright (C) 2018-2021 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import openvino.runtime.opset8 as ov from openvino.runtime.impl import Dimension, Function, PartialShape, Shape def test_dimension(): dim = Dimension() assert dim.is_dynamic assert not dim.is_static ...
from datetime import datetime def time_now(request): return {'time_now': datetime.now()}
default_app_config = 'greenbudget.app.fringe.apps.FringeConfig'
import os import logging import datetime import numpy as np import tensorflow as tf from gym.spaces import Box, Discrete from gym.utils import colorize from control.utils.misc import Config from control.utils.misc import REPO_ROOT, RESOURCE_ROOT from abc import ABC, abstractmethod class TrainConfigBase(Config):...
# Owner(s): ["module: unknown"] from functools import partial import torch from torch.testing import FileCheck from torch.testing._internal.common_utils import \ (run_tests, IS_SANDCASTLE, clone_input_helper, first_sample) from torch.testing._internal.common_methods_invocations import op_db from torch.testing._i...
# Helper class that stores all relevant information of a document class document: def __init__(self, id, externalid=0, title="", author="", publishingYear=0, journal="", terms=[], uri="" ): self.id = id self.externalid = externalid self.title = title self.author = author sel...
import csv import os from histdata.api import download_hist_data def mkdir_p(path): import errno try: os.makedirs(path) except OSError as exc: if exc.errno == errno.EEXIST and os.path.isdir(path): pass else: raise def download_all(): with open('pairs....
from pkg_resources import get_distribution, DistributionNotFound try: __version__ = get_distribution("django-rest-framework-simplejwt").version except DistributionNotFound: # package is not installed __version__ = None
#!/usr/bin/env python """Django's command-line utility for administrative tasks.""" import os import sys def main(): os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'lllorigins.settings') try: from django.core.management import execute_from_command_line except ImportError as exc: raise Imp...
#!/usr/bin/env python3 import os import socket from collections import namedtuple from enum import Enum, unique HeadTerm = namedtuple('HeadTerm', ['index', 'value']) @unique class Header(Enum): FILE_NAME = HeadTerm(index=0, value=0x80) FILE_SIZE = HeadTerm(index=0, value=0x40) FILE_CONTEXT = HeadTerm(in...
#!/usr/bin/env python3 # Copyright (c) 2015-2016 The Bitcoin Core developers # Copyright (c) 2017-2018 The Placeholder Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test node responses to invalid blocks. In th...
#!/usr/bin/env python """ collectPostOutputGSweep.py collect output from different runs & reps into single data structures to be used with the newer sweeps across gE, gI """ import sys import os import numpy as np import scipy.io import matplotlib.pyplot as plt import progressbar import pandas as pd #### config here...
# -*- coding: utf-8 -*- """ Created on Mon Dec 6 19:54:52 2021 @author: Alex """ import os #sistema operativo import pandas as pd #gestionar datframes import numpy as np #numeric python (vectores, matrices,...) import matplotlib.py...
f = open('d04.in', 'r') def calculateScore(card, number): for i in range(5): if sum(card[i::5]) == -5 or sum(card[i*5:i*5+5]) == -5: return sum([x for x in card if x != -1]) * number return -1 def calculateFinalScore(cards, number): for card in cards: score = calculateScore(ca...
# Copyright (c) 2020 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 appli...
# -*- coding: utf-8 -*- """ Created on Wed Mar 27 18:06:08 2013 @author: proto """ from pytagcloud import create_tag_image, make_tags from pytagcloud.lang.counter import get_tag_counts def cloudText(text,fileName): tags = make_tags(get_tag_counts(text), maxsize=80) create_tag_image(tags, fileName, size=(800,...
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from .. import...
import numpy as np import cv2 import os window_title = "The Input Image" input_image = "input.jpg" output_image = os.path.basename(__file__)[:-len(".py")] + ".jpg" HORIZONTAL = 0 VERTICAL = 1 def read_image(file_name = input_image): img = cv2.imread(file_name) return img def display_image(img,window_title = w...
def metade(num): return num/2 def dobro(num): return num*2 def aumentar(num, perc): perc /= 100 return num + num*perc def diminuir(num, perc): perc /= 100 return num - num*perc
# BSD 3-Clause License; see https://github.com/scikit-hep/uproot4/blob/master/LICENSE from __future__ import absolute_import import sys import json try: from io import StringIO except ImportError: from StringIO import StringIO import numpy import pytest import skhep_testdata import uproot4 import uproot4.i...
import os import sys BASE_DIR = os.getcwd() sys.path.append(BASE_DIR) from helper import random, diff import unittest class TestHelper(unittest.TestCase): def test_random(self): for l in [1, 2, 5, 10, 100]: a = random.randints(0, 1, l) self.assertEqual(len(a), l, "Not returning co...
#!/usr/bin/env python # coding: utf-8 """ The Clear BSD License Copyright (c) – 2016, NetApp, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are met...
_base_ = 'ranksort_cascade_rcnn_r50_fpn_1x_coco.py' model = dict(rpn_head=dict(head_weight=0.60)) optimizer = dict(type='SGD', lr=0.004, momentum=0.9, weight_decay=0.0001)
# -*- coding: utf-8 -*- """ Created on Wed Jul 22 15:56:47 2020 @author: Saksham """ import numpy as np import keras import keras.backend as k from keras.layers import Conv2D,MaxPooling2D,SpatialDropout2D,Flatten,Dropout,Dense from keras.models import Sequential,load_model from keras.optimizers import adam from kera...
import unittest from typing import List from is_valid_binary_search_tree import Solution, TreeNode class TestSolution(unittest.TestCase): def setUp(self): pass def tearDown(self): pass def test_isValidBST_when_tree_has_single_node_should_return_true(self): ...
# coding: utf-8 # In[1]: import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns get_ipython().run_line_magic('matplotlib', 'inline') # In[2]: dataset = pd.read_csv('Churn_Modelling.csv') dataset.head() # In[3]: X = dataset.iloc[:,3:13].values # In[4]: y = dataset.il...
# 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...
# config.py DATABASE_CONFIG = { 'dialect': 'mysql+mysqlconnector', 'host': 'localhost', 'database': 'database', 'user': 'user', 'password': 'password', 'port': 3306 }
from typing import List, NoReturn from random import randint def return_rarray(_min=1, _max=10, size=5, duplicates=False) -> List[int]: """ Returns array of random elements [x0, x1, ..., xn] for each element in the range (_min >= x >= _max). Where the number of elements equals parameter -> size. ...
# Copyright 2016 Google 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 by applicable law or ag...
# -*- coding: utf-8 -*- import re import logging import time from datetime import datetime, timedelta import requests import bleach import dateutil.parser import pytz import requests_cache from django.utils.html import strip_tags from events.models import ( DataSource, Event, Keyword, Place ) from dja...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ In this problem set you work with cities infobox data, audit it, come up with a cleaning idea and then clean it up. In the previous quiz you recognized that the "name" value can be an array (or list in Python terms). It would make it easier to process and query the dat...
import time from celery import chain, chord from celery.utils.log import get_task_logger from materializationengine.celery_init import celery from materializationengine.shared_tasks import fin celery_logger = get_task_logger(__name__) @celery.task(name="process:start_test_workflow") def start_test_workflow(iterator...
class PiggyBank: # create __init__ and add_money methods def __init__(self, dollars, cents): self.dollars = dollars self.cents = cents def add_money(self, deposit_dollars, deposit_cents): self.dollars += deposit_dollars self.cents += deposit_cents if self.cents >= 10...
"""bam2wiggle.py - convert bam to wig/bigwig file ============================================== :Tags: Genomics NGS Intervals Conversion BAM WIGGLE BIGWIG BEDGRAPH Purpose ------- convert a bam file to a bigwig or bedgraph file. Depending on options chosen, this script either computes the densities itself or makes...
#!/usr/bin/env python # # Copyright (c) 2012 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. """Runs all the native unit tests. 1. Copy over test binary to /data/local on device. 2. Resources: chrome/unit_tests requires r...
# SPDX-License-Identifier: (Apache-2.0 OR MIT) import datetime import sys import unittest import pytest import pytz from dateutil import tz import orjson try: import pendulum except ImportError: pendulum = None # type: ignore if sys.version_info >= (3, 9): import zoneinfo class DatetimeTests(unittes...
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). import os import shutil import tempfile import unittest from pants.reporting.linkify import linkify def ensure_dir_exists(path): os.makedirs(path) def ensure_file_exists(path): ...
import unittest from .context import BasicEndpointTestSuite class EndPointScoring(BasicEndpointTestSuite): def test_dice(self): response = self.client.post("/scoring/dice?run_sync=true") assert response.status_code == 200 def test_sum(self): response = self.client.post("/scoring/sum?...
import numpy as np class Deriv: """ Calculate the derivative with given order of the function f(t) at point t. """ def __init__(self, f, dt, o=1): """ Initialize the differentiation solver. Params: - f the name of the function object ('def f(t):...') ...
from django.core.cache import cache def set_cache(user_no, token): cache.set('token:userno:' + user_no, token, timeout=None) cache.set('token:value:'+ token, user_no, timeout=None) def get_token_from_cache(user_no): try: token = cache.get('token:userno:' + user_no) except: tok...
from typing import List, Optional from .constants import HEADER_LENGTH, VALID_HEADER_TYPES_FESL, VALID_HEADER_TYPES_THEATER, \ VALID_HEADER_ERROR_INDICATORS, HEADER_BYTE_ORDER from .exceptions import Error class Packet: header: bytes body: bytes def __init__(self, header: bytes = b'', body: bytes = ...
""" Tests for FlowJo 10 workspace files """ import copy import unittest import os from io import BytesIO import numpy as np from flowkit import Session, gates, transforms from .session_tests import test_samples_8c_full_set class FlowJoWSPTestCase(unittest.TestCase): def test_load_wsp_single_poly(self): ws...