text
stringlengths
1
927k
# Define here the models for your spider middleware # # See documentation in: # https://docs.scrapy.org/en/latest/topics/spider-middleware.html from scrapy import signals # useful for handling different item types with a single interface from itemadapter import is_item, ItemAdapter class ScrapercatalogoucSpiderMidd...
# Copyright (C) 2014 Christine Dodrill <xena@yolo-swag.com> All rights reserved. # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any damages # arising from the use of this software. # # Permission is granted to anyone to use this software...
#!/usr/bin/env python # Copyright (c) 2013-2016 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...
# Lint as: python3 # Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
#=============================================================================== # Copyright 2009 Matt Chaput # # 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/li...
import json import os import numpy as np from plyfile import PlyData # matrix: 4x4 np array # points Nx3 np array def transform_points(matrix, points): assert len(points.shape) == 2 and points.shape[1] == 3 num_points = points.shape[0] p = np.concatenate([points, np.ones((num_points, 1))], axis=1) p ...
# Copyright 2013-2020 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 * class Libxfontcache(AutotoolsPackage): """Xfontcache - X-TrueType font cache extension client li...
arr: list = list() for i in range(int(input())*2): arr.append(int(input())) left_sum: int = sum(arr[:int(len(arr)/2)]) right_sum: int = sum(arr[int(len(arr)/2):]) print(f'Yes, sum = {left_sum}' if left_sum == right_sum else f'No, diff = {abs(left_sum - right_sum)}')
# -*- coding: utf-8 -*- """ Created on Mon Aug 26 22:12:16 2019 @author: vince """ from pykep import planet, DEG2RAD, epoch, AU from Math import sqrt, PI from _Kerbol_System import Moho, Eve, Kerbin, Duna, Jool KAU = 13599840256 #m def plot_innerKerbol(epoch = epoch(0)): """ Plots the Galilean Moons...
""" Copyright 2013 Steven Diamond 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...
# coding=utf-8 r""" This code was generated by \ / _ _ _| _ _ | (_)\/(_)(_|\/| |(/_ v1.0.0 / / """ from twilio.base.domain import Domain from twilio.rest.messaging.v1 import V1 class Messaging(Domain): def __init__(self, twilio): """ Initialize the Messaging Domain ...
import responses from gitjoke.extractor import get_joke, get_jokes def stub_request(): def request_callback(request): body = 'foo\nbar\n' return (200, {}, body) url = 'https://raw.githubusercontent.com/EugeneKay/git-jokes/lulz/Jokes.txt' # noqa: E501 responses.add_callback(responses.GET...
# Copyright (c) 2019 - The Procedural Generation for Gazebo authors # For information on the respective copyright owner see the NOTICE file # # 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 # #...
# -*- coding: utf-8 -*- from setuptools import setup, find_packages setup(name='sdg', version='0.2.0', description='Build SDG data and metadata into output formats', url='https://github.com/ONSdigital/sdg-build', author='Doug Ashton', author_email='douglas.j.ashton@gmail.com', lice...
from datetime import datetime from django.db import models from django.utils.translation import ugettext_lazy as _ from publisher import Publisher from django.conf import settings from cms.models.managers import TitleManager from cms.models.pagemodel import Page from cms.utils.helpers import reversion_register class T...
stack = [] stack.append(5) # ์‚ฝ์ž…() stack.append(2) stack.append(3) stack.append(7) stack.pop() # ์‚ญ์ œ() / ๊ฐ€์žฅ ๋งˆ์ง€๋ง‰์— ๋“ค์–ด์˜จ ์ž๋ฃŒ๊ฐ€ ์‚ญ์ œ print(stack[::-1]) # ์ตœ์ƒ๋‹จ ์›์†Œ๋ถ€ํ„ฐ ์ถœ๋ ฅ print(stack) # ์ตœํ•˜๋‹จ ์›์†Œ๋ถ€ํ„ฐ ์ถœ๋ ฅ
from PIL import Image from PIL import ImageGrab import numpy as np from sklearn_decoder import ImgRecognizer import win32api, win32con import time import debug_utils as dbg import simple_solver import cProfile import pstats # excelent hardcoded values :) #board_box = (102, 90, 389, 650) #board_size_x = 4 board_box = (...
import csv import os import random import torch from PIL import Image, ImageOps from torch.utils.data import Dataset from torch.utils.data import DataLoader import cv2 import numpy as np START = "<SOS>" END = "<EOS>" PAD = "<PAD>" SPECIAL_TOKENS = [START, END, PAD] # Rather ignorant way to encode the truth, but at ...
#!/usr/bin/env python3 # NeoPixel library strandtest example # Author: Tony DiCola (tony@tonydicola.com) # # Direct port of the Arduino NeoPixel library strandtest example. Showcases # various animations on a strip of NeoPixels. import time from neopixel import * import argparse # LED strip configuration: LED_COUNT ...
from .index_page import DrawIndexPage
#!/usr/bin/env python3 # coding: utf-8 # Copyright 2019 Huawei Technologies Co., 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 ...
import abc import logging import os import shutil import urllib from collections import namedtuple from typing import List, IO, Tuple import ray from ray.ray_constants import DEFAULT_OBJECT_PREFIX from ray._raylet import ObjectRef ParsedURL = namedtuple("ParsedURL", "base_url, offset, size") logger = logging.getLogge...
""" Discord API Wrapper ~~~~~~~~~~~~~~~~~~~ Unofficial copy of a Python wrapper for the Discord API(Original by Rapptz) :copyright: (c) 2021-present discord-pyc :license: MIT, see LICENSE for more details. """ __title__ = "discord" __author__ = "discord-pyc" __license__ = "MIT" __copyright__ = "Copyright 2021-prese...
def rungekutta5(x1, x2, y0, h): """ Runge-Kutta 5th (higher order) method to solve ODE at domain x [x1,x2] x1: the lowest x in domain x2: the upper x in domain y0: y at initial condition (x0 = 0) h: stepsize """ # initial condition y = y0 # time array from timesteps x = np.arange(x1, x2+h, h...
import numpy as np import nibabel as nib from nilearn.image import new_img_like, resample_to_img import random import itertools from scipy.ndimage import affine_transform from math import pi from transforms3d import affines, euler def scale_image(image, scale_factor): scale_factor = np.asarray(scale_factor) n...
import pytest from barista.models import Match def test_both_trigger_and_triggers(): with pytest.raises(ValueError): Match.parse_obj( { "replace": "asd", "trigger": "asd", "triggers": ["asd", "abc"], } ) def test_neither_tr...
"""Tests for the Elgato Key Light integration.""" import aiohttp from homeassistant.components.elgato.const import DOMAIN from homeassistant.config_entries import ConfigEntryState from homeassistant.core import HomeAssistant from tests.components.elgato import init_integration from tests.test_util.aiohttp import Aioh...
import datetime import unittest from nose.tools import * # flake8: noqa from website.util import sanitize class TestSanitize(unittest.TestCase): def test_escape_html(self): assert_equal( sanitize.clean_tag('<script> evil code </script>'), '&lt;script&gt; evil code &lt;/script&gt;'...
# -*- coding:utf-8 -*- """ Bitmex ๆจกๅ—ไฝฟ็”จๆผ”็คบ > ็ญ–็•ฅๆ‰ง่กŒ็š„ๅ‡ ไธชๆญฅ้ชค: 1. ๅœจๅฝ“ๅ‰็›˜ๅฃไปทๅทฎ10็พŽ้‡‘็š„ไฝ็ฝฎ๏ผŒๆŒ‚ไธ€ไธชไนฐๅ…ฅ10ๆ‰‹็š„ๅง”ๆ‰˜ๅ•๏ผŒๅณๅผ€ไป“ๅคงๅฐไธบ10๏ผ› 2. ๅง”ๆ‰˜ๅ•ๆˆๅŠŸๆˆไบคไน‹ๅŽ๏ผŒๅณๆŒๅคšไป“ๅคงๅฐ10๏ผ› 3. ็จ‹ๅบ่ฎพ็ฝฎ5ๅˆ†้’Ÿๅ€’่ฎกๆ—ถๅนณไป“๏ผŒๅณๅผ€ไป“5ๅˆ†้’ŸๅŽๅนณไป“(ไธบไบ†็ฎ€ๅ•ๆญคๅค„ๆŒ‰ๅธ‚ไปทๅนณไป“)๏ผ› 4. ๅนณไป“ๆˆๅŠŸไน‹ๅŽ๏ผŒ็จ‹ๅบ้€€ๅ‡บ๏ผ› """ import sys from quant import const from quant.utils import tools from quant.utils import logger from quant.config import c...
#! /usr/bin/env python """ Create files for ls unit test """ import nmrglue.fileio.pipe as pipe import nmrglue.process.pipe_proc as p d, a = pipe.read("time_complex.fid") d, a = p.ls(d, a, ls=2.0, sw=True) pipe.write("ls1.glue", d, a, overwrite=True) d, a = pipe.read("time_complex.fid") d, a = p.ls(d, a, ls=-3.0, sw...
#!/usr/bin/env python2 # Copyright (c) 2014-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. # Test mempool limiting together/eviction with the wallet from test_framework.test_framework import Sysc...
from classes.Despachante import * from classes.Sistema import * from classes.Processo import * from tkinter import * from tkinter import ttk from tkinter.filedialog import askopenfilename as fileChooser class EscDeProcessos: def __init__(self, master=None): #Tamanho da janela master.minsize(width=7...
import numpy as np from vis_utils.scene.components import ComponentBase class SimpleNavigationAgent(ComponentBase): def __init__(self, scene_object): ComponentBase.__init__(self, scene_object) self.controller = scene_object._components["morphablegraph_state_machine"] self.walk_targets = []...
from dataclasses import asdict, dataclass, field from datetime import date, datetime from typing import List, TypeVar, Union from uuid import UUID import ujson T = TypeVar("T") @dataclass class MetaState: exclude: List[str] = field(default_factory=list) class BaseModel: __state__: MetaState def __pos...
# -*- coding: utf-8 -*- # vim: ai ts=4 sts=4 et sw=4 encoding=utf-8 """ Message Parsing Template-specific Message Parsers are defined here. @copyright: 2013-2020 (c) Sahana Software Foundation @license: MIT Permission is hereby granted, free of charge, to any person obtaining a copy of this soft...
#!/usr/bin/env python import base64 import httplib import json import re import sys def find_next_path(resp): link = resp.getheader("Link") if link is not None: regex = re.compile(r'<https://scc.suse.com([^>]+)>; rel="next"') match = regex.search(link) if match is not None: return match.group(...
"""The shows app tests.""" from django.test import TestCase from .models import Band, Genre DJANGO_REINHARDT = { "nickname": "Django Reinhardt", "description": ( "Jean Reinhardt (23 January 1910 โ€“ 16 May 1953), known to all by his gypsy " "nickname Django (French: [dส’รฃล‹ษกo สษ›jnaสt] or [dส’ษ‘ฬƒษกo ...
""" ่พ“ๅ…ฅไธ€ไธช้“พ่กจ๏ผŒๅ่ฝฌ้“พ่กจๅŽ๏ผŒ่พ“ๅ‡บๆ–ฐ้“พ่กจ็š„่กจๅคดใ€‚ """ # -*- coding:utf-8 -*- # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: # ่ฟ”ๅ›žListNode def ReverseList(self, pHead): # write code here if not pHead: return None vals = [] # ๅนถ...
from dataclasses import dataclass from typing import List, Dict, Optional from dataclasses_json import DataClassJsonMixin class BaseModel(DataClassJsonMixin): def key(self): if hasattr(self, 'id'): return self.create_key(getattr(self, 'id')) return None @classmethod def creat...
# -*- coding: utf-8 -*- ## svgwrite: ## ## - [svgwrite 1.1.6 documentation](https://svgwrite.readthedocs.io/en/latest/#) ## - ... and: [svgwrite 1.1.8](https://bitbucket.org/mozman/svgwrite) ## - NOTE that the documentation is a bit behind the latest version, and pip / bitbucket aren't quite in sync -- pip links ...
############################################################################## # # A hello world spreadsheet using the XlsxWriter Python module. # # Copyright 2013-2018, John McNamara, jmcnamara@cpan.org # import xlsxwriter workbook = xlsxwriter.Workbook('hello_world.xlsx') worksheet = workbook.add_worksheet() worksh...
import typedBot as tB tB.newPage(130, 130) tB.font("Times") tB.text("ToTAVAT.", (10, 10)) tB.openTypeFeatures(kern=False) tB.text("ToTAVAT.", (10, 30)) tB.openTypeFeatures(kern=True) tB.text("ToTAVAT.", (10, 50)) # add tracking tB.tracking(10) tB.text("ToTAVAT.", (10, 70)) tB.openTypeFeatures(kern=False) tB.text("ToTAV...
# -*- coding: utf-8 -*- from __future__ import print_function, division, absolute_import import os from itertools import chain import json import sys import warnings import pytest from sympy.testing.runtests import setup_pprint, _get_doctest_blacklist durations_path = os.path.join(os.path.dirname(__file__), '.ci', '...
""" Copyright 2020 The OneFlow 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 law or agr...
import os import wandb from copy import deepcopy from src.systems import audio_systems from src.utils.utils import load_json from src.utils.setup import process_config import random, torch, numpy import pytorch_lightning as pl SYSTEM = { 'PretrainExpertInstDiscSystem': audio_systems.PretrainExpertInstDiscSystem, ...
import h5py import numpy as np from keras import layers from keras.layers import Input, Add, Dense, Activation, Flatten, Conv2D,MaxPooling2D, Dropout from keras.models import Model, load_model from keras.preprocessing import image from sklearn.metrics import confusion_matrix as cf def load_dataset(): """ Reads...
import pytest from mnamer.endpoints import ( tvdb_episodes_id, tvdb_login, tvdb_refresh_token, tvdb_search_series, tvdb_series_id, tvdb_series_id_episodes, tvdb_series_id_episodes_query, ) from mnamer.exceptions import MnamerException, MnamerNotFoundException from mnamer.providers import Tv...
# Automated Acceptance Test Platform # Date: 2020.11.4 # Author: Zhangjh # -*- coding: utf-8 -*- import time import unittest from selenium import webdriver from selenium.common.exceptions import NoAlertPresentException from selenium.common.exceptions import NoSuchElementException from selenium.webdriver.support.ui im...
from varappx.common import manage_dbs def user_factory(u): """Create a more useful User instance from a Django Users instance *u*. In particular, its 'databases' attribute stores all active database names he has access to, with a runtime check of the connection and physical presence. """ from varap...
""" user.py created by dromakin as 03.05.2021 Project app """ __author__ = 'dromakin' __maintainer__ = 'dromakin' __credits__ = ['dromakin', ] __status__ = 'Development' __version__ = '20210503' from typing import TYPE_CHECKING from sqlalchemy import Boolean, Column, Integer, String from sqlalchemy.orm import relat...
# Copyright 2019 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import annotations import logging import re from dataclasses import dataclass from enum import Enum from typing import Any, Iterable from pants.base.exiter import PANTS_F...
import arcade from arcade import Point, Vector from arcade.utils import _Vec2 # bring in "private" class import os import random import pyglet import imgui import imgui.core from imdemo.page import Page from imdemo.particle import AnimatedAlphaParticle SCREEN_WIDTH = 800 SCREEN_HEIGHT = 600 SCREEN_TITLE = "Particle...
# Copyright 2013 - Noorul Islam K M # # 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 w...
from znjson.converter.class_converter import ClassConverter from znjson.converter.pathlib_converter import PathlibConverter __all__ = ["PathlibConverter", "ClassConverter"] try: from znjson.converter.numpy_converter_base64 import NumpyConverter from znjson.converter.numpy_converter_latin1 import NumpyConverte...
import time import os from pdfminer.high_level import extract_pages from pdfminer.layout import LTTextContainer class extract_text_from_pdf: def __init__(self, pdf_file_name, target_file_name): """Extracts PDF file into text file. Args: file_name (string): PDF file name to extrat text...
class Eval_It(): eval_str = None def __init__(self, eval_str): self.eval_str = eval_str
from django.test import TestCase from django.contrib.auth.models import User from .models import Post class PostTestCase(TestCase): def setUp(self): user = User(username="test user", first_name='test', last_name='user', email='test@test.com', password='abc123') ...
import pickle import os import re import math from multiprocessing import Pool import sys def build_hp_rev(org): di=os.getcwd() file1=org org=ngi=0 dir1=di+"/../prep_hairpin/"+file1+'/reverse' org=org+1 #-------------$organism contain organism name for genomes folder and gene id--------------------------------...
import unittest import pytest import ray import ray.rllib.agents.ppo as ppo from ray.rllib.policy.sample_batch import DEFAULT_POLICY_ID from ray.rllib.utils.metrics.learner_info import LEARNER_INFO, \ LEARNER_STATS_KEY from ray.rllib.utils.test_utils import check, check_compute_single_action, \ check_train_res...
#!/usr/bin/env python # -*- coding: utf-8 -*- # import ## batteries import os import sys import pytest ## 3rd party import pandas as pd ## package from pyTecanFluent import Utils # data dir test_dir = os.path.join(os.path.dirname(__file__)) data_dir = os.path.join(test_dir, 'data') # tests def test_make_range(): ...
from HyperAPI.hdp_api.base.resource import Resource from HyperAPI.hdp_api.base.route import Route class AuxData(Resource): name = "auxdata" available_since = "3.0" removed_since = None class _getProjectAuxData(Route): name = "getProjectAuxData" httpMethod = Route.GET path = "/...
import copy import logging from collections.abc import Mapping from typing import Any, Dict, Generator, List, Optional, Tuple import numpy import random from ray.tune import TuneError from ray.tune.sample import (Categorical, Domain, Function, RandomState) logger = logging.getLogger(__name__) def generate_variants...
import getpass import os, sys sys.path[0:0] = os.path.join(os.path.dirname(__file__), "..") from dolt.apis import Twitter from httplib2 import Http if __name__ == "__main__": http = Http() username = raw_input("Twitter Username: ") password = getpass.getpass("Twitter Password: ") http.add_credentials(...
from abc import ABC, abstractmethod from bobocep.rules.events.bobo_event import BoboEvent class IForwarderSubscriber(ABC): """An interface to subscribe to Forwarder events.""" @abstractmethod def on_forwarder_success_event(self, event: BoboEvent): """ Events that have been successfully f...
from distutils.core import setup setup( name='gsutils', version='0.1', packages=['gsutils'], url='https://github.com/oktopac/gsutils', license='Apache', author='oktopac', author_email='', install_requires=[ "google-cloud-storage" ], description='Some utilities for google...
import numpy as np import pandas as pd from sklearn.metrics import f1_score from program_synthesis.synthesizer import Synthesizer from program_synthesis.verifier import Verifier class HeuristicGenerator(object): """ A class to go through the synthesizer-verifier loop """ def __init__(self, train_prim...
def bytesToIntArray(b, bytesPerInt, signed=True, endianness="little"): if len(b) % bytesPerInt != 0: raise Exception("Wrong number of bytes for conversion") nums = [0] * int((len(b) / bytesPerInt)) for i in range(0, len(b), bytesPerInt): nums[int(i / bytesPerInt)] = int.from_bytes( ...
# ---------------------------------------------------------------- # Copyright 2016 Cisco Systems # # 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/LICENS...
num = """ 37107287533902102798797998220837590246510135740250 46376937677490009712648124896970078050417018260538 74324986199524741059474233309513058123726617309629 91942213363574161572522430563301811072406154908250 23067588207539346171171980310421047513778063246676 89261670696623633820136378418383684178734361726757 2811...
#!/usr/bin/env python """ Copyright 2014-2015 Taxamo, 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 app...
############################################################################ # # # Copyright (c) 2019 Carl Drougge # # # # Licensed u...
from .main import * # Random effects (summary statistics) likelihood functions def mle_rfx_optmin_batch(): def nll_ffx_1s(params): sD = D[D['sid'] == s] # nll_ffx_dr_avf nll_ffx_dr_nudger nll_ffx_kde nll_ffx_dr_naive_nudger return nll_ffx_dr_avf(params, sD) def mle_rfx_optmin(s)...
# -*- coding: utf-8 -*- ''' :codeauthor: :email:`Jayesh Kariya <jayeshk@saltstack.com>` ''' # Import Python Libs from __future__ import absolute_import # Import Salt Testing Libs from salttesting import TestCase, skipIf from salttesting.mock import ( MagicMock, patch, NO_MOCK, NO_MOCK_REASON ) fr...
from .cmp_net import CmpNet from .expected_rank_regression import ExpectedRankRegression from .feta_ranker import FETANetwork from .object_ranker import ObjectRanker from .rank_net import RankNet from .list_net import ListNet from .rank_svm import RankSVM
import json import os MAX_NODES = 1000 raphael_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'raphael.js') treant_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'treant.js') def generate_html(parsed_json): global current_tone, execution_time, total_nodes # tones for the differen...
import argparse from src.create_results import create_results ''' Analyze results that are saved as .pkl files in results/raw. Args: name (str) : dataset name directory (str) : directory name lassos (int) : number of lassos for some plots (MLL) step (int) : steps between lassos (see above) ''' ap = ...
# coding: utf-8 """ Python InsightVM API Client OpenAPI spec version: 3 Contact: support@rapid7.com Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re # noqa: F401 import six class ReferencesWithVulnerabilityNaturalIDLink(object): """NOTE: This class...
import unittest import os import requests_mock import xml.etree.ElementTree as ET import tableauserverclient as TSC from tableauserverclient.datetime_helpers import format_datetime from tableauserverclient.server.endpoint.exceptions import InternalServerError from tableauserverclient.server.request_factory import Reque...
""" Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: MIT-0 """ import sys import os from test.testlib.testcase import BaseTestCase from unittest.mock import patch, MagicMock, mock_open import cfnlint.helpers import json class TestDownloadsMetadata(BaseTestCase): """Test ...
# 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 ...
""" Create SQL statements for QuerySets. The code in here encapsulates all of the SQL construction so that QuerySets themselves do not have to (and could be backed by things other than SQL databases). The abstraction barrier only works one way: this module has to know all about the internals of models in order to get ...
from collections import Counter def partial_digest(distances): '''Returns a set whose positive pairwise differences generate 'distances'.''' # Initialize variables. X = {0} width = max(distances) # Create lambda functions for multiset operations. new_dist = lambda y, S: Counter(abs(y-s) for s...
"""Define tests for the Notion config flow.""" from unittest.mock import patch import aionotion import pytest from homeassistant import data_entry_flow from homeassistant.components.notion import DOMAIN, config_flow from homeassistant.const import CONF_PASSWORD, CONF_USERNAME from tests.common import MockConfigEntry...
# -*- coding: utf-8 -*- import numpy as np import pandas as pd import pandas.util.testing as tm from pandas import Index, MultiIndex def check_level_names(index, names): assert [level.name for level in index.levels] == list(names) def test_reindex(idx): result, indexer = idx.reindex(list(idx[:4])) as...
# encoding: utf-8 from __future__ import unicode_literals from lpvaultmanager import DEFAULT_LPASS_PATH from workflow import MATCH_ALL, MATCH_ALLCHARS from workflow.background import run_in_background import lpvaultmanager as lpvm import subprocess ###################################################################...
# -*- coding: utf-8 -*- # Copyright 2016 Dravetech AB. All rights reserved. # # The contents of this file are 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/LI...
from sys import argv, exit from csv import reader, DictReader if len(argv) != 3: print("Usage: python dna.py data.csv sequence.txt") exit(1) # Opens and read the DNA Sequence file with open(argv[2], "r") as txt_file: dna = txt_file.read() # Creates a dictionary sequences = {} with open(argv[1]) as peopl...
#!/usr/bin/env python # coding=utf-8 ''' Author:Tai Lei Date:Thu Nov 22 12:09:27 2018 Info: ''' import glob import numpy as np import h5py import torch from torchvision import transforms from torch.utils.data import Dataset from imgaug import augmenters as iaa from helper import RandomTransWrapper class CarlaH5Dat...
# -*- coding: utf-8 -*- # This file is part of RRMPG. # # RRMPG is free software with the aim to provide a playground for experiments # with hydrological rainfall-runoff-models while achieving competitive # performance results. # # You should have received a copy of the MIT License along with RRMPG. If not, # see <http...
# -*- coding: utf-8 -*- # -------------------------- # Copyright ยฉ 2014 - Qentinel Group. # # 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/LIC...
#!/usr/bin/env python # -*- coding: utf-8 -*- # ============================================================================== # # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the L...
# -*- coding: utf-8 -*- import base64 import functools import hashlib import logging import os import random import re import string import time import urllib import flask from M2Crypto import RSA import requests from docker_registry.core import compat json = compat.json from . import storage from .lib import confi...
"""Data source of stream of frames.""" import bz2 import dlib import queue import shutil import threading import time from typing import Tuple import os from urllib.request import urlopen import cv2 as cv import numpy as np import tensorflow as tf from core import BaseDataSource class FramesSource(BaseDataSource): ...
import imp import requests from flask import make_response, g, jsonify, current_app from functools import wraps class RET(object): OK = "2000" OTHER_REQ_ERR = "3500" OTHER_REQ_TIMEOUT = "3504" PARMA_ERR = "4000" VERIFY_ERR = "4001" CLA_VERIFY_ERR = "4010" UNAUTHORIZE_ERR = "4020" BAD_R...
from collections import namedtuple # This method will recursively convert dictionaries into named tuples, allowing them to be # used like they were regular objects e.g. foo.bar.baz not foo['bar']['baz'] # it does trade readability of code for a performance hit doing the conversion def objectify(v): if isinstance(...
import os import networkx as nx import numpy as np def validate(n,attr='pos'): try: G=nx.read_gpickle(f't{n}.pickle') G1=nx.read_gpickle(f't_fast{n}.pickle') vals = nx.get_node_attributes(G,attr) vals1 = nx.get_node_attributes(G1,attr) max_diff = np.max([np.max(np...
from loop_listen.loop_listen import Loop_listen as Loop i=5 try: for i in range(i): audio = Loop(filename=str(i), threshold=False, max_seconds=3) audio.listen() except KeyboardInterrupt: print('interrupted!') print('Finalizado com sucesso')
#!/usr/bin/env python """ generated source for module UniquenessSolver_no_german """ from __future__ import print_function # # * Copyright (C) 2008-12 Bernhard Hobiger # * # * This file is part of HoDoKu. # * # * HoDoKu is free software: you can redistribute it and/or modify # * it under the terms of the GNU Ge...
import os jmx_metrics = { "host": "localhost", "port": 11003, "java_bin_path": str(os.path.abspath(".local/bin/java")), "java_options": "-Xmx50m -Xms15m", "conf": [ { "include": { "bean": "kafka.connect:type=connect-worker-metrics", "attribute": {...
class Quote: def __init__(self, author, quote): self.author = author self.quote = quote