filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_106_26901 | # Licensed to the StackStorm, Inc ('StackStorm') 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 th... |
the-stack_106_26903 | # coding: utf-8
from .. import fixtures, config
from ..assertions import eq_
from ..config import requirements
from sqlalchemy import Integer, Unicode, UnicodeText, select, TIMESTAMP
from sqlalchemy import Date, DateTime, Time, MetaData, String, \
Text, Numeric, Float, literal, Boolean, cast, null, JSON, and_, \
... |
the-stack_106_26904 | import itertools
import json
from functools import total_ordering
from django.conf import settings
from django.forms import widgets
from django.forms.utils import flatatt
from django.template.loader import render_to_string
from django.urls import reverse
from django.utils.formats import get_format
from django.utils.fu... |
the-stack_106_26905 | import numpy as np
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
from collections import OrderedDict
import pandas as pd
from evaluator.evaluator_helpers import Categories, Sub_categories, Metrics
class Table(object):
"""docstring for Table"""
def __init__(self, arg=None)... |
the-stack_106_26908 | """
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... |
the-stack_106_26909 | import asyncio
import sys
import toml
from Server import Server
async def main(node_id, config_file):
config = toml.load(config_file)
n = config['n']
t = config['t']
server_config = config["servers"][node_id]
server = Server(n, t, server_id, server_config["host"], server_config["http_port"])
... |
the-stack_106_26911 | # -*- coding: utf-8 -*-
"""
Created on 2018/10/31
@author: gaoan
"""
import six
import pandas as pd
from tigeropen.common.util.string_utils import get_string
from tigeropen.common.response import TigerResponse
COLUMNS = ['symbol', 'settlement_date', 'short_interest', 'avg_daily_volume', 'days_to_cover', 'percent_of_... |
the-stack_106_26912 | import sys
import os
os.environ["OMP_NUM_THREADS"] = "1"
import pyDNMFk.config as config
#import pytest
config.init(0)
from pyDNMFk.pyDNMF import *
from pyDNMFk.dist_comm import *
#@pytest.mark.mpi
def test_dist_nmf_2d():
np.random.seed(100)
comm = MPI.COMM_WORLD
m, k, n = 24, 2, 12
W = np.random.ra... |
the-stack_106_26913 | """
Sfaturi de implementare:
- from lab2 import Dfa
- creati 3 obiecte Dfa pentru A3, A4 si A5, incepand de la string
- creati o clasa Lexer care primeste o lista de Dfa-uri si pentru fiecare un
nume
- creati metoda Lexer.longest_prefix care primeste un cuvant (string) si
gaseste cel mai lung prefix acceptat de 1 din D... |
the-stack_106_26914 | import sys
sys.path.insert(0, '/home/apprenant/simplon_projects/personal_diary/')
from src.config import USER, PASSWORD
from datetime import datetime
import streamlit as st
import pandas as pd
import matplotlib.pyplot as plt
import mysql.connector
import requests
import locale
locale.setlocale(locale.LC_ALL, 'fr_FR.UTF... |
the-stack_106_26918 | # coding: utf-8
# Copyright (c) 2018-2019, Taku MURAKAMI. All rights reserved.
# Distributed under the terms of the BSD 3-clause License.
from setuptools import setup
from setuptools import find_packages
with open("README.md") as file:
readme = file.read()
with open('LICENSE') as file:
license = file.read()... |
the-stack_106_26919 | # --------------
#Importing header files
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
#Reading the file
data=pd.read_csv(path)
#Code starts here
#Creating a new variable to store the value counts
loan_status = data['Loan_Status'].value_counts()
print(loan_status)
#Plotting bar plot
plt.fi... |
the-stack_106_26922 | #
# 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
# ... |
the-stack_106_26930 | """
Copyright (c) 2020 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 writin... |
the-stack_106_26931 | from django.urls import path
from . import views
urlpatterns = [
path("", views.index, name="index"),
path("edit/<str:title>", views.edit, name="edit"),
path("create", views.create, name="create"),
path("search", views.search, name="search"),
path("random", views.randompage, name="random"),
pa... |
the-stack_106_26934 | # coding: utf-8
import re
import six
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class AllowDbUserPrivilegeRequest:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict)... |
the-stack_106_26935 | q = int(input())
soma = 0
conta = input()
for i in range(12):
for j in range(12):
valor = float(input())
if(i == q):
soma += valor
if(conta == 'S'):
print("%.1f" %soma)
else:
print("%.1f" %(soma/12.0)) |
the-stack_106_26936 | from dku_utils.access import _default_if_blank, _default_if_property_blank
import dataiku
from dataiku.core.intercom import backend_json_call
from dku_utils.access import _has_not_blank_property
import json, logging
def make_overrides(config, kube_config, kube_config_path):
# alter the spark configurations to put ... |
the-stack_106_26937 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 17 15:29:18 2020
@author: mike_ubuntu
"""
import time
import numpy as np
from copy import deepcopy, copy
from functools import reduce
from moea_dd.src.moeadd_supplementary import fast_non_dominated_sorting,\
slow_non_dominated_sort... |
the-stack_106_26938 | # helper functions for shuffling bits around various formats
from __future__ import absolute_import, division
import binascii
import hashlib
import struct
import bitstring
__b58chars = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
__b58index = { k: n for n, k in enumerate(__b58chars) }
def base58_de... |
the-stack_106_26939 | import ast
import errno
import glob
import importlib
import os
import py_compile
import stat
import sys
import textwrap
import zipfile
from functools import partial
import py
import _pytest._code
import pytest
from _pytest.assertion import util
from _pytest.assertion.rewrite import _get_assertion_exprs
from _pytest.a... |
the-stack_106_26940 | import os
import os.path as osp
import time
import argparse
import torch
import torch.distributed as dist
from .logger import get_logger
from utils.pyt_utils import load_model, parse_devices, extant_file, link_file, \
ensure_dir
logger = get_logger()
# State dictation class. Register training dictations that he... |
the-stack_106_26941 | # -*- coding: utf-8 -*-
"""
Tests for discord.ext.tasks
"""
import asyncio
import datetime
import pytest
import sys
from discord import utils
from discord.ext import tasks
@pytest.mark.asyncio
async def test_explicit_initial_runs_tomorrow_single():
now = utils.utcnow()
if not ((0, 4) < (now.hour, now.m... |
the-stack_106_26943 | import argparse
import os
from random import seed
import torch
from allennlp.data.iterators import BucketIterator
from allennlp.data.vocabulary import DEFAULT_OOV_TOKEN, DEFAULT_PADDING_TOKEN
from allennlp.data.vocabulary import Vocabulary
from allennlp.modules.text_field_embedders import BasicTextFieldEmbedder
from ... |
the-stack_106_26944 | # Copyright 2017 Amazon.com, Inc. or its affiliates. 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. A copy of the License
# is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file acc... |
the-stack_106_26945 | #!/usr/bin/env python3
import requests
from bs4 import BeautifulSoup
from utils import convert_num, display_num
from tweet import twitter_post
hashtags= "\n@The Weeknd #weeknd #music #r&b #streams"
module = "Kworb Charts"
def kworb_data(group):
"""Gets Spotify charts data of an artist
It starts all the task... |
the-stack_106_26946 | from sympy import gcd
__all__ = ('phi', 'partition_sequences')
def phi(n):
""" Euler's totient function."""
assert n >= 0, 'Negative integer.'
out = 0
for i in range(1, n + 1):
if gcd(n, i) == 1:
out += 1
return out
def partition_sequences(k):
""" Generates a set of part... |
the-stack_106_26953 | """
Simple Example: Query Something
--------------------------------------------------------------------
Loads Something from disk
"""
from typing import Union, Optional
from datetime import datetime, timezone
from hopeit.app.api import event_api
from hopeit.app.context import EventContext, PostprocessHook
from hopeit... |
the-stack_106_26956 | # Copyright (c) 2017 VisualDL Authors. All Rights Reserve.
#
# 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... |
the-stack_106_26957 | # importing the requests and base64 library
import requests
import base64
import pprint
with open('file.jpg', 'rb') as image:
img = base64.b64encode(image.read()).decode("utf-8")
headers = { 'Content-Type': 'application/json', 'Accept': '*/*'}
rf = requests.post(
url = 'http://localhost:8080/selfie' ,
... |
the-stack_106_26960 | import logging
from connexion import problem
from flask import url_for
from rhub.auth.keycloak import (
KeycloakClient, KeycloakGetError, problem_from_keycloak_error,
)
from rhub.auth.utils import route_require_admin
logger = logging.getLogger(__name__)
def _role_href(role):
return {
'role': url_f... |
the-stack_106_26961 | #!/usr/bin/env python
#
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... |
the-stack_106_26962 | from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import argparse
import logging
import os
import typing
from typing import Text
from typing import Tuple
from typing import Optional
from rasa_nlu.components import Comp... |
the-stack_106_26963 | # Copyright (c) 2021 NVIDIA Corporation. All rights reserved.
# This work is licensed under the NVIDIA Source Code License - Non-commercial.
# Full text can be found in LICENSE.md
"""
We develop our own evaluation script from the official example Evaluation script for
Objectron dataset. It reads our re-sorted tfrecord... |
the-stack_106_26965 | # pylint: disable=function-redefined,no-name-in-module
from behave import given, when, then
import grpc
from google.protobuf.empty_pb2 import Empty
from client.topic_pb2 import *
@when(u'I fetch all topics')
def step_impl(context):
context.stubs.try_call(
context.stubs.topics.AllTopics,
Empty(),
)
@when... |
the-stack_106_26966 | import re
import os
import sys
import operator
import commands
from commands import *
SLUG = re.compile(r'\\(ex|in)tslug\[(?P<time>.*)\]\{(?P<location>.*)\}(\s+\% WITH (?P<transition>.*))?')
ACTOR = re.compile(r"\\@ifdefinable\{\\(?P<alias>[\w\d]+)\}{\\def\\.+\/\{(?P<actor>.+)\}\}")
DIALOGUE = re.compile(r'\\begin\{d... |
the-stack_106_26967 | # -*- coding: utf-8 -*-
from setuptools import setup
scripts = ['bin/borgcron']
packages = ['borgcron']
data_files = [('/etc/borgcron/', ['etc/cfg_example.yml'])]
install_requires = ['PyYAML']
tests_require = ['nose']
setup(name = 'borgcron',
version = '0.3',
description = 'execute borgbackup without user... |
the-stack_106_26969 | import os
from functools import lru_cache
import numpy as np
from .connection import Connection
from forest.exceptions import SearchFail
__all__ = [
"Locator"
]
class Locator(Connection):
"""Query database for path and index related to fields"""
def __init__(self, connection, directory=None):
se... |
the-stack_106_26970 | # Multithreading comparação de tempo
from threading import *
import time
def d2(n):
for x in n:
time.sleep(1)
print(x/10)
def d3(n):
for x in n:
time.sleep(1)
print(x*10)
#SEM Multithreading
n = [10,20,30,40,50]
s = time.time()
d2(n)
d3(n)
e = time.time()
print(f"Tempo gasto:... |
the-stack_106_26971 | #!/usr/bin/env python
#
# Copyright 2015 Airbus
# Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
#
# 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
#
# ... |
the-stack_106_26973 | # Copyright (C) 2017 Beijing Didi Infinity Technology and Development 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/LI... |
the-stack_106_26974 | #!/usr/bin/env python
"""Plot ROC curve of variant called data"""
########################################################################
# File: plot_variant_accuracy.py
# executable: plot_variant_accuracy.py
#
# Author: Andrew Bailey
# History: Created 01/07/19
######################################################... |
the-stack_106_26979 | from manimlib.imports import *
import os
import pyclbr
class Shapes(Scene):
#A few simple shapes
#Python 2.7 version runs in Python 3.7 without changes
def construct(self):
circle = Circle()
square = Square()
line=Line(np.array([3,0,0]),np.array([5,0,0]))
triangle=Polygon(... |
the-stack_106_26980 | from __future__ import annotations
import json
import os
import sys
from typing import TYPE_CHECKING, Any, List, Tuple, cast
from tfx.orchestration.portable import data_types
from tfx.orchestration.portable.base_executor_operator import (
BaseExecutorOperator,
)
from tfx.proto.orchestration import (
executabl... |
the-stack_106_26981 | from elasticsearch_dsl import analyzer
from django_elasticsearch_dsl import Document, Index, fields
from django_elasticsearch_dsl.registries import registry
from .models import Ad, Category, Car, Manufacturer
index_settings = {
'number_of_shards': 1,
'number_of_replicas': 0,
}
html_strip = analyzer(
'ht... |
the-stack_106_26984 | #-*-coding: utf-8-*-
#-*-coding: euc-kr-*-
import requests
import base64
def check(ip):
url = 'http://'+ip+':3500/ping'
r = requests.post(url)
if r.ok:
result = r.json()['result']
if result == 'pong': # 서버 살아있으면
return True
return False # 서버 죽었으면
def get_pose(img_name, ip)... |
the-stack_106_26987 | import pickle
import numpy as np
from ...ops.iou3d_nms import iou3d_nms_utils
from ...utils import box_utils
class DataBaseSampler(object):
def __init__(self, root_path, sampler_cfg, class_names, logger=None):
self.root_path = root_path
self.class_names = class_names
self.sampler_cfg = s... |
the-stack_106_26988 | # Copyright (C) 2021 ServiceNow, Inc.
""" Train a mittens model """
import csv
import numpy as np
import pickle
import argparse
from mittens import Mittens
def glove2dict(glove_filename):
with open(glove_filename) as f:
reader = csv.reader(f, delimiter=' ', quoting=csv.QUOTE_NONE)
embed = {line[0... |
the-stack_106_26990 | """.. Ignore pydocstyle D400.
=============
Resolwe Query
=============
.. autoclass:: resdk.ResolweQuery
:members:
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import collections
import copy
import logging
import operator
import six
class ResolweQuery(object):
""... |
the-stack_106_26991 | import os
import pickle
import time
from unittest.mock import MagicMock
import pytest
from tools import skip_if_on_windows
from xonsh.commands_cache import (
SHELL_PREDICTOR_PARSER,
CommandsCache,
predict_false,
predict_shell,
predict_true,
)
def test_commands_cache_lazy(xession):
cc = xessi... |
the-stack_106_26995 | from django.urls import path
from .views import *
urlpatterns = [
path('', deteksi_mandiri_view, name='deteksi-mandiri'),
path('<pk>/', quiz_view, name='quiz-view'),
path('<pk>/data', quiz_data_view, name='quiz-data-view'),
path('<pk>/save', save_quiz_view, name='save-quiz-view'),
path('delete/<pk... |
the-stack_106_26996 | # encoding: utf-8
from functools import reduce
import operator
import warnings
from haystack import connection_router, connections
from haystack.backends import SQ
from haystack.constants import DEFAULT_OPERATOR, ITERATOR_LOAD_PER_QUERY
from haystack.exceptions import NotHandled
from haystack.inputs import AutoQuery, ... |
the-stack_106_27000 | import torch
def vis_density(model,bbox, L= 32):
maxs = torch.max(bbox, dim=0).values
mins = torch.min(bbox, dim=0).values
x = torch.linspace(mins[0],maxs[0],steps=L).cuda()
y = torch.linspace(mins[1],maxs[1],steps=L).cuda()
z = torch.linspace(mins[2],maxs[2],steps=L).cuda()
grid_x ,grid_y,g... |
the-stack_106_27002 | #!/usr/bin/env python
__all__ = ['tucao_download']
from ..common import *
# import re
import random
import time
from xml.dom import minidom
#possible raw list types
#1. <li>type=tudou&vid=199687639</li>
#2. <li>type=tudou&vid=199506910|</li>
#3. <li>type=video&file=http://xiaoshen140731.qiniudn.com/lovestage04.flv|</l... |
the-stack_106_27003 | # -*- coding: utf-8 -*-
"""
test_data
~~~~~~~~~
Test `data` module for `mrtool` package.
"""
import numpy as np
import pandas as pd
import xarray as xr
import pytest
from mrtool import MRData
@pytest.fixture()
def df():
num_obs = 5
df = pd.DataFrame({
'obs': np.random.randn(num_obs),
... |
the-stack_106_27004 | #@+leo-ver=4-thin
#@+node:bob.20080109185406.1:@thin gtkDialogs.py
#@@language python
#@@tabwidth -4
#@<< docstring >>
#@+node:bob.20071220105852:<< docstring >>
"""Replace Tk dialogs with Gtk dialogs.
At the moment this plugin only replaces Tk's file dialogs, but
other dialogs may be replaced in future.
This plugin ... |
the-stack_106_27005 | #!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... |
the-stack_106_27011 | from ui import UiFrame, Vect, BLACK, WHITE, YELLOW
class UiRain(UiFrame):
def __init__(self, ofs, dim):
super().__init__(ofs, dim)
def draw(self, ui, d):
# Pre-calculates some range values and draw icons bar
forecast = ui.forecast.forecast
cnt = len(foreca... |
the-stack_106_27012 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from functools import lru_cache, wraps
import logging
import pandas as pd
import numpy as np
from reco_utils.common.constants import (
DEFAULT_USER_COL,
DEFAULT_ITEM_COL,
DEFAULT_RATING_COL,
DEFAULT_LABEL_CO... |
the-stack_106_27013 | '''
# Singin Module
Sing-ins the user with url given
(appType:2)
'''
from .. import session
from bs4 import BeautifulSoup
from utils.myutils import urlparams
import logging
logger = logging.getLogger('Singin')
def NormalSingin(singin_url) -> str:
'''
# 签到、手势签到
Returns a string suggesting ... |
the-stack_106_27017 | # Copyright (c) Microsoft Corporation
# All rights reserved.
#
# MIT License
#
# 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 ... |
the-stack_106_27019 | from typing import Set, Optional, Sequence, Tuple
from specs import BeaconState, VALIDATOR_REGISTRY_LIMIT, ValidatorIndex, Attestation
from eth2spec.utils.ssz.ssz_typing import Container, List, uint64
class NetworkSetIndex(uint64):
pass
class NetworkSet(Container):
validators: List[ValidatorIndex, VALIDATOR_... |
the-stack_106_27021 | from bokeh.io import output_file, show
from bokeh.models import ColumnDataSource
from bokeh.plotting import figure
from bokeh.transform import dodge
output_file("dodged_bars.html")
fruits = ['Apples', 'Pears', 'Nectarines', 'Plums', 'Grapes', 'Strawberries']
years = ['2015', '2016', '2017']
data = {'fruits' : fruits... |
the-stack_106_27022 | import re
import json
import string
import random
from steemapi.steemclient import SteemNodeRPC
from steembase.account import PrivateKey, PublicKey, Address
import steembase.transactions as transactions
from .utils import (
resolveIdentifier,
constructIdentifier,
derivePermlink,
formatTimeString
)
from ... |
the-stack_106_27023 | # This file is executed on every boot (including wake-boot from deepsleep)
#import esp
#esp.osdebug(None)
import gc
#import webrepl
#webrepl.start()
gc.collect()
from machine import Pin, PWM
from neopixel import NeoPixel
from time import sleep
flash = Pin(0, Pin.IN) # D3/FLASH
led = Pin(5, Pin.OUT) ... |
the-stack_106_27024 | import os
import pathlib
import re
from collections.abc import Container, Iterable, Mapping, MutableMapping, Sized
from urllib.parse import unquote
import pytest
from yarl import URL
import aiohttp
from aiohttp import hdrs, web
from aiohttp.test_utils import make_mocked_request
from aiohttp.web import HTTPMethodNotAl... |
the-stack_106_27025 | import os, warnings, time, tempfile, datetime, pathlib, shutil, subprocess
from tqdm import tqdm
from urllib.request import urlopen
from urllib.parse import urlparse
import cv2
from scipy.ndimage import find_objects, gaussian_filter, generate_binary_structure, label, maximum_filter1d, binary_fill_holes
from scipy.spati... |
the-stack_106_27026 | from database.databasehandler import MariaDB_handler
import database.pricesModel as pricemodel
from prices.prices_api import PricesAPI
from datetime import datetime, timedelta
class PriceDB():
def __init__(self, priceDBConfig):
self.priceAPI = PricesAPI()
self.priceDB = MariaDB_handler(**priceDBCo... |
the-stack_106_27034 | class Beam(object):
def __init__(self, opt, tokens, log_probs, state, prev_attn, p_gens, coverage=None, three_grams=[], bi_grams=[]):
""" Args:
tokens: List of integers. The ids of the tokens that form the summary so far.
log_probs: List, same length as tokens, of floats, giving the log proba... |
the-stack_106_27035 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''zgls.py - Waqas Bhatti (wbhatti@astro.princeton.edu) - Jan 2017
Contains the Zechmeister & Kurster (2002) Generalized Lomb-Scargle period-search
algorithm implementation for periodbase.
'''
#############
## LOGGING ##
#############
import logging
from datetime impor... |
the-stack_106_27037 | # -*- coding: utf-8 -*-
"""
examples.py: copy example files to a specified directory
Source repository: http://github.com/tdda/tdda
License: MIT
Copyright (c) Stochastic Solutions Limited 2016-2017
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
imp... |
the-stack_106_27039 | """
双向链表
"""
class Node:
def __init__(self, elem, _next=None):
self.elem = elem
self.next = _next
self.pre = None
class DLinkList:
def __init__(self):
self._head = None
def is_empty(self):
return self._head is None
def length(self):
cur = self._h... |
the-stack_106_27040 | """Config Flow using OAuth2.
This module exists of the following parts:
- OAuth2 config flow which supports multiple OAuth2 implementations
- OAuth2 implementation that works with local provided client ID/secret
"""
from __future__ import annotations
from abc import ABC, ABCMeta, abstractmethod
import asyncio
from... |
the-stack_106_27041 | from random import choice
from string import ascii_uppercase
from torch.utils.data import DataLoader
from torchvision.transforms import transforms
import os
from configs import global_config, paths_config
import wandb
from training.coaches.multi_id_coach import MultiIDCoach
from training.coaches.single_id_coach import... |
the-stack_106_27042 | # Copyright 2017, OpenCensus 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 applicable law or agreed to in w... |
the-stack_106_27043 | import os
import sys
import pprint
import traceback
from random import randint
pp = pprint.PrettyPrinter(depth=6)
root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(root + '/python')
# import ccxt # noqa: E402
import ccxt.async_support as ccxt # noqa: E402
import as... |
the-stack_106_27046 | from collections import deque
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
def is_symmetric(root):
queue = deque([root])
while queue:
level = []
for _ in range(len(queue)):
node ... |
the-stack_106_27047 | import argparse
import chainer
from chainer import iterators
from chainercv.datasets import ade20k_semantic_segmentation_label_names
from chainercv.datasets import ADE20KSemanticSegmentationDataset
from chainercv.datasets import camvid_label_names
from chainercv.datasets import CamVidDataset
from chainercv.datasets i... |
the-stack_106_27050 | # =============================================================================
# TASK PARAMETER DEFINITION (should appear on GUI) init trial objects values
# =============================================================================
# SOUND, AMBIENT SENSOR, AND VIDEO RECORDINGS
RECORD_SOUND = True
RECORD_AMBIE... |
the-stack_106_27053 | """
Invoke entrypoint, import here all the tasks we want to make available
"""
import os
from invoke import Collection
from . import agent, android, benchmarks, customaction, docker, dogstatsd, pylauncher, cluster_agent, systray, release
from .go import fmt, lint, vet, cyclo, ineffassign, misspell, deps, reset
from .... |
the-stack_106_27055 | import numpy as np
import cvxpy as cp
import networkx as nx
from scipy import linalg
def greedy_independent_set(graph):
"""
:param graph: (nx.classes.graph.Graph) An undirected graph with no
self-loops or multiple edges. The graph can either be weighted or
unweighted, although the problem only... |
the-stack_106_27056 | import locale
import logging
import os
import wx
from flask_restful import Resource
from orangeshare import Config
class GetDataFrame(wx.Frame):
def __init__(self, parent, id, title, orange_share, newer_version):
"""
:param newer_version: The new available version of orangeshare
:param o... |
the-stack_106_27058 | from abc import ABCMeta, abstractmethod
from contextlib import suppress
from pocs.base import PanBase
from pocs.camera.camera import AbstractCamera
from pocs.utils import error
from pocs.utils.library import load_library
from pocs.utils.logger import get_root_logger
class AbstractSDKDriver(PanBase, metaclass=ABCMeta... |
the-stack_106_27062 | def front_and_back_search(lst, item):
'''
args:
lst: an unsorted array of integers
item: data to be found
return:
item which is found else False
'''
rear=0
front=len(lst)-1
u=None
if rear>front:
return False
else:
while rear<=front:
if item==l... |
the-stack_106_27063 | import os.path
import tempfile
import logging
from binascii import unhexlify
from urllib.request import urlopen
from torba.client.errors import InsufficientFundsError
from lbry.testcase import CommandTestCase
from lbry.wallet.transaction import Transaction
log = logging.getLogger(__name__)
class ClaimTestCase(Co... |
the-stack_106_27065 | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from pytorch_a2c_ppo_acktr.utils import AddBias, init, init_normc_
"""
Modify standard PyTorch distributions so they are compatible with this code.
"""
FixedCategorical = torch.distributions.Categorical
old_sample = FixedCategorical.samp... |
the-stack_106_27066 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... |
the-stack_106_27067 | # 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
# d... |
the-stack_106_27068 | # 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
# distributed under t... |
the-stack_106_27069 | # Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.
from __future__ import absolute_import
from cef_version import VersionFormatter
from date_util import *
from file_util import *
from o... |
the-stack_106_27071 | #
# 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... |
the-stack_106_27072 | import os
from shapely.geometry import Point
from geospark.core.enums import FileDataSplitter, GridType, IndexType
from geospark.core.geom.envelope import Envelope
from tests.tools import tests_path
input_location = os.path.join(tests_path, "resources/crs-test-point.csv")
offset = 0
splitter = FileDataSplitter.CSV
g... |
the-stack_106_27075 | import math
#Coding Exercise 2:
#1.
x=50
print (x+50, 2*x-10)
#2
#30+*6 => error
print(6**6,6^6, 6+6+6+6+6+6) # 6^6 defaults to 6.__xor__(6)
#3
print("Hello World", "Hello World : 10")
#4
pv=int(input("Enter the present value of the loan, the interest, and the time the loan will be paid out, respecti... |
the-stack_106_27076 | """Login classes and functions for Simple-Salesforce
Heavily Modified from RestForce 1.0.0
"""
DEFAULT_CLIENT_ID_PREFIX = 'RestForce'
import time
import xml
import warnings
import xmltodict
from datetime import datetime, timedelta
from html import escape
from json.decoder import JSONDecodeError
import requests
fro... |
the-stack_106_27077 | import unittest
class StackEntry:
def __init__(self, element: int, min_value: 'StackEntry'):
self.element = element
self.min_value = min_value
def __repr__(self):
return repr('StackEntry({0})'.format(self.element))
class MinStack:
"""
Design a stack that supports push, pop,... |
the-stack_106_27078 | from PyQt5.QtCore import Qt, pyqtSlot
from PyQt5.QtGui import QImage, QPixmap
from PyQt5.QtWidgets import QLabel
class CamLabel(QLabel):
def __init__(self, parent):
super().__init__(parent)
self._image = None
self.setMinimumWidth(480)
self.setMinimumHeight(360)
def image(self):
return self._image
def ... |
the-stack_106_27080 | # (C) Datadog, Inc. 2018
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from setuptools import setup
from codecs import open # To use a consistent encoding
from os import path
HERE = path.abspath(path.dirname(__file__))
# Get version info
ABOUT = {}
with open(path.join(HERE, "datad... |
the-stack_106_27085 | import os, subprocess, gzip
from sift import Sift
className = "LoweSift"
class LoweSift(Sift):
win32Executable = "sift-lowe/siftWin32.exe"
linuxExecutable = "sift-lowe/sift"
def __init__(self, distrDir):
Sift.__init__(self, distrDir)
def extract(self, photo, photoInfo):... |
the-stack_106_27086 | # SPDX-License-Identifier: MIT
#
# Copyright (c) 2021 The Anvil Extras project team members listed at
# https://github.com/anvilistas/anvil-extras/graphs/contributors
#
# This software is published at https://github.com/anvilistas/anvil-extras
import anvil
from anvil.js.window import jQuery as _S
from ._anvil_designer... |
the-stack_106_27087 | # -*- coding: utf-8 -*-
# imageio is distributed under the terms of the (new) BSD License.
""" Storage of image data in tiff format.
"""
import datetime
from .. import formats
from ..core import Format
import numpy as np
_tifffile = None # Defer loading to lib() function.
def load_lib():
global _tifffile
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.