text stringlengths 2 999k |
|---|
name1_0_1_0_1_0_0 = None
name1_0_1_0_1_0_1 = None
name1_0_1_0_1_0_2 = None
name1_0_1_0_1_0_3 = None
name1_0_1_0_1_0_4 = None |
# Copyright 2018 The Cirq Developers
#
# 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 ... |
#!/usr/bin/env python
#
# Copyright 2012 Jeremy Pack
#
# 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 o... |
#!/usr/bin/env python
## @package haar_cascade.py
#
# Massimiliano Patacchiola, Plymouth University 2016
#
# This module use the opencv haar cascade classifier
# to find frontal and profile faces in a frame.
import numpy
import cv2
import sys
import os.path
class haarCascade:
def __init__(self, frontalFacePat... |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "apifest.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
|
from __future__ import absolute_import, unicode_literals
from copy import deepcopy
from functools import partial
from os import linesep, path
from shutil import rmtree
from tempfile import mkdtemp
from unittest import TestCase
from unittest import main as unittest_main
import crossplane
from boltons.iterutils import ... |
# -*- coding: utf-8 -*-
# @Date : 2019-07-25
# @Author : Xinyu Gong (xy_gong@tamu.edu)
# @Link : None
# @Version : 0.0
import comet_ml
import os
import numpy as np
import torch
import torch.nn as nn
from torchvision.utils import make_grid
import torch.nn.functional as F
from imageio import imsave
from tqdm impo... |
from django.contrib import admin
from .models import Album, Photo
# Register your models here.
admin.site.register(Album)
admin.site.register(Photo) |
#!/usr/bin/env python3
import argparse
import os
import sys
from typing import Any
from selfdrive.car.car_helpers import interface_names
from selfdrive.test.openpilotci import get_url
from selfdrive.test.process_replay.compare_logs import compare_logs
from selfdrive.test.process_replay.process_replay import CONFIGS, r... |
import sys
from datetime import datetime
import torch
import torchvision
from torch.utils.data import ConcatDataset
from iic.datasets.clustering.truncated_dataset import TruncatedDataset
from iic.utils.cluster.transforms import sobel_make_transforms, \
greyscale_make_transforms
from iic.utils.semisup.dataset import... |
import argparse
import os
import random
import numpy as np
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim as optim
from torch.utils import data
import torchvision.datasets as dset
import torchvision.transforms as transforms
import torchvision.utils as... |
# Copyright (c) 2013, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
import re
from . import AWSHelperFn, AWSObject, AWSProperty, Tags
from .validators import (boolean, network_port, integer, positive_integer,
integer_range)
# Taken from:
# http://doc... |
from __future__ import print_function
import re
from streamlink.plugin import Plugin
from streamlink.plugin.api import http
from streamlink.plugin.api.utils import itertags
from streamlink.stream import HLSStream
from streamlink.utils import update_scheme
class EuropaPlusTV(Plugin):
url_re = re.compile(r"https?... |
import numpy as np
import pytest
import pandas.util._test_decorators as td
import pandas as pd
from pandas import Series, isna
import pandas.util.testing as tm
class TestSeriesCov:
def test_cov(self, datetime_series):
# full overlap
tm.assert_almost_equal(
datetime_series.cov(datetim... |
from slot.a import *
class PP(Amulet): #Plunder Pals or Hitting the Books
att = 54
a = [('s',0.25)]
class RR(Amulet):
att = 64
a = [('s',0.25),
('cc',0.06,'hp70')]
class LC(Amulet):
att = 64
a = [('cd',0.13),
('cc',0.08,'hp70')]
class VC(Amulet):
att = 65
a = [('s'... |
from __future__ import print_function
import sys
from setuptools import dist, setup, find_packages
from setuptools.command.build_py import build_py
from setuptools.command.develop import develop
from setuptools.command.test import test as test_command
# # force cython to use setuptools dist
# # see also:
# # https... |
import re
from typing import List
class StringProcessService:
def __init__(self):
self._charmap = {
0x201c: u'"',
0x201d: u'"',
0x2018: u"'",
0x2019: u"'",
'ff': u'ff',
'fi': u'fi',
'fl': u'fl',
'ffi': u'ffi',
... |
import subprocess
import sys
def start_web_server(port=8888):
cmd = [sys.executable, '-m', 'SimpleHTTPServer', str(port)]
server = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
return server
|
class ObsActSeqFeatureTransformer:
"""Transforms observation-action sequences into string representations.
Attributes
----------
idx_lookup_ : dict
Converts string repr to an integer index.
next_idx_ : int
Next index to use when encountering a new string representation.
inverse_... |
#!/usr/bin/env python3
# coding: utf-8
import pytest
import spacy
from deep_reference_parser.prodigy.numbered_reference_annotator import (
NumberedReferenceAnnotator,
)
@pytest.fixture(scope="function")
def nra():
return NumberedReferenceAnnotator()
def test_numbered_reference_splitter(nra):
numbered_... |
from __future__ import unicode_literals
from frappe import _
def get_data():
return [
{
"label": _("Tools"),
"icon": "fa fa-star",
"items": [
{
"color": "grey",
"icon": "octicon octicon-key",
"type": "doctype",
"name": "Password Management",
"label": _("Password Manage... |
"""
Você deve criar uma classe carro que vai possuir
dois atributos compostos por outras duas classes:
1) Motor
2) Direção
O motor terá a responsabilidade de controlar a velocidade.
Ele oferece os seguintes atributos:
1) Atributo de dado velocidade:
2) Método acelerar, que deverá incrementar a velocidade de uma unid... |
import operator
from queue import Queue
# 请求
def _fetch(url, token):
from urllib.request import urlopen
import json
import time
time.sleep(1)
response = urlopen(url + '?access_token=' + token)
data = response.read().decode("utf-8")
return json.loads(data)
class MockUser:
def __init_... |
from liblanelet2_routing_pyapi import *
|
z=int(input("from "))
n=input("number " )
l=["A","B","C","D","E","F"]
A=10
B=11
C=12
D=13
E=14
F=15
j=0
d=0
n=n.split()
|
import discord
from discord.ext import commands
#https://www.youtube.com/watch?v=4JptXXkqiKU&list=PLSCgthA1Anif1w6mKM3O6xlBGGypXtrtN&index=10
class Cog_Extension(commands.Cog):
def __init__(self,bot):
self.bot = bot
|
from setuptools import find_packages, setup
setup(
name='src',
packages=find_packages(),
version='0.1.0',
description='This is a helpful Python library for bioinformatics analysis.',
author='Rafael Prudencio Leite',
license='MIT',
)
|
import os
import sys
from app import app, assets, Environment, freezer
from views import *
BUILD_DIR = os.path.join(os.path.realpath(os.path.dirname(__file__)), 'build')
ROOT_URL = '//extras.sfgate.com'
# CHANGE THE FOLDER SLUG TO NEW PROJECT
TEST_PROJECT_NAME = 'test-proj/airbnb'
PROJECT_NAME = '2016/airbnb'
if ... |
from pyearth._record import PruningPassRecord, PruningPassIteration
from pyearth._util import gcv
from ..testing_utils import assert_list_almost_equal
num_samples = 1000
num_variables = 10
penalty = 3.0
sst = 100.0
record = PruningPassRecord(num_samples, num_variables,
penalty, sst, 7, 18.0... |
#!/usr/bin/env python3
import os
import shutil
from contextlib import suppress
from pathlib import Path
from atomicwrites import atomic_write
from filelock import FileLock
from ruamel.yaml import YAML, comments, representer
from broker._utils.tools import _remove, print_tb
_SR = representer.RoundTripRepresenter
c... |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Validus.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are ... |
"""Middleware for verifying a user has been invited to ON."""
# pylint: disable=no-self-use
import re
from django.conf import settings
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
EXEMPT_URLS = [re.compile(settings.LOGIN_URL.lstrip('/'))]
if hasattr(settings, 'LOGIN_EXEMP... |
"""Define version number here and read it from setup.py automatically"""
__version__ = "0.1.6"
|
"""
WSGI config for project project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTI... |
from regrippy import BasePlugin, PluginResult
class Plugin(BasePlugin):
"""Get the Windows version"""
__REGHIVE__ = "SOFTWARE"
def run(self):
key = self.open_key("Microsoft\\Windows NT\\CurrentVersion")
if not key:
return
value = key.value("ProductName")
yield... |
#!/usr/bin/env python
#############################################################################
##
# This file is part of Taurus
##
# http://taurus-scada.org
##
# Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
##
# Taurus is free software: you can redistribute it and/or modify
# it under the terms of t... |
import copy_reg
import imp
import os
import sys
import types
from os.path import abspath, join
from seisflows.tools import unix
from seisflows.tools.code import Struct, loadjson, loadobj, savejson, saveobj
from seisflows.tools.msg import WarningOverwrite
class SeisflowsObjects(object):
""" SeisFlows consists o... |
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
# Copyright 2015 and onwards Google, 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/license... |
import argparse
from ddapp.consoleapp import ConsoleApp
from ddapp import cameraview
from ddapp import vtkAll as vtk
import PythonQt
from PythonQt import QtCore, QtGui, QtUiTools
def addWidgetsToDict(widgets, d):
for widget in widgets:
if widget.objectName:
d[str(widget.objectName)] = widget
... |
# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
import os
from pathlib import Path
from fastapi.testclient import TestClient
from request_forms_and_files.tutorial001 import app
client = TestClient(app)
openapi_schema = {
"openapi": "3.0.2",
"info": {"title": "FastAPI", "version": "0.1.0"},
"paths": {
"/files/": {
"post": {
... |
# Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved.
import dace
import numpy as np
W = dace.symbol('W')
H = dace.symbol('H')
@dace.program
def control_flow_test(A, B, tol):
if tol[0] < 4:
while tol[0] < 4:
@dace.map(_[0:W])
def something(i):
... |
import sys
from getpass import getpass
from instagram_private_api import Client, ClientLoginError, ClientError
from main import console, base_color, success_color, fail_color
from states import menu
def start():
console.print("\nFill in your Instagram credentials to allow authorization. Type :quit to exit the a... |
#import cPickle as pickle
import pickle
import numpy as np
#pickle.dump([embeddings], open('embeddings_from_XYZ.p', 'wb'))
# ../
load_path = "ebmeddings_from_celeb_12k_noflips_160px.p"
load_path = "embeddings_from_celeb_12kwithflips_160px.p"
load_path = "embeddings_from_celeb_30k_noflip_160px.p"
with open(load_path, ... |
# 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... |
"""Type checking of attribute access"""
from typing import cast, Callable, List, Optional, TypeVar
from mypy.types import (
Type, Instance, AnyType, TupleType, CallableType, FunctionLike, TypeVarDef,
Overloaded, TypeVarType, UnionType, PartialType,
DeletedType, NoneTyp, TypeType, function_type
)
from mypy... |
"""
Tests that can be parametrized over _any_ Index object.
"""
import re
import numpy as np
import pytest
from pandas.core.dtypes.common import is_float_dtype
import pandas._testing as tm
def test_boolean_context_compat(index):
# GH#7897
with pytest.raises(ValueError, match="The truth value of a"):
... |
# -*- coding: utf-8 -*-
'''
Utils for making various web calls. Primarily designed for REST, SOAP, webhooks
and the like, but also useful for basic HTTP testing.
.. versionaddedd:: 2015.2
'''
# Import python libs
from __future__ import absolute_import
import json
import logging
import os.path
import pprint
import soc... |
from typing import Tuple
import pandas as pd
class RuntimeStats:
def __init__(self, all_data_shape: Tuple[int, int]):
self._x_shape = []
self._data_size = []
self._current_x_shape = None
self._data_shape = all_data_shape
def as_dataframe(self) -> pd.DataFrame:
res = p... |
import logging
from typing import Callable, Optional, List, Iterable
from ray.rllib.agents.trainer import Trainer, COMMON_CONFIG
from ray.rllib.evaluation.worker_set import WorkerSet
from ray.rllib.execution.rollout_ops import ParallelRollouts, ConcatBatches
from ray.rllib.execution.train_ops import TrainOneStep
from ... |
import py
from pypy import conftest
from pypy.rpython.ootypesystem.ootype import *
from pypy.rpython.ootypesystem import ootype
from pypy.rpython.ootypesystem.rlist import ListRepr
from pypy.rpython.rint import signed_repr
from pypy.annotation import model as annmodel
from pypy.objspace.flow.objspace import FlowObjSpac... |
#!/usr/bin/env python
print 'Content-Type: text/plain\r\n',
print
print 'Test content here'
|
import numpy as np
import torch
import os
from scipy.ndimage import distance_transform_edt
from Models.FDU3D import *
from tqdm import tqdm
import argparse
from era5dataset.FrontDataset import *
# ERA Extractors
from era5dataset.EraExtractors import *
from IOModules.csbReader import *
from NetInfoImport import *
... |
# The Message class contains the data structure of the Message, and methods includes encapsulate, and decapsulate.
import sys
import struct
import netifaces
from socket import *
from Header import Header
from Record import Record
class Message:
"""docstring for Message"""
def __init__(self, header = Header())... |
#!/usr/bin/env python
import os
import sys
if sys.version_info < (3, 6):
print('Error: dbt does not support this version of Python.')
print('Please upgrade to Python 3.6 or higher.')
sys.exit(1)
from setuptools import setup
try:
from setuptools import find_namespace_packages
except ImportError:
#... |
import _thread
import argparse
import logging
import os
import time
import webbrowser
from threading import Thread
from cryptography.hazmat.backends import default_backend as crypto_default_backend
from cryptography.hazmat.primitives import serialization as crypto_serialization
from cryptography.hazmat.primitives.asym... |
from django.contrib.auth import views
#from myapp.forms import UserLoginForm
class LoginView(views.LoginView):
template_name = "account/accounting/login.html"
|
# Generated by Django 2.1.15 on 2022-02-25 15:02
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0003_ingredient'),
]
operations = [
migrations.CreateModel(
... |
from pathlib import Path
import numpy as np
import tifffile as tif
import pandas as pd
import matplotlib.pyplot as plt
import pickle
import seaborn as sns
import requests
# import local package
from src.data.read_data import read_channel
def get_percentiles(data, step=10):
"""
The function to calculate 11 pe... |
from setuptools import setup
VERSION = '1.11.0'
def readme():
with open("README.md") as file:
return file.read()
setup(
name="aws-sg",
version=VERSION,
description="Allows activities directly in your AWS securities groups",
long_description_content_type="text/makrdown",
long_descripti... |
"""The LowMC blockcipher in Python."""
from BitVector import BitVector
import os
from typing import Optional
__author__ = "Thorsten Knoll"
__copyright__ = "Thorsten Knoll"
__license__ = "mit"
class LowMC(object):
"""LowMC blockcipher mainclass.
For de- and encryption of message blocks with the LowMC blocki... |
# Standard Library imports
from datetime import datetime
import logging
from pprint import pprint as pp
import sys
import traceback
# Third party imports
import numpy as np
import pandas as pd
# Load application imports
import dmyplant2
from dmyplant2 import cred, Validation, MyPlant, EngineReadOnly, dPlot as pl
... |
from random import randint
listFile=open("/home/fisher/live/backup/diurnal/python/list","r")
dirArr=[]
for line in listFile:
dirArr.append(line.replace("\n",""))
listFile.close()
requestFile=open("/home/fisher/live/backup/diurnal/request","w")
requestFile.write(dirArr[randint(0,len(dirArr)-1)])
requestFile.... |
"""
Python wrappers for Orthogonal Distance Regression (ODRPACK).
Notes
=====
* Array formats -- FORTRAN stores its arrays in memory column first, i.e. an
array element A(i, j, k) will be next to A(i+1, j, k). In C and, consequently,
NumPy, arrays are stored row first: A[i, j, k] is next to A[i, j, k+1]. For
ef... |
import logging
import os
import os.path as osp
from typing import Optional
from sacred.observers import FileStorageObserver
from stable_baselines3.common import callbacks
from stable_baselines3.common.vec_env import VecNormalize
import imitation.util.sacred as sacred_util
from imitation.data import rollout
from imita... |
from django.urls import path
from .views import authentication, logout_user, user_profile
urlpatterns = [
path('', authentication, name='authentication'),
path('logout/', logout_user, name='logout'),
path('profile/<int:user_id>', user_profile, name='profile')
] |
import time
import gzip
import pickle
import logging
import asyncio
from aioudp import open_local_endpoint, open_remote_endpoint
SERVER_ADDR = '0.0.0.0'
SERVER_PORT = 5300
# Upsteam Address, use DNSPod
UPSTREAM_ADDR = '119.29.29.29'
UPSTREAM_PORT = 53
# Duration to cleanup caches
CACHE_TTL = 1800
caches = []
# Que... |
# coding: utf-8
"""
KFServing
Python SDK for KFServing # noqa: E501
OpenAPI spec version: v0.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import kfserving
from kfserving.models.v1alpha2_tensorflow_spec import V... |
import pdb
import scipy.optimize as opt
import logging
import numpy as np
import sys
import scipy.linalg as lng
from scipy.stats import multivariate_normal as mvn
sys.path.append('../..')
from pyMRA.MRATree import MRATree
import pyMRA.MRATools as mt
logging.basicConfig(format='%(asctime)s %(message)s', datefmt='%H... |
import re
import yaml
def replace_e_float(d):
p = re.compile(r"^-?\d+(\.\d+)?e-?\d+$")
for name, val in d.items():
if type(val) == dict:
replace_e_float(val)
elif type(val) == str and p.match(val):
d[name] = float(val)
def load_cfg(name, prefix="."):
with open(f"{... |
import pandas as pd
import numpy as np
import joblib
import random
from ..chem_utils.Autodescriptor import MordredDescriptor
from tqdm import tqdm
from sklearn.preprocessing import StandardScaler
import yaml
random.seed(0)
def dump(
settings
):
"""
automatically calculate descriptors for training
... |
money = 2
apple_price = 4
if money >= apple_price:
print('You can buy an apple')
else :
print('You do not have enough money')
# When the condition above is False, print 'You do not have enough money'
|
"""
Copyright 2020 Nvidia Corporation
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 conditions and the following disclaimer.
2. Re... |
import argparse
from datetime import datetime
import numpy as np
import os
import os.path
from sklearn.model_selection import train_test_split
import torch
from torch.utils.data import Dataset, DataLoader
from helpers import *
from ctrmf import CTRMF
# Parse input arguments
ap = argparse.ArgumentParser()
ap.add_argu... |
from threading import Thread
from flask import current_app
from flask_mail import Message
from flask_app import mail
def send_async_email(app, msg):
with app.app_context():
mail.send(msg)
def send_email(subject, sender, recipients, text_body, html_body, attachments=None, sync=False):
msg = Message(... |
# Decision Tree Regression
# Importing the libraries
import numpy as np
# no visual graph in this template, plt is commented out as such
# import matplotlib.pyplot as plt
import pandas as pd
# Importing the dataset
dataset = pd.read_csv('Data.csv')
X = dataset.iloc[:, :-1].values
y = dataset.iloc[:, -1].values
# Spl... |
#!/usr/bin/python
import os
import re
import shutil
from colorama import init
init()
from colorama import Fore,Style
print(Style.BRIGHT+Fore.GREEN+"Packing all projects"+Fore.RESET)
if not os.path.exists("packed"):
os.mkdir("packed")
os.system("dotnet pack > ./packed/packingOutput.txt")
for root, dirs, file... |
from django.db.models.signals import post_save, pre_save
from django.dispatch import receiver
from baby_backend.utils.utils import (
unique_cart_unique_id_generator,
unique_cart_unique_item_id_generator,
)
from ..orders.models import Order
from .models import Cart, CartItem
@receiver(pre_save, sender=Cart)
... |
import click
from packit_service.worker.whitelist import Whitelist
"""
This is cli script to approve user manually after he installed github_app to repository
"""
@click.group()
def cli():
pass
@click.command("approve")
@click.argument("account_name", type=str)
def approve(account_name):
"""
Approve us... |
# -*- coding:utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import pytest
from botocore.stub import Stubber
from treehugger.kms import kms_agent
from treehugger.remote import s3_client
@pytest.fixture(scope='function', autouse=True)
def kms_stub():
kms_agent.reset()... |
#!/usr/bin/env python3
import argparse
import sys
import re
from rest_client_generator import RestClientGenerator
class PythonClientGenerator(RestClientGenerator):
def __init__(self, server_url, output_dir):
super().__init__(server_url, output_dir)
self.param_types = {
'string': 's... |
# Copyright (c) 2021 elParaguayo
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distrib... |
import os
import platform
from termcolor import colored
import mysql.connector
from mysql.connector import Error
def insert(connection, cursor, table, val):
try:
if table == "City":
mySql_insert_query = "INSERT INTO " + table + "(Name, CountryCode, District, Population) VALUES (%s, %s,... |
from CybORG.Agents.BaseAgent import BaseAgent
import random
import math
from ipaddress import IPv4Address
from CybORG.Shared.Actions import VelociraptorPoll, SSHAccess, VelociraptorPoll, KillProcessLinux, VelociraptorPoll, KillProcessLinux
class CounterKillchainAgent(BaseAgent):
def __init__(self, action_size=... |
from django.contrib import admin
from django.utils.translation import ugettext, ugettext_lazy as _
from ella.positions.models import Position
from ella.utils import timezone
class PositionOptions(admin.ModelAdmin):
def show_title(self, obj):
if not obj.target:
return '-- %s --' % ugettext('em... |
import re
import os
class GitConfigParser:
def __init__(self, repoDirectory):
self._repoDirectory = repoDirectory
def originURL(self):
with open(os.path.join(self._repoDirectory, ".git", "config")) as f:
contents = f.read()
return self._parseOriginURL(contents)
def _p... |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Intangible()
result.template = "object/draft_schematic/clothing/shared_clothing_bodysuit_field_14.iff"
result.att... |
# 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... |
import logging
from typing import Any, Optional, Union, Callable
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import DataLoader
from tqdm.auto import trange
from transformers import AutoTokenizer
from ..backbone import BackBone
from ..basemodel import Bas... |
'''Implement an in-memory hyperdb for testing purposes.
'''
import shutil
import os
from roundup import date
from roundup import hyperdb
from roundup import roundupdb
from roundup import security
from roundup import password
from roundup import configuration
from roundup.backends import back_anydbm
from roundup.backe... |
#!/usr/bin/env python
"""
Tests for nuclide_data
"""
import numpy as np
import uncertainties as unc
import unittest
import nuclide_data
class TestNuclideData(unittest.TestCase):
def test_isotopes(self):
"""Do we have the correct isotopes for select elements?"""
zs = [1, 8, 56, 95]
isos ... |
# -*- coding: utf-8 -*-
# @Time : 2021/8/24 17:44
# @Author : ZhaoXiangPeng
# @File : __init__.py
import importlib
from collections import defaultdict, deque
import ReSpider.setting as setting
from ReSpider.extend.logger import LogMixin
from ReSpider.extend.misc import load_object
from ReSpider.core.o... |
for x in range(4):
with open(f'..\\data\\cpu\\functions\\stack_switch\\write_stack\\write_stack_{4*x}-{4*x+3}.mcfunction', 'a') as f:
for i in range(4):
i = 4*x+i
f.write(f'execute if score Global SP matches {i} run scoreboard players operation Global stack_{i} = Global stack_value\n... |
from __future__ import print_function
import os
import progressbar
try:
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
UnicodeXMLURL = "https://w3c.github.io/xml-entities/unicode.xml"
InlineAxisOperatorsURL = "https://w3c.github.io/mathml-core/tables/inline-axis-operators.tx... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-07-12 16:25
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('excerptexport', '0058_auto_20170511_1639'),
]
operations = [
migrations.Alt... |
import pytest
from nerodia.exception import UnknownObjectException
pytestmark = pytest.mark.page('definition_lists.html')
class TestDtExist(object):
def test_returns_true_if_the_element_exists(self, browser):
assert browser.dt(id='experience').exists
assert browser.dt(class_name='current-industr... |
from .wordpiece import WordPieceTokenizer
try:
from .sentencepiece import SentencePieceTokenizer
except:
pass
__all__ = [
"WordPieceTokenizer",
"SentencePieceTokenizer",
]
|
class Solution:
def numDecodings(self, s: str) -> int:
n = len(s)
dp = [0] * (n + 1)
dp[0] = 1
for i in range(n):
if s[i] > "0":
dp[i + 1] += dp[i]
if i > 0 and "10" <= s[i - 1 : i + 1] <= "26":
dp[i + 1] += dp[i - 1]
re... |
# Copyright (c) 2022 elParaguayo
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distrib... |
#!/usr/bin/python
import csv, sys, os.path, re
# wrap text after x characters
def wrap(string, width=80, ind1=0, ind2=0, prefix=''):
string = prefix + ind1 * " " + string
newstring = ""
string = string.replace("\n", " ")
while len(string) > width:
marker = width - 1
while not string[marker].isspace():... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.