id
stringlengths
3
8
content
stringlengths
100
981k
506980
import os from fastapi import FastAPI, File, UploadFile import cv2 as cv from mtcnn_cv2 import MTCNN from torchvision import transforms from PIL import Image import torch import numpy as np device = 'cpu' emotion_model = torch.load('./weights/EmotionNet_b27.pt', map_location=torch.device('c...
506986
import unittest import influxgraph.utils from influxgraph.constants import DEFAULT_AGGREGATIONS import datetime class InfluxGraphUtilsTestCase(unittest.TestCase): def test_interval_calculation(self): start_time, end_time = (datetime.datetime.now() - datetime.timedelta(days=2)), \ datetime.dateti...
506990
import torch import torch.nn as nn import torchvision import os import pickle import scipy.io import numpy as np import torch.nn.functional as F from torch.autograd import Variable from torch import optim from model import G12, G21 from model import D1, D2 class Solver(object): def __init__(self, config, svhn_loa...
507004
from setuptools import find_packages, setup setup( name='datpy', version='1.0.0', py_modules=['datpy'], description='Python dough for making Dat-flavored pies', author='<NAME>', author_email='<EMAIL>', url='http://dat-data.com', download_url='https://github.com/karissa/datpy/tarball/0.7...
507009
from typing import Dict, List, Optional, Union from spacy.language import Language from edsnlp.utils.deprecation import deprecated_factory from . import Pollution DEFAULT_CONFIG = dict( pollution=None, ) @deprecated_factory("pollution", "eds.pollution", default_config=DEFAULT_CONFIG) @Language.factory("eds.po...
507024
import pydoodle c = pydoodle.Compiler(clientId="client-id", clientSecret="client-secret") with open(file="test1.py") as f: script = f.read() f.close() result = c.execute(script=script, language="python3") usage = c.usage() print(usage, result.output, sep='\n')
507025
from django.utils.translation import gettext_lazy as _ WIDGET_TYPES = ( ('text', _('Text')), ('textarea', _('Textarea')), ('yesno', _('Yes/No')), ('checkbox', _('Checkboxes')), ('radio', _('Radio buttons')), ('select', _('Select drop-down')), ('autocomplete', _('Autocomplete')), ('range...
507030
import unittest import pulse as p class SignalTest(unittest.TestCase): """This test Class is for signal_diff()""" def test_signal_diff(self): """ This function test to assure that signal_diff() returns a size of 200. """ testing_uid = "1kzd0DmeunLGEeB0nWLFFaIfuFZn" ...
507037
from rest_framework import status from rest_framework.response import Response from rest_framework.generics import GenericAPIView from ..permissions import IsAuthenticated from ..models import Token from ..app_settings import ActivateTokenSerializer from ..authentication import TokenAuthenticationAllowInactive from .....
507071
from rest_framework.exceptions import ValidationError from django.utils.translation import ugettext_lazy as _ from openbook_invitations.models import UserInvite def invite_id_exists(invite_id): if not UserInvite.objects.filter(id=invite_id).exists(): raise ValidationError( _('The invite does ...
507080
from moha import * a = 1.0 #unit cell length def square(a): #define a 2D square lattice cell with vectors a1 a2 and a3 cell = Cell(2,[a, 0., 0.],[0., a, 0.],[0., 0., 0.]) #add a site labeled 'A' at positon [0.,0.,0.] cell.add_site(LatticeSite([0.,0.,0.],'A')) #add a bond from first site in cell [0...
507108
import json import logging from pathlib import Path from os.path import sep def load_mitigation(mitigation_name: str, raise_error=False, force=False) -> dict: """ Wrapper for mitigation loader. :param mitigation_name: The object to type check :param raise_error: Raise the error if any. :type rais...
507123
from can_decoder.dataframe.DataFrameDecoder import DataFrameDecoder from can_decoder.dataframe.DataFrameGenericDecoder import DataFrameGenericDecoder from can_decoder.dataframe.DataFrameJ1939Decoder import DataFrameJ1939Decoder
507141
import functools import json import os.path as path import cv2 import numpy as np def exist_file_path(file_id): if not path.exists(file_id): raise FileNotFoundError(f'index: {file_id}\n') else: image_path = path.abspath(file_id) return image_path def match_file_path(file_id): fi...
507179
from mando import command, main @command def po(a=2, b=3): print(a ** b) if __name__ == '__main__': main()
507211
def normalize(name): name = name.capitalize() return name L1 = ['adam', 'LISA', 'barT'] L2 = list(map(normalize, L1)) print(L2)
507221
src =Split(''' ''') component =aos_component('lib_mico_ble_firmware', src) BT_CHIP = aos_global_config.get('BT_CHIP') BT_CHIP_REVISION = aos_global_config.get('BT_CHIP_REVISION') BT_CHIP_XTAL_FREQUENCY = aos_global_config.get('BT_CHIP_XTAL_FREQUENCY') if BT_CHIP_XTAL_FREQUENCY == None: src.add_sources( BT_CHIP+BT...
507227
import logging import os import toml from test_framework.utils import ( TailableProc, VERBOSE, LOG_LEVEL, MIRADORD_PATH, ) from nacl.public import PrivateKey as Curve25519Private # FIXME: it's a bit clumsy. Miradord should stick to be the `miradord` process object # and we should have another class (...
507235
from django.conf import settings from django.http import HttpResponseRedirect # We need to pull this middleware here since it's old and is not maintained anymore, so we need to take care # it ourselfves. Please note that this middleware is not exactly the same to its published one. class BrowscapParser(object): D...
507237
from django.http import HttpResponse from django.views.generic import View from final.utils import render_to_pdf from bus_board.views import bus_details from bus_board.models import Ticket # class GeneratePdf(View): # def get(self, request, *args, **kwargs): # # data = { # # 'today': datetim...
507294
import pytest import json class TestRemoveSwitchPartitionMember: SWITCH_PARTITION_MEMBER_TEST_DATA = [ ['default', '00:00:00:00:00:00:00:00', '', '', '', 'add_default_member_output.json'], ['default', '', 'backend-0-0', 'ib0', '', 'add_default_member_output.json'], ['Default', '', 'backend-0-0', 'ib0', 'limite...
507326
import tempfile from dagster import ResourceDefinition, fs_io_manager, mem_io_manager from dagster_pyspark import pyspark_resource from hacker_news_assets.pipelines.download_pipeline import download_comments_and_stories_dev from hacker_news_assets.resources.hn_resource import hn_snapshot_client from hacker_news_assets...
507350
from setuptools import setup setup( name='nrgpy_docs', version='0.0.1', description='nrgpy formatting for readthedocs', url='https://github.com/nrgpy/nrgpy', author='NRG Systems, Inc.', author_email='<EMAIL>', keywords='nrg systems rld symphonie symphoniepro wind data spidar r...
507356
import sys from functools import wraps def validate(*types, **kwargs): def decorator(f): @wraps(f) def wrapper(*args, **kwargs): return f(*args, **kwargs) return f return decorator def py3_to_bytes(bytes_or_str): if sys.version_info[0] > 2 and isinstance(bytes_or_str,...
507442
from . import couple from onix.passport import * from onix.sequence import * from onix.cell import * from onix.system import * from onix.passlist import * from onix.standalone import *
507444
import json from datetime import datetime, timedelta from app.api.now_applications.models.now_application_status import NOWApplicationStatus from tests.now_application_factories import NOWApplicationIdentityFactory, NOWApplicationFactory from tests.factories import MineFactory class TestNOWApplicationStatus: """...
507454
from django.utils.translation import ugettext as _ from django.db import models # Create your models here. MESSAGES = ( _("Hello!"), _('Bye!'), _('Thank you!'), )
507474
import logging from polyswarmclient.parameters import Parameters logger = logging.getLogger(__name__) class StakingClient(object): def __init__(self, client): self.__client = client self.parameters = {} async def fetch_parameters(self, chain, api_key=None): """Get staking parameters...
507506
from base import DataSourceBase from datasource_exceptions import InvalidDataSourceFormatException __all__ = ['FileDataSource', 'File64DataSource'] class FileDataSource(DataSourceBase): datasource_name = 'file' def __init__(self, data_source): super(FileDataSource, self).__init__(data_source) ...
507508
from app import application as app import app.protobufs.decisiontrees_pb2 as pb from flask.ext.pymongo import PyMongo from protobuf_to_dict import protobuf_to_dict import fake_data import json import unittest class FlaskrTestCase(unittest.TestCase): def setUp(self): app.config['TEST_DBNAME'] = 'ui_test' ...
507531
import re import shutil import subprocess import time from mutagen.id3 import APIC, ID3, TIT2, TPE1, error from mutagen.mp3 import MP3 from requests import Session # Символы, на которых можно разбить сообщение message_breakers = ["\n", ", "] def update_parameter(config, section, name, num, config_path="../config.in...