filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_854 | #!/usr/bin/env python3
# Write a program that simulates random BAC coverage over a genome
# Command line arguments include
# Genome size (e.g. 1000)
# X coverage (e.g. 5)
# Use assert() to check parameter bounds
# Report min, max, and histogram of coverage
# Note that your output may vary due to random function
imp... |
the-stack_0_855 | import logging
from typing import Any, Dict, List, TypedDict
from utility import Utility
log: logging.Logger = logging.getLogger(__name__)
class CamoIDs(TypedDict):
"""Structure of loot/camo_ids.csv"""
id: int
ref: str
rarity: int
price: int
salvage: int
license: int
premium: int #... |
the-stack_0_856 | class Pagelet(object):
def __init__(self, parent_request, target_element_id, route_view, params, method: str = 'GET', depends_on: str= None):
self.parent_request = parent_request
self.target = target_element_id
self.route_view = route_view
self.params = params
self.me... |
the-stack_0_857 | import numpy as np
import pandas as pd
from tensorflow.keras.preprocessing.text import Tokenizer
from tensorflow.keras.layers import Dense
from tensorflow.keras.models import Sequential
from sklearn.preprocessing import MultiLabelBinarizer
from tensorflow.keras.preprocessing.sequence import skipgrams
from keras.utils i... |
the-stack_0_858 | from commndata.models import TimeLinedTable
from django.db import models
from django.utils.translation import gettext_lazy as _
from enum import Enum
class SalaryTable(TimeLinedTable):
class SALARY_TABLE(models.IntegerChoices):
GS1 = (1010, '行(一)')
GS2 = (1020, '行(二)')
SGS = (1110, '専門行政')... |
the-stack_0_860 | """
fitpack --- curve and surface fitting with splines
fitpack is based on a collection of Fortran routines DIERCKX
by P. Dierckx (see http://www.netlib.org/dierckx/) transformed
to double routines by Pearu Peterson.
"""
# Created by Pearu Peterson, June,August 2003
from __future__ import division, print_function, abs... |
the-stack_0_866 | # 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_867 | # coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from biocontainers_flask.server.models.base_model_ import Model
from biocontainers_flask.server import util
class Checksum(Model):
"""NOTE: This class is auto gen... |
the-stack_0_868 | from .config import UTILS1_LOGLEVEL
import logging
from log_utils.utils import get_logger_with_file_handler
formatter = 'logger name : %(name)s ,%(levelname)s , func : %(funcName)s , %(message)s , module : %(module)s ,line : %(lineno)d , %(asctime)s'
logger = get_logger_with_file_handler(__name__,UTILS1_LOGLEVEL,form... |
the-stack_0_869 | import asyncio
import contextlib
from types import TracebackType
from typing import Optional, Type, Dict, Any
import aiojobs
from aiojobs import Scheduler
from .client import ChaosIQClient
from .log import logger
from .types import Config
__all__ = ["Heartbeat"]
class Heartbeat:
def __init__(self, config: Con... |
the-stack_0_874 | # Copyright 2018-2019 The glTF-Blender-IO 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 ... |
the-stack_0_876 | # Copyright (C) 2021-present MongoDB, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the Server Side Public License, version 1,
# as published by MongoDB, Inc.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without e... |
the-stack_0_878 | # Copyright 2014-2017 Insight Software Consortium.
# Copyright 2004-2009 Roman Yakovenko.
# Distributed under the Boost Software License, Version 1.0.
# See http://www.boost.org/LICENSE_1_0.txt
import unittest
import logging
from . import parser_test_case
from pygccxml import utils
class Test(parser_test_case.pars... |
the-stack_0_879 | # -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# File: transformer.py
import inspect
import numpy as np
import pprint
import sys
from abc import ABCMeta, abstractmethod
from fvcore.transforms.transform import (
BlendTransform,
CropTransform,
HFlipTransform,
... |
the-stack_0_882 | # pylint: disable=C0302
"""
@file
@brief Implements a class able to compute the predictions
from on an :epkg:`ONNX` model.
"""
from collections import OrderedDict
from io import BytesIO
from time import perf_counter
import warnings
import textwrap
import pprint
import numpy
from scipy.sparse import coo_matrix
from onnx... |
the-stack_0_883 | from typing import Iterable
import re
from dbt.clients.jinja import get_rendered
from dbt.contracts.graph.parsed import ParsedDocumentation
from dbt.node_types import NodeType
from dbt.parser.base import Parser
from dbt.parser.search import (
BlockContents, FileBlock, BlockSearcher
)
SHOULD_PARSE_RE = re.compil... |
the-stack_0_887 | #!/usr/bin/env python3
# Copyright (c) 2020-2021 The Eleccoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Functionality to build scripts, as well as signature hash functions.
This file is modified from pytho... |
the-stack_0_890 | from aiohttp import web
from utils.utils import *
def get_members(request, client):
try:
role_ids = request.query["ids"].split(",")
guild = client.get_guild(client.config["main_guild_id"])
roles = [get(guild.roles, id=int(role_id)) for role_id in role_ids]
members = [role.members fo... |
the-stack_0_891 |
import os
import cv2
cascPath = "./haarcascades/haarcascade_frontalface_alt.xml"
input_dir = './lfw'
output_dir = './other_faces'
if not os.path.exists(output_dir):
os.makedirs(output_dir)
# classifiers
faceCascade = cv2.CascadeClassifier(cascPath)
index = 1
for (path,dirnames,filenames) in os.walk(input_dir):
... |
the-stack_0_892 | #######################
# Dennis MUD #
# remake_item.py #
# Copyright 2018-2020 #
# Michael D. Reiley #
#######################
# **********
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal i... |
the-stack_0_894 | # -*- coding: utf-8 -*-
"""
mslib.msui.performance_settings
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This module defines the performance settings dialog
This file is part of mss.
:copyright: Copyright 2017 Joern Ungermann
:copyright: Copyright 2017-2022 by the mss team, see AUTHORS.
:license: APA... |
the-stack_0_895 | from decimal import Decimal
import graphene
from django_filters import FilterSet, OrderingFilter
from graphene import relay
from graphene_django.filter import DjangoFilterConnectionField
from graphene_django.types import DjangoObjectType
from graphene_file_upload.scalars import Upload
from graphql import GraphQLError
... |
the-stack_0_896 | from grpc.beta import implementations
import numpy
import traceback
import tensorflow as tf
from tensorflow_serving.apis import predict_pb2
from tensorflow_serving.apis import prediction_service_pb2
from flask_restplus import Resource, abort
from monocker_api.api.restplus import restplus_api
from monocker_api.api.m... |
the-stack_0_899 | # Copyright Contributors to the Rez 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 required by applicable law or agreed ... |
the-stack_0_901 | #!/usr/bin/python2.7
# -*- coding: UTF-8 -*-
'''
Created on 2018年6月15日
@author: zhaohongxing
'''
import os
from PyQt5.Qt import Qt
from PyQt5.Qt import QIcon,QStandardItemModel,QStandardItem
'''
from PyQt5 import QtGui
'''
from PyQt5.QtWidgets import QTableView,QVBoxLayout,QDialog,QPushButton
from PyQt... |
the-stack_0_902 | """
This module contains pdsolve() and different helper functions that it
uses. It is heavily inspired by the ode module and hence the basic
infrastructure remains the same.
**Functions in this module**
These are the user functions in this module:
- pdsolve() - Solves PDE's
- classify_pde() - Classif... |
the-stack_0_903 | from notifications.signals import notify
def notify_answer(request, topico, resposta):
recipient = resposta.parent.user if resposta.parent else topico.user
verb = 'responder'
description = f'{recipient} respondeu seu post em {topico.titulo}.'
url = topico.get_absolute_url() + f'#post{resposta.pk}'
... |
the-stack_0_904 | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import torchvision
from torch.autograd import Variable
import itertools
import operator
from itertools import islice
from collections import OrderedDict
def to_var(x, requires_grad=True):
if torch.cuda.is_available():
x =... |
the-stack_0_905 | #!/usr/bin/env python
# Software License Agreement (Apache License 2.0)
#
# Copyright 2017 Florian Kromer
#
# 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... |
the-stack_0_913 | """
===============
Subplots Adjust
===============
Adjusting the spacing of margins and subplots using
:func:`~matplotlib.pyplot.subplots_adjust`.
"""
import matplotlib.pyplot as plt
import numpy as np
# Fixing random state for reproducibility
np.random.seed(19680801)
plt.subplot(211)
plt.imshow(np.random.random((... |
the-stack_0_914 | #! /usr/bin/python2
#
# Copyright (c) 2017 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
import codecs
import os
import shutil
import socket
import string
import subprocess
import sys
import telnetlib
import tempfile
import time
import serial
import commonl
import ttbl
import ttbl.cm_loopback
import t... |
the-stack_0_915 | #!/usr/bin/python
# -*- coding: utf-8 -*-
def warn(*args, **kwargs):
pass
from django.shortcuts import render
from django.core.files.storage import FileSystemStorage
from django.http import HttpResponse, JsonResponse
from django.db.models import Q
from .models import *
def search(request):
try:
query ... |
the-stack_0_916 | # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
the-stack_0_918 | # coding: utf-8
import os
import sys
import re
import time
import pickle
import shutil
import random
import argparse
from darknet_util import *
from darknet import Darknet
from preprocess import prep_image, process_img, inp_to_image
from dataset import color_attrs, direction_attrs, type_attrs
import ... |
the-stack_0_919 | """
SimplePose for COCO Keypoint, implemented in TensorFlow.
Original paper: 'Simple Baselines for Human Pose Estimation and Tracking,' https://arxiv.org/abs/1804.06208.
"""
__all__ = ['SimplePose', 'simplepose_resnet18_coco', 'simplepose_resnet50b_coco', 'simplepose_resnet101b_coco',
'simplepose_re... |
the-stack_0_920 | """Selector and proactor event loops for Windows."""
import _overlapped
import _winapi
import errno
import math
import msvcrt
import socket
import struct
import time
import weakref
from . import events
from . import base_subprocess
from . import futures
from . import exceptions
from . import proactor_... |
the-stack_0_921 | from django.urls import path, include
from comment.api.views import CommentCreateApiView, CommentListApiView, CommentValidateApiView
app_name = "comment"
urlpatterns = [
path('create/', CommentCreateApiView.as_view(), name='create'),
path('list/', CommentListApiView.as_view(), name='list'),
path('validat... |
the-stack_0_922 | def readline(f, newline):
buf = ""
while True:
while newline in buf:
pos = buf.index(newline)
yield buf[:pos]
buf = buf[pos + len(newline):]
chunk = f.read(4096 * 10)
if not chunk:
yield buf
break
buf += chunk
with ope... |
the-stack_0_924 | """The module defines the abstract interface for resolving container images for tool execution."""
from abc import (
ABCMeta,
abstractmethod,
abstractproperty,
)
from galaxy.util.bunch import Bunch
from galaxy.util.dictifiable import Dictifiable
class ResolutionCache(Bunch):
"""Simple cache for dupli... |
the-stack_0_925 | import warnings
from itertools import islice
from types import GeneratorType
from typing import (
TYPE_CHECKING,
AbstractSet,
Any,
Callable,
Dict,
Generator,
Iterator,
List,
Optional,
Set,
Tuple,
Type,
TypeVar,
Union,
no_type_check,
)
from .typing import AnyT... |
the-stack_0_927 | # _____ ______ _____
# / ____/ /\ | ____ | __ \
# | | / \ | |__ | |__) | Caer - Modern Computer Vision
# | | / /\ \ | __| | _ / Languages: Python, C, C++, Cuda
# | |___ / ____ \ | |____ | | \ \ http://github.com/jasmcaus/caer
# \_____\/_/ \_ \______ |_| \_\
# Lic... |
the-stack_0_928 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('api', '0007_apirequest_extra'),
]
operations = [
migrations.AddField(
model_name='apirequest',
name=... |
the-stack_0_929 | #-*- coding:utf-8 -*-
import pytest
import random
import string
import itertools as itt
import collections
import spiceminer as sm
import spiceminer.kernel.lowlevel as lowlevel
### Helpers ###
def rstrings(max_size):
while True:
yield ''.join(random.sample(string.lowercase, random.randint(1, max_size))... |
the-stack_0_932 | import json
import datetime
from django.utils import timezone
from django.core.exceptions import PermissionDenied
from rest_framework import permissions, generics
from resources.models import Unit, Reservation, Resource, ResourceType
from hmlvaraus.models.hml_reservation import HMLReservation
from hmlvaraus.models.bert... |
the-stack_0_934 | """Gaussian MLP Policy.
A policy represented by a Gaussian distribution
which is parameterized by a multilayer perceptron (MLP).
"""
# pylint: disable=wrong-import-order
import akro
import numpy as np
import tensorflow as tf
from garage.tf.models import GaussianMLPModel
from garage.tf.policies.policy import Stochasti... |
the-stack_0_937 | from collections import Counter
class Solution:
def removeDuplicateLetters(self, s: str) -> str:
counter = Counter(s)
seen = set()
stack = []
for letter in s:
counter[letter] -= 1
if letter in seen:
continue
... |
the-stack_0_939 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
the-stack_0_940 | from django.db.models.signals import pre_save, post_delete
from django.dispatch import receiver
from .serializers import XXTMP_PO_HEADERS, ElasticPO_headersSerializer
@receiver(pre_save, sender=XXTMP_PO_HEADERS, dispatch_uid="update_record")
def update_es_record(sender, instance, **kwargs):
obj = ElasticPO_header... |
the-stack_0_943 | """Implementation of core Haskell rules"""
load("@bazel_skylib//lib:dicts.bzl", "dicts")
load(
":providers.bzl",
"C2hsLibraryInfo",
"HaddockInfo",
"HaskellInfo",
"HaskellLibraryInfo",
"HaskellToolchainLibraryInfo",
"all_dependencies_package_ids",
)
load(":cc.bzl", "cc_interop_info")
load(
... |
the-stack_0_944 | import os
import numpy as np
import json
from itertools import product
class Node():
'''
Class for representing a node in the ImageNet/WordNet hierarchy.
'''
def __init__(self, wnid, parent_wnid=None, name=""):
"""
Args:
wnid (str) : WordNet ID for synset represented by n... |
the-stack_0_948 | from math import *
from prettytable import PrettyTable
def func(x, y):
return x * x + y * y
def main():
mas_x = []; mas_y = []
tmp_x = []; tmp_y = []; tmp_y2 = []
tmp_x3 = []; tmp_y3 = []
matrix = []
beg = 0; end = 10
N = abs(end - beg) - 1
eps = 1e-5
for ... |
the-stack_0_950 | import configparser
import os
from compute.config import AlgorithmConfig
import numpy as np
from train.utils import TrainConfig
class StatusUpdateTool(object):
@classmethod
def clear_config(cls):
config_file = os.path.join(os.path.dirname(__file__), 'global.ini')
config = configparser.ConfigP... |
the-stack_0_952 | import cv2
import random
import numpy as np
import skimage.transform
from typing import Union, Optional, Sequence, Tuple, Dict
from . import functional as F
from ...core.transforms_interface import DualTransform, to_tuple
__all__ = ["ShiftScaleRotate", "ElasticTransform", "Perspective", "Affine", "PiecewiseAffine"]
... |
the-stack_0_953 | from sympy import S, Rational
from sympy.external import import_module
from sympy.stats import Binomial, sample, Die, FiniteRV, DiscreteUniform, Bernoulli, BetaBinomial, Hypergeometric, \
Rademacher
from sympy.testing.pytest import skip, raises
def test_given_sample():
X = Die('X', 6)
scipy = import_module... |
the-stack_0_956 | """
Writes out submission datetime details (when it was submitted, how long it was in grading
process, etc) to a history.json file which is a list of all grading attempts for a
particular submission (including initial grading of it and all regrades).
"""
import os
import sys
import collections
import json
from datetim... |
the-stack_0_958 | from __future__ import unicode_literals
import fnmatch
import logging
import os
import re
import shutil
import subprocess
import tempfile
from difflib import SequenceMatcher
from functools import cmp_to_key
from django.core.exceptions import ObjectDoesNotExist
from django.utils import six
from django.utils.encoding i... |
the-stack_0_959 | #!/usr/bin/env python
#
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Creates an AndroidManifest.xml for an APK split.
Given the manifest file for the main APK, generates an AndroidManifest.xml with
t... |
the-stack_0_960 | # -*- coding: utf-8 -*-
# Resource object code
#
# Created: Mon Dec 9 12:39:51 2019
# by: The Resource Compiler for PySide2 (Qt v5.13.0)
#
# WARNING! All changes made in this file will be lost!
from PySide2 import QtCore
qt_resource_data = b"\
\x00\x00\x10\xcd\
<\
?xml version=\x221.\
0\x22 encoding=\x22UTF\
-8... |
the-stack_0_964 | #!/usr/bin/env python3
#
# Synthesis-based resolution of features/enforcers interactions in CPS
# Copyright 2020 Carnegie Mellon University.
# NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING
# INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON
# UNIVERSITY MAKES NO WARRANTIES OF ... |
the-stack_0_968 | from chainer import cuda
from chainer import function
from chainer import variable
class _DummyFunction(function.Function):
def __init__(self, grads):
self.grads = grads
def forward(self, inputs):
xp = cuda.get_array_module(*inputs)
return xp.array(0),
def backward(self, inputs,... |
the-stack_0_969 |
""" tpm.py
Wrapper classes for swtpm
"""
# pylint: disable=R0902,R0913,R0914,C0302,W0703
#
# swtpm_setup.py
#
# Authors: Stefan Berger <stefanb@linux.ibm.com>
#
# (c) Copyright IBM Corporation 2020
#
import os
import socket
import struct
import subprocess
import time
# TPM1.2 imports
from cryptography.hazmat.bac... |
the-stack_0_973 | # -*- coding: utf-8 -*-
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
the-stack_0_974 | """This is used to patch the QApplication style sheet.
It reads the current stylesheet, appends our modifications and sets the new stylesheet.
"""
from PyQt5 import QtWidgets
def patch_qt_stylesheet(use_dark_theme: bool) -> None:
if not use_dark_theme:
return
app = QtWidgets.QApplication.instance()
... |
the-stack_0_978 | import json
import os
import re
import urllib.request
import warnings
from typing import Optional, Union, Tuple, Dict
import ee
import pkg_resources
from ee_extra.STAC.utils import _get_platform_STAC
from ee_extra.utils import _load_JSON
def _get_expression_map(img: ee.Image, platformDict: dict) -> dict:
"""Get... |
the-stack_0_980 | #!/usr/bin/env python3
import argparse
import json
import sys
import traceback
import re
from sonic_py_common import device_info, logger
from swsscommon.swsscommon import SonicV2Connector, ConfigDBConnector, SonicDBConfig
INIT_CFG_FILE = '/etc/sonic/init_cfg.json'
SYSLOG_IDENTIFIER = 'db_migrator'
# Global logger ... |
the-stack_0_981 | # Copyright 2022 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_982 |
import os
import click
import shutil
import subprocess
import pkg_resources
import sys
import errno
import traceback
from monitor.logs import init_logging, logger
class ValidationExceptionBinaryNotFound(Exception):
pass
class NotRunningRoot(Exception):
pass
@click.group()
def cli():
click.echo("FileW... |
the-stack_0_984 | import sys
import csv
import get_info
def main(argv):
skip = int(argv[1])
with open('final_movie_upload_data.csv', mode='r') as csv_file:
csv_reader = csv.DictReader(csv_file)
for i in range(0, skip):
next(csv_reader)
count = 0
new_data = []
for row in csv_re... |
the-stack_0_985 |
from tensorflow.keras.models import model_from_json
import numpy as np
import cv2
import math
import tensorflow as tf
from tensorflow.keras.preprocessing import image
facec = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
from matplotlib import pyplot as plt
import os
import shutil
from skimage.measure i... |
the-stack_0_987 | # --------------------------------------------------------
# Tensorflow Faster R-CNN
# Licensed under The MIT License [see LICENSE for details]
# Written by Jiasen Lu, Jianwei Yang, based on code from Ross Girshick
# --------------------------------------------------------
from __future__ import absolute_import
from __... |
the-stack_0_990 | """Test of Ray-tune without RLLib"""
from ray import tune
def objective(step, alpha, beta):
return (0.1 + alpha * step / 100)**(-1) + beta * 0.1
def train(config):
alpha, beta = config["alpha"], config["beta"]
for step in range(10):
score = objective(step, alpha, beta)
tune.report(mean_l... |
the-stack_0_992 | # Copyright 2012 New Dream Network, LLC (DreamHost)
#
# 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 a... |
the-stack_0_995 | import tensorflow as tf
import os
import shutil
from tensorflow.python.saved_model import tag_constants
from tensorflow.python import ops
def get_graph_def_from_file(graph_filepath):
tf.compat.v1.reset_default_graph()
with ops.Graph().as_default():
with tf.compat.v1.gfile.GFile(graph_filepath, 'rb') as f:
... |
the-stack_0_997 | # -*- coding: utf-8 -*-
from matplotlib.patches import Patch
from matplotlib.pyplot import axis, legend
from ....Functions.init_fig import init_fig
from ....definitions import config_dict
MAGNET_COLOR = config_dict["PLOT"]["COLOR_DICT"]["MAGNET_COLOR"]
def plot(self, fig=None, display_magnet=True):
"""Plot the... |
the-stack_0_998 | from jesse.helpers import get_candle_source, slice_candles, np_shift, same_length
import numpy as np
from numba import njit,jit
import talib
from typing import Union
from jesse.helpers import get_config
from collections import namedtuple
import tulipy as ti
import math
"""
https://www.tradingview.com/script/sxZRzQzQ... |
the-stack_0_999 | from enum import Enum
from itertools import takewhile
from grid import Grid, Point
import grid_utils
class DiscState(Enum):
empty = 0
red = 1
black = 2
class Game(object):
def __init__(self, initial_grid=None):
self.restart(initial_grid)
def restart(self, initial_grid=None):
if initial_grid is N... |
the-stack_0_1001 | from typing import Optional
from django.db import models, DatabaseError, transaction
from .message import ChatMediaTypes
from ..users import UserUpdater
from ..base import BaseModel
from .entity_types import EntityTypes
from .entity_types import EntitySourceTypes
from core.globals import logger
from pyrogram import t... |
the-stack_0_1002 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('esg_leipzig_homepage_2015', '0005_linktoflatpage'),
]
operations = [
migrations.CreateModel(
name='News',
... |
the-stack_0_1003 | from typing import List
from webdnn.backend.code_generator.allocator import MemoryLayout
from webdnn.backend.code_generator.injectors.buffer_injector import BufferInjector
from webdnn.backend.code_generator.injectors.kernel_name_injector import KernelNameInjector
from webdnn.backend.webassembly.generator import Webass... |
the-stack_0_1004 | import configparser
import json
from pathlib import Path
from transformers import AutoTokenizer, Wav2Vec2ForCTC
import sounddevice as sd
import soundfile as sf
import torch
def record_from_mic(config):
"""Record audio from a microphone.
Args:
config (ConfigParser): Config params.
Returns:
... |
the-stack_0_1005 | import argparse
import pandas as pd
label_map = {
'agree': 'agree',
'disagree': 'refute',
'discuss': 'nostance'
}
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('snopes', help='/path/to/snopes/file')
parser.add_argument('pred', help='/path/to/prediction/file... |
the-stack_0_1006 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Prints Graph
def print_dict(dictionary):
for k, v in {k: v for k, v in dictionary.items() if v[0] != 'out'}.items(): print(k, ':', *v, sep='\t', end='\n')
# Parsing
def parse(lines, gates):
data = list()
graph = dict()
for i in range(len(lines)):
... |
the-stack_0_1007 | # -*- coding: utf-8 -*-
import os
import os.path
import re
import sys
import string
from django.apps.registry import apps
from django.core.management.base import BaseCommand, CommandError
from python_translate.extractors import base as extractors
from python_translate import operations
from python_translate.translat... |
the-stack_0_1008 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 18 16:55:14 2017
@author: ajaver
"""
import os
import tables
import numpy as np
import warnings
from .getFoodContourNN import get_food_contour_nn
from .getFoodContourMorph import get_food_contour_morph
from tierpsy.helper.misc import TimeCounter, ... |
the-stack_0_1009 | """
Based on https://github.com/asanakoy/kaggle_carvana_segmentation
"""
import torch
import torch.utils.data as data
from torch.autograd import Variable as V
from PIL import Image
import cv2
import numpy as np
import os
import scipy.misc as misc
import Constants
def randomHueSaturationValue(image, hue_shift_limit=(-1... |
the-stack_0_1011 | class ScoreCalc:
def __init__(self, slices):
self.score = 0
self.slices = slices
self.calculatescore()
def calculatescore(self):
for slice in self.slices:
r1 = slice[0]
c1 = slice[1]
r2 = slice[2]
c2 = slice[3]
self.sco... |
the-stack_0_1012 | # qubit number=3
# total number=10
import numpy as np
from qiskit import QuantumCircuit, execute, Aer, QuantumRegister, ClassicalRegister, transpile, BasicAer, IBMQ
import networkx as nx
from qiskit.visualization import plot_histogram
from typing import *
from pprint import pprint
from math import log2
from collectio... |
the-stack_0_1013 | # Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import pytest
from common.onnx_layer_test_class import OnnxRuntimeLayerTest
class TestLoop(OnnxRuntimeLayerTest):
@staticmethod
def create_const(name, tensor_type, value):
from onnx import helper
... |
the-stack_0_1015 | """
@ProjectName: DXY-2019-nCov-Crawler
@FileName: crawler.py
@Author: Jiabao Lin
@Date: 2020/1/21
"""
from bs4 import BeautifulSoup
from service.db import DB
from service.nameMap import country_type_map, city_name_map, country_name_map, continent_name_map
import re
import json
import time
import logging
import datetim... |
the-stack_0_1016 | """ This is KAMINARIO-FLOCKER-DRIVER Module docstring """
from flocker import node
from kaminario_flocker_driver.k2_blockdevice_api \
import instantiate_driver_instance
from kaminario_flocker_driver.constants import DRIVER_NAME
def api_factory(cluster_id, **kwargs):
"""Entry point for Flocker to load ... |
the-stack_0_1019 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @File : tests\test_model\test_resnet.py
# @Time : 2022-05-03 12:15:10
# @Author : Bingjie Yan
# @Email : bj.yan.pa@qq.com
# @License : Apache License 2.0
import torch
from torch import optim
from torch.utils.data import DataLoader
from fedhf.api impor... |
the-stack_0_1020 | import re
from typing import List
import numpy as np
from pandas.util._decorators import Appender, deprecate_kwarg
from pandas.core.dtypes.common import is_extension_array_dtype, is_list_like
from pandas.core.dtypes.concat import concat_compat
from pandas.core.dtypes.missing import notna
from pandas.core.arrays imp... |
the-stack_0_1022 | """
The main purpose of this module is to expose LinkCollector.collect_sources().
"""
import cgi
import collections
import functools
import itertools
import logging
import os
import re
import urllib.parse
import urllib.request
import xml.etree.ElementTree
from html.parser import HTMLParser
from optparse import Values
... |
the-stack_0_1023 | # coding: utf-8
# 2019/12/30 @ tongshiwei
import pytest
from CangJie.Features import Stroke, character_glyph, CDict
from CangJie import token2stroke, token2radical, char_features
def test_features():
cdict = CDict.from_file()
char_features("一")
assert len(cdict.get_stroke("一s")) == 1
assert len(cdic... |
the-stack_0_1024 | # -*- coding: utf-8 -*-
# Copyright (c) 2013, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
"""
This module contains manual annotations for the gl backends. Together
with the header files, we can generatre the full ES 2.0 API.
Every function-annotations consists of... |
the-stack_0_1025 | import json
import logging
import ssl
import requests
import socket
import websocket
import websocket._exceptions
logger = logging.getLogger(__name__)
class MattermostAPI(object):
def __init__(self, url, ssl_verify, token):
self.url = url
self.token = token
self.initial = None
sel... |
the-stack_0_1026 | '''
This module is for DiffChecker class.
'''
import sys
import os
import logging
from importlib import reload
import pickle
import pandas as pd
import numpy as np
sys.path.append('../')
from mlqa import checkers as ch
class DiffChecker():
'''Integrated QA performer on pd.DataFrame with logging functionality.
... |
the-stack_0_1027 | from pymoo.algorithms.nsga2 import NSGA2
from pymoo.optimize import minimize
from pymoo.problems.multi.srn import SRN
from pymoo.visualization.scatter import Scatter
problem = SRN()
algorithm = NSGA2(pop_size=100)
res = minimize(problem,
algorithm,
# ('n_gen', 1000),
see... |
the-stack_0_1029 | import binascii
import hashlib
import hmac
import json
import time
from datetime import datetime, timedelta
from itertools import chain
import pytz
from django.contrib.auth.models import User
from django.db.models import Prefetch
from django.forms import ChoiceField, Form, IntegerField, ModelForm, Select
from django.u... |
the-stack_0_1031 | """
MIT License
Copyright (c) 2020 Airbyte
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, distr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.