content stringlengths 5 1.05M |
|---|
import json
from django.shortcuts import render
from django.views.generic import TemplateView, View, FormView
from django.http import JsonResponse
from django.db.models import Q
from django.http import Http404
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import ensure_csrf_coo... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
"""
//******************************************************************************************
// SGDI, Práctica 1, Apartado 4: INDEX
// Dan Cristian Rotaru y Gorka Suárez García
//******************************************************************************************
Ut... |
from aiogram import Bot, Dispatcher
from settings import API_TOKEN
bot = Bot(token=API_TOKEN)
dp = Dispatcher(bot=bot)
|
import numpy as np
import scipy.stats as stats
from hic3defdr.util.scaled_nb import logpmf, fit_mu_hat
def lrt(raw, f, disp, design, refit_mu=True):
"""
Performs a likelihood ratio test on raw data ``raw`` given scaling factors
``f`` and dispersion ``disp``.
Parameters
----------
raw, f, dis... |
import instatools.base.payload_formatter as payload_formatter_base
import instatools.auth.password_credentials as password_credentials
class InstagramWebPayloadFormatter(payload_formatter_base.PayloadFormatter):
@staticmethod
def generate(instance):
payload = {}
if isinstance(instance, pa... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from pyqir.generator import BasicQisBuilder, SimpleModule
mod = SimpleModule("if", num_qubits=2, num_results=2)
qis = BasicQisBuilder(mod.builder)
# Manually reset a qubit by measuring it and applying the X gate if the result
# is one.
qis.h(mo... |
# Copyright 2009 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 agreed to in writing, ... |
from operator import itemgetter
from random import randint
# from runlocal import evaluate as run_evaluate
import random
from aletheia.settings import BASE_DIR
import json
import os
import shutil
import math
class Gene:
def __init__(self, **data):
self.__dict__.update(data)
self.size = len(data['d... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------------------------
import unittest
import numpy as np... |
# Generated by Django 3.0.5 on 2020-05-05 21:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='safariaccount',
options={'verbose_n... |
from sklearn.ensemble import RandomForestRegressor
from sklearn.datasets import make_regression
import pandas as pd
import numpy as np
from sklearn import preprocessing
from sklearn.model_selection import train_test_split
import numpy as np, tensorflow as tf
from sklearn.preprocessing import OneHotEncoder
impor... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 4 14:26:28 2020
@author: apramanik
"""
from torch.utils.data import DataLoader
import numpy as np
import os, torch
import matplotlib.pyplot as plt
from tst_dataset import cardiacdata
from Auto3D_D4 import Auto3D
def dice_comp(pred, gt):
re... |
# -*- coding: utf-8 -*-
"""Naive Bayes python implementation.
Homework of IoT Information processing Lab 2. A simple implementation
of Naive Bayes algorithm.
Example:
$ python NaiveBayes.py
$ python NiaveBayes.py -k num_of_iterations
$ python NaiveBayes.py -k 25
Author: Yongjian Hu
License: MIT License
"... |
def doctree_resolved(app, doctree, docname):
for node in doctree.traverse():
if (node.astext() == 'inline' and node.parent.tagname == 'desc_signature_line'):
node.parent.remove(node)
def setup(app):
app.connect('doctree-resolved', doctree_resolved)
|
"""
@author: Alex Kerr
"""
import numpy as np
def main():
a = 1.40
posList, zList = get_sites(a)
nList = [[1],[0,2,3],[1],[1,4],[3]]
return posList,nList,zList
def get_sites(a):
c0 = np.array([0.,0.,0.])
c1 = c0 + a*np.array([1.,0.,0.])
o2 = c1 + a*np.... |
import functools
import jwt
import os
import uuid
from validator_collection.checkers import is_uuid
from flask import request, g
from .controllers import format_response
from .models import User, Task
def token_required(func):
""" Check if the client has the required token for access the api """
@functools.w... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from enum import Enum, auto
from codegen.passes import *
from codegen.mir import *
from codegen.spec import *
from codegen.live_intervals import cmp_interval_start_func, cmp_inst_func
from codegen.live_intervals import LiveIntervals
class Spiller:
def __init__(self):... |
from typing import Optional, Union, Sequence
from slack_sdk.web import WebClient
from slack_sdk.models.blocks import Block
class Configure:
def __init__(self, *, callback_id: str, client: WebClient, body: dict):
self.callback_id = callback_id
self.client = client
self.body = body
def... |
# -*- coding: utf-8 -*-
#Lista05 - Fila - Questão 08
#Mayara Rysia
"""
8. Em certas aplicações do TAD fila, é comum repetidamente realizar dequeue e então, imediamente, realizar enqueue com o
mesmo elemento. Modifique a implementação FilaArray para incluir um método rodar() que deve ser semanticamente
identifico a f.e... |
import pytest
import tenseal as ts
def test_context_creation():
context = ts.context(ts.SCHEME_TYPE.BFV, 8192, 1032193)
assert context.is_private() is True, "TenSEALContext should be private"
assert context.public_key() is not None, "TenSEALContext shouldn't be None"
def test_make_context_public():
... |
# Generated by Django 3.1.3 on 2020-12-09 00:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bulletin', '0002_article_article_image'),
]
operations = [
migrations.AddField(
model_name='article',
name='is_featu... |
#Import Libraries
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import matplotlib.pylab as pl
#Functions
def test_plot(str_values):
print('plot undeformed structure to verify original design')
fig = plt.figure() #setup the plot
fig.subplots_adjust(bottom=0,top=... |
# -*- coding: utf-8 -*-
from wemake_python_styleguide.types import final
from wemake_python_styleguide.violations.consistency import (
FormattedStringViolation,
)
from wemake_python_styleguide.visitors.base import BaseNodeVisitor
@final
class WrongStringVisitor(BaseNodeVisitor):
"""Restricts to use ``f`` str... |
from aioify import aioify
from discord.ext import commands, tasks
import aiohttp
import aiosqlite
import asyncio
import discord
import json
import os
import shutil
class Events(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.os = aioify(os, name='os')
self.shutil = aioify(shuti... |
# -*- coding: utf-8 -*
# @Time : 2020/12/22 17:29
from motor.motor_asyncio import AsyncIOMotorClient
class MotorClient:
client: AsyncIOMotorClient = None
mongodb_ = MotorClient()
async def get_async_motor() -> AsyncIOMotorClient:
return mongodb_.client
|
"""Remove resource and person from slots
Revision ID: 55cc7870b02a
Revises: 3b1769f1cfdb
Create Date: 2014-03-29 20:20:50.274118
"""
# revision identifiers, used by Alembic.
revision = '55cc7870b02a'
down_revision = '3b1769f1cfdb'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.drop_column("s... |
import os
from datetime import datetime
import muons
from matplotlib import pyplot as plt
folder = "data"
name = "pi_data"
# Raspberry pi time lags behind by this amount. Need to adjust it to align with weather data and other muon data.
time_offset = 365760
# Only get data from files with "pi_data" in their names.
fil... |
#!/usr/bin/env python3
from ruamel.yaml import YAML, dump, RoundTripDumper
#
import os
import math
import argparse
import time
import numpy as np
from rpg_baselines.envs import tcn_mlp_ae_vec_env_wrapper as wrapper
import rpg_baselines.common.util as U
#
from flightgym import QuadrotorEnv_v1
def parser():
parse... |
import utils.util as util
from generation.structures.baseStructure import *
class GeneratedWell(BaseStructure):
def __init__(self) :
super(BaseStructure, self).__init__()
self.uselessBlocks = [
'minecraft:air', 'minecraft:cave_air', 'minecraft:water', 'minecraft:lava'
'minecraft:oa... |
from typing import Generic, List, TypeVar
T = TypeVar('T')
class Graph(Generic[T]):
def __init__(self) -> None:
self.__graph = {}
def addNode(self, node: T) -> None:
if node not in self.__graph:
self.__graph[node] = []
def addDirectedEdge(self, src: T, dest: T) ... |
try:
with open("input.txt", "r") as fileContent:
drawnNumbers = [drawnNumber.strip("\n")
for drawnNumber in fileContent.readline().split(",")]
bingoCards = [line.strip("\n").strip().split() for line in fileContent.readlines()
if line.strip("\n")]
... |
# This list of imports is likely incomplete --- add anything you need.
# TODO: Your code here.
import torch
import torch.nn as nn
from allennlp.nn.util import masked_softmax
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
from allennlp.nn.util import sort_batch_by_length
from allennlp.nn.util i... |
import random
from simulators.constants_and_packages import *
def init_message_boxes(agents, iterations):
for agent in agents:
agent.message_box = {
itr: {
nei.name: {} for nei in agent.neighbours
}
for itr in range(iterations)
}
def load_file... |
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_equal
import chainladder as cl
from rpy2.robjects.packages import importr
from rpy2.robjects import r
CL = importr('ChainLadder')
@pytest.fixture
def atol():
return 1e-5
def mack_r(data, alpha, est_sigma):
return r('mack<-Mack... |
#
# Copyright 2021. Clumio, Inc.
#
from typing import Any, Dict, Mapping, Optional, Sequence, Type, TypeVar
T = TypeVar('T', bound='ComplianceStatsDeprecated')
class ComplianceStatsDeprecated:
"""Implementation of the 'ComplianceStatsDeprecated' model.
ComplianceStatsDeprecated denotes compliance metrics f... |
"""
This file defines:
-quad_area_centroid (method)
- CHEXA8 (class)
- f1
- f2
"""
import numpy as np
from numpy import arange, cross, abs, searchsorted, array, ones, eye
from numpy.linalg import norm # type: ignore
from pyNastran.bdf.field_writer_8 import print_card_8
from pyNastran.bdf.bdf_interface.as... |
def main():
secret_number = 777
print(
"""
+================================+
| Welcome to my game, muggle! |
| Enter an integer number |
| and guess what number I've |
| picked for you. |
| So, what is the secret number? |
+==============... |
#! /usr/bin/python
# -*- coding: utf8 -*-
import deeptensor as dt
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torchvision
import horovod.torch as hvd
# Init horovod
dt.train.init_library()
# Configuration
cfg = dt.config.Config(name="ImageNet")
ARGS = cfg.opt... |
import abc
import collections.abc
import socket
__all__ = ['get_socket_type', 'get_server_socket', 'get_client_socket',
'SocketReader', 'SocketWriter', 'JSONReader', 'JSONWriter']
def get_socket_type(host=None, ip_type=None):
if ip_type is not None:
return ip_type
if host and ':' in host... |
#!/usr/bin/env python3
from harness import HttpError, UsersClient, PermissionsClient
from common import *
# print('user: {} secret: {}'.format(client_user_id, client_user_secret))
if args.action == 'user-add':
role_set = args.role_set
engine_id = args.engineid
users_client = UsersClient(
url=url... |
from django.db import models
from django.forms import ModelForm
class Placeholder(models.Model):
location = models.SlugField(max_length=50, unique=True, help_text=
"""This field must match the argument given in {% editable %} tag. Use only letters, number, underscores or hyphens only. Must be a unique name""")
cont... |
"""Code for checking if deployment is possible via CLI"""
import logging
import click
from shipping.commands import Process
from shipping.configs.base_config import AppConfig, HostConfig
from shipping.deploy.conda import check_if_deploy_possible
from shipping.environment import get_python_path
from shipping.log impo... |
import torch
import torchaudio
import torchaudio.functional as F
print(torch.__version__)
print(torchaudio.__version__)
import math
import os
import requests
import matplotlib.pyplot as plt
from IPython.display import Audio, display
_SAMPLE_DIR = "_sample_data"
SAMPLE_WAV_URL = "https://pytorch-tutorial-assets.s3... |
# set this to the full path to the dashvend respository checkout
DASHVEND_DIR = '/home/pi/dashvend'
# note: also update paths in:
# bin/.init.d.dashvend
# bin/_dashvend_control.sh
# bin/dashvend_screens.screenrc
# bin/show_screen_number.sh
# after testing, set this to True to use mainnet
MAINNET = False
# **p... |
files = """
bdg_math.cpp
bdg_math.h
bdg_random.cpp
bdg_random.h
button.cpp
button.h
city.cpp
city.h
constants.h
coord.cpp
coord.h
gameclock.cpp
gameclock.h
hsv.cpp
hsv.h
kruskal.cpp
kruskal.h
layers.h
main.cpp
mode_highway.cpp
mode_highway.h
modes.h
node.cpp
node.h
nodemgr.cpp
nodemgr.h
scree... |
# Copyright (c) 2017, Zebula Sampedro, CU Boulder Research Computing
"""
Singularity Spawner
SingularitySpawner provides a mechanism for spawning Jupyter Notebooks inside of Singularity containers. The spawner options form is leveraged such that the user can specify which Singularity image the spawner should use.
A ... |
import sys
import cftime
import numpy as np
import numpy.matlib as npm
import pytest
import xarray as xr
@pytest.fixture
def dset():
start_date = np.array([0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334], dtype=np.float64)
start_date = np.append(start_date, start_date + 365)
end_date = np.array([3... |
from flask import Flask
def create_app():
from . import routes, models
# create and configure the app
app = Flask(__name__, instance_relative_config=True)
app.config["SQLALCHEMY_DATABASE_URI"] = f"sqlite:////{app.instance_path}/url.db"
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
route... |
# -*- coding: utf-8 -*-
"""
Created on Fri May 8 17:24:59 2020
@author: Nikki Frazer
Student Number: 1003111116
"""
import numpy as np
from scipy.integrate import solve_ivp
import matplotlib.pyplot as plt
#Question 1
#create the basic plot
def divergent(x:int, y:int, iteration_count:int):
"""Given ... |
# Copyright 2021 UChicago Argonne, LLC
# Author:
# - Haoyu Wang and Roberto Ponciroli, Argonne National Laboratory
# - Andrea Alfonsi, Idaho National Laboratory
# 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 o... |
from .attrib_base import AttributeBase, AttributeLengthError
__all__ = ['AttributeDeprecated']
class AttributeDeprecated(AttributeBase):
def __init__(self, type_index, parent):
AttributeBase.__init__(self, type_index, parent)
if self.length:
raise AttributeLengthError
|
'''
Created on 22 Feb 2018
@author: Anna
'''
from setuptools import setup
setup(name="sysinfo",
version="0.1",
description="Basic system information for COMP30670",
author="Anna Ryzova",
author_email="anna.ryzova@ucdconnect.ie",
license="GPL3",
packages=['systeminfo'],... |
#Bisection method to find a real root of an equation***********
a,b=input ('enter the value of a and b')
maxitr=input('enter the no. of iterations')
itr=0
print("itr, a, b, x, fx")
func= lambda x: x**3+x-1
while itr<maxitr:
x=(a+b)/2.0
fa=func(a)
fx=func(x)
if fa*fx<0.0:
b=x
else:
a=... |
import aiohttp
import asyncio
from typing import Optional, List
from .abstractions import TelemetryChannel
from ..exceptions import OperationFailed
from ..utils.json import friendly_dumps
class AiohttpTelemetryChannel(TelemetryChannel):
def __init__(self,
loop:Optional[asyncio.AbstractEventLoop]... |
"""
A bit easier than yesterday, I simply solved the puzzle by using np.where in a loop. The main thing is that we need to
take into account the borders of the array and that I used a separate mask array to keep track of the octopi that
flashed during this turn. After correctly implementing part 1, part 2 was easy, jus... |
from django_filters.rest_framework import DjangoFilterBackend, FilterSet
from rest_framework import filters, viewsets
from .models import Question
from .pagination import QuestionPagination
from .permissions import QuestionPermission
from .serializers import QuestionSerializer
from .throttles import BurstCommunityRate... |
#!/usr/bin/python
# BSD 3-Clause License
# Copyright (c) 2019, Noam C. Golombek
# 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 code must retain the above copyright... |
# -*- coding: utf-8 -*-
# Copyright (C) 2006-2007 Søren Roug, European Environment Agency
#
# This library 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 2.1 of the License, or (at you... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2019, 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... |
import json
import os
import re
import subprocess
from itertools import groupby
import tensorflow as tf
class Wav2Vec2Processor:
def __init__(
self, is_tokenizer, do_normalize=True, vocab_path="./vocab.json"
):
# whether to use as `feature_extractor` or `tokenizer`
self.is_tokenizer ... |
# Generated by Django 2.0 on 2018-01-27 07:55
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.Crea... |
import click
from natsort import natsorted
from tabulate import tabulate
from swsscommon.swsscommon import SonicV2Connector
import utilities_common.cli as clicommon
CHASSIS_MODULE_INFO_TABLE = 'CHASSIS_MODULE_TABLE'
CHASSIS_MODULE_INFO_KEY_TEMPLATE = 'CHASSIS_MODULE {}'
CHASSIS_MODULE_INFO_DESC_FIELD = 'desc'
CHASSIS... |
import functools
import urlparse
class require_role(object):
def __init__(self, role):
self.role = role
def __call__(self, method):
@functools.wraps(method)
def wrapper(handler, *args, **kwargs):
if not handler.current_user:
url = handler.get_login_url()
... |
"""
ID: piraadw1
LANG: PYTHON3
TASK: [Task Name]
"""
fin = open ('[Task Name].in', 'r')
fout = open ('[Task Name].out', 'w')
fout.write([send to server])
fout.close()
|
''' TMP36 temperature sensor
2017-0802 PePo initial version
Let op: verwissel Vs en GND niet van de TMP36!
pin TMP36 NodeMCU Huzzah ESP8266
data-out A0 ADC
Vs 3.3V 3.3V
GND GND GND
#'''
import machine, time
import ssd1306
#import heartbeat #diagnostic tool
# using from... |
class Solution:
def longestPalindrome(self, s: str) -> int:
str_dict={}
for each in s:
if each not in str_dict:
str_dict[each]=0
str_dict[each]+=1
result=0
odd=0
for k, v in str_dict.items():
if v%2==0:
resul... |
from datetime import date
from factory import DjangoModelFactory, Faker, SubFactory, fuzzy, post_generation
from tests.models import Article, EarningsReport, NewsAgency, Place, Publication, Reporter, Restaurant, Waiter
class PlaceFactory(DjangoModelFactory):
address = Faker('street_address')
name = Faker('c... |
#!/usr/bin/python
from __future__ import unicode_literals
# https://stackoverflow.com/questions/19475955/using-django-models-in-external-python-script
from django.core.management.base import BaseCommand, CommandError
import sys
import datetime
from django.utils import timezone
from provision.models import Activity, Ac... |
import os
import numpy as np
import pandas as pd
import multiprocessing
from PIL import Image
from sklearn.metrics import pairwise_distances
from lib.image_lib import preprocess
from lib.image_lib import center_of_mass
LEVEL = 'level'
PRETRAIN = 'pre-train'
def find_start_end(profile):
start = None
end = ... |
# Copyright 2020- Robot Framework 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 ag... |
import os
from modules.base_crawler import Base_Crawler
from modules.csv_module.csv_helper import read_clothDB_info
class Tier_1_Crawler(Base_Crawler):
''' This func is used by func: generate_tier_1_info
func: delete_tier_1_temp_files
'''
def get_two_saving_paths(self, original... |
import unittest
import qiskit_toqm.native as toqm
class TestTOQM(unittest.TestCase):
def test_version(self):
self.assertEqual(toqm.__version__, "0.1.0")
def test_basic(self):
num_q = 4
gates = [
toqm.GateOp(0, "cx", 0, 1),
toqm.GateOp(1, "cx", 0, 2),
... |
"""Unit tests for the Gerrit hosting service."""
from __future__ import unicode_literals
import base64
import re
import sys
from django.utils.six.moves.urllib.request import (HTTPDigestAuthHandler,
OpenerDirector)
from reviewboard.hostingsvcs.errors import (Authori... |
#!/usr/bin/env python
import os
import sys
import math
import numpy
if len(sys.argv) < 3:
print("usage: script.py bwa_depth.tab bwa_depth-pos.tab mode[contigs/complete] suffix")
sys.exit()
name = os.path.basename(sys.argv[1]).split(sys.argv[4])[0]
spec_stats = {}
# recover genome length and total counts per... |
import matplotlib.pyplot as plt
import numpy
from matplotlib.figure import Figure
from tifffile import imread
from hylfm.detect_beads import get_bead_pos
def plot_bead_hist(bead_pos_tgt, bead_pos_pred, bi=0) -> Figure:
z_tgt_counts, bin_edges = numpy.histogram(bead_pos_tgt[bi][:, 0], bins=49, range=(0, 49))
... |
from django.apps import AppConfig
class LeagueConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'league'
|
# import unittest
# import json
# from cloud_guardrails.shared import utils
# from cloud_guardrails.terraform.terraform import TerraformTemplateNoParams
# from cloud_guardrails.iam_definition.services import Services, Service
#
#
# class TerraformTemplateNoParamsTestCase(unittest.TestCase):
# def test_terraform_sin... |
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file ac... |
# Copyright 2017 Intel 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 agreed to in wri... |
#
# Copyright (c) 2018 Intel 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 agreed to... |
"""
Django settings for ecssweb project.
Generated by 'django-admin startproject' using Django 2.0.5.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.0/ref/settings/
"""
import os
#... |
class Constants:
SERVICE_ID = "Manga Scraper"
SETTINGS_FILE = "settings.json"
BASE_URI = "https://api.mangadex.org" |
#!/usr/bin/python
from PyQt5.QtWidgets import QWidget, QLabel, QMessageBox, QTableWidget, QAbstractItemView, QPushButton, QCheckBox, \
QVBoxLayout, QDialog, QDialogButtonBox, QTableWidgetItem, QHeaderView, QFormLayout, \
QTabWidget, QLineEdit, QScrollArea, QListW... |
from django.db import models
class Library(models.Model):
name = models.CharField(max_length=45, default="나의 서재")
class Meta:
db_table = "libraries"
class Shelf(models.Model):
name = models.CharField(max_length=100)
library = models.ForeignKey(
Library, on_delete=models.CASCADE, rel... |
import tensorflow as tf
def preprocess_image(image_data, centroid, bbox_size, cropsize):
"""
Performs preproccessing on a single image for feeding into the network.
:param image_data: raw image data as a bytestring
:param centroid: the center of the bounding box to crop to, in pixel coordinates
:p... |
"""Resources module."""
import datetime
import enum
import os
import pathlib
import shutil
import typing as t
import urllib.request as request
from contextlib import closing
from io import BytesIO
import attr
import numpy as np
import pandas as pd
import requests
import xarray as xr
from .units import format_missing_... |
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, fields
class L10nLatamIdentificationType(models.Model):
_inherit = "l10n_latam.identification.type"
l10n_ar_afip_code = fields.Char("AFIP Code")
|
#!/usr/bin/env python
import rospy
import roslib
import serial
from time import time, sleep
from std_msgs.msg import String, Float64
from sensor_msgs.msg import Image, Imu
import tf
#from geometry_msgs.msg import PoseStamped
#TODO need to look at the signs for the pitch, yaw, and thrust commands
class SerialBridge():
... |
#!/usr/bin/python3
import sys
blocks = []
#
# blocks is an array of paths under which we want to block by
# default.
#
# blocks[0] = ['path' = '/sys', 'children' = [A,B] ]
# blocks[1] = ['path' = '/proc/sys', 'children' = [ E ] ]
# A = [ 'path' = 'fs', children = [C] ]
# C = [ 'path' = 'cgroup', children = [F] ]... |
# Copyright (c) 2020 PaddlePaddle 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... |
# coding=utf-8
# Copyright 2022 The ML Fairness Gym 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... |
tree_map = """.......#................#......
...#.#.....#.##.....#..#.......
..#..#.#......#.#.#............
....#...#...##.....#..#.....#..
....#.......#.##......#...#..#.
...............#.#.#.....#..#..
...##...#...#..##.###...##.....
##..#.#...##.....#.#..........#
.#....#..#..#......#....#....#.
..................... |
from enum import Enum
class TaskResultStatus(Enum):
FAILURE = 50
WARNING = 40
SUCCESS = 30
INFO = 20
UNKNOWN = 10
def __str__(self):
return self.name
|
"""
Django models for qcm app.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/db/models/
"""
from .branch import Branch
from .choice import Choice
from .question import Question
from .questionsset import QuestionsSet
from .questionssubset import QuestionsSubset
from .training impo... |
name = " yang yahu "
print(name)
print(name.lstrip() + "\n" + name.rstrip() + "\t" + name.strip())
|
import torch.nn as nn
import torch
import torch.nn.functional as F
# from torch_geometric.nn import GCNConv
#from torch_geometric.nn.conv.gatv2_conv import GATv2Conv as GATConv
# from torch_geometric.nn import SuperGATConv as GATConv
# from torch_geometric.nn import
from torch_geometric.nn.norm import LayerNorm
impo... |
_base_ = [
'../_base_/models/faster_rcnn_r50_fpn_voc_wAnchor.py', '../_base_/datasets/voc0712OS.py',
'../_base_/default_runtime.py'
]
model = dict(roi_head=dict(bbox_head=dict(num_classes=15)))
# optimizer
optimizer = dict(type='SGD', lr=0.005, momentum=0.9, weight_decay=0.0001)
optimizer_config = dict(grad_cli... |
from os import path, mkdir, listdir
import numpy as np
np.random.seed(1)
import random
random.seed(1)
import tensorflow as tf
tf.set_random_seed(1)
import timeit
import cv2
from models import get_inception_resnet_v2_unet_softmax
from tqdm import tqdm
test_folder = path.join('..', 'data_test')
models_fol... |
#this class will encapsulate all the necessary logic to extract our 3D HSV color histogram from our images
#import the necessary packages
import numpy as np #numerical processing
import cv2 #opencv
import imutils #check opencv ver.
class ColorDescriptor:
def __init__(self, bins):
#store the number of bins ... |
# -*- coding: utf-8 -*-
"""flask views file"""
from __future__ import absolute_import, unicode_literals, division
import logging
from datetime import datetime
from flask import Blueprint, render_template, Response
from vsphere_ds_exporter.libs import vsphere
metrics = Blueprint('metrics', __name__)
logger = logging.g... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.