text stringlengths 1 927k |
|---|
#!/usr/bin/python
"""
django-helpdesk - A Django powered ticket tracker for small enterprise.
(c) Copyright 2008 Jutda. All Rights Reserved. See LICENSE for details.
scripts/escalate_tickets.py - Easy way to escalate tickets based on their age,
designed to be run from Cron or similar.
""... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
p = np.eye(3)[y][:, None]
grad_d = q - p
grad_C = grad_d @ U.T
grad_b = (C.T @ grad_d ) * Drelu(A@x+b)
grad_A = grad_b @ x.T |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2017 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2017 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2017 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2017 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# This program is free software: you can r... |
"""
Analytical template tags and filters.
"""
from __future__ import absolute_import
import logging
from django import template
from django.template import Node, TemplateSyntaxError
from importlib import import_module
from analytical.utils import AnalyticalException
TAG_LOCATIONS = ['head_top', 'head_bottom', 'bo... |
from google.auth.transport import requests
from google.oauth2 import id_token
class Google:
"""Google class to fetch the user info and return it"""
@staticmethod
def validate(auth_token):
"""
validate method Queries the Google oAUTH2 api to fetch the user info
"""
try:
... |
import unittest
from sacrerouge.common.testing.metric_test_cases import DocumentBasedMetricTestCase
from sacrerouge.common.testing.util import sacrerouge_command_exists
from sacrerouge.metrics import Blanc
from sacrerouge.metrics.blanc import BLANC_INSTALLED
@unittest.skipIf(not BLANC_INSTALLED, '"blanc" not install... |
# qubit number=3
# total number=12
import numpy as np
from qiskit import QuantumCircuit, execute, Aer, QuantumRegister, ClassicalRegister, transpile, BasicAer, IBMQ
import networkx as nx
from qiskit.visualization import plot_histogram
from typing import *
from pprint import pprint
from math import log2
from collectio... |
import math as ma
# test_data = 400,1280/2 #test input
test_data = 150, 68
hight = 495-114 #mm
#ball parameter
r_ball = 114.8 #mm
#angles
ang_cam_tilt = ma.radians(30)
ang_rev_cam_tilt = ma.radians(90)-ang_cam_tilt
ang_cam_flare_X = ma.radians(47) #Öffnungswinkel pixy cam
ang_cam_flare_Y = ma.radians(75)
'PIXY Par... |
from collections import namedtuple
from django.forms import TypedChoiceField
from django.template import Library
from django.utils.translation import ugettext_lazy as _
from evap.evaluation.models import BASE_UNIPOLAR_CHOICES
from evap.rewards.tools import can_reward_points_be_used_by
from evap.student.forms import H... |
import os
import re
from .syllables import count as count_syllables
from nltk.tokenize import sent_tokenize, TweetTokenizer
from nltk.stem.porter import PorterStemmer
class AnalyzerStatistics:
def __init__(self, stats):
self.stats = stats
@property
def num_poly_syllable_words(self):
retur... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
# -*- test-case-name: twisted.test.test_memcache -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Memcache client protocol. Memcached is a caching server, storing data in the
form of pairs key/value, and memcache is the protocol to talk with it.
To connect to a server, create a factory ... |
### SciPyを使った実装 ###
import numpy as np
from scipy.integrate import solve_ivp
import matplotlib.pyplot as plt
def diff_eq(x, t, a):
"""微分方程式"""
return a * x
def do_example_2():
time_list = np.arange(0.0, 2.0, 0.01) # 時間のリスト
x_init = [1.0] # 初期値
a = 1
# 解く
sol = solve_ivp(
... |
"""
MIT License
Copyright (c) 2022, Lawrence Livermore National Security, LLC
Written by Zachariah Carmichael et al.
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... |
"""
delete.py
This script allows developers to delete files generated from redwood storage
system.
"""
import argparse
import os
import json
import boto3
import botocore
import defaults
import docker
import logging
import urllib2
import ssl
import datetime
from io import BytesIO
logger = logging.getLogger('admin-de... |
# -*- coding: utf-8 -*-
"""
PMLB was primarily developed at the University of Pennsylvania by:
- Randal S. Olson (rso@randalolson.com)
- William La Cava (lacava@upenn.edu)
- Weixuan Fu (weixuanf@upenn.edu)
- and many more generous open source contributors
Permission is hereby granted, free of charge, ... |
"""
Copyright (c) 2016-present, Facebook, Inc.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of patent rights can be found in the PATENTS file in the same directory.
"""
from magma.pipelined.openfl... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Name: encrypt.py
Author: Wesley Lee - wtl5736@rit.edu
Assignment: Introduction to Cryptography Project
Date: 04-20-2018
Description:
Encrypts a file usesing a symmetric-key algorithm based on a special class of graphs.
"""
from time import *
from getA import *
# In... |
# Copyright 2020 IBM Corporation
#
# 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, ... |
import numpy as np
import healpy as hp
try:
from pixell import curvedsky, enmap
except:
pass
try: # PySM >= 3.2.1
import pysm3.units as u
import pysm3 as pysm
except ImportError:
import pysm.units as u
import pysm
class PrecomputedAlms(object):
def __init__(
self,
filena... |
#!/usr/bin/python3
import sys
import json
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.svm import LinearSVC
import pickle
class Payload:
def __init__(self, svm, vect):
self.svm = svm
self.vect = vect
def use(self, comm):
return self.svm.predict(self.vect.tr... |
from setuptools import setup
with open('README.md') as f:
long_description = f.read()
setup(
name='tensorflowonspark',
packages=['tensorflowonspark'],
version='2.1.2',
description='Deep learning with TensorFlow on Apache Spark clusters',
long_description=long_description,
long_description_content_type='... |
from rest_framework.generics import ListAPIView, RetrieveAPIView
from api.serializers import ChallengeSerializer
from challenges.models import Challenge
class ChallengeListAPIView(ListAPIView):
""" Lists all challenges. """
serializer_class = ChallengeSerializer
def get_queryset(self):
return Ch... |
# created by mark brown
import h5py as h5
from colorama import Fore, Style
from numpy import array as arr
import numpy as np
import Miscellaneous as misc
import datetime
dataAddress = None
currentVersion = 1
def annotate(fileID=None, expFile_version=currentVersion, useBaseA=True):
#hashNum = int(input("Title-Level... |
# Copyright 2008-2018 Univa Corporation
#
# 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... |
from __future__ import print_function, division
from functools import reduce
from sympy.core.basic import Basic
from sympy.core.compatibility import with_metaclass, range, PY3
from sympy.core.containers import Tuple
from sympy.core.expr import Expr
from sympy.core.function import Lambda
from sympy.core.logic import f... |
import unittest
import numpy as np
import pandas as pd
import df2numpy
from df2numpy import TransformDF2Numpy, one_hot_encode, NAN_CATEGORY, DROPPED_CATEGORY
from df2numpy.errors import *
df = pd.DataFrame({
"A": ["Aa", "Ab", "Ac", "Aa", "Ac", "Aa", "Aa", "Aa"], # uniques: 3, to_be_thresholded: "Ab"
"B": [1.... |
import discord
from discord.embeds import EmptyEmbed
class CustomEmbeds:
confirm_path = 'https://raw.githubusercontent.com/davisschenk/Unnamed-Bot/master/images/ConfirmIcon.png?token=AIRYAKQHGVMHHBQ73J7G2AK5FKHRK'
add_path = 'https://raw.githubusercontent.com/davisschenk/Unnamed-Bot/master/images/AddIcon.png?t... |
import os
import json
import shutil
from lib.config import Config
from lib.variables import Variables, HACKERMODE_FOLDER_NAME
RED = '\033[1;31m'
GREEN = '\033[1;32m'
YELLOW = '\033[1;33m'
NORMAL = '\033[0m'
UNDERLINE = '\033[4m'
BOLD = '\033[1m'
with open(os.path.join(Variables.HACKERMODE_PATH, 'packages.json')) as... |
#!/usr/bin/env python3
""" ImageNet Validation Script
This is intended to be a lean and easily modifiable ImageNet validation script for evaluating pretrained
models or training checkpoints against ImageNet or similarly organized image datasets. It prioritizes
canonical PyTorch, standard Python style, and good perform... |
# Copyright 2020 The PyMC 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... |
from combat import Damage, DamageType
from components import consumable, effects
from components_types import ConsumableTarget as Target, ConsumableType
from entities.factory import ItemFactory
from ranged_value import Range
def effect_level_up(effect: effects.Effect, floor: int, base: int):
match effect:
... |
from __future__ import absolute_import
import logging
import os.path
import re
from pip._vendor.packaging.version import parse as parse_version
from pip._vendor.six.moves.urllib import parse as urllib_parse
from pip._vendor.six.moves.urllib import request as urllib_request
from pip._internal.exceptions import BadCom... |
import os
import shutil
import time
import configargparse
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.optim as optim
import torch.utils.data
from tensorboardX import SummaryWriter
from torch.optim.lr_scheduler import MultiStepLR
from tqdm ... |
from __future__ import absolute_import
from torch import nn
from torch.nn import functional as F
from torch.nn import init
import torchvision
import torch
import pdb
from .layers import (
SpatialAttention2d,
WeightedSum2d)
__all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101',
'resn... |
from distutils.core import setup
setup(
name = 'image_to_ascii',
packages = ['image_to_ascii'],
version = '0.2',
license='MIT',
description = 'A simple python library to convert images to ASCII art',
long_description="README.md",
author = 'Aypro',
author_email = 'ayprogaming1@gmail.com',
... |
print('-='*20)
print('Analisador de Triângulos')
print('-='*20)
r1 = float(input('Primeiro segmento: '))
r2 = float(input('Segundo segmento: '))
r3 = float(input('Terceiro segmento: '))
if r1 < r2 + r3 and r3 < r2 + r1 and r2 < r1 + r3 :
print('Os segmentos acima, PODEM FORMAR triângulos!')
else:
print('Os segm... |
#!/usr/bin/env python
import rospy
from std_msgs.msg import Bool
from dbw_mkz_msgs.msg import ThrottleCmd, SteeringCmd, BrakeCmd, SteeringReport
from geometry_msgs.msg import TwistStamped
import math
from twist_controller import Controller
'''
You can build this node only after you have built (or partially built) th... |
# -*- coding: utf-8 -*
import numpy as np
import cv2
from numba import njit
import time
NUM_SECTOR = 9
FLT_EPSILON = 1e-07
@njit
def func1(dx, dy, boundary_x, boundary_y, height, width, numChannels):
r = np.zeros((height, width), dtype=np.float32)
alfa = np.zeros((height, width, 2), np.int32)
for j in... |
# -*- coding: utf-8 -*-
import math
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import GeoCommonBase as CoordinateBase
# 危险隶属度函数,障碍物周围隶属度函数随着方向和速度逐渐变小
# 改进:隶属度范围和速度大小有关
def riskSubjection(boatPnt,currPnt,boatVelo,boatOrien,evaluTime,impactFactor):
#考虑求解半径
ev... |
"""
Cisco Intersight
Cisco Intersight is a management platform delivered as a service with embedded analytics for your Cisco and 3rd party IT infrastructure. This platform offers an intelligent level of management that enables IT organizations to analyze, simplify, and automate their environments in more advan... |
"""
mbed SDK
Copyright (c) 2011-2013 ARM Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wr... |
from .ssz_typing import (
SSZValue, SSZType, BasicValue, BasicType, Series, ElementsType,
Elements, bit, boolean, Container, List, Vector, Bytes, BytesN,
byte, uint, uint8, uint16, uint32, uint64, uint128, uint256,
Bytes32, Bytes48
)
def expect_value_error(fn, msg):
try:
fn()
raise... |
# -*- coding: utf-8 -*-
import abc
__author__ = "Patrick Hohenecker"
__copyright__ = (
"Copyright (c) 2017, Patrick Hohenecker\n"
"All rights reserved.\n"
"\n"
"Redistribution and use in source and binary forms, with or without\n"
"modification, are permitted provided that th... |
# dependencies
# pydrive
# redis
# celery
import urllib2
import csv
import json
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
from celery import Celery
from celery.decorators import periodic_task
from celery.utils.log import get_task_logger
from celery.task.schedules import crontab
app = ... |
from .tui import curses_init, term_resize, KeyboardDisplay
from .interface import KeyboardInterface |
# pylint: skip-file
"""This client script handles datagram protocol communication between devices on the CAN."""
import zlib
import can
DEFAULT_CHANNEL = "can0"
PROT_VER = 1
CAN_BITRATE = 500000
MESSAGE_SIZE = 8
HEADER_SIZE = 6
MIN_BYTEARRAY_SIZE = 9
DATA_SIZE_SIZE = 2
PROTOCOL_VERSION_OFFSET = 0
CRC_32_OFFSET = 1
... |
import os
import logging
import gevent
import falcon
from datalad_service.tasks.dataset import create_snapshot
from datalad_service.tasks.snapshots import get_snapshot, get_snapshots
from datalad_service.tasks.files import get_files
from datalad_service.tasks.publish import publish_snapshot, monitor_remote_configs
fr... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu May 3 19:22:59 2018
@author: nikos
"""
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy.io import loadmat
from skimage.transform import rescale, resize, downscale_local_mean
from lmfit.models import GaussianM... |
import numpy as np
import pytest
from baloo import Index
def assert_index_equal(actual, expected, sort=False):
actual = actual.evaluate()
expected = expected.evaluate()
actual_values = actual.values
expected_values = expected.values
if sort:
actual_values = np.sort(actual_values)
... |
# Some methods in this file ported to Pytorch from https://github.com/Ashish77IITM/W-Net/
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from scipy.stats import norm
from torch import Tensor
# The weight matrix w is a measure of the weight between each pixel and
# every other pi... |
import numpy as np
import os
from astropy.io import fits
import operator
import itertools
class ImgCat:
"""
Represent an individual image and its associated catalog, starlist, quads etc.
"""
def __init__(self, filepath, hdu=0, cat=None):
"""
:param filepath: Path to the FITS file, or ... |
from olympia import amo
from olympia.amo.tests import addon_factory, TestCase, user_factory, version_factory
from olympia.amo.tests.test_helpers import get_uploaded_file
from olympia.amo.urlresolvers import django_reverse, reverse
from olympia.constants.promoted import (
LINE,
RECOMMENDED,
VERIFIED,
NOT... |
from django.urls import reverse
from rest_framework import status
from authors.apps.articles.tests.base_class import ArticlesBaseTest
from .test_data import valid_article
from ..models import Article
class TestArticle(ArticlesBaseTest):
def test_create_article(self):
"""
Tests method tests wethe... |
# -*- coding: utf-8 -*-
"""
pip_services_runtime.ITiming
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Callback interface to complete measuring time interval.
:copyright: Digital Living Software Corp. 2015-2016, see AUTHORS for more details.
:license: MIT, see LICENSE for more details.
"""
class ITimi... |
# -*- coding: utf-8 -*-
r"""
Generic structures for linear codes over the rank metric
Rank Metric
===========
In coding theory, the most common metric is the Hamming metric, where distance
between two codewords is given by the number of positions in which they differ.
An alternative to this is the rank metric. Take ... |
"""
Django settings for Website project.
Generated by 'django-admin startproject' using Django 1.10.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os
f... |
from django import forms
from django.contrib.auth.models import User
from django.core import validators
class LoginForm(forms.Form):
username = forms.CharField(
widget=forms.TextInput(attrs={'placeholder': 'pls enter your username'}),
label='username'
)
password = forms.CharField(
... |
import numpy as np
import tensorflow as tf
def placeholder(dim=None):
return tf.placeholder(dtype=tf.float32, shape=(None,dim) if dim else (None,))
def placeholders(*args):
return [placeholder(dim) for dim in args]
def mlp(x, hidden_sizes=(32,), activation=tf.tanh, output_activation=None):
for h in hidd... |
"""
I'm copying this from some of my much older work. It's probably going to be
buggy. Yep, it was. I've done some refactoring and whatnot but it could probably
use some more. Maybe combine with `GeoDFUtils`? It would be nice to be able to
easily operate on GDF subsets and selections.
`buffer` and `rasterize` are work... |
import logging
from pandas import DataFrame
from .abstract import AbstractFeatureGenerator
from ..feature_metadata import FeatureMetadata, R_CATEGORY, R_OBJECT
logger = logging.getLogger(__name__)
# TODO: Not necessary to exist after fitting, can just update outer context feature_out/feature_in and then delete thi... |
# -*- coding: utf-8 -*-
# ======================================================================================================================
# Copyright (©) 2015-2022 LCS - Laboratoire Catalyse et Spectrochimie, Caen, France. =
# CeCILL-B FREE SOFTWARE LICENSE AGREEMENT - See ful... |
import json
from mythril.analysis.security import get_detection_module_hooks
from mythril.analysis.symbolic import SymExecWrapper
from mythril.analysis.callgraph import generate_graph
from mythril.ethereum.evmcontract import EVMContract
from mythril.solidity.soliditycontract import SolidityContract
from mythril.mythril... |
# -*- coding: utf-8 -*-
# Copyright 2018 The Blueoil 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
#
# Unles... |
# Copyright 2020 Alethea Katherine Flowers
#
# 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... |
"""Utils for 3D ML."""
from .config import Config
from .log import LogRecord, get_runid, code2md
from .builder import (MODEL, PIPELINE, DATASET, SAMPLER, get_module,
convert_framework_name, convert_device_name)
from .dataset_helper import get_hash, make_dir, Cache
__all__ = [
'Config', 'make... |
# qubit number=5
# total number=42
import cirq
import qiskit
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import FakeVigo
from math import log2,floor, sqrt, pi
import numpy as np
import networkx as ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# **************************************************************************
# Copyright © 2016 jianglin
# File Name: integer.py
# Author: jianglin
# Email: xiyang0807@gmail.com
# Created: 2016-12-20 21:30:29 (CST)
# Last Update:星期五 2016-12-23 17:16:21 (CST)
# By:
... |
import PySimpleGUI as sg
from readerFile import *
sg.theme("BlueMono")
sg.set_options(font=('Helvetica', 10))
layout = [[sg.T("")],
[sg.Text("Choose a file: "), sg.Input(key="-IN2-", change_submits=True), sg.FileBrowse(key="-IN-")],
[sg.Text("Choose a folder"), sg.Input(key="-IN3-", change_submits=... |
"""
PDF Export logic for test reports via ReportLab.
"""
import os
import uuid
import warnings
try:
from urllib import pathname2url # Python 2.x
except:
from urllib.request import pathname2url # Python 3.x
from schema import Schema, Or
try:
from reportlab.platypus import SimpleDocTemplate
except Exc... |
import os
import json
import logging
import sys
from django.db import transaction
from django.apps import apps
from scripts import utils as script_utils
from scripts.populate_preprint_providers import update_or_create
from osf.models import PreprintProvider, Subject
from website.app import init_app
from website impor... |
# 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 ... |
# SPDX-License-Identifier: Apache-2.0
"""
tf2onnx.rewriter - rewrite tensorflow QuantizeAndDequantizeV2|QuantizeAndDequantizeV3|QuantizeAndDequantizeV4 op
"""
import numpy as np
from onnx import TensorProto, helper
from tf2onnx.graph_matcher import OpTypePattern, GraphMatcher
from tf2onnx import utils
# pylint: dis... |
#!/usr/bin/env python
"""
#
#
# File Name: loss_function.py
# Description:
"""
import torch
import torch.nn.functional as F
import math
def kl_divergence(mu, logvar):
"""
Computes the KL-divergence of
some element z.
KL(q||p) = -∫ q(z) log [ p(z) / q(z) ]
= -E[log p(z) ... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: alias_metric.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobu... |
# encoding=utf8
# pylint: disable=mixed-indentation, line-too-long, multiple-statements, too-many-function-args
import sys
import logging
from argparse import ArgumentParser
from numpy import inf
from NiaPy.util.utility import OptimizationType
import NiaPy.benchmarks as bencs
logging.basicConfig()
logger = logging.get... |
from .sampler import Sampler, SASampler, SQASampler
from .model import BinaryQuadraticModel
from .utils import * |
'''
给定一组唯一的单词, 找出所有不同 的索引对(i, j),使得列表中的两个单词, words[i] + words[j] ,可拼接成回文串。
示例 1:
输入: ["abcd","dcba","lls","s","sssll"]
输出: [[0,1],[1,0],[3,2],[2,4]]
解释: 可拼接成的回文串为 ["dcbaabcd","abcddcba","slls","llssssll"]
示例 2:
输入: ["bat","tab","cat"]
输出: [[0,1],[1,0]]
解释: 可拼接成的回文串为 ["battab","tabbat"]
来源:力扣(LeetCode)
链接:https://le... |
# Copyright 2018 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... |
# coding: utf-8
"""
Intersight REST API
This is Intersight REST API
OpenAPI spec version: 1.0.9-262
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import sys
import os
import re
# python 2 and python 3 compatibility library
from s... |
# -*- coding:utf-8 -*-
#
# Copyright (C) 2008 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless re... |
# -*- coding: utf-8 -*-
import json
from collections import OrderedDict
from gluon import current
from gluon.html import *
from gluon.storage import Storage
from gluon.languages import lazyT
from s3 import FS, s3_str
def config(settings):
"""
Template settings for CAP: Common Alerting Protocol
"""
... |
# Copyright 2014 NEC Corporation. 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 ... |
#!/usr/bin/env python
"""
Script for running in salome to automatically create regular mesh for thick_plate_benchmark
Change PATH_TO_EXPORT_MESH to your own path.
You can also change MESH_MULTIPLIER to make mesh more or less dense.
"""
###
### SALOME v9.3.0
###
import sys
import salome
salome.salome_init()
import s... |
# Copyright 2015 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... |
# Copyright 2020 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
# noqa: D100
from typing import Optional, Tuple
import numpy as np
import xarray as xr
from xclim.core.calendar import date_range, datetime_to_decimal_year
from xclim.core.units import amount2rate, convert_units_to, declare_units, units2pint
__all__ = [
"humidex",
"tas",
"uas_vas_2_sfcwind",
"sfcwind... |
# -*- coding: utf-8 -*-
"""
.. module:: skimpy
:platform: Unix, Windows
:synopsis: Simple Kinetic Models in Python
.. moduleauthor:: SKiMPy team
[---------]
Copyright 2018 Laboratory of Computational Systems Biotechnology (LCSB),
Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland
Licensed under the ... |
###
# if you dont have picamera installed run sudo apt-get install python-picamera
# and emable camera in raspberrypi configuration
#
#
# this progam uses raspberry pi onboarc camera to capture an image and save it to a file
#
# wait for 5 seconds
# capture the image
# save the mage to image.jpg file
#
# for more infor... |
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... |
"""
This code fetches jobs from the queue, decides whether to run jobs, and then
runs them or manipulates its own and parent/child queues
"""
import importlib
from stolos import argparse_shared as at
from stolos import log
from stolos import dag_tools as dt, exceptions
from stolos import queue_backend as qb
from stolo... |
import fresh_tomatoes
# import fresh_tomatoes from library
import media
# import class
# first object created
Bahubali = media.Movies('Bahubali', 'The ancient kingdom of Mahishmati'
,
'https://i.ytimg.com/vi/JS4drCVGIms/maxresdefault.jpg'
, 'h... |
import urllib.request
import io
def robots(url):
if url.endswith('/'):
path = url
else:
path = url + '/'
req = urllib.request.Request(path + "robots.txt", data = None) #request
resp = urllib.request.urlopen(req) #response
data = resp.read()
return data |
from tests.src import BasePage
from tests.src.elements.select import SelectList
from tests.src.validator_error import ValidatorPhoneMixin
class FinderOpponentTab(BasePage):
def __init__(self, phone: str, district: str, category: str, datetime_: str,):
super().__init__()
self.phone = phone
... |
import random, sys
from socket import *
hostsA = ['192.168.128.7', '192.168.128.1']
hostsC = ['192.224.0.5', '192.224.0.7', '192.224.10.5', '192.224.15.6']
def gen_packets(packet_num=5):
packets = []
for i in range(0, packet_num):
packet_id = i
source = random.choice(hostsA)
destinat... |
# <Copyright 2019, Argo AI, LLC. Released under the MIT license.>
"""This module evaluates the forecasted trajectories against the ground truth."""
import math
import pickle as pkl
from typing import Dict, List, Optional, Tuple
import numpy as np
from argoverse.map_representation.map_api import ArgoverseMap
LOW_PR... |
# Generated by Django 3.2.7 on 2021-09-25 06:33
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('hood', '0007_rename_user_business_owner'),
]
operations = [
migrations.CreateModel(
name='Posts... |
from flask_wtf import FlaskForm
from wtforms import StringField,PasswordField,BooleanField ,SubmitField,TextAreaField
from wtforms.validators import Required, Email, EqualTo
from ..models import User
from wtforms import ValidationError
class RegistrationForm(FlaskForm):
email = StringField('Your Email Address',val... |
from PySide2.QtCore import QItemSelectionModel, QObject, Signal
from PySide2.QtWidgets import QDialog, QTableWidgetItem, QVBoxLayout
from hexrd.ui.ui_loader import UiLoader
from hexrd.ui.utils import block_signals, unique_name
class ListEditor(QObject):
"""A string list editor that doesn't allow duplicates"""
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.