text stringlengths 2 999k |
|---|
# -* coding: utf-8 -*-
"""
celery.backends.cassandra
~~~~~~~~~~~~~~~~~~~~~~~~~
Apache Cassandra result store backend.
"""
from __future__ import absolute_import
try: # pragma: no cover
import pycassa
from thrift import Thrift
C = pycassa.cassandra.ttypes
except ImportError: # pragma: no cov... |
#!/usr/bin/env python3
# %%
# ---------------------- packages
# // RELOAD MODULE OPTION WHEN NEEDED
# importlib.reload(sys.modules['transformers'])
# %%
# General packages
import numpy as np
import pandas as pd
import pickle # save API responses to variables
import math
import json
import os
import fnmatch
from ite... |
from typing import List, Optional, Tuple, TYPE_CHECKING
from abc import ABC, abstractmethod
from random import randrange
import pyinputplus as pyinput
from forked_inquirer.forked_inquirer import inquirer, InquirerList, BlueTheme
from .helpers import convert_hand
from .utils import unicode_block
from .components impor... |
#!/usr/bin/env python3
#
# Generates an HTML file for previewing all styles defined in a CSS file
#
# dependencies: cssutils
# USAGE:
# css_preview_generator.py style.css -o preview.html
import html
import io
import sys
import cssutils
image_placeholder = "data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import os
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
import math
import sys
import unittest
from unittest import TestCase, main
from nni.algorithms.compression.pytorch.pruning import LevelPruner, Sl... |
# SPDX-License-Identifier: MIT
# Copyright (c) 2019 Intel Corporation
"""
Description of what this model does
"""
import os
import abc
import json
import hashlib
from typing import AsyncIterator, Tuple, Any, List, Optional, NamedTuple, Dict
import numpy as np
from dffml.repo import Repo
from dffml.source.source impor... |
# (C) Datadog, Inc. 2021-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from contextlib import contextmanager
from copy import deepcopy
from datadog_checks.avi_vantage import metrics
from datadog_checks.base import AgentCheck, OpenMetricsBaseCheckV2
from datadog_checks.base.e... |
import enum
import numpy as np
import random
import matplotlib.pyplot as plt
# 1. Create and algorithm for random walk with equal probability of length 100
# 2. Run your RW algorithm 10x and calculate the statistical features:
# time average, ensemble average, variance and standard deviation.
# Plot a histogram... |
import _plotly_utils.basevalidators
class ShowtickprefixValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self,
plotly_name="showtickprefix",
parent_name="scatterpolar.marker.colorbar",
**kwargs
):
super(ShowtickprefixValidator, self).__init__(
... |
"""Documentación del módulo.
Esta aplicacion es un desarrollo de escritorio para simular a partir de la data entregada
paramentros criticos en los superconductores """
__author__ = "Cristian Leonardo Cárdenas Garcia"
__copyright__ = "Copyright 2020"
__credits__ = ["Grupo de Investigación Telematics", "Cristian Leonard... |
# -*- codeing: utf-8 -*-
class Converter(object):
def __init__(self):
self.factors = {9: "IX", 5: "V", 4: "IV", 1: "I"}
def convert(self, n):
if n < 1:
return ""
key = sorted(list(filter(lambda e: e <= n, self.factors)))[-1]
roman = self.factors.get(key)
re... |
# Copyright (c) 2012 CNRS
# Author: Florent Lamiraux
#
# This file is part of hpp-corbaserver.
# hpp-corbaserver is free software: you can redistribute it
# and/or modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation, either version
# 3 of the License, or (at... |
"""The MPC Linear Layer."""
# stdlib
from collections import OrderedDict
from typing import Any
from typing import Dict
from typing import Optional
from typing import Tuple
# third party
import torch
from sympc.tensor import MPCTensor
from sympc.utils import ispointer
from .smpc_module import SMPCModule
class Lin... |
import tkinter as tk
from tkinter.filedialog import askopenfilename, asksaveasfilename
def open_file(window, txt_edit, event=False):
"""Open a file for editing."""
filepath = askopenfilename(
filetypes=[("Text Files", "*.txt"), ("All Files", "*.*")]
)
if not filepath:
return
txt_edit.delete(1.0,... |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, VHRS and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class KRA_CurrentYear(Document):
pass
|
from TestedTrek.Game.RandomWrapper import Random
class MockRandom(Random):
def next(self, maxValue):
# always return 1/2 max: It isn't random, and that's the point!
return maxValue / 2
|
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# The MIT License
#
# Copyright (c) 2009-2010 Felix Schwarz <felix.schwarz@oss.schwarz.eu>
#
# 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 ... |
"""mathathon URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-b... |
# Model validation metrics
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
import torch
from . import general
def fitness(x):
# Model fitness as a weighted combination of metrics
w = [0.0, 0.0, 0.1, 0.9] # weights for [P, R, mAP@0.5, mAP@0.5:0.95]
return (x[:, :4] * w).sum(... |
class carritoCompra:
fechaCreacion=None
listaLineaProducto=None
def __init__(self,fcx,lx=[]):
self.__fechaCreacion=fcx
self.listaLineaProducto=lx
def getFecha(self):
return self.fechaCreacion
def getListaLineas(self):
return self.listaLineaProducto
def addLi... |
# coding: utf-8
# AUTOGENERATED BY gen_script.sh from kpony4.py
# Copyright (C) Nyimbi Odero, Sun May 21 13:44:04 EAT 2017
from sqlalchemy import func
from flask_appbuilder import Model
from flask_appbuilder.models.mixins import AuditMixin, FileColumn, ImageColumn, UserExtensionMixin
from flask_appbuilder.models.dec... |
# AUTO GENERATED FILE - DO NOT EDIT
from dash.development.base_component import Component, _explicitize_args
class Multicol(Component):
"""A Multicol component.
Keyword arguments:
- children (a list of or a singular dash component, string or number; optional): The children of this component
- id (string; optio... |
# Peak GPU memory usage is around 1.57 G
# | RevGNN Models | Test Acc | Val Acc |
# |-------------------------|-----------------|-----------------|
# | 112 layers 160 channels | 0.8307 ± 0.0030 | 0.9290 ± 0.0007 |
# | 7 layers 160 channels | 0.8276 ± 0.0027 | 0.9272 ± 0.0006 |
import os.path... |
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
KEY_SIZE = getattr(settings, 'OAUTH_PROVIDER_KEY_SIZE', 32)
# LRS CHANGE - CHANGED SIZE OF SECRET FOR RSA PUBLIC KEY
RSA_SECRET_SIZE = getattr(settings, 'OAUTH_PROVIDER_RSA_SECRET_SIZE', 2048)
REGULAR_SECRET_SIZE = getattr(setting... |
# python
import sys
# torch
import torch
from torch import nn
# ours
from data import MonoTextData
from modules import VAE
from modules import LSTMEncoder, LSTMDecoder
############################################
# INITIALIZERS #
############################################
class uniform... |
# Copyright The PyTorch Lightning team.
#
# 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 i... |
# -*- coding: UTF-8
import elasticsearch
import datetime
import time
from elasticsearch import helpers
ES_HOST = 'sgk:9200'
es = elasticsearch.Elasticsearch([ES_HOST])
def time_me(fn):
'''
函数耗时修饰器
'''
def _wrapper(*args, **kwargs):
start = time.clock()
ret = fn(*args, **kwargs)
... |
# THIS FILE SHOULD STAY IN SYNC WITH /kafka-monitor/settings.py
import os
def str2bool(v):
return str(v).lower() in ('true', '1') if type(v) == str else bool(v)
# Redis host information
REDIS_HOST = os.getenv('REDIS_HOST', 'redis')
REDIS_PORT = int(os.getenv('REDIS_PORT', 6379))
REDIS_DB = int(os.getenv('REDIS_DB... |
import numpy as np
from scipy.optimize import leastsq, fmin, fmin_l_bfgs_b
# bounding code inspired by http://newville.github.com/lmfit-py/bounds.html
# which was inspired by leastsqbound, which was inspired by MINUIT
def _to_bound_p(params, bounds):
new_v = {}
for p in params:
if p not in bounds:
... |
# Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.utils import TORCH_VERSION, build_from_cfg, digit_version
from .registry import ACTIVATION_LAYERS
for module in [
nn.ReLU, nn.LeakyReLU, nn.PReLU, nn.RReLU, nn.ReLU6, nn.ELU,
nn... |
import os
import sys
import unittest
from tempfile import mkdtemp
from unittest import mock
from qrcode.console_scripts import main
def bad_read():
raise UnicodeDecodeError('utf-8', b'0x80', 0, 1, 'invalid start byte')
class ScriptTest(unittest.TestCase):
def setUp(self):
self.tmpdir = mkdtemp()
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# This program 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 License, or
# (at your option) any later version.
#
# This progra... |
# Side Scroller 2
from backgrounds import Hill, Cloud
from sprites import Alien, Obstacle
FPS = 60
clouds = []
bighills = []
smallhills = []
sprites = []
obstacles = []
def setup():
size(800, 450)
this.surface.setTitle("Side Scroller 2: Jump, Ally, jump!")
clouds.append(Cloud(400, -1))
for i in range... |
from ..base.base_connector import BaseConnector
from .async_dummy_ping import AsyncDummyPing
from .async_dummy_query_connector import AsyncDummyQueryConnector
from .async_dummy_status_connector import AsyncDummyStatusConnector
from .async_dummy_results_connector import AsyncDummyResultsConnector
class Connector(BaseC... |
from django import forms
from .models import ForumReply, ForumThread
class PostForm(object):
def __init__(self, *args, **kwargs):
no_subscribe = kwargs.pop("no_subscribe", False)
super(PostForm, self).__init__(*args, **kwargs)
if no_subscribe:
del self.fields["subscribe"]
c... |
import os
import json
import shutil
import logging
import codecs
# Internal dependencies
from datatypes.binary.Bam import Bam
from datatypes.binary.BigWig import BigWig
from datatypes.interval.Bed import Bed
from datatypes.interval.BedSimpleRepeats import BedSimpleRepeats
from datatypes.interval.BedSpliceJunctions im... |
import boto3
from errors import InvalidImageExtensionException, InvalidImageUriException
from typing import Mapping
from urllib.parse import urlparse
from boto3.dynamodb.conditions import BeginsWith, Key
from boto3.dynamodb.conditions import Key, Attr
#from aws_xray_sdk.core import xray_recorder
class FaceTa... |
from csv import DictReader, DictWriter
from typing import Any, Dict, Iterable, Iterator, Sequence, Text, Tuple
# Alignments with e-values greater than 1 are low-quality alignments and associated with
# a high rate of false-positives. These should be filtered at all alignment steps.
MAX_EVALUE_THRESHOLD = 1
class _Ty... |
# All rights reserved by forest fairy.
# You cannot modify or share anything without sacrifice.
# If you don't agree, keep calm and don't look at code bellow!
__author__ = "VirtualV <https://github.com/virtualvfix>"
__date__ = "03/22/18 15:33"
import re
import os
import platform
from config import CONFIG
def get_sc... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
fromfunction.py
---------------------
Date : May 2018
Copyright : (C) 2018 by Denis Rouzaud
Email : denis@opengis.ch
************************************... |
from pytorch_pfn_extras.dataset.tabular import _asmode # NOQA
from pytorch_pfn_extras.dataset.tabular import _concat # NOQA
from pytorch_pfn_extras.dataset.tabular import _join # NOQA
from pytorch_pfn_extras.dataset.tabular import _slice # NOQA
from pytorch_pfn_extras.dataset.tabular import _transform # NOQA
from ... |
# coding: utf-8
"""
Intersight REST API
This is Intersight REST API
OpenAPI spec version: 1.0.9-255
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class NetworkElementList(object):
"""
NOTE: This cl... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2019-07-17 08:31
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('osf', '0168_merge_20190610_2308'),
('osf', '0139_merge_20190517_0633'),
]
operatio... |
# Do BFS. When you reach a null node, check if the Q is empty. If yes: return True else return False
class Solution:
def isCompleteTree(self, root: TreeNode) -> bool:
Q = [root]
while Q:
node = Q.pop()
if not node:
if any(Q):
retu... |
import itertools
import numpy as np
import os
import time
from contextlib import contextmanager
from numpy.testing import assert_equal
from pyoperators import Operator
from pyoperators.utils import (
broadcast_shapes, cast, complex_dtype, first, first_is_not, float_dtype,
ifirst, ifirst_is_not, ilast, ilast_is... |
import time
from torch_geometric.data import DataLoader
from cgl.utils.params import ParamDict
from cgl.models.gnn import DeepGENNet
from rdiv.data import RLadderDataset
s = time.time()
print('Loading the dataset ...')
dset = RLadderDataset(root='rdiv', train_fname='rser_train.pt', test_fname='rser_test.pt')
print(... |
"""
MIT License
Copyright (c) 2021 TheHamkerCat
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 witout limitation the rights
to use, copy, modify, merge, publish, d... |
from jsonrpc import ServiceProxy
import sys
import string
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:9332")
else:
access = Ser... |
"""
tkinter HTML text widgets
"""
import sys
import tk_html_widgets as tk_html
from ..Events import Bindings
from ..Widgets.Widgets import ScrolledText, ViewState, tkEvent
__all__ = [
'HTMLScrolledText', 'HTMLText', 'HTMLLabel'
]
class HTMLScrolledText(ScrolledText):
_bindIDs = set()
__d... |
# Encoding the entire DEC VT10x state machine in gateware is possible, but our FPGA isn't very
# large and is not fast at all. So, instead of doing that, we define a boneless CPU architecture
# and use that to control the terminal.
#
# Architecture description:
# * Four explicit 16-bit registers, A, B, C, and P.
# ... |
from flask import Blueprint, request
from anubis.models import db, LectureNotes
from anubis.utils.data import req_assert
from anubis.utils.auth import require_admin
from anubis.utils.http.decorators import json_response, json_endpoint
from anubis.utils.http.files import process_file_upload, get_mime_type
from anubis.u... |
from typing import List, Optional, Union
from ._common_types import ExtractionOpportunity
from veniq.ast_framework.block_statement_graph import Block, Statement
def syntactic_filter(statements: ExtractionOpportunity, method_block_statement_graph: Statement) -> bool:
syntactic_filter_callbacks = _SyntacticFilterC... |
# 给定一个字符串,验证它是否是回文串,只考虑字母和数字字符,可以忽略字母的大小写。
# 说明:本题中,我们将空字符串定义为有效的回文串。
class Solution:
def isPalindrome(self, s: str) -> bool:
lis = [x for x in s.strip().lower() if (ord(x) >= 97 and ord(x) <= 122) or (ord(x) >= 48 and ord(x) <= 57)]
return lis == lis[::-1]
b = Solution().isPalindrome("A man, a p... |
def get_length(generator):
if hasattr(generator,"__len__"):
return len(generator)
else:
return sum(1 for _ in generator)
def get_tag_index(tag):
tasks = ['liver','spleen','pancreas','rightkidney','leftkidney']
return tasks.index(tag)+1 |
# coding=utf-8
# Copyright (c) 2021, EleutherAI contributors
# This file is based on code by the authors denoted below and has been modified from its original version.
#
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use ... |
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible import constants as C
from ansible.plugins.action import ActionBase
from ansible.util... |
"""HA Cli docker object."""
import logging
from typing import List
from ..const import ENV_TIME
from ..coresys import CoreSysAttributes
from .const import Capabilities
from .interface import DockerInterface
_LOGGER: logging.Logger = logging.getLogger(__name__)
MULTICAST_DOCKER_NAME: str = "hassio_multicast"
class ... |
"""
Adapted from
https://github.com/Jackson-Kang/Pytorch-VAE-tutorial/blob/master/01_Variational_AutoEncoder.ipynb
A simple implementation of Gaussian MLP Encoder and Decoder trained on MNIST
"""
import torch
import torch.nn as nn
import torchvision.transforms as transforms
from torch.utils.data import DataLoader
from... |
import pandas as pd
# Read the cities.csv file
df = pd.read_csv('Resources/cities.csv')
# Save as html file
df.to_html('data.html', index=False)
# Assign to table to view
table = df.to_html()
print(table)
|
# Insert Interval
class Solution:
def insert(self, intervals, newInterval):
ans = []
[nst, nen] = newInterval
for index, [st, en] in enumerate(intervals):
if en < nst:
ans.append(intervals[index])
elif nen < st:
# can return now
... |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 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 new Noodlyappendagecoin multisig prefix functionality.
#
from test_framework.test_framework imp... |
# Copyright (C) 2013 Lars Wirzenius
#
# This program 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 2 of the License, or
# (at your option) any later version.
#
# This program is distributed i... |
import logging
import os
import time
from flask import Flask, flash, redirect, render_template, request, session
from flask_oauth import OAuth
from flask_sslify import SSLify
from wtforms import Form, StringField
from analyze import analyze_followers, analyze_friends, div
logging.getLogger("requests").setLevel(loggi... |
# coding: utf-8
"""
Swaggy Jenkins
Jenkins API clients generated from Swagger / Open API specification # noqa: E501
The version of the OpenAPI document: 1.1.2-pre.0
Contact: blah@cliffano.com
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
impor... |
# Copyright (c) 2017, The University of Bristol, Senate House, Tyndall Avenue, Bristol, BS8 1TH, United Kingdom.
# Copyright (c) 2021, COSIC-KU Leuven, Kasteelpark Arenberg 10, bus 2452, B-3001 Leuven-Heverlee, Belgium.
"""
This is the collection of all possible types managed by the compiler
that are available for MA... |
#https://programmers.co.kr/learn/courses/30/lessons/12910
def solution(arr, divisor):
answer = []
for i in arr:
if i%divisor==0:
answer.append(i)
answer.sort()
if len(answer) == 0:
return [-1]
return answer |
# 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... |
from setuptools import setup, find_packages
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name='drf_dx_datagrid',
version='0.3.1',
packages=find_packages(),
url='https://github.com/SergeyMatveev88/drf-dx-datagrid',
license='MIT',
author='SergeyMatveev88',
autho... |
# encoding: UTF-8
""""
基于布林带的交易策略
观察周期:1min
策略周期:5min
策略逻辑:
1. 信号:突破上轨、下轨
2. 过滤:均线多头、空头排列
3. 出场:分级止盈;固定止损
"""
import talib
import numpy as np
from cyvn.trader.vtObject import VtBarData
from cyvn.trader.vtConstant import EMPTY_STRING
from cyvn.trader.app.ctaStrategy.ctaTemplate import CtaTemplate, BarGenerator, Arr... |
# Copyright (c) 2015-2016 OpenStack Foundation
#
# 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... |
class DesignerSerializationVisibilityAttribute(Attribute, _Attribute):
"""
Specifies the type of persistence to use when serializing a property on a component at design time.
DesignerSerializationVisibilityAttribute(visibility: DesignerSerializationVisibility)
"""
def Equals(self, obj):
... |
"""
WSGI config for strops 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/3.0/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTIN... |
# Copyright 2019 Typo. 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 applicabl... |
# Copyright 2013 by Rackspace Hosting, 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 t... |
#!/usr/bin/env python
#******************************************************************************
# $Id: s57tables.py 2780 2001-12-17 22:33:06Z warmerda $
#
# Project: S-57 OGR Translator
# Purpose: Script to translate s57 .csv files into C code "data" statements.
# Author: Frank Warmerdam, warmerdam@pobox... |
#!/usr/bin/env python3
# Copyright (c) 2017 The Syndicate Cash developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test various fingerprinting protections.
If an stale block more than a month old or its header are reques... |
import json
import sys
import portalocker
from bot import utils
default_config = {
"general": {
"language": "en",
"cache_file_name": "TTMediaBotCache.dat",
"blocked_commands": [],
"send_channel_messages": True,
"delete_uploaded_files_after": 300,
"time_format": r"%... |
r"""
Plotting Functions
EXAMPLES::
sage: x, y = var('x y')
sage: W = plot3d(sin(pi*((x)^2+(y)^2))/2,(x,-1,1),(y,-1,1), frame=False, color='purple', opacity=0.8)
sage: S = sphere((0,0,0),size=0.3, color='red', aspect_ratio=[1,1,1])
sage: show(W + S, figsize=8)
.. PLOT::
x, y = var('x y')
W =... |
# commonly used navigation paths
SINGLE_COLUMN_TAB = [
'contents', 'singleColumnBrowseResultsRenderer', 'tabs', 0, 'tabRenderer', 'content'
]
SECTION_LIST = ['sectionListRenderer', 'contents']
ITEM_SECTION = ['itemSectionRenderer', 'contents', 0]
MUSIC_SHELF = [0, 'musicShelfRenderer']
CONTINUATION = ['continuation... |
# Copyright 2018 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... |
# coding=utf-8
import os
import math
import pickle
import torch
import torch.nn.functional as F
import torch.distributed as dist
import numpy as np
from torchvision.io import read_video
import utils.logging as logging
from datasets.data_augment import create_data_augment, create_ssl_data_augment
logger = logging.get_... |
# Copyright (c) 2017, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
from mixbox import entities
from mixbox import fields
import cybox.bindings.dns_record_object as dns_record_binding
from cybox.common import (Integer, HexBinary, ObjectProperties, String,
StructuredText, Da... |
# Copyright 2014 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... |
# Copyright 2013 Rackspace Hosting
# 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 require... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
: Project - Test speed of different models
: standalone segmentation using torch in-built models - fcn, deeplabv3, lr-aspp
: Author - Xi Mo
: Institute - University of Kansas
: Date - 5/13/2021 last updated 5/15/2021
: Model Reference:
https://pytorch.org/vision/st... |
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 7 12:15:25 2021
@author: danie
"""
# %% Imports
import torch
import torchvision
from torchvision import transforms
from TrainTripletNetwork import LoadBestModel
import matplotlib
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
im... |
from unittest import skip
from .base import FunctionalTest
class ItemValidationTest(FunctionalTest):
@skip
def test_cannot_add_empty_list_items(self):
# Edith goes to the home page and accidentally tries to submit
# an empty list item. She hits Enter on the empty input box
self.browser.get(self.... |
#/usr/bin/env python
from ciscoconfparse import CiscoConfParse
from pprint import pprint
import re
def main():
cfg=CiscoConfParse('Config-file.txt')
temp_list=cfg.find_objects_wo_child(parentspec=r"^crypto map", childspec="AES")
print temp_list
#print temp_list
for entry in temp_list:
for child in entry.chil... |
from io import open
import tempfile
import os
import shutil
import uuid
import PIL.Image
from django.core.files.storage import default_storage
from django.core.files.base import ContentFile
from django.test import override_settings
from .utils import repr_rgb
PATH = os.path.split(__file__)[0]
ORIG_IMG_PATH = os.pa... |
"""This is Drupalista herself.
"""
import subprocess
import os
from prettytable import PrettyTable
class Drupalista(object):
def __init__(self, message, config):
self.output = ''
self.servers = {}
self.site = False
self.drush_command = False
self.message = message
... |
import copy
import actmsg
class ctest(object):
def __init__(self, x, y):
self.x = x
self.y = y
class cchotest(ctest):
def __init__(self, x, y, z):
super().__init__(x, y)
self.z = z
def copy(self):
return copy.deepcopy(self)
def test():
a = ctest(1,2)
b = cchotest(3,4,5)
print(a.x, a.y... |
# USAGE
# python simple_request.py
# import the necessary packages
import requests
# initialize the Keras REST API endpoint URL along with the input
# image path
KERAS_REST_API_URL = "http://localhost:5001/tag"
# load the input image and construct the payload for the request
text = """
M Soriano habite à Paris
"... |
# -*- coding: utf-8 -*-
# (C) 2017 Tampere University of Technology
# MIT License
# Pauli Losoi
"""
Functions
---------
determine_intermediates
Determine intermediates from reactants and products.
evaluate_input
Evaluate user input.
evaluate_pathway
Evaluate pathway score.
filter_pathways
Filter pathwa... |
__author__ = "Fox Cunning"
import configparser
import os
import threading
import time
import tkinter
from typing import Optional, Tuple, List
import pyo
import appJar
import colour
from APU.APU import APU
from debug import log
from editor_settings import EditorSettings
from rom import ROM
# ------------------------... |
# Generated by Django 3.0.7 on 2020-08-26 07:03
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('model', '0011_auto_20200824_0753'),
]
operations = [
migrations.RenameModel(
old_name='Conferences',
new_name='Conference',
... |
# This file is part of Indico.
# Copyright (C) 2002 - 2022 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from flask import flash, render_template, session
from indico.core import signals
from indico.core.db imp... |
# 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... |
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
"""File wrangling."""
import fnmatch
import hashlib
import ntpath
import os
import os.path
import re
import sys
from functools import lru_cache
from .misc import ... |
import stft
import numpy as np
global SMP_RATE, SEG_SIZE
SMP_RATE = 16000
window_sec = .02 #window length 20 ms
SEG_SIZE = int(SMP_RATE*window_sec)
OVER_LAP = 2
def compute_spectrogram(wav_data):
specgram = stft.spectrogram(wav_data,framelength=SEG_SIZE,overlap=OVER_LAP)
reals,ims = np.real(specgram),np.imag(spe... |
"""
Image Utils
Handles preprocessing images before they are sent to the server
"""
import os.path, base64, re, warnings
from six import BytesIO, string_types, PY3
from PIL import Image
from indicoio.utils.errors import IndicoError
B64_PATTERN = re.compile("^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.