content stringlengths 0 894k | type stringclasses 2
values |
|---|---|
# Generated by Django 2.1.5 on 2019-02-07 11:53
from django.db import migrations
import modelcluster.fields
class Migration(migrations.Migration):
dependencies = [
('core', '0010_researcherpage_disciplines'),
]
operations = [
migrations.AddField(
model_name='researcherpage',... | python |
import argparse
from model.VGG import *
from model.Decoder import *
from model.Transform import *
import os
from PIL import Image
from os.path import basename
from os.path import splitext
from torchvision import transforms
from torchvision.utils import save_image
def test_transform():
transform_list = []
trans... | python |
from typing import (
TYPE_CHECKING,
Tuple,
)
import pymunk
from pymunk import (
Arbiter,
Vec2d,
)
from k_road.constants import Constants
from k_road.entity.entity_category import EntityCategory
from k_road.entity.vehicle.vehicle import Vehicle
from k_road.util import *
if TYPE_CHECKING:
from k_ro... | python |
import re
import logging
import httplib
import view_base
from models import rt_proxy
LOG = logging.getLogger('ryu.gui')
class RtAddrDel(view_base.ViewBase):
def __init__(self, host, port, dpid, address_id, status=None):
super(RtAddrDel, self).__init__()
self.host = host
self.port = port
... | python |
from django.apps import AppConfig
class ManualConfig(AppConfig):
name = 'manual'
def ready(self):
pass
| python |
# ServoBlaster.py
# ================
# ServoBlaster class initializes the servoblaster API installed on our system.
# The class is initialized by identifying the number of servos used, and each
# servo has an ID they are associated with. For now we are working with two
# servos so the id's will be: 'P1-7' & '(to be ... | python |
from settings import DEBUG
class UserForumRoleRouter(object):
def db_for_read(self, model, **hints):
if DEBUG:
if model.__name__ == 'Forum' \
or model.__name__ == 'User' \
or model.__name__ == 'Role'\
or model.__name__ == 'UserInfo' \
... | python |
import logging
import getpass
from socket import gethostname
import json
class JSONFormatter(logging.Formatter):
def format(self, record):
data = record.__dict__.copy()
if record.args:
msg = record.msg % record.args
else:
msg = record.msg
data.update(
... | python |
"""
软件架构
View:界面逻辑,例如:负责输入输出
Model:数据的抽象,例如:学生类型(姓名,年龄,成绩...)
Controller:核心业务逻辑,例如:存储,编号
"""
class View:
def __init__(self):
self.controller = Controller()
def func01(self):
self.controller.func02()
class Controller:
def func02(self):
print("func02执行了"... | python |
import torch
import numpy as np
import unittest
try:
import affogato
WITH_AFF = True
except ImportError:
WITH_AFF = False
class TestArand(unittest.TestCase):
def build_input(self):
affinity_image = np.array([[0, 0, 1, 0, 0],
[0, 0, 1, 0, 0],
... | python |
#!/usr/bin/env python
# Copyright 2011 Leonidas Poulopoulos (GRNET S.A - NOC)
#
# 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... | python |
from oeis import A001221
def test_A001221():
assert A001221(1, 6) == [0, 1, 1, 1, 1, 2]
| python |
# -*- coding: utf-8 -*-
#
# michael a.g. aïvázis <michael.aivazis@para-sim.com>
# (c) 1998-2022 all rights reserved
# publish the base implementation so users can extend
from .Factory import Factory as factory
# factories
from .Copy import Copy as cp
from .Mkdir import Mkdir as mkdir
# end of file
| python |
'''
file: GitHubAPI.py
brief: Defines a wrapper class for the GitHub RESTful API. Handles all HTTPS
requests and exception handling of those requests.
https://github.com/AlexanderJDupree/GithubNetwork
'''
import os
import requests
GITHUB_API = "https://api.github.com/"
USER = os.environ['GITHUB_USER'] if 'GI... | python |
PRODUCT_TYPES = (
"cash_carry",
"digital_content",
"digital_goods",
"digital_physical",
"gift_card",
"physical_goods",
"renew_subs",
"shareware",
"service",
)
class Order:
order_id: str
sales_tax: int
product_type: str
def __init__(self, order_id: str, sales_tax: i... | python |
#!/usr/bin/env python
import sys
import time
import functools
from fuse import FUSE
from passthroughfs import Passthrough
def report(fn):
@functools.wraps(fn)
def wrap(*params,**kwargs):
fc = "%s(%s)" % (fn.__name__, ', '.join(
[a.__repr__() for a in params] +
["%s = %s" % (a,... | python |
from typing import Any
from typing import Dict
import apysc as ap
from apysc._callable import callable_util
def test_get_func_default_vals() -> None:
def _test_func(a: int, b: int = 100, c: str = 'Hello!') -> None:
...
default_vals: Dict[str, Any] = callable_util.get_func_default_vals(
... | python |
"""Plots module."""
import numpy as np
import plotly.express as px
import plotly.graph_objects as go
import os
import pandas as pd
| python |
"""
MixUp
Source: https://github.com/hysts/pytorch_image_classification/tree/master/augmentations
"""
import numpy as np
import torch
import torch.nn as nn
def mixup(data, targets, alpha): #, n_classes):
indices = torch.randperm(data.size(0))
shuffled_data = data[indices]
shuffled_targets = targets[indi... | python |
"""High level package initialization to make classes and functions within the package visible to the user.
:author: Chris R. Vernon
:email: chris.vernon@pnnl.gov
License: BSD 2-Clause, see LICENSE and DISCLAIMER files
"""
from im3agents.farmers import FarmerOne
__all__ = ['FarmerOne']
| python |
import random
cards = {"1": "1" ,"2": "2", "3": "3", "4": "4", "5": "5", "6": "6", "7": "7",
"8": "8", "9": "9", "J": "10", "Q": "10", "K": "10", "A": "11"}
def getcard():
kart, value = random.choice(list(cards.items()))
del cards[kart]
return kart, value
def as_mi(n):
if n == 11:
r... | python |
from pathlib import Path
from appyter.ext.asyncio.run_in_executor import run_in_executor
def assert_mounted(path: Path):
assert path.is_mount()
async_assert_mounted = run_in_executor(assert_mounted)
def assert_unmounted(path: Path):
assert not path.is_mount()
async_assert_unmounted = run_in_executor(assert_unmou... | python |
__author__ = 'felix.shaw@tgac.ac.uk - 20/01/2016'
import sys
from bson.errors import InvalidId
from api.utils import get_return_template, extract_to_template, finish_request
from dal.copo_da import Person
from web.apps.web_copo.lookup.lookup import API_ERRORS
def get(request, id):
"""
Method to handle a req... | python |
import tensorflow as tf
import numpy as np
from models.blocks.resnet_block import ResnetBlock
from tensorflow.keras.layers import Activation, Input
from tensorflow.keras.layers import Conv2D
from tensorflow.keras.layers import Concatenate
from tensorflow.keras.layers import Reshape
from tensorflow.keras.models import... | python |
#!/usr/bin/env python3
import pulp
def main():
model = pulp.LpProblem("Resource allocation monitoring with cost optimisation", pulp.LpMinimize)
if __name__ == "__main__":
main()
| python |
from src.util import make_directory
from src.download_data import download_data
from src.preprocess import preprocess_data
import pandas as pd
import argparse
def request(source, name, file, variables, set_positive_longitude):
cities_info = pd.read_csv(file)
name = f'{file.split(".")[0]}/{name}'
make_dir... | python |
# Calculate the gcd using the euclidean algorithm
# Accepts either 2 numbers, or 1 list
# By using a list, the gcd of multiple numbers can be calculated
def gcd(a,b = None):
if b != None:
if a % b == 0:
return b
else:
return gcd( b, a % b)
else:
for i in range(len... | python |
"""Library for controlling an Apple TV."""
import asyncio
import logging
import concurrent
from ipaddress import ip_address
from threading import Lock
from zeroconf import ServiceBrowser, Zeroconf
from aiohttp import ClientSession
from . import (conf, exceptions)
from .airplay import player
from .airplay.api import ... | python |
import cv2
# Load the cascade
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
# Read the input image
img = cv2.imread('group_face.jpg')
# Convert into grayscale
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
# Detect faces
faces = face_cascade.detectMultiScale(gray, 1.3, 5)
... | python |
import unittest
from tests.TestSupport.Utilities import RedirectStreams
import EXOSIMS.StarCatalog
from EXOSIMS.StarCatalog.GaiaCat1 import GaiaCat1
from EXOSIMS.util.get_module import get_module
import os, sys
import pkgutil
from io import StringIO
import astropy.units as u
from EXOSIMS.util.get_dirs import get_downlo... | python |
from app.models import User
from unittest import mock
class TestLogin:
def test_should_access_login_return_status_200(self, client):
response = client.get('/login', follow_redirects=True)
assert 200 == response.status_code
def test_should_login_return_field_required_when_not_inform_email(sel... | python |
#!/usr/bin/env python
"""The setup script."""
from setuptools import setup, find_packages
exec(open("fishsound_finder/_version.py").read())
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read()
# automatically captured ... | python |
# -*- coding:utf-8 -*-
from app import db
ROLE_USER = 0
ROLE_ADMIN = 1
class User(db.Model):
id = db.Column(db.Integer, primary_key = True)
nickname = db.Column(db.String(64), index = True, unique = True)
email = db.Column(db.String(120), index = True, unique = True)
role = db.Column(db.SmallInteger,... | python |
#!/usr/bin/python
import numpy as np
import helpfunctions as hlp
import math
class inner:
"""Class whose constructor generates a particle system to be used
for nested SMC procedure on the row space.
Constructor
Parameters
----------
y : 1-D array_like
Measurements.
N : int... | python |
from sklearn.utils.estimator_checks import check_estimator
from automllib.under_sampling import ModifiedRandomUnderSampler
def test_modified_random_under_sampler() -> None:
check_estimator(ModifiedRandomUnderSampler)
| python |
import adv_test
from adv import *
def module():
return Irfan
class Irfan(Adv):
pass
if __name__ == '__main__':
conf = {}
conf['acl'] = """
`rotation
"""
conf['rotation_init'] = """
c4fs c4fs c1
"""
conf['rotation'] = """
S1 C4FS C4FS C1- S1 C2- S2 C4FS C5- S3 ... | python |
"""
File: bouncing_ball.py
Name: Isabelle
-------------------------
The file shows how to start bouncing by mouse clicking
and the process of bouncing
"""
from campy.graphics.gobjects import GOval
from campy.graphics.gwindow import GWindow
from campy.gui.events.timer import pause
from campy.gui.events.mouse... | python |
import app.views.password_resets.urls
| python |
#
# Copyright 2021 Ocean Protocol Foundation
# SPDX-License-Identifier: Apache-2.0
#
class ConfigSections:
"""
This class contains values for:
1. `OCEANBD`
2. `RESOURCES`
"""
OCEANBD = "oceandb"
RESOURCES = "resources"
class BaseURLs:
"""
This class contains values for:
... | python |
# 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... | python |
""" Userbot module for having some fun with people. """
import asyncio
import random
import re
import time
from collections import deque
import requests
from telethon.tl.functions.users import GetFullUserRequest
from telethon.tl.types import MessageEntityMentionName
from userbot import ALIVE_NAME
from userbot imp... | python |
"""
MIT License
Copyright (c) 2021 mooncell07
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, di... | python |
# -*- coding: utf-8 -*-
from __future__ import division
from __future__ import print_function
import os
import sys
import unittest
import shutil
# temporary solution for relative imports in case TDC is not installed
# if TDC is installed, no need to use the following line
sys.path.append(os.path.abspath(os.path.joi... | python |
##############################
# Name: compass.py
# Author: Patrick Conlon
# Date: 07/24/2017
# Description:
# Simple script that just obtains the data from the compass chipset.
##############################
from microbit import *
###
# Function : calibrateCompass
# Description : clear and calibrate the compass on th... | python |
#!/usr/bin/env python
'''
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")... | python |
"""
(c) Copyright JC 2018-2020 All Rights Reserved
-----------------------------------------------------------------------------
File Name :
Description :
Author : JC
Email : lsdvincent@gmail.com
GiitHub : https://github.com/lsdlab
--------------------------------------------------... | python |
import csv
import time
from typing import Dict
from tqdm import tqdm
from transformers import (
AutoModelForSeq2SeqLM,
AutoTokenizer,
TrainingArguments,
Trainer,
)
import data_operations
from crypto_news_dataset import CryptoNewsDataset
import torch
import os
from metrics import calculate_rouge, calcul... | python |
class Vehiculo:
def __init__(self, marca, modelo):
self.marca = marca
self.modelo = modelo
self.enMarcha = False
self.acelera = False
self.frena = False
def arrancar(self):
self.enMarcha = True
def acelerar(self):
self.acelera = True
def frenar... | python |
match = 1
mismatch = -1
openGap = -10
gapExtension = -1
def first_gap_position(s):
for i in range(len(s)):
if s[i] == '-':
return i
return len(s)
def pairwise_alignment(s1, s2):
# s1[i] is aligned to s2[j]
a = [[0 for x in range(len(s1)+1)] for y in range(len(s2)+1)]
# s1[i... | python |
# Extrapolate trainingsdata from data foundation and apply to relevant members
class Trainings:
# Extrapolate trainings data from data foundation
def Get_Data(self, data, training_sheet, gren_sheet, _style_sheet):
print(f'Processing Training Fee Data for:')
multi_gren_clubs = {'Status': Fals... | python |
# This file is automatically generated during the generation of setup.py
# Copyright 2020, canaro
author = 'Jason Dsouza <jasmcaus@gmail.com>'
version = '1.0.8'
full_version = '1.0.8'
release = True
contributors = ['Jason Dsouza <jasmcaus@gmail.com>']
| python |
from logging import log
from config import data_db_schema,data_mono
from repositories import DataRepo
from utilities import LANG_CODES
import logging
from logging.config import dictConfig
log = logging.getLogger('file')
repo = DataRepo()
class MonolingualModel:
def __init__(self):
self.db = data_db_s... | python |
from django.contrib import admin
from .models import Item
# register to site view
admin.site.register(Item) | python |
class print_result:
def __init__(self):
pass
def print_result_all(self, contents, result):
print(contents, ':', result) | python |
import streamlit as st
import pandas as pd
import numpy as np
from sklearn.metrics.pairwise import cosine_similarity
import plotly.express as px
from modules import topic_identify
import base64
from io import BytesIO
from sentence_transformers import SentenceTransformer
st.set_option('deprecation.showPyplotGlobalUse', ... | python |
from django.db import models
from django.utils.translation import gettext_lazy as _
class TimeStampedModel(models.Model):
"""
TimeStampedModel is the base abstract class to be used for all models with
this project.
"""
created = models.DateTimeField(_("Created"), auto_now_add=True)
modified =... | python |
from pycu.driver import device_primary_ctx_retain, device_primary_ctx_release, ctx_set_current, ctx_synchronize, ctx_create, ctx_destroy, ctx_push_current, ctx_pop_current
import threading
import weakref
from collections import defaultdict
class _ContextStack(threading.local):
def __init__(self):
super().__init__(... | python |
from flask import Blueprint, request, jsonify
import logging
blueprint = Blueprint('health_check', __name__, url_prefix='/api/health')
@blueprint.route('/')
def health_check():
logging.info('Health check')
return jsonify({'status': 'ok'}) | python |
import numpy as np
import matplotlib.pyplot as plt
func = np.poly1d(np.array([1, 2, 3, 4]).astype(float))
x = np.linspace(-10, 10, 30)
y = func(x)
func1 = func.deriv(m=1)
y1 = func1(x)
func2 = func.deriv(m=2)
y2 = func2(x)
plt.subplot(311)
plt.plot(x, y, 'r-')
plt.title("Polynomial")
plt.subplot(312)
plt.plot(x, y1, ... | python |
"""
Helpers and wrappers that make usages of mars_util more consistent.
"""
import os.path
from typing import Any, List, Optional, Union
import yaml
from mars_util.job_dag import JobDAG
from mars_util.task import PrestoTask
from mars_util.task.destination import PrestoTableDestination
import src.jobs.whereami
PRESTO... | python |
import os
import torch
from torchvision.utils import save_image
from config import *
from dataset import get_div2k_loader
from models import Generator_SRGAN, Generator_ESRGAN
from utils import denorm
# Device Configuration #
device = 'cuda' if torch.cuda.is_available() else 'cpu'
def single_inference():
# Inf... | python |
'''
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2016, Telestax Inc and individual contributors
* by the @authors tag.
*
* This 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; ei... | python |
import gin
import numpy as np
import torch
import torch.optim as optim
from basics.abstract_algorithms import RecurrentOffPolicyRLAlgorithm
from basics.summarizer import Summarizer
from basics.actors_and_critics import MLPTanhActor, MLPCritic
from basics.replay_buffer_recurrent import RecurrentBatch
from basics.utils... | python |
import sublime
import sublime_plugin
from ..settings import get_setting
class InsertPhpConstructorPropertyCommand(sublime_plugin.TextCommand):
'Inserts a constructor argument that sets a property.'
placeholder = 'PROPERTY'
def description(self):
'The description of the command.'
return '... | python |
from django.urls import reverse
from rest_framework.test import APITestCase
from .models import User
class APITests(APITestCase):
def test_list_user_status_ok(self):
"""
Ensure we got a status 200 when listing users
"""
url = reverse("user-list")
response = self.client.get... | python |
from django.apps import AppConfig
class MonitoringDbApiConfig(AppConfig):
name = 'monitoring_db_api' | python |
import pytest
from indy_common.constants import RS_ID, RS_VERSION, RS_NAME, RS_CONTENT, RS_TYPE, \
GET_RICH_SCHEMA_OBJECT_BY_METADATA
from indy_common.types import Request
from indy_node.server.request_handlers.read_req_handlers.rich_schema.get_rich_schema_object_by_metadata_handler import \
GetRichSchemaObjec... | python |
import os
import time
import tempfile
from django.core.files.base import ContentFile
def getSizes(settings):
if "sizes" in settings:
if isinstance(settings["sizes"], list) and all(isinstance(x, list) for x in settings["sizes"]):
return settings["sizes"]
return [[1600, 900]]
def generateL... | python |
#
# Collective Knowledge (individual environment - setup)
#
# See CK LICENSE.txt for licensing details
# See CK COPYRIGHT.txt for copyright details
#
# Developer: Grigori Fursin, Grigori.Fursin@cTuning.org, http://fursin.net
#
import os
##############################################################################
# ... | python |
from django.db import models
from django.conf import settings
from projects.models import Project
# Create your models here.
User = settings.AUTH_USER_MODEL
class BalanceManager(models.Manager):
def add_new(self, cart):
try:
for i in cart:
p_id = i.get('projects')
p... | python |
########
# Copyright (c) 2017 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
#
# Unless... | python |
import xmltodict
import json
reply = """
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/21.2R0/junos" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101">
<zones-information xmlns="http://xml.juniper.net/junos/21.2R0/junos-zones" junos:style="detail">
<zones-security>
<zones-security-zonename>... | python |
#!/usr/bin/python3
# coding: utf8
"""
Global definition of pin numbers.
"""
# Serial Clock (shared between thermocouples)
CLK = 21
# First thermocouple - Chip Select and Serial Output
CS1 = 12
SO1 = 5
# Second thermocouple - Chip Select and Serial Output
CS2 = 6
SO2 = 13
# Third thermocouple - Chip Select and ... | python |
"""
Tests for the measure module
"""
import star
import numpy as np
import math
import pytest
def test_calculate_distance():
r1 = np.array([0, 0, 0])
r2 = np.array([0, 1, 0])
expected_distance = 1
calculated_distance = star.calculate_distance(r1, r2)
assert expected_distance == calculated_distance
##assert ... | python |
from django.urls import path
from . import views
app_name = 'message'
urlpatterns = [
path('<slug:username>/', views.index_view, name='index'),
path('<slug:username>/create', views.create_view, name='create'),
] | python |
from flask_wtf import FlaskForm
from wtforms import StringField, FloatField
from wtforms.validators import InputRequired
class InputForm(FlaskForm):
convert_from = StringField("Converting from", validators=[InputRequired()])
convert_to = StringField("Converting to", validators=[InputRequired()])
amount = F... | python |
"""
Problem 005 on CSPLib
Examples of Execution:
python3 LowAutocorrelation.py
python3 LowAutocorrelation.py -data=16
"""
from pycsp3 import *
n = data or 8
# x[i] is the ith value of the sequence to be built.
x = VarArray(size=n, dom={-1, 1})
# y[k][i] is the ith product value required to compute the kth auto... | python |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import logging
import torch
import torch.nn as nn
import models
BN_MOMENTUM = 0.1
logger = logging.getLogger(__name__)
class PoseDAResNet(nn.Module):
def __init__(self, cfg, is_train):
... | python |
from setuptools import setup, find_packages
setup(
name="mvtech_al",
version="2.3.0",
description="Anomaly Localization on MVTech images",
url="",
author="Shrihari Muttagi",
author_email="meetshrihari@gmail.com",
packages=["mvtech_al"],
) | python |
from unittest import TestCase
from mock import Mock, call, patch
import os
from home_greeter.tweeter import Tweeter
class TestTweeter(TestCase):
def setUp(self):
self.mock_tweepy = Mock(autospec='tweepy')
self.tweeter = Tweeter(api=self.mock_tweepy)
def test_create(self):
self.assertIs... | python |
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 2.0.11
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info
if version_info >= (2,6,0):
def swig_import_helper():
from os.path impo... | python |
##
# Copyright (c) 2013-2015 Apple 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 l... | python |
import logging
import os
import shutil
from tempfile import mkdtemp
from pandas import Timestamp
from pandas.io.pickle import read_pickle as pd_read_pickle
from pandas.io.pickle import to_pickle as pd_to_pickle
from featuretools import variable_types as vtypes
logger = logging.getLogger('featuretools.entityset')
_d... | python |
from unittest import TestCase, mock
import numpy as np
from copulas.bivariate.base import Bivariate, CopulaTypes
from tests import compare_nested_dicts
class TestBivariate(TestCase):
def setUp(self):
self.X = np.array([
[0.2, 0.3],
[0.4, 0.4],
[0.6, 0.4],
... | python |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 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
#
# Unle... | python |
import streamlit as st
import utils
from classrad.evaluation.evaluator import Evaluator
from classrad.config import config
def show():
"""Shows the sidebar components for the template and returns
user inputs as dict."""
with st.sidebar:
pass
# LAYING OUT THE TOP SECTION OF THE APP
col1, ... | python |
from abc import ABCMeta, abstractmethod
class IVisitor(metaclass=ABCMeta):
def visit(self, element):
if isinstance(element, Building):
self._visit_building(element)
elif isinstance(element, Floor):
self._visit_floor(element)
elif isinstance(element, Room):
... | python |
from Qt import QtWidgets, QtCore
from .base import InputWidget
from .widgets import ExpandingWidget
from .lib import (
BTN_FIXED_SIZE,
CHILD_OFFSET
)
from avalon.vendor import qtawesome
class EmptyListItem(QtWidgets.QWidget):
def __init__(self, entity_widget, parent):
super(EmptyListItem, self).... | python |
from setuptools import setup, find_packages
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name="capi",
version="0.1.0",
author="Samuel Sokota",
license="LICENSE",
description="Example implementation of CAPI",
long_description=long_description,
long_description_... | python |
import arcpy
def pprint_fields(table):
""" pretty print table's fields and their properties """
def _print(l):
print("".join(["{:>12}".format(i) for i in l]))
atts = ['name', 'aliasName', 'type', 'baseName', 'domain',
'editable', 'isNullable', 'length', 'precision',
'required... | python |
import opcode
import dis
import weakref
import types
from funes.logging import logging
# this will store hashes and global lists for functions / values,
# without preventing them from being GC'd
code_object_global_names_cache = weakref.WeakKeyDictionary()
STORE_GLOBAL = opcode.opmap['STORE_GLOBAL']
DELETE_GLOBAL = ... | python |
import click
import yaml
from freezeyt.freezer import freeze
from freezeyt.util import import_variable_from_module
@click.command()
@click.argument('module_name')
@click.argument('dest_path', required=False)
@click.option('--prefix', help='URL of the application root')
@click.option('--extra-page', 'extra_pages', mu... | python |
#
# PySNMP MIB module CISCO-ATM-IF-PHYS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-ATM-IF-PHYS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:50:39 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... | python |
from .main import *
from .LINEAPI import LINE, Channel, OEPoll
from .LINEBASE.ttypes import OpType
from .GAMES import cows_and_bulls, tic_tac_toe
__copyright__ = 'Copyright 2021 by Light Technology'
__version__ = '1.0.1'
__license__ = 'MIT'
__author__ = 'Light Technology'
__author_email_... | python |
# -*- coding: utf-8 -*-
import phantom.app as phantom
from phantom.base_connector import BaseConnector
from phantom.action_result import ActionResult
# Usage of the consts file is recommended
# from mark2server_consts import *
import requests
import json
import tempfile
import os
class RetVal(tuple):
def __new_... | python |
from discord import ChannelType, Message, TextChannel, Thread
from discord.abc import Snowflake
from discord.ext.commands import Context as _BaseContext
class Context(_BaseContext):
"""A Custom Context for extra functionality."""
async def create_message_thread(
self, name: str, *, auto_archive_durat... | python |
import dqcsim._dqcsim as raw
from dqcsim.common.handle import Handle
class QubitSet(object):
@classmethod
def _from_raw(cls, handle): #@
with handle as hndl:
qubits = []
while raw.dqcs_qbset_len(hndl) > 0:
qubits.append(raw.dqcs_qbset_pop(hndl))
return qu... | python |
# -------------------------------
# UFSC - CTC - INE - INE5663
# Exercício da Matriz de Inteiros
# -------------------------------
# Classe que permite exibir informações sobre uma matriz.
#
from view.util import mostra_matriz
class PainelAnalisaMatriz:
def analise(self, matrizes):
print('- - - Analisand... | python |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os.path
from io import BytesIO
import datetime
import pytz
import re
import json
import requests
import urllib
import csv
import pandas as pd
import numpy as np
import hashlib
from django.apps import apps
from django.views.generic... | python |
#!/usr/bin/python
import cv2
import sys
import os
from cv2 import cv
import numpy as np
def showme(pic):
cv2.imshow('window',pic)
cv2.waitKey()
cv2.destroyAllWindows()
def main(argv):
inputfile = 'test/test-tmp-1-34227-polygon-extracted.tif'
if len(argv) == 1:
inputfile = argv[0]
ci... | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.