text stringlengths 1 927k |
|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""\
This script creates a stack array
"""
import diypy3
d = diypy3.Diypy3()
arr_stk = (1, 2, 3, 4, 5)
max_size = 100
inc = 10
d.array_stack(max_size, inc, arr_stk) |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: yandex/cloud/mdb/mysql/v1alpha/backup_service.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 messag... |
# This program melds together two Turing machines;
# that is, if the first machine ends up in an "OUT" state,
# this program outputs a TM where the out state of the first machine
# is the start state of the second
import sys
import tmsim
def alphabetMSToTS():
return ["a", "b"]
def convertStatesToString(listOfSt... |
def row_major(l: list) -> tuple[list, int]:
""" converts a 2d list to a 1d list using row major algorithm and returns a 1d list and row count """
out = []
i = 0
while i < len(l):
ii = 0
a = l[i]
while ii < len(a):
out.append(a[ii])
ii += 1
i += 1
... |
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
def default_conv(in_channels, out_channels, kernel_size, bias=True):
return nn.Conv2d(
in_channels, out_channels, kernel_size,
padding=(kernel_size//2), bias=bias)
class MeanShift(n... |
import os
from os.path import dirname as _dir
import logging
def get_logger(name):
return logging.getLogger('conftest.%s' % name)
def pytest_sessionstart(session):
BASE_FORMAT = "[%(name)s][%(levelname)-6s] %(message)s"
FILE_FORMAT = "[%(asctime)s]" + BASE_FORMAT
root_logger = logging.getLogger('con... |
def frequency(lst, search_term):
"""Return frequency of term in lst.
>>> frequency([1, 4, 3, 4, 4], 4)
3
>>> frequency([1, 4, 3], 7)
0
"""
return lst.count(search_term)
print(F"frequency.py: frequency([1, 4, 3, 4, 4], 4) = `3` = {frequency([1, 4, 3, 4, 4], 4)}")
print(F"freq... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Nov 29 10:29:06 2020
@author: fa19
""" |
import sqlalchemy as sql
from sqlalchemy.orm import relationship, backref
from app import db
from const.admin import AdminOperation
from const.db import (
name_length,
now,
description_length,
# mediumtext_length,
# text_length
)
from lib.sqlalchemy import CRUDMixin
Base = db.Base
class Announc... |
# selectionsort() method
def selectionSort(arr):
arraySize = len(arr)
for i in range(arraySize):
min = i
for j in range(i+1, arraySize):
if arr[j] < arr[min]:
min = j
#swap values
arr[i], arr[min] = arr[min], arr[i]
# method to print an array
def printList(arr):
for i in rang... |
#
#
# main() will be run when you invoke this action
#
# @param Cloud Functions actions accept a single parameter, which must be a JSON object.
#
# @return The output of this action, which must be a JSON object.
#
#
from cloudant.client import Cloudant
from cloudant.error import CloudantException
from cloudant.query im... |
##############################################################################
#
# Copyright (c) 2006 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS I... |
import warnings
from unittest.mock import patch
import numpy as np
import pandas as pd
import pytest
import ray
from ray.ml.preprocessor import PreprocessorNotFittedException
from ray.ml.preprocessors import (
BatchMapper,
StandardScaler,
MinMaxScaler,
OrdinalEncoder,
OneHotEncoder,
LabelEncod... |
import asyncio
import os
from datetime import datetime
from pathlib import Path
from telethon.tl.types import InputMessagesFilterDocument
from astro.config import Config
from astro import CMD_HELP
from astro.utils import admin_cmd, load_module, remove_plugin
NAME = Config.NAME
DELETE_TIMEOUT = 5
thumb_image_path = "... |
from threading import Timer
class DeskTimer(object):
current_timer = None
def start(self, time, callback, *args):
self.current_timer = Timer(time, callback, args)
self.current_timer.start()
def stop(self):
if self.current_timer != None:
self.current_timer.cancel() |
# Copyright 2015 PerfKitBenchmarker 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 appli... |
import re
import paramiko
class Handler:
'''
A slash command for checking ssh connectivity and rebooting machines.
'''
id = 2
def __init__(self, regexp):
'''
Takes a regexp as an argument, the regexp will then be used to check if the format of the hostname is correct
'''
... |
from collections import defaultdict
from sortedcontainers import SortedDict
import math
import pandas as pd
import numpy as np
from pyqstrat.pq_types import ContractGroup, Trade, Contract
from types import SimpleNamespace
from typing import Sequence, Any, Tuple, Callable, Union, MutableSet, MutableSequence, MutableMapp... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Setup file for openrisknet_magkoufopoulou.
This file was generated with PyScaffold 3.0.3.
PyScaffold helps you to put up the scaffold of your new Python project.
Learn more under: http://pyscaffold.org/
"""
import sys
from setuptools import setup
# Ad... |
test = {
'name': 'q9',
'points': 1,
'suites': [
{
'cases': [
{
'code': r"""
>>> survey == "2020 vision"
True
""",
'hidden': False,
'locked': False
}
],
'scored': True,
'setup': '',
'teardown': '',
'... |
# -*- coding: utf-8 -*-
"""
During exploit development, it is frequently useful to debug the
target binary under GDB.
Pwntools makes this easy-to-do with a handful of helper routines, designed
to make your exploit-debug-update cycles much faster.
Useful Functions
----------------
- :func:`attach` - Attach to an exis... |
import random
def test_clear_projects_helper(app):
while app.project.count()>0:
app.project.navigate_to_manage_projects_page()
old_projects = app.project.get_project_list()
project = random.choice(old_projects)
app.project.delete_by_name(project.name) |
# Copyright 2013 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 applica... |
from dl.data.objdetn import datasets, utils, target_transforms
from dl.data import transforms
from dl.models.ssd.ssd300 import SSD300
from dl.data.utils.converter import toVisualizeRectLabelRGBimg
from torch.utils.data import DataLoader
import cv2
if __name__ == '__main__':
augmentation = None
transform = tr... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: David Stevens
import sys
import time
import json
import logging
logging.basicConfig(level=logging.INFO)
sys.path.append('../')
from obswebsocket import obsws, requests # noqa: E402
stdinput = sys.stdin.readline()
data = json.loads(stdinput)
try:
host =... |
# Copyright (c) 2016 Intel, 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 ... |
# Copyright (c) 2021, Serum Studio
# 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, merg... |
# -*- coding: windows-1252 -*-
__VERSION__ = '0.7.4'
import sys
if sys.version_info[:2] < (2, 3):
print >> sys.stderr, "Sorry, xlwt requires Python 2.3 or later"
sys.exit(1)
from Workbook import Workbook
from Worksheet import Worksheet
from Row import Row
from Column import Column
from Formatting import Font... |
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 23 16:06:35 2018
@author: libo
"""
from PIL import Image
import os
def image_resize(image_path, new_path): # 统一图片尺寸
print('============>>修改图片尺寸')
for img_name in os.listdir(image_path):
img_path = image_path + "/" + img_name # 获取该图片全称
image = Im... |
import json
from app import db
from app.models import *
from utils import utils
# turn annotation labels by hit X into a quiz Job
def annotation_to_quiz(hit_id, alt_hit_id, quiz_label):
'''
hit_id and alt_hit_id should be for the same task. hit_id has the strictly correct answers and alt_hit_id has possibly co... |
#!/usr/bin/env python
# Copyright (c) The Shogun Machine Learning Toolbox
# Written (w) 2014 Daniel Pyrathon
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source... |
import pygame as pg
import pygame_widgets as pw
from math import sin, cos
SCREEN_WIDTH = 640
SCREEN_HEIGHT = 480
WHITE = (255,255,255)
YELLOW = (220,220,0)
RED = (220,0,0)
GREY = (180,180,180)
BLACK = (0,0,0)
GREEN = (0,200,0)
BUTTON_COLOR = (0,0,220)
BUTTON_HOVER_COLOR = GREEN
BUTTON_PRESS_COLOR = (0,100,0)
def cr... |
# Generated by Django 2.2.6 on 2019-10-17 10:38
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Merchant',
fields=[
('id', models.AutoField... |
#!/usr/bin/env python3
import sys
import subprocess
import functools
from enum import Enum
import gi
gi.require_version('Notify', '0.7')
from gi.repository import Notify
from PyQt5.QtWidgets import QApplication, QMainWindow, QWidget, QSystemTrayIcon, QMenu, QAction, qApp, QMessageBox
from PyQt5.QtCore import QSize, QT... |
import os
from functools import wraps, partial
from time import time
from statistics import mean
from pathlib import Path
from pygraphblas import *
from multiprocessing.pool import ThreadPool
from multiprocessing import cpu_count
NFEATURES = 60000
BIAS = {1024: -0.3, 4096: -0.35, 16384: -0.4, 65536: -0.45}
def timing... |
from flask import Flask,jsonify,request
import os
from subprocess import PIPE,Popen
app = Flask(__name__)
@app.route("/",methods=["GET"])
def home():
return "Working"
@app.route("/sendcode",methods=["POST"])
def sendCode():
print(request.json)
owd = os.getcwd() # chdir into this once done executing.
u... |
#
# This software is licensed under the Apache 2 license, quoted below.
#
# Copyright 2019 Astraea, 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/LI... |
"""test_scrubber.py."""
# Import a minimal text loader class, the functions for scrubber pipelines,
# and the scrubber function registry
from lexos.io.basic import Loader
from lexos.scrubber.pipeline import make_pipeline
from lexos.scrubber.registry import scrubber_components
from lexos.scrubber.scrubber import Scrubb... |
"""
swagger module -
A package defining the swagger features. This module creates the swagger
structure and defines the data to show when the swagger is activated.
It does not contain the html and css files used to create the page,
only the underlying structure. The html and css can be found at the sta... |
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from openvino.tools.mo.ops.grn import GRNOp
from openvino.tools.mo.front.caffe.collect_attributes import merge_attrs
from openvino.tools.mo.front.extractor import FrontExtractorOp
class GRNFrontExtractor(FrontExtractorOp):
op = 'GR... |
import numpy as np
import matplotlib.pyplot as plt
def func(x):
return 1 / (1 + np.exp(-x))
# Return evenly spaced numbers over a specified interval.
xdata = np.linspace(-8, 8, 960,endpoint=True)
ydata = func(xdata)
plt.plot(xdata,ydata)
plt.show() |
import requests
import sys
import h5py
import numpy as np
import os
def get(path, params=None, savedir=None):
# make HTTP GET request to path
headers = {"api-key":"27d44ba55cd115b10f2dd9153589aff0"}
r = requests.get(path, params=params, headers=headers)
# raise exception if response code is not HTTP S... |
#!/usr/bin/env python
# ------------------------------------------------------------------------------
# Copyright (c) 2011-2012, Ryan Galloway (ryan@rsgalloway.com)
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# ... |
#!/usr/bin/python
from Subfact_ina219 import INA219
import time
import os
import glob
import Tkinter as tk
import math
import copy
from OneFifo import OneFifo
import json
import socket
import select
from SolarMonitor import SolarMonitor
from SolarSensors import SolarSensors
from SolarServer import SolarServer
from So... |
predictors = [
{
"description": "todo",
"long_name": "Normalised Difference Vegetation index",
"short_name": "NDVI",
"type": "Index",
"ee_import": 'LANDSAT/LC8_SR',
"checked": True,
"vis": True,
"ramp": '000000, 00FF00'
},
{
"descriptio... |
from optimize import logger, get_ttree, selection_to_branches, tree_get_branches, cuts_to_selection
import json
import root_numpy as rnp
import glob
import itertools
import numexpr as ne
import numpy as np
import os
from collections import defaultdict
skipRegions = ["old", "SR", "VR0"]
regions = sorted([region for re... |
#!/usr/bin/python
# Classification (U)
"""Program: server_connect.py
Description: Unit testing of Server.connect in mongo_class.py.
Usage:
test/unit/mongo_class/server_connect.py
Arguments:
"""
# Libraries and Global Variables
# Standard
import sys
import os
if sys.version_info < (2, 7):
... |
# 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... |
#
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
#
from enum import Enum
from mlos.Spaces import SimpleHypergrid, ContinuousDimension, DiscreteDimension, CategoricalDimension, Point
from mlos.Spaces.Configs.DefaultConfigMeta import DefaultConfigMeta
class SklearnRidgeRegressionModelConfig(m... |
# Copyright 2019 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
#! /usr/bin/env python
from __future__ import division, print_function
import argparse
import collections
import logging
import os
import random
import threading
import numpy as np
import pandas as pd
from itertools import cycle, islice
import keras
from keras import backend as K
from keras import optimizers
from ... |
# Disactivate safety reflexes
# First, go to http://pepper.local/advanced/#/settings to enable the disactivation
import qi
import sys
# Connect to Naoqi session
session = qi.Session()
try:
session.connect("tcp://127.0.0.1:9559")
except RuntimeError:
print ("Can't connect to Naoqi at ip \"" + args.ip + "\" on ... |
# 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... |
import os
import pandas as pd
from pathlib import Path
import numpy as np
from mt import RAW_PATH
from mt import utils
SUFFLE = True
CONSTRAINED = True
TR_DATA_PATH = "/home/salva/Documents/Programming/Datasets/scielo/originals/scielo-gma/scielo-gma"
TR_RAW_FILES = ["es-en-gma-biological.csv", "es-en-gma-health.csv"... |
"""
Contains cache implementations which can be used by the modules, for example
to cache results acquired from various online APIs.
"""
import datetime
import hashlib
def get_md5(string):
"""Returns a hash of a string."""
m = hashlib.md5()
m.update(string.encode('utf-8'))
return m.hexdigest(... |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters, InlineQueryHandler
import telegram as tg
import requests
import json
import os
import io
import time
import logging
from datetime import timedelta
import translate
import random
import praw
RED... |
# Copyright (c) 2014, Matt Layman
import gettext
import os
localedir = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'locale')
translate = gettext.translation('handroll', localedir, fallback=True)
_ = translate.gettext |
# Copyright 2016 Red Hat, 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 agre... |
# Lint as: python3
# Copyright 2018, The TensorFlow Federated 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 ... |
import pytest
from decimal import Decimal
from baserow.contrib.database.fields.handler import FieldHandler
from baserow.contrib.database.fields.registries import field_type_registry
@pytest.mark.django_db
@pytest.mark.parametrize(
"expected,field_kwargs",
[
(
[
9223372036... |
from netapp.netapp_object import NetAppObject
class IscsiReceivedStatsInfo(NetAppObject):
"""
Counts for PDUs received.
"""
_data_out = None
@property
def data_out(self):
"""
Count of data out requests.
"""
return self._data_out
@data_out.setter
def ... |
import os
from distutils.dir_util import copy_tree
import warnings
import IPython
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy as sp
import torch
from context import utils
import utils.filesystem as fs
import utils.plotting as plot
from utils.data_analysis impo... |
#! /usr/bin/env python
# encoding: utf-8
import sys
sys.path.append('..')
sys.path.append('mock')
import unittest
from mock import Mock
import simulator.relay
class TestPacket(unittest.TestCase):
"""Class for testing Relay."""
def test_instantiation(self):
"""Test instantiation."""
id = "te... |
from pytest_bdd import scenarios, when, then, parsers
import ui_automation_tests.shared.tools.helpers as utils
from ui_automation_tests.pages.generic_application.task_list import TaskListPage
from ui_automation_tests.pages.open_application.country_contract_types import OpenApplicationCountryContractTypes
from ui_autom... |
"""
A simple redis-cache interface for storing python objects.
"""
from functools import wraps
import pickle
import json
import hashlib
import redis
import logging
from redis._compat import basestring, unicode
DEFAULT_EXPIRY = 60 * 60 * 24
class RedisConnect(object):
"""
A simple object to store and pass da... |
from setuptools import setup, find_packages
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name='spektral',
version='0.6.0',
packages=find_packages(),
install_requires=['tensorflow>=2.1.0',
'networkx',
'pandas',
... |
# Simple Cipher Text Generator
# Rohan Roy - 2nd Nov 2013
import simplegui
import random
# Global Variables
CIPHER = {}
LETTER = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ1234567890!@#$%&" "'
message = ""
# Helper Function
def init():
letter_list = list(LETTER)
random.shuffle(letter_list)
for c... |
# Copyright 2016 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the 'license' file accompa... |
from encapsulation_exercise.restaurant.project.beverage.beverage import Beverage
class ColdBeverage(Beverage):
def __init__(self, name: str, price: float, milliliters: float):
super().__init__(name, price, milliliters) |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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 modif... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Phil Schwartz <schwartzmx@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the ... |
from .inference import inference_recognizer, init_recognizer
from .test import multi_gpu_test, single_gpu_test
from .train import train_model
__all__ = [
'train_model', 'init_recognizer', 'inference_recognizer', 'multi_gpu_test',
'single_gpu_test'
] |
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. 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 the Software without restriction, including without limitation
# the rights to... |
import _plotly_utils.basevalidators
class TitlefontValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(
self,
plotly_name='titlefont',
parent_name='streamtube.colorbar',
**kwargs
):
super(TitlefontValidator, self).__init__(
plotly_name=p... |
"""
Pulls data from:
https://www.divvybikes.com/system-data
https://s3.amazonaws.com/divvy-data/tripdata
"""
from io import BytesIO
import os
import re
import requests
from zipfile import ZipFile
from typing import List
from lxml import html
import pandas as pd
from .stations_feed import StationsFeed
STN_DT_FORM = ... |
from django.shortcuts import render, redirect
from django.template import loader
from django.urls import reverse_lazy
from .models import *
from django.http import HttpResponse
from .forms import TicketForm
from django.views.generic import ListView, CreateView, UpdateView, DeleteView
from django.core.paginator import E... |
from datetime import timedelta
from epsilon.extime import Time
from nevow.page import renderer
from nevow.loaders import stan
from nevow.tags import div
from nevow.athena import LiveElement
from xmantissa.liveform import TEXT_INPUT, LiveForm, Parameter
class CalendarElement(LiveElement):
docFactory = stan(div... |
weight=1
a=_State('a', name='var1', shared=True)
def run():
@_do
def _():
print(a.val)
sleep(10)
a.val = 5
@_do
def _():
print(a.val)
sleep(10)
a.val = 8
@_do
def _():
print(a.val) |
from nose.tools import raises
from csympy import Symbol, Integer, Add, Pow
def test_arit1():
x = Symbol("x")
y = Symbol("y")
e = x + y
e = x * y
e = Integer(2)*x
e = 2*x
e = x + 1
e = 1 + x
def test_arit2():
x = Symbol("x")
y = Symbol("y")
assert x+x == Integer(2) * x
... |
from pathlib import Path
from datetime import datetime
import shutil
import subprocess
import yaml
import requests
class SCMCredentialValidationError(Exception):
pass
class SCMCloneRepoError(Exception):
pass
class SCMCreateBranchError(Exception):
pass
class SCMWriteFileError(Exception):
pass
c... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2020-03-14 03:57
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('films', '0002_film'),
]
operations = [
migrations.AddField(
mo... |
from unittest import TestCase
from django.core.management import call_command
class SendAiPicsStatsTestCase(TestCase):
def test_run_command(self):
call_command('send_ai_pics_stats') |
'''
Created on Nov 16, 2021
@author: mballance
'''
from mkdv.runners.runner import Runner
class RunnerPython(Runner):
def __init__(self): |
# 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 use ... |
"""Define graph partition book."""
import pickle
from abc import ABC
import numpy as np
from .. import backend as F
from ..base import NID, EID
from .. import utils
from .shared_mem_utils import _to_shared_mem, _get_ndata_path, _get_edata_path, DTYPE_DICT
from .._ffi.ndarray import empty_shared_mem
from ..ndarray imp... |
# 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, software
# distributed under t... |
import torch
from typing import Tuple
from torch import Tensor
import torchvision
def nms(boxes, scores, iou_threshold):
# type: (Tensor, Tensor, float) -> Tensor
"""
Performs non-maximum suppression (NMS) on the boxes according
to their intersection-over-union (IoU).
NMS iteratively removes lowe... |
import AppKit
import objc
from PyObjCTools.TestSupport import TestCase, min_os_level
class TestNSGraphics(TestCase):
def testConstants(self):
self.assertEqual(AppKit.NSCompositeClear, 0)
self.assertEqual(AppKit.NSCompositeCopy, 1)
self.assertEqual(AppKit.NSCompositeSourceOver, 2)
s... |
# -*- coding: utf-8 -*-
"""TF2.0 Mirrored Strategy.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1e7_N_vVQGyfa3Wz9ND0smWnnsHsQUs_k
"""
# Commented out IPython magic to ensure Python compatibility.
from tensorflow.keras.models import Model
from ... |
from collections import defaultdict, Counter
from datetime import datetime, timedelta
import threading
import itertools
import random
import time
import math
import re
from src.containers import UserDict, UserSet
from src.decorators import COMMANDS, command, event_listener, handle_error
from src.functions import get_... |
import tempfile
import json
import os
import logging
from six import itervalues, iterlists
import connexion
from werkzeug.utils import secure_filename
def visit(d, op):
"""Recursively call op(d) for all list subelements and dictionary 'values' that d may have."""
op(d)
if isinstance(d, list):
for... |
import json
import os
import time
import traceback
import warnings
import numpy as np
import pynisher
from smac.facade.smac_facade import SMAC
from smac.optimizer.objective import average_cost
from smac.runhistory.runhistory import RunHistory
from smac.runhistory.runhistory2epm import RunHistory2EPM4Cost
from smac.sc... |
# (C) Datadog, Inc. 2021-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from datadog_checks.base.utils.models.fields import get_default_field_value
def shared_proxy(field, value):
return get_default_field_value(field, value)
def shared_service(field, value):
return... |
# lookup.py
# Copyright (C) 2006, 2007, 2008 Michael Bayer mike_mp@zzzcomputing.com
#
# This module is part of Mako and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
import os, stat, posixpath, re
from mako import exceptions, util
from mako.template import Template
try:
i... |
# Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, 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 ... |
import datetime as _datetime
import logging as _logging
import uuid as _uuid
import six as _six
from deprecated import deprecated as _deprecated
from flytekit.common import interface as _interface
from flytekit.common import nodes as _nodes
from flytekit.common import promise as _promises
from flytekit.common import ... |
from common.caching import read_input_dir, cached, read_log_dir
from common.dataio import get_aps_data_hdf5, get_passenger_clusters, get_data
from . import dataio
from collections import defaultdict
import numpy as np
import skimage.transform
import skimage.io
import skimage.color
import glob
import os
import tqdm
im... |
# Generated by Django 2.1.1 on 2018-09-26 09:08
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('AboutModel', '0005_auto_20180926_1639'),
]
operations = [
migrations.AddField(
model_name='person',
name='upload',
... |
from display.handlers.base import BaseHandler
class CalendarHandler(BaseHandler):
def get(self):
title = 'CalendarHandler'
self.render('calendar/calendar.html', title = title, **self.render_dict) |
archivo = open('paises.txt', 'r')
lista = []
ciudad = []
for i in archivo:
a = i.index(":")
for r in range(a+2, len(i)):
lista.append(i[r])
a = "".join(lista)
ciudad.append(a)
lista = []
for i in ciudad:
if(i[0] == "M"):
print(i)
lista.append(i)
print(len(lista))
archivo.close() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.