filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_8828 | from multiprocessing.connection import Listener
from threading import Thread
import pickle
class RPCHandler:
def __init__(self):
self._functions = {}
def register_function(self, func):
self._functions[func.__name__] = func
def handle_connection(self, connection):
try:
... |
the-stack_0_8829 | from eth_account.account import Account
from web3.types import TxParams
from typing import TypedDict, List
from hexbytes import HexBytes
FlashbotsBundleTx = TypedDict(
"FlashbotsBundleTx",
{
"transaction": TxParams,
"signer": Account,
},
)
FlashbotsBundleRawTx = TypedDict(
"FlashbotsBu... |
the-stack_0_8831 | # import codes.basic_functions.ourpretrainedmodels as pretrainedmodels
import pretrainedmodels
import torch
import torch.nn as nn
class ImagenetEnsemble(nn.Module):
def __init__(self, ):
super(ImagenetEnsemble, self).__init__()
self.archs = ['resnet34', 'resnet152', 'densenet121']
for m... |
the-stack_0_8833 | # Copyright 2014-present PlatformIO <contact@platformio.org>
#
# 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 applicabl... |
the-stack_0_8836 | import argparse
from collections import deque
import os
import torch
from torch import optim
from tqdm import tqdm
from environments import CartPoleEnv
from evaluation import evaluate_agent
from models import ActorCritic, AIRLDiscriminator, GAILDiscriminator, GMMILDiscriminator, REDDiscriminator
from train... |
the-stack_0_8837 | import tkinter as tk
from tkinter import ttk
from tkinter.font import Font
import re
import math
MAX_LINES = 16
def traverse_up(widget, function, initializer = None):
return function(widget, traverse_up(widget.master, function, initializer) if hasattr(widget, 'master') else initializer)
class AutocompleteEntry(t... |
the-stack_0_8838 | # BSD 3-Clause License
#
# Copyright (c) 2019, Elasticsearch BV
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, t... |
the-stack_0_8839 | # P2P helper functions
# Copyright (c) 2013-2015, Jouni Malinen <j@w1.fi>
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
import logging
logger = logging.getLogger()
import threading
import time
import Queue
import hwsim_utils
MGMT_SUBTYPE_PROBE_REQ = 4
MGMT_SU... |
the-stack_0_8840 | # dataset settings
data_source_cfg = dict(type='ImageNet')
# StanfordCars
data_train_labeled_list = 'data/meta/Cars/image_list/train_50.txt' # download from Self-Tuning
data_train_unlabeled_list = 'data/meta/Cars/image_list/unlabeled_50.txt'
data_train_root = 'data/StanfordCars/'
data_test_list = 'data/meta/Cars/image... |
the-stack_0_8841 | #
# Copyright 2018-2021 IBM 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 wr... |
the-stack_0_8842 | import unittest
from typing import List
class Solution:
def nthUglyNumber(self, n: int) -> int:
ugly_nums = [1] * n
multi_2 = 2
multi_3 = 3
multi_5 = 5
index_multi_2 = 0
index_multi_3 = 0
index_multi_5 = 0
for i_th in range(1, n):
next_... |
the-stack_0_8843 | import unittest
import cupy as cp
import pytest
from skimage import data
from cucim.skimage.filters import LPIFilter2D, inverse, wiener
class TestLPIFilter2D(unittest.TestCase):
img = cp.array(data.camera()[:50, :50])
def filt_func(self, r, c):
return cp.exp(-cp.hypot(r, c) / 1)
def setUp(self... |
the-stack_0_8846 | #!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# Image pipeline
image1 = vtk.vtkImageCanvasSource2D()
image1.SetNumberOfScalarComponents(3)
image1.SetScalarTypeToUnsignedChar()
image1.SetExtent(0,511,0,511,0,0)
image1.SetDrawColor... |
the-stack_0_8848 | import traceback
import backoff
from collections import namedtuple
from collections.abc import AsyncIterable, Awaitable
from pyignite import Client
from pyignite.utils import is_hinted
from pyignite.exceptions import ReconnectError
from ..extensions.context_vars import fabric_service, fabric_execution
from ..protocol i... |
the-stack_0_8849 | # -*- coding: utf-8 -*-
u"""
.. module:: common
"""
from django.contrib.auth.models import User
from apps.volontulo.models import Offer
from apps.volontulo.models import Organization
from apps.volontulo.models import UserProfile
COMMON_OFFER_DATA = {
'organization': None,
'description': u'',
'requiremen... |
the-stack_0_8850 | from modelbasedagent import ModelBasedAgent
import numpy as np
class ThompsonSampAgent(ModelBasedAgent):
def __init__(self, dirichlet_param, reward_param, **kwargs):
super(ThompsonSampAgent, self).__init__(**kwargs)
self.dirichlet_param = dirichlet_param
self.reward_param = reward_param
... |
the-stack_0_8852 | from __future__ import absolute_import
from __future__ import print_function
import os
from distutils.dir_util import remove_tree
from shutil import copyfile
def clean_dir(src_dir, directory):
if os.path.exists(directory):
print("Cleaning directory: " + directory + "\n")
for f in os.listdir(direct... |
the-stack_0_8853 | import pytest
import numpy as np
from sklearn.model_selection import train_test_split
from ngboost import NGBClassifier, NGBRegressor
from ngboost.distns import Bernoulli, Normal
def test_classification():
from sklearn.datasets import load_breast_cancer
from sklearn.metrics import roc_auc_score, log_loss
... |
the-stack_0_8854 | #!/usr/bin/env python
###############################################################################
# Copyright 2017 The Apollo 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 ... |
the-stack_0_8858 | import numpy as np
from colour import Color
from svgwrite import Drawing
from map_machine.geometry.flinger import Flinger
from map_machine.osm.osm_reader import Tagged
from map_machine.scheme import Scheme
class Tree(Tagged):
"""Tree on the map."""
def __init__(
self, tags: dict[str, str], coordinat... |
the-stack_0_8859 | import json
from collections import Counter
import jieba
from tqdm import tqdm
from config import *
from utils import parse_user_reviews
def build_wordmap(contents):
word_freq = Counter()
for sentence in tqdm(contents):
seg_list = jieba.cut(sentence.strip())
# Update word frequency
... |
the-stack_0_8861 | import os
import sys
import numpy as np
from PIL import Image
from skimage import io
from skimage.color import rgb2gray
from torch.utils.data import Dataset
sys.path.append('../')
from research.iqa.cfg import cfg
class ImageQualityDataset(Dataset):
"""
Image Quality Dataset
"""
def __init__(self, t... |
the-stack_0_8862 | import tensorflow as tf
import numpy as np
import pandas as pd
import sklearn as sk
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import LSTM
from keras.layers import Dropout
from keras.layers import Flatten
from sklearn.preprocessing import MinMaxScaler
from sklearn.model_selecti... |
the-stack_0_8863 | comando = input ("Ingrese los comandos deseados: ")
comando = list(comando)
comando = "".join(comando)
comando = comando.split("|")
print (comando)
intercambio = []
cadena_comparadora= "abcdefghijklmnñopqrstuvwxyzABCDEFGHIJKLMNÑOPQRSTUVWXYZ .,_1234567890><!#$%&/()=?¡¿´+*[]{}_:;áéíóú"
lista_abc = list(cadena_comparador... |
the-stack_0_8865 | #!/usr/bin/env python
#
# Copyright 2007 Google 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 o... |
the-stack_0_8866 | # coding: utf-8
from __future__ import unicode_literals
import re
import requests
from bs4 import BeautifulSoup
class BaseSpider(object):
def __init__(self, url):
super(BaseSpider, self).__init__()
self.url = url
self.headers = {"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_1... |
the-stack_0_8867 | """
Helpers for XAI
"""
import altair as alt
import numpy as np
import pandas as pd
import streamlit as st
from pdpbox import pdp
@st.cache(allow_output_mutation=True)
def compute_pdp_isolate(model, dataset, model_features, feature):
pdp_isolate_out = pdp.pdp_isolate(
model=model,
dataset=dataset,... |
the-stack_0_8868 | print("How old are you?", end=' ')
age = input()
print('How tall are you?', end=' ')
height= input()
print(f"So, you're {age} old, and {height} tall.")
print('Let\'s practice everything.')
print('You\'d need to know about escapes'+
'with \\ that do \n newlines and \t tabs.')
poem = """
\tThe lovely world
wit... |
the-stack_0_8870 | # Copyright 2006 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Fixer for apply().
This converts apply(func, v, k) into (func)(*v, **k)."""
# Local imports
from .. import pytree
from ..pgen2 import token
from .. import fixer_base
from ..fixer_util import Call, Comma, parenthesi... |
the-stack_0_8873 | # Copyright 2020 The Google Authors. All Rights Reserved.
#
# Licensed under the MIT License (the "License");
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN... |
the-stack_0_8875 | import tkinter as tk
from PIL import ImageTk, Image # pip3 install Pillow
from tkinter import filedialog
import engine.torch as tengine
import matplotlib.pyplot as plt
def upload(): # AQUI SE SUBE LA IMAGEN
filename = filedialog.askopenfilename(title='open', filetypes=[("Images", ".jpg")])
img = Image.open... |
the-stack_0_8876 | """Builder class used to transform a mypy AST to the IR form.
The IRBuilder class maintains transformation state and provides access
to various helpers used to implement the transform.
The top-level transform control logic is in mypyc.irbuild.main.
mypyc.irbuild.visitor.IRBuilderVisitor is used to dispatch based on ... |
the-stack_0_8877 | import pathlib
import torch
from torch import nn
from torch.nn import functional as F
from torch.utils.data import DataLoader
from torchvision import transforms
from torchvision.models import *
from torchvision.utils import save_image
import numpy as np
from tqdm import tqdm
from skimage import feature
import pandas ... |
the-stack_0_8878 | # TODO(matt): Reformat script.
"""
Big Data Training
=================
"""
###############################################################################
# train
###############################################################################
import argparse
import collections
import os
import sys
import time
from ty... |
the-stack_0_8881 | # 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_8882 | """Configuration file."""
import numpy as np
import mne
# Empty config
CONFIG = dict()
# Supported MNE types
MNE_EPOCHS_TYPE = (mne.Epochs, mne.EpochsArray, mne.epochs.EpochsFIF,
mne.epochs.BaseEpochs)
CONFIG["MNE_EPOCHS_TYPE"] = MNE_EPOCHS_TYPE
CONFIG["MNE_EPOCHSTFR_TYPE"] = (mne.time_frequency.Ep... |
the-stack_0_8883 | import math
import operator
import sys
import pickle
import multiprocessing
import ctypes
import warnings
from distutils.version import LooseVersion
import re
import numpy as np
from numba import njit, jit, vectorize, guvectorize, objmode
from numba.core import types, errors, typing, compiler, cgutils
from numba.core... |
the-stack_0_8884 | from __future__ import print_function
import numpy as np
import argparse
import torch
import torch.utils.data as data_utils
import torch.optim as optim
from torch.autograd import Variable
from dataloader import MnistBags
from grape.grape_dataloader import VineBags
from model_old import Attention, GatedAttention
# T... |
the-stack_0_8885 | # Copyright 2019 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import os
import re
from pants.backend.python.subsystems.python_tool_base import PythonToolBase
from pants.backend.python.tasks.python_tool_prep_base import PythonToolInstance, PythonTool... |
the-stack_0_8888 | # orm/mapper.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Logic to map Python classes to and from selectables.
Defines the :class:`~sqlalche... |
the-stack_0_8889 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class MybankPaymentTradeNormalpayOperateQueryModel(object):
def __init__(self):
self._order_no = None
self._request_no = None
@property
def order_no(self):
return self.... |
the-stack_0_8890 | #!/usr/bin/env python
##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
##~ Copyright (C) 2002-2004 TechGame Networks, LLC.
##~
##~ This library is free software; you can redistribute it and/or
##~ modify it under the terms of the BSD style License as found in the
##~ LICENSE file included with this distribution... |
the-stack_0_8892 | # -*- coding: utf-8 -*-
#
# pylast -
# A Python interface to Last.fm and Libre.fm
#
# Copyright 2008-2010 Amr Hassan
# Copyright 2013-2017 hugovk
#
# 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 Lice... |
the-stack_0_8894 | from datetime import datetime
from decimal import Decimal
import unittest
from werkzeug.datastructures import MultiDict
from pytz import timezone, utc
import pytest
from coaster.utils import LabeledEnum
import baseframe.forms as forms
from .fixtures import app1 as app
class MY_ENUM(LabeledEnum): # NOQA: N801
... |
the-stack_0_8895 | # coding=utf-8
# Copyright 2019 The Google Research Authors.
#
# 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_8896 | # Copyright (c) 2021 Zenqi
# 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, publish, distribute, su... |
the-stack_0_8898 | """empty message
Revision ID: 237df1268348
Revises:
Create Date: 2021-07-29 21:33:34.739710
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '237df1268348'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto gener... |
the-stack_0_8900 | # kontonr.py - functions for handling Norwegian bank account numbers
# coding: utf-8
#
# Copyright (C) 2018 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# versi... |
the-stack_0_8903 | # -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and contributors
# License: MIT. See LICENSE
import frappe
from frappe import _
from frappe.desk.doctype.notification_settings.notification_settings import (
is_email_notifications_enabled_for_type,
is_notifications_enabled,
set_seen_value,
)
from fr... |
the-stack_0_8904 | r"""
Query Builder Datalog
=====================
Complements QueryBuilderBase with query capabilities,
as well as Region and Neurosynth capabilities
"""
from collections import defaultdict
from typing import (
AbstractSet,
Dict,
Iterable,
List,
Optional,
Tuple,
Type,
Union,
)
from uuid i... |
the-stack_0_8905 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
import unittest
from happy_python import HappyPyException
class TestHappyPyException(unittest.TestCase):
def test_hpe(self):
try:
raise HappyPyException('自定义错误')
except HappyPyException as e:
self.assertEqual('自定义错误', str(e)... |
the-stack_0_8906 | from __future__ import division
import requests
import datetime as dt
import json
from functools import partial
# from multiprocessing.pool import Pool
from billiard.pool import Pool
from twitterscraper.tweet import Tweet
from twitterscraper.ts_logger import logger
from twitterscraper.user import User
from fake_userag... |
the-stack_0_8907 | # qubit number=4
# total number=47
import cirq
import qiskit
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import FakeVigo
from math import log2
import numpy as np
import networkx as nx
def bitwise_... |
the-stack_0_8909 | #!/usr/bin/env python
# Copyright 2020-2021 Axis Communications AB.
#
# For a full list of individual contributors, please see the commit history.
#
# 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... |
the-stack_0_8911 | # a cursor is the object we use to interact with the database
import pymysql.cursors
# this class will give us an instance of a connection to our database
class MySQLConnection:
def __init__(self, db):
# change the user and password as needed
connection = pymysql.connect(host = 'localhost',
... |
the-stack_0_8913 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# xpaw documentation build configuration file, created by
# sphinx-quickstart on Thu Mar 16 11:08:48 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autog... |
the-stack_0_8914 | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... |
the-stack_0_8916 | # This is a sample commands.py. You can add your own commands here.
#
# Please refer to commands_full.py for all the default commands and a complete
# documentation. Do NOT add them all here, or you may end up with defunct
# commands when upgrading ranger.
# A simple command for demonstration purposes follows.
# ---... |
the-stack_0_8918 | import string
import os
def clean_name(name):
name = name.lower()
name = name.strip()
name = name.replace('\'', '')
name = name.replace('-', ' ')
return name.translate(str.maketrans("", "", string.punctuation))
class NameConverter:
def __init__(self):
self.color_map = {}
lo... |
the-stack_0_8919 | # Copyright (C) 2010 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... |
the-stack_0_8923 | """sc-githooks - The base check class
Copyright (c) 2021 Scott Lau
Portions Copyright (c) 2021 InnoGames GmbH
Portions Copyright (c) 2021 Emre Hasegeli
"""
from enum import IntEnum
class CheckState(IntEnum):
NEW = 0
CLONED = 1
DONE = 2
FAILED = 3
class Severity(IntEnum):
# The numbers are sele... |
the-stack_0_8926 | import logging
import numpy as np
import pandas as pd
from random import shuffle
import models
from common.constant.df_from_csv import LISTENING_DF, SP_I_DF, SP_O_DF
from common.constant.message_type import MessageType
from core.nlp.response_generator.product.base.base_response_generator import BaseResponseGenerator
... |
the-stack_0_8928 | # 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_8929 | from bs4 import BeautifulSoup
import requests,datetime
top_news = {"world":[],"business":[],"technology":[],"sports":[],"entertainment":[]}
def Scraper_news():
new_dic = {}
URLS_of_menu = {"world":"http://www.newzcone.com/world/","business":"http://www.newzcone.com/business/","technology":"http://www.newzcone.com/te... |
the-stack_0_8931 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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/... |
the-stack_0_8932 | import contextlib
import re
import sys
class ColorContext(object):
"""
A context manager for terminal text colors.
Context usage:
with blue:
print 'this is blue'
with red:
print 'this is red'
print 'blue again!'
Callable usage that can brea... |
the-stack_0_8933 | #!/usr/bin/env python
from txros import util
from twisted.internet import defer
from navigator import Navigator
import numpy as np
from mil_tools import rosmsg_to_numpy
from geometry_msgs.msg import Vector3Stamped
class PingerAndy(Navigator):
'''
Mission to run sonar start gate challenge using Andy's sonar sy... |
the-stack_0_8934 | from bitmovin.resources import AbstractIdResource
class EncodingStatus(AbstractIdResource):
def __init__(self, status, number_of_segments=None, id_=None, messages=None, subtasks=None,
created_at=None, queued_at=None, finished_at=None, error_at=None):
super().__init__(id_=id_)
se... |
the-stack_0_8935 | """Tools for simulation of transients."""
from __future__ import print_function
import sys
import math
import copy
from collections import OrderedDict
import numpy as np
from numpy import random
from scipy.interpolate import InterpolatedUnivariateSpline as Spline1d
from astropy.table import Table
from astropy.cosmol... |
the-stack_0_8936 | from selenium import webdriver
from fixture.session import SessionHelper
from fixture.group import GroupHelper
from fixture.contact import ContactHelper
class Application:
def __init__(self):
self.wd = webdriver.Firefox()
self.wd.implicitly_wait(5)
self.session = SessionHelper(self)
... |
the-stack_0_8938 | import os
import re
import sys
import glob
import json
import time
import logging
import threading
import subprocess
import six
import base64
from multiprocessing import Process, Queue
try:
from shlex import quote as cmd_quote
except ImportError:
from pipes import quote as cmd_quote # for Python 2.7
from local... |
the-stack_0_8940 | import re
from collections.abc import Iterable
from functools import partial
from graphql_relay import connection_from_array
from ..types import Boolean, Enum, Int, Interface, List, NonNull, Scalar, String, Union
from ..types.field import Field
from ..types.objecttype import ObjectType, ObjectTypeOptions
from ..utils... |
the-stack_0_8941 | #!/usr/bin/env python3
# Copyright (c) 2013-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Generate seeds.txt from Pieter's DNS seeder
#
NSEEDS=512
MAX_SEEDS_PER_ASN=2
MIN_BLOCKS = 615801
#... |
the-stack_0_8942 | """Init file for Supervisor RESTful API."""
import logging
from pathlib import Path
from typing import Optional
from aiohttp import web
from ..coresys import CoreSys, CoreSysAttributes
from .addons import APIAddons
from .audio import APIAudio
from .auth import APIAuth
from .cli import APICli
from .discovery import AP... |
the-stack_0_8944 | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import pyt... |
the-stack_0_8945 | from No import No
from Estado import Estado
estadoInicial = Estado('/home/ec2-user/environment/DiretorioInicial')
raiz = No(estadoInicial)
estadosFilhos = estadoInicial.funcaoSucessora()
for estadoFilho in estadosFilhos:
noFilho = No(Estado(estadoFilho))
raiz.addFilho(noFilho)
raiz.printArvore()
|
the-stack_0_8947 | from __future__ import absolute_import, division, print_function
from oem.core.providers.base import Provider
from oem.version import __version__
from oem_core.core.plugin import PluginManager
import inspect
import logging
import six
log = logging.getLogger(__name__)
class Client(object):
version = __version__... |
the-stack_0_8948 | #
# Copyright 2020 IBM Corp. 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... |
the-stack_0_8949 | """Dense univariate polynomials with coefficients in Galois fields. """
from random import uniform
from math import ceil, sqrt, log
from sympy.polys.polyutils import (
_sort_factors
)
from sympy.polys.polyerrors import (
ExactQuotientFailed
)
from sympy.utilities import (
any, all, cythonized
)
from sy... |
the-stack_0_8951 | # flake8: noqa: F811, F401
import asyncio
import sys
from typing import Dict, List, Optional, Tuple
import aiosqlite
import pytest
from taco.consensus.block_header_validation import validate_finished_header_block
from taco.consensus.block_record import BlockRecord
from taco.consensus.blockchain import Blockchain
from... |
the-stack_0_8954 | # -*- coding: utf-8 -*-
import logging
from abc import abstractmethod
import numpy as np
import tensorflow as tf
from jack.readers.multiple_choice.shared import AbstractSingleSupportMCModel
from jack.tfutil.attention import attention_softmax3d
from jack.tfutil.masking import mask_3d
logger = logging.getLogger(__nam... |
the-stack_0_8955 | import os
import base64
import binascii
from collections import namedtuple
import hexdump
import intervaltree
from PyQt5.QtGui import QIcon
from PyQt5.QtGui import QBrush
from PyQt5.QtGui import QPixmap
from PyQt5.QtGui import QMouseEvent
from PyQt5.QtGui import QKeySequence
from PyQt5.QtGui import QFontDatabase
impo... |
the-stack_0_8958 | import turtle
import time
import random
delay = 0.1
score = 0
high_score = 0
wn = turtle.Screen()
wn.title("Snake")
wn.bgcolor("green")
wn.setup(width=600, height=600)
wn.tracer(0)
head = turtle.Turtle()
head.speed(0)
head.shape("square")
head.color("black")
head.penup()
head.goto(0,0)
head.direction = "stop"
foo... |
the-stack_0_8959 | """
inorder: [LEFT]root[RIGHT]
postorder: [LEFT][RIGHT]root
First thing we know is the value of root, which is the last element of `postorder`.
Find the index of the root in `inorder`. So find out the interval of [LEFT] and [RIGHT] in `inorder`.
The length of the [LEFT] and [RIGHT] in `inorder` are the same with the ... |
the-stack_0_8960 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2015, PHYTEC Messtechnik GmbH
# Author: Stefan Müller-Klieser <s.mueller-klieser@phytec.de>
import sys
import argparse
import os
import shutil
from phylib import *
class BSP_SiteConfLoader(BoardSupportPackage):
"""Extends the BoardSupportPackage class wit... |
the-stack_0_8961 | import pytest
from apps.gdpr.utils import account_info_handler
pytestmark = pytest.mark.django_db
def test_account_info_handler(user):
needed_data = {
"email": user.email,
"username": user.username,
"first_name": user.first_name,
"last_name": user.last_name,
"privacy_poli... |
the-stack_0_8963 | # ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
from typing import TYPE_CHECKING
from .._internal.client_credential_base import ClientCredentialBase
if TYPE_CHECKING:
# pylint:disable=unused-import,ungrouped-imp... |
the-stack_0_8964 | import os
MILVUS_TB = "Tables"
MILVUS_TBF = "TableFiles"
METRIC_DIC = {
1: "L2",
2: "IP",
3: "HAMMING",
4: "JACCARD",
5: "TANIMOTO",
6: "SUBSTRUCTURE",
7: "SUPERSTRUCTURE"
}
H2M_YAML = {
'milvus-version': '0.10.5',
'data_path': ['/home/data/data1.hdf5', '/home/data/fdata2.hdf5'],
... |
the-stack_0_8966 | from functions_recorder import load_csv, plot_inputs_vr, plot_inputs_miniscope
import tkFileDialog
from paths import sync_path
from Tkinter import Tk
def get_tk_file(initial_path):
root = Tk()
root.withdraw()
return tkFileDialog.askopenfilenames(initialdir=initial_path, filetypes=(("csv files", "*.csv"),)... |
the-stack_0_8967 | import sys
import os
import time
import subprocess
import codecs
# Change these to match your own environment
# Do not make watchfolder = outputfolder
path_to_watch = "\path\of\watchfolder"
path_to_send = "\path\of\outputfolder"
script_to_run = "\path\of\script"
def __main__():
# Create a dictionary of all the ... |
the-stack_0_8968 | # Copyright (c) 2020 Uber Technologies, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
the-stack_0_8970 | """
File: anagram.py
Name: Jason Huang
----------------------------------
This program recursively finds all the anagram(s)
for the word input by user and terminates when the
input string matches the EXIT constant defined
at line 19
If you correctly implement this program, you should see the
number of anagrams for eac... |
the-stack_0_8971 | import operator
import numpy as np
import pytest
import pandas as pd
from pandas import DataFrame, Series
import pandas._testing as tm
class TestSeriesAnalytics:
def test_matmul(self):
# matmul test is for GH #10259
a = Series(np.random.randn(4), index=["p", "q", "r", "s"])
b = DataFrame... |
the-stack_0_8972 | #!/usr/bin/env python
# This example demonstrates the use of multiline 2D text using
# vtkTextMappers. It shows several justifications as well as
# single-line and multiple-line text inputs.
import vtk
font_size = 14
# Create the text mappers and the associated Actor2Ds.
# The font and text properties (except jus... |
the-stack_0_8974 | # -*- coding: utf-8 -*-
"""
Created on Thu Oct 21 10:09:24 2021
@author: jbt5jf
TESTING SCRIPT for the neural network
"""
import matplotlib.pyplot as plt
import numpy as np
import imageio
from skimage.transform import resize
import tqdm
import cv2
import tensorflow as tf
from tensorflow.keras imp... |
the-stack_0_8975 | """
This module contains helper functions for controlling caching. It does so by
managing the "Vary" header of responses. It includes functions to patch the
header of response objects directly and decorators that change functions to do
that header-patching themselves.
For information on the Vary header, see:
http... |
the-stack_0_8977 | from django.core.management.base import BaseCommand, CommandError
from ark.transactions import TxBroadcaster
class Command(BaseCommand):
help = 'start/stop a TxBroadcaster'
def add_arguments(self, parser):
parser.add_argument('uid', nargs=1, type=int)
parser.add_argument('network', nargs=1, t... |
the-stack_0_8983 | """Logging utilities."""
import asyncio
from asyncio.events import AbstractEventLoop
from functools import partial, wraps
import inspect
import logging
import threading
import traceback
from typing import Any, Callable, Coroutine, Optional
class HideSensitiveDataFilter(logging.Filter):
"""Filter API password call... |
the-stack_0_8984 | from netaddr import IPAddress
__all__ = [
'to_server_dict',
'to_dns_zone_dict',
'to_dns_record_dict'
]
def to_server_dict(server):
public_ips = [ip['addr'] for ip in server.addresses['public']]
private_ips = [ip['addr'] for ip in server.addresses['private']]
# Pick out first public IPv4 and ... |
the-stack_0_8987 | import IPython
import numpy as np
import pandas as pd
def display(*dfs, head: bool = True):
"""Display the dataframes in _dfs_"""
for df in dfs:
IPython.display.display(df.head() if head else df)
def reduce_mem_usage(df: pd.DataFrame, verbose: bool = False) -> pd.DataFrame:
"""Efficiently manage... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.