text stringlengths 1 927k |
|---|
import itertools
import json
import pkgutil
import re
from jsonschema.compat import MutableMapping, str_types, urlsplit
class URIDict(MutableMapping):
"""
Dictionary which uses normalized URIs as keys.
"""
def normalize(self, uri):
return urlsplit(uri).geturl()
def __init__(self, *args... |
_base_ = 'htc_swin_base.py'
model = dict(
pretrained='pretrained/swin_tiny_patch4_window7_224.pth',
roi_head=dict(
semantic_roi_extractor=dict(
type='SingleRoIExtractor',
roi_layer=dict(type='RoIAlign', output_size=14, sampling_ratio=0),
out_channels=256,
... |
import cv2
import dropbox
import time
import random
start_time = time.time()
def take_snapshot():
number = random.randint(0,100)
#initializing cv2
videoCaptureObject = cv2.VideoCapture(0)
result = True
while(result):
#read the frames while the camera is on
ret,frame = videoCapture... |
# Copyright (C) 2011 Nippon Telegraph and Telephone 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 appli... |
# Copyright 2018-2021 Faculty Science 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... |
# Copyright 2017 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... |
import numpy as np
from gym import utils
from gym.envs.dart import dart_env
from .simple_water_world import BaseFluidSimulator
class DartFlatwormSwimStraightReducedEnv(dart_env.DartEnv, utils.EzPickle):
def __init__(self):
control_bounds = np.array([[1.0] * 12, [-1.0] * 12])
self.action_scale = np... |
import cv2
import numpy as np
from drivers.devices.kinect_azure.pykinectazure import PyKinectAzure, _k4a
mtx = np.array([[610.16101074, 0, 638.35681152], [0, 610.19384766, 367.82455444], [0, 0, 1]])
def get_images(pk_obj):
while True:
pk_obj.device_get_capture()
color_image_handle = pk_obj.captur... |
import sys
import os.path as osp
from itertools import repeat
import torch
from torch_sparse import coalesce
from torch_geometric.data import Data
from torch_geometric.read import read_txt_array
from torch_geometric.utils import remove_self_loops
try:
import cPickle as pickle
except ImportError:
import pickle... |
import requests
from lib2 import upload
from setting import server
import time
def stickerSave(user, name, url):
save=requests.get(f"{server}/uploadSticker", params={"pengguna":user[:-5], "nama":name, "konten":upload(url).get("id")}).json()
print(save)
if save.get("status") == False and save.get("tersimpan"... |
import torch
from torch import nn
from torch.nn.utils import spectral_norm
from generators.common import blocks
class Wrapper:
@staticmethod
def get_args(parser):
parser.add('--embed_padding', type=str, default='zero', help='zero|reflection')
parser.add('--embed_num_blocks', type=int, default=6... |
import pico_module as pm
import csv
import matplotlib.pyplot as plt
import signal
import sys
handle = 0
def signal_handler(signal, frame):
print "Stopping...\n"
if ( handle != 0 ):
pm.pico_close(handle);
sys.exit(0)
signal.signal(signal.SIGINT, signal_handler)
handle = pm.pico_init(1)
i = 0
while (True):
... |
"""Command-line INBC tool to invoke Software update on the device with manageability framework.
Copyright (C) 2020-2022 Intel Corporation
SPDX-License-Identifier: Apache-2.0
"""
import logging
import sys
import signal
import itertools
from typing import Any
from time import sleep
from inbc import shared
from inbc.bro... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
text_labels_and_annotations/auto-wrapping_text.py
Matplotlib > Gallery > Text, labels and annotations> Auto-wrapping text
https://matplotlib.org/3.1.1/gallery/text_labels_and_annotations/autowrap.html#sphx-glr-gallery-text-labels-and-annotations-autowrap-py
"""
import... |
# 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
from... |
from sklearn.model_selection import train_test_split
import pandas as pd
from sklearn.feature_extraction.text import TfidfVectorizer, TfidfTransformer, CountVectorizer
from sklearn import svm
from sklearn.naive_bayes import MultinomialNB
from sklearn.metrics import roc_auc_score
from sklearn.pipeline import Pipeline
fr... |
"""
IP Routes
object abstractions for representing IP routes in VPP
"""
import socket
from vpp_object import *
# from vnet/vnet/mpls/mpls_types.h
MPLS_IETF_MAX_LABEL = 0xfffff
MPLS_LABEL_INVALID = MPLS_IETF_MAX_LABEL + 1
class VppRoutePath(object):
def __init__(
self,
nh_addr,
... |
# -*- coding: utf-8 -*-
#
# setup.py
#
# Copyright 2015 Base4 Sistemas Ltda ME
#
# 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... |
"""
This module contains the my implementation of the FastDTW algorithm.
The algorithm is described in http://cs.fit.edu/~pkc/papers/tdm04.pdf.
This implementation is losely based on the python package from this
GitHub repository: https://github.com/slaypni/fastdtw.
My code deviates from this repository is a few ways... |
"""This module contains the general information for TestingServiceProfileFsm ManagedObject."""
from ...ucscmo import ManagedObject
from ...ucsccoremeta import UcscVersion, MoPropertyMeta, MoMeta
from ...ucscmeta import VersionMeta
class TestingServiceProfileFsmConsts():
COMPLETION_TIME_ = ""
CURRENT_FSM_RESO... |
"""
Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
# Test case ID : C5296614
# Test Case Title : Check that unless you assign a shape to a physX collider compone... |
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 27, 2022
SHREAD Dash Snow Plot
Script for running the snow plot in the dashboard (shread_dash.py)
@author: buriona, tclarkin (2020-2022)
"""
import pandas as pd
import numpy as np
import plotly.graph_objects as go
from plot_lib.utils import import_snotel,import_csas_l... |
# -*- coding: utf-8 -*-
""" Part of the `AutoSys` package
copyright (c) 2019 Michael Treanor
https://www.github.com/skeptycal/autosys
https://www.twitter.com/skeptycal
`AutoSys` is licensed under the `MIT License
`<https://opensource.org/licenses/MIT>`
"""
__license__ = "MIT"
... |
import numpy as np
from nnfs.layers import Linear
from nnfs.optimizers import SGD
class Model:
def __init__(self, layers, loss, optimizer=SGD(lr=0.01)):
self.layers = layers
self.loss = loss
self.optimizer = optimizer
def save_weights(self, filename):
weights = []
for ... |
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
#加载数据集
boston_housing = tf.keras.datasets.boston_housing
(train_x,train_y),(test_x,test_y) = boston_housing.load_data()
num_train=len(train_x) #训练集和测试机中样本的数量
num_test=len(test_x)
#对训练样本和测试样本进行标准化(归一化),这里有用到张量的广播运算机制
x_train=(train_x-train_x... |
# Copyright (c) maiot GmbH 2021. 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... |
import pandas as pd
from PIL import Image
from pathlib import Path
def make_df_imagenet(dataset):
"""
Making Pandas Dataframes of the extracted data
"""
# Making lists of class columns
classes = list(Path(dataset).iterdir())
classes = [p.stem for p in classes if p.is_dir()]
class_ids = [i f... |
from django.urls import path
from django.conf import settings
from django.conf.urls.static import static
from . import views
app_name = 'onlinecourse'
urlpatterns = [
# route is a string contains a URL pattern
# view refers to the view function
# name the URL
path(route='', view=views.CourseListView.as... |
# qubit number=4
# total number=49
import cirq
import qiskit
from qiskit.providers.aer import QasmSimulator
from qiskit.test.mock import FakeVigo
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import ... |
# tianqiVirus's Essay
# by TianqiVirus
# https://github.com/TianqiVirus
# Released under a "Simplified BSD" license
width=600
height=600
title="tianqiVirusEssay"
icon="clown.ico"
fps=32
import pygame
from random import randint
screen = pygame.display.set_mode([width,height])
pygame.display.set_caption(title)
pygame.... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2019, 2021.
#
# 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 derivat... |
#!/usr/bin/env python3
# -*- mode: python -*-
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2016 The Electrum developers
#
# 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... |
# -*- coding: utf-8 -*-
#
# This file is part of REANA.
# Copyright (C) 2017, 2018, 2019 CERN.
#
# REANA is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""REANA-Workflow-Engine-Yadage."""
from __future__ import absolute_import, print... |
description = 'Inputs from the Pilz control box'
group = 'lowlevel'
tango_base = 'tango://sans1hw.sans1.frm2:10000/sans1/modbus/'
# TODO: Mapping and description of the devices
devices = dict(
iatt1 = device('nicos.devices.tango.NamedDigitalInput',
description = 'Unknown',
tangodevice = tango_ba... |
# -*- coding: utf-8 -*-
"""Azure Part Models testcases.
"""
from django.core.exceptions import MultipleObjectsReturned
from vision_on_edge.general.tests.azure_testcase import CustomVisionTestCase
from vision_on_edge.general.tests.test_special_strings import special_strings
from ..models import Part
class AzurePart... |
import functools
import z3
class WrappingNamespace(dict):
"""A namespace that automatically wraps all objects that are looked up on
it with magic substitutes for the getattr/setattr protocols.
:type constraints: pybelsberg.constraint.Constraints
:var patches: A mapping of all instance attributes to th... |
#program to check whether lowercase letters exist in a string.
str1 = 'A8238i823acdeOUEI'
print(any(c.islower() for c in str1)) |
import os, common, gtypes, sys_compiler, gvmtlink, heap
_ptr_size = gtypes.p.size
_ptr_mask = _ptr_size - 1
ADDR_TEMPLATE = '.long %s\n'
ALIGN_TEMPLATE = '.align %s\n'
LINE_SIZE = 1 << 7
BLOCK_SIZE = 1 << 14
SUPER_BLOCK_ALIGN = 1 << 19
LINE_MASK = LINE_SIZE - 1
BLOCK_MASK = BLOCK_SIZE - 1
BLOCKS_PER_SUPER_BLOCK = ... |
import logging
import re
from binascii import unhexlify
from datetime import datetime
from os import urandom
from urllib.parse import urlparse
from hiss.encryption import PY_CRYPTO, encrypt, decrypt
from hiss.exception import MarshalError
from hiss.handler.gntp import GNTP_BASE_VERSION, ENCRYPTION_ALGORITHM
from hiss.... |
"""
Utility functions
"""
import numpy as np
def set_all_args(obj, argdict):
for k in argdict.keys():
if hasattr(obj, k):
setattr(obj, k, argdict[k])
else:
print("Warning: parameter name {} not found!".format(k))
def div0(a,b):
with np.errstate(divide='ignore', invali... |
import os
import time
import random
import argparse
import numpy as np
from tqdm import trange
from types import SimpleNamespace
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from torch.utils.data import DataLoader
from torchvision.utils import save_image
from t... |
import boto3
import json
import logging
import os
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def handler(event, context):
repo_count = 0
img_count = 0
ec2 = boto3.client('ec2')
regions = ec2.describe_regions()
### Region Loop ###
for region in regions['Regio... |
import numpy as np
import torch
from dataclasses import dataclass
from typing import List
from jiant.tasks.core import (
BaseExample,
BaseTokenizedExample,
BaseDataRow,
BatchMixin,
Task,
TaskTypes,
)
from jiant.tasks.lib.templates.shared import double_sentence_featurize, labels_to_bimap
from ji... |
# coding=utf-8
# Copyright 2021 The Google Research 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 applicab... |
import datetime
from sqlalchemy import (
Boolean,
DateTime,
Integer,
String,
event,
)
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.sql import (
case,
column,
extract,
func,
)
from temboardui.model import tables
Mode... |
import logging
import pytorch_metric_learning.utils.logging_presets as logging_presets
import sentencepiece as spm
import torch
from pytorch_metric_learning import losses, miners, samplers, trainers, testers
from pytorch_metric_learning.utils.accuracy_calculator import AccuracyCalculator
from config import SPIECE_MOD... |
from __future__ import print_function
import os
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data # Import MINST data
def linear_model(x):
# x is the image input
# mnist data image of shape 28*28=784
# Set model weights
W = tf.Variable(tf.zeros([784, 10]))
b = tf.Variable(tf... |
import pathlib
import subprocess
import pytest
from setuptools import sandbox
from pysen.path import change_dir
TARGET_EXAMPLE = "sync_cmdclass_pyproject"
@pytest.mark.examples
def test_cli_run(example_dir: pathlib.Path) -> None:
target = example_dir / TARGET_EXAMPLE
with change_dir(target):
subpro... |
import sys
from io import StringIO
import unittest
from src.AOJ.ITP1_6_B import resolve
class TestClass(unittest.TestCase):
def assertIO(self, input, output):
stdout, stdin = sys.stdout, sys.stdin
sys.stdout, sys.stdin = StringIO(), StringIO(input)
resolve()
sys.stdout.seek(0)
... |
import _plotly_utils.basevalidators
class ScaleValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self, plotly_name="scale", parent_name="scatter3d.projection.y", **kwargs
):
super(ScaleValidator, self).__init__(
plotly_name=plotly_name,
parent_name=... |
import os
import argparse
import itertools
import numpy as np
import joblib
import matplotlib.pyplot as plt
from sklearn import datasets
from sklearn.svm import SVC
from sklearn.metrics import confusion_matrix, precision_score, recall_score, f1_score
from sklearn.model_selection import train_test_split
from azureml.c... |
#!/usr/bin/env python3
# Copyright (c) 2014 Wladimir J. van der Laan
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Run this script from the root of the repository to update all translations from
transifex.
It will do the foll... |
"""server URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based ... |
# pylint: disable=R0902,R0904,R0914
from math import sin, cos, radians, atan2, sqrt, degrees
from itertools import count
from typing import Tuple # , TYPE_CHECKING
import numpy as np
from numpy import array, zeros
from scipy.sparse import coo_matrix # type: ignore
from pyNastran.utils.numpy_utils import integer_type... |
# -*- coding: utf-8 -*-
"""
Andrew D. Rouillard
Computational Biologist
Target Sciences
GSK
andrew.d.rouillard@gsk.com
"""
import os
import gzip
import pickle
import numpy as np
import dataclasses as dc
def load_datasetinfo(datasetspath):
dataset_info = []
with open(datasetspath, mode='rt', encoding="utf-8", ... |
"""
Runner for a Celery Python function
"""
from __future__ import absolute_import
import time
from uuid import uuid4
from importlib import import_module
from ..event import BaseEvent
from ..utils import add_data_if_needed
class CeleryRunner(BaseEvent):
"""
Represents Python Celery event runner.
"""
... |
import click
import logging
from os.path import basename, exists
from shutil import rmtree
from helper.aws import AwsApiHelper
logging.getLogger().setLevel(logging.DEBUG)
class Helper(AwsApiHelper):
def __init__(self, sql_file):
super().__init__()
self._sql_file = sql_file
with open(sql_f... |
from os import listdir, getenv
from os.path import isfile, join, basename
from dmrpp_generator.main import DMRPPGenerator
from re import match
import logging
import json
logging.getLogger()
if __name__ == "__main__":
payload = getenv('PAYLOAD', '{}')
meta = json.loads(payload)
workstation_path = getenv('MO... |
import numpy as np
from Tensor import Tensor
class Operation:
result = None
def forward(self):
raise NotImplementedError
def backward(self, gradOutput: Tensor):
raise NotImplementedError
class Negative(Operation):
def __init__(self, A: Tensor,B:Tensor):
self.A = A
def forward(self):
self.result = ... |
"""
Capitalize!
:author: Dela Anthonio
:hackerrank: https://hackerrank.com/delaanthonio
:problem: https://www.hackerrank.com/contests/pythonist3/challenges/capitalize
"""
def solve(s: str):
words = [word.capitalize() for word in s.split(' ')]
return " ".join(words)
print(solve('hi jake hj ')) |
import os
import shlex
import subprocess
import unittest
import numpy
import lue
import lue_test
class TestCase(unittest.TestCase):
@classmethod
def dataset_name(self,
module_name,
filename):
return "{}.lue".format(
os.path.join(os.path.dirname(module_name), filena... |
import datetime as dt
from unittest import TestCase
import numpy as np
from numpy.testing import assert_allclose, assert_almost_equal
import pytest
from orbit_predictor.locations import ARG
from orbit_predictor.predictors.numerical import (
J2Predictor, InvalidOrbitError, R_E_KM, is_sun_synchronous
)
class J2Pr... |
#!/usr/bin/env python
from distutils.core import setup
setup(
name='notify-when-done',
version='1.0',
description='Send push notifications to monitor long running jobs',
author='Aziz M. Bookwala',
author_email='aziz.mansur@gmail.com',
url='https://github.com/azizmb/pushwhendone',
py_module... |
import unittest
from flapi_schema.types import AnyOf
class AnyOfTest(unittest.TestCase):
def test_any_of(self):
rule = AnyOf(lambda _: True, lambda _: False)
self.assertTrue(rule({}))
def test_fails(self):
rule = AnyOf(lambda _: False, lambda _: False)
self.assertFalse(rule({... |
#*******************************************************************************
#
# scmRTOS Integrity Checker Script
#
# Version 2.1
#
# Copyright (c) 2006-2011, Harry E. Zhurov
#
#
# DESCRIPTION:
#
#
# FUNCTIONALITY:
#
#
#******************************************************... |
from api.exceptions import DatasourceBadParameterTypeError
import os
import six
import importlib
class TypeChecker:
primitive_types = set(["unsigned int", "int", "bool", "string", "Object",
"datetime", "float"])
def __init__(self, type_check_info, type_check_enum):
self._type_check_info = typ... |
from django.db import models
class Batch(models.Model):
name = models.CharField(max_length=250)
notes = models.TextField(blank=True)
added = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
def __unicode__(self):
return self.name
class Card(models.Mo... |
BITLY_CONFIGURE_PROMPT = 'Please enter the bitly API access token. ' \
'You can get it here (login to the bitly first): ' \
'https://bitly.is/accesstoken\nAPI token' |
import os
import sys
from setuptools import find_packages
from setuptools import setup
version = '1.26.0.dev0'
install_requires = [
'google-api-python-client>=1.5.5',
'oauth2client>=4.0',
'setuptools>=41.6.0',
# already a dependency of google-api-python-client, but added for consistency
'httplib2... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
from netests.constants import NOT_SET
from netests.protocols.vrf import VRF, ListVRF
def _arista_vrf_api_converter(
hostname: str(),
cmd_output,
options={}
) -> ListVRF:
if not isinstance(cmd_output['result'][0], dict):
cmd_output = ... |
# -*- coding: utf-8 -*-
import os, sys, pdb
import torch
from torch.autograd import Variable
import torch.nn.functional as F
import torch.utils.data as data
from torchvision import datasets, transforms
import numpy as np
import cv2, copy, time
import matplotlib.pyplot as plt
from scipy.ndimage import binary_fill_hol... |
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the 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.
import numpy as np
import torch
im... |
import collections
from typing import Any, Sequence
from django.core.exceptions import ObjectDoesNotExist
from django.db.models import Manager
# Mock is_simple_callable for now
# instead of the more sophisticated one from rest_framework.fields
def is_simple_callable(possible_callable: Any) -> bool:
return callab... |
import pyglet
def center_image(image):
"""Sets an image's anchor point to its center"""
image.anchor_x = image.width / 2
image.anchor_y = image.height / 2
# Tell pyglet where to find the resources
pyglet.resource.path = ['../resources']
pyglet.resource.reindex()
# Load the three main resources and get ... |
#!/usr/bin/env python
#
# Licence statement goes here
#
tosca_ordered_fields = ['tosca_definitions_version', 'description', 'metadata', 'policy_types', 'topology_template'] |
import json
import pytest
import requests
from hypothesis import given
from hypothesis import strategies as st
from schemathesis import Case
from schemathesis.models import APIOperation
from schemathesis.specs.openapi import expressions
from schemathesis.specs.openapi.expressions.errors import RuntimeExpressionError
... |
import os
from collections import defaultdict
from copy import copy
from typing import TYPE_CHECKING, Dict, Optional, Set, Tuple
from voluptuous import Required
from dvc.path_info import PathInfo
from .base import Dependency
if TYPE_CHECKING:
from dvc.hash_info import HashInfo
from dvc.objects.db.base impor... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
def calc_mean_invstddev(feature):
if len(feature.size()) != 2:
raise ValueError("We expect the input feature to be ... |
"""
# Tests for stuff in django.utils.text.
>>> from django.utils.text import *
### smart_split ###########################################################
>>> list(smart_split(r'''This is "a person" test.'''))
['This', 'is', '"a person"', 'test.']
>>> print list(smart_split(r'''This is "a person's" test.'''))[2]
"a ... |
# noinspection PyUnreachableCode
if False:
# noinspection PyUnresolvedReferences
from _stubs import *
from .palette import Palette
ext.palette = Palette(COMP())
def onValueChange(panelValue, prev):
ext.palette.onPanelInsideChange(panelValue) |
from .multi_head import MultiHead
from .multi_head_attention import MultiHeadAttention
__version__ = '0.28.0' |
dados = {'nome': str(input('Nome: ')), 'média': float(input('Média: '))}
if dados['média'] > 9:
dados['situação'] = 'apto'
elif 6 < dados['média'] < 10:
dados['situação'] = 'recurso'
else:
dados['situação'] = 'Ñapto'
for chave, valor in dados.items():
print(f'{chave} é {valor}') |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#author:DWBH
#Exploit Title : Wordpress N-Media Website Contact Form with File Upload 1.3.4
import sys
import re
def assign(service, arg):
if service == "wordpress":
return True, arg
def audit(arg):
uploader=''
payload='/wp-admin/admin-ajax.php'
u... |
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
import sys
import pytest # noqa: F401
import numpy as np # noqa: F401
import awkward as ak # noqa: F401
def test_iterator():
content = ak.layout.NumpyArray(np.array([1.1, 2.2, 3.3]))
offsets = ak.layout.Index32(np.ar... |
import superturtle, turtle
turtle.setup(500,500)
wn = turtle.Screen()
wn.title("Turtle Chase!")
wn.bgcolor("pink")
player_one = superturtle.SuperTurtle()
player_two = superturtle.SuperTurtle()
# make anouncements
player_one.write(" Bet you can't catch me!")
player_two.write(" Im gonna catch you man.")
# he... |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
import os
import json
import uuid
import boto3
import datetime
flight_table_name = os.environ['ORDER_TABLE_NAME']
init_db_lambda_name = os.environ['INITDB_LAMBDA_NAME']
dynamodb = boto3.resource('dynamodb')
table =... |
c.JupyterConsoleApp.confirm_exit = False
c.JupyterQtConsoleApp.confirm_exit = False
c.JupyterQtConsoleApp.hide_menubar = True
c.ConsoleWidget.include_other_output = True
c.HistoryConsoleWidget.include_other_output = True
c.FrontendWidget.include_other_output = True
c.JupyterWidget.include_other_output = True
c.JupyterW... |
#!/usr/bin/env python
# Copyright (c) 2014 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test re-org scenarios with a mempool that contains transactions
# that spend (directly or indirectly) coinb... |
import asyncio
import json
from unittest.mock import mock_open
import aiohttp
import pytest
import pytest_mock
import pybotters
async def test_client():
apis = {
'name1': ['key1', 'secret1'],
'name2': ['key2', 'secret2'],
'name3': ['key3', 'secret3'],
}
base_url = 'http://example... |
#!/usr/bin/env python
#
# Use the raw transactions API to spend LYRAs received on particular addresses,
# and lyra any change back to that same address.
#
# Example usage:
# spendfrom.py # Lists available funds
# spendfrom.py --from=ADDRESS --to=ADDRESS --amount=11.00
#
# Assumes it will talk to a lyrad or lyra-Qt r... |
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
# See file LICENSE for terms.
# This file is a copy of what is available in a Cython demo + some additions
from __future__ import absolute_import, print_function
import os
from distutils.sysconfig import get_config_var, get_python_inc
import versioneer
... |
"""
Ory APIs
Documentation for all public and administrative Ory APIs. Administrative APIs can only be accessed with a valid Personal Access Token. Public APIs are mostly used in browsers. # noqa: E501
The version of the OpenAPI document: v0.0.1-alpha.71
Contact: support@ory.sh
Generated by: htt... |
"""Routines for talking to a kake-server daemon, spawning one if necessary.
Routines in this module are meant to be used from dev-appserver.
This module defines these routines:
start_server(): spawn a kake server as a daemon, if needed
server_port(): returns port the current kake server is running on
get(): giv... |
#!/usr/bin/env python
#
# Use the raw transactions API to spend bitcoins received on particular addresses,
# and send any change back to that same address.
#
# Example usage:
# spendfrom.py # Lists available funds
# spendfrom.py --from=ADDRESS --to=ADDRESS --amount=11.00
#
# Assumes it will talk to a bitcoind or Bit... |
"""
Copyright (c) 2019-2020 Intel 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 w... |
from machine import Pin
from time import sleep
analog_switch = Pin(16,Pin.OUT, Pin.PULL_DOWN)
led_status1 = Pin(15,Pin.IN,Pin.PULL_UP)
led_status2 = Pin(14,Pin.IN,Pin.PULL_UP)
led_status3 = Pin(13,Pin.IN,Pin.PULL_UP)
def button_sim():
analog_switch.value(1)
sleep(0.1)
analog_switch.value(0)
def get_cur... |
from service_capacity_modeling.hardware import shapes
from service_capacity_modeling.interface import FixedInterval
from service_capacity_modeling.models.common import WorkingSetEstimator
from service_capacity_modeling.stats import dist_for_interval
def test_working_set():
gp2_interval = shapes.region("us-east-1"... |
import functools
import operator
import os
import os.path
import sys
import numpy as np
# Bamboo utilities
current_file = os.path.realpath(__file__)
current_dir = os.path.dirname(current_file)
sys.path.insert(0, os.path.join(os.path.dirname(current_dir), 'common_python'))
import tools
# ==============================... |
import os
import csv
import genanki
from gtts import gTTS
from mnemocards import ASSETS_DIR
from mnemocards.utils import get_hash_id, NoteID, generate_furigana
from mnemocards.builders.vocabulary_builder import VocabularyBuilder
from mnemocards.builders.vocabulary_builder import remove_parentheses, remove_spaces
fr... |
# encoding: utf-8
from __future__ import absolute_import
import os
import pytest
import webtest
from io import BytesIO
from PIL import Image
from weasyl.macro import MACRO_APP_ROOT, MACRO_STORAGE_ROOT
from weasyl.test import db_utils
from weasyl.test.web.wsgi import app
_BASE_FORM = {
'title': u'Test name',
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.