filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_106_32038 | # model settings
model = dict(
type='CenterNet',
pretrained='modelzoo://resnet18',
backbone=dict(
type='ResNet',
depth=18,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_eval=False,
add_summay_every_n_step=200,
style='pytorch'),
... |
the-stack_106_32040 | # We must redefine it in Py3k if it's not already there
def execfile(file, glob=None, loc=None):
if glob is None:
import sys
glob = sys._getframe().f_back.f_globals
if loc is None:
loc = glob
# It seems that the best way is using tokenize.open(): http://code.activestate.com/... |
the-stack_106_32041 | import argparse
import logging
import os
from typing import List, Optional, Text, Dict, Union, Any
from rasa.cli import SubParsersAction
import rasa.shared.data
from rasa.shared.exceptions import YamlException
import rasa.shared.utils.io
import rasa.shared.utils.cli
from rasa.cli.arguments import test as arguments
fro... |
the-stack_106_32042 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Simulates the Arduino communication stream as expected by demo A and C.
"""
__author__ = "Dennis van Gils"
__authoremail__ = "vangils.dennis@gmail.com"
__url__ = "https://github.com/Dennis-van-Gils/DvG_Arduino_PyQt_multithread_demo"
__date__ = "11-08-2020"
__version__ =... |
the-stack_106_32044 | # Copyright (c) 2016 The Pybind Development Team, All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of cond... |
the-stack_106_32046 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 5/15/20 4:49 PM
# @File : grover.py
# qubit number=4
# total number=19
import cirq
import cirq.google as cg
from typing import Optional
import sys
from math import log2
import numpy as np
#thatsNoCode
def make_circuit(n: int, input_qubit):
c = cirq.Ci... |
the-stack_106_32048 | # -*- coding: utf-8 -*-
__author__ = 'mika hämäläinen'
pronouns = {"SG1" : "minä", "SG2" : "sinä", "SG3" : "se", "PL1" : "me", "PL2": "te", "PL3": "ne"}
def pronoun(person, human=True):
if human and person is "SG3":
return "hän"
if human and person is "PL3":
return "he"
if person in pron... |
the-stack_106_32049 | #!/usr/bin/python
'''
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"... |
the-stack_106_32051 | """SCons.Subst
SCons string substitution.
"""
#
# Copyright (c) 2001 - 2019 The SCons Foundation
#
# 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_106_32053 | import unittest
import sys
import pexpect
from vncdotool import rfb
class TestLogEvents(object):
def setUp(self):
cmd = 'vncev -rfbport 5999 -rfbwait 1000'
self.server = pexpect.spawn(cmd, timeout=2)
self.server.logfile_read = sys.stdout
cmd = 'vnclog --listen 1842 -s :99 -'
... |
the-stack_106_32054 | #!/usr/bin/env python
# coding: utf-8
import librosa
import logging
import numpy as np
from scipy.spatial import distance
from scipy import signal
from scipy.ndimage import filters
from msaf.algorithms.interface import SegmenterInterface
import msaf.utils as U
def median_filter(X, M=8):
"""Median filter along th... |
the-stack_106_32055 | from . import support
from . import tuner
from .learner import Learner
from .random import Random
from .session import Session
import json
import numpy as np
import os
import threading
class Agent:
def __init__(self, session, semaphore, config):
self.session = session
self.semaphore = semaphore
... |
the-stack_106_32056 | from __future__ import division
from __future__ import print_function
import os.path as osp
import numpy as np
from easydict import EasyDict as edict
__C = edict()
cfg = __C
# Dataset name: flowers, birds
__C.DATASET_NAME = 'coco'
__C.CONFIG_NAME = ''
__C.DATA_DIR = ''
__C.GPU_ID = 0
__C.CUDA = True
__C.WORKERS = 6... |
the-stack_106_32058 | from tkinter import *
class GUI:
def __init__(self, master):
frame = Frame(master)
frame.pack()
frame.configure(background='white')
self.button1 = Button(frame, bg="white")
self.button1.config(image=photo1)
self.button2 = Button(frame,bg="white")
self.button2.config(image=photo2)
... |
the-stack_106_32060 | # Test script for interaction based messages using DiscordAPI compoments
from discord.ext import commands
import discord
import discord_slash.utils.manage_components as utils
from discord_slash.model import ButtonStyle
from discord_slash.cog_ext import cog_component
class Components(commands.Cog):
def __init__(se... |
the-stack_106_32062 | from django.shortcuts import render, redirect
from django.urls import reverse
from django.contrib.auth.admin import User
from tool.models import Project as ProjectModel, ProjectMember, GroupAccess
from tool.forms import UserCreateForm, UserEditForm, ProjectCreationForm, ProjectEditForm
from tool.utilies import *
import... |
the-stack_106_32063 | # coding=utf-8
import pygame
from game import *
class Pool(object):
def __init__(self, x, y, width, height, style='grass'):
self.x, self.y = x, y
self.Vx, self.Vy = 0, 0
self.width, self.height = width, height
# Platform images
self.image = pygame.image.load('env... |
the-stack_106_32064 | """View Module."""
from jinja2 import ChoiceLoader, Environment, PackageLoader, select_autoescape
from jinja2.exceptions import TemplateNotFound
from .exceptions import RequiredContainerBindingNotFound, ViewException
from .response import Responsable
class View(Responsable):
"""View class. Responsible for hand... |
the-stack_106_32065 | from __future__ import print_function
import torch
from model import highwayNet
from utils import ngsimDataset,maskedNLL,maskedMSETest,maskedNLLTest
from torch.utils.data import DataLoader
import time
## Network Arguments
args = {}
args['use_cuda'] = True
args['encoder_size'] = 64
args['decoder_size'] = 128
args['in... |
the-stack_106_32066 | # -*- coding: utf-8 -*-
"""
Wind Setbacks tests
"""
from click.testing import CliRunner
import json
import numpy as np
import os
import pytest
import shutil
import tempfile
import traceback
from rex.utilities.loggers import LOGGERS
from reVX import TESTDATADIR
from reVX.handlers.geotiff import Geotiff
from reVX.wind_... |
the-stack_106_32068 | # Copyright 2019 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 a... |
the-stack_106_32069 | from . import QtCore
class RecursiveSortFilterProxyModel(QtCore.QSortFilterProxyModel):
"""Filters to the regex if any of the children matches allow parent"""
def filterAcceptsRow(self, row, parent):
regex = self.filterRegExp()
if not regex.isEmpty():
pattern = regex.pattern()
... |
the-stack_106_32071 | import threading
import time
# global variables
hero_health = 40
orc_health = 7
dragon_health = 20
def thread_orc():
global hero_health
global orc_health
while orc_health > 0 and hero_health > 0:
time.sleep(1.5)
hero_health = hero_health - 1
print("Orc attacked... Hero health: ", ... |
the-stack_106_32072 | import warnings
import attr
import cattr
from typing import (
Dict,
Optional,
List,
Any,
DefaultDict,
Mapping,
Tuple,
Union,
ClassVar,
)
from enum import Enum
import collections
import argparse
import abc
import numpy as np
import math
import copy
from mlagents.trainers.cli_utils i... |
the-stack_106_32075 | # -*- coding: utf-8 -*-
"""ATA over Ethernet Protocol."""
from __future__ import absolute_import
import struct
from . import dpkt
from .compat import iteritems
class AOE(dpkt.Packet):
"""ATA over Ethernet Protocol.
See more about the AOE on
https://en.wikipedia.org/wiki/ATA_over_Ethernet
Attribute... |
the-stack_106_32076 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sympy
import mpmath
import math
import re
from itertools import chain
from mathics.core.numbers import get_type, dps, prec, min_prec, machine_precision
from mathics.core.convert import sympy_symbol_prefix, SympyExpression
def fully_qualified_symbol_name(name):
... |
the-stack_106_32077 | # @TODO instead of using threading, replace with aiohttp!
from http.server import BaseHTTPRequestHandler, HTTPServer
import threading
import json
import logging
logger = logging.getLogger()
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.DEBUG)
def parse_jcu_command(p... |
the-stack_106_32078 | def setup_fs(s3, key="", secret="", endpoint="", cert="", passwords={}):
"""Given a boolean specifying whether to use local disk or S3, setup filesystem
Syntax examples: AWS (http://s3.us-east-2.amazonaws.com), MinIO (http://192.168.0.1:9000)
The cert input is relevant if you're using MinIO with TLS enabled... |
the-stack_106_32079 | """
pyaud.plugins
=============
Main module used for public API.
"""
import functools as _functools
import importlib as _importlib
import os as _os
import sys as _sys
from abc import ABC as _ABC
from abc import abstractmethod as _abstractmethod
from pathlib import Path as _Path
from subprocess import CalledProcessErro... |
the-stack_106_32080 | # -*- coding: utf-8 -*-
#
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
the-stack_106_32082 | from .restful_model_collection import RestfulModelCollection
from .errors import FileUploadError
from six import StringIO
import base64
import json
class NylasAPIObject(dict):
attrs = []
# The Nylas API holds most objects for an account directly under '/',
# but some of them are under '/a' (mostly the acc... |
the-stack_106_32083 | import msgpack
import mmap
import re
import sys
file_path = sys.argv[1]
out_file_path = sys.argv[2]
num_rows = int(sys.argv[3])
discrete_query_col_index = int(sys.argv[4])
num_query_col_index = int(sys.argv[5])
compression_method = sys.argv[6]
compression_level = sys.argv[7]
if compression_method == "bz2":
import... |
the-stack_106_32085 | """Script to download the 20 newsgroups text classification set"""
import os
import tarfile
from contextlib import closing
try:
from urllib import urlopen
except ImportError:
from urllib.request import urlopen
URL = ("http://people.csail.mit.edu/jrennie/"
"20Newsgroups/20news-bydate.tar.gz")
ARCHIVE_... |
the-stack_106_32086 | '''
*
* Copyright (C) 2020 Universitat Politècnica de Catalunya.
*
* 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 requi... |
the-stack_106_32087 | from inspect import getsource
import urllib.request
import json
# from pkg_resources import SOURCE_DIST
from .models import Articles, Sources
api_key = None
sources_url = None
articles_url = None
def configure_request(app):
global api_key, sources_url, articles_url
api_key = app.config['NEWS_API_KEY']
... |
the-stack_106_32090 | # Tests for parsing of label queries
import unittest
import os
import sys
# Insert .. at the beginning of path so we use this version instead
# of something that's already been installed
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
import musicbrainzngs
from musicbrainzngs import ... |
the-stack_106_32091 | import unittest
from contextlib import contextmanager
from unittest import mock
import dbt.flags as flags
from dbt.adapters.snowflake import SnowflakeAdapter
from dbt.adapters.base.query_headers import MacroQueryStringSetter
from dbt.logger import GLOBAL_LOGGER as logger # noqa
from dbt.parser.results import ParseRe... |
the-stack_106_32095 | """
Multiple plots vignette
========================
Demo multiple plots and style the figure.
"""
import matplotlib.pyplot as plt
ax = plt.subplot(2, 1, 1)
ax.set_xticklabels([])
ax.set_yticklabels([])
plt.text(-0.05, 1.02, " Multiplot: plt.subplot(...)\n",
horizontalalignment='left',
verticalalign... |
the-stack_106_32096 | from __future__ import print_function
from __future__ import division
from keras.preprocessing.image import ImageDataGenerator, load_img, img_to_array
import os
from PIL import ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True
def augmentation(image_path, iters, file_list):
image_datagen = ImageDataGenerator(rotatio... |
the-stack_106_32097 | """
SOILICE to mrfso converter
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import cmor
import cdms2
import logging
import numpy as np
from e3sm_to_cmip.lib import handle_variables
# list of raw variable names needed
RAW_VARIABLES = [str('SOILICE')]
VAR_NAME = str('mrfso')
V... |
the-stack_106_32098 | """Config flow to configure Coolmaster."""
from pycoolmasternet_async import CoolMasterNet
import voluptuous as vol
from homeassistant import config_entries, core
from homeassistant.const import CONF_HOST, CONF_PORT
from .const import AVAILABLE_MODES, CONF_SUPPORTED_MODES, DEFAULT_PORT, DOMAIN
MODES_SCHEMA = {vol.R... |
the-stack_106_32101 | """tech URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based ... |
the-stack_106_32103 | from pytorch_lightning.loggers import LoggerCollection
from pathlib import Path
from typing import Any, List, Optional, Tuple, Union
import numpy as np
import pytorch_lightning as pl
import torch as tr
import torch.nn.functional as F
from torch import Tensor, nn
from torch.optim import Adam
from torch.utils.data impo... |
the-stack_106_32104 | # -*- coding: utf8 -*-
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. 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... |
the-stack_106_32105 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Debugger to save results during training.
"""
from __future__ import annotations
import threading
from queue import Queue
from typing import Optional
from torch import Tensor
from onevision.type import Callable
from onevision.utils import console
__all__ = [
"D... |
the-stack_106_32107 |
import numpy as np
# mne imports
import mne
from mne import io
from mne.datasets import sample
# EEGNet-specific imports
from EEGModels import EEGNet
from tensorflow.keras import utils as np_utils
from tensorflow.keras.callbacks import ModelCheckpoint
# PyRiemann imports
from pyriemann.estimation import XdawnCovari... |
the-stack_106_32109 | #!/usr/bin/env python3
# Copyright (c) 2014-2019 The Wazzle Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the listtransactions API."""
from decimal import Decimal
from io import BytesIO
from test_framewor... |
the-stack_106_32110 | from django.contrib import admin
from .models import User
from django.contrib.auth.models import Group
class UserAdmin(admin.ModelAdmin):
list_display = (
'user_id',
'name',
'student_id',
'grade',
'circles',
'department',
'level',
'date_joined'
... |
the-stack_106_32113 | #!/usr/bin/env python3
# -------------------------------------------------------------
#
# 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 ... |
the-stack_106_32114 | import sys
import os
inputfile=os.path.join(sys.path[0],sys.argv[1])
frequency = 0
frequencies = {0}
changes = []
with open(inputfile) as changes_file:
for change in changes_file:
changes.append(int(change))
while True:
for change in changes:
frequency += change
if frequency in frequencies:
pr... |
the-stack_106_32115 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
聯合報
the crawl deal with udn's news
Usage: scrapy crawl udn -o <filename.json>
"""
from datetime import datetime
from datetime import timedelta
import scrapy
TODAY_STR = datetime.now().strftime('%m-%d')
class UdnSpider(scrapy.Spider):
name = "udn_origin"
def ... |
the-stack_106_32118 | # -*- coding: utf-8 -*-
# @Time : 2020/12/01 15:44:11
# @Author : DannyDong
# @File : run.py
# @Describe: flask应用入口
from factory import create_app
if __name__ == "__main__":
app = create_app()
app.run()
|
the-stack_106_32119 | # Day 12: Subterranean Sustainability
from utils import *
def main(start: str):
rules = load_rules()
plants = set()
for i in range(len(start)):
if start[i] == '#':
plants.add(i)
for i in range(20):
plants = iterate(plants, rules)
print('Part 1:', sum(plants))
# B... |
the-stack_106_32120 | import argparse
import os
import numpy as np
from dagbldr.datasets import fetch_binarized_mnist
from dagbldr.utils import convert_to_one_hot, load_checkpoint
from dagbldr.utils import interpolate_between_points, make_gif
parser = argparse.ArgumentParser()
parser.add_argument("saved_functions_file",
... |
the-stack_106_32121 | '''LeNet in PxTorch.'''
import torch.nn as nn
from src.models.classifiers.general import GeneralNet
class Dense(GeneralNet):
def __init__(self, n_classes, n_channels_in=1, **kwargs):
super(Dense, self).__init__(n_classes, n_channels_in, **kwargs)
self.fc1 = nn.Linear(n_channels_in * 32 * 32, 300... |
the-stack_106_32122 | def var(mat,col,population,get,obj,dFrame):
from ..customs.objects import Label
nullobj = mat.DEFAULT_NULL
feats = mat.features.labels
if mat.features.level == 1:
feats = [row[0] for row in feats]
col = feats.index(col)+1 if isinstance(col,(tuple,str)) else col
if col != None:
... |
the-stack_106_32124 | import os
from auxpump import TEMP_PATH, CONFIG
import time
def remote_exec(cmd, *args):
temp_ver = 0
fname = None
while fname is None or fname in os.listdir(TEMP_PATH):
fname = 'tmp' + str(temp_ver) + '.sh'
temp_ver += 1
fname = os.path.join(TEMP_PATH, fname)
try:
cmd = ' '... |
the-stack_106_32127 | import setuptools
setup_reqs = ['pytest', 'pytest-cov', 'pytest-runner', 'flake8']
setuptools.setup(
name="gordian",
version="2.1.2",
author="Intuit",
author_email="cg-sre@intuit.com",
description="A tool to search and replace files in a Git repo",
url="https://github.com/argoproj-labs/gordian"... |
the-stack_106_32130 | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
the-stack_106_32136 | """
This module defines base classes for events.
"""
from datetime import timedelta
from uuid import UUID
from pydantic import BaseModel, Field, validator
__all__ = ["Event", "ElementTransportEvent", "PrimitiveEvent"]
class Event(BaseModel):
"""
The base event schema.
"""
name: str = Field(..., desc... |
the-stack_106_32138 | from _kratos import Simulator as _Simulator
from .generator import Generator, PortType
# Python wrapper for the simulator
class Simulator:
def __init__(self, generator: Generator):
self._sim = _Simulator(generator.internal_generator)
# get the clock and reset
clks = generator.internal_gene... |
the-stack_106_32139 | '''
Test TMCL Parameters of TMCM1161 via RS485 interface and module ID 1.
Created on 15.12.2020
@author: LK
'''
from PyTrinamicMicro.platforms.motionpy2.connections.rs485_tmcl_interface import rs485_tmcl_interface
from PyTrinamic.modules.TMCM1161.TMCM_1161 import TMCM_1161
import logging
MODULE_ID = 1
GP_BANK = 0
A... |
the-stack_106_32141 | #-*- coding:utf-8 _*-
"""
@author:charlesXu
@file: Info_Ext_main.py
@desc: 数据预处理
@time: 2018/08/08
"""
import sys, pickle, os, random
import numpy as np
import pdb
## tags, BIO 标注策略
tag2label = {"O": 0,
"B-PER": 1, "I-PER": 2,
"B-LOC": 3, "I-LOC": 4,
"B-ORG": 5, "I-ORG": 6
... |
the-stack_106_32142 | """Module for keeping the value of a RemoteValue from KNX bus up to date."""
import asyncio
from enum import Enum
import logging
from typing import TYPE_CHECKING, Awaitable, Callable, Dict, Optional, Tuple, Union
from xknx.remote_value import RemoteValue
if TYPE_CHECKING:
from xknx.xknx import XKNX
logger = log... |
the-stack_106_32146 | # This program simulates 10 tosses of a coin.
import random
# Constants
HEADS = 1
TAILS = 2
TOSSES = 10
def main():
for toss in range(TOSSES):
# Simulate the coin toss.
if random.randint(HEADS, TAILS) == HEADS:
print('Heads')
else:
print('Tails')
# Call... |
the-stack_106_32147 | """Posts URL configuration"""
from django.urls import path
from .views import (
add_post_view,
category_view,
delete_post_view,
post_detail_view,
post_list_view,
search_results_view,
update_post_view,
)
urlpatterns = [
path("post_list/", post_list_view, name="post_list"),
path("pos... |
the-stack_106_32148 | from copy import deepcopy
from typing import List, Union, Tuple, Dict
import numpy as np
import pandas as pd
def process_dataframe(X: Union[pd.DataFrame, np.ndarray], copy=True) -> pd.DataFrame:
if isinstance(X, pd.DataFrame):
if copy:
X_ = deepcopy(X)
else:
X_ = X
eli... |
the-stack_106_32149 | # (C) Datadog, Inc. 2013-2017
# (C) Brett Langdon <brett@blangdon.com> 2013
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
# stdlib
import re
import time
import warnings
from collections import defaultdict
# 3p
from six.moves.urllib.parse import urlparse, quote_plus, urljoin
from six impo... |
the-stack_106_32150 | import os
from datetime import date
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.http.response import Http404
from django.shortcuts import get_object_or_404
from jinja2 import TemplateSyntaxError
from requests.exceptions import ConnectionError, HTTPError
from ... |
the-stack_106_32155 | from memrise import Course, Data
file = 'test.db'
db = Data(file)
course = Course(2157577)
# Create file database output
db = Data(file)
# Connect to file database and init
db.init_database()
# Update information about the course
db.update_course(course)
# Update IPA for database
db.update_ipa()
# Tra... |
the-stack_106_32157 | import requests
import random
import sys
cat_url = "https://cat-fact.herokuapp.com/facts"
r = requests.get(cat_url)
r_obj_list = r.json()
fact_list = []
for fact in r_obj_list:
fact_list.append(fact["text"])
def select_random_fact(fact_arr):
return fact_arr[random.randint(0, len(fact_list) + 1)]
random_fac... |
the-stack_106_32161 | '''
NOTICE
This module was solely developed under MITRE corporation internal funding project code 10AOH630-CA
Approved for Public Release; Distribution Unlimited. Public Release Case Number 20-1780.
(c) 2020 The MITRE Corporation. ALL RIGHTS RESERVED.
Licensed under the Apache License, Version 2.0 (the "License")... |
the-stack_106_32163 | """
This is a job script for running NPG/DAPG on hand tasks and other gym envs.
Note that DAPG generalizes PG and BC init + PG finetuning.
With appropriate settings of parameters, we can recover the full family.
"""
from mjrl.utils.gym_env import GymEnv
from mjrl.policies.gaussian_mlp import MLP
from mjrl.baselines.qu... |
the-stack_106_32165 | '''BlockMacro, define a macro.
:copyright: 2015, Jeroen van der Heijden (Cesbit)
'''
import re
from .exceptions import DefineBlockError
from .constants import ALWAYS_ALLOWED, LINE_END
class BlockMacro:
RE_MACRO = re.compile(r'^\s*#macro\s+([a-zA-Z0-9_]+)\s*:\s*$', re.UNICODE)
def __init__(self, lines):
... |
the-stack_106_32167 | # -*- coding: utf-8 -*-
"""
TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-节点管理(BlueKing-BK-NODEMAN) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance ... |
the-stack_106_32169 | '''
scan_instances
==============
NOTE: not currently tested code.
The following methods allow for interaction into the Tenable.sc
`Scan Result <https://docs.tenable.com/sccv/api/Scan-Result.html>`_ API. While
the Tenable.sc API refers to the model these endpoints interact with as
*ScanResult*, were actually inter... |
the-stack_106_32170 | #
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under ... |
the-stack_106_32172 | # 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 required by applica... |
the-stack_106_32174 | import os
import re
import subprocess # nosec
from django.core.management.base import BaseCommand, CommandError
class Command(BaseCommand):
"""
Load schema from remote Heroku PostgreSQL database.
This command can be useful to load the Heroku Connect database schema into
a local development environm... |
the-stack_106_32176 | import numpy as np
import h5py
import random
import tensorflow as tf
import os
from typing import List
AUTOTUNE = tf.data.experimental.AUTOTUNE
def images_in_paths(folder_path: str) -> List[str]:
"""
Collects paths to all images from one folder and return them as a list
:param folder_path:
:return: l... |
the-stack_106_32177 | import string
from urllib import urlencode
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render
from django.views.decorators.csrf import csrf_exempt
import commonware.log
from oauthlib import oauth1
from oauthlib.common import safe_string_equals
from mkt.api.models import Ac... |
the-stack_106_32180 | # pylint:disable=unused-variable
# pylint:disable=unused-argument
# pylint:disable=redefined-outer-name
import json
from pathlib import Path
from typing import Dict
import pytest
import yaml
@pytest.fixture
def port_type() -> str:
return ""
@pytest.fixture
def label_cfg(metadata_file: Path, port_type: str) ->... |
the-stack_106_32181 | #
# Copyright (c) 2021 Citrix Systems, 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 or... |
the-stack_106_32182 | from kivy_ios.toolchain import HostRecipe, shprint
from os.path import join
import sh
import logging
logger = logging.getLogger(__name__)
arch_mapper = {'x86_64': 'darwin64-x86_64-cc',
'arm64': 'darwin64-arm64-cc'}
class HostOpensslRecipe(HostRecipe):
version = "1.1.1l"
url = "http://www.open... |
the-stack_106_32184 | import pytest
from django.urls import resolve, reverse
from ecommerce.users.models import User
pytestmark = pytest.mark.django_db
def test_detail(user: User):
assert (
reverse("users:detail", kwargs={"username": user.username})
== f"/users/{user.username}/"
)
assert resolve(f"/users/{use... |
the-stack_106_32186 | from operator import itemgetter
cancerlist = ["ACC", "BLCA", "BRCA", "CESC", "CHOL", "COAD", "DLBC", "ESCA", "GBM", "HNSC", "KICH", "KIRC", "KIRP", "LGG", "LIHC", "LUAD", "LUSC", "MESO", "OV", "PAAD", "PCPG", "PRAD", "READ", "SARC", "SKCM", "STAD", "TGCT", "THCA", "THYM", "UCEC", "UCS", "UVM"]
#cancerlist = ["PANCANCE... |
the-stack_106_32187 | # Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, so... |
the-stack_106_32191 | #!/usr/bin/python
#
# Copyright 2019 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 ag... |
the-stack_106_32193 | # name: pyALL
# created: May 2018
# by: paul.kennedy@guardiangeomatics.com
# description: python module to read a Kongsberg ALL sonar file
# notes: See main at end of script for example how to use this
# based on ALL Revision R October 2013
# https://raw.githubusercontent.co... |
the-stack_106_32195 | # -*- coding: utf-8 -*-
"""
Unit tests for landlab.components.soil_moisture.SoilInfiltrationGreenAmpt
last updated: 3/14/16
"""
import numpy as np
from landlab import RasterModelGrid
from landlab.components.soil_moisture import SoilInfiltrationGreenAmpt
(_SHAPE, _SPACING, _ORIGIN) = ((10, 10), (25, 25), (0.0, 0.0))
... |
the-stack_106_32196 | # Copyright 2020 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_106_32197 | import random
import time
print('Welcome to the game. I hope you know the rules. \n')
# time.sleep(3)
print('The game begins now!\n')
# time.sleep(2)
isoc = 'Heads'
cc = ['Flip', 'Not Flip']
ui1 = input("Choose to 'Flip' or 'Not Flip' the coin. I choose to ")
ci1 = random.choice(cc)
if ci1 == 'Flip':
isoc = 'Tales'... |
the-stack_106_32199 | """
The MIT License (MIT)
Copyright (c) 2015-present Rapptz
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, merg... |
the-stack_106_32204 | #!/usr/bin/env python
"""
Simple example that sets a key, and retrieves it again.
"""
import asyncio
from asyncio_redis import RedisProtocol
async def main():
# Create connection
transport, protocol = await loop.create_connection(RedisProtocol, "localhost", 6379)
# Set a key
await protocol.set("key"... |
the-stack_106_32205 | # Copyright (c) 2012, GPy authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.txt)
# Only difference from the original (hence the above Copyright): .variances -> .variance
import numpy as np
from GPy.kern.src.kern import Kern
from GPy.util.linalg import tdot
from GPy.core.parameterizatio... |
the-stack_106_32206 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import itertools
from typing import List
from fairseq.data.legacy.masked_lm_dictionary import BertDictionary
from pytext.config.component import ComponentType, create_component
from pytext.data.tensorizers import TokenTensor... |
the-stack_106_32207 | """Expectation values and other statistical measures for operators: ``<A>"""
from __future__ import print_function, division
from sympy import Expr, Add, Mul, Integer, Symbol, Integral
from sympy.physics.quantum import Dagger
from sympy.physics.quantum import qapply
__all__ = [
'Expectation',
'Covariance'
... |
the-stack_106_32209 | import unittest
def midpoint(linked_list):
slow = linked_list.head
fast = linked_list.head
while slow.next_node is not None and fast.next_node is not None and fast.next_node.next_node is not None:
slow = slow.next_node
fast = fast.next_node.next_node
return slow
class... |
the-stack_106_32211 | # This file comes originally from https://github.com/google-research/bert/blob/master/tokenization.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import re
import unicodedata
import six
import tensorflow as tf
def validate_case_matc... |
the-stack_106_32213 | import pyttsx3
import datetime
import speech_recognition as sr
import wikipedia
import webbrowser
import random
import os
print("FRIDAY")
engine = pyttsx3.init('sapi5')
voices = engine.getProperty('voices')
engine.setProperty('voice',voices[1].id)
chrome_path = 'C:/Program Files (x86)/Google/Chrome/Application/chrome... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.