filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_106_24775 | # conflicts with isort because of local non-relative import
# pylint: disable=wrong-import-order
import logging
import os
import sys
from datetime import datetime, timedelta
from dependencies import logger
from models.tortoise_models import (
AuthEvents,
DispenserState,
DoorState,
FleetState,
Hea... |
the-stack_106_24776 | import hash_ssz
from beacon_chain.state import crystallized_state as cs
from ssz import ssz
import time
from hashlib import blake2b
def hash(x):
return blake2b(x).digest()[:32]
v = cs.ValidatorRecord(pubkey=3**160, withdrawal_shard=567, withdrawal_address=b'\x35' * 20, randao_commitment=b'\x57' * 20, balance=32 *... |
the-stack_106_24777 | # (C) Datadog, Inc. 2018
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import copy
import importlib
import inspect
import json
import logging
import re
import traceback
import unicodedata
from collections import defaultdict
from os.path import basename
import yaml
from six import PY... |
the-stack_106_24778 | from django.urls import path
from django.conf import settings
from django.conf.urls.static import static
from . import views
app_name = 'onlinecourse'
urlpatterns = [
# route is a string contains a URL pattern
# view refers to the view function
# name the URL
path(route='', view=views.CourseListView.as... |
the-stack_106_24779 | # -*- coding: utf-8 -*-
"""Test suite for lower bounding techniques."""
import numpy as np
import pandas as pd
import pytest
from sktime.distances.lower_bounding import LowerBounding
from sktime.distances.tests._utils import create_test_distance_numpy
def _validate_bounding_result(
matrix: np.ndarray,
x: np.... |
the-stack_106_24784 | # coding: utf-8
"""
ThingsBoard REST API
ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501
OpenAPI spec version: 3.3.3PAAS-RC1
Contact: info@thingsboard.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F40... |
the-stack_106_24785 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Kvirt config class
"""
from distutils.spawn import find_executable
from kvirt.defaults import (NETS, POOL, CPUMODEL, NUMCPUS, MEMORY, DISKS,
DISKSIZE, DISKINTERFACE, DISKTHIN, GUESTID,
VNC, CLOUDINIT, RESERVEIP, R... |
the-stack_106_24786 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import pickle
import sys
import traceback
from ray.rllib.utils.annotations import PublicAPI
from ray.rllib.utils.policy_client import PolicyClient
if sys.version_info[0] == 2:
from SimpleHTTPServer import... |
the-stack_106_24787 | """Test c_cpp_properties flags generation."""
import imp
from os import path, environ
from unittest import TestCase
from EasyClangComplete.plugin.flags_sources import c_cpp_properties
from EasyClangComplete.plugin import tools
from EasyClangComplete.plugin.utils import flag
imp.reload(c_cpp_properties)
imp.reload(too... |
the-stack_106_24788 | from django.db import migrations
from cms.djangoapps.contentstore.config.waffle import ENABLE_CHECKLISTS_QUALITY
def create_flag(apps, schema_editor):
Flag = apps.get_model('waffle', 'Flag')
# Replacement for flag_undefined_default=True on flag definition
Flag.objects.get_or_create(name=ENABLE_CHECKLISTS... |
the-stack_106_24789 | # Copyright 2019 The TensorFlow Authors. All Rights Reserved.
# Copyright 2022 Northern System Service 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
#
# h... |
the-stack_106_24790 | #! /usr/bin/env python
import numpy as np
import pytest
from numpy.testing import assert_array_equal
from landlab.field import FieldError, GroupError
from landlab.field.graph_field import GraphFields as ModelDataFields
def test_init():
fields = ModelDataFields()
assert set() == fields.groups
# assert_set... |
the-stack_106_24792 | """
This file offers the methods to automatically retrieve the graph Lactobacillus curieae.
The graph is automatically retrieved from the STRING repository.
References
---------------------
Please cite the following if you use the data:
```bib
@article{szklarczyk2019string,
title={STRING v11: protein--protein ... |
the-stack_106_24793 | """Device handler for centralite motion (only) sensors."""
from zigpy.profiles import zha
from zigpy.quirks import CustomDevice
from zigpy.zcl.clusters.general import Basic, Identify, Ota, PollControl
from zigpy.zcl.clusters.measurement import TemperatureMeasurement
from zigpy.zcl.clusters.security import IasZone
from... |
the-stack_106_24794 | from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from insta_constants.xpath_constants import *
from insta_constants.user_constants import *
from time import sleep
class Instabot:
def __init__(self, username, password):
self.username = username
self.password =... |
the-stack_106_24795 | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import datetime
import os
import platform
import time
from subprocess import call
import requests
class SlotChecker:
def __init__(self):
self.DISTRICT_IDS = [(188, "Gurgaon")] # (149, "South Delhi") #
self.NUM_WEEKS ... |
the-stack_106_24796 | import torch
import torch.nn as nn
import numpy as np
import sys
import os
import torch.nn.functional as F
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT_DIR = os.path.dirname(BASE_DIR)
sys.path.append(BASE_DIR)
sys.path.append(os.path.join(ROOT_DIR, 'pointnet2'))
import pointnet2_utils
class PointsObjC... |
the-stack_106_24797 | # Copyright (c) 2016 Cisco Systems 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 re... |
the-stack_106_24799 | from __future__ import annotations
from datetime import timedelta
import operator
from typing import (
TYPE_CHECKING,
Any,
Callable,
Sequence,
)
import numpy as np
from pandas._libs.arrays import NDArrayBacked
from pandas._libs.tslibs import (
BaseOffset,
NaT,
NaTType,
Timedelta,
... |
the-stack_106_24801 | from random import random, choice
from random import seed as set_seed
from math import atan2
import cairo
# ~~~~~~~~ class for graph nodes ~~~~~~~~
class node:
def __init__(self,x,y,z):
self.x = x
self.y = y
self.z = z
self.flux = 0
self.population = 0
self.danger... |
the-stack_106_24802 | # https://www.geeksforgeeks.org/avl-tree-set-1-insertion/
class Node:
def __init__(self, val):
self.val = val
self.left = None
self.right = None
self.height = 1
def insert(node, val):
if not node:
return Node(val)
if val <= node.val:
node.left = insert(node.left, val)
elif node.val <... |
the-stack_106_24803 | import os
flags = [
'-x',
'c++',
'-isystem',
'/usr/local/Cellar/llvm/6.0.0/include/c++/v1',
'-isystem',
'/usr/local/include',
'-isystem',
'/usr/local/Cellar/llvm/6.0.0/lib/clang/6.0.0/include',
'-isystem',
'/usr/include',
'-isystem',
'/System/Library/Frameworks'
'-is... |
the-stack_106_24804 | from __future__ import annotations
import sys
import types
from typing import (
Any,
ClassVar,
FrozenSet,
Generator,
Iterable,
Iterator,
List,
NoReturn,
Tuple,
Type,
TypeVar,
TYPE_CHECKING,
)
import numpy as np
__all__ = ["_GenericAlias", "NDArray"... |
the-stack_106_24806 | """
Title: The Functional API
Author: [fchollet](https://twitter.com/fchollet)
Date created: 2019/03/01
Last modified: 2020/04/12
Description: Complete guide to the functional API.
"""
"""
## Setup
"""
import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
"""
## I... |
the-stack_106_24808 | import os
import yaml
from datetime import datetime
import yamldown
from jinja2 import Environment, Template, FileSystemLoader
from .markdown import md
stage1_template = """
{%- if extends -%}
{% raw %}{%{% endraw %} extends '{{ extends }}' {% raw %}%}{% endraw %}
{%- endif %}
{% raw %}{% block page %}{% endraw %}
{{ ... |
the-stack_106_24810 | from talon import actions, Module, speech_system
from typing import Any, List
mod = Module()
last_phrase = None
def on_phrase(d):
global last_phrase
last_phrase = d
speech_system.register("pre:phrase", on_phrase)
class NotSet:
def __repr__(self):
return "<argument not set>"
@mod.action_cla... |
the-stack_106_24811 | # Copyright 2017 NTT Corporation.
#
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... |
the-stack_106_24813 | #!/usr/bin/python
#
# Copyright 2002-2021 Barcelona Supercomputing Center (www.bsc.es)
#
# 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_106_24816 | # Given an n x n matrix mat[n][n] of integers,
# find the maximum value of mat(c, d) – mat(a, b)
# over all choices of indexes such that both c > a and d > b.
import sys
# TC: O(CxR) | SC: O(CxR)
def find_max_diff(matrix):
# max difference
max_value = -sys.maxsize-1
# print(max_value)
# temp matri... |
the-stack_106_24820 | # encoding: UTF-8
# api: streamtuner2
# title: RadioBrowser
# description: Community collection of stations; votes, clicks, homepage links.
# version: 0.3
# type: channel
# url: http://www.radio-browser.info/
# category: radio
# priority: optional
# config:
# { type=select, name=radiobrowser_cat, value=tags, select="... |
the-stack_106_24824 | from selenium import webdriver
from fixture.session import SessionHelper
from fixture.group import GroupHelper
from fixture.contact import ContactHelper
class Application:
def __init__(self, browser, base_url):
if browser == "firefox":
self.wd = webdriver.Firefox()
elif browser == "chr... |
the-stack_106_24825 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
the-stack_106_24828 | # 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_106_24829 | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
the-stack_106_24830 | #!/Users/apple/Desktop/PGalla/virtual/bin/python3.6
#
# The Python Imaging Library
# $Id$
#
from __future__ import print_function
import sys
if sys.version_info[0] > 2:
import tkinter
else:
import Tkinter as tkinter
from PIL import Image, ImageTk
# ---------------------------------------------------------... |
the-stack_106_24831 | # pylint: disable=E1101
# Copyright (C) 2018 The Android Open Source Project
#
# 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 require... |
the-stack_106_24833 | import os
from pathlib import Path
import pickle
import numpy as np
import jittor_utils
from jittor_utils import LOG
import sys
jittor_utils.try_import_jit_utils_core()
has_error = 0
def convert(data):
if isinstance(data, tuple):
return tuple( convert(v) for v in data )
if isinstance(data, list):
... |
the-stack_106_24834 | ###_________ Introduction to automatic learning with scikit-learn __________###
# En los últimos tiempos habrás oído hablar de _machine learning_, _deep learning_,
# _reinforcement learning_, muchas más cosas que contienen la palabra _learning_ y,
# por supuesto, _Big Data_. Con los avances en capacidad de cálculo d... |
the-stack_106_24835 | import textwrap
from conan.tools.cmake.base import CMakeToolchainBase
class CMakeiOSToolchain(CMakeToolchainBase):
_toolchain_tpl = textwrap.dedent("""
{% extends 'base_toolchain' %}
{% block before_try_compile %}
{{ super() }}
# set cmake vars
set(CMAKE_SYSTEM... |
the-stack_106_24836 | import io
import htic
CVT = "cvt{ \n 0 cvt0 \n 10 cvt1 \n 20 cvt2 \n}"
FLAGS = "flags{ x 1 \n m 11110 \n}"
FPGM = "fpgm{ FDEF 0 func0 val \n POP \n ENDF \n FDEF 1 func1 val \n POP \n ENDF \n}"
FPGMPARAMS = "fpgm{ FDEF 0 func0 val pt cvt func stor \n POP \n POP \n POP \n POP \n POP \n ENDF \n}"
def getData(code):
p... |
the-stack_106_24839 | from cv2 import cv2
import time
import pyautogui
import numpy as np
import mss
from os import listdir
# from run import getBackgroundText
import torch
from random import randint
# example_captcha_img = cv2.imread('images/example.png')
model = torch.hub.load('./captcha', 'custom', "captcha/bomb_captcha.pt", source='lo... |
the-stack_106_24840 | from theano import gof
class TypedListType(gof.Type):
def __init__(self, ttype, depth=0):
"""
:Parameters:
-'ttype' : Type of theano variable this list
will contains, can be another list.
-'depth' : Optionnal parameters, any value
above 0 will creat... |
the-stack_106_24841 | # Copyright (c) 2019 PaddlePaddle 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_24842 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
import inspect
import sys
def get_locale(name):
'''Returns an appropriate :class:`Locale <locale.Locale>` corresponding
to an inpute locale name.
:param name: the name of the locale.
'''
loca... |
the-stack_106_24845 | #!/usr/bin/env python3
#
# Copyright (c) 2017 Weitian LI <weitian@aaronly.me>
# MIT License
#
"""
Calculate the mean values of the cube.
"""
import argparse
import numpy as np
def main():
parser = argparse.ArgumentParser(
description="Calculate the mean value of the data cube")
parser.add_argument(... |
the-stack_106_24849 | #
# 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_24850 | import _plotly_utils.basevalidators
class StreamValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="stream", parent_name="ohlc", **kwargs):
super(StreamValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
da... |
the-stack_106_24851 | """
LED.py
Code by Sammy Haq
https://github.com/sammyhaq
Child class of OutputComponent that adds exclusive functions to LEDs.
"""
from OutputComponent import OutputComponent
import time
class LED(OutputComponent):
def __init__(self, pin):
OutputComponent.__init__(self, pin)
def breathe(self, dura... |
the-stack_106_24852 | """
=========
SMOTE SVM
=========
An illustration of the random SMOTE SVM method.
"""
print(__doc__)
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
# Define some color for the plotting
almost_black = '#262626'
palette = sns.color_palette()
from sklearn.datasets import make_classification
from skl... |
the-stack_106_24853 | # -----------------------------------------------------------
# Stacked Cross Attention Network implementation based on
# https://arxiv.org/abs/1803.08024.
# "Stacked Cross Attention for Image-Text Matching"
# Kuang-Huei Lee, Xi Chen, Gang Hua, Houdong Hu, Xiaodong He
#
# Writen by Kuang-Huei Lee, 2018
# -------------... |
the-stack_106_24855 | import functools
import math
from collections import defaultdict
from ..core import (Add, Basic, Dummy, E, Integer, Mul, Pow, Rational, cacheit,
count_ops, expand_log, expand_mul, factor_terms)
from ..core.mul import _keep_coeff
from ..core.rules import Transform
from ..core.sympify import sympify
... |
the-stack_106_24856 | from lxml import etree
import requests
if __name__ == "__main__":
url = "https://blog.csdn.net/yhl_jxy"
html = requests.get(url).text
parser = etree.HTML(html)
# title = parser.xpath("//*[@id='archive']/div[1]/div[2]/p[1]/a[1]/text()")
# titles = parser.xpath("//a[@class='archive-title']/@href")
... |
the-stack_106_24857 | # Copyright (c) 2015 OpenStack Foundation
#
# 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_24858 | import concurrent.futures
import os
import gzip
import pickle
import os.path as osp
import random
import time
import pydicom
import numpy as np
from pylinac import image
from scipy.misc import imresize
from sklearn import svm, metrics, preprocessing, model_selection
def is_dicom(path):
"""Whether the file is a r... |
the-stack_106_24859 | from setuptools import setup, find_packages
version = "0.1"
setup(
name = "pyhdwallet",
version = version,
packages = find_packages(),
package_data = {
'': ['_bip32/data/*.db'],
},
#data_files=[('pyhdwallet/_bip32/data/bip32version.db', 'pyhdwallet/_bip32/data')],
install_requires ... |
the-stack_106_24861 | from setuptools import setup, find_packages
from rost.__version__ import VERSION
NAME = 'rost'
DESCRIPTION = 'A simple static site generator based on Jinja2 with a CLI build using Click.'
KEYWORDS = 'HTML, Jinja2, Click'
URL = 'https://github.com/Robert-96/rost'
EMAIL = 'dezmereanrobert@gmail.com'
AUTHOR = 'Robert-... |
the-stack_106_24862 | from mmdet.apis import init_detector, inference_detector
config_file = 'configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py'
device = 'cuda:0'
# init a detector
model = init_detector(config_file, device=device)
# inference the demo image
inference_detector(model, 'demo/demo.jpg')
|
the-stack_106_24863 | # -*- coding: utf-8 -*-
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent.parent.absolute()))
# -- Project information -----------------------------------------------------
project = "BioPAL"
author = "BioPAL team"
copyright = "2021, BioPAL team"
# -- General configuration ------------... |
the-stack_106_24864 | __author__ = 'Calvin'
try:
from builtins import range
except ImportError:
range = xrange
from pyperform import *
class SomeClass(object): #!
def __init__(self, n):
self.n = n
self.count = 0
if n > 0:
self.a = SomeClass(n-1)
def func(self):
self.count += 1
... |
the-stack_106_24865 | from utility import *
"""This class deals only in gene strings, not Flower objects"""
class BreedingResult:
# lists probabilities of each gene pair outcome
combinations = {
'00':[("0", 1.0)],
'01':[("0", 0.5), ("1", 0.5)],
'02':[("1", 1.0)],
... |
the-stack_106_24866 | # pylint: disable=invalid-name,line-too-long,too-many-locals,too-many-arguments,too-many-branches,too-many-statements,stop-iteration-return
import os
import math
import glob
import typing
import random
import zipfile
import string
import itertools
import cv2
import tqdm
import numpy as np
import essential_generators
i... |
the-stack_106_24867 | #!/usr/bin/env python
# coding: utf-8
# In[83]:
import itertools
import csv
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn import preprocessing
from sklearn.tree import DecisionTreeClassifier
import scipy.optimize as opt
import pylab as pl
import scipy.optimize as opt
from sklear... |
the-stack_106_24868 |
class TasksCli:
def __init__(self, git, tasks):
self.git = git
self.tasks = tasks
def add_subparser(self, subparsers):
task_parser = subparsers.add_parser('task', help="Remember tasks for a given branch")
task_parser.add_argument("add", nargs="?", type=str, default=None, help=... |
the-stack_106_24869 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals, print_function
import frappe
import time
from frappe import _, msgprint
from frappe.utils import flt, cstr, now, get_datetime_str, file_lock, date_diff
from frappe.utils.backgrou... |
the-stack_106_24871 | """ Functions to implement the randomized optimization and search algorithms.
"""
# Author: Genevieve Hayes (modified by Andrew Rollings)
# License: BSD 3 clause
import numpy as np
import itertools
from mlrose_hiive.decorators import short_name
@short_name('mimic')
def mimic(problem, pop_size=200, keep_pct=0.2, ma... |
the-stack_106_24872 | import logging
from typing import Generator, Any, Union, Dict
def get_inner_dict(source_dict, path_as_list):
result = source_dict
for index in path_as_list:
result = result[index]
return result
def merge_dicts(*dicts: Dict[Any, Any]) -> Dict[Any, Any]:
"""
Merges two or more dicts. If th... |
the-stack_106_24874 | # -*- coding: utf-8 -*-
'''
Edit ini files
:maintainer: <akilesh1597@gmail.com>
:maturity: new
:depends: re
:platform: all
(for example /etc/sysctl.conf)
'''
# Import Python libs
from __future__ import absolute_import, print_function
import os
import re
# Import Salt libs
import salt.utils.files
import salt.utils.js... |
the-stack_106_24875 | import torch as T
import sys
sys.path.append('/content/drive/MyDrive/xyz_master/master_thesis')
from xyzModel import CriticNetwork,ActorNetwork
class Agent:
def __init__(self, actor_dims, critic_dims, n_actions, n_agents, agent_idx, chkpt_dir,
alpha, beta, fc1,
fc2, gamma, t... |
the-stack_106_24876 | import numpy
import h5py
import csv
def h5_to_csv(infilepath, outfilepath):
fin = h5py.File(filepath, 'r')
data = fin["rows"]
num_rows = data.shape[0]
print('The h5 data have ' + str(num_rows) + ' rows and ' + str(data.shape[1]) + ' columns.')
writer = csv.writer(open(outfilepath, 'w'))
f... |
the-stack_106_24883 | import os
import subprocess as sp
import warnings
import numpy as np
from moviepy.config import FFMPEG_BINARY
from moviepy.video.io.ffmpeg_reader import ffmpeg_parse_infos
class FFMPEG_AudioReader:
"""
A class to read the audio in either video files or audio files
using ffmpeg. ffmpeg will read any audi... |
the-stack_106_24886 | import logging
import socket
import subprocess
import time
from datetime import datetime
from .adapter import Adapter
MINICAP_REMOTE_ADDR = "localabstract:minicap"
ROTATION_CHECK_INTERVAL_S = 1 # Check rotation once per second
class MinicapException(Exception):
"""
Exception in minicap connection
"""
... |
the-stack_106_24887 | #!/usr/bin/env python3
"""
Requires:
python-mnist
numpy
sklearn
"""
import mnist
import numpy as np
from numpy.linalg import norm as l21_norm
from sklearn.metrics.cluster import normalized_mutual_info_score as nmi
gamma = .005
epsilon = 1e-5
# Download t10k_* from http://yann.lecun.com/exdb/mnist/
# Change to dire... |
the-stack_106_24891 | from flask import abort, request, Blueprint
import contextlib
import hmac
from ..utils import warn, parse_lease_seconds, calculate_hmac
NOT_FOUND = "Could not found subscription with callback id '%s'"
def build_blueprint(subscriber, url_prefix):
name = 'websub_callbacks' + url_prefix.replace('/', '_')
call... |
the-stack_106_24892 | from __future__ import annotations
from typing import Callable
from typing import NoReturn
from ...base import BaseEstimator
import numpy as np
from ...metrics import misclassification_error
def default_callback(fit: Perceptron, x: np.ndarray, y: int):
pass
class Perceptron(BaseEstimator):
"""
Perceptr... |
the-stack_106_24893 | # Based on http://www.nytimes.com/interactive/2012/08/05/sports/olympics/the-100-meter-dash-one-race-every-medalist-ever.html
from bokeh.plotting import figure, show, output_file
from bokeh.models import (
ColumnDataSource,
Range1d, DataRange1d,
LinearAxis, SingleIntervalTicker, FixedTicker,
Label, Arr... |
the-stack_106_24894 | # -*- coding: utf-8 -*-
import os
import orjson
from pytest import fixture
FIXTURE_DIR = os.path.join("fixture_data")
@fixture
def showdown_format_teams(raw_team_data):
data = {}
for format_, team_list in raw_team_data.items():
data[format_] = []
for team_info in team_list:
wit... |
the-stack_106_24897 | #coding: utf-8
from time import sleep
from flask import render_template, request, jsonify
from app import app
import panasonic_viera
import unidecode
import collections
def arrow_keys(command):
global rc
print(command)
if(command[0:9] == "seleciona"):
rc.send_key(panasonic_viera.Keys.enter)
... |
the-stack_106_24898 | import discord
import json
from random import randint
from discord.ext import commands
from gex import *
#
# Get Discord bot token
#
try:
# NOTE: add auth.json at root with the token as the only field
# e.g. { "token": "some_random_token_value" }
with open('auth.json', 'r') as file:
auth_token = ... |
the-stack_106_24899 | import matplotlib.pyplot as plt
import numpy as np
import pyvista as pv
sst = pv.read("pdata_xy_sst_t0.vtk")
cmap = "fire" # colorcet (perceptually accurate) color maps
sargs = dict(
shadow=True,
n_labels=5,
italic=False,
fmt="%.1f",
font_family="cour... |
the-stack_106_24900 | # created by Chirath R <chirath.02@gmail.com>
from django import forms
from technical_resources.models import Category, File, Link
class CategoryForm(forms.ModelForm):
name = forms.CharField(label='Category name', help_text='Enter category name, example: Python, C, OS...',
widget=form... |
the-stack_106_24901 | # -*- coding: utf-8 -*-
"""Exemplo de CRUD com Python, SQLAlchemy e SQLite3."""
from sqlalchemy import Column, Integer, String, create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
# Para debug utilizar ``echo=True``:
# engine = create_engine('sqlite:///db.sqli... |
the-stack_106_24902 | class lazy_property(object):
def __init__(self, fget):
self.fget = fget
self.func_name = fget.__name__
def __get__(self, obj, cls):
if obj is None:
return None
value = self.fget(obj)
setattr(obj, self.func_name, value)
return value
class Test(object... |
the-stack_106_24907 | # -*- coding: utf-8 -*-
import threading
from iconThreadModule import PackThread
import file_operate
from time import sleep
class packThreadManager(object):
"""
"""
__instance = None
__Lock = threading.Lock()
__taskThreads = []
__finishChannel = []
__curworkDir = ''
def __init__(s... |
the-stack_106_24908 | #! /usr/bin/env python3
"""
The MIT License
Copyright (c) 2017 by Anthony Westbrook, University of New Hampshire <anthony.westbrook@unh.edu>
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 witho... |
the-stack_106_24912 | #!/usr/bin/python3
from __future__ import unicode_literals
import yahoogroupsapi
from yahoogroupsapi import YahooGroupsAPI
import argparse
import codecs
import datetime
import json
import logging
import math
import os
import re
import requests.exceptions
import sys
import unicodedata
from os.path import basename
from ... |
the-stack_106_24913 | # Natural Language Toolkit: Logic
#
# Author: Dan Garrette <dhgarrette@gmail.com>
#
# Copyright (C) 2001-2018 NLTK Project
# URL: <http://nltk.org>
# For license information, see LICENSE.TXT
"""
A version of first order predicate logic, built on
top of the typed lambda calculus.
"""
from __future__ import print_functi... |
the-stack_106_24914 | from sympy import Add, cos, sin, sqrt # noqa
import numpy as np
import pytest
from cached_property import cached_property
from conftest import skipif, EVAL # noqa
from devito import (NODE, Eq, Inc, Constant, Function, TimeFunction, SparseTimeFunction, # noqa
Dimension, SubDimension, Grid, Operat... |
the-stack_106_24915 | # -*- mode:python; coding:utf-8 -*-
# Copyright (c) 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
#... |
the-stack_106_24916 | '''
Created on Aug 9, 2017
@author: Hao Wu
'''
from ScopeFoundry import HardwareComponent
from VOTAScopeHW.arduino_odometer.arduino_odometer_dev import ArduinoOdometerDev
import time
from math import exp
class ArduinoOdometerHW(HardwareComponent):
'''
Hardware Component Class for receiving AI input for breat... |
the-stack_106_24918 | import datetime
from flask import Blueprint, render_template
from BOFS.util import *
from BOFS.globals import db
from BOFS.admin.util import verify_admin
# The name of this variable must match the folder's name.
unity_example = Blueprint('unity_example', __name__,
static_url_path='/unity_exam... |
the-stack_106_24920 | from functools import wraps, partial
from itertools import product, chain
import itertools
import collections
import copy
import operator
import random
import numbers
import unittest
import torch
import numpy as np
from torch._six import inf
import collections.abc
from typing import Any, Callable, List, Optional, Seq... |
the-stack_106_24921 | from model.group import Group
from random import randrange
def test_delete_some_group(app):
if app.group.count() == 0:
app.group.create(Group(name="test_name", header="test_header", footer="test_footer"))
old_groups = app.group.get_group_list()
index = randrange(len(old_groups))
app.group.dele... |
the-stack_106_24922 | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
import copy
class Solution:
def pathSum(self, root: TreeNode, sum: int) -> List[List[int]]:
if root is None: return []
result = []
def dfs(nod... |
the-stack_106_24923 | # -*- coding: utf-8 -*-
import pytest
from cottonformation.core import helpers
from cottonformation.tests.helpers import jprint
class TestAssumeRolePolicyBuilder:
def test_build(self):
assert helpers.iam.AssumeRolePolicyBuilder(
helpers.iam.ServicePrincipal.ec2(),
helpers.iam.Serv... |
the-stack_106_24927 | def increment_string(strng):
str2 = strng[::-1]
strf = []
n = []
flag = True
for s in str2:
if s.isnumeric() and flag:
n.insert(0,s)
else:
flag = False
strf.insert(0,s)
if len(n) == 0:
return f'{strng}1'
else:
i = -1
... |
the-stack_106_24933 | from flask import Blueprint, render_template
from flask import current_app
from critiquebrainz.db import users as db_users
from critiquebrainz.db.users import gravatar_url
moderators_bp = Blueprint('moderators', __name__)
@moderators_bp.route('/')
def mods_list():
mod_usernames = set(map(str.lower, current_app.c... |
the-stack_106_24935 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 In-Q-Tel, 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.or... |
the-stack_106_24937 | #
# Copyright (c) 2017, Massachusetts Institute of Technology 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 ... |
the-stack_106_24940 | import math
import pygtk
pygtk.require('2.0')
import gtk
class ConfigDialog(object):
def __init__(self, config, levels):
self.config = config
self.levels = levels
def cb_ball_num(self, widget):
self.config.ball['num'] = widget.get_value_as_int()
def cb_level(self, widget):
self.levels[widget.get... |
the-stack_106_24941 | import torch.nn as nn
import math
import torch.utils.model_zoo as model_zoo
import torch.nn.functional as F
def conv1x1(in_planes, out_planes, stride=1):
return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False)
def conv3x3(in_planes, out_planes, stride=1):
"3x3 convolution with padd... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.