content stringlengths 0 991k | tokens int64 0 655k |
|---|---|
from _TFL.pyk import pyk
from rsclib.HTML_Parse import tag, Page_Tree
from rsclib.autosuper import autosuper
from spider.common import Interface, Inet4, Inet6, unroutable
from spider.common import WLAN_Config
from spider.luci import Version_Mixin
class Status (Page_Tree, Versio... | 1,478 |
from PIL import Image
import cv2
import imagehash
import math
import numpy as np
DIFF_THRES = 20
LIMIT = 2
RESIZE = 1000
def calc_hash(img):
"""
Calculate the wavelet hash of the image
img: (ndarray) image file
"""
img = resize(img)
return imagehash.whash(Image.fromarray(img))
def compare(ha... | 406 |
from .cli.cli import main
if __name__ == '__main__':
main() | 18 |
import time
from PyQt5 import QtGui, QtCore
from ui.room_item import Ui_Form
from PyQt5.QtWidgets import QWidget
class Room_Item(QWidget,Ui_Form):
def __init__(self,parent=None,room_data=None):
super(Room_Item,self).__init__(parent)
self.setupUi(self)
self.data = room_data
self.setRo... | 218 |
import asyncio
import re
import sys
import traceback
import toga
from toga import Key
from .keys import toga_to_winforms_key
from .libs import Threading, WinForms, shcore, user32, win_version
from .libs.proactor import WinformsProactorEventLoop
from .window import Window
class MainWindow(Window):
def winforms_FormC... | 1,680 |
"""
/***************************************************************************
SimplePhotogrammetryRoutePlanner
A QGIS plugin
A imple photogrammetry route planner.
Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/
------------... | 275 |
"""
Created on Tue Jul 24 14:38:20 2018
dimension reduction with VarianceThreshold using sklearn.
Feature selector that removes all low-variance features.
@author: lenovo
"""
from sklearn.feature_selection import VarianceThreshold
import numpy as np
np.random.seed(1)
X = np.random.randn(100, 10)
X = np.hstack([X, np.ze... | 189 |
from my_multi_main3 import main
import numpy as np
import argparse
import time
parser = argparse.ArgumentParser(description='PyTorch MNIST Example')
parser.add_argument('--batch-size', type=int, default=64, metavar='N',
help='input batch size for training (default: 64)')
parser.add_argument('--test-... | 812 |
"""HDF5 related files.
This file contains a set of functions that related to read and write
HDF5 files.
Author: Yuhuang Hu
Email : duguyue100@gmail.com
"""
from __future__ import print_function, absolute_import
import h5py
from spiker import log
logger = log.get_logger("data-hdf5", log.DEBUG)
def init_hdf5(file_path, m... | 265 |
import flatbuffers
class FloatingPoint(object):
__slots__ = ['_tab']
@classmethod
def GetRootAsFloatingPoint(cls, buf, offset):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = FloatingPoint()
x.Init(buf, n + offset)
return x
def Init(self, buf, pos... | 198 |
"""[Scynced Lights]
Class attributes are "shared"
Instance attributes are not shared.
"""
def sub(x, y):
f
class Light:
pass
a = Light()
b = Ligth() | 44 |
from __future__ import unicode_literals, division, absolute_import
import time
import logging
from collections import deque
try:
from UserDict import DictMixin
except ImportError:
from collections import Mapping as DictMixin
import six
from six import iteritems
from six.moves import cPickle
class BaseCounter(ob... | 2,007 |
"""Feature extractor class for ViT."""
from typing import List, Optional, Union
import numpy as np
from PIL import Image
from ...feature_extraction_utils import BatchFeature, FeatureExtractionMixin
from ...file_utils import TensorType
from ...image_utils import IMAGENET_STANDARD_MEAN, IMAGENET_STANDARD_STD, ImageFeatur... | 1,406 |
UNKNOWN = -1
def read_val():
return int(input())
def read_row():
return list(map(int, input().split()))
def read_grid():
return [read_row() for _ in range(read_val())]
def make_blank_row(i):
return [UNKNOWN] * i
def make_blank_grid(n):
return [make_blank_row(i) for i in range(1, n + 1)]
def compute_... | 198 |
import platform
operating_system = platform.system().lower()
if operating_system == 'darwin':
from .blender_utils_macos import get_installed_blender_versions
operating_system_name = 'macos'
elif operating_system == 'linux':
from .blender_utils_linux import get_installed_blender_versions
operating_system... | 368 |
import functools
import random
from math import cos, pi
import cv2
import kornia
import numpy as np
import torch
from kornia.augmentation import ColorJitter
from data.util import read_img
from PIL import Image
from io import BytesIO
from utils.util import opt_get
'''
if __name__ == '__main__':
import numpy as np
... | 1,744 |
print(b"%%" % ())
print(b"=%d=" % 1)
print(b"=%d=%d=" % (1, 2))
print(b"=%s=" % b"str")
print(b"=%r=" % b"str")
print("PASS") | 58 |
import pytest
import albumentations as A
from .context import TfDataAugmentation as Tfda
from . import test_utils
from .test_utils import TestResult
@pytest.mark.parametrize(
"quality_lower, quality_upper, expected, message", [
(-1, 100, TestResult.Error,
"quality_lower < min => Error"),
(0... | 489 |
import os
from torch.utils.data import DataLoader
from continuum.datasets import CIFAR10, InMemoryDataset
from continuum.datasets import MNIST
import torchvision
from continuum.scenarios import TransformationIncremental
import pytest
import numpy as np
from continuum.transforms.bg_swap import BackgroundSwap
DATA_PATH =... | 646 |
import os
JQUERY_VERSION = "1.6.2"
JQUERY_UI_VERSION = "1.8.16"
DATE_TEXT_SIZE = 25
TEXT_SIZE = 85
TEXTAREA_COLS = 85
TEXTAREA_ROWS_SHORT = 2
TEXTAREA_ROWS_LONG = 4
TEXTAREA_ROWS_XLONG = 10
MAX_LENGTH_CHECKLIST_NOTES = 255
EMAIL_LENGTH = 60
_app_path = None
_config_file = None
_app_name = None
session_lock_dir = None
p... | 284 |
from typing import Any, TYPE_CHECKING
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy
from .._version import VERSION
if TYPE_CHECKING:
from azure.core.credentials_async import AsyncTokenCredential
class WebSiteMana... | 563 |
import django.http
import unittest.mock
from .. import middleware
def get_response(req):
return django.http.HttpResponse()
def test_leaves_remote_addr_alone_if_no_real_ip():
remote_addr = object()
request = unittest.mock.MagicMock()
request.META = {"REMOTE_ADDR": remote_addr}
middleware.XRealIPMiddl... | 184 |
import time
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(21, GPIO.OUT)
GPIO.output(21, GPIO.LOW)
time.sleep(3.00)
GPIO.output(21, GPIO.HIGH)
GPIO.cleanup() | 53 |
from direct.directnotify.DirectNotifyGlobal import directNotify
class Notifier:
def __init__(self, name):
"""
@param name: The name of the notifier. Be sure to add it to your config/Config.prc!
@type name: str
"""
self.notify = directNotify.newCategory(name) | 69 |
import numpy as np
def train_ml_squarer() -> None:
print("Training!")
def square() -> int:
"""Square a number...maybe"""
return np.random.randint(1, 100)
if __name__ == '__main__':
train_ml_squarer() | 60 |
"""
Platformer Game
"""
import arcade
SCREEN_WIDTH = 1000
SCREEN_HEIGHT = 650
SCREEN_TITLE = "Platformer"
CHARACTER_SCALING = 1
TILE_SCALING = 0.5
COIN_SCALING = 0.5
SPRITE_PIXEL_SIZE = 128
GRID_PIXEL_SIZE = SPRITE_PIXEL_SIZE * TILE_SCALING
PLAYER_MOVEMENT_SPEED = 10
GRAVITY = 1
PLAYER_JUMP_SPEED = 20
class MyGame(arca... | 968 |
'''
lib/ycmd/start.py
Server bootstrap logic. Includes a utility class for normalizing parameters and
calculating default ones. Also includes a helper to set up the temporary
options file.
'''
import logging
import os
import tempfile
from ..process import (
FileHandles,
Process,
)
from ..util.fs import (
de... | 4,053 |
import serial
import sys
import struct
import pprint
import argparse
import code
pp = pprint.PrettyPrinter()
class ConsoleUI:
def opStart(self, name):
sys.stdout.write(name.ljust(40))
def opProgress(self, progress, total=-1):
if (total >= 0):
prstr = "0x%04x / 0x%04x" % (progress, to... | 1,265 |
from CIM16.IEC61968.Common.ActivityRecord import ActivityRecord
class ComplianceEvent(ActivityRecord):
"""Compliance events are used for reporting regulatory or contract compliance issues and/or variances. These might be created as a consequence of local business processes and associated rules. It is anticipated th... | 270 |
import logging
from django.db.models.query_utils import Q
from django.shortcuts import get_object_or_404
from django.utils.decorators import method_decorator
from django_filters.rest_framework import DjangoFilterBackend
from drf_yasg import openapi
from drf_yasg.openapi import Parameter
from drf_yasg.utils import no_bo... | 8,973 |
"""Mypy style test cases for SQLAlchemy stubs and plugin."""
import os
import os.path
import sys
import pytest
from mypy.test.config import test_temp_dir
from mypy.test.data import DataDrivenTestCase, DataSuite
from mypy.test.helpers import assert_string_arrays_equal
from mypy.util import try_find_python2_interpreter... | 534 |
from __future__ import print_function
import argparse
import hashlib
import os
import sys
from gnupg import GPG
from jinja2 import Template
class Version:
def __init__(self, version):
self.version = version
parts = version.split('.')
if len(parts) > 2:
self.major = ".".join(parts... | 687 |
from flask import Flask, jsonify, request, make_response, redirect, url_for
import jwt
import datetime
import os
from functools import wraps
from flask_sqlalchemy import SQLAlchemy
import uuid
from werkzeug.security import generate_password_hash, check_password_hash
from werkzeug.utils import secure_filename
from sqlal... | 4,310 |
"""
An API to insert and retrieve metadata on cloud artifacts.
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1alpha1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re
import six
... | 1,416 |
from __future__ import absolute_import, division, unicode_literals, print_function
import re
import os
import tempfile
import six
from .. import environment
from ..console import log
from .. import util
WIN = (os.name == "nt")
def _find_conda():
"""Find the conda executable robustly across conda versions.
Retur... | 1,228 |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 19