text stringlengths 1 927k |
|---|
from .shape import *
from .image import Image
from .table import Table
from .roi import *
from .surface import * |
from __future__ import annotations
from prettyqt import core, gui
from prettyqt.qt import QtQuick
QtQuick.QQuickItemGrabResult.__bases__ = (core.Object,)
class QuickItemGrabResult:
def __init__(self, item: QtQuick.QQuickItemGrabResult):
self.item = item
def __getattr__(self, val):
return g... |
from django import forms
from common.data.labels import LABELS
from posts.models.post import Post
class PostCuratorForm(forms.Form):
change_type = forms.ChoiceField(
label="Сменить тип поста",
choices=[(None, "---")] + Post.TYPES,
required=False,
)
new_label = forms.ChoiceField(
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
try:
with open('README.md', encoding='utf-8') as readme_file:
readme = readme_file.read()
except IOError:
readme = ''
try:
with open('HISTORY.md', encoding='utf-8') as history_file:
history = history... |
#
# Copyright 2020 British Broadcasting Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
.. _sdc_estimation :
Fieldmap estimation and unwarping workflows
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. automodule:: fmriprep.workflows.fieldmap... |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
import auth_rename
setup(
name='ahlev-django-auth-rename',
version=auth_rename.__version__,
description='to rename authentication and authorization',
long_description='to rename authentication and authorization',
long_description_c... |
import typer
from find.utils import find_package
from paur.paur import console
findcmd = typer.Typer()
@findcmd.command("find")
def find(
packages: str,
in_aur: bool = typer.Option(False, help="Search only in AUR."),
in_repo: bool = typer.Option(False, help="Search only in official repo."),
) -> None:
... |
import nose.tools
import ckan.logic as logic
import ckan.plugins as p
import ckan.tests.helpers as helpers
import ckan.tests.factories as factories
import ckan.logic.schema as schema
eq = nose.tools.eq_
class TestPackageShow(helpers.FunctionalTestBase):
def test_package_show(self):
dataset1 = factorie... |
r"""
Lie Algebras
AUTHORS:
- Travis Scrimshaw (07-15-2013): Initial implementation
"""
#*****************************************************************************
# Copyright (C) 2013 Travis Scrimshaw <tscrim at ucdavis.edu>
#
# This program is free software: you can redistribute it and/or modify
# it under... |
# coding: utf-8
default_app_config = "django_ymap.apps.SimpleYandexMap"
from .apps import SimpleYandexMap |
"""
This file provides the template for designing the agent and environment. The below hyperparameters must be assigned to a value for the algorithm to work properly.
"""
import numpy as np
# from environment import Environment
from environment_adapter import EnvironmentAdapter
from agent import Agent
from collection... |
import torch
import numpy as np
import logging
from .env import SechsNimmtEnv
logger = logging.getLogger(__name__)
class GameSession:
def __init__(self, *agents, device=torch.device("cpu"), dtype=torch.float):
""" Initializes a game session, which consists of an arbitrary number of games between the give... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, Matt Wright <matt@nobien.net>
#
# 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 License... |
import unittest
from typing import Any, List, Tuple
from unittest.mock import MagicMock, patch
from io import StringIO
from nix_review.cli import main
from .cli_mocks import (
CliTestCase,
Mock,
MockCompletedProcess,
build_cmds,
read_asset,
IgnoreArgument,
)
def rev_command_cmds() -> List[Tu... |
# coding=utf-8
# Copyright 2019 The SEED 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 agre... |
import youtube_dl,re, os, tkinter
def getUrlWindow(data=None):
root=tkinter.Tk()
root.withdraw()
data = root.clipboard_get()
if re.match('https://www.youtube.com/',data) != None:
print('Downloading as MP3')
return data
else: return None
def sendtoYDL(data):
ydl_opts = { 'outtm... |
# import
## batteries
import os, sys
import re
from functools import partial
import types
import logging
import tempfile
import shutil
import glob
from collections import defaultdict
from random import shuffle
from StringIO import StringIO
## 3rd party
import numpy as np
import pandas as pd
from SIPSim_pymix import mix... |
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redi... |
import pytest
from astropy.io import fits
import numpy as np
from numpy.testing import assert_array_equal
from lightkurve.io.k2sff import read_k2sff_lightcurve
from lightkurve import search_lightcurve
@pytest.mark.remote_data
def test_read_k2sff():
"""Can we read K2SFF files?"""
url = "http://archive.stsci.... |
import os
def getEnv(name,default=None):
value = os.environ.get(name,None)
if value == None:
if default == None:
value = input("Env variable not found, please enter {}: ".format(name))
else:
value = default
return value |
#!/usr/bin/env bash
#SBATCH --job-name=mlcommons-science-earthquake-a100
#SBATCH --output=mlcommons-science-earthquake-a100.out
#SBATCH --error=mlcommons-science-earthquake-a100.err
#SBATCH --partition=gpu
#SBATCH --cpus-per-task=6
#SBATCH --mem=32G
#SBATCH --time=06:00:00
#SBATCH --gres=gpu:a100:1
#SBATCH --account=d... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class FinUserInfo(object):
def __init__(self):
self._user_id = None
@property
def user_id(self):
return self._user_id
@user_id.setter
def user_id(self, value):
... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-12-21 22:42
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0005_auto_20161221_1710'),
]
operations = [
migrations.AlterField(... |
#!/usr/bin/env python
__author__ = "RADICAL Team"
__copyright__ = "Copyright 2012-2020, The SAGA Project"
__license__ = "MIT"
""" This examples shows how to run a job on a remote cluster
using the 'COBALT' job adaptor.
More information about the radical.saga job API can be found at:
http://radical-... |
import pytest
from pytest_mock import mocker
from hamcrest import *
import numpy as np
from src.objects.quantum_system import SystemType
from src.objects.qudit import Qudit
from src.dirac_notation.constants import *
@pytest.mark.parametrize('input', [
(
comp_ket_x(0, 4)
)
])
def test_init(input):
... |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import ... |
from infrastructure.json.JsonConvert import JsonConvert
@JsonConvert.register
class CreateDataIntegrationConnectionFileModel:
def __init__(self,
HasHeader: bool = None,
Header: str = None,
Separator: str = None,
):
self.HasHeader: bool =... |
import pandas as pd
import numpy as np
from collections import Counter
class my_NB:
def __init__(self, alpha=1):
# alpha: smoothing factor
# P(xi = t | y = c) = (N(t,c) + alpha) / (N(c) + n(i)*alpha)
# where n(i) is the number of available categories (values) of feature i
# Setting... |
from typing import TYPE_CHECKING, List, Optional, Type
from uuid import UUID
from sqlalchemy import event
from sqlalchemy.schema import Column, ForeignKey, UniqueConstraint
from sqlmodel import Field, Relationship
from sqlmodel.sql.sqltypes import GUID
from joj.horse.models.base import DomainURLORMModel, url_pre_save... |
import binascii
import logging
import struct
from plistutils.utils import HFS_EPOCH_FROM_UNIX_SHIFT, interpret_flags, NamedStruct, parse_timestamp
logger = logging.getLogger(__name__)
class AliasParser(object):
"""
Note that for...
v2: volume_creation_date, creation_date, and volume_name are prese... |
import string
import numpy as np
import matplotlib.pyplot as plt
from VertexTissue import globals as const
from VertexTissue.Analysis import *
from VertexTissue.funcs import euclidean_distance
from periodic_2D import forces, omegas
if __name__ == '__main__':
square_length = lambda G, t : euclidean_distance... |
import boto3
def __get_parameter(name):
if not name or name == "":
raise ValueError("name not passed.")
system_code = "spot-rec"
name = f"/{system_code}/{name}"
client = boto3.client('ssm')
response = client.get_parameter(Name=name)
return response ['Parameter']['Value']
client_id =... |
DEXY_VERSION="2.0.9b" |
#!/usr/bin/python
import os
import stat
import sys
import time
import outer_packages
import zmq
import yaml
from jsonrpclib.SimpleJSONRPCServer import SimpleJSONRPCServer
import jsonrpclib
from jsonrpclib import Fault
import binascii
import socket
import errno
import signal
from common.trex_status_e import TRexStatus... |
# Copyright 2016 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... |
#!/usr/bin/env python
import os
## setup testfiles for easier access
__base_dir = os.path.dirname(os.path.abspath(__file__))
__testfiles_dir = os.path.realpath(__base_dir + "/../testdata")
testfiles = {}
for file in os.listdir(__testfiles_dir):
testfiles[file] = "%s/%s" % (__testfiles_dir, file) |
# Copyright 2012 IBM Corp.
# Copyright 2013 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 r... |
import rospy
import PointCloud
reload(PointCloud)
import CoordinateFrames
reload(CoordinateFrames)
import Lines
reload(Lines)
import Image as ImagePy
reload(ImagePy)
import Text
reload(Text)
from PointCloud import PointCloudMarker
from PlotObject import PlotObject
from CoordinateFrames import CoordinateFramesMarke... |
from PyQt5 import QtCore
import os, tempfile
from scipy.misc import toimage
import brukerWriter as bw
import utils
from FilesTreeWidget import *
__all__ = ["FilesTreeThread", "SaveThread"]
class FilesTreeThread(QtCore.QThread):
def __init__(self, parent = None, mode = "create", dirnames = ""):
super()... |
"""
ORY Hydra
Welcome to the ORY Hydra HTTP API documentation. You will find documentation for all HTTP APIs here. # noqa: E501
The version of the OpenAPI document: v1.10.5
Generated by: https://openapi-generator.tech
"""
import copy
import logging
import multiprocessing
import sys
import urllib3
... |
import cv2 as cv
img = cv.imread("dog.jpg")
cv.imshow("Original Image", img)
cv.waitKey(0)
border = cv.copyMakeBorder(img, 10, 10, 10, 10, cv.BORDER_CONSTANT)
cv.imshow("Bordered Image", border)
cv.waitKey(0)
cv.destoryAllWindows() |
# # Introduction
# In this notebook, we will load an example time series, fit a growth model
# and plot the signals.
#
# ## Load example time series
#
# Let's start by loading example time series data.
# -------------------------------------------------------------------------------------------
# Copyright (c) Microsof... |
import torch
import torch.nn.functional
from e3nn.o3 import Irreps
from e3nn.util.jit import compile_mode
from nequip.data import AtomicDataDict
from .._graph_mixin import GraphModuleMixin
@compile_mode("script")
class OneHotAtomEncoding(GraphModuleMixin, torch.nn.Module):
num_types: int
set_features: bool
... |
#!/usr/bin/env python3
import sys
import io
def decompress(stream):
output = io.BytesIO()
planes = 0
while planes < 0x30 * 2:
favourite = stream.read(1)
control = stream.read(1)[0]
for x in range(8):
if control & 0x80:
output.write(stream.read(1))
... |
"""
altgraph.Graph - Base Graph class
=================================
..
#--Version 2.1
#--Bob Ippolito October, 2004
#--Version 2.0
#--Istvan Albert June, 2004
#--Version 1.0
#--Nathan Denny, May 27, 1999
"""
from __future__ import division
from __future__ import absolute_import
from altgraph import ... |
from newmath import sum
print(sum(2, 40)) |
from threading import Thread
import random
import time
from sciibo.bot import Bot
from sciibo.core.emitter import Emitter
from sciibo.core.helpers import Queue
from sciibo.network.broadcast import BroadcastThread
from sciibo.network.connection import ConnectionThread
from sciibo.network.listen import ListenThread
from... |
import FWCore.ParameterSet.Config as cms
egmGedGsfElectronPFNoPileUpIsolation = cms.EDProducer(
"CITKPFIsolationSumProducer",
srcToIsolate = cms.InputTag("gedGsfElectrons"),
srcForIsolationCone = cms.InputTag('pfNoPileUpCandidates'),
isolationConeDefinitions = cms.VPSet(
cms.PSet( isolationAlgo... |
# Tomasz Netczuk (netczuk.tomasz at gmail.com)
# Dariusz Seweryn (dariusz.seweryn at gmail.com)
#
# Copyright (c) 2009-2013 Polidea Sp. z o.o. (http://www.polidea.pl)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following c... |
import base64
from wptserve.utils import isomorphic_decode
# Use numeric references to let the HTML parser take care of inserting the correct code points
# rather than trying to figure out the necessary bytes for each encoding. (The latter can be
# especially tricky given that Python does not implement the Encoding St... |
# Copyright (c) 2020, Fabio Muratore, Honda Research Institute Europe GmbH, and
# Technical University of Darmstadt.
# 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 ... |
"""FastAPI application using PGStac."""
import logging
import os
from typing import Any, Awaitable, Callable, Dict, List
from fastapi import FastAPI, Request, Response
from fastapi.exceptions import RequestValidationError, StarletteHTTPException
from fastapi.openapi.utils import get_openapi
from fastapi.responses impo... |
import pytest
import tensorflow as tf
import numpy as np
from attx import tensor_ops
def test_single_example_batch_single_step_sequence_with_high_dimension():
# (?, k, dk) = (1, 1, 4)
query_1 = [[1, 2, 3, 4]]
key_1 = [[1, 1, 1, 1]]
value_1 = [[10, 10, 10, 10]]
query = tf.cast([query_1], tf.float... |
# -*- coding: utf-8 -*-
#
# Copyright 2018-2021 Bartosz Kryza <bkryza@gmail.com>
#
# 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 r... |
# Copyright 2012 OpenStack 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 required b... |
import random
import logging
# import torch
from stanza.models.common.data import map_to_ids, get_long_tensor, get_float_tensor, sort_all
from stanza.models.common.vocab import PAD_ID, VOCAB_PREFIX, ROOT_ID, CompositeVocab, CharVocab
from stanza.models.pos.vocab import WordVocab, XPOSVocab, FeatureVocab, MultiVocab
fr... |
import math
from binascii import hexlify
from clvm_tools import binutils
from shamrock.types.blockchain_format.program import Program
from shamrock.types.blockchain_format.sized_bytes import bytes32
from shamrock.types.condition_opcodes import ConditionOpcode
from shamrock.util.ints import uint64
from shamrock.wallet... |
#
# Copyright (c) 2015, Nikolay Polyarnyi
# All rights reserved.
#
import yaml
import asyncio
import logging
import numpy as np
import pkg_resources
from pathlib import Path
from unittest import TestCase
from triangulum.utils import support
from triangulum.utils.support import str_dict, deep_merge
from triangulum.ren... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tests for the PL/SQL Recall event formatter."""
from __future__ import unicode_literals
import unittest
from plaso.formatters import pls_recall
from tests.formatters import test_lib
class PlsRecallFormatterTest(test_lib.EventFormatterTestCase):
"""Tests for the PL/SQ... |
import io
import itertools
import os
import time
import cv2
try:
import horovod.tensorflow as hvd
except ImportError:
hvd = None
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import tensorflow.compat.v1 as tf
from PIL import Image
from PIL import ImageDraw, ImageFont
from sklearn... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib.auth import get_user_model
from django.core.exceptions import ObjectDoesNotExist
from django.db.models import F
from django.db.models.signals import post_delete
from django.db.models.signals import pre_save
from django.dispatch import... |
from panda3d.core import *
from direct.showbase.DirectObject import DirectObject
from direct.interval.IntervalGlobal import *
from direct.distributed.ClockDelta import globalClockDelta
from direct.distributed.ClockDelta import NetworkTimePrecision
import random
from direct.task.Task import Task
from direct.directnotify... |
"""
Django settings for comfort_gallery project.
Generated by 'django-admin startproject' using Django 3.1.2.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
from... |
#!/usr/bin/env python
"""Threaded IMAP4 client.
Based on RFC 3501 and original imaplib module.
Public classes: IMAP4
IMAP4_SSL
IMAP4_stream
Public functions: Internaldate2Time
ParseFlags
Time2Internaldate
"""
__all__ = ("IMAP4", "IMAP4_SSL"... |
import numpy as np
import tensorrt as trt
import pycuda.driver as cuda
import pycuda.autoinit
import sys, os
TRT_LOGGER = trt.Logger()
def get_engine(onnx_file_path, engine_file_path=""):
"""Attempts to load a serialized engine if available, otherwise builds a new TensorRT engine and saves it."""
def build_eng... |
# 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... |
# 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 absolute_import
from .nodes import * |
import math
import numpy as np
from scipy.interpolate import interp1d
from copy import deepcopy
def Rosen(x1, d):
x=list(4*np.asarray(x1)-2)
sum_i = 0
for i in range(d-1):
sum_i =sum_i + (100 * ((x[i]**2) - x[i+1])**2 + (x[i] - 1)**2)
return sum_i
def Sphere(x1,d):
x=list(4*np.asarray(x1)... |
#!python3
"""
Python 3 wrapper for identifying objects in images
Requires DLL compilation
Original *nix 2.7: https://github.com/pjreddie/darknet/blob/0f110834f4e18b30d5f101bf8f1724c34b7b83db/python/darknet.py
Windows Python 2.7 version: https://github.com/AlexeyAB/darknet/blob/fc496d52bf22a0bb257300d3c79be9cd80e722cb... |
from datetime import datetime, timedelta
from .args import parse_arguments
from .ffmpeg_runner import run_ffmpeg
from .image_generator import generate_frame, generate_random_color_dvd_logo, get_scaled_dvd_logo
from .position_generator import generate_dvd_positions
def main():
args = parse_arguments()
ffmpeg ... |
# Ejercicio 1 de DGP. Realizado por :
# Ramona Verónica Moise.
# Funciones en python
# La función suma de una lista por recursión:
def suma(l):
acum=0
for x in l:
acum+=x
return acum
# La función suma de cuadrados de una lista por comprensión:
def suma_cuadrados(n):
return sum([i**2 for i ... |
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
from . import uploader_pb2 as uploader__pb2
class UploaderServiceStub(object):
"""Missing associated documentation comment in .proto file."""
def __in... |
# 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
from... |
import os
from conans import ConanFile, tools
required_conan_version = ">=1.33.0"
class VisitStructConan(ConanFile):
name = "visit_struct"
description = "A miniature library for struct-field reflection in C++"
topics = ("reflection", "introspection", "visitor", "struct-field-visitor",)
homepage = "htt... |
from xml.dom import minidom as xd
import re
from AbstractRule import AbstractRule
import os
class GuideCreatorRule(AbstractRule):
def __init__(self):
AbstractRule.__init__(self)
def execute(self):
commentTag = "//! "
startTitleTag = "//! <title>"
startDescriptionTag = "//! <descripti... |
# Copyright 2016 Husky 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 in writing, softw... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
from types import LambdaType
from apscheduler.schedulers.background import BackgroundScheduler
from typing import Optional, List, Dict, Any
from typing im... |
"""
MAP Client Plugin Step
"""
import json
from PySide2 import QtGui
from mapclient.mountpoints.workflowstep import WorkflowStepMountPoint
from mapclientplugins.gait2392somsomusclestep.configuredialog import \
ConfigureDialog
from mapclientplugins.gait2392somsomusclestep.gait2392musclecustsomso import \
Gait2... |
#!/usr/bin/env python
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# import sys
import setuptools
setuptools.setup(name='lstchain',
version=0.1,
description="DESCRIPTION",
# these should be minimum list of what is needed to run
packages=setuptools.find_packages(),
insta... |
""" Method for data manipulation in the mock db """
from flask import jsonify
from marshmallow import ValidationError
from app.api.model.party import Party
from app.api.util.dto import party_schema, parties_schema
from app.api.db.database import AppDatabase as db
def save_new_party(json_data):
"""saves a new par... |
import argparse
import os
import sys
import pprint
import itertools
import cv2
from av import open
parser = argparse.ArgumentParser()
parser.add_argument('-f', '--format')
parser.add_argument('-n', '--frames', type=int, default=0)
parser.add_argument('path', nargs='+')
args = parser.parse_args()
max_size = 24 * 60... |
class Person:
def __init__(self,fname,lname):
self.fname=fname
self.lname=lname
self.name=self.fname+self.lname
class Student(Person):
def __init__(self,fname,lname,RollNO):#We can add properties in child class like this.
#Using __init__ inside child will disable the inheri... |
"""typy fragments"""
__all__ = ("Fragment",)
class Fragment(object):
def __init__(self):
raise FragmentCannotBeInstantiated() |
"""
Very stupid bot to indicate the quantities of ingredients to prepare the desired number of piadines
Mother"s recipe for 16 piadine:
FLOUR: 700g
LARD: 100g
MILK: 175g
WATER: 175g
SWEETS YEAST: 15g
SALT: q.s.
HONEY: q.s.
"""
class Ingredient:
def __init__(self, name, quantity):
self.name = name
self.q... |
from typing import Any, Callable, Optional
from reactivex import Observable, abc, typing
from reactivex.disposable import Disposable
def from_callback_(
func: Callable[..., Callable[..., None]],
mapper: Optional[typing.Mapper[Any, Any]] = None,
) -> Callable[[], Observable[Any]]:
"""Converts a callback f... |
from enum import Enum
from typing import Dict, List
from boa3.model.builtin.interop.blockchain import *
from boa3.model.builtin.interop.contract import *
from boa3.model.builtin.interop.contract.contractmanifest import *
from boa3.model.builtin.interop.crypto import *
from boa3.model.builtin.interop.iterator import *
... |
"""SQL alchemy models for tweettweet"""
from flask_sqlalchemy import SQLAlchemy
DB = SQLAlchemy()
class Tweeter(DB.Model):
"""Twitter users that we pull and analyze tweets for"""
id = DB.Column(DB.BigInteger, primary_key=True)
handle = DB.Column(DB.String(15), nullable=False)
newest_tweet_id = DB.Colu... |
""" Create a batch of single use discount coupons from a CSV file.
Parameters: <conference> <csv-file>
Creates coupons based on the CSV file contents:
code - coupon code
max_usage - max. number of uses
items_per_usage - max number of items per use
value - value of the coupon in percent
des... |
import migraphx, struct, array, sys
try:
from functools import reduce
except:
pass
def assert_eq(x, y):
if x == y:
pass
else:
raise Exception(str(x) + " != " + str(y))
def read_float(b, index):
return struct.unpack_from('f', b, index*4)[0]
def write_float(b, index):
struct.pac... |
from controllers.GameState import state
from pygame.font import Font
from pygame.surface import Surface
from pygame.locals import *
from helpers.config import config
from helpers.loaders import load_image
import os
from definitions import ROOT_DIR
from controllers.GameState import state, PAUSE_STATE, RUNNING_STATE, GAM... |
# -*- coding: utf-8 -*-
"""
auth.py - Creates an authenticated pygsheets object
"""
# Libs
import pygsheets
import pathlib
from config import config # import config
# Grab the service account auth file location from the config
SA_auth_file = pathlib.Path(config['auth_file'])
# Create the pygsheets obj
client = p... |
"""Manifest structure used to store paths that should be included in a test run.
The manifest is represented by a tree of IncludeManifest objects, the root
representing the file and each subnode representing a subdirectory that should
be included or excluded.
"""
import glob
import os
import urlparse
from wptmanifest... |
from torch.autograd import Variable
import torch.nn.functional as F
from torch import nn
from torch import Tensor
from torch.nn import Parameter
def l2normalize(v, eps=1e-12):
return v / (v.norm() + eps)
class SpectralNorm(nn.Module):
def __init__(self, module, name='weight', power_iterations=1):
sup... |
from .api import api, candles_api, trades_api
__all__ = ["api", "trades_api", "candles_api"] |
from pathlib import Path
from setuptools import find_namespace_packages, setup
from sys import platform as _platform
import sys
VERSION="0.3.0"
current_dir = Path(__file__).resolve().parent
with open(current_dir.joinpath('README.md'), encoding='utf-8') as f:
long_description = f.read()
if _platform not in ["lin... |
"""
Tests for the HDF5 datalayer
"""
import pytest
from fiasco.io import DataIndexer
from fiasco.util.exceptions import MissingDatabaseError
def test_missingdatabase():
with pytest.raises(MissingDatabaseError):
DataIndexer.create_indexer('foo/bar.h5', '/') |
#!/usr/bin/env python
import numpy as np
from copy import deepcopy
import matplotlib.pyplot as plt
from nntable import AllCategoriesTables
from composites_utils import *
class simulator(object):
def __init__(self, db, batch_size=None, nn_table=None):
self.db = db
self.cfg = db.cfg
self.b... |
"""Functions to visualize outputs at different stages of GTSFM.
Authors: Ayush Baid
"""
import os
from typing import List, Optional, Tuple
import cv2 as cv
import matplotlib.pyplot as plt
import numpy as np
from gtsam import Pose3
from matplotlib.axes._axes import Axes
import gtsfm.utils.geometry_comparisons as comp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.