text
stringlengths
2
999k
# Copyright 2016 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 applicable ...
from allauth.account.signals import user_signed_up from django.dispatch import receiver from io import BytesIO from urllib.request import urlopen from django.core.files import File @receiver(user_signed_up) def user_signed_up(request, user, **kwargs): if len(user.socialaccount_set.all()) > 0: social_accou...
# # 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 us...
from operator import itemgetter from django.conf import settings from django.db import transaction from django.contrib.auth.models import User from django.db import models from django.db.models import signals, Q from django.db.models.functions import Lower from django.contrib.contenttypes.models import Content...
import fresh_tomatoes import media # instances of my favorite movies batman = media.Movie("Batman", "A heroic genius who fights for justice. He's also rich.", "https://upload.wikimedia.org/wikipedia" "/en/a/af/Batman_Begins_Poster.jpg", ...
from being.models import newuser, getuserbyname from topics.models import Genre, Topic, newvote from talks.models import Talk from datetime import datetime import random, traceback def initialize(): # init user admin = 'cacate' if not getuserbyname(admin): user = newuser(truename=admin, password='l...
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.response.AlipayResponse import AlipayResponse class KoubeiCateringOrderPayApplyResponse(AlipayResponse): def __init__(self): super(KoubeiCateringOrderPayApplyResponse, self).__init__() self._out_pay_no = None s...
# Demo for Network wrapper to implement Binary Logistic Regression import numpy as np from TinyFlow.Network import Network from TinyFlow.Datasets import spiral_data from TinyFlow.Layers import Layer_Dense from TinyFlow.Activations import Activation_Sigmoid, Activation_ReLU from TinyFlow.Optimizers import Optimizer_Adam...
"""Provides device automations for Cover.""" from __future__ import annotations from typing import Any import voluptuous as vol from homeassistant.components.automation import ( AutomationActionType, AutomationTriggerInfo, ) from homeassistant.components.device_automation import DEVICE_TRIGGER_BASE_SCHEMA fr...
# Test tools API. import json import os from base import api from base import rules_test_data from base.populators import ( DatasetCollectionPopulator, DatasetPopulator, LibraryPopulator, load_data_dict, skip_without_tool, ) class ToolsTestCase(api.ApiTestCase): def setUp(self): supe...
import io import unittest from contextlib import redirect_stdout from unittest.mock import patch class TestQ(unittest.TestCase): @patch('builtins.input', return_value='saurabh') def test_case_0(self, input_mock=None): text_trap = io.StringIO() with redirect_stdout(text_trap): impor...
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import itertools import math import torch from torch.distributions import constraints from torch.distributions.utils import lazy_property from pyro.distributions.torch_distribution import TorchDistribution class SpanningTree(To...
import json # import requests def lambda_handler(event, context): """Sample pure Lambda function Parameters ---------- event: dict, required API Gateway Lambda Proxy Input Format Event doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations...
import copy import json import cassiopeia as cass import pandas as pd from IPython.display import clear_output from roleidentification import get_roles, pull_data NUMBER_OF_LINES = 108941 champion_roles = pull_data() champions_mapper = {champion.id: champion.name for champion in cass.get_champions("EUW")} summoners ...
import json import logging import os import workflow_manager from workflow_manager_analysis import AnalysisWorkflowManager from threading import Thread from django import forms from django.http import HttpResponse, QueryDict, JsonResponse from django.views.decorators.http import require_http_methods, require_POST, req...
# 循环旋转(将func反复应用于x的移位版本) import skimage.data from skimage import img_as_float, io import numpy as np from skimage.restoration import denoise_wavelet, cycle_spin img = img_as_float(skimage.data.camera()) sigma = 0.1 img = img + sigma * np.random.standard_normal(img.shape) denoised = cycle_spin(img, func=denoise_wavelet,...
#!/usr/bin/env python3 # # Copyright (c) 2014-present, Facebook, Inc. # # 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 sys from builtins import obje...
from unittest import TestCase def setUpModule(): from . import testing testing.setup_django() class FTPAccountAuthorizerTestBase(TestCase): def _getUser(self, **kwargs): from django.contrib.auth import models return models.User(**kwargs) def _getGroup(self, **kwargs): from d...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import h5py import numpy as np from PIL import Image, ImageDraw import os import argparse from util import log from vqa_util import * import progressbar from base64 import decode import tensorflow as tf import...
# Copyright 2011 VMware, 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 ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Faire du bruit avec Numpy """ from pyo import * import numpy as np s = Server().boot() # récupère la taille du buffer bs = s.getBufferSize() # Crée une table de la longueur du buffer et la lit en boucle t = DataTable(size=bs) osc = TableRead(t, freq=t.getRate(), loo...
from pytest import mark # type: ignore from messages import show_count @mark.parametrize('qty, expected', [ (1, '1 part'), (2, '2 parts'), (0, 'no part'), ]) def test_show_count(qty, expected): got = show_count(qty, 'part') assert got == expected # tag::TEST_IRREGULAR[] @mark.parametrize('qty,...
#The MIT License (MIT) #Copyright (c) 2014 Microsoft Corporation #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, mod...
"""pybb URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-based...
"""Initial conditions and boundary conditions.""" __all__ = [ "BC", "DirichletBC", "NeumannBC", "RobinBC", "PeriodicBC", "OperatorBC", "PointSetBC", "IC", ] from .boundary_conditions import ( BC, DirichletBC, NeumannBC, RobinBC, PeriodicBC, OperatorBC, Point...
__author__ = 'odsum'
#!/usr/bin/env python3 import argparse import os import subprocess import sys def setup(): global args, workdir programs = ['ruby', 'git', 'apt-cacher-ng', 'make', 'wget'] if args.kvm: programs += ['python-vm-builder', 'qemu-kvm', 'qemu-utils'] elif args.docker: dockers = ['docker.io',...
import asyncio from contextlib import suppress from dataclasses import dataclass from typing import ( Any, AsyncGenerator, Callable, List, Optional, Sequence, Union, ) import pytest from arq import ArqRedis, Worker from arq.constants import job_key_prefix from arq.jobs import Job from arq.typing import WorkerCorou...
from typing import List, Dict from oauth2client.service_account import ServiceAccountCredentials def load_credentials(scopes: List[str], credentials: Dict[str, str]) -> ServiceAccountCredentials: """ Load credentials for authorization to GoogleServices :param scopes: Available scopes :param credentia...
#Make a program that calculate the growth of a salary.It must request the value of the salary and the percentage of the growth.Show the value of the growth and of the new salary salary=float(input("Insert your salary: ")) growth=float(input("Insert the Growth in porcentage: ")) nsalary=salary*((growth/100)+1) print(f"Y...
# Copyright 2014 Diamond Light Source 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 law or agreed t...
# -*- coding: utf-8 -*- # # 检测人脸 import face_recognition import cv2 import pickle from pick_class import Info #face_locations = face_recognition.face_locations(img) #Returns::A list of tuples of found face locations in css (top, right, bottom, left) order #Given an image, return the 128-dimension face encoding for each...
# GNU MediaGoblin -- federated, autonomous media hosting # Copyright (C) 2013 MediaGoblin contributors. See AUTHORS. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of...
# 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...
import tcod from components.message import Message class Inventory: def __init__(self, capacity): self.capacity = capacity self.items = [] def add_item(self, item): results = [] if len(self.items) >= self.capacity: results.append({ 'item_added': N...
# Definition for an interval. # class Interval(object): # def __init__(self, s=0, e=0): # self.start = s # self.end = e class Solution(object): def merge(self, intervals): """ :type intervals: List[Interval] :rtype: List[Interval] """ ans = [] for intv in sorted(intervals,...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import inspect import os import sys from setuptools import find_packages, setup from setuptools.command.test import test as TestCommand __location__ = os.path.join(os.getcwd(), os.path.dirname(inspect.getfile(inspect.currentframe()))) def read_version(package): wi...
from unicodedata import name from django.urls import path, include from rest_framework.routers import DefaultRouter from administration import views router = DefaultRouter() router.register('progress', views.ProgressViewSet) router.register('course', views.CourseViewSet) router.register('examination', views.Examinatio...
# # Copyright (C) 2014 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...
""" Django settings for bookmarks project. Generated by 'django-admin startproject' using Django 3.0. For more information on this file, see https://docs.djangoproject.com/en/3.0/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/3.0/ref/settings/ """ import os #...
import random import app.calculator.assign as assign import app.calculator.filters as filters import app.calculator.tech_abilities as tech_abilities def bombard_roll(val, options, jolnar_commander): x = random.randint(1, 10) if options["def_bunker"]: x -= 4 if x >= val: return 1 # Jol...
#!/usr/bin/env python3 import sys import requests import warnings import hashlib import tarfile import pathlib import click import io from typing import Dict from collections import namedtuple from tqdm import tqdm if sys.version_info < (3, 9): import importlib_resources as resources else: import importlib.r...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import requests try: import cookielib except: import http.cookiejar as cookielib import re import time import os.path try: from PIL import Image except: pass # 构造 Request headers agent = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, lik...
#!/usr/bin/env python # # Copyright 2019 Espressif Systems (Shanghai) PTE 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 req...
#coding=utf-8 ''' Created on 2016-9-27 @author: dengdan ''' import matplotlib as mpl # mpl.use('Agg') mpl.use('TkAgg') import matplotlib.pyplot as plt import numpy as np import util def hist(x, title = None, normed = False, show = True, save = False, save_path = None, bin_count = 100,...
# -*- coding: utf-8 -*- # python-holidays # --------------- # A fast, efficient Python library for generating country, province and state # specific sets of holidays on the fly. It aims to make determining whether a # specific date is a holiday as fast and flexible as possible. # # Authors: dr-prodigy <maurizio....
from fluent_pages.models import Page from fluent_pages.models.navigation import PageNavigationNode from fluent_pages.tests.utils import AppTestCase from fluent_pages.tests.testapp.models import SimpleTextPage class MenuTests(AppTestCase): """ Tests for URL resolving. """ root_url = '/' subpage1_ur...
from __future__ import absolute_import from __future__ import print_function import os import sys import copy import veriloggen.core.vtypes as vtypes class RenameVisitor(object): def __init__(self, prefix=None, postfix=None, rename_exclude=None): self.prefix = prefix if prefix is not N...
#!/usr/bin/env python3.8 # Copyright 2020 The Fuchsia Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Unit test for verify_zbi_kernel_cmdline.py. Need to have SCRUTINY and ZBI environmental variables set. To manually run this test:...
# Coded By Gowtham on 30/05/2020 # Coded Using Vim Text Editor from flask import Flask, request, jsonify from DailyHunt import getNews from flask_cors import CORS app = Flask(__name__) app.secret_key = "I_am_Marvelous (^_^)" CORS(app) @app.route('/') def home(): return 'News API is UP!<br><br>A part of <a href=...
import jieba # 使用jieba进行分词 def Rouge_1(model, reference): # terms_reference为参考摘要,terms_model为候选摘要 ***one-gram*** 一元模型 terms_reference = jieba.cut(reference) # 默认精准模式 terms_model = jieba.cut(model) grams_reference = list(terms_reference) grams_model = list(terms_model) temp = 0 ngram_all = ...
# coding: utf-8 """ pollination-server Pollination Server OpenAPI Definition # noqa: E501 The version of the OpenAPI document: 0.16.0 Contact: info@pollination.cloud Generated by: https://openapi-generator.tech """ import pprint import re # noqa: F401 import six from pollination_sdk.configu...
# Copyright 2020 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 a...
# pylint: disable = C0103, C0111, C0301, R0913, R0903, R0914, E1101 from __future__ import division import numpy as np from scipy import mgrid, ndimage, signal import tensorflow as tf import cvxpy import cv2 import im_rotate def get_gaussian_filter(radius, size): x, y = mgrid[-(size-1)/2:size/2, -(size-1)/2:si...
import dataclasses from chives.types.blockchain_format.sized_bytes import bytes32 from chives.util.byte_types import hexstr_to_bytes from chives.util.ints import uint8, uint32, uint64, uint128 @dataclasses.dataclass(frozen=True) class ConsensusConstants: SLOT_BLOCKS_TARGET: uint32 # How many blocks to target pe...
# -*- coding: utf-8 -*- import torch.nn.functional as F import numpy as np from Mnn_Core import fast_dawson import matplotlib.pyplot as plt import palettable class Param_Container: """ args: _vol_rest: the rest voltage of a neuron _vol_th: the fire threshold of a neuron _t_ref: the ref...
#!/usr/bin/env python # coding=utf-8 """ __created__ = '6/9/15' __author__ = 'deling.ma' """ import os from django.shortcuts import redirect from django.views.generic import FormView, ListView, TemplateView from django.contrib import auth, messages from django.core.urlresolvers import reverse from django.shortcuts imp...
from sus.networking import Network from sus.engines.base_engine import Parser, Publication, BadUrlException from sus.logger import Logger from lxml import html, etree import datetime import json import pytz utc = pytz.UTC log = Logger('reddit') class Reddit(Parser): """ A class used to parse publications fr...
from django.shortcuts import render from django.http import HttpResponse from django.template import loader from django.contrib.auth import get_user_model User = get_user_model() #def login_reg_view(request): # #template = loader.get_template('login_register/templates/test.html') # return render(request, 'login...
import typer from . import __version__ from .install import _install, _uninstall, is_installed from .stripout import list_dotenv_file_paths, strip_file, strip_stdin cli = typer.Typer(help="Strip secrets from all .env files in the current repo") @cli.callback(invoke_without_command=True) def main( ctx: typer.Con...
"""Create secure (secret-shared) types for finite groups. This module provides methods and classes to construct secure groups from finite groups. Operators are inherited from non-secure finite groups and then overloaded via secure group constructors. SecureGroup() is the main entrypoint and exposes an optional s...
# Copyright (c) Facebook, Inc. and its affiliates. import logging import os import warnings from enum import Enum from typing import Any, Dict, List, Optional, Tuple, Union import mmf import pytorch_lightning as pl import torch from mmf.common.meter import Meter from mmf.common.registry import registry from mmf.datas...
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals from efc.rpn_builder.parser.parser import Parser
import sys def solution(R): m, n = len(R), len(R[0]) gamma = sum(1 << n-i for i, col in enumerate(zip(*R), 1) if sum(col) > m//2) epsilon = (1 << n) + ~gamma return gamma * epsilon print(solution([tuple(map(int, s.strip())) for s in sys.stdin.readlines()]))
import ast from pypytranspy.transformations.base_transformer import BaseTransformer from pypytranspy.transformations.utils import replace_node_field class RemoveAnnotationsTransformer(BaseTransformer): minimum_version = [3] def pre_arg(self): """ Remove annotations from function's arguments ...
#!/usr/bin/env python ''' Observing a set of passes ================================ ''' import pathlib from tabulate import tabulate import numpy as np import matplotlib.pyplot as plt import sorts eiscat3d = sorts.radars.eiscat3d from sorts.controller import Tracker from sorts.scheduler import StaticList, ObservedP...
from setuptools import find_packages from setuptools import setup package_name = 'ament_uncrustify' setup( name=package_name, version='0.11.3', packages=find_packages(exclude=['test']), data_files=[ ('share/' + package_name, ['package.xml']), ('share/ament_index/resource_index/packages...
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 import boto3 import botocore import os import logging import time import json import datetime log = logging.getLogger() log.setLevel('INFO') bucket = os.environ['BUCKET'] region = os.environ['AWS_REGION'] solu...
import dns.edns import dns.message import dns.query # This example demonstrates how to use the EDNS client subnet option ADDRESS = '0.0.0.0' # replace this with the address you want to check PREFIX = 0 # replace this with a prefix length (typically 24 for IPv4) ecs = dns.edns.ECSOption(ADDRESS, PREFIX) q = dns.me...
# Sarus # # Copyright (c) 2018-2021, ETH Zurich. All rights reserved. # # Please, refer to the LICENSE file in the root directory. # SPDX-License-Identifier: BSD-3-Clause import unittest import subprocess import os import sys import shutil import json import common.util as util class TestSiteMounts(unittest.TestCas...
""" ASGI config for rinex_webservice project. It exposes the ASGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/ """ import os from django.core.asgi import get_asgi_application os.environ.setdefault('DJA...
#!/usr/bin/python # This script is used to generate luabinding glue codes. # Android ndk version must be ndk-r9b. import sys import os, os.path import shutil import ConfigParser import subprocess import re from contextlib import contextmanager def _check_ndk_root_env(): ''' Checking the environment NDK_ROOT, w...
import _plotly_utils.basevalidators class FormatValidator(_plotly_utils.basevalidators.DataArrayValidator): def __init__(self, plotly_name="format", parent_name="table.header", **kwargs): super(FormatValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, ...
import configparser import json import os import tempfile import shutil import subprocess import time import dateutil import dateutil.parser import urllib.parse import string import random import socket import zipfile from submitty_utils import dateutils from . import insert_database_version_data, autograding_utils, ...
import furl import logging from django.utils import timezone from modularodm import Q from modularodm.exceptions import NoResultsFound, QueryException, ImproperConfigurationError from website import mails from website.models import PreprintProvider from website.settings import DOMAIN, CAMPAIGN_REFRESH_THRESHOLD from ...
"""book URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.2/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based vi...
"""Define two dimensional geometric entities.""" __author__ = "Daniel Ching, Doga Gursoy" __copyright__ = "Copyright (c) 2016, UChicago Argonne, LLC." __docformat__ = 'restructuredtext en' __all__ = [ 'Curve', 'Circle', 'Polygon', 'RegularPolygon', 'Triangle', 'Rectangle', 'Square', 'Me...
# -*- coding: utf-8 -*- """ demeter web page name:work.py author:rabin """ from .__load__ import * class index_path(Load): #权限控制,需要在Load类中自行做判断 #@Web.auth #异步加载,增加执行效率 @Web.setting def get(self): self.view("index.html") # 测试数据库 查询 /main/select class select_path(Load): @Web.settin...
import matplotlib as mpl mpl.use('Qt5Agg') import matplotlib.pyplot as plt import pandas as pd from math import log, exp import numpy as np from matplotlib.ticker import MultipleLocator, FormatStrFormatter plt.rcParams.update({'font.size': 16}) def decay(half_life, curr_nuclii, max_time, timestep, current_time, orig...
# Copyright (c) 2021 Xiaomi Corporation (authors: Guo Liyong) # Apache 2.0 from typing import List, Union from pathlib import Path import k2 import sentencepiece as spm Pathlike = Union[str, Path] class Numericalizer(object): def __init__(self, tokenizer, tokens_list): super().__init__() self...
# @ Copyright Inria, Ecole Polytechnique # Shared under the MIT license https://opensource.org/licenses/mit-license.php # This file contains all the functions that are used in the comparison/aggregation detection # The main part of the code is the function find_aggregators, that will be used elsewhere in the code # ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2019 The FATE 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/l...
import uuid from typing import Dict, List, Optional, Union import great_expectations.exceptions as ge_exceptions from great_expectations import DataContext from great_expectations.core import ExpectationConfiguration, ExpectationSuite from great_expectations.data_context.util import instantiate_class_from_config from ...
from allauth.socialaccount.providers.oauth.urls import default_urlpatterns from .provider import EvernoteProvider urlpatterns = default_urlpatterns(EvernoteProvider)
#!/usr/bin/env python3 # Copyright (c) 2017-2018 The Vpub Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. import time from test_framework.test_vpub import VpubTestFramework from test_framework.util import connect_...
#!/usr/bin/python from scipy.optimize import * from scipy.integrate import * import distributions import mytime ln = distributions.LogNormal (0, 1) N = 100000 tmr = mytime.timeit() for i in xrange(N): root = brenth (ln.dx_lpdf, 0.1, 25) print "root was %.10f" % root elapsed = tmr.total("Time for %d root-fi...
# -*- coding: utf-8 -*- """ ------ What is this file? ------ This test module contains some data quality tests for the review_sentences_cleaned.csv file. The file can be found at: ../../data/cleaned/review_sentences_cleaned.csv """ #%% --- Import required packages --- import os from pathlib import Path # To wrap...
# -*- coding: utf-8 -*- # Copyright 2013-2021 CERN # # 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...
#!/usr/bin/env python from PyQt5 import QtCore, QtWidgets import pyqtgraph as pg import numpy as np class MyWidget(pg.GraphicsWindow): def __init__(self, parent=None): super().__init__(parent=parent) self.mainLayout = QtWidgets.QVBoxLayout() self.setLayout(self.mainLayout) self...
#!/usr/bin/env python import json import logging import threading import time from usblib import device_from_fd from usblib import shell_usbdevice from usblib import CP210xSerial LOGGER = logging.getLogger(__name__) # ---------------------------------------------------------------------------- def main(fd, debu...
import gym import os import numpy as np import lanro import argparse import glfw DEBUG = int("DEBUG" in os.environ and os.environ["DEBUG"]) def parse_args(): parser = argparse.ArgumentParser() parser.add_argument('-i', '--interactive', action='store_true', dest='interactive', help='Start interactive mode') ...
# Copyright 2018 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...
# !/usr/bin/env python # # # Author : # Date: May 19 2018 # About: from unittest.mock import inplace ''' https://www.dataquest.io/blog/k-nearest-neighbors-in-python/ https://stackoverflow.com/questions/29530232/python-pandas-check-if-any-value-is-nan-in-dataframe https://stackoverflow.com/questions/40393663/how-do...
import os from typing import Optional, Sequence from csr.tabular_file_reader import TabularFileReader from sources2csr.ngs import NGS, LibraryStrategy from sources2csr.ngs_reader import NgsReader, ReaderException class NgsMafReader(NgsReader): """ Mutation data reader. Parses NGS files in the MAF format....
from fastapi import FastAPI, HTTPException, File, UploadFile, BackgroundTasks from fastapi.responses import FileResponse, HTMLResponse from typing import Optional from drive.drive import PostFile, GetFileList, GetFile import glob import os app = FastAPI() # Cleans up tmp files from the filesystem def cleanup(): ...
x = 10 if x < 10: print "x is less than 10." elif x < 20: print "x is less than 20." else: print "x is greater than or equal to 20."
datos=[ {'x0': 105.47995780800001, 'x1': 291.4442955092628, 'y0': 621.537231385008, 'y1': 641.06314357464,}, ] control={'x0': 100, 'x1': 500, 'y0': 621.537231385008, 'y1': 641.06314357464, } for dato in datos: print (dato) if dato['x0']>=control['x0'] and dato['x1']<=con...
import json import logging from django.core.management.base import BaseCommand from django.db import transaction from osf.models import AbstractProvider, PreprintProvider, Preprint, Subject from osf.models.provider import rules_to_subjects from scripts import utils as script_utils from osf.models.validators import va...
def rename_groups( adata, key_added, restrict_key, restrict_categories, restrict_indices, groups ): key_added = restrict_key + '_R' if key_added is None else key_added all_groups = adata.obs[restrict_key].astype('U') prefix = '-'.join(restrict_categories) + ',' new_groups = [prefix + g for g in grou...
#!/usr/bin/env python # -*- coding:utf-8 -*- # author:owefsad # datetime:2020/11/30 下午3:13 # software: PyCharm # project: lingzhi-webapi import base64 import logging import time from dongtai.models.agent import IastAgent from dongtai.models.project import IastProject from dongtai.models.project_version import IastProj...