filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_11707 | #!/usr/bin/env python3
from typing import List
from reagent import types as rlt
from reagent.core.dataclasses import dataclass, field
from reagent.models.base import ModelBase
from reagent.models.dqn import FullyConnectedDQN
from reagent.net_builder.discrete_dqn_net_builder import DiscreteDQNNetBuilder
from reagent.p... |
the-stack_0_11708 | import pandas as pd
import qcportal as ptl
from simtk import unit
PARTICLE = unit.mole.create_unit(
6.02214076e23 ** -1,
"particle",
"particle",
)
HARTREE_PER_PARTICLE = unit.hartree / PARTICLE
HARTREE_TO_KCALMOL = HARTREE_PER_PARTICLE.conversion_factor_to(
unit.kilocalorie_per_mole
)
def main():
... |
the-stack_0_11709 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# @File: cms.py
"""
envlib.cms
~~~~~~~~~~
Cms配置类预置库
"""
import json as json_tool
from copy import deepcopy
from envlib.env.envlogging import logger
from envlib.env.globals import current_app as app
from envlib.env.globals import g
from envlib.env.helpers im... |
the-stack_0_11717 | # -*- coding: utf-8 -*-
import numpy
from matplotlib import pyplot
def lif(v, ge, gi, i):
dv = (v * -0.01) + ge - gi + i
spk = v > 1
dv[spk] = -v[spk]
return dv, spk
def lif_net(num_neurons, duration):
offset = -numpy.linspace(0, 4 * numpy.pi, num_neurons)
offset[:num_neurons / 2] = -3 * nump... |
the-stack_0_11718 | # -*- coding: utf-8 -*-
# file: BERT_SPC.py
# author: songyouwei <youwei0314@gmail.com>
# Copyright (C) 2019. All Rights Reserved.
import torch
import torch.nn as nn
class BERT_SPC(nn.Module):
def __init__(self, bert, opt):
super(BERT_SPC, self).__init__()
self.bert = bert
self.dropout = n... |
the-stack_0_11719 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Advanced Movie Selection for Dreambox-Enigma2
#
# The plugin is developed on the basis from a lot of single plugins (thx for the code @ all)
# Coded by JackDaniel @ cmikula (c)2011
# Support: www.i-have-a-dreambox.com
#
# This plugin is licensed under the Creative Common... |
the-stack_0_11720 | import glob, os, shutil
if not os.path.exists('./converted'):
os.makedirs('./converted')
os.chdir('./labels')
for file in glob.glob("*.txt"):
f = open(file, "r")
line = f.read()
lineVals = line.split()
if (len(lineVals) > 19):
newLine = lineVals[0] + ' ' + lineVals[1] + ' ' + lineVals[2] ... |
the-stack_0_11723 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2018, Simon Dodsley (simon@purestorage.com)
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',... |
the-stack_0_11724 | #!/usr/bin/env python3
# Copyright (c) 2019-2020 The Bitcoin Core and Devcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# Test Taproot softfork (BIPs 340-342)
from test_framework.blocktools import (
COINB... |
the-stack_0_11727 | # emacs: -*- mode: python; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil -*-
# ex: set sts=4 ts=4 sw=4 et:
# ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the datalad package for the
# copyright and license terms.
#
# ## ### ### ... |
the-stack_0_11729 | import itertools
import logging
from collections import defaultdict, deque
from BaseClasses import DoorType
from Regions import dungeon_events
from Dungeons import dungeon_keys, dungeon_bigs
from DungeonGenerator import ExplorationState, special_big_key_doors
class KeyLayout(object):
def __init__(self, sector, ... |
the-stack_0_11732 | """
Test calling user defined functions using expression evaluation.
This test checks that typesystem lookup works correctly for typedefs of
untagged structures.
Ticket: https://llvm.org/bugs/show_bug.cgi?id=26790
"""
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldb... |
the-stack_0_11733 | from random import randint
from pygame import *
class GameSprite(sprite.Sprite):
def __init__(self, player_image, player_speed, player_x, player_y):
super().__init__()
self.image = transform.scale(image.load(player_image),(65, 65))
self.speed = player_speed
self.rect = self.im... |
the-stack_0_11734 | from . import _nnls
from numpy import asarray_chkfinite, zeros, double
__all__ = ['nnls']
def nnls(A, b, maxiter=None):
"""
Solve ``argmin_x || Ax - b ||_2`` for ``x>=0``. This is a wrapper
for a FORTRAN non-negative least squares solver.
Parameters
----------
A : ndarray
Matrix ``A`... |
the-stack_0_11735 | #!/usr/bin/env python3
# coding: utf8
"""
Loads and handels training and validation data collections.
"""
__author__ = 'David Flury, Andreas Kaufmann, Raphael Müller'
__email__ = "info@unmix.io"
import hashlib
import glob
import os
import random
from unmix.source.configuration import Configuration
from unmix.source... |
the-stack_0_11737 | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyPybigwig(PythonPackage):
"""A package for accessing bigWig files using libBigWig."""
... |
the-stack_0_11738 | import subprocess
import os
def arg():
try:
import sys
return sys.argv[1]
except:
None
inputfile = input("Enter the file to parse:")
outputfile = input("Enter the file to output to: ")
if os.path.exists("my_filters_001"):
os.chdir("my_filters_001")
subprocess.call(["git pull"]... |
the-stack_0_11740 | #!/usr/bin/env python
# Copyright 2015-2016 Yelp Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... |
the-stack_0_11743 | # 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_11744 | from logging import Logger
from typing import Optional
from widgetastic.browser import Browser
from widgetastic.types import ViewParent
from widgetastic.utils import ParametrizedLocator
from widgetastic.widget.base import ClickableMixin
from widgetastic.widget.base import View
from widgetastic.widget.base import Widge... |
the-stack_0_11749 | import os
import jinja2
import logging
from mkdocs import utils
from mkdocs.utils import filters
from mkdocs.config.base import ValidationError
log = logging.getLogger(__name__)
log.addFilter(utils.warning_filter)
class Theme:
"""
A Theme object.
Keywords:
name: The name of the theme as define... |
the-stack_0_11750 | """Tools for processing Texas PUDF in conjunction with HCUP data
Texas does not participate in HCUP, but does provide instead its own Inpatient Public Use Data Files (PUDF) for similar purposes.
More information on Texas Inpatient PUDF at http://www.dshs.state.tx.us/thcic/hospitals/Inpatientpudf.shtm.
"""
impor... |
the-stack_0_11753 | import json
import vidservers
from utils import gen_client, getLink, process_xpath
# -----------------------------------------------------------------------
def get_server_link(ep_number, server_id, episodes, servers, c):
client = gen_client(referer=f"{c['scheme']}{c['host']}")
sourceId = episodes[ep_number][... |
the-stack_0_11754 | import logging
RANDOM_SEED = 20201234
import argparse
import openml
import os
import numpy as np
import string
import pandas as pd
import scipy
import math
OPENML_REGRESSION_LIST = [201, 1191, 215, 344, 537, 564, 1196, 1199, 1203, 1206,
5648, 23515, 41506, 41539, 42729, 42496]
NS_LIST = list(string.ascii_lowercase) + ... |
the-stack_0_11755 | from rlalgos.pytorch.mf import dqn as dqn_pytorch, sac as sac_pytorch, td3 as td3_pytorch, \
categorical_dqn as c51_pytorch, qr_dqn as qr_dqn_pytorch
from rlalgos.pytorch.mf.atari import categorical_dqn as c51_pytorch, dqn as atari_dqn_pytorch, \
qr_dqn as atari_qr_dqn_pytorch
from rlalgos.pytorch.offline impor... |
the-stack_0_11758 | import os
import random
import numpy as np
import vec_noise
from PIL import Image
from tqdm import tqdm
WORLD_SIZE = [2000, 2000, 3]
WORKING_DIR = os.getcwd()
DATA_DIR = WORKING_DIR[:-8]
os.system("cls")
# +------------------------------------------------------------+
# | Made by... |
the-stack_0_11761 | #!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2014 Thomas Voegtlin
#
# 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... |
the-stack_0_11764 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('example', '0002_relatedsubscription'),
]
operations = [
migrations.CreateModel(
name='Summary',
fiel... |
the-stack_0_11765 | # -*- coding: utf-8 -*-
# Copyright 2022 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_11769 | ###############################################################################
#
# ChartScatter - A class for writing the Excel XLSX Scatter charts.
#
# Copyright 2013-2016, John McNamara, jmcnamara@cpan.org
#
from . import chart
class ChartScatter(chart.Chart):
"""
A class for writing the Excel XLSX Scatte... |
the-stack_0_11770 | #encoding: utf-8
import json
from django import template
from django.conf import settings
register = template.Library()
@register.inclusion_tag('laws/bill_full_name.html')
def bill_full_name(bill):
return { 'bill': bill }
@register.inclusion_tag('laws/bill_list_item.html')
def bill_list_item(bill, add_li=True,... |
the-stack_0_11774 | # -*- coding: utf-8 -*-
# Copyright (c) 2020 Nekokatt
# Copyright (c) 2021-present davfsa
#
# 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 t... |
the-stack_0_11778 | import copy
import argparse
import json
import pickle
import torch
import torch.nn.functional as F
from torch.utils.data import DataLoader
import egg.core as core
from egg.core.util import find_lengths
from egg.core import EarlyStopperAccuracy
from egg.core import CheckpointSaver
from egg.zoo.imitation_lea... |
the-stack_0_11780 | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Pig(Package):
"""
Pig is a dataflow programming environment for processing very large ... |
the-stack_0_11782 | # Copyright (c) 2014 The Bitcoin Core developers
# Copyright (c) 2014-2015 The Dash developers
# Copyright (c) 2015-2017 The PIVX developers
# Copyright (c) 2017 The Peps developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.ph... |
the-stack_0_11784 | # # ⚠ Warning
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
# LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIA... |
the-stack_0_11785 | n = 10
m = 4
stack = []
def main():
while True:
if is_full_solution():
is_acceptable()
if has_next_solution():
try_next_solution()
else:
backtrack()
continue
if can_expand_solution():
expand_solution()
... |
the-stack_0_11787 | import os
import warnings
from collections import OrderedDict
from itertools import product
from typing import Any, Dict, List, Optional, Union
import torch
from torch.nn.functional import interpolate
from torch.nn.modules import LSTM
from torch.nn.modules.conv import Conv2d
from torch.nn.modules.linear import Linear
... |
the-stack_0_11790 | from input_output.Loader import Loader
from joblib import load
# Loader specific for the Titanic task
# The loader loads the data
class TitanicLoader(Loader):
def load_split(self, training_data_file, test_data_file, verbose=False):
train, test = self.load_data(training_data_file, test_data_file)
... |
the-stack_0_11791 | # coding: utf-8
import pprint
import re
import six
class StartRecyclePolicyRequest:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and th... |
the-stack_0_11793 | from somerandomapi.sync_async_handler import SyncAsyncHandler
from somerandomapi import http
def welcome(
key: str,
image: int,
background: str,
type: str,
avatar: str,
username: str,
discriminator: int,
guild_name: str,
text_color: str,
member_count: int,
):
"""
Docs: ... |
the-stack_0_11794 | import os
import json
import nltk
import random
import re
classes_under_consideration = ['ynQuestion','whQuestion','Greet','Statement','Emotion']
out_dir = './../res/data/nps_chat_dataset'
if not os.path.exists(out_dir):
os.makedirs(out_dir)
posts = nltk.corpus.nps_chat.xml_posts()[:]
dataset = {}
for post in po... |
the-stack_0_11795 | # %%
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
from torch.utils.tensorboard import SummaryWriter
from tqdm import tqdm
from ..config import (
device,
experiment_folder,
second_stage,
second_stage_dataset,
)
from ..model import LanguageGenerator, SentenceDecoderWithAtten... |
the-stack_0_11797 | #!/usr/bin/env python
import colorsys
import math
import time
import unicornhathd
print("""Unicorn HAT HD: demo.py
This pixel shading demo transitions between 4 classic graphics demo effects.
Press Ctrl+C to exit!
""")
unicornhathd.rotation(0)
u_width, u_height = unicornhathd.get_shape()
# Generate a lookup ta... |
the-stack_0_11799 | #!/usr/bin/env python
import sys, os , socket, random, struct, time
import argparse
from scapy.all import sendp, send, get_if_list, get_if_hwaddr, bind_layers
from scapy.all import Packet
from scapy.all import Ether, IP, UDP, TCP, Raw
from scapy.fields import *
SRC = 0
DST = 1
DSCP = 2
BOS = 0
LABEL1 = 1
SWITCH_ID ... |
the-stack_0_11800 | #%%
import numpy as np
import pandas as pd
import tqdm
import vdj.io
import vdj.bayes
import vdj.stats
# Load data and stan model
data = pd.read_csv('../../data/compiled_dwell_times.csv')
model = vdj.bayes.StanModel('../stan/pooled_exponential_sum.stan', force_compile=True)
#%%
# Iterate through the data and fit whil... |
the-stack_0_11801 | # Copyright 2019 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_11803 | """empty message
Revision ID: 9b9102347500
Revises: 7ede01846a31
Create Date: 2019-08-14 12:26:40.368422
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '9b9102347500'
down_revision = '7ede01846a31'
branch_labels = None
depends_on = None
def upgrade():
# ... |
the-stack_0_11806 | """market_access_python_frontend URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, na... |
the-stack_0_11807 | import flavio
from wilson import Wilson
import wcxf
from flavio.statistics.likelihood import Likelihood, FastLikelihood
from flavio.statistics.probability import NormalDistribution
from flavio.statistics.functions import pull, pvalue
import warnings
import pandas as pd
import numpy as np
from collections import Ordered... |
the-stack_0_11809 | import pexpect
import argparse
import os
import os.path
import subprocess
import sys
class RepositorySet:
def __init__(self, repository_root, repositories):
self.repository_root = repository_root
self.repositories = repositories
class Repository:
def __init__(self, name, origin_url, remote_u... |
the-stack_0_11810 | #!/usr/bin/env python3
# Copyright 2018 The SwiftShader 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
#
# Un... |
the-stack_0_11811 | """Serializers Alquileres"""
#Django REST Framework
from rest_framework import serializers
#Model
from maquinaria.alquileres.models import Alquiler
from maquinaria.maquinas.models import Maquina
class AlquilerModelSerializer(serializers.ModelSerializer):
"""Modelo Serializer de Cliente"""
class Meta:
"""Clase ... |
the-stack_0_11812 |
from PIL import Image
# from PIL import GifImagePlugin
import cv2
import numpy as np
import os
#root_dir = os.path.dirname('/Users/apple/Desktop/414project/')
input_video = Image.open("./walking.gif")
frame_length = input_video.n_frames
def track_position_per_frame(f_num):
image = cv2.imread('./walk... |
the-stack_0_11814 | # coding: utf-8
from __future__ import absolute_import
import pytest
try:
import vtk
except:
vtk = None
from six import string_types
from panel.models.vtk import VTKPlot
from panel.pane import Pane, PaneBase, VTK
vtk_available = pytest.mark.skipif(vtk is None, reason="requires vtk")
def make_render_windo... |
the-stack_0_11815 | from abc import ABCMeta, abstractmethod
from collections import OrderedDict
from blenderneuron.activity import Activity
class RootGroup:
__metaclass__ = ABCMeta
def __init__(self):
self.name = ""
self.roots = OrderedDict()
self.import_synapses = False
self.interact... |
the-stack_0_11819 | #!/usr/bin/env python
# coding: utf-8
import logging
import os
import pickle
import numpy as np
import pandas as pd
from sklearn.metrics import roc_auc_score
from sklearn.model_selection import train_test_split
from lightautoml.automl.presets.tabular_presets import TabularAutoML
from lightautoml.dataset.roles import ... |
the-stack_0_11821 | import warnings
from geopy.compat import urlencode
from geopy.exc import GeocoderParseError, GeocoderServiceError
from geopy.geocoders.base import DEFAULT_SENTINEL, Geocoder
from geopy.location import Location
from geopy.util import logger
__all__ = ("Yandex", )
class Yandex(Geocoder):
"""Yandex geocoder.
... |
the-stack_0_11828 | from setuptools import setup
from setuptools import find_packages
NAME = "torbjorn"
AUTHOR = "Ailln"
EMAIL = "kinggreenhall@gmail.com"
URL = "https://github.com/Ailln/torbjorn"
LICENSE = "MIT License"
DESCRIPTION = "Provide some practical Python decorators."
if __name__ == "__main__":
setup(
name=NAME,
... |
the-stack_0_11831 | # -*- coding: utf-8-*-
from __future__ import absolute_import
import atexit
from .plugins import Email
from apscheduler.schedulers.background import BackgroundScheduler
import logging
from . import app_utils
import time
import sys
if sys.version_info < (3, 0):
import Queue as queue # Python 2
else:
import queu... |
the-stack_0_11832 | import numpy as np
from gym_minigrid.minigrid import *
from gym_minigrid.register import register
class Ice(WorldObj):
def __init__(self):
super().__init__('ice', 'blue')
def can_overlap(self):
return True
def render(self, img):
c = (119, 201, 240) # Pale blue
# Backgr... |
the-stack_0_11833 | import os
import subprocess
import sys
from typing import Optional
from briefcase.config import BaseConfig
from briefcase.exceptions import BriefcaseCommandError
from .base import BaseCommand
from .create import DependencyInstallError, write_dist_info
class DevCommand(BaseCommand):
cmd_line = 'briefcase dev'
... |
the-stack_0_11835 | import numpy as np
import argparse
import nibabel as nib
parser = argparse.ArgumentParser(description='Convert AFNI to RAS')
reqoptions = parser.add_argument_group('Required arguments')
reqoptions.add_argument('-i', '-in', dest="infile", required=True, help='Dir' )
reqoptions.add_argument('-o', '-out', dest="outfile... |
the-stack_0_11838 | # Copyright (c) Open-MMLab. All rights reserved.
import logging
import torch.nn as nn
import torch.utils.checkpoint as cp
from ..runner import load_checkpoint
from .weight_init import constant_init, kaiming_init
def conv3x3(in_planes, out_planes, stride=1, dilation=1):
"""3x3 convolution with padding"""
ret... |
the-stack_0_11839 | import sys
import torch
import os
import shutil
from torch.utils.data.dataloader import DataLoader
import random
sys.path.append('.')
class AverageMeter(object):
"""Computes and stores the average and current value"""
def __init__(self, name, fmt=':f'):
self.name = name
self.fmt = fmt
... |
the-stack_0_11843 | # Write a program that takes a list of numbers (for example, a = [5, 10, 15, 20, 25]) and makes a new list of only the first and last elements of the given list.
# For practice, write this code inside a function.
def first_and_last_element_of_a_list(number_list):
if(len(number_list) <= 1):
return number_l... |
the-stack_0_11844 | import copy
import datetime
from operator import attrgetter
from django.core.exceptions import ValidationError
from django.db import models, router
from django.db.models.sql import InsertQuery
from django.test import TestCase, skipUnlessDBFeature
from django.test.utils import isolate_apps
from django.utils.timezone im... |
the-stack_0_11847 | from __future__ import annotations
import inspect
from pathlib import Path
import pytest
from _pytest.monkeypatch import MonkeyPatch
import platformdirs
from platformdirs.android import Android
def test_package_metadata() -> None:
assert hasattr(platformdirs, "__version__")
assert hasattr(platformdirs, "__... |
the-stack_0_11852 | #!/usr/bin/python3
try:
import os, sys, requests
import argparse, json
import datetime as dt
import configparser
from elasticsearch import Elasticsearch
from github import Github
from string import ascii_letters
print("All libraries/modules loaded as expected !!!!! ")
except Excep... |
the-stack_0_11853 | import torch
import torch.nn as nn
import torch.nn.functional as F
import math
from torch.autograd import Variable
class VGG_enc(nn.Module):
def __init__(self, input_channels=6):
super(VGG_enc, self).__init__()
in_channels = input_channels
self.c11 = nn.Conv2d(in_channels, 64, kernel_size=... |
the-stack_0_11855 | # 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_11857 | import boto3
import copy
import hashlib
import logging
import json
import time
import typing
import uuid
from bert import \
encoders as bert_encoders, \
datasource as bert_datasource, \
constants as bert_constants
from datetime import datetime, timedelta
logger = logging.getLogger(__name__)
PWN = typing.... |
the-stack_0_11858 | import numpy as np
from astropy.wcs.wcsapi import BaseHighLevelWCS
from glue.core import BaseData
from glue_jupyter.bqplot.image import BqplotImageView
from jdaviz.core.registries import viewer_registry
__all__ = ['ImvizImageView']
@viewer_registry("imviz-image-viewer", label="Image 2D (Imviz)")
class ImvizImageV... |
the-stack_0_11861 | import cv2
import numpy as np
from argparse import ArgumentParser
def parse_args():
parser = ArgumentParser()
parser.add_argument('--normal_path', type=str)
parser.add_argument('--depth_path', type=str)
parser.add_argument('--silhou_path', type=str)
parser.add_argument('--output_path', ty... |
the-stack_0_11862 | # coding=utf-8
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# 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/lice... |
the-stack_0_11864 | def scrape():
from bs4 import BeautifulSoup
from selenium import webdriver
import pandas as pd
import urllib
import time
URL_mars_news = "https://mars.nasa.gov/news/"
URL_mars_image = "https://www.jpl.nasa.gov/spaceimages/?search=&category=Mars"
URL_mars_weather = "https://twitter.com/m... |
the-stack_0_11867 | import sys
n, m, *ab = map(int, sys.stdin.read().split())
ab = list(zip(*[iter(ab)] * 2))
root = list(range(n+1)); root[0] = None
height = [0] * (n + 1); height[0] = None
size = [1] * (n + 1); size[0] = None
sys.setrecursionlimit(10 ** 9)
def find_root(v):
u = root[v]
if u == v:
return u... |
the-stack_0_11868 | # Copyright 2020 Google
#
# 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, soft... |
the-stack_0_11869 | # Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "LICENSE.txt" file acc... |
the-stack_0_11870 | # -*- coding: utf-8 -*-
'''
Exodus Add-on
Copyright (C) 2016 Exodus
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your opti... |
the-stack_0_11872 | from faker import Faker
import os
import random
import pandas as pd
CurrentDir = os.path.dirname(os.path.realpath(__file__))
def CreateFakeInformation(fake,AccountsCSV):
AccountData = pd.read_csv(os.path.join(CurrentDir,AccountsCSV),encoding='latin-1')
AccountDF = pd.DataFrame(AccountData)
DataColumns =... |
the-stack_0_11878 |
#1. 编写一个函数:
#1) 计算所有参数的和的基数倍(默认基数为base=3)
def mysum(*number):
res = 0
for i in number:
res += i
return res
def bei(a,base=3):
r = 0
r = mysum(a) * base
return r
if __name__=="__main__":
print(bei(mysum(1,3,5)))
|
the-stack_0_11881 | # Amara, universalsubtitles.org
#
# Copyright (C) 2012 Participatory Culture Foundation
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your opti... |
the-stack_0_11883 | #!/usr/bin/env python3
"""
USAGE:
yb_mass_column_update.py [options]
PURPOSE:
Update the value of multiple columns.
OPTIONS:
See the command line help message for all options.
(yb_mass_column_update.py --help)
Output:
The update statements for the requested set of columns.
"""
import sy... |
the-stack_0_11884 | # Copyright (c) 2020 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_11885 | """Implemented support for Common Workflow Language (CWL) for Toil."""
# Copyright (C) 2015 Curoverse, Inc
# Copyright (C) 2015-2021 Regents of the University of California
# Copyright (C) 2019-2020 Seven Bridges
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in c... |
the-stack_0_11886 | # coding=utf-8
# 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 requir... |
the-stack_0_11887 | """
University of Minnesota
Aerospace Engineering and Mechanics - UAV Lab
Copyright 2019 Regents of the University of Minnesota
See: LICENSE.md for complete license details
Author: Chris Regan
Analysis for Thor RTSM
"""
#%%
# Import Libraries
import numpy as np
import matplotlib.pyplot as plt
# Hack to allow loadin... |
the-stack_0_11890 | #!/usr/bin/env python
"""
For more information on this API, please visit:
https://duo.com/docs/adminapi
-
Script Dependencies:
requests
Depencency Installation:
$ pip install -r requirements.txt
System Requirements:
- Duo MFA, Duo Access or Duo Beyond account with aministrator priviliedges.
- Duo ... |
the-stack_0_11892 |
# 升半音
def sharp_note(mynote, sharped):
'''
给一个音符升半音
'''
if sharped:
if mynote == '1':
return '2'
elif mynote == '2':
return '3'
elif mynote == '4':
return '5'
elif mynote == '5':
return '6'
elif mynote == '6':
... |
the-stack_0_11894 | import collections
Set = set
try:
from collections import OrderedDict
except ImportError:
class OrderedDict(dict):
'Dictionary that remembers insertion order'
# An inherited dict maps keys to values.
# The inherited dict provides __getitem__, __len__, __contains__, and get.
# T... |
the-stack_0_11897 | from typing import Any, Dict
from ..base import BaseDistiller, DistillationResult
class JsonDistiller(BaseDistiller):
def __call__(
self,
source: Dict[str, Any],
context: Dict[str, Any] = None,
raise_validation_error: bool = False,
) -> DistillationResult:
raise NotImp... |
the-stack_0_11898 | import abc
from typing import TYPE_CHECKING
import jsonpickle
from .output.json_writer import ADD_VARIABLE, CHANGE_VARIABLE, EXECUTE_FRAME, NEW_FRAME, REMOVE_VARIABLE
if TYPE_CHECKING:
from .debugger import Debugger
class Replayer(abc.ABC):
def __init__(self: "Debugger"):
# Propagate initialization... |
the-stack_0_11899 | from gym.spaces import Box
from ray.rllib.agents.dqn.distributional_q_tf_model import \
DistributionalQTFModel
from ray.rllib.agents.dqn.dqn_torch_model import \
DQNTorchModel
from ray.rllib.models.tf.fcnet import FullyConnectedNetwork
from ray.rllib.models.torch.fcnet import FullyConnectedNetwork as TorchFC
f... |
the-stack_0_11900 | import argparse
import os
import json
import joblib
from azureml.core import Run
from training.train_helper import split_data, train_model, get_model_metrics
dummy1 = os.path.abspath(os.curdir)
print(f"Root directory is {dummy1}")
print(f"Listing files in root directory {os.listdir(dummy1)}")
print("Create new featur... |
the-stack_0_11901 | from __future__ import absolute_import
from __future__ import print_function
import veriloggen
import _iter
expected_verilog = """
module blinkled
(
input CLK,
input RST,
output reg [8-1:0] LED
);
reg [32-1:0] count;
always @(posedge CLK) begin
if(RST) begin
count <= 0;
end else begin
i... |
the-stack_0_11903 | import jesse.helpers as jh
from jesse.enums import sides, order_statuses
from jesse.models import Order
from jesse.enums import order_types
from .utils import set_up, single_route_backtest
def test_cancel_order():
set_up()
order = Order({
'id': jh.generate_unique_id(),
'exchange': 'Sandbox',
... |
the-stack_0_11904 | #!/usr/bin/env python
'''
TnAmplicons
Analysis of Tn-Seq data, Transposon insertion site detection, initial
version is to process the samples (trim) primers (transoposon sequence)
detect the TA genomic insertion site and map the resulting files to the
genome.
Later version will exand on analysis
'''
import sys
try:... |
the-stack_0_11905 | import numpy as np
import torch
class SamplingAlgo:
def __init__(self, t_prof, env_bldr, n_envs_avg, n_envs_br, br_buf2, avg_buf2, br_learner2, avg_learner2):
if t_prof.nn_type == "recurrent":
from PokerRL.rl.buffers.BRMemorySaverRNN import BRMemorySaverRNN
from NFSP.workers.la.ac... |
the-stack_0_11907 | import os
import shutil
import tempfile
from datetime import datetime
from typing import Text, List, Dict
import requests
from fastapi import File
from fastapi.background import BackgroundTasks
from fastapi.security import OAuth2PasswordBearer
from loguru import logger
from mongoengine.errors import ValidationError
fr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.