filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_6629 | from config import HNConfig as Config
import numpy as np # type: ignore
from matplotlib import pyplot as plt # type: ignore
from matplotlib import cm # type: ignore
from matplotlib import colors # type: ignore
import pandas as pd # type: ignore
import util
window_size = 5
dpi = 100
iter_lim = 1000
record_moment =... |
the-stack_0_6630 | import flask_restplus
import marshmallow
from znail.netem.disciplines import PacketReordering
from znail.netem.tc import Tc
from znail.ui import api
from znail.ui.util import NoneAttributes, json_request_handler
class PacketReorderingSchema(marshmallow.Schema):
milliseconds = marshmallow.fields.Integer(required=... |
the-stack_0_6634 | """Support for exposing Concord232 elements as sensors."""
import datetime
import logging
import requests
import voluptuous as vol
from homeassistant.components.binary_sensor import (
BinarySensorDevice,
PLATFORM_SCHEMA,
DEVICE_CLASSES,
)
from homeassistant.const import CONF_HOST, CONF_PORT
import homeass... |
the-stack_0_6636 | # coding=utf-8
# Copyright 2020-present the HuggingFace Inc. team.
#
# 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 ap... |
the-stack_0_6637 | # (C) Copyright 2005-2021 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only under
# the conditions described in the aforementioned license. The license
# is also available online at... |
the-stack_0_6638 | # coding: utf-8
from django.conf.urls import include, url
from customers.cbv_base.CreateView import CreateViewCustom
from customers.cbv_base.DeleteView import DeleteViewCustom
from customers.cbv_base.UpdateView import UpdateViewCustom
from customers.cbv_base.ListView import ListViewCustomOrderBy
from customers.cbv_bas... |
the-stack_0_6640 | import collections
class Solution:
def pacificAtlantic(self, matrix: List[List[int]]) -> List[List[int]]:
m = len(matrix)
if m == 0:
return []
n = len(matrix[0])
if n == 0:
return []
visitedTimes = [[0] * n for _ in range(m)]
def bfs(s... |
the-stack_0_6641 | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... |
the-stack_0_6642 | from __future__ import division
import array
import os
import subprocess
from tempfile import TemporaryFile, NamedTemporaryFile
import wave
import sys
import struct
from .logging_utils import log_conversion, log_subprocess_output
from .utils import mediainfo_json, fsdecode
import base64
from collections import namedtu... |
the-stack_0_6646 | #! /usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from botorch.acquisition.acquisition import (
AcquisitionFunction,
OneShotAcquisitionFunction,
)
from botorch.... |
the-stack_0_6647 | load("@rules_pkg//:pkg.bzl", "pkg_zip")
def copy_file(name, src, out):
native.genrule(
name = name,
srcs = [src],
outs = [out],
cmd = "cp $< $@"
)
def pkg_asset(name, srcs = [], **kwargs):
"""Package MediaPipe assets
This task renames asset files so that they can be added to an... |
the-stack_0_6648 | from celery import shared_task
from checkerapp.models import AlertPlugin
from checkerapp.models import AlertSent
from django.db import models
from django.db.models import Q
from .telegrambot import send_alert
class TelegramAlertPlugin(AlertPlugin):
url = "accounts:telegram_plugin:telegram_pluginview"
telegr... |
the-stack_0_6650 | # Copyright (C) 2013 by Ben Morris (ben@bendmorris.com)
# Based on Bio.Nexus, copyright 2005-2008 by Frank Kauff & Cymon J. Cox
# and Bio.Phylo.Newick, copyright 2009 by Eric Talevich.
# All rights reserved.
#
# This file is part of the Biopython distribution and governed by your
# choice of the "Biopython License Agre... |
the-stack_0_6651 | #!/bin/python
# Simple script, which gathers information about GPUs and puts it into a file to expose it for node-exporter
from __future__ import print_function
from pynvml import *
import sys, traceback
try:
nvmlInit()
try:
driverVersion = nvmlSystemGetDriverVersion()
try:
gpuNum = nvmlDe... |
the-stack_0_6655 | # Lint as: python3
# Copyright 2020 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 ... |
the-stack_0_6658 | '''
Takes all pickle files from 1. pre-preprocessing, 2. post-preprocessing,
3. kernelizing, 4. decomposing
and creates single csv file with all data.
'''
import pandas as pd
import networkx as nx
import os, sys, pickle, pprint, shutil, datetime, time
from os.path import dirname,realpath
sys.path.inser... |
the-stack_0_6660 | import os
import re
import sys
import json
import time
import signal
import logging
import traceback
import boto3
import subprocess
from moto import core as moto_core
from requests.models import Response
from localstack import constants, config
from localstack.constants import (
ENV_DEV, LOCALSTACK_VENV_FOLDER, LOC... |
the-stack_0_6661 | from django.urls import path
from . import views
urlpatterns = [
path('<int:id_number>/<str:auth_status>/', views.leaks, name='leaks'),
path('login/', views.login_view, name='login'),
path('logout/', views.logout_view, name='logout'),
path('test/', views.test_login, name='test'),
path('ver/', view... |
the-stack_0_6662 | from django.core.exceptions import ObjectDoesNotExist
from qfieldcloud.core import permissions_utils, serializers
from qfieldcloud.core.models import Job, Project
from rest_framework import generics, permissions, viewsets
from rest_framework.response import Response
from rest_framework.status import HTTP_201_CREATED
... |
the-stack_0_6665 | """Plugin system for strax
A 'plugin' is something that outputs an array and gets arrays
from one or more other plugins.
"""
from concurrent.futures import wait
from enum import IntEnum
import inspect
import itertools
import logging
import time
import typing
from immutabledict import immutabledict
import numpy as np
... |
the-stack_0_6666 | # Copyright 2019 TerraPower, 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 agreed to in writi... |
the-stack_0_6668 | import os
import re
import numpy as np
import csv
def write2csv(path):
# path='Planetoid_node_classification/results/result_GAT_pyg_Citeseer_GPU0_23h12m32s_on_Oct_28_2020.txt'
csv_file=open('results.csv','w',encoding='gbk',newline='')
csv_writer=csv.writer(csv_file)
csv_writer.writerow(['data','model',... |
the-stack_0_6669 | # 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_6670 | import copy
from math import floor
from Objects.Object import Object
class Repeater(Object):
def __init__(self, isVisible, position, content, pixellength, numRepeats=-1, spacing=0):
super().__init__(isVisible, position, content)
self.numRepeats = numRepeats
self.spacing = spacing
... |
the-stack_0_6671 | import adv_test
import adv
from slot.d import *
def module():
return Curran
class Curran(adv.Adv):
comment = "no fs"
a1 = ('od',0.13)
a3 = ('lo',0.5)
if __name__ == '__main__':
conf = {}
conf['acl'] = """
`s1
`s2, seq=2
`s3
"""
conf['slot.d'] = Shinobi()... |
the-stack_0_6672 | def _apply_entities(text, entities, escape_map, format_map):
def inside_entities(i):
return any(map(lambda e:
e['offset'] <= i < e['offset']+e['length'],
entities))
# Split string into char sequence and escape in-place to
# preserve index pos... |
the-stack_0_6673 | """Support for (EMEA/EU-based) Honeywell TCC climate systems.
Such systems include evohome, Round Thermostat, and others.
"""
from datetime import datetime as dt, timedelta
import logging
import re
from typing import Any, Dict, Optional, Tuple
import aiohttp.client_exceptions
import evohomeasync
import evohomeasync2
... |
the-stack_0_6674 | import os
import genapi
import numpy_api
from genapi import \
TypeApi, GlobalVarApi, FunctionApi, BoolValuesApi
h_template = r"""
#ifdef _UMATHMODULE
#ifdef NPY_ENABLE_SEPARATE_COMPILATION
extern NPY_NO_EXPORT PyTypeObject PyUFunc_Type;
#else
NPY_NO_EXPORT PyTypeObject PyUFunc_Type;
#endif
%s
#else
#if d... |
the-stack_0_6677 | #!/usr/bin/env python3
# coding: utf-8
# Copyright 2016 Abram Hindle, https://github.com/tywtyw2002, and https://github.com/treedust
#
# 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_0_6679 | from django.urls import path
from django.contrib.auth import views as views_auth
from . import views_profile
app_name = 'profiles'
urlpatterns = [
path('ورود/',
views_auth.LoginView.as_view(template_name='profiles/login.html'),
name='ورود'),
path('خروج/', views_auth.LogoutView.as_view(), name='خروج'),... |
the-stack_0_6682 | # This is basically a copy-paste from https://github.com/facebookresearch/detr/blob/master/models/matcher.py
"""
Modules to compute the matching cost and solve the corresponding LSAP.
"""
import sys
import torch
from scipy.optimize import linear_sum_assignment
from torch import nn
sys.path.append('./util')
from seg_o... |
the-stack_0_6683 | import os
import sys
import click
from zipfile import ZipFile, ZIP_DEFLATED
import pathlib
import hashlib
import re
from loguetools import og, xd, common
from loguetools import version
XD_PATCH_LENGTH = 1024
def explode(filename, match_name, match_ident, prepend_id, append_md5_4, append_version, unskip_init):
"... |
the-stack_0_6684 | from flask import request, render_template, session
class Version_HTML():
endpoints = ["/version", "/version.html"]
endpoint_name = "page_version_html"
endpoint_access_level = 1
endpoint_category = "tool_pages"
pretty_name = "Version"
def __init__(self, fhdhr):
self.fhdhr = fhdhr
... |
the-stack_0_6685 | # Copyright 2020 The HuggingFace Team. 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_0_6687 | # coding=utf-8
from common import errcode
from dao.ask.ask_answer_reply_dao import AskAnswerReplyDao
from dao.ask.ask_answer_reply_like_dao import AskAnswerReplyLikeDao
from handlers.base.base_handler import BaseHandler
class LikeAnswerReplyHandler(BaseHandler):
methods = ['POST']
def __init__(self):
... |
the-stack_0_6688 | """Date based tools"""
import calendar
import datetime
from dateutil import parser as date_parser
import datetime as dt
import calendar
MONTHS = {
"jan": 1,
"jan.": 1,
"january": 1,
"feb": 2,
"feb.": 2,
"february": 2,
"mar": 3,
"mar.": 3,
"march": 3,
"apr": 4,
"apr.": 4,
... |
the-stack_0_6689 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
the-stack_0_6690 | from django.urls import path, include
from rest_framework.routers import DefaultRouter
from recipe import views
router = DefaultRouter()
router.register('tags', views.TagViewSet)
router.register('ingredients', views.IngredientViewSet)
router.register('recipe', views.RecipeViewSet)
app_name='recipe'
urlpatterns = [
... |
the-stack_0_6694 | # Copyright 2019 Contributors to Hyperledger Sawtooth
#
# 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 ... |
the-stack_0_6696 | #!/usr/bin/env python
#############################################################################
##
## Copyright (C) 2013 Riverbank Computing Limited.
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
## All rights reserved.
##
## This file is part of the examples of PyQt.
##
## $QT_BEGIN_LICENS... |
the-stack_0_6697 | #!/usr/bin/python
#
# Python library for reading and writing Windows shortcut files (.lnk)
# Copyright 2011 Tim-Christian Mundt
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# ... |
the-stack_0_6699 | # Copyright 2020 DeepMind Technologies Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... |
the-stack_0_6702 | import xarray as xr
import numpy as np
from climate_toolbox.utils.utils import \
remove_leap_days, convert_kelvin_to_celsius
def snyder_edd(tasmin, tasmax, threshold):
r"""
Snyder exceedance degree days/cooling degree days
Similarly to Snyder HDDs, Snyder exceedance degree days for any given day
... |
the-stack_0_6703 | # 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_0_6704 | #!/usr/bin/env python
# pyOCD debugger
# Copyright (c) 2015-2020 Arm Limited
# SPDX-License-Identifier: Apache-2.0
#
# 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_0_6705 | #!/usr/bin/env python3
import os, sys
import json
from pathlib import Path
import requests
from time import time
from tempfile import gettempdir
import tarfile
import concurrent
from concurrent.futures import ThreadPoolExecutor
import pkg_resources
## Just perform a sanity check on hit caches:
toolchains_file... |
the-stack_0_6708 | ##############################################################################
## This file is part of 'L2SI Core'.
## It is subject to the license terms in the LICENSE.txt file found in the
## top-level directory of this distribution and at:
## https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.
## No... |
the-stack_0_6709 | """
Various helper functions related to dictionaries.
"""
def extend_dictionary(d1, d2):
"""
Helper function to create a new dictionary with the contents of the two
given dictionaries. Does not modify either dictionary, and the values are
copied shallowly. If there are repeats, the second dictionary w... |
the-stack_0_6711 | int_to_mod = {
0 : ["NM", "NoMod"],
1 << 0 : ["NF", "NoFail"],
1 << 1 : ["EZ", "Easy"],
1 << 2 : ["TD", "TouchDevice"],
1 << 3 : ["HD", "Hidden"],
1 << 4 : ["HR", "HardRock"],
1 << 5 : ["SD", "SuddenDeath"],
1 << 6 : ["DT", ... |
the-stack_0_6715 | from collections import OrderedDict
from nmigen import *
from nmigen.hdl.rec import *
from .endpoint import *
__all__ = ["DoubleBuffer", "InputMultiplexer", "OutputMultiplexer"]
class DoubleBuffer(Elaboratable):
def __init__(self, *, depth, width, read_ack=False):
self.w_stb = Signal()
self.w... |
the-stack_0_6717 | # Copyright 2017 The Sonnet 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 l... |
the-stack_0_6718 | """Train script.
Usage:
train.py <hparams> <dataset_root> [--cuda=<id>]
train.py -h | --help
Options:
-h --help Show this screen.
--cuda=<id> Speed in knots [default: 0].
"""
import torch
import numpy as np
from docopt import docopt
from os.path import join
from irl_dcb.config import JsonConfig
from data... |
the-stack_0_6720 | """
.. module:: CConstraintL1
:synopsis: L1 Constraint
.. moduleauthor:: Battista Biggio <battista.biggio@unica.it>
.. moduleauthor:: Ambra Demontis <ambra.demontis@unica.it>
"""
from secml.array import CArray
from secml.optim.constraints import CConstraint
class CConstraintL1(CConstraint):
"""L1 Constraint.... |
the-stack_0_6721 | import warnings
from typing import Any, Callable, Hashable, List, Mapping, Optional, Set, Tuple, Union
import numpy as np
from numba import guvectorize
from xarray import Dataset
from . import variables
from .typing import ArrayLike, DType
def check_array_like(
a: Any,
dtype: Union[None, DType, Set[DType]] ... |
the-stack_0_6723 | import json, urllib
import xmltodict
import logging
import concurrent.futures
from urllib import request, parse
from .parser import search_result
from .proj_convertor import ProjConvertor
from .address_factory import AddressFactory
logger = logging.getLogger(__name__)
OGCIO_RECORD_COUNT = 200
NEAR_THRESHOLD = 0.05 #... |
the-stack_0_6724 | from aiogram import Bot
from aiogram.contrib.middlewares.logging import LoggingMiddleware
from aiogram.dispatcher import Dispatcher
from aiogram.utils.executor import start_webhook, start_polling
from loguru import logger as log
from abc import ABC, abstractmethod
from utils.singletone import SingletonABC
from utils... |
the-stack_0_6725 | import mock
import unittest
import manager
def create_mock_load_builder_fn(mock_rings):
"""To avoid the need for swift.common.ring library, mock a basic rings
dictionary, keyed by path. Each ring has enough logic to hold a dictionary
with a single 'devs' key, which stores the list of passed dev(s) by
... |
the-stack_0_6728 | # -*- coding: utf-8 -*-
#
# 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
#... |
the-stack_0_6729 | from .calling_conventions import DEFAULT_CC
class Callable(object):
"""
Callable is a representation of a function in the binary that can be
interacted with like a native python function.
If you set perform_merge=True (the default), the result will be returned to you, and
you can get the result st... |
the-stack_0_6730 | """Implementation of the int type based on r_longlong.
Useful for 32-bit applications manipulating values a bit larger than
fits in an 'int'.
"""
import operator
from rpython.rlib.rarithmetic import LONGLONG_BIT, intmask, r_longlong, r_uint
from rpython.rlib.rbigint import rbigint
from rpython.tool.sourcetools import... |
the-stack_0_6731 | import pickle
import scipy.stats as st
from sklearn.model_selection import RandomizedSearchCV
from sklearn.metrics import auc
from sklearn.model_selection import StratifiedKFold
import xgboost as xgb
from sklearn.model_selection import KFold
from sklearn.metrics import matthews_corrcoef,make_scorer
def train_xgb(X,
... |
the-stack_0_6734 | # Problem statement: Consider an array of integers. We perform queries of the following type on :
# Sort all the elements in the subsegment .
# Given , can you find and print the value at index (where ) after performing queries?
import sys
##### Read Data
dat = [x.split() for x in sys.stdin.readlines()]
N = int(... |
the-stack_0_6735 | # 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_0_6736 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from io import BytesIO
from struct import pack
from random import randint, choice
import time
from test_framework.authproxy import JSONRPCException
from test_framework.blocktools import create_coinbase, create_block
from test_framework.key import CECKey
from test_framewo... |
the-stack_0_6738 | load("//ruby/private:constants.bzl", "RULES_RUBY_WORKSPACE_NAME")
load("//ruby/private:providers.bzl", "RubyRuntimeContext")
DEFAULT_BUNDLER_VERSION = "2.1.2"
BUNDLE_BIN_PATH = "bin"
BUNDLE_PATH = "lib"
SCRIPT_INSTALL_BUNDLER = "download_bundler.rb"
SCRIPT_ACTIVATE_GEMS = "activate_gems.rb"
SCRIPT_BUILD_FILE_GENERATO... |
the-stack_0_6739 | #!/usr/bin/env python
# Direct downwind faster than the wind vehicle simulation
#
import os
from math import pi
import numpy as np
from matplotlib import pyplot as plt
from airfoil import Airfoil
from blade import Blade
from rotor import Rotor
from vehicle import Vehicle
from rk4 import RK4
ddwfttw_vehicle = None
Vwin... |
the-stack_0_6742 | # coding: utf8
from __future__ import unicode_literals, print_function
import os
import pkg_resources
import importlib
import re
from pathlib import Path
import random
from collections import OrderedDict
from thinc.neural._classes.model import Model
from thinc.neural.ops import NumpyOps
import functools
import itertoo... |
the-stack_0_6746 | # Copyright (C) 2018 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Tests for workflow object exports."""
from os.path import abspath, dirname, join
from flask.json import dumps
from ggrc import db
from ggrc.app import app # NOQA # pylint: disable=unused-import
from g... |
the-stack_0_6747 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2020/12/23 4:56 下午
# @File : main.trainer_predict_api.py
# @Author: johnson
# @Contact : github: johnson7788
# @Desc :
import logging
logging.basicConfig(
format='%(asctime)s - %(levelname)s - %(name)s - %(message)s',
datefmt='%Y/%m/%d %H:%M:%S',
... |
the-stack_0_6749 | """
Copyright MIT and Harvey Mudd College
MIT License
Summer 2020
Lab 2B - Color Image Cone Parking
"""
########################################################################################
# Imports
########################################################################################
import sys
import cv2 as c... |
the-stack_0_6751 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
"""
##############################################################################
# Configuration paramete... |
the-stack_0_6753 | """A keyboard with a hint when you press it"""
import lvgl as lv
from ..decorators import feed_touch
from .theme import styles
class HintKeyboard(lv.btnm):
def __init__(self, scr, *args, **kwargs):
super().__init__(scr, *args, **kwargs)
self.hint = lv.btn(scr)
self.hint.set_size(50, 60)
... |
the-stack_0_6757 | import torch
from torch.utils.data import Dataset
import os
import pickle
class ToxicData(Dataset):
def __init__(self, root, dcat, max_len) -> None:
super(ToxicData, self).__init__()
src_path = os.path.join(root, dcat + '/src.pkl')
tgt_path = os.path.join(root, dcat + '/tgt.pkl')
se... |
the-stack_0_6758 | """
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_0_6759 | import copy
import json
import os
import os.path
import zstd
import hlt
ARBITRARY_ID = -1
def parse_replay_file(file_name, player_name):
print("Load Replay: " + file_name)
with open(file_name, 'rb') as f:
data = json.loads(zstd.loads(f.read()))
print("Load Basic Information")
player = [p fo... |
the-stack_0_6760 | # Autores:
# Diego Carballido Álvarez (diego.carballido.alvarez@udc.es)
# José Antonio Figueiras Martínez (jose.figueirasm@udc.es)
import matplotlib.pyplot as plt
import numpy as np
#funcion recurvisa
def B(coorArr, i, j, t):
if j == 0:
return coorArr[i]
return B(coorArr, i, j - 1, t) * (1 - t) + B(co... |
the-stack_0_6761 | import re
import glob
import pandas as pd
from . import clean
class Corpus(object):
"""Docstring"""
def __init__(self, docs_paths):
self.corpus = []
self.docs_names = docs_paths
def load(self):
"""
:return A list of Strings each one being a document
"""
... |
the-stack_0_6763 | # -*- coding: utf-8 -*-
"""
Created on Wed Oct 5 14:31:00 2016
@author: mtkessel
"""
import matplotlib.pyplot as plt
from numpy.random import random, randint
import pandas as pd
dates = [
1665,
1674,
1838,
1839,
1855]
values = [1,2,3,4,5]
X = dates #pd.to_datetime(dates)
fig, ax = plt.subplots(figsize=(6,1))
ax.s... |
the-stack_0_6764 | from __future__ import annotations
from typing import Any, Callable
from sqlalchemy.ext.hybrid import hybrid_property
from .expression import Expression
from .resolver import AttributeResolver, PrefetchedAttributeResolver
from .typing import ColumnDefaults
class DerivedColumn:
def __init__(
self,
... |
the-stack_0_6765 | # 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_6768 | import pygame
from pygame.cursors import tri_left
import pygame_gui
import time
import serial.tools.list_ports
import os, sys
import math
from collections import deque
from pygame_gui import UIManager
from pygame_gui.elements import UIButton
from pygame_gui.elements import UITextEntryLine
from pygame_gui.elements impo... |
the-stack_0_6770 | from IPython.parallel import Client
from random import uniform
from simul import Particle
def scatter_gather(nparticles):
particles = [Particle(uniform(-1.0, 1.0),
uniform(-1.0, 1.0),
uniform(-1.0, 1.0)) for i in range(nparticles)]
rc = Client()
dv... |
the-stack_0_6771 | #!/usr/bin/python3
# coding=utf-8
# pylint: disable=I0011,E0401,W0702,W0703
# Copyright 2019 getcarrier.io
#
# 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... |
the-stack_0_6775 | from .base import * # noqa
from .base import env
# GENERAL
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
SECRET_KEY = env("DJANGO_SECRET_KEY")
# https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
ALLOWED... |
the-stack_0_6776 | #Import required libraries
import os
import cv2
import numpy as np
from tqdm import tqdm
import tensorflow as tf
from random import shuffle
from tensorflow import keras
import matplotlib.pyplot as plt
from tensorflow.keras import models, layers
#Github: https://github.com/sujitmandal
#This programe is create by Su... |
the-stack_0_6779 | from keras.models import model_from_json
from common import *
def save_model(json_file, weights_file, model):
with open(json_file, 'w') as model_file:
model_file.write(model.to_json())
model.save_weights(weights_file)
def load_model(json_file, weights_file):
with open(json_file, 'r') as jfile:
... |
the-stack_0_6781 | from datetime import datetime, timezone
from typing import Tuple
from dagster import EventMetadataEntry, Output, OutputDefinition, solid
def binary_search_nearest_left(get_value, start, end, min_target):
mid = (start + end) // 2
while start <= end:
mid = (start + end) // 2
mid_timestamp = ge... |
the-stack_0_6782 | """Support for the Netatmo binary sensors."""
import logging
from pyatmo import NoDevice
import voluptuous as vol
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorDevice
from homeassistant.const import CONF_TIMEOUT
from homeassistant.helpers import config_validation as cv
from .const i... |
the-stack_0_6783 | from . import shapes, sprite, clock
import time, math
class Sprite:
def __init__(self, window, x=0, y=0, direction=(0, 0), speed=(0, 0), images=[], image_num=0, color_pair=None, group=None):
self.window = window
self.x = x
self.y = y
self.direction = tuple(direction)
self.speed = tuple(speed)
if color_pai... |
the-stack_0_6784 | import copy
import logging
import os
from absl import app
from absl import flags
import torch
from torch.nn.functional import cosine_similarity
from torch.optim import AdamW
from torch.utils.tensorboard import SummaryWriter
from torch_geometric.data import DataLoader
from torch_geometric.datasets import PPI
from tqdm ... |
the-stack_0_6785 | # coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace Datasets 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/LI... |
the-stack_0_6786 | import os.path
try:
from setuptools import setup, find_packages
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(name='wp_iso3166',
... |
the-stack_0_6787 | # Rewritten by RayzoR
import sys
from com.l2jfrozen.gameserver.model.quest import State
from com.l2jfrozen.gameserver.model.quest import QuestState
from com.l2jfrozen.gameserver.model.quest.jython import QuestJython as JQuest
from com.l2jfrozen.gameserver.model.base import Race
qn = "236_SeedsOfChaos"
DROP_RATE = 20
... |
the-stack_0_6788 | # -*- coding: utf-8 -*-
from os.path import join
from os.path import dirname
from os.path import isfile
class Template(object):
SUPPORTED_METHODS = {}
TEMPLATES = {}
def __init__(self, estimator, target_language='java',
target_method='predict', **kwargs):
# pylint: disable=unus... |
the-stack_0_6790 | #! /usr/bin/env python
import numpy as np
import sys
sys.path.append("spnet/")
sys.path.append("../spnet/")
from diagnostics import compute_iou
def test_compute_iou():
# make up two ellipes
Y_true = (100, 140, 120, 60, 90, 0, 10.3) # ellipse a
Y_pred = (120, 123, 120, 60, 149.97, 0, 7.8) # elli... |
the-stack_0_6794 | from app.helpers.cache import CacheExpiresAfter
from app.helpers.units import Units
from configparser import ConfigParser
config = ConfigParser()
config.read('config.ini')
def handle_cache_expires_after():
try:
if CacheExpiresAfter(config["cache"]["cache_expires_after"]) is CacheExpiresAfter.DISABLE:
... |
the-stack_0_6795 | """Tests for the main tournament class."""
import csv
import logging
from multiprocessing import Queue, cpu_count
import unittest
import warnings
from hypothesis import given, example, settings
from hypothesis.strategies import integers, floats
from axelrod.tests.property import (tournaments,
... |
the-stack_0_6797 | # *****************************************************************************
#
# Copyright (c) 2020, the pyEX authors.
#
# This file is part of the pyEX library, distributed under the terms of
# the Apache License 2.0. The full license can be found in the LICENSE file.
#
def peerCorrelation(client, symbol, range=... |
the-stack_0_6798 | from os.path import dirname, join
import pandas as pd
from bokeh.layouts import row, column
from bokeh.models import ColumnDataSource, CustomJS
from bokeh.models.widgets import RangeSlider, Button, DataTable, TableColumn, NumberFormatter
from bokeh.io import curdoc
df = pd.read_csv(join(dirname(__file__), 'salary_da... |
the-stack_0_6799 | from Logger import log
import numpy as np
# from sklearn.metrics import confusion_matrix
def get_TP(target, prediction, threshold):
'''
compute the number of true positive
Parameters:
----------------
target: the groud truth , np.array
prediction: the prediction, np.array
threshold: flo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.