text stringlengths 2 999k |
|---|
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
plt.rcParams.update({
"text.usetex": True,
"font.family": "serif",
"font.sans-serif": ["Helvetica"],
"font.size": 12})
styles = ['^-', 'o-', 'd-', 's-', 'p-', 'x-', '*-']
#data = pd.read_csv('results/gbl_ml_accuracies_angular.csv')... |
import csv
import math
import cv2
import numpy as np
from keras import Model
from keras.applications.mobilenetv2 import MobileNetV2, preprocess_input
from keras_applications.mobilenet_v2 import _inverted_res_block
from keras.callbacks import ModelCheckpoint, EarlyStopping, ReduceLROnPlateau
from keras.layers import Ma... |
"""
Import from vtk.
These are the modules within vtk that must be loaded across pyvista.
Here, we attempt to import modules using the VTK9 ``vtkmodules``
package, which lets us only have to import from select modules and not
the entire library.
"""
# Checking for VTK9 here even though 8.2 contains vtkmodules. Ther... |
# Generated by Django 2.1.7 on 2019-03-19 15:43
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tracker', '0003_auto_20190319_2109'),
]
operations = [
migrations.AlterField(
model_name='order',
name='url',
... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.metrics import r2_score
import time
from preprocessing import preprocessing
def predict(x, y, theta):
y_predict = np.matmul(x, theta).flatten()
loss = ((y_predict-y) ** 2).mean()
return y_predict, loss
# data from https:/... |
import uuid
import requests
from flask import Flask, render_template, session, request, redirect, url_for
from flask_session import Session # https://pythonhosted.org/Flask-Session
# from waitress import serve
import msal
import app_config
from flask_bootstrap import Bootstrap
app = Flask(__name__)
Bootstrap(app)
ap... |
import torch.nn as nn
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Linear, Dropout, LayerNorm, TransformerEncoder
class PositionalEncoding(nn.Module):
def __init__(self, d_model, max_len=5000):
super(PositionalEncoding, self).__init__()
self.pos_embedding... |
import time
from decorator import decorate
class HighPerformanceTimer(object):
def __init__(self, callback):
self._callback = callback
def _new_timer(self):
return self.__class__(self._callback)
def __enter__(self):
self._start = time.perf_counter_ns()
def __exit__(self, ty... |
from rest_framework.routers import DefaultRouter
from monsterapi.views import (PrinterViewSet, BookViewSet, OwnerViewSet,
MonsterViewSet, MelodyViewSet, GameViewSet, CheckViewSet, RecipeViewSet,
NameViewSet)
router = DefaultRouter()
# ROUTERS add support for automatic URL routing to django
# it is used for al... |
# generated from catkin/cmake/template/pkg.context.pc.in
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "".split(';') if "" != "" else []
PROJECT_CATKIN_DEPENDS = "".replace(';', ' ')
PKG_CONFIG_LIBRARIES_WITH_PREFIX = "".split(';') if "" != "" else []
PROJECT_NAME = "epuck_description"
PROJECT_SPACE_DIR ... |
r"""
A simple, fast, extensible JSON encoder and decoder
JSON (JavaScript Object Notation) <http://json.org> is a subset of
JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data
interchange format.
simplejson exposes an API familiar to uses of the standard library
marshal and pickle modules.
Encoding b... |
import numpy as np
import torch
from comm.registry import Registry
from compute import Config_ini
from tools import StatusUpdateTool
from train.dataset.dataloader import BaseDataloader
def test_cifar_loader():
Config_ini.batch_size = 64
Config_ini.total_epoch = 50
datasets = ['CIFAR10', 'CIFAR100']
f... |
from __future__ import absolute_import, division, print_function
import torch
from torch.autograd import Variable
from pyro.distributions import MultivariateNormal, SparseMultivariateNormal
from tests.common import assert_equal
def test_scale_tril():
loc = Variable(torch.Tensor([1, 2, 1, 2, 0]))
D = Variab... |
# coding: utf-8
"""
ESP Documentation
The Evident Security Platform API (version 2.0) is designed to allow users granular control over their Amazon Web Service security experience by allowing them to review alerts, monitor signatures, and create custom signatures.
OpenAPI spec version: v2_sdk
Ge... |
#!/usr/bin/python
# Copyright (c) 2020, 2021 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for d... |
age = 18
if ((age>= 8) and (age<= 12)):
print("YOU ARE ALLOWED. WELCOME !")
else:
print("SORRY ! YOU ARE NOT ALLOWED. BYE !")
|
# -*- coding: utf-8 -*-
"""Unit test package for aws_consoler."""
|
# Mock when building the doc without pytorch.
class Function(object):
def __init__(self, *args, **kwargs):
pass
|
import random
from enum import Enum
CarType = Enum('CarType', 'subcompact compact suv')
class Car:
pool = dict()
def __new__(cls, car_type):
obj = cls.pool.get(car_type, None)
if not obj:
obj = object.__new__(cls)
cls.pool[car_type] = obj
... |
# The user guesses a number until they guess correctly
# Author: Isabella Doyle
numberToGuess = 25
guess = int(input("Guess a number: "))
while guess != numberToGuess:
print("Incorrect ")
guess = int(input("Guess again! "))
else:
print("That is correct! The number to guess was {}.".format(numberToGuess))... |
#!/usr/bin/env python
"""fanotify: wrapper aroudn the fanotify family of syscalls for watching for file modifcation"""
from __future__ import print_function
from cffi import FFI as _FFI
from os import O_RDONLY, O_WRONLY, O_RDWR
from os import fdopen
import errno as _errno
READ_EVENTS_MAX = 10
_ffi = _FFI()
_ffi.cdef... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
__a... |
# -*- coding: utf-8 -*-
import sys
from PyQt4 import QtCore, QtGui
def main(argv):
app = QtGui.QApplication(argv)
mainwindow = MainWindow()
mainwindow.show()
sys.exit(app.exec_())
class MainWindow(QtGui.QMainWindow):
def __init__(self, *args):
QtGui.QMainWindow.__init__(self, *args)
... |
# Copyright (c) Yugabyte, 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 agreed to in writing, soft... |
class TransactionAmounts(object):
""" A class of constants for transaction amounts that will cause different statuses. """
Authorize = "1000.00"
Decline = "2000.00"
HardDecline = "2015.00"
Fail = "3000.00"
|
from . import mcda_methods
from . import additions
from . import correlations
from . import normalizations
from . import weighting_methods |
# 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... |
# -*- coding: utf-8 -*-
"""CCXT: CryptoCurrency eXchange Trading Library"""
# MIT License
# Copyright (c) 2017 Igor Kroitor
# 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 restricti... |
import click
import os
from battleforcastile.utils.select_all_files import select_all_files
from battleforcastile.utils.display_card import display_card
from battleforcastile.constants import CARDS_FOLDER_NAME
CURRENT_PATH = os.path.dirname(os.path.abspath(__file__))
@click.group(help='List of cards in the game')
... |
# flake8: noqa
from cereal import car
from selfdrive.car import dbc_dict
Ecu = car.CarParams.Ecu
class CarControllerParams():
STEER_MAX = 300 # Safety limit, not LKA max. Trucks use 600.
STEER_STEP = 2 # control frames per command
STEER_DELTA_UP = 7
STEER_DELTA_DOWN = 17
MIN_STEER_SPEED = 3. # m/s
STEE... |
"""
:author: Thomas Delaet <thomas@delaet.org>
"""
import velbus
COMMAND_CODE = 0xf0
class ChannelNamePart1Message(velbus.Message):
"""
send by: VMB6IN, VMB4RYLD
received by:
"""
def __init__(self, address=None):
velbus.Message.__init__(self)
self.channel = 0
self.name = ... |
import typing
from game_sprite_buttons.game_sprite_button_base_class import HideableGuiElement
class ModifiedUIManager:
ui_elements : typing.List[HideableGuiElement]
def __init__(self,window):
self.window = window
self.ui_elements = []
def add_ui_element(self,v):
self.ui_elements... |
# -*- coding: utf-8 -*-
"""
.. module:: skimpy
:platform: Unix, Windows
:synopsis: Simple Kinetic Models in Python
.. moduleauthor:: SKiMPy team
[---------]
Copyright 2020 Laboratory of Computational Systems Biotechnology (LCSB),
Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland
Licensed under the ... |
import requests
from flask import Flask, request, jsonify, send_from_directory
app = Flask(__name__)
import pandas as pd
import quandl
import math
import random
import os
import numpy as np
from sklearn import preprocessing, cross_validation, svm
from sklearn.linear_model import LinearRegression
if 'ON_HEROKU' in os.e... |
# -*- coding: utf-8 -*-
"""
For usage instructions, see:
https://kolibri-dev.readthedocs.io/en/develop/references/i18n.html
"""
from __future__ import unicode_literals
import argparse
import base64
import io
import json
import logging
import mimetypes
import os
import re
import sys
import tempfile
import noto_sou... |
# coding: utf-8
"""
TokensApi.py
Copyright 2016 SmartBear Software
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... |
"""
SimpleMonitor alerts via pushbullet
"""
from typing import cast
import requests
import requests.auth
from ..Monitors.monitor import Monitor
from .alerter import Alerter, AlertLength, AlertType, register
@register
class PushbulletAlerter(Alerter):
"""Send push notification via Pushbullet."""
alerter_ty... |
# coding: utf-8
"""
LUSID API
# Introduction This page documents the [LUSID APIs](https://www.lusid.com/api/swagger), which allows authorised clients to query and update their data within the LUSID platform. SDKs to interact with the LUSID APIs are available in the following languages : * [C#](https://gith... |
from django.shortcuts import render
# Create your views here.
def index(request):
""" renders the index page template """
return render(request, 'home/index.html')
|
import os
import sys
import gzip
import imp
from itertools import product
from setuptools import setup, find_packages
try:
from urllib.request import urlretrieve
except ImportError:
from urllib import urlretrieve
module_dir = 'openl3'
modalities = ['audio', 'image']
input_reprs = ['linear', 'mel128', 'mel256'... |
from django.apps import AppConfig
class BalanceConfig(AppConfig):
name = 'balance'
|
from wordseg import segment_token
def main():
# set a test token
token = "soitmoinscompliqués"
# apply segmentation fucntion on the given token
result = segment_token(token)
# print raw mispelled token
print("raw token is {}".format(token))
# print correct splitted token
print("processed token is {}".forma... |
# -*- coding: utf-8 -*-
#
# Calcspec Bug Report documentation build configuration file, created by
# sphinx-quickstart on Tue Oct 20 17:51:49 2009.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated f... |
# -*- coding: utf-8 -*-
# Copyright (2017-2018) Hewlett Packard Enterprise Development LP
#
# 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
#
# U... |
__title__ = "simulation"
__author__ = "murlux"
__copyright__ = "Copyright 2019, " + __author__
__credits__ = (__author__, )
__license__ = "MIT"
__email__ = "murlux@protonmail.com"
# Local imorts
from playground.enums import RunMode
from playground.simulation.backtesting import BackTestingOperation
from playground.si... |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Tcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test RPC calls related to blockchain state. Tests correspond to code in
# rpc/blockchain.cpp.
#
from d... |
import json
import logging
import math
import os
import random
import warnings
import string
from dataclasses import asdict
from multiprocessing import Pool, cpu_count
from pathlib import Path
import numpy as np
import pandas as pd
import torch
import transformers
from tensorboardX import SummaryWriter
from torch.nn.u... |
import b3cdi
# Create and/or update local DB
b3cdi.sync_db()
# Create time series for the desired duration
b3cdi.create_time_series(360)
|
'''
Copyright (c) 2015 SONATA-NFV [, ANY ADDITIONAL AFFILIATION]
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... |
"""Patient Model
Revision ID: 64fb26819d4f
Revises: 1f3baa1921c7
Create Date: 2018-07-27 00:50:36.593722
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '64fb26819d4f'
down_revision = '1f3baa1921c7'
branch_labels = None
depends_on = None
def upgrade():
# ... |
import unittest
import logging
import pandas as pd
import cmapPy.pandasGEXpress.setup_GCToo_logger as setup_logger
import cmapPy.math.agg_wt_avg as agg_wt_avg
logger = logging.getLogger(setup_logger.LOGGER_NAME)
test_mat = pd.DataFrame({'A':[1,2,3], 'B': [2,8,6], 'C': [6,8,9]})
test_mat_corr = test_mat.corr()
class... |
import logging
import re
import string
from abc import abstractmethod
from typing import Any, List, Optional, Tuple
from unicodedata import normalize
import nltk
from dateutil.parser import parse
from nltk.corpus import stopwords
from pydantic import BaseModel
logger = logging.getLogger(__name__)
class TextCleaning... |
import ctypes
from sys import stdout, platform as _platform
from datetime import datetime, timedelta
from pokemongo_bot.base_task import BaseTask
from pokemongo_bot.worker_result import WorkerResult
from pokemongo_bot.tree_config_builder import ConfigException
class UpdateLiveStats(BaseTask):
"""
Periodicall... |
#!/usr/bin/python
DOCUMENTATION = '''
---
module: docker_service
short_description: Interact with the Docker Service API
'''
EXAMPLES = '''
'''
from ansible.module_utils.basic import AnsibleModule # This must be included in order for the program structure to work
from l11_ansible_modules.module_base i... |
# 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... |
# -*- coding: utf-8 -*-
"""
TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-用户管理(Bk-User) 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 with the Lic... |
from typing import Optional
import torch
@torch.jit.script
def knn(x: torch.Tensor, y: torch.Tensor, k: int,
batch_x: Optional[torch.Tensor] = None,
batch_y: Optional[torch.Tensor] = None, cosine: bool = False,
num_workers: int = 1) -> torch.Tensor:
r"""Finds for each element in :obj:`y` ... |
# Copyright 2012 IBM Corp.
#
# 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 agree... |
import numpy as np
from torch import optim
import torch
from railrl.policies.base import ExplorationPolicy
from railrl.state_distance.policies import UniversalPolicy, \
SampleBasedUniversalPolicy
from railrl.state_distance.util import merge_into_flat_obs, split_flat_obs
from railrl.torch.core import PyTorchModule
... |
#!/usr/bin/env python2
# coding=utf-8
"""
Config Handler
"""
__author__ = "Manuel Ebert"
__copyright__ = "Copyright 2015, summer.ai"
__date__ = "2015-11-09"
__email__ = "manuel@summer.ai"
import boto3
import os
from util import AttrDict
path = os.path.dirname(os.path.abspath(__file__))
def load_yaml(filename):
... |
import logging
from copy import deepcopy
from django.db import models
from django.utils.functional import cached_property
from django.utils.translation import get_language, ugettext_lazy as _
from django.utils import timezone
from ..constants import status, translation_status
from ..utils.content_edit_lock import ge... |
"""Allows to configure custom shell commands to turn a value for a sensor."""
from collections.abc import Mapping
from datetime import timedelta
import json
import logging
import shlex
import subprocess
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const impor... |
from django.conf.urls import url
from . import views
from django.conf import settings
from django.conf.urls.static import static
urlpatterns=[
url('^$',views.welcome, name = 'welcome'),
url(r'^search/', views.search_image, name='search_image'),
url(r'^image/(\d+)', views.image, name='image'),
url(r'^lo... |
# -*- coding: utf-8 -*-
"""DNA Center Create Global Pool data model.
Copyright (c) 2019 Cisco and/or its affiliates.
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... |
import sys
import cli
# ******************************************************************************************************************** #
def main():
cli.app()
# ******************************************************************************************************************** #
if __name__ == "__main__":... |
#####################################################################
# #
# /__init__.py #
# #
# Copyright 2013, Monash University ... |
# Optimize.py
# Created: Feb 2016, M. Vegh
# Modified: Aug 2017, E. Botero
# Aug 2018, T. MacDonald
# ----------------------------------------------------------------------
# Imports
# ----------------------------------------------------------------------
import SUAVE
from SUAVE.Core import U... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative wo... |
from django.core.validators import DecimalValidator
from django.db import models
from rest_framework import generics, serializers
from rest_framework.fields import ImageField
from .models import Content, Like
from authentication.models import User
class ContentSerializer(serializers.ModelSerializer):
'''
A se... |
################################################################################
# Copyright 2016-2020 Advanced Micro Devices, Inc. All rights reserved.
#
# 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 t... |
from flask import Flask, request
from structs import *
import json
#import numpy
from basicFuncs import *
app = Flask(__name__)
def create_action(action_type, target):
actionContent = ActionContent(action_type, target.__dict__)
bleh = json.dumps(actionContent.__dict__)
print(bleh)
return bleh
def cr... |
# Install: pip3 install kafka-python
from kafka import KafkaConsumer
from sqlalchemy import create_engine
from io import StringIO
from kubernetes import client, config, watch
from kubernetes.client.rest import ApiException
import pywebhdfs.webhdfs
import socket
import requests
import mysql.connector
import pandas
impor... |
# Copyright (c) 2009-2014 Upi Tamminen <desaster@gmail.com>
# See the COPYRIGHT file for more information
from __future__ import annotations
from twisted.conch.ssh.common import getNS
from cowrie.ssh import userauth
# object is added for Python 2.7 compatibility (#1198) - as is super with args
class ProxySSHAuthSe... |
from __future__ import print_function, unicode_literals
from future.builtins import open
import os
import re
import sys
from contextlib import contextmanager
from functools import wraps
from getpass import getpass, getuser
from glob import glob
from importlib import import_module
from posixpath import join
from mezza... |
# -*- coding: utf-8 -*-
# SPDX-FileCopyrightText: 2011 Sybren A. Stüvel <sybren@stuvel.eu>
#
# SPDX-License-Identifier: Apache-2.0
"""Common functionality shared by several modules."""
# pylint: disable=invalid-name
__version__ = "1.2.2"
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_RSA.git"
def b... |
import base64
import datetime
import sys
import pytest
from mock import patch
from nbgrader.utils import make_unique_key, notebook_hash
from nbexchange.handlers.base import BaseHandler
from nbexchange.tests.utils import (
AsyncSession,
async_requests,
clear_database,
get_feedback_dict,
get_files_d... |
class ExperimentList(type):
experiments = {}
def __init__(cls, name, bases, attrs):
if name != "Experiment":
ExperimentList.experiments[cls.name] = cls
class Experiment:
__metaclass__ = ExperimentList
# a list of input files that can be
# used in order to make use of more tha... |
# Copyright (C) 2019 The Raphielscape Company LLC.
#
# Licensed under the Raphielscape Public License, Version 1.c (the "License");
# you may not use this file except in compliance with the License.
#
# You can find misc modules, which dont fit in anything xD
import io
import sys
from os import execl
from random impor... |
#!/usr/bin/env python3
# Usage:
# PYTHONPATH=src ./train --dataset <file|directory|glob>
import fire
import json
import os
import numpy as np
import tensorflow as tf
import random
import time
import horovod.tensorflow as hvd
import model, sample, encoder
from load_dataset import load_dataset, Sampler
CHECKPOINT_DI... |
# -*- coding: utf-8 -*-
# Author: Koos Zevenhoven
# Needs to do some magic to import numpy and replace it with a monkey-patched
# version implementing __getitem__ etc. This seems to be close to the cleanest
# way to do this in Python. This now works best with Python >=3.5
import np.magic
|
def is_leap(year):
if year % 4 == 0:
if year % 100 == 0:
if year % 400 == 0:
return True
else:
return False
else:
return True
else:
return False
#Defining the function returning the number of days in the specified month
def days_in_month(year, month):
#Testing if the... |
from tssearch.utils.preprocessing import *
from tssearch.utils.visualisation import *
from tssearch.utils.distances_settings import *
|
import app.scripts.terminal_scripts as term
import app.scripts.cloudhsm_mgmt_utility_scripts as cmu
import time
import json
class CloudHSMMgmtUtil():
def __init__(self, eni_ip, crypto_officer_type, crypto_officer_username, crypto_officer_password):
self.eni_ip = eni_ip
self.crypto_officer_type =... |
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
import dataclasses
from dataclasses import dataclass
import fileinput
import functools
from itertools import cycle
from itertools import product
# Types
@dataclass(unsafe_hash=True)
class Player:
position: int
score: int = 0
# Functions
def move_forward(start: int, steps: int) -> int:
return 1 + ((start... |
audioFiles = {
"08": "audio/8_9.wav",
"09": "audio/9_10.wav",
"10": "audio/10_11.wav",
"11": "audio/11_12.wav",
"12": "audio/12_13.wav",
"13": "audio/13_14.wav",
"14": "audio/14_15.wav",
"15": "audio/15_16.wav",
"16": "audio/16_17.wav",
"17": "audio/17_18.wav",
"18": "audio/18_19.wav",
... |
def lengthOfLongestSubstring(s: str) -> int:
if not s or len(s) == 0:
return 0
result = 1
start_index = 0
dictionary = {}
for index, value in enumerate(s):
if value in dictionary:
start_index = max(start_index, dictionary[value] + 1)
result = ma... |
# -*- coding: utf-8 -*-
# Import Python libs
from __future__ import absolute_import
import os
import shutil
# Import Salt Testing libs
from salttesting import skipIf
from salttesting.helpers import (ensure_in_syspath, destructiveTest)
ensure_in_syspath('../../')
# Import salt libs
import integration
import salt.util... |
import unittest, os, shutil, tempfile, sys
from .. import qm, vfat, netstat
from ..util import net, proc
if sys.version_info < (2, 7):
import unittest2 as unittest
VMID_RANGE = xrange(9000, 10000)
TEMPLATE_PATHS = ['/var/lib/vz/template/qemu', '/var/lib/tomato/templates']
PORT_RANGE = xrange(2000, 3000)
WEBSOCKIFY_... |
# MIT License
# Copyright (c) 2020 Dr. Jan-Philip Gehrcke
# 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... |
#키-값
dic={}
dic['파이썬']='www.python.org'
dic['마이크로소프트']='www.microsoft.com'
dic['애플']='www.apple.com'
print(dic['파이썬'])
print(dic['마이크로소프트'])
print(dic['애플'])
print("")
print(dic)
print(dic.keys()) #키
print(dic.values()) #값
print(dic.items()) #전체 목록
print("")
#in dic.keys() <= 키 목록 안에 있는지
print('애플' in dic.keys())... |
from drone_sim.viz.body import Body
from drone_sim.viz.visualiser import Graphics |
#!/usr/bin/env python
import vtk
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# Image pipeline
reader = vtk.vtkImageReader()
reader.ReleaseDataFlagOff()
reader.SetDataByteOrderToLittleEndian()
reader.SetDataExtent(0,63,0,63,1,93)
reader.SetDataSpacing(3.2,3.2,1.5)
reader.SetDataOrigin(-100... |
from __future__ import division
import serial
import time
import threading
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
ser = serial.Serial(port='COM17', baudrate=230400, timeout=1.0)
ser.set_buffer_size(rx_size = 25000, tx_size = 12800)
print(ser.name)
ser.flushI... |
# Copyright 2019 Robert Bosch GmbH
#
# 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 wri... |
"""
Tiny little ORM (Object Relational Mapper) for SQLite.
"""
import logging
from .db_helpers import attrs
from .manager import Manager
logging.basicConfig(
filename='simple_orm_sqlite.log',
format='%(asctime)s - %(levelname)s - %(message)s',
datefmt='%d-%b-%y %H:%M:%S',
level=logging.INFO)
class M... |
# 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... |
from unittest.mock import patch
import kaa_testutils
from kaa.filetype.default import defaultmode, modebase
class TestDefaultMode(kaa_testutils._TestScreenBase):
def test_getwords(self):
doc = self._getdoc('0123 \tabc ::::あいうえおカキクケコ[[')
assert (
(0, 4, '0123', 'L_WORDCHAR'),
... |
#
# The Python Imaging Library.
# $Id$
#
# PCX file handling
#
# This format was originally used by ZSoft's popular PaintBrush
# program for the IBM PC. It is also supported by many MS-DOS and
# Windows applications, including the Windows PaintBrush program in
# Windows 3.
#
# history:
# 1995-09-01 fl Created
# 1996... |
class Wall(HostObject, IDisposable):
""" Represents a wall in Autodesk Revit. """
@staticmethod
def Create(document, *__args):
"""
Create(document: Document,curve: Curve,wallTypeId: ElementId,levelId: ElementId,height: float,offset: float,flip: bool,structural: bool) -> Wall
Cre... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.