text stringlengths 2 999k |
|---|
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 9
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_8_2_2
from i... |
#
#
#
from __future__ import absolute_import, division, print_function, \
unicode_literals
from logging import getLogger
logger = getLogger('Ns1')
try:
logger.warning('octodns_ns1 shimmed. Update your provider class to '
'octodns_ns1.Ns1Provider. '
'Shim will be removed ... |
import os
import logging
from logging.handlers import SMTPHandler, RotatingFileHandler
from flask import Flask
from config import Config
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from flask_login import LoginManager
from flask_mail import Mail
from flask_bs4 import Bootstrap
from flask_m... |
# -*- coding: utf-8 -*-
from datetime import date
from decimal import Decimal
from urllib.parse import urlencode
from django.contrib.auth import get_user_model
from django.http import QueryDict
from rest_framework.test import APIClient, APIRequestFactory
from ralph.api.filters import (
ExtendedFiltersBackend,
... |
from threading import Timer
import time
import os
def timer_func(self):
print(time.time() - self.timestamp)
if time.time() - self.timestamp < 5:
print(str(self.speed) + ' ' + str(self.balance))
self.control_impl(self.speed, self.balance)
elif self.speed > 0:
print('Timestamp too ol... |
#!/usr/bin/env python
import sys
import rospy
import yaml
from dynamic_reconfigure.server import Server as DynamicReconfigureServer
from geometry_msgs.msg import TwistStamped
from sensor_msgs.msg import Joy
from arka_manipulator.cfg import ManipulatorJoyConfig
from arka_manipulator.msg import ManipulatorData
from me... |
import os
import logging
import networkx
import string
import itertools
import pickle
from collections import defaultdict
from itanium_demangler import parse
from archinfo.arch_arm import get_real_address_if_arm
import claripy
from ...protos import function_pb2, primitives_pb2
from ...serializable import Serializab... |
#!/usr/bin/env python
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to us... |
# Lint as: python2, python3
# Copyright 2019 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 req... |
from pathlib import Path
from lightpype import Pipeline, Script
ROOT_DIR = Path(__file__).parents[1] # always returns absolute path in Python3.9+
SRC_PATH = ROOT_DIR / "src"
SRC_PATH.mkdir(exist_ok=True)
def main():
scripts = [
Script(SRC_PATH / "first.py"),
Script(SRC_PATH / "second.py"),
... |
# 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 agreed to in... |
from enum import Enum
class TransactionType(Enum):
Transfer = "XFER"
PowReward = "POWR"
|
#!/usr/bin/env python3
#
# Copyright 2019-2020 Internet Corporation for Assigned Names and Numbers.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at https://mozilla.org/MPL/2.0/.
#
# Developed by S... |
from django.conf import settings
from django.db import models
from datagrowth.configuration import create_config
from core.constants import Repositories
from core.models import HarvestHttpResource, ExtractionMapping
from hanze.extraction import HanzeResourceObjectExtraction, HANZE_EXTRACTION_OBJECTIVE
class HanzeRe... |
from django.shortcuts import render
from rest_framework import viewsets
from .models import Ultrasonic
from .serializer import UltrasonicSerializer
# Create your views here.
class UltrasonicViewSet(viewsets.ModelViewSet):
queryset = Ultrasonic.objects.all().order_by('-created')
serializer_class = UltrasonicSe... |
"""
Internal endpoints.
Code to implement the /api/internal endpoint
FIXME: TO BE DEPRECATED
"""
from b2stage.endpoints.commons import CURRENT_MAIN_ENDPOINT
from b2stage.endpoints.commons.endpoint import EudatEndpoint
from restapi import decorators
from restapi.config import TESTING
from restapi.models import fields
... |
#!/usr/bin/env python3
#
# Author:
# Tamas Jos (@skelsec)
#
import platform
import json
from pypykatz.commons.common import KatzSystemInfo
from pypykatz.lsadecryptor import CredmanTemplate, MsvTemplate, \
MsvDecryptor, WdigestTemplate, LsaTemplate, WdigestDecryptor, \
LiveSspTemplate, LiveSspDecryptor, SspDecrypto... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_clone_army
----------------------------------
Tests for `clone_army` module.
"""
from . import mock_data
import os.path
from unittest import mock
import pytest
import requests
from click.testing import CliRunner
from clone_army import clone_army
from clone_arm... |
from typing import List
from aicssegmentation.workflow.workflow_definition import WorkflowDefinition
from napari.layers.base.base import Layer
from qtpy.QtWidgets import (
QComboBox,
QLabel,
QVBoxLayout,
QWidget,
)
from qtpy.QtGui import QStandardItem, QStandardItemModel
from qtpy import QtCore
from n... |
from tapis_cli.project_ini.schema import (app, actor, docker, git, job, system)
from tapis_cli.clients.services.mixins import ParserExtender
def AppIniArgs(ParserExtender):
pass
def ActorIniArgs(ParserExtender):
pass
def DockerIniArgs(ParserExtender):
pass
def GitIniArgs(ParserExtender):
pass
... |
import numpy as np
from VariableUnittest import VariableUnitTest
from gwlfe.Input.WaterBudget import Withdrawal
class TestWithdrawal(VariableUnitTest):
def test_Withdrawal(self):
z = self.z
np.testing.assert_array_almost_equal(
Withdrawal.Withdrawal_f(z.NYrs, z.StreamWithdrawal, z.Gro... |
#!/usr/bin/env python3
import pytest
import glooey
from vecrec import Rect
def test_misspelled_alignment():
with pytest.raises(glooey.UsageError) as err:
glooey.drawing.align('not an alignment', None, None)
def test_parent_changed():
child, parent = Rect.null(), Rect.null()
def change_parent(chi... |
import numpy as np
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
import scanpy as sc
import seaborn as sns
#========= may have to split some of these methods into utils later
def get_cls_adata(adata_here,n_neighbors):
sc.pp.neighbors(adata_here,n_neighbors=n_neighbors,use_rep='X')
sc.tl... |
import requests
class ServerConnection:
def __init__(self, url) -> None:
self.cleanDataServer();
self.url = url
pass
def sendToServer(self, value, type):
payLoad = {
"value": value,
"type": type
}
# print(f"{type}:\nSimples: {ploadSimple... |
# 245
# ^(http(s?)\:\/\/)?(www.)?(([A-Za-z]+)([0-9]+)?([A-Za-z0-9\.\_\-]+)?)(\.)(([a-zA-Z]{2,})([0-9a-zA-Z]+)?)(\:\d{0,5})?(\/|(\/[A-Za-z]+([a-zA-Z0-9]+)?)+)?(\?[a-zA-Z0-9\\\&\%\_\.\/\-\=\~\*]+)?$
# EXPONENT
# nums:4
# EXPONENT AttackString:"A.aa"+"/AA"*32+"! _1_EOA(i or ii)"
import re
from time import perf_counter
r... |
#!/usr/bin/env python
"""
Copyright (c) 2014-2019 Maltrail developers (https://github.com/stamparm/maltrail/)
See the file 'LICENSE' for copying permission
"""
from antivirus.lists_based_engine.update import retrieve_content
from antivirus.lists_based_engine.settings import IP_TYPE
from antivirus.lists_based_engine.s... |
import sys
# I went with a pattern approach for this problem
# I noticed a pattern on both sides of the diagonals, and decided to loop through the two sides and sum one side then the other,
# then sum those two sides together
# I also did not really do the problem solving steps, that's because I wasn't really sure to ... |
import time
import Utils
import dbExe
output=[]
name=Utils.getNames()
def traversal(name):
qh=Utils.QHistory(10)
n,r,ra,rb,des=qh.Search(name)
db = dbExe.db()
for i in range(n):
output.append([ra[i],rb[i],r[i],des[i]])
add_values="("+ra[i]+","+rb[i]+","+r[i]+","+des[i]+")"
print... |
# -*- coding: utf-8 -*-
import sys
import math
common_repo_path = sys.argv[1]
report_count = int(sys.argv[2])
ddr_banks = int(sys.argv[3])
io_test = int(sys.argv[4])
reapr_path = sys.argv[5]
if ((report_count%512)!=0):
#if report_count is not evenly divided by 512, find the exponent of next ... |
from typing import * # pylint: disable=wildcard-import,unused-wildcard-import
from abc import abstractmethod
import random
import functools
import os
from transformers import AutoModelWithLMHead
from transformers import PreTrainedModel
from transformers.tokenization_utils import BatchEncoding
from .tokenizer import... |
"""
Created on Sat Oct 23 19:38:17 2021
@author: Nelson Mosquera (Monotera)
@Theory Taken from: www.geeksforgeeks.org
Linked list
A linked list is represented by a pointer to the first node of the linked list.
The first node is called the head. If the linked list is empty, then the value
of the head is NULL.
Each... |
# 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 ... |
"""
WSGI config for awards 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.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTIN... |
"""
This implementation is adapted from
https://github.com/ardigen/MAT/blob/master/src/transformer.py
"""
import math
from typing import Type
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from .models_api import PretrainedModelBase
from .models_common_utils import MultiHeadedA... |
import json
pair_ids = {
336:'BNB_BTC',
462:'BTC_AAVE',
438:'BTC_AKRO',
451:'BTC_AMP',
177:'BTC_ARDR',
253:'BTC_ATOM',
324:'BTC_AVA',
210:'BTC_BAT',
189:'BTC_BCH',
464:'BTC_BCHA',
236:'BTC_BCHABC',
466:'BTC_BCHN',
238:'BTC_BCHSV',
468:'BTC_BID',
232:'BTC_BNT',
14:'BTC_BTS',
333:'BTC_CHR',
194:'BTC_CVC',
24:'BTC_DASH',... |
from operator import attrgetter
import pyangbind.lib.xpathhelper as xpathhelper
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType
from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType
from pyangbind.lib.base import PybindBase
from d... |
#!/usr/bin/env python
from setuptools import setup
setup(name='pyobb',
packages=['pyobb'],
version='1.0.2',
install_requires=['numpy>=1.12'],
description='Python OBB Implementation',
author='Pedro Boechat',
author_email='pboechat@gmail.com',
url='https://github.com/pboechat/... |
import warnings
import numpy as np
import pytest
from dpmmlearn.density import (multivariate_t_density, scaled_IX_density,
t_density)
from scipy.integrate import dblquad, quad
def test_scaled_IX_density():
nu = 3
sigsqr = 1.0
# test that probability integrates to 1.0
r... |
import functools
import itertools
import warnings
import numpy as np
from ..core.formatting import format_item
from .utils import (
_infer_xy_labels,
_process_cmap_cbar_kwargs,
import_matplotlib_pyplot,
label_from_attrs,
)
# Overrides axes.labelsize, xtick.major.size, ytick.major.size
# from mpl.rcPa... |
"""
FAT-Forensics
=============
FAT-Forensics is a Python module integrating a variety of fairness,
accountability (security, privacy) and transparency (explainability,
interpretability) approaches to assess social impact of artificial
intelligence systems.
"""
# Author: Kacper Sokol <k.sokol@bristol.ac.uk>
# License:... |
"""Support for WeMo switches."""
import asyncio
import logging
from datetime import datetime, timedelta
import requests
import async_timeout
from homeassistant.components.switch import SwitchDevice
from homeassistant.exceptions import PlatformNotReady
from homeassistant.util import convert
from homeassistant.const im... |
# Definition for a binary tree node.
import sys
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def validate_bst(self, root: TreeNode, min_bound:int, max_bound:int)-> bool:
if root is None:
re... |
### Model data
class catboost_model(object):
float_features_index = [
0,
]
float_feature_count = 1
cat_feature_count = 1
binary_feature_count = 2
tree_count = 5
float_feature_borders = [
[2]
]
tree_depth = [2, 1, 2, 1, 1]
tree_split_border = [255, 1, 255, 255, 1,... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2019-07-10 04:21
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations... |
"""
File: similarity.py
----------------------------
This program compares short dna sequence, s2,
with sub sequences of a long dna sequence, s1
The way of approaching this task is the same as
what people are doing in the bio industry.
"""
def main():
"""
User will input a long DNA sequence(s1) and a short D... |
from setuptools import setup
with open('README.md') as f:
readme = f.read()
setup(
name='yottadb_kernel',
version='1.0',
packages=['yottadb_kernel'],
description='YottaDB kernel for Jupyter',
long_description=readme,
author='Winfried Bantel',
author_email='winfried.bantel@hs-aalen.de',... |
i = 1
while i <=11:
print(i)
i +=1
|
# Copyright 2015 Google Inc. 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... |
import socket
import select
import logging
import signal
import sys
import random
def broadcast(sock, message):
"""This function broadcats data to all users
:param sock: socket object
:param message: message to send
"""
#Non Empty sockets
valid_users = []
# Iterate connection list
for... |
"""
MIT License
Copyright (c) 2020 GamingGeek
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, dis... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
class C:
def __init__(self):
self.b = 0
a = 0
c = C()
assert c.a == 0
assert c.b == 0
assert 'a' in dir(c)
assert 'b' in dir(c)
delattr(c, 'b')
assert not 'b' in dir(c)
try:
delattr(c, 'a')
except AttributeError as e:
assert e.args[0] == "a"
else... |
from setuptools import setup, find_packages
setup(
name='pyconcepticon',
version='2.6.1.dev0',
description='programmatic access to concepticon-data',
long_description=open('README.md').read(),
long_description_content_type='text/markdown',
license='Apache 2.0',
classifiers=[
"Progr... |
# -*- coding: utf-8 -*-
#
# 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
#... |
from primitives import Node, Anode, Cathode
from threading import Event
def test_node():
n = Node(False, None)
assert not n.value
n.value = True
assert n.value
n = Node(True, None)
assert n.value
n.value = False
assert not n.value
def test_node_value_changed():
def value_chang... |
class Matrix:
def __init__(self, row_count: int, col_count: int, data: list):
self.create(row_count, col_count, data)
def create(self, row_count: int, col_count: int, data: list):
self.rows = row_count
self.cols = col_count
self.mat = []
for i in range(row_count):
... |
#!/usr/bin/python
#
# Created on Aug 25, 2016
# @author: Gaurav Rastogi (grastogi@avinetworks.com)
# Eric Anderson (eanderson@avinetworks.com)
# module_check: supported
# Avi Version: 17.1.1
#
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the te... |
#!/usr/bin/env python
# coding: utf-8
"""
Tests for dss.Config
"""
import os
import sys
import unittest
import unittest.mock
import google.resumable_media.common
pkg_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) # noqa
sys.path.insert(0, pkg_root) # noqa
from tests.infra import testmode
fr... |
import pandas as pd
import os
import datetime
import numpy as np
import statsmodels.formula.api as sml
import matplotlib.pyplot as plt
import scipy.stats as scs
import matplotlib.mlab as mlab
from easyquant.indicator.base import *
import json
from easyquant import MongoIo
import statsmodels.api as sm
from multiproce... |
import os
from collections import OrderedDict
import torch
import torch.nn as nn
from .. import layer as vn_layer
__all__ = ['TinyYolov2']
class TinyYolov2(nn.Module):
def __init__(self, num_anchors, num_classes):
""" Network initialisation """
super().__init__()
layer_list = [
... |
from PIL import Image
from PIL import ImageOps
from torch.utils.data import Dataset
import random
import numpy as np
import torch
class SiameseDataset(Dataset):
def __init__(self, ImgDataset, transform=None, invert=True):
self.ImgDataset = ImgDataset
self.transform = transform
self.invert =... |
# coding: utf-8
# Copyright (c) 2016, 2020, 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... |
import fasttext
import os
from flask import Flask, jsonify, request
from flask_restful import Api, Resource
app = Flask(__name__)
api = Api(app)
# This is what you get when you do model.save_model("model_fasttext.bin")
model = fasttext.load_model('model_fasttext.bin')
class MakePrediction(Resource):
@staticmetho... |
import os
import sys
import user
config = user.config()
def run(path):
if os.path.isfile(path):
if path.endswith(config['suffix']):
with open(path, "r", encoding="utf-8") as f:
tmpfile = open(path+'.tmp', 'w+b')
for line in f:
lin... |
#!/usr/bin/python3
# bucket.py
import sys
sys.path.append("../")
import boto3
from flask_api.config import S3_KEY, S3_SECRET, S3_BUCKET, S3_LOCATION
s3_client = boto3.client("s3", aws_access_key_id=S3_KEY, aws_secret_access_key=S3_SECRET)
s3_resource = boto3.resource("s3", aws_access_key_id=S3_KEY, aws_secret_access_... |
import numpy as np
from guiLib import *
class LootCrate:
"""
A class representing a single loot crate that can have multiple items.
Attributes
- ``name``: The name of the ``LootCrate``.
- ``cost``: The cost of the ``LootCrate``.
- ``pool``: The pool of ite... |
# Echo client program
import socket
HOST = 'daring.cwi.nl' # The remote host
PORT = 50007 # The same port as used by the server
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("127.0.0.1", 7778))
s.send('ONE\n')
s.close()
data1 = s.recv(1024)
print 'Received data1', repr(data1)
|
# -*- coding: utf-8 -*-
"""
test_theming
~~~~~~~~~~~~
Test the Theme class.
:copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import os
import zipfile
from util import *
from sphinx.theming import Theme, ThemeError
@with_app(confoverr... |
# -*- coding: utf-8 -*-
from __future__ import print_function, division, unicode_literals
from __future__ import absolute_import
import time
import sys
import smbus2
# code of driver class included below
# import relevant pieces from adafruit
class GroveADCConfig(object):
"""grove ADC configuration and interf... |
""" This script will read/share data from a capacitive soil sensor using the FBS' serial, BLE, and onboard neopixel"""
# Script Source/Engineering
# https://learn.adafruit.com/adafruit-stemma-soil-sensor-i2c-capacitive-moisture-sensor/python-circuitpython-test
# https://www.youtube.com/profgallaugher
# https://g... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
利用pymysql模块管理mysql的连接和CURD基础使用
author: gxcuizy
date: 2018-10-24
"""
import pymysql
def show_version():
"""基础使用,查看mysql版本"""
# 创建一个连接
db = pymysql.connect(db_host, db_user, db_pw, db_name)
# 用cursor()创建一个游标对象
cursor = db.cursor()
# 使用execute()... |
# 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... |
"""
MP 1.12
>>> import uos
>>> dir(uos)
['__class__', '__name__', 'remove', 'VfsFat', 'VfsLfs2', 'chdir', 'dupterm', 'dupterm_notify',
'getcwd', 'ilistdir', 'listdir', 'mkdir', 'mount', 'rename', 'rmdir', 'stat', 'statvfs', 'umount',
'uname', 'urandom']
>>> import sys
>>> dir(sys)
['__class__', '__name__', 'argv', '... |
'''
Created by auto_sdk on 2015.06.23
'''
from aliyun.api.base import RestApi
class Rds20130528CreateBackupRequest(RestApi):
def __init__(self,domain='rds.aliyuncs.com',port=80):
RestApi.__init__(self,domain, port)
self.DBInstanceId = None
def getapiname(self):
return 'rds.aliyuncs.com.CreateBackup.2013-05-28'... |
import cv2, os, keras
import numpy as np
from keras.utils import np_utils
from keras.preprocessing.image import ImageDataGenerator
TRAINING_DIR = "./data/train"
train_datagen = ImageDataGenerator(rescale=1.0/255,
rotation_range=40,
width_shift_range... |
#
# ===============LICENSE_START=======================================================
# Acumos
# ===================================================================================
# Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
# =================================================================... |
# Copyright 2018-2021 Xanadu Quantum Technologies 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 applicabl... |
# Copyright 2020, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Python tests originally created or extracted from other peoples work. The
# parts were too small to be protected.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the ... |
# Hyperparams
EPOCHS = 10
BATCHSIZE = 64
LR = 0.01
MOMENTUM = 0.9
N_CLASSES = 10
GPU = True |
# Cloud-Init Datasource for VMware Guestinfo
#
# Copyright (c) 2018 VMware, Inc. All Rights Reserved.
#
# This product is licensed to you under the Apache 2.0 license (the "License").
# You may not use this product except in compliance with the Apache 2.0 License.
#
# This product may include a number of subcomponents ... |
"""
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES O... |
# 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 ... |
from typing import Dict
from flytekit import task, workflow
@task
def t1(x: Dict[str, int]) -> int:
return sum(x.values())
@workflow
def wf(x: Dict[str, int] = {"a": 1, "b": 2, "c": 3}) -> int:
return t1(x=x)
|
import requests
from bs4 import BeautifulSoup
import re
class WebScraper:
def __init__(self):
self.urls = []
def fetch_url(self, file):
'''
Creates a list of URLS to be scraped.
'''
f = open(file, 'r')
for line in f:
line = line.rstri... |
import numpy as np
import scipy as sp
import warnings
from tqdm.autonotebook import tqdm
from ._explainer import Explainer
from ..utils import safe_isinstance
from .. import maskers
from .. import links
class Linear(Explainer):
""" Computes SHAP values for a linear model, optionally accounting for inter-feature c... |
import logging
import os
import sys
import traceback
import uuid
from argparse import ArgumentParser, Namespace
from datetime import datetime
from typing import List
from common import directories, email, file_utils
from common.commands.base import (
CommandList,
add_arxiv_id_filter_args,
create_args,
... |
TARGET_TURN = 30000000
def play_memory_game(s: str) -> int:
d = [int(a) for a in s.split(",")]
m = [0] * TARGET_TURN
for t, n in enumerate(d, 1):
m[n] = t
n = 0
c = 0
for t in range(len(d) + 1, TARGET_TURN):
c = m[n]
if c:
m[n], n = t, t - c
else:
... |
from __future__ import print_function
import os
import torch
from torch.utils.ffi import create_extension
sources = ['src/roi_align.c']
headers = ['src/roi_align.h']
extra_objects = []
#sources = []
#headers = []
defines = []
with_cuda = False
this_file = os.path.dirname(os.path.realpath(__file__))
print(this_file)
... |
from pycocotools import mask
import torch
import random
import numpy as np
import cv2
import torchvision
from torchvision.models.detection.faster_rcnn import FastRCNNPredictor
from torchvision.models.detection.mask_rcnn import MaskRCNNPredictor
import transforms as T
from engine import train_one_epoch, evaluate
import ... |
'''This implements a virtual screen. This is used to support ANSI terminal
emulation. The screen representation and state is implemented in this class.
Most of the methods are inspired by ANSI screen control codes. The
:class:`~pexpect.ANSI.ANSI` class extends this class to add parsing of ANSI
escape codes.
PEXPECT LI... |
# Task 07. Perfect Number
def sum_of_divisors(num):
return sum([x for x in range(1, num) if num % x == 0])
def perfect_number(num):
if num == sum_of_divisors(num):
return "We have a perfect number!"
return "It's not so perfect."
number = int(input())
print(perfect_number(number))
|
import sys
sys.path.insert(1, "../../../")
import h2o
def binop_eq(ip,port):
# Connect to h2o
h2o.init(ip,port)
iris = h2o.import_frame(path=h2o.locate("smalldata/iris/iris_wheader.csv"))
rows, cols = iris.dim()
iris.show()
#frame/scaler
res = iris == 4.7
res_rows, res_cols = res.dim(... |
import pymel.core as pm
import mtoa.utils as utils
import mtoa.ui.ae.utils as aeUtils
from mtoa.ui.ae.shaderTemplate import ShaderAETemplate
class AErlSkinTemplate(ShaderAETemplate):
def setup(self):
# Add the shader swatch to the AE
self.addSwatch()
self.beginScrollLayout()
# Add... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-10-23 18:34
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cmz_seo', '0004_auto_20161023_1831'),
]
operations = [
migrations.AlterField... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: github.com/metaprov/modelaapi/services/featurehistogram/v1/featurehistogram.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from ... |
# Generated by Django 3.1.13 on 2021-10-30 04:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('notification', '0017_auto_20211030_0003'),
]
operations = [
migrations.AlterField(
model_name='notification',
name=... |
# coding=utf-8
"""
Copyright 2013 LinkedIn Corp. 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 l... |
from __future__ import annotations
import asyncio
import functools
import logging
from copy import copy
from typing import Any, cast, Callable, Optional, Union, Set, TypeVar
from typing_extensions import TypedDict, Literal, Final
from opentrons.config import feature_flags as ff
from opentrons.broker import Broker
from... |
from __future__ import unicode_literals
import os, re
import boto3
import boto.kms
from boto.exception import JSONResponseError
from boto.kms.exceptions import AlreadyExistsException, NotFoundException
import sure # noqa
from moto import mock_kms, mock_kms_deprecated
from nose.tools import assert_raises
from freezegun... |
import random
import pyperclip
import string
#Global Variable
global users_list
class User:
'''
Class to create user accounts and save their information
'''
#class variables
#global users_list
users_list = []
def _init_(self, first_name, last_name, password):
'''
Methods to ... |
#!/usr/bin/env python
r"""Browse raw data.
This uses :func:`mne.io.read_raw` so it supports the same formats
(without keyword arguments).
Examples
--------
.. code-block:: console
$ mne browse_raw sample_audvis_raw.fif \
--proj sample_audvis_ecg-proj.fif \
--eve sample_a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.