text stringlengths 3.07k 12.6k |
|---|
"""
New TurboGears2 identification, authentication and authorization setup.
This aims to provide an easier way to setup auth layer in TurboGears2
and removes the dependency from repoze.what.
"""
import sys, logging, re
from tg.support.converters import asbool
from zope.interface import implementer
from repoze.who.midd... |
# 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, overload
from ... import _utilities
fro... |
"""
dzcb.repeaterbook - export JSON from Repeaterbook, convert to K7ABD CSV format
"""
import argparse
import csv
import hashlib
import json
import logging
from pathlib import Path
import os
import time
import geopy.distance
import requests
from . import appdir, AmateurBands
from dzcb import k7abd
logger = logging.g... |
import unittest
import warnings
import numpy as np
import six
import chainer
from chainer import testing
from chainer_tests.dataset_tests.tabular_tests import dummy_dataset
def _filter_params(params):
for param in params:
if 'expected_len' in param and \
isinstance(param['get_examples_indices... |
import math
import matplotlib.pyplot as plt
#Function 1
def grayscale(img):
"""Applies the Grayscale transform
This will return an image with only one color channel
but NOTE: to see the returned image as grayscale
you should call plt.imshow(gray, cmap='gray')"""
return cv2.cvtColor(img, cv2.... |
"""
Simple wrapper for a control process
"""
import asyncio
import xxhash
import toml
from datetime import datetime
import logging
import base64
import os
import jq
import uuid
from aiogrpc import insecure_channel
from google.protobuf.json_format import MessageToDict
from pyxbos.exceptions import *
from . import xbos_... |
# cqlstatement.py
# Copyright 2016 <NAME>
# Licence: See LICENCE (BSD licence)
"""Chess Query Language (CQL) statement parser.
Thes extracts from http://www.gadycosteff.com/cql/doc/operation.html for cql5.1
briefly describe CQL and how the cql.exe program operates.
A CQL statement has three parts:
The word cql
... |
# -*- coding: utf-8 -*-
"""
Tests for pyftpsync
"""
import os
import unittest
from ftpsync.ftp_target import FTPTarget
from ftpsync.targets import DirMetadata, make_target
from ftpsync.util import set_pyftpsync_logger, write, write_error
from tests.fixture_tools import (
PYFTPSYNC_TEST_FOLDER,
_Syn... |
import re
from django.utils.translation import ugettext_lazy as _
from .base import (
ADDON_DICT, ADDON_EXTENSION, ADDON_LPAPP, ADDON_PLUGIN,
ADDON_SEARCH, ADDON_STATICTHEME, ADDON_THEME)
from olympia.versions.compare import version_int as vint
class App(object):
@classmethod
def matches_user_agent... |
import tensorflow as tf
from tensorflow.keras import losses, applications, Model
class PixelLossTraining:
def setup_pixel_loss(self, pixel_loss):
if pixel_loss == 'l1':
self.pixel_loss_type = losses.MeanAbsoluteError()
elif pixel_loss == 'l2':
self.pixel_loss_type = losses.M... |
import os
from joblib import Parallel, delayed
from tqdm import tqdm
from utils import generator_based_read_file, do_pickle, pretty, custom_tokenize
from opcodes import Opcodes
from transform_suffixes import SuffixTransform
import tokenization
import argparse
import seq2edits_utils
def add_arguments(parser):
"""Buil... |
#
# Copyright 2018-2020 Elyra 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 or agreed to in writ... |
"""
DC motor cqparts model
2018 <NAME> <EMAIL>
"""
import math
import cadquery as cq
import cqparts
from cqparts.params import PositiveFloat, String
from cqparts.display import render_props
from cqparts.constraint import Fixed, Coincident
from cqparts.constraint import Mate
from cqparts.utils.geometry import CoordSys... |
## evaluation helpers
from sklearn.metrics import confusion_matrix, classification_report, precision_recall_fscore_support, f1_score, accuracy_score, confusion_matrix
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.externals import joblib
from sklearn.tree import DecisionTreeClassif... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# =======================================
# File Name: utils.py
# Purpose : implementation for generating
# parameters
# =======================================
import math
import numpy as np
import csv
import sys
import os
np.random.seed(42) # fixed random s... |
"""
The socket server in Python.
Uses the toy_socket_evaluator to evaluate problems from the toy-socket suite. Additional evaluators
can be used -- whether they are included or not depends on the values of the respective variables
(see the variables that start with EVALUATE_). These definitions can be modified directly... |
# Copyright 2020,2021 Sony Corporation.
# Copyright 2021,2022 Sony Group 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
#
# Un... |
import os
import asyncio
from pathlib import Path
from concurrent.futures import ProcessPoolExecutor
from tqdm import tqdm
from aiosecretsdump import logger
from pypykatz.registry.offline_parser import OffineRegistry
from aiosmb.commons.interfaces.file import SMBFile
async def smb_registry(machine, outfolder = None... |
#!python3
# -*- coding: UTF-8 -*-
'''OMZ
This shows a scrolling row or grid of special characters in the Pythonista Keyboard. The view supports both the 'minimized' mode (above the QWERTY keyboard) and the 'expanded' mode with the grid filling most of the keyboard.
Note: This script is designed for the Pythonista Keyb... |
from __future__ import division
from __future__ import print_function
from myhdl import *
from ._emesh_i import EMeshPacket
from ._fifo_i import FIFO
class ELinkChannel(object):
""" RX or TX channel in an ELink interface
"""
def __init__(self):
# The Signals for the channel
self.lclk = S... |
import tensorflow as tf
import tensorflow_probability as tfp
import numpy as np
import matplotlib.pyplot as plt
from gpflow import Parameter
from gpflow.kernels import Stationary, Sum
from gpflow.utilities import positive
from gpflow.utilities.ops import square_distance, difference_matrix
from gpflow.utilities import ... |
# Copyright (c) 2019 GalaxyLearning 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 numpy as np
#import torchvision.transforms as transforms
import torch.nn as nn
import torch.nn.functional as F
import torch
from torch.autograd import Variable
from torch.utils.data import Dataset, DataLoader, TensorDataset
#from torchvision import transforms, utils
class BasicBlock_1(nn.Module): # 2-layers
... |
#!/usr/bin/env python
"""Python Client library for Open Pixel Control
http://github.com/zestyping/openpixelcontrol
Sends pixel values to an Open Pixel Control server to be displayed.
http://openpixelcontrol.org/
Recommended use:
import opc
# Create a client object
client = opc.Client('localhost:7890')
... |
##
# VTScan - Utility to scan for malicious files using the VirusTotal API
#
# @author <NAME><<EMAIL>>
# @license MIT
# @modified 13-05-2019
#
import requests
import argparse
import os, sys
import time
import hashlib
import json
from cfgsaver import cfgsaver
from vtscan import __title__, __description__, __version__
fr... |
# -*- coding: utf-8 -*-
# Copyright 2017 Google 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 ... |
"""
Parse iCal data to Events.
"""
# for UID generation
from random import randint
from datetime import datetime, timedelta, date
from dateutil.relativedelta import relativedelta
from dateutil.rrule import rrule, rruleset, rrulestr
from dateutil.tz import UTC, gettz
from icalendar import Calendar
from icalendar.prop i... |
from discord.ext import commands
import json
import asyncio
import dbl
import aiohttp
import discord
import config
class DBL():
"""Commands related to [discordbots.org](https://discordbots.org)"""
def __init__(self, bot):
self.bot = bot
self.token = config.dbl_token
self.dblpy = dbl.Cli... |
# MIT License
#
# Copyright (c) 2018 <NAME>, <EMAIL>
#
# 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, mer... |
"""
A simple wrapper for bluepy's btle.Connection.
Handles Connection duties (reconnecting etc.) transparently.
"""
import codecs
import logging
import re
import dbus
from bluepy import btle
DEFAULT_TIMEOUT = 1
_LOGGER = logging.getLogger("core.ble")
class Peripheral(btle.Peripheral):
def __init__(
sel... |
# 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 torch
import torch.nn as nn
import numpy as np
import math
def make_model(args, parent=False):
return SRDenseNet(args)
def get_upsample_filter(size):
"""Make a 2D bilinear kernel suitable for upsampling"""
factor = (size + 1) // 2
if size % 2 == 1:
center = factor - 1
else:
... |
"""
'storage-add ' sub command
"""
#To prevent Py2 to interpreting print(val) as a tuple.
from __future__ import print_function
import os
import tempfile
import sys
import json
import utils
from storage_yaml import to_storage_yaml
# noqa # pylint: disable=too-many-branches
def set_args(name, subparsers):
""" a... |
"""Test persistence."""
import json
import os
from collections import deque
from unittest import mock
import pytest
from mysensors import Gateway
from mysensors.persistence import MySensorsJSONEncoder, Persistence
from mysensors.sensor import ChildSensor, Sensor
# pylint: disable=redefined-outer-name
@pytest.fixtu... |
# -*- coding: utf-8 -*-
import cPickle
from matplotlib import pyplot
from numpy import *
def plot_errors(filenames):
colors = 'brgymc'
styles = ['-','--','-.',':']
idx = 0
for filename in filenames:
file = open(filename,'rb')
results = cPickle.load(file)
file.close()
po... |
########
# Copyright (c) 2018-2020 GigaSpaces Technologies Ltd. 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
#
# U... |
# utilities for reading device PRNUs and image noise residuals
import h5py
import numpy as np
from tqdm import tqdm
vision_dev_list = 'D01;D02;D03;D05;D06;D07;D08;D09;D10;D11;D12;D14;D15;D16;D17;D18;D19;D20;D21;D22;D24;D25;D26;D27;' \
'D28;D29;D30;D31;D32;D33;D34;D35'
vision_dev_list = vision_dev_list.... |
# Copyright 2012-present MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... |
import cv2
import numpy as np
import nn_models
import data_loading.image_loading as il
import nn_models.Models as models
import data_loading.data_loaders as loaders
import numpy.random
import torch, random
import torch.nn as nn
import torch.optim as optim
from tqdm import tqdm as tqdm
import pickle
from datetime impor... |
import numpy as np
from gym.envs.mujoco import HalfCheetahEnv as HalfCheetahEnv_
class HalfCheetahEnv(HalfCheetahEnv_):
def _get_obs(self):
return np.concatenate([
self.sim.data.qpos.flat[1:],
self.sim.data.qvel.flat,
self.get_body_com("torso").flat,
]).... |
import pandas as pd
import numpy as np
from impute_values import impute_values
from booleanize import booleanize
from one_hot import one_hot
skipped_reactors = [
"COMPASS", "MAST", "START",
"T10", "TEXTOR", "TUMAN3M"
]
def load_tokamaks():
tokamak_data = pd.read_csv("./tokamak_shots.csv", low_memory=False)
... |
import time
import numpy as np
from numpy.polynomial.legendre import legval
import numba
from desiutil.log import get_logger
from desispec.xytraceset import XYTraceSet
from desispec.image import Image
from desispec.io.fibermap import empty_fibermap
from desispec.qproc.qframe import QFrame
@numba.jit
def numba_extrac... |
import torch
from up.tasks.det.models.utils.bbox_helper import (
bbox2offset,
clip_bbox,
filter_by_size,
normalize_offset,
)
from up.tasks.det.models.utils.box_sampler import build_roi_sampler
from up.tasks.det.models.utils.matcher import build_matcher
from up.utils.general.fp16_helper import to_float3... |
#!/usr/bin/env python
# import sys,os
# from _functools import reduce
# CORE_DIR = reduce(lambda x,f:f(x), [os.path.dirname,]*4, os.path.realpath(__file__))
# sys.path.extend( [os.path.join(CORE_DIR,x) for x in ["web","lib"]] )
# os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
# import django
# django.setu... |
# Authors: <NAME>, <NAME>
import torch
import cupy
from collections import namedtuple
from string import Template
BACKEND_NAME = 'torch_skcuda'
@cupy.util.memoize(for_each_device=True)
def load_kernel(kernel_name, code, **kwargs):
code = Template(code).substitute(**kwargs)
kernel_code = cupy.cuda.compile_wit... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, division, print_function, unicode_literals
from numpy.testing import assert_allclose
import numpy as np
from astropy.units import Quantity
from astropy.table import Table
from ....utils.testing import requires_depend... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# 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 ... |
import socket
import threading
import time
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
serverRunning = True
ip = "127.0.0.1"
port = 25565
app = {}
app["anaoda"] = {}
con = []
s.bind((ip, port)) #Sunucu belirtilen ip ve porta bağlandı.
s.listen()
print("Sunucu Hazır...")
print("Sunuc... |
"""
Copyright (c) 2019 The Cereja Project
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, distrib... |
# http://forum.micropython.org/viewtopic.php?f=5&t=195&p=873&hilit=lcd_gfx#p873
#adaptiert von Adafruit_GFX.cpp
#for LCD and touch-sensor skin
def drawLine(x0,y0,x1,y1,thelcd,fill):
steep= abs(y1 - y0) > abs(x1 - x0);
if steep:
x0, y0 = y0, x0
x1, y1 = y1, x1
if x0>x1:
x0, x1 = x1, x0
... |
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use ... |
"""
Copyright 2019 <NAME>
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, distribute, sublicense,... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# python 3.3.2+ Hammer Dos Script v.1
# by <NAME>
# only for legal purpose
from queue import Queue
from optparse import OptionParser
import time,sys,socket,threading,logging,urllib.request,random
def user_agent():
global uagent
uagent=[]
uagent.append("uagent Mozilla/5.... |
import hoomd
import pytest
import numpy as np
_harmonic_args = {
'k': [3.0, 10.0, 5.0],
't0': [np.pi / 2, np.pi / 4, np.pi / 6]
}
_harmonic_arg_list = [(hoomd.md.angle.Harmonic, dict(zip(_harmonic_args, val)))
for val in zip(*_harmonic_args.values())]
_cosinesq_args = {
'k': [3.0, 10... |
"""Main flask app for users service.
Features include
- adding/updating users in the users db
- getting the authorization level of a user
"""
# Author: mukobi
# Copyright 2019 The Knative Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complian... |
#!/usr/bin/env python3
# Copyright 2017 Google 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... |
from typing import List
from hwt.pyUtils.uniqList import UniqList
from hwtGraph.elk.containers.constants import PortType
from hwtGraph.elk.containers.lNode import LNode
from hwtGraph.elk.containers.lPort import LPort
from itertools import chain
def merge_non_reduced_ports(port: LPort, reduced_ports: List[LPort]):
... |
import os
import numpy as np
import pandas as pd
from sklearn.metrics import confusion_matrix
def get_result(l_type="mae", ph=6, ind=0, path="ohio_results", standard=True):
path = f"{path}/ph_{ph}_{l_type}"
# pids = [552, 544, 567, 584, 596, 559,
# 563, 570, 588, 575, 591, 540]
pids = [
... |
# Importing the packages
from math import *
import numpy as np,cv2
from skimage import io
from matplotlib import pyplot as plt
from skimage.util import random_noise
from imageio import imread
################################################### Part 1 ###################################################
''' To perform b... |
import traceback
from inspect import isclass
from typing import Tuple, Dict, Any, Union, Callable, List, get_args
from .entities.subscriber import Subscriber
from .entities.event import TemplateEvent, ParamRet
from .exceptions import UndefinedRequirement, UnexpectedArgument, ParsingStop, PropagationCancelled, Judgement... |
# DExTer : Debugging Experience Tester
# ~~~~~~ ~ ~~ ~ ~~
#
# Copyright (c) 2018 by SN Systems Ltd., Sony Interactive Entertainment Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# ... |
import warnings
import torch
from torch import LongTensor, FloatTensor
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.modules.loss import _Loss
# TODO needs an overhaul
# 1. Consistency
# 2. See if we can make use of pytorch-metric-learning instead of these
class FocalLoss(nn.Module):
def __... |
import functools
import torch
from torch.nn import init
"""
# --------------------------------------------
# select the network of G, D and F
# --------------------------------------------
"""
# --------------------------------------------
# Generator, netG, G
# --------------------------------------------
def defi... |
# Purpose: using splines
# Created: 13.04.2014
# Copyright (c) 2014 <NAME>
# License: MIT License
from typing import cast
import ezdxf
from ezdxf.math.bspline import global_bspline_interpolation
from ezdxf.math import BSpline, Vec3
from ezdxf.entities import Spline
new = ezdxf.new
readfile = ezdxf.readfile
def clone... |
from __future__ import annotations
import disnake
from aiohttp import ClientSession
from disnake.ext import commands
from utils.music.converters import URL_REG
from utils.music.errors import parse_error
from utils.others import send_message
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from utils.client impor... |
from crccheck import crc
import ad_path
import antenna_diversity as ad
import numpy as np
import matplotlib.pyplot as plt
import math
"""
This file will show the insights of a chosen selection algorithm.
Very nice for seing what is actually done.
It will output the following data:
- A plot showing CRC error and the se... |
# CTK: Cherokee Toolkit
#
# Authors:
# <NAME> <<EMAIL>>
#
# Copyright (C) 2009-2011 <NAME>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
# License as published by the Free Software Foundation.
#
# This program is distributed in ... |
from github import Github
from gitmask.lib.common.git import (repo_clone, repo_receive_pack, repo_checkout, repo_squash_commits, repo_push, repo_remote_add, repo_fetch)
from gitmask.lib.scm.github_utils import auth_remote_url
from gitmask.lib.gitmask_protocol import (inject, decode_branch)
import tempfile
import os
imp... |
import os
import pandas as pd
from PIL import Image, ImageDraw, ImageFont
import PIL
# Inserts texts in the image with specific details
def image_process(data, image_file_name, font_name, font_size, name_x, name_y, id_x, id_y, save_with_name, id_font_color='yellow',
name_font_color='red', line_space... |
#!/usr/bin/env python
from utils import utils, inspector, admin
from datetime import datetime
from urllib.parse import urljoin
import os.path
import re
archive = 2007
def run(options):
year_range = inspector.year_range(options, archive)
for page_url in URLS:
doc = utils.beautifulsoup_from_url(page_url)
... |
import tensorflow as tf
import dgl.nn.tensorflow as dglt
from numpy import prod
class multiNet(tf.keras.Model):
""""""
def __init__(self, stageGraph, h_dim, n_layers, trainable=False, network_type='GATConv', **kwargs):
super().__init__()
network_type_dict = {
'GraphConv': dglt.Gra... |
"""
Phase dispersion minimisation algorithm, Stellingwerf (1978).
"""
import numpy as np
import scipy.optimize as sco
def sj2(x, meanx, N):
"""
The variance of a set of data points in one bin.
Args:
x (array): The flux array (defined as x in Stellingwerf, 1978).
meanx (float): The mean o... |
import asyncio
from discord.ext import commands, tasks
import game_management.output as output
import utils as ut
from environment import PREFIX, CHECK_EMOJI, DISMISS_EMOJI
from game_management.game import Game, find_game, games
from game_management.tools import Phase, Group, Key
from game_management.word_pools impor... |
import csv
from typing import List, Optional
from dataclasses import dataclass
import itertools
from pathlib import Path
class CachedTsvReader(object):
__slots__ = ['fobj', 'csvrdr', 'current']
def __init__(self, filename):
self.fobj = open(filename, 'rt', encoding='utf-8-sig', newline='')
sn... |
# Lexer's job is to turn the source code into tokens
from interpreter.exceptions import SyntaxErrorException
from interpreter.consts import KEYWORDS, Consts, TokenTypes
class Token:
def __init__(self, type, value=None):
self.type = type
self.value = value
def __repr__(self):
if self.v... |
from dataclasses import dataclass
from typing import Iterator, Iterable, Generic, TypeVar
from sqlschm import tok
T = TypeVar("T")
@dataclass(slots=True)
class ItemCursor(Generic[T]):
_it: Iterator[T]
_default_item: T
item: T
# Enable to look ahead
next_item: T
def __init__(self, items: Iter... |
import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
import collections
from lib.models.backbone.squeezenet import DilationLayer, FeatExtractorSqueezeNetx16
from lib.models.psroi_pooling.modules.psroi_pool import PSRoIPool
class ConcatAddTable(nn.Module):
def __init__(self, *a... |
#!/usr/bin/env python3
# coding=utf-8
"""
This script prints some basic collection stats about the size of the
collections and their indexes.
"""
from optparse import OptionParser
import psutil
from prettytable import PrettyTable
from pymongo import MongoClient
def compute_signature(index):
signature = index["... |
# -*- coding: utf-8 -*-
# isort: skip_file
# fmt: off
"""Helpers to deal with marshmallow schemas"""
from marshmallow import class_registry
from marshmallow.base import SchemaABC
from marshmallow_jsonapi.fields import Relationship, List, Nested
from .exceptions import InvalidInclude
def compute_schema(schema_cls, ... |
# -*- coding: utf-8 -*-
# Copyright © 2009/2021 <NAME>
#
# 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,
# ... |
# python/example4.py -- Python version of an example application that
# shows how to use the GLCanvas widget. For a C++ implementation, see
# '../src/example4.cpp'.
#
# NanoGUI was developed by <NAME> <<EMAIL>>.
# The widget drawing code is based on the NanoVG demo application
# by <NAME>.
#
# All rights reserved. Use ... |
import torch.nn as nn
import torch.nn.functional as F
FLANK_SIZE = 10
CONTEXT_SIZE = FLANK_SIZE * 2 + 1
def conv3x3(in_planes, out_planes, stride=1):
"""3x3 convolution with padding"""
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=1, bias=False)
class Ba... |
import subprocess
import tarfile
import shutil
import string
import tempfile
from util import *
def dockerCreateRunContainer(name, image, cmd="run", commandLine = None, daemon = True, interacive = True,
volumes=[], volumesFrom=[], hostname=None, links=[], privileged = False, labels = [], net=None) :
args =... |
import json
import os
import subprocess
import time
from datetime import datetime, timezone
from pathlib import Path
from typing import Any, Dict, Iterator, List, Union, cast
import pytest
from tests import config as conf
from .test_users import ADMIN_CREDENTIALS, logged_in_user
DEVCLUSTER_CONFIG_ROOT_PATH = conf.P... |
import numpy as np
import collections
import operator
import nltk
from config import configs as conf
configs = conf()
def question_types_filter(data):
results = []
que_types = collections.defaultdict(int)
que_1_types = ['what', 'how', 'whose', 'which', 'when', 'where', 'who', 'why', 'can', 'could', 'am'... |
#!/usr/bin/python
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2021 Intel Corporation
''' This is a module for ansible to check working state of some kubernetes
objects. Please read inline YAML documentation'''
import subprocess # nosec - bandit: security considered
import json
from ansible.module_utils.ba... |
""" Module to translate from Romanji to Hiragana
This module is responsible solely for translating words from Romanji
to Hiragana. Its called only by the deck module and only within its
add and edit functions. It is modeled after the katakana module.
Important work that needs to be done:
Catch errors from bad romanj... |
try:
import skin_run
except:
print("Could not import library 'skin_run'")
import numpy as np
import tables
from simple_io import *
try:
import xlwt
except:
print("could not import library 'xlwt'")
import os
class SkinData:
data = None
skin_base = None
def __init__(self, live=True, filename... |
import warnings
import scanpy as sc
import numpy as np
from sklearn.preprocessing import LabelEncoder
def choose_representation(adata,
rep=None,
n_pcs=None):
"""Get representation of multivariate data.
Args:
adata (anndata.AnnData): Multidimensional... |
#!/usr/bin/env python
# mypy: ignore-errors
# ncem documentation build configuration file
#
# If extensions (or modules to document with autodoc) are in another
# directory, add these directories to sys.path here. If the directory is
# relative to the documentation root, use os.path.abspath to make it
# absolute, like ... |
"""
This module contains various contants and utilities for both internal and external use.
"""
import aiohttp
import asyncio
import datetime
import typing
#: This constant is used in the various ``edit()`` methods.
#: It's used to indicate that there should be no change to the value of a field,
#: in the cases wher... |
"""Core Haskell rules"""
load(":providers.bzl",
"HaskellPackageInfo",
"CcSkylarkApiProviderHacked",
)
load(":actions.bzl",
"compile_haskell_bin",
"compile_haskell_lib",
"create_dynamic_library",
"create_ghc_package",
"create_static_library",
"gather_dependency_information",
"get_pkg_id",
"link_has... |
"""
The test cases in bluebottle_salesforce are intended to be used for integration
with Django ORM and Salesforce for Onepercentclub.
"""
import logging
from bluebottle.utils.tests import UserTestsMixin
import requests
from datetime import datetime
from django.test import TestCase
from django.conf import settings
from... |
# 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 argparse
import pathlib
import torch
from esm import Alphabet, FastaBatchedDataset, ProteinBertModel, pretrained, MSATransformer
impo... |
from __future__ import division
from math import ceil, log
import random
class MatchGenerator(object):
def __init__(self, players, turns, game, repetitions, noise=0):
"""
A class to generate matches. This is used by the Tournament class which
is in charge of playing the matches and collec... |
# 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 __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import numpy as np
from ipywidgets import widgets
from mpl_toolkits.mplot3d import Axes3D
from mpl_toolkits.mplot3d.art3d import Poly3DCollection
import matplotlib.pyplot as plt
from matplotlib.patches i... |
# Copyright 2011 Contributors (<NAME>)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... |
"""Tenable Settings
Collect Tenable Settings using a Service User’s API Key
"""
from datetime import datetime, timezone
import requests
from tenable.io import TenableIO
from runners.helpers import db, log
from runners.helpers.dbconfig import ROLE as SA_ROLE
from runners.utils import groups_of
from .utils import yaml... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import secrets
import smtplib
from email.message import EmailMessage
import qrcode
from flask import Flask, jsonify, make_response, request
from flask_cors import CORS
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import DateTime
app = Flask(__na... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.