content
stringlengths
5
1.05M
from django.contrib.admin.models import LogEntry from cms.contexts.serializers import LogEntrySerializer from rest_framework import filters, generics from rest_framework.permissions import IsAdminUser from .. ordering import StableOrderingFilter from .. pagination import UniCmsApiPagination class ObjectLogEntriesL...
def isPalindrome(x: int) -> bool: if x < 0: return False if x<=9: return True if x%10 == 0 and x!= 0: return False x = str(x) for i in range(len(x)//2): if x[i] != x[-(i+1)]: return False return True x = int...
# structure_ex1.py import numpy as np from civpy.structures import * section = CrossSection( name='dummy', area=32.9, inertia_x=236, inertia_y=716, inertia_j=15.1 ) material = Material( name='dummy', elasticity=29000, rigidity=11500 ) group = ElementGroup( name='dummy', sectio...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012 NEC Corporation. # All Rights Reserved. # from webob import exc from quantum.api import api_common as common from quantum.common import exceptions as qexception from quantum.common import extensions from quantum.manager import QuantumManager class Vifinfo...
from django.db import models from django.contrib.auth.models import User, Group from django.core import exceptions # Create your models here. STATE_UNTRACKED = 'untracked' STATE_REJECTED = 'rejected' class ReportEndOfFlowException(Exception): pass class UserNoPermissionToChangeReportState(Exception): pass ...
#!/usr/bin/python # Copyright 2017 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
from django.shortcuts import render from django.http import HttpResponse from .forms import PDFForm,keyForm from .models import Profile from django.core.files.storage import FileSystemStorage import requests import PyPDF2 from pprint import pprint from PyPDF2 import PdfFileReader import io from .cmodel import...
from gqlpycgen.client import Client schema_load_gql = """ { __schema { types { name kind interfaces { name } enumValues { name } fields { name args { name type { name kind ofType { ...
import abc from rest_framework import generics, mixins # Mixins LIST = mixins.ListModelMixin CREATE = mixins.CreateModelMixin GENERIC = generics.GenericAPIView class AbstractRessources(LIST, CREATE, GENERIC): @abc.abstractmethod def get(self, request, *args, **kwargs): pass @abc.abstractmethod ...
from django.shortcuts import render,redirect,get_object_or_404 from django.contrib import messages from django.http import HttpResponse from django.contrib.auth.decorators import login_required import csv from .forms import * from .models import * @login_required def home(request): template_name = 'home.html' ...
try: import local_config except: try: import os SECRET_KEY = os.environ['SECRET_KEY'] TWILIO_ACCOUNT_SID = os.environ['TWILIO_ACCOUNT_SID'] TWILIO_AUTH_TOKEN = os.environ['TWILIO_AUTH_TOKEN'] GOOGLE_ACCOUNT_USER = os.environ['ameecova@gmail.com'] GOOGLE_ACCOUNT_PASS = os.envir...
def convert(number): resp = '' # Construct the response using modulo operators. if number % 3 == 0: resp += 'Pling' if number % 5 == 0: resp += 'Plang' if number % 7 == 0: resp += 'Plong' # Return resp (if truthy) or number as a string. return resp or str(number)
import urllib.request import lxml.html import openwifi class AttWifi(openwifi.Module): def login(self): doc = lxml.html.parse(self.login_page) form = doc.getroot().forms[0] form.fields['aupAgree'] = 1 form.fields['connect'] = "Connect" self.submit_form(form)
ShaderNodeTexChecker.texture_mapping = None
import pandas as pd import streamlit as st import pathlib import datetime as dt from os.path import abspath, dirname from pandas_profiling import ProfileReport import glucose as gc SRC_PATH = pathlib.Path(dirname(abspath(__file__))) @st.cache(suppress_st_warning=True) def read_markdown_file(file: str) -> str: ""...
import threading import time from model.ivy.std_api import * from controller.IvyControllers.state import State from model.multiplayer.gameServer import Server class Init(State): def __init__(self, next, manager, nbPlayers, countDownBeforeStart, timeOut): State.__init__(self, next, None, manager) ...
from abc import ABC from abc import abstractmethod from copy import deepcopy from enum import Enum from typing import Any from typing import Dict from typing import Generator from typing import List from typing import Optional from typing import Sequence from typing import Tuple from typing import Union import numpy a...
import pytest from lispyc import exceptions from lispyc.nodes import BoolType, FloatType, FunctionType, IntType, ListType, Type from lispyc.parser import parse from lispyc.typechecker import TypeChecker CONSTANTS = [ ("120", IntType()), ("-40", IntType()), ("0", IntType()), ("12e35", FloatType()), ...
# -*- coding: utf-8 -*- """Tests for the Digital Marketplace Notify client.""" import json import mock import os from collections import OrderedDict from itertools import product import pytest from notifications_python_client.errors import HTTPError from dmutils.email.exceptions import EmailError, EmailTemplateError...
# This file is part of Androguard. # # Copyright (C) 2012, Anthony Desnos <desnos at t0t0.fr> # All rights reserved. # # Androguard is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of th...
import torch import torchvision import matplotlib.pyplot as plt import numpy as np from data.download_data import download_cifar_dataset, download_mnist_dataset from data.show_data import imshow #from data import download_data as dd #from data import show_data as sd BATCH_SIZE = 4 NUM_WORKERS = 2 CIFAR_CLASSES = ('p...
import unittest import os import sys from io import StringIO # from onepassword import OnePassword def set_up_one_password(): """Set up a mock OnePassword Vault""" # domain = "test" # email = "user@test.com" # secret = "test_secret" # password = "a234567890b234567890c234567890d234567890e23" # ...
""" # ***************************************************************** # (C) Copyright IBM Corp. 2021. 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...
from datetime import date from typing import List from typing import Optional from typing import Any from bs4 import BeautifulSoup from PIL.Image import Image from requests.models import Response from requests.exceptions import RequestException from jmm.utilities.session import Session from jmm.utilities.functions imp...
import argparse import copy import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data import torchvision.datasets as datasets import torchvision.transforms as transforms from nni.algorithms.compression.pytorch.pruning import LotteryTicketPruner class fc1(nn.Module): def __init__(s...
# import md5, random, time, string import shelve SESSION_INDEX = "/tmp/session_index" def longhash( str ): return string.join( map( lambda x: "%02x" % ord(x), md5.new( str ).digest() ), '' ) LAST_SEED = (int((time.time()*1000)%1000000), longhash('smgr-%f-w0llaw0lla' % tim...
default_app_config = 'djangito_server.apps.DjangitoServerConfig' # needed for signal
import fiona import math from shapely.geometry import Point, shape import itertools import pickle import os import argparse from .util import track, prepare_geojson import geojson MAP_DATA_FP = os.path.dirname( os.path.dirname( os.path.dirname( os.path.abspath(__file__)))) + '/data/processed/ma...
from cortex import Cortex class Subcribe(): def __init__(self): self.c = Cortex(user, debug_mode=True) self.c.do_prepare_steps() def sub(self, streams): self.c.sub_request(streams) # ----------------------------------------------------------- # # SETTING # - replace your license, client_id, client_secret ...
## debug.py ## ## Copyright (C) 2003 Jacob Lundqvist ## ## This program 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, or (at your option) ## any later version. ## ## ...
import sys from PyQt5.QtWidgets import QApplication, QFileDialog from os.path import expanduser import os class Open_Save_dialogs(): def openFileNameDialog(self, parent_window=None, extensions="Supported Files (*.jpg *.tif *.png);;All Files (*)", path=expanduser('~')): options =...
""" Copyright 2017 Steven Diamond 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, software...
# -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incor...
from django.urls import path from artcloud.arts.views import ArtListView, ArtCreateView, ArtEditView, ArtDeleteView, ArtDetailsView, LikeArtView, CommentArtView urlpatterns = [ path('', ArtListView.as_view(), name='list arts'), path('detail/<int:pk>/', ArtDetailsView.as_view(), name='art details'), path(...
# -*- coding: utf-8 -*- """ @author: alexyang @contact: alex.yang0326@gmail.com @file: read_data.py @time: 2018/4/21 8:06 @desc: """ import numpy as np import pandas as pd import nltk from utils import onehot_encoding def isinteger(_str): return _str.strip().isdigit() def isfloat(_str): return sum([...
# Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved. from collections import Counter import os.path import platform import shutil import tempfile import unittest import Queue # Find the best implementation available try: from cStringIO import StringIO except ImportError: from StringIO import S...
# Generated by Django 3.1.2 on 2020-10-27 20:14 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Family', fields=[ ('id', models.AutoField(p...
import os import yaml from mtm.util.Assert import * def loadYamlFilesThatExist(*paths): configs = [] for path in paths: if os.path.isfile(path): config = loadYamlFile(path) if config != None: configs.append(config) return configs def loadYamlFile(path):...
#!/usr/bin/env python3 import time import math import smbus import sys import tty import termios import curses from curses import wrapper # ============================================================================ # Raspi PCA9685 16-Channel PWM Servo Driver # =======================================================...
""" ################################################################################################## # Copyright Info : Copyright (c) Davar Lab @ Hikvision Research Institute. All rights reserved. # Filename : __init__.py # Abstract : # Current Version: 1.0.0 # Date : 2020-05-31 ###...
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Created on 2014-7-10 Author: Gavin_Han Email: muyaohan@gmail.com ''' import urllib2 import urllib import cookielib import lxml.html as HTML class WeiboLogin(object): def __init__(self, username=None, pwd=None, cookie_filename=None, enableProxy = False): ...
from model.group import Group class GroupHelper: def __init__(self, app): self.app = app def fill_group_form(self, group): wd = self.app.wd self.app.fill_field("group_name", group.name) self.app.fill_field("group_header", group.header) self.app.fill_field("group_foote...
""" This python script is useful in converting from concentrations of various compounds, the RMG natural unit, to the delta enrichment and site preference values perferred in isotope literature """ import unittest import pandas as pd def getEnrichementFractionFromDelta(desired_delta, reference_ratio = 0.011115): ...
import psycopg2 import os from sys import modules from instance.config import app_config from app.queries import queries,drop_queries environment = os.environ['ENVIRONMENT'] url = os.getenv('DATABASE_URL') def Database_Connection(): try: # if 'pytest' in modules: # connection = psycopg2.connect( # ...
import math from collections import defaultdict class Cluster(object): """docstring for Cluster""" def __init__(self, n): """ input: n : number of bits to consider for making clusters """ super(Cluster, self).__init__() self.n = n def parse(self, file_path): """ Parse the input file and genera...
from django_rq import job @job def add(x, y): print 'Add was called! with x:{}, y:{}'.format(x, y) return x + y
# -*- coding: utf-8 -*- from .error import RandomLoggerError from IoticAgent.IOT import Config as IoticConfig import click import collections import yaml class RandomLoggerConfig: """ Random logger configuration. """ def __init__(self, yaml_path): """ Creates a new configuration from...
import os.path from shapefile import Reader import sqlite3 PATH = os.path.abspath(os.path.dirname(__file__)) SHAPE_FILE = "/data/nigeria/hotosm_nigeria_points_of_interest_points" CREATE_TABLE_SQL = """CREATE TABLE IF NOT EXISTS poi ( id integer PRIMARY KEY, name text NOT NULL, latitude real NOT NULL, longitude rea...
from django.contrib.auth import get_user from django.http.response import JsonResponse from rest_framework.generics import ListCreateAPIView, RetrieveUpdateDestroyAPIView from django.contrib.auth.models import AnonymousUser from .models import User, Series, Event from .serializers import UserSerializer, SeriesSerialize...
# -*- coding: utf-8 -*- # Generated by Django 1.11.4 on 2017-10-05 16:30 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('emgapi', '0004_analysisjobann'), ] operations = [ ...
from __future__ import unicode_literals from django.conf.urls import url from .views import front_end_update_view urlpatterns = [ url(r'^ft_edit/(?P<app_label>[^/]+)/(?P<model_name>[^/]+)/(?P<pk>\d+)/$', front_end_update_view, name='ft_edit'), ]
from draw_pr_curve_zyf import calc_roc, calc_presicion_recall, draw_analysis_figure import numpy as np import sys import os import os.path as osp from numpy.linalg import norm def calc_similarity(all_ftr_mat, pairs_idx_list, distance_type='cosine'): print "Calc similarities of pairs" sim_list = [] if ...
""" Write a function that accepts another function as an argument. Then it should return such a function, so the every call to initial one should be cached. def func(a, b): return (a ** b) ** 2 cache_func = cache(func) some = 100, 200 val_1 = cache_func(*some) val_2 = cache_func(*some) assert val_1 is val_2 ...
# Generated by Django 3.0 on 2020-05-08 17:41 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('notifications', '0010_notificationtemplate_subject'), ] operations = [ migrations.DeleteModel( name='Reminder', ), ]
#!/usr/bin/env python # coding: utf-8 import numpy as np from scipy import sparse import sys import umap import warnings import networkx as nx import seaborn as sns; sns.set() import matplotlib.pyplot as plt import pandas as pd from scipy.stats import norm, zscore, poisson from sklearn.preprocessing import normalize wa...
class GameProcess: def __init__(self, intergame, data, queue): self.intergame = intergame self.data = data self.queue = queue def _init_game(self): if not self.data["status"]: self.intergame.exit_room(False) self.intergame.alert("Problems with room, pleas...
# Anthony Krivonos # server.py # 07/13/2018 # MARK: - Imports import os from os.path import join, dirname from dotenv import Dotenv # MARK: - Set .env Path dotenv = Dotenv(os.path.join(os.path.dirname(__file__), ".env")) # Of course, replace by your correct path os.environ.update(dotenv) # MARK: - Environment Vari...
""" mcpython - a minecraft clone written in python licenced under the MIT-licence (https://github.com/mcpython4-coding/core) Contributors: uuk, xkcdjerry (inactive) Based on the game of fogleman (https://github.com/fogleman/Minecraft), licenced under the MIT-licence Original game "minecraft" by Mojang Studios (www.m...
""" IPython extensions for Myria queries """ import re try: from IPython.core.magic import Magics, magics_class, cell_magic, line_magic from IPython.display import HTML from IPython.core.magic_arguments import \ argument, magic_arguments, parse_argstring from traitlets import Int, Unicode ...
import sys from SPARQLWrapper import SPARQLWrapper, JSON term = sys.argv[1] sparql = SPARQLWrapper("http://35.194.43.13:3030/ds/query") sparql.setQuery(""" prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> prefix owl: <http://www.w3.org/2002/07/ow...
# This file is part of the Reproducible and Reusable Data Analysis Workflow # Server (flowServ). # # Copyright (C) 2019-2021 NYU. # # flowServ is free software; you can redistribute it and/or modify it under the # terms of the MIT License; see LICENSE file for more details. """Unit tests for the file system IO Handle....
"""Intranet de la Rez - Rooms Pages Blueprint""" import flask bp = flask.Blueprint("rooms", __name__) # ! Keep at the bottom to avoid circular import issues ! from app.rooms import routes
import discord from discord.ext import commands from config import plugins from utils.plugin_cache import plugin_cache def plugin_manager_permissions(ctx): return ctx.author.id == 160462583453712386 or ctx.author.guild_permissions.administrator class PluginManager(commands.Cog): def __init__(self, bot): ...
from src.attacks.dosattack import DoSAttack from src.attacks.replayattack import ReplayAttack from src.attacks.walkingperson import WalkingPerson attacks = [ ReplayAttack, DoSAttack, WalkingPerson ]
import typing as tp import logging import yaml from importlib.resources import files def read_config() -> tp.Dict[str, str]: try: content = files("Telegram_bot_robonomics_coffeemaker.config").joinpath("config.yaml").read_text() config = yaml.load(content, Loader=yaml.FullLoader) logging.d...
from enum import Enum, auto from collections import Counter, deque, ChainMap, defaultdict class Status(Enum): RUNNING = auto() LOOP = auto() CYCLE = auto() BAD_PC = auto() HIT_TARGET = auto() NEED_INPUT = auto() NEED_OUTPUT = auto() def input_prog(day): prog = [] with open(f'../in...
""" This module is really a small Django app which exists here only as an example of richtemplates usage and shouldn't be used in your project directly. It is, however, used by ``example_project`` packaged with source distribution of ``django-richtemplates``. """
# (C) 2020, Schlumberger. Refer to LICENSE # # unit_handler.py # # NOTE: units should only be used by plots, we allow an assumption of # metric everywhere for all calculations and processing. from numba import vectorize, float64 #UNITS FOR DISPLAY @vectorize([float64(float64)],) def M_TO_FT(val): return 3...
import math import nltk from nltk.corpus import stopwords # from search.utils import DESCRIBING_METHODS, COMPARISON_METHODS DESCRIBING_METHODS = {'term_frequency': 'term_frequency', 'term_frequency_inverse_document_frequency': 'term_frequency_inverse_document_frequency'} COMPARISON_METHODS = {'cosine_similarity': 'cos...
# -*- coding: utf-8 -*- """egu.py This script generates the figures for the Möstl et al. EGU 2019 poster "PREDICTED STATISTICS OF CORONAL MASS EJECTIONS OBSERVED BY PARKER SOLAR PROBE AND FORWARD MODELING OF THEIR IN SITU MAGNETIC FIELD". """ import ciso8601 import datetime import matplotlib import mfr3dcore import ...
#!/usr/bin/env python DEF_TASKDB_CONF = {'timeout': 10.0, # seconds 'task_checkout_delay': 1.0, # seconds 'task_checkout_num_tries': 10} class TASK_STATES(object): QUEUED_NO_DEP = 'QUEUED_NO_DEP' RUNNING = 'RUNNING' FAILED = 'FAILED' SUCCEEDED = 'SUCCEEDED' ...
from util import matching_audio_feature_with_padding, matching_max_audio_feature_with_padding, mean_max_similarity_audio, max_max_similarity_audio, get_maximum_matching_score_audio, pairwise_matching_audio, cosine_similarity, euclidDistance import json import glob import os import sys import numpy as np def L2_norm(...
import json from django.contrib.auth.models import AnonymousUser def template(request): context = {} if isinstance(request.user, AnonymousUser): context.update({'is_logged_in': False}) else: context.update({ 'is_logged_in': True, 'user_id': request.user.id, ...
#!/usr/bin/env python # Copyright 2017 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Semi-automated tests of Chrome with NVDA. This file performs (semi) automated tests of Chrome with NVDA (NonVisual Desktop Access),...
import copy from c7n.filters.core import Filter, ValueFilter from c7n.utils import local_session, type_schema class IamPolicyFilter(Filter): """ Filters resources based on their IAM policy """ value_filter_schema = copy.deepcopy(ValueFilter.schema) del value_filter_schema['required'] user_r...
"""IPSEC VPN Address Translations"""
#!/usr/bin/python3 # # # dtiplayground launcher # # import shutil import os import importlib from pathlib import Path import argparse,yaml from argparse import RawTextHelpFormatter import traceback,time,copy,yaml,sys,uuid import dmri.common import dmri.common.study as study import dmri.common.study.loaders as ...
# 2018-05-19 Michal B ''' This script batch converts molecular coordinate (*.xyz) files into gaussian09 input (*.com) files. Specify *.com settings under the INPUTS section of this script ''' import numpy as np import os import sys import glob # INPUTS ----------- theory = '#n B3LYP/6-31G(d) SP' charge = 0 multiplici...
import numpy as np import matplotlib.pyplot as plt import matplotlib.mlab as ml def contour_plot(x, y, z, nx=100, ny=100, interp='linear'): """ Note grid interpolation can take a long time :param x: :param y: :param z: :param nx: How many x intervals in the z grid :param ny: How many y int...
# Tests for the pip accelerator. # # Author: Peter Odding <peter.odding@paylogic.com> # Last Change: July 30, 2016 # URL: https://github.com/paylogic/pip-accel """ Test suite for the pip accelerator. I've decided to include the test suite in the online documentation of the pip accelerator and I realize this may be so...
''' leia varios numeros inteiros pelo teclado o programa vai parar quando diginar 999 mostre quantos numeros foram digitados ''' soma = 0 cont = 0 while True: num = int(input("Diga um numero [999 para parar]")) if num == 999: break soma += num cont += 1 print(cont, " numeros") print("A soma ...
from unittest.mock import MagicMock, patch import pytest from github_action_template.framework import GitHubEnvironment from check_pr_comment.action import CheckPRCommentAction @patch('builtins.print') @patch("github_action_template.framework.GitHub") def test_action_not_a_pr(mock_github, mock_print): github_en...
# encoding=utf-8 import datetime from flask import Blueprint, render_template, g, request, redirect from flask.ext.login import login_required from app.common.constants import CameraStatus, UserRole from app.common.json_builder import success_result from app.models import EventStatistics overview = Blueprint('overvie...
# # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, soft...
import pytest from aioredis.util import parse_url @pytest.mark.parametrize('url,expected_address,expected_options', [ # redis scheme ('redis://', ('localhost', 6379), {}), ('redis://localhost:6379', ('localhost', 6379), {}), ('redis://localhost:6379/', ('localhost', 6379), {}), ('redis://localhos...
#!/usr/bin/env python # -*- coding: utf-8 -*- ### # # Quick and dirty util to figure out who's worked on # something and has knowledge of it. This util takes # into account how long ago the person has worked on it # and is based on their commit messages. # # @author: Anh Tran # atran.wynd@gmail.com # ### from datetim...
fruits = ["apple, strawberry, banana"] for x in fruits : print(x)
from .auth import UnauthenticatedError, UnauthorizedError
from django.urls import path from . import views from .views import * urlpatterns = [ path('', pelayanan, name='pelayanan'), path('pelayanan/update', views.updateStatus, name="updatestatus"), path('pelayanan/filter/', views.filterpelayanan, name='filterpelayanan'), path('editstatus/<str:pk>/', views.ed...
wt2_3_4 = {'192.168.122.110': [11.6496, 11.545, 8.2132, 8.9778, 10.4653, 10.0842, 9.4838, 9.6617, 9.3852, 9.1489, 9.367, 9.0677, 8.8135, 8.6147, 8.4121, 8.5924, 8.4433, 8.2921, 8.1881, 8.162, 8.0478, 8.8593, 8.7537, 8.6327, 10.7904, 10.4758, 10.1565, 10.2746, 10.169, 10.0979, 10.1604, 10.0759, 9.9478, 9.9931, 9.8794, ...
from sqlalchemy import Column, PrimaryKeyConstraint from sqlalchemy.dialects.postgresql import VARCHAR, INTEGER from .database import Base class CourseCorequisite(Base): __tablename__ = 'course_corequisite' department = Column(VARCHAR(length=255)) level = Column(INTEGER) corequisite = Column(VARCHAR(...
import tensorflow as tf import argparse import sys from tensorflow.python.tools import saved_model_utils from tensorflow.python.framework import graph_util from tensorflow.python.saved_model import tag_constants def add_png_decoding(input_width, input_height, input_depth): """Adds operations that perform PNG decod...
import collections import keras import numpy as np import os from src.algorithms.classify.src.classification_model import ClassificationModel from src.preprocess import preprocess_ct, load_ct, crop_patches, generators from .architecture import net class Model(ClassificationModel): """ Args: init_mo...
from discord_iamz1 import * #especially "bot" from discordsupport import * ##from here unsupported functions @bot.command(name='upload', help='upload an attached file to directory of user that sent the message. will only upload one file, for now', before_invoke=gotit) async def iamz1_upload(ctx): s='i would h...
from b0mb3r.services.service import Service class SushiRolla(Service): phone_codes = [7] async def run(self): await self.post( "https://sushirolla.ru/page/save.php", data={ "send_me_password": 1, "phone": self.format(self.formatted_phone, "+*(**...
def BubbleSort(list): for i in range(len(list)-1): for j in range(len(list)- i - 1): if (list[j]>list[j+1]): list[j+1]+=list[j] list[j]= list[j+1]-list[j] list[j+1] = list[j+1]-list[j] string = input("Enter elements to be sorted separated by space") list = string.split() for i in ra...
import pytest from testsuite._internal import fixture_types @pytest.mark.nofilldb def test_load(load: fixture_types.LoadFixture): data = load('test.txt') assert data == 'Hello, world!\n' @pytest.mark.nofilldb def test_load_binary_text(load_binary: fixture_types.LoadBinaryFixture): data = load_binary('t...
import networkx as nx import json import random from assignment.utils import DATASETS, METHODS, fwd from networkx.readwrite.json_graph import node_link_data, node_link_graph from sklearn.cluster import AgglomerativeClustering from pathlib import Path import nbdt.models as models import torch import argparse import os ...
# coding=utf-8 import socket import pytest @pytest.fixture def dns_sd(): from pymachinetalk import dns_sd return dns_sd @pytest.fixture def sd(): from pymachinetalk import dns_sd return dns_sd.ServiceDiscovery() def test_registering_services_from_service_container_works(dns_sd, sd): service...
# -*- coding: utf-8 -*- # Copyright (c) 2021 Brian Scholer (@briantist) # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import (absolute_import, division, print_function) __metaclass__ = type # this file is here just to run the exact same tests as written i...