filename
stringlengths
13
19
text
stringlengths
134
1.04M
the-stack_0_3493
# Copyright 2019 DeepMind Technologies Limited # # 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...
the-stack_0_3495
#!/usr/bin/env python # -*- coding: utf-8; -*- # # collectd implementation of: # https://github.com/BrightcoveOS/Diamond/blob/master/src/collectors/tcp/tcp.py import collectd import os class Tcp(object): PROC = ['/proc/net/netstat', '/proc/net/snmp'] GAUGES = ['CurrEstab', 'MaxConn'] def __init__(self...
the-stack_0_3496
# -*- coding: utf-8 -*- """Tests for thanks-related code.""" # # (C) Pywikibot team, 2016-2019 # # Distributed under the terms of the MIT license. # from __future__ import absolute_import, division, unicode_literals from pywikibot.flow import Topic from tests.aspects import TestCase from tests import unittest NO_TH...
the-stack_0_3497
# -*- coding: utf-8 -*- # Copyright 2018 ProjectQ-Framework (www.projectq.ch) # # 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 # # ...
the-stack_0_3498
import os import utils def main(): src_file = os.path.join(os.getcwd(), "deploy/roles/default_role.yaml") dst_file = os.path.join(os.getcwd(), "build/default_role.yaml") with open(src_file, "r") as src: with open(dst_file, "w+") as dst: data = src.read() print("Deploying {...
the-stack_0_3500
from flask import render_template,request,redirect,url_for,abort from . import main from .forms import UpdateProfile from ..models import User from flask_login import login_required,current_user from .. import db,photos import markdown2 @main.route('/') def index(): ''' View root page function that returns t...
the-stack_0_3501
# 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...
the-stack_0_3505
import re from dataclasses import dataclass, field from typing import Optional, Sequence, Union from snuba_sdk.column import Column from snuba_sdk.expressions import ( Expression, InvalidExpression, ScalarLiteralType, ScalarType, is_literal, is_scalar, ) class InvalidFunction(InvalidExpressio...
the-stack_0_3506
import numpy as np import glob import os import fridge.Material.Element as Element import fridge.utilities.utilities as utilities AVOGADROS_NUMBER = 0.6022140857 cur_dir = os.path.dirname(__file__) material_dir = os.path.join(cur_dir, '../data/materials/') class Material(object): """Creates a material consisting...
the-stack_0_3508
""" My 5th bot. I don't actually like those films, but that was an order. And, frankly, a very interesting one! """ from bs4 import BeautifulSoup from datetime import datetime import requests import telebot import json def search_link(name): """Find a link for a film""" with open("database.json", "r", encodin...
the-stack_0_3511
# Copyright 2021 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 required by applicable law or agreed to...
the-stack_0_3514
from datetime import datetime from flask import Flask from flask import request, Response, render_template, redirect, url_for, flash, request from flask_sqlalchemy import SQLAlchemy from flask_login import current_user, login_required, login_user, LoginManager, logout_user, UserMixin from werkzeug.security import check...
the-stack_0_3515
# Copyright (C) 2019 The Raphielscape Company LLC. # # Licensed under the Raphielscape Public License, Version 1.c (the "License"); # you may not use this file except in compliance with the License. # """ Userbot module containing commands for interacting with dogbin(https://del.dog)""" from requests import get, post,...
the-stack_0_3516
# -*- coding:utf-8 -*- from sqlalchemy import create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import Column, Integer, String, and_, or_, func from sqlalchemy.orm import sessionmaker # 创建对象基类 Base = declarative_base() class User(Base): """ 1.指定表名 2.指定表结构 """ ...
the-stack_0_3517
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import time from HTMLTestRunner import HTMLTestRunner import unittest from db_fixture import test_data sys.path.append('./interface') sys.path.append('./db_fixture') # 指定测试用例为当前文件夹下的 interface 目录 test_dir = './interface' discover = unittest.defaultTestLoader.d...
the-stack_0_3518
from collections import defaultdict from mesa.time import RandomActivation class RandomActivationByBreed(RandomActivation): """ A scheduler which activates each type of agent once per step, in random order, with the order reshuffled every step. This is equivalent to the NetLogo 'ask breed...' and is...
the-stack_0_3519
"Miscellaneous utilities" ########################################################################### # Copyright (C) 2008 William Stein <wstein@gmail.com> # # Distributed under the terms of the GNU General Public License (GPL) # # http://www.gnu.org/licenses/ ...
the-stack_0_3523
import sys from colour.utilities.deprecation import ModuleAPI, build_API_changes from colour.utilities.documentation import is_documentation_building from colour.hints import Any from .primitives import MAPPING_PLANE_TO_AXIS, primitive_grid, primitive_cube from .primitives import PRIMITIVE_METHODS, primitive from .s...
the-stack_0_3524
# -*- coding: utf-8 -*- import hashlib from flask import (render_template, g, session, jsonify, request,redirect, flash) from web.app import app from web.model import (User, UserInfo,UserSetting,BasicUser, AdvancedUser,FeedSite, Feed, Sub, ReadFeed) @app.route("/api/pop-f...
the-stack_0_3526
""" Test address breakpoints set with shared library of SBAddress work correctly. """ import lldb import lldbsuite.test.lldbutil as lldbutil from lldbsuite.test.lldbtest import * class AddressBreakpointTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) NO_DEBUG_INFO_TESTCASE = True def tes...
the-stack_0_3529
# -*- coding: utf-8 -*- # --------------------------------------------------------------------- # Policy Settings # --------------------------------------------------------------------- # Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # ----------------------------------------------------------------...
the-stack_0_3531
#!/usr/bin/env python3 all_brivla = [ ("tavla", ["speaker", "listener", "subject", "language"]) , ("dunda", ["donor", "gift", "recipient"]) , ("ctuca", ["instructor", "audience/student(s)", "ideas/methods", "subject", "teaching method"]) , ("citka", ["consumer", "aliment"]) , ("ciska", ["writer", "text...
the-stack_0_3534
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
the-stack_0_3535
import os import numpy from rdkit import Chem from rdkit.Chem import AllChem from rdkit.Chem import ChemicalFeatures from rdkit import RDConfig from chainer_chemistry.config import WEAVE_DEFAULT_NUM_MAX_ATOMS from chainer_chemistry.dataset.preprocessors.common \ import construct_atomic_number_array from chainer_c...
the-stack_0_3536
""" ApiGateway for CloudWedge Provides implementation details for apigateway service. It follows contract outlined in cloudwedge.models.AWSService """ from os import environ import boto3 import jmespath from typing import List, Any, Dict, Optional from cloudwedge.utils.logger import get_logger from cloudwedge.utils....
the-stack_0_3538
import sys import os import numpy as np inDir = sys.argv[1] print(inDir) ratesInWins = {} for fileName in os.listdir(inDir): if fileName.endswith(".txt"): print(fileName) with open(inDir + "/" + fileName, "rt") as f: sys.stderr.write("reading {}/{}\n".format(inDir, fileName)) ...
the-stack_0_3539
import json import random from hashlib import md5 import pytz from django.conf import settings from django.contrib.auth.models import ( AbstractBaseUser, BaseUserManager, PermissionsMixin, ) from django.contrib.contenttypes.models import ContentType from django.db import models, transaction from django.db.models i...
the-stack_0_3540
# -*- coding: utf-8 -*- # Minio Python Library for Amazon S3 Compatible Cloud Storage, (C) 2016 Minio, 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/licen...
the-stack_0_3541
""" Space : O(1) Time : O(log n) """ # The isBadVersion API is already defined for you. # @param version, an integer # @return an integer # def isBadVersion(version): class Solution: def firstBadVersion(self, n): """ :type n: int :rtype: int """ low = 1 high =...
the-stack_0_3542
"""PIL/Tkinter based simulator for InkyWHAT and InkyWHAT.""" import numpy from . import inky from . import inky_uc8159 class InkyMock(inky.Inky): """Base simulator class for Inky.""" def __init__(self, colour, h_flip=False, v_flip=False): """Initialise an Inky pHAT Display. :param colour: ...
the-stack_0_3543
# Handler for ulno-iot devkit1 import config if config.display: import ulno_iot_display as dp if config.devel: import ulno_iot_devel as dv if config.ht: import ulno_iot_ht as ht import gc gc.collect() import wifi import machine from machine import Pin import time import ubinascii from umqtt.simple import...
the-stack_0_3544
# Copyright 2019 DeepMind Technologies Ltd. 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 appl...
the-stack_0_3545
#database.py creates a .db file for performing umls searches. import sqlite3 import os import sys import os import atexit features_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) if features_dir not in sys.path: sys.path.append(features_dir) # find where umls tables are located from read_config...
the-stack_0_3547
from __future__ import unicode_literals, division, absolute_import from builtins import * # noqa pylint: disable=unused-import, redefined-builtin import pytest from jinja2 import Template from flexget.plugins.parsers.parser_guessit import ParserGuessit from flexget.plugins.parsers.parser_internal import ParserIntern...
the-stack_0_3548
# -*- coding: utf-8 -*- from __future__ import unicode_literals import torchtext.data as data from ..common.torchtext_test_case import TorchtextTestCase class TestDataset(TorchtextTestCase): def test_tabular_simple_data(self): for data_format in ["csv", "tsv", "json"]: self.write_test_ppid_da...
the-stack_0_3549
#!/usr/bin/env python3 # Copyright (c) 2019-2020 The PIVX developers # Copyright (c) 2020 The Supernode Coin developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # -*- coding: utf-8 -*- from io import BytesIO from time impor...
the-stack_0_3554
""" Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. ---------- Compute upper limit on word perplexity for kenlm ngram models Command : python3 compute_upper_ppl_kenlm.p...
the-stack_0_3556
from functools import wraps from typing import Optional def _embed_ipython_shell(ns: Optional[dict] = None): if ns is None: ns = {} from IPython.terminal.embed import InteractiveShellEmbed from IPython.terminal.ipapp import load_default_config @wraps(_embed_ipython_shell) def wrapper(nam...
the-stack_0_3557
import argparse import os import random import string import time from abc import ABC, abstractmethod from diffimg import diff from selenium import webdriver from selenium.webdriver import ChromeOptions, FirefoxOptions from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from sel...
the-stack_0_3559
#!/usr/bin/env python3 # Copyright (c) 2016-2019 The Cedicoin 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.""" import math import random import struct import ...
the-stack_0_3560
from string import punctuation, digits import numpy as np import random # Part I #pragma: coderesponse template def get_order(n_samples): try: with open(str(n_samples) + '.txt') as fp: line = fp.readline() return list(map(int, line.split(','))) except FileNotFoundError: ...
the-stack_0_3561
from utils import read_data import numpy as np def test_mnist_images(): train_images = read_data.get_mnist_data(read_data.MNIST_TRAIN_IMAGES_URL) assert train_images.shape == (60000, 28, 28) test_images = read_data.get_mnist_data(read_data.MNIST_TEST_IMAGES_URL) assert test_images.shape == (10000, 28, ...
the-stack_0_3563
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """ Reports builder for BIDS-Apps. Generalizes report generation across BIDS-Apps """ from pathlib import Path import re from itertools import compress from collections import defaultdict from pkg_resourc...
the-stack_0_3564
"""Test functions for the sparse.linalg._expm_multiply module """ from __future__ import division, print_function, absolute_import import numpy as np from numpy.testing import assert_allclose, assert_, assert_equal from scipy._lib._numpy_compat import suppress_warnings from scipy.sparse import SparseEfficiencyWarnin...
the-stack_0_3567
# coding: utf-8 # # Copyright 2022 :Barry-Thomas-Paul: Moss # # 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 applicab...
the-stack_0_3569
from datetime import datetime from time import sleep from redis import StrictRedis from random import random from rediscache_decorator import Cache ### Comment this section if you don't have redis instance ### redis = StrictRedis(decode_responses=True) cache = Cache(redis) @cache.ttl(300) def pseudo_calc(): sle...
the-stack_0_3570
import os # toolchains options ARCH='sparc-v8' CPU='bm3803' CROSS_TOOL='gcc' if CROSS_TOOL == 'gcc': PLATFORM = 'gcc' EXEC_PATH = r'C:\Users\97981\Downloads\bcc-2.1.1-gcc\bin' BUILD = 'debug' if PLATFORM == 'gcc': # toolchains PREFIX = 'sparc-gaisler-elf-' CC = PREFIX + 'gcc' CXX = PREFIX...
the-stack_0_3575
from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import create_engine, MetaData from sqlalchemy.ext.automap import automap_base from sqlalchemy.orm import Session from .common import app, db # The `framework.models.main_database` module`... def name_for_scalar_relationship(base, l...
the-stack_0_3577
from collections import OrderedDict from django.forms import BoundField, CheckboxInput, CheckboxSelectMultiple, FileInput, RadioSelect from django.template.loader import get_template from django.utils.safestring import mark_safe from django_jinja import library from bootstrapform_jinja.config import BOOTSTRAP_COLUMN_C...
the-stack_0_3578
import json from pathlib import Path def save_json(filepath, content, append=False, topcomment=None): """ Saves content to a json file :param filepath: path to a file (must include .json) :param content: dictionary of stuff to save """ fp = Path(filepath) if fp.suffix not in (".json"): ...
the-stack_0_3579
# This code is derived from https://github.com/esa/pykep/pull/127 # originally developed by Moritz v. Looz @mlooz . # It was modified following suggestions from Waldemar Martens @MartensWaldemar_gitlab # Solar orbiter is quite a challenge for state of the art optimizers, but # good solutions fulfilling the requireme...
the-stack_0_3582
# Copyright 2017 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...
the-stack_0_3583
import numpy as np import networkx as nx import matplotlib.pyplot as plt import matplotlib import time import ot from scipy import linalg from scipy import sparse import gromovWassersteinAveraging as gwa import spectralGW as sgw from geodesicVisualization import * from GromovWassersteinGraphToolkit import * import json...
the-stack_0_3586
import gzip import os import struct import tempfile import unittest from io import BytesIO, StringIO, TextIOWrapper from unittest import mock from django.core.files import File from django.core.files.base import ContentFile from django.core.files.move import file_move_safe from django.core.files.temp import NamedTempo...
the-stack_0_3587
from commands import commands from socket import socket import json # All these "magic" variables come from reverse engineering the HS100 app, Kasa # We decompiled it and found their encryption function, then wrote this to try # to connect and manipulate a HS100, which it does! It appears they use no form # of authent...
the-stack_0_3589
# coding: utf-8 """ Feed API <p>The <strong>Feed API</strong> lets sellers upload input files, download reports and files including their status, filter reports using URI parameters, and retrieve customer service metrics task details.</p> # noqa: E501 OpenAPI spec version: v1.3.1 Generated by: ...
the-stack_0_3591
# _*_ coding: utf-8 _*_ """ parse.py by xianhu """ import logging import multiprocessing from .base import TPEnum, BaseThread from ...utilities import CONFIG_ERROR_MESSAGE, check_url_legal, get_dict_buildin class ParseThread(BaseThread): """ class of ParseThread, as the subclass of BaseThread """ d...
the-stack_0_3595
r""" Genomics operations """ import collections import os import re from functools import reduce from itertools import chain from operator import add from typing import Any, Callable, List, Mapping, Optional, Union import anndata import networkx as nx import numpy as np import pandas as pd import pybedtools from pybe...
the-stack_0_3597
# 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 u...
the-stack_0_3598
# Copyright 2014 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...
the-stack_0_3599
from os import path from splashgen import MetaTags, SplashSite, launch from splashgen.integrations import MailchimpSignup site = SplashSite(title="ZenWeb – Python Internal Web Apps", logo=path.join(path.dirname(__file__), "zenweb-logo.png"), theme="dark") site.headline = "Effortless...
the-stack_0_3600
import math from typing import Any import torch import torch.nn as nn from torch.nn import functional as f import numpy as np BETA_START = 0.4 BETA_FRAMES = 100000 class NoisyLinear(nn.Linear): def __init__(self, in_features, out_features, sigma_init=0.017, bias=True): super(NoisyLinear, self).__init_...
the-stack_0_3603
"""empty message Revision ID: 914d00d1492a Revises: Create Date: 2020-07-01 23:19:51.549022 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '914d00d1492a' down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto gene...
the-stack_0_3604
import logging import time class Stage: def __init__(self, total_tasks, seconds_per_tasks): self.current_task_number = 0 self.total_tasks = total_tasks self.seconds_per_task = seconds_per_tasks def update_task_number(self, task_number): self.current_task_number = task_number ...
the-stack_0_3607
import gc import os import time # Import required modules from pyaedt import Circuit from pyaedt.generic.filesystem import Scratch from pyaedt.generic.TouchstoneParser import read_touchstone # Setup paths for module imports from _unittest.conftest import local_path, scratch_path, config try: import pytest # noq...
the-stack_0_3611
import sys import json import time from itertools import combinations import requests from ratelimit import limits, sleep_and_retry def loop_possibilities(upper_bound, n_combinations=3): return combinations(range(1, upper_bound + 1), n_combinations) @sleep_and_retry @limits(calls=5, period=30) # decorator def _h...
the-stack_0_3614
# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/stable/config # -- Path setup ------------------------------------------------------------...
the-stack_0_3615
# Copyright 2018 Lenovo (Beijing) Co.,LTD. # 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...
the-stack_0_3616
from django.utils.html import escape from core.templatetags import register from django.utils.safestring import mark_safe @register.simple_tag(takes_context=True) def text_element( context, id, label, errors=None, data_mode=None, name=None, textarea=None, value=None, hint=None, ...
the-stack_0_3617
from typing import List class Grid: def __init__(self): self.grid_mat = Grid.__initialise_grid_mat() def visualise(self) -> None: grid_mat_element_gen = self.__create_grid_mat_element_generator() str_rows = list() for ri in range(7): if ri % 2 == 0: ...
the-stack_0_3618
# Copyright 2011 OpenStack LLC. # 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 b...
the-stack_0_3619
def main(): n = int(input()) for i in range(n): a = int(input()) b = set([int(x) for x in input().split()]) if (max(b) - min(b)) < len(b): print("YES") else: print("NO") if __name__ == '__main__': main()
the-stack_0_3620
import sqlite3 from datetime import datetime from os import listdir import os import re import json import shutil import pandas as pd from application_logging.logger import App_Logger class Prediction_Data_validation: """ This class shall be used for handling all the validation d...
the-stack_0_3621
# Copyright 2018 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
the-stack_0_3623
''' Function: 音悦台MV下载: http://www.yinyuetai.com Author: Charles 微信公众号: Charles的皮卡丘 ''' import re import requests from utils.utils import * ''' Input: --url: 视频地址 --savepath: 视频下载后保存的路径 Output: --is_success: 下载是否成功的BOOL值 ''' class yinyuetai(): def __init__(self): self.headers = { 'User-Agent': 'Mozilla/...
the-stack_0_3624
""" Wrapper class that takes a list of template loaders as an argument and attempts to load templates from them in order, caching the result. """ import hashlib import warnings from django.template import Origin, Template, TemplateDoesNotExist from django.template.backends.django import copy_exception from django.uti...
the-stack_0_3626
from __future__ import unicode_literals import re import uuid from datetime import datetime from random import random, randint import pytz from boto3 import Session from moto.core.exceptions import JsonRESTError from moto.core import BaseBackend, BaseModel from moto.core.utils import unix_time from moto.ec2 import ec...
the-stack_0_3627
""" AES IGE implementation in Python. If available, tgcrypto will be used instead, otherwise if available, cryptg will be used instead, otherwise if available, libssl will be used instead, otherwise the Python implementation will be used. """ import os import pyaes import logging from . import libssl __log__ = loggi...
the-stack_0_3628
"""edsr_slim.py""" # import mindspore from src import common # from src.edsr_model import Upsampler, default_conv import mindspore.nn as nn import mindspore.ops as ops # import mindspore.ops.operations as P from mindspore import Tensor class EDSR(nn.Cell): """[EDSR] Args: nn ([type]): [description] ...
the-stack_0_3629
#!/usr/bin/env python3 # coding: UTF-8 from configparser import ConfigParser from contextlib import contextmanager import os import datetime from os.path import abspath, basename, exists, dirname, join, isdir, expanduser import platform import sys import subprocess import time import logging import logging.config imp...
the-stack_0_3633
# WxPython Demo from typing import List, Optional import os.path import wx import QRCodeLib.qrcodelib as qr from QRCodeLib.qrcodelib import Symbols class FormMain(wx.Frame): def __init__(self, **kw) -> None: super().__init__(**kw) self._init_widgets() self._images: List[wx.Bitmap] = [] ...
the-stack_0_3635
# MIT License # Copyright (c) 2020 Mitchell Lane # 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, ...
the-stack_0_3638
#/* # * # * TuneIn Radio for Kodi. # * # * Copyright (C) 2013 Diego Fernando Nieto # * # * This program 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 opti...
the-stack_0_3639
from plotly.graph_objs import Layout from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType import copy as _copy class Data(_BaseLayoutHierarchyType): # area # ---- @property def area(self): """ The 'area' property is a tuple of instances of A...
the-stack_0_3640
import io import jsonpickle import logging import numpy as np import os from tqdm import tqdm from typing import Tuple, List, Optional, Dict, Text, Any import rasa.utils.io from rasa.core import utils from rasa.core.actions.action import ACTION_LISTEN_NAME from rasa.core.domain import PREV_PREFIX, Domain from rasa.cor...
the-stack_0_3641
import wx DisplayCrosshairsEventType = wx.NewEventType() DisplayMagnifierEventType = wx.NewEventType() FitToPageEventType = wx.NewEventType() SetNumarrayEventType = wx.NewEventType() ScaleSizeEventType = wx.NewEventType() ScaleValuesEventType = wx.NewEventType() EVT_DISPLAY_CROSSHAIRS = wx.PyEventBinder(DisplayCrossh...
the-stack_0_3642
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser from textattack.commands import TextAttackCommand from textattack.commands.attack.attack_args import * from textattack.commands.augment import AUGMENTATION_RECIPE_NAMES def _cb(s): return textattack.shared.utils.color_text(str(s), color="blue", m...
the-stack_0_3644
#!python3 from lib import queries from tkinter import * from tkinter import ttk from lib.gui import elements from lib.gui import dialog flag = 0 dbDict = {} fDict = {} class MainFrame(Toplevel): def __init__(self, dbCon): Toplevel.__init__(self) self.geometry("800x600") se...
the-stack_0_3645
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = '古溪' import os import numpy as np from dataset.data_util import pil_load_img from dataset.dataload import TextDataset, TextInstance from util.io import read_lines import cv2 class Ctw1500Text(TextDataset): def __init__(self, data_root, is_training=True, ...
the-stack_0_3646
from functools import partial import torch.nn as nn from detectron2.layers import (BatchNorm2d, NaiveSyncBatchNorm, FrozenBatchNorm2d) from detectron2.utils import env def get_norm(norm, out_channels, **kwargs): """ Args: norm (str or callable): either one of BN, SyncB...
the-stack_0_3647
""" In this lesson, we'll cover two more advanced data types: lists and dictionaries. Let's start with lists. Lists are a great way to store a bunch of stuff in a collection. Here's an example: """ myList = ["foo", 5, 7, True, "hello", False, -1] """ This list contains a bunch of things. In other languages, ...
the-stack_0_3648
""" This schema represents all known key/value pairs for the builder config file. """ from strictyaml import ( load, Map, MapPattern, Str, Int, Float, S...
the-stack_0_3650
from functools import wraps from inspect import iscoroutinefunction import falcon try: import jsonschema except ImportError: # pragma: nocover pass def validate(req_schema=None, resp_schema=None, is_async=False): """Decorator for validating ``req.media`` using JSON Schema. This decorator provides ...
the-stack_0_3651
import collections import copy import functools import logging import sys import six from jsonschema import Draft4Validator, ValidationError, draft4_format_checker from werkzeug import FileStorage from ..exceptions import ExtraParameterProblem from ..http_facts import FORM_CONTENT_TYPES from ..json_schema import Draf...
the-stack_0_3653
import os from decouple import config from flask import Flask, render_template from core.model import cotacoes def create_app(): app = Flask('core') app.config["SECRET_KEY"] = config('SECRET_KEY') @app.route('/') def home(): dicionario = cotacoes.cotar() if dicionario['sucesso']: ...
the-stack_0_3654
# Copyright 2020 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 required by applicable law or agreed to...
the-stack_0_3655
# # 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...
the-stack_0_3657
from typing import Tuple import re RESULT_PATTERN = re.compile(r'([^\*]+)(\**)') def convert_to_stars(t_value: float) -> str: t = abs(t_value) if t < 1.645: return '' elif t < 1.96: return '*' elif t < 2.576: return '**' elif t > 2.576: return '***' else: # cove...
the-stack_0_3661
""" CRUD de SQLite3 con Python 3 @author parzibyte Más tutoriales en: parzibyte.me/blog """ import sqlite3 try: #Conectar a la base de datos bd = sqlite3.connect("libros.db") cursor = bd.cursor() #Listar los libros sentencia = "SELECT *,rowid FROM libros;" cursor.execute(sentencia) libros = cursor.fetc...
the-stack_0_3662
# -*- coding: utf-8 -*- from openerp import models, fields, api, osv # We just create a new model class mother(models.Model): _name = 'test.inherit.mother' _columns = { # check interoperability of field inheritance with old-style fields 'name': osv.fields.char('Name'), 'state': osv.fie...