repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
DeepFaceLive | xlib/qt/widgets/QXDoubleSpinBox.py | .py | from PyQt6.QtCore import *
from PyQt6.QtGui import *
from PyQt6.QtWidgets import *
from ._part_QXWidget import _part_QXWidget
class QXDoubleSpinBox(QDoubleSpinBox, _part_QXWidget):
def __init__(self, min=None, max=None, step=None, decimals=None, readonly=False, special_value_text=None, color=None, alignment=None... | 41 | 1,472 |
DeepFaceLive | xlib/qt/widgets/QXFrame.py | .py | from PyQt6.QtGui import *
from PyQt6.QtWidgets import *
from ._part_QXWidget import _part_QXWidget
from .QXMainApplication import QXMainApplication
from .QXWidget import QXWidget
class QXFrame(QXWidget):
def __init__(self, bg_color=None, **kwargs):
super().__init__(**kwargs)
pal = QXMainApplicati... | 37 | 1,051 |
DeepFaceLive | xlib/qt/widgets/QXMenuBar.py | .py | from PyQt6.QtGui import *
from PyQt6.QtWidgets import *
from ._part_QXWidget import _part_QXWidget
class QXMenuBar(QMenuBar, _part_QXWidget):
def __init__(self, **kwargs):
QMenuBar.__init__(self)
_part_QXWidget.__init__(self, **kwargs)
self.setStyleSheet(f"""
QMenuBar {{
border: 0px;
... | 25 | 609 |
DeepFaceLive | xlib/qt/widgets/QXMainApplication.py | .py | from pathlib import Path
from PyQt6.QtCore import *
from PyQt6.QtGui import *
from PyQt6.QtWidgets import *
from ..core.QXTimer import QXTimer
from ...db import KeyValueDB
from .forward_declarations import forward_declarations
class QXMainApplication(QApplication):
inst : 'QXMainApplication' = None
@static... | 170 | 5,689 |
DeepFaceLive | xlib/qt/widgets/QXCollapsibleSection.py | .py | from PyQt6.QtCore import *
from PyQt6.QtGui import *
from PyQt6.QtWidgets import *
from .QXFrame import QXFrame
from .QXHBoxLayout import QXHBoxLayout
from .QXLabel import QXLabel
from .QXToolButton import QXToolButton
from .QXVBoxLayout import QXVBoxLayout
from .QXFrameVBox import QXFrameVBox
from .QXFrameHBox import... | 81 | 2,824 |
DeepFaceLive | xlib/qt/widgets/QXFrameHBox.py | .py | from PyQt6.QtGui import *
from PyQt6.QtWidgets import *
from .QXFrame import QXFrame
from .QXHBoxLayout import QXHBoxLayout
class QXFrameHBox(QXFrame):
def __init__(self, widgets=None, contents_margins=0, spacing=0, **kwargs):
super().__init__(layout=QXHBoxLayout(widgets=widgets, contents_margins=contents... | 10 | 358 |
DeepFaceLive | xlib/qt/widgets/QXLineEdit.py | .py | from PyQt6.QtCore import *
from PyQt6.QtGui import *
from PyQt6.QtWidgets import *
from ._part_QXWidget import _part_QXWidget
class QXLineEdit(QLineEdit, _part_QXWidget):
def __init__(self, placeholder_text=None,
style_sheet=None,
read_only=False,
... | 32 | 1,015 |
DeepFaceLive | xlib/qt/widgets/QXTextEdit.py | .py | from PyQt6.QtCore import *
from PyQt6.QtGui import *
from PyQt6.QtWidgets import *
from ._part_QXWidget import _part_QXWidget
class QXTextEdit(QTextEdit, _part_QXWidget):
def __init__(self, placeholder_text=None,
style_sheet=None,
read_only=False,
... | 31 | 971 |
DeepFaceLive | xlib/qt/widgets/QXCheckBox.py | .py | from PyQt6.QtCore import *
from PyQt6.QtGui import *
from PyQt6.QtWidgets import *
from ._part_QXWidget import _part_QXWidget
class QXCheckBox(QCheckBox, _part_QXWidget):
def __init__(self, text=None, color=None, clicked=None, toggled=None, **kwargs):
super().__init__()
_part_QXWidget.__init__(se... | 26 | 862 |
DeepFaceLive | xlib/qt/widgets/QXOpenGLWidget.py | .py | from PyQt6.QtGui import *
from PyQt6.QtOpenGL import *
from PyQt6.QtOpenGLWidgets import *
from PyQt6.QtWidgets import *
from ._part_QXWidget import _part_QXWidget
class QXOpenGLWidget(QOpenGLWidget, _part_QXWidget):
def __init__(self, **kwargs):
super().__init__()
_part_QXWidget.__init__(self, *... | 22 | 634 |
DeepFaceLive | xlib/qt/widgets/QXFixedLayeredImages.py | .py | from typing import List, Union
import numpy as np
from PyQt6.QtCore import *
from PyQt6.QtGui import *
from PyQt6.QtWidgets import *
from ..gui.from_np import QImage_from_np
from .QXWidget import QXWidget
class QXFixedLayeredImages(QXWidget):
"""
A widget to show multiple stacked images in fixed area
al... | 83 | 2,207 |
DeepFaceLive | xlib/qt/widgets/QXSplashWindow.py | .py | from PyQt6.QtCore import *
from PyQt6.QtGui import *
from PyQt6.QtWidgets import *
from .QXWindow import QXWindow
class QXSplashWindow(QXWindow):
def __init__(self, **kwargs):
"""
represents top widget which has no parent
"""
super().__init__(**kwargs)
self.setWindowFlags(Qt... | 14 | 354 |
DeepFaceLive | xlib/qt/widgets/QXLabel.py | .py | from typing import Any, Union
from PyQt6.QtCore import *
from PyQt6.QtGui import *
from PyQt6.QtWidgets import *
from ..gui import QXImage
from ._part_QXWidget import _part_QXWidget
class QXLabel(QLabel, _part_QXWidget):
def __init__(self, text = None,
color = None,
... | 59 | 1,798 |
DeepFaceLive | xlib/qt/widgets/QXWidgetVBox.py | .py | from PyQt6.QtGui import *
from PyQt6.QtWidgets import *
from .QXWidget import QXWidget
from .QXVBoxLayout import QXVBoxLayout
class QXWidgetVBox(QXWidget):
def __init__(self, widgets=None, contents_margins=0, spacing=0, **kwargs):
super().__init__(layout=QXVBoxLayout(widgets=widgets, contents_margins=cont... | 10 | 362 |
DeepFaceLive | xlib/qt/widgets/QXHBoxLayout.py | .py | from PyQt6.QtCore import *
from PyQt6.QtGui import *
from PyQt6.QtWidgets import *
from ..core.widget import set_contents_margins
class QXHBoxLayout(QHBoxLayout):
def __init__(self, widgets=None, contents_margins=0, spacing=0):
super().__init__()
set_contents_margins(self, contents_margins)
... | 34 | 1,110 |
DeepFaceLive | xlib/qt/widgets/QXProgressBar.py | .py | from PyQt6.QtCore import *
from PyQt6.QtGui import *
from PyQt6.QtWidgets import *
from ._part_QXWidget import _part_QXWidget
class QXProgressBar(QProgressBar, _part_QXWidget):
def __init__(self, min=None, max=None, valueChanged=None, **kwargs):
super().__init__()
_part_QXWidget.__init__(self, **... | 25 | 771 |
DeepFaceLive | xlib/qt/widgets/QXPopupWindow.py | .py | from PyQt6.QtCore import *
from PyQt6.QtGui import *
from PyQt6.QtWidgets import *
from .QXWindow import QXWindow
class QXPopupWindow(QXWindow):
def __init__(self, **kwargs):
"""
represents top widget which has no parent
"""
super().__init__(**kwargs)
self.setWindowFlags(Qt.... | 14 | 346 |
DeepFaceLive | xlib/qt/widgets/QXFileDialog.py | .py | from PyQt6.QtWidgets import *
class QXFileDialog(QFileDialog):
def __init__(self, parent=None,
multi_files=False,
existing_only=False,
is_save=False,
filter=None,
accepted=None):
super().__i... | 28 | 867 |
DeepFaceLive | xlib/qt/widgets/QXComboBox.py | .py | from PyQt6.QtCore import *
from PyQt6.QtGui import *
from PyQt6.QtWidgets import *
from ._part_QXWidget import _part_QXWidget
from typing import List
class QXComboBox(QComboBox, _part_QXWidget):
def __init__(self, choices : List[str] = None, on_index_changed=None, **kwargs):
super().__init__()
[ s... | 22 | 775 |
DeepFaceLive | xlib/qt/widgets/QXScrollArea.py | .py | from PyQt6.QtCore import *
from PyQt6.QtGui import *
from PyQt6.QtWidgets import *
from ._part_QXWidget import _part_QXWidget
class QXScrollArea(QScrollArea, _part_QXWidget):
def __init__(self, **kwargs):
super().__init__()
_part_QXWidget.__init__(self, **kwargs)
def focusInEvent(self, ev : ... | 20 | 537 |
DeepFaceLive | xlib/qt/widgets/QXDirDialog.py | .py | from PyQt6.QtWidgets import *
class QXDirDialog(QFileDialog):
def __init__(self, parent=None, caption : str = None, directory : str = None, accepted=None):
super().__init__(parent=parent, directory=directory)
self.setOption(QFileDialog.Option.DontUseNativeDialog)
self.setOption(QFileDialog... | 15 | 556 |
DeepFaceLive | xlib/qt/widgets/QXSlider.py | .py | from PyQt6.QtCore import *
from PyQt6.QtGui import *
from PyQt6.QtWidgets import *
from ._part_QXWidget import _part_QXWidget
class QXSlider(QSlider, _part_QXWidget):
def __init__(self, orientation=None,
min=None, max=None,
tick_position=None,
... | 45 | 1,549 |
DeepFaceLive | xlib/qt/gui/from_file.py | .py | from PyQt6.QtGui import *
from .QXImage import QXImage
from .QXPixmap import QXPixmap
def QPixmap_from_file(filepath, color=None):
img = QPixmap(str(filepath))
if color is not None:
qp = QPainter(img)
qp.setCompositionMode(QPainter.CompositionMode.CompositionMode_SourceIn)
qp.fillRec... | 33 | 897 |
DeepFaceLive | xlib/qt/gui/QXImage.py | .py | from PyQt6.QtCore import *
from PyQt6.QtGui import *
from .QXPixmap import QXPixmap
class QXImage(QImage):
"""
extension of QImage
"""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._cache = {}
def as_QXPixmap(self) -> QXPixmap:
pixmap = self... | 44 | 1,185 |
DeepFaceLive | xlib/qt/gui/from_np.py | .py | from typing import Union
import numpy as np
from PyQt6.QtGui import *
from ...image import ImageProcessor, get_NHWC_shape
_C_to_Format = {
1: QImage.Format.Format_Grayscale8,
3: QImage.Format.Format_BGR888,
4: QImage.Format.Format_ARGB32
}
def QPixmap_from_np(image : np.ndarray):
"""
constru... | 73 | 2,213 |
DeepFaceLive | xlib/qt/gui/QXImageSequence.py | .py | from typing import List
from .QXImage import QXImage
class QXImageSequence:
"""
contains a list of QXImage with defined FPS
"""
def __init__(self, frames : List[QXImage], fps : float):
super().__init__()
self._frames = frames
self._fps = fps
self._frame_count = len(fr... | 25 | 651 |
DeepFaceLive | xlib/qt/gui/QXPixmap.py | .py | from PyQt6.QtCore import *
from PyQt6.QtGui import *
class QXPixmap(QPixmap):
"""
extension of QPixmap
contains cached scaled versions
cached grayscaled
cached QIcon
"""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._cache = {}
def scaled... | 52 | 1,529 |
DeepFaceLive | xlib/qt/core/QXTimer.py | .py | from PyQt6.QtCore import *
class QXTimer(QTimer):
def __init__(self, interval=None, timeout=None, single_shot=False, start=False):
super().__init__()
if interval is not None:
self.setInterval(interval)
if timeout is not None:
self.timeout.connect(timeout)
... | 20 | 419 |
DeepFaceLive | xlib/qt/core/QXTimeLine.py | .py | from typing import Tuple
from PyQt6.QtCore import *
_linear_easing_curve = QEasingCurve(QEasingCurve.Type.Linear)
class QXTimeLine(QTimeLine):
"""
QXTimeLine with default linear curve
frame_range(None) (int,int) start,end
"""
def __init__(self, duration,
frame_range :... | 44 | 1,195 |
DeepFaceLive | xlib/qt/core/widget.py | .py | from collections import Iterable
from PyQt6.QtCore import *
class BlockSignals:
def __init__(self, qt_widget_or_list, block_signals=True):
if not isinstance(qt_widget_or_list, (tuple,list)):
qt_widget_or_list = [qt_widget_or_list]
self.qt_widget_or_list = qt_widget_or_list
sel... | 89 | 2,726 |
DeepFaceLive | xlib/qt/_unused/QSubprocessor.py | .py | import multiprocessing
import sys
import time
import traceback
from PyQt6.QtCore import *
from PyQt6.QtGui import *
from PyQt6.QtWidgets import *
from .qtex import *
class QSubprocessor(object):
"""
"""
class Cli(object):
def __init__ ( self, client_dict ):
s2c = multiprocessing... | 262 | 9,337 |
DeepFaceLive | xlib/api/win32/dxgi/dxgi.py | .py | from ctypes import POINTER, c_longlong, c_uint, c_void_p
from typing import Union
from xlib.api.win32.wintypes.wintypes import BOOL
from ..wintypes import (ERROR, GUID, HRESULT, REFGUID, REFIID, IUnknown,
dll_import, interface)
from .structs import *
@interface
class IDXGIObject(IUnknown):
... | 122 | 4,754 |
DeepFaceLive | xlib/api/win32/dxgi/structs.py | .py | import ctypes as ct
from ctypes import (POINTER, WINFUNCTYPE, byref, c_byte, c_int64,
c_longlong, c_size_t, c_ubyte, c_uint, c_uint32, c_ulong,
c_void_p, c_wchar)
class DXGI_ADAPTER_FLAG(c_uint):
DXGI_ADAPTER_FLAG_NONE = 0
DXGI_ADAPTER_FLAG_REMOTE = 1
DXGI_AD... | 61 | 2,366 |
DeepFaceLive | xlib/api/win32/dxgi/__init__.py | .py | from .dxgi import (DXGI_ADAPTER_DESC1, CreateDXGIFactory1, CreateDXGIFactory2, DXGI_ADAPTER_FLAG, IDXGIAdapter,
IDXGIAdapter1, IDXGIFactory, IDXGIFactory1, IDXGIFactory2, IDXGIFactory3, IDXGIFactory4, IDXGIObject,
create_DXGIFactory1, create_DXGIFactory2, create_DXGIFactory3, creat... | 4 | 336 |
DeepFaceLive | xlib/api/win32/ole32/structs.py | .py | from ..wintypes import DWORD
class COINIT(DWORD):
APARTMENTTHREADED = 0x2
MULTITHREADED = 0x2
DISABLE_OLE1DDE = 0x4
SPEED_OVER_MEMORY = 0x8
class CLSCTX(DWORD):
CLSCTX_INPROC_SERVER = 0x1
CLSCTX_INPROC_HANDLER = 0x2
CLSCTX_LOCAL_SERVER = 0x4
CLSCTX_INPROC_SERVER16 = 0x8
CLSCTX_REMO... | 36 | 1,121 |
DeepFaceLive | xlib/api/win32/ole32/ole32.py | .py | from ctypes import (POINTER, WINFUNCTYPE, byref, c_byte, c_int64, c_longlong,
c_size_t, c_ubyte, c_uint, c_uint32, c_ulong, c_void_p,
c_wchar)
from typing import Union
from ..wintypes import (DWORD, ERROR, GUID, HRESULT, REFCLSID, REFGUID, REFIID,
IUnknow... | 19 | 702 |
DeepFaceLive | xlib/api/win32/oleaut32/oleaut32.py | .py | from ctypes import POINTER, Structure
from ..wintypes import VARIANT, dll_import
@dll_import('OleAut32')
def VariantInit( pvarg : POINTER(VARIANT) ) -> None: ...
| 8 | 165 |
DeepFaceLive | xlib/api/win32/uuids/uuids.py | .py | from ..wintypes import CLSID
CLSID_SystemDeviceEnum = CLSID('62BE5D10-60EB-11d0-BD3B-00A0C911CE86')
CLSID_VideoInputDeviceCategory = CLSID('860bb310-5d01-11d0-bd3b-00a0c911ce86') | 4 | 187 |
DeepFaceLive | xlib/api/win32/kernel32/__init__.py | .py | from .kernel32 import (CreateEventW, GetCurrentProcess, GetPriorityClass,
PriorityClass, QueryPerformanceCounter,
QueryPerformanceFrequency, SetPriorityClass, Sleep,
WaitForSingleObject)
| 5 | 256 |
DeepFaceLive | xlib/api/win32/kernel32/kernel32.py | .py | from ctypes import c_void_p, c_wchar_p, POINTER
from ..wintypes import BOOL, DWORD, ERROR, HANDLE, HRESULT, LARGE_INTEGER, dll_import
class PriorityClass(DWORD):
HIGH_PRIORITY_CLASS = DWORD(0x00000080)
ABOVE_NORMAL_PRIORITY_CLASS = DWORD(0x00008000)
NORMAL_PRIORITY_CLASS = DWORD(0x00000020)
... | 39 | 1,220 |
DeepFaceLive | xlib/api/win32/d3d12/structs.py | .py | from ctypes import c_uint, c_int, Structure
class D3D_FEATURE_LEVEL(c_uint):
D3D_FEATURE_LEVEL_1_0_CORE = 0x1000
D3D_FEATURE_LEVEL_9_1 = 0x9100
D3D_FEATURE_LEVEL_9_2 = 0x9200
D3D_FEATURE_LEVEL_9_3 = 0x9300
D3D_FEATURE_LEVEL_10_0 = 0xa000
D3D_FEATURE_LEVEL_10_1 = 0xa100
D3D_FEATURE_LEVEL_11_... | 40 | 1,402 |
DeepFaceLive | xlib/api/win32/strmif/strmif.py | .py | from ctypes import POINTER
from ..objidl import IEnumMoniker
from ..wintypes import DWORD, GUID, HRESULT, REFIID, IUnknown, interface
@interface
class ICreateDevEnum(IUnknown):
def CreateClassEnumerator(self, refiid : REFIID, enumMoniker : POINTER(IEnumMoniker), flags : DWORD ) -> HRESULT: ...
IID = GUID('29... | 11 | 357 |
DeepFaceLive | xlib/api/win32/wintypes/wintypes.py | .py | import ctypes
import uuid
from ctypes import (POINTER, WINFUNCTYPE, c_char_p, c_int16, c_int32, c_float, c_double, c_uint8,
c_int64, c_int8, c_size_t, c_ubyte, c_uint, c_uint16,
c_uint32, c_uint64, c_ulong, c_void_p, c_wchar_p)
from ctypes.util import find_library
from enum impor... | 602 | 17,380 |
DeepFaceLive | xlib/api/win32/wintypes/__init__.py | .py | from .wintypes import (BOOL, CHAR, CLSID, DOUBLE, DWORD, ERROR, FLOAT, GUID,
HANDLE, HRESULT, IID, INT, LARGE_INTEGER, LONG,
LONGLONG, LPCOLESTR, MMERROR, MMRESULT, PVOID,
REFCLSID, REFGUID, REFIID, SHORT, UINT, ULARGE_INTEGER,
... | 7 | 410 |
DeepFaceLive | xlib/api/win32/oaidl/oaidl.py | .py | from ctypes import POINTER, c_void_p, c_wchar_p
from ..wintypes import (GUID, DWORD, IUnknown, interface, VARIANT, HRESULT, LPCOLESTR)
@interface
class IErrorLog(IUnknown):
def AddError(self, pszPropName : LPCOLESTR, pExcepInfo : c_void_p) -> HRESULT: ... #EXCEPINFO
IID = GUID('3127ca40-446e-11ce-8135-00aa004... | 15 | 619 |
DeepFaceLive | xlib/api/win32/dshow/helper.py | .py | from typing import List
from .. import ole32, uuids, strmif, wintypes, objidl, oaidl
def get_video_input_devices_names() -> List[str]:
"""
returns a list of available names of VideoInputDevice's
ole32 should be initialized before use
"""
# based on https://docs.microsoft.com/ru-ru/windows/win32/... | 41 | 1,638 |
DeepFaceLive | xlib/api/win32/winmm/winmm.py | .py | from ..wintypes import DWORD, MMRESULT, dll_import
@dll_import('Winmm')
def timeBeginPeriod(uPeriod : DWORD) -> MMRESULT: ... | 4 | 127 |
DeepFaceLive | xlib/api/win32/objidl/objidl.py | .py | from ctypes import POINTER, c_void_p
from ..wintypes import (GUID, DWORD, IUnknown, CLSID, interface, HRESULT, REFIID, BOOL, ULARGE_INTEGER)
@interface
class IStream(IUnknown): #ISequentialStream
IID = GUID('0000000c-0000-0000-c000-000000000046')
@interface
class IPersist(IUnknown):
def GetClassID(self, pCl... | 108 | 3,457 |
DeepFaceLive | xlib/console/console.py | .py | from typing import Generator
_progress_symbols = "|/-\\"
def progress_bar_iterator(iterable, count : int = None, desc = '', suppress_print=False) -> Generator:
if count is None:
count = len(iterable)
if not suppress_print:
progress_bar_print(0, count, desc)
for i, item in enumerate(iterabl... | 32 | 968 |
DeepFaceLive | xlib/console/diacon/Diacon.py | .py |
import threading
import time
from enum import IntEnum
from typing import Any, Callable, List, Tuple, Union
from numbers import Number
from ... import text as lib_text
class EDlgMode(IntEnum):
UNHANDLED = 0
BACK = 1
RELOAD = 2
WRONG_INPUT = 3
HANDLED = 4
class DlgChoice:
def __init__(self, s... | 369 | 11,806 |
DeepFaceLive | xlib/mt/AtomicInteger.py | .py | import threading
class AtomicInteger:
def __init__(self, value=0):
self._value = int(value)
self._lock = threading.Lock()
def inc(self, d = 1):
with self._lock:
self._value += int(d)
return self._value
def dec(self, d = 1):
return self.inc(-... | 23 | 539 |
DeepFaceLive | xlib/mt/__init__.py | .py | """
various threading extensions
"""
from .AtomicInteger import AtomicInteger
from .MTOrderedData import MTOrderedData
| 7 | 120 |
DeepFaceLive | xlib/mt/MTOrderedData.py | .py | from collections import deque
from queue import Queue
from typing import Any, Union, Tuple
def MTOrderedData(queue_size=0):
"""
Multithreaded ordered work.
Ensures the order of work done by threads.
returns (host,client) classes.
"""
h2c, c2h = Queue(maxsize=queue_size), Queue(maxsize=que... | 90 | 2,145 |
DeepFaceLive | xlib/file/SplittedFile.py | .py | import itertools
from pathlib import Path
from typing import List
class SplittedFile:
@staticmethod
def split(filepath : Path, part_size : int, delete_original = False):
"""
splits a file to the parts
raises:
Exception
FileNotFoundError
"""
... | 76 | 2,171 |
DeepFaceLive | xlib/path/__init__.py | .py | """
pathlib extensions
"""
from .path import get_files_paths
| 5 | 61 |
DeepFaceLive | xlib/logic/DelayedBuffers.py | .py | from collections import deque
from datetime import datetime
class DelayedBuffers:
"""
Buffers temporal data and "shows" it evenly with target delay.
first frame created
0 ms
| 1500ms first frame arrived, set minimum target delay
|
more data arrived
... | 107 | 3,340 |
DeepFaceLive | xlib/net/ThreadFileDownloader.py | .py | import io
import threading
import urllib.request
from pathlib import Path
from typing import Union
class ThreadFileDownloader:
"""
FileDownloader using sub thread
url str
savepath(None) str,Path
Use .get_error() to check the error
"""
def __init__(self, url, savepath : Un... | 100 | 2,720 |
DeepFaceLive | xlib/db/KeyValueDB.py | .py | import traceback
from datetime import datetime
from pathlib import Path
from ..io import FormattedFileIO
class KeyValueDB:
_KeyValueDB_VERSION = 1
def __init__(self, filepath = None):
"""
Simple key/value database.
each key/value pickled/unpickled separately,
thus unpickling... | 86 | 2,626 |
DeepFaceLive | xlib/io/IOThreadLinesReader.py | .py | import threading
import time
from io import IOBase
from typing import List
from collections import deque
class IOThreadLinesReader:
"""
continuously reads lines from IO in background thread.
"""
def __init__(self, io : IOBase, max_lines=None):
self._io = io
self._lock = threading.Lock(... | 57 | 1,372 |
DeepFaceLive | xlib/io/IO.py | .py | import io
import pickle
import struct
from pathlib import Path
from typing import Union
class FormattedIOBase:
"""
base class for formatting IO-like objects
methods should be implemented:
write
read
seek
tell
"""
def get_file_size(self):
c = self.tell()
... | 305 | 8,421 |
DeepFaceLive | xlib/torch/device.py | .py | from typing import List, Union
import torch
class TorchDeviceInfo:
"""
Represents picklable torch device info
"""
def __init__(self, index=None, name=None, total_memory=None):
self._index : int = index
self._name : str = name
self._total_memory : int = total_memory
def __... | 97 | 2,758 |
DeepFaceLive | xlib/torch/__init__.py | .py | from .device import (TorchDeviceInfo, get_available_devices_info,
get_cpu_device_info, get_device, get_device_info_by_index)
| 3 | 146 |
DeepFaceLive | xlib/torch/model/XsegNet.py | .py | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
class FRNorm2D(nn.Module):
def __init__(self, in_ch):
super().__init__()
self.in_ch = in_ch
self.weight = nn.parameter.Parameter( torch.Tensor(1, in_ch, 1, 1), requires_grad=True)
self.bias = nn.pa... | 226 | 7,263 |
DeepFaceLive | xlib/torch/model/MobileNet.py | .py | from functools import partial
import torch
import torch.nn as nn
import torch.nn.functional as F
def _make_divisible(v: float, divisor: int, min_value = None) -> int:
if min_value is None:
min_value = divisor
new_v = max(min_value, int(v + divisor / 2) // divisor * divisor)
if new_v < 0.9 * v:
... | 140 | 6,974 |
DeepFaceLive | xlib/torch/optim/AdaBelief.py | .py | import torch
class AdaBelief(torch.optim.Optimizer):
def __init__(self, params, lr=1e-3, betas=(0.9, 0.999), eps=1e-16,
weight_decay=0, lr_dropout = 1.0):
defaults = dict(lr=lr, lr_dropout=lr_dropout, betas=betas, eps=eps, weight_decay=weight_decay)
super(AdaBelief, self).__init__... | 54 | 2,017 |
DeepFaceLive | resources/fonts/QXFontDB.py | .py | from pathlib import Path
from localization import Localization
from PyQt6.QtCore import *
from PyQt6.QtGui import *
from xlib import path as lib_path
class QXFontDB():
_cached = {}
_file_to_family = {}
_families_loaded = set()
@staticmethod
def _load_family(name : str):
if name in QXFo... | 90 | 2,866 |
DeepFaceLive | resources/gfx/QXImageDB.py | .py | from pathlib import Path
from PyQt6.QtCore import *
from PyQt6.QtGui import *
from xlib.qt.gui.from_file import QXImage_from_file
class QXImageDB:
cached = {}
def _get(filename : str, color=None):
if isinstance(color, QColor):
key = (filename, color.getRgb() )
else:
... | 51 | 2,583 |
DeepFaceLive | resources/gfx/QXImageSequenceDB.py | .py | from pathlib import Path
from PyQt6.QtCore import *
from PyQt6.QtGui import *
from xlib import path as lib_path
from xlib.qt.gui.from_file import QXImage_from_file
from xlib.qt.gui.QXImageSequence import QXImageSequence
class QXImageSequenceDB:
cached = {}
def _get(dir_path : Path, fps, color=None):
... | 22 | 832 |
DeepFaceLive | localization/localization.py | .py | import os
from typing import Union
def L(s : Union[str, None]) -> Union[str, None]:
return Localization.localize(s)
class Localization:
lang = os.environ.get('__APP_LANGUAGE', 'en-US')
allowed_langs = ['en-US', 'ru-RU', 'zh-CN', 'es-ES', 'it-IT', 'ja-JP', 'de-DE']
@staticmethod
def set_language(l... | 1,432 | 74,367 |
DeepFaceLive | scripts/dev.py | .py | from pathlib import Path
import numpy as np
from xlib import console as lib_con
from xlib import face as lib_face
from xlib import path as lib_path
from xlib.file import SplittedFile
from xlib import cv as lib_cv
repo_root = Path(__file__).parent.parent
large_files_list = [ (repo_root / 'modelhub' / 'onnx' / 'S3FD' /... | 205 | 5,923 |
Vibe-Trading | wiki/scripts/build_alpha_library.py | .py | #!/usr/bin/env python3
"""Render the Alpha Library wiki section from ``manifest.json``.
Pipeline:
1. Load ``wiki/alpha-library/manifest.json`` (produced by
``vibe-trading alpha export-manifest``).
2. Emit one HTML page per alpha at
``wiki/alpha-library/content/<zoo>/<alpha_id>.html``.
3. Emit... | 476 | 18,633 |
Vibe-Trading | wiki/scripts/check_social_cards.py | .py | """Validate social-card metadata for static wiki pages."""
from __future__ import annotations
import struct
from html.parser import HTMLParser
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
class MetaParser(HTMLParser):
"""Collect simple head metadata from a static HTML document."""
... | 62 | 2,066 |
Vibe-Trading | tools/ci_env_var_gate.py | .py | #!/usr/bin/env python3
"""CI gate: reject raw os.getenv / os.environ reads outside config layer.
Scans Python files under the agent source tree and rejects any direct
environment-variable **read** that bypasses the centralized
``agent/src/config/`` accessor layer.
Detected patterns (READ calls):
os.getenv("KEY")
... | 302 | 10,246 |
Vibe-Trading | tools/test_ci_env_var_gate.py | .py | """Tests for tools/ci_env_var_gate.py.
Each test creates a temporary Python file under a fake repo tree, runs the
AST visitor, and asserts the expected violations / warnings / clean result.
Run with::
pytest tools/test_ci_env_var_gate.py -v
"""
from __future__ import annotations
import ast
import textwrap
from... | 271 | 9,544 |
Vibe-Trading | agent/api_server.py | .py | #!/usr/bin/env python3
"""Vibe-Trading API Server - RESTful API for finance research and backtesting.
Thin assembler: creates the FastAPI app, mounts middleware, registers route
modules, and re-exports symbols for test compatibility. All shared
infrastructure lives in ``src.api.{security,models,helpers,state}``.
"""
... | 398 | 12,582 |
Vibe-Trading | agent/mcp_server.py | .py | #!/usr/bin/env python3
"""Vibe-Trading MCP Server — expose finance research tools to any MCP client.
Works with OpenClaw, Claude Desktop, Cursor, and any MCP-compatible client.
Zero API key required for HK/US/crypto research markets (yfinance, OKX,
AKShare are free). Trading connector tools are profile-scoped and requ... | 2,804 | 107,668 |
Vibe-Trading | agent/backtest/regime.py | .py | """Correlation-regime timeline: edge density + hysteresis over time.
Implements Mode 1 of the ``correlation-regime`` skill on top of the same
price data the /correlation endpoint uses: rolling pairwise correlations are
reduced to an edge-density scalar per bar, the density series is smoothed
with a trailing (causal) w... | 236 | 8,719 |
Vibe-Trading | agent/backtest/models.py | .py | """Shared data models for backtest engines.
Immutable dataclasses for positions, fills, trades, and equity snapshots.
"""
from __future__ import annotations
from dataclasses import dataclass
import pandas as pd
@dataclass(frozen=True)
class Position:
"""An open position in a single instrument.
Args:
... | 118 | 3,230 |
Vibe-Trading | agent/backtest/benchmark.py | .py | """Benchmark ticker resolution and fetch for backtest comparison.
Provides a lightweight, zero-dependency way to fetch benchmark reference
data given a set of strategy codes and a data source.
"""
from __future__ import annotations
from dataclasses import dataclass
from typing import Any, Optional
import pandas as ... | 208 | 6,841 |
Vibe-Trading | agent/backtest/perpetual_risk.py | .py | """Pure state and risk contracts for historical USD-M perpetual backtests.
The model is deliberately account-local and deterministic. It does not read
live exchange state, model open orders, or store mutable mark prices on
positions.
Maintenance-bracket data comes from the loader's already-validated artifact
contract... | 418 | 16,523 |
Vibe-Trading | agent/backtest/runner.py | .py | """Fixed backtest entrypoint: read config.json, select loader by source, import signal_engine, run engine.
Supports ``source="auto"`` to route codes to loaders by symbol format.
Supports ``interval`` for bar size (1m/5m/15m/30m/1H/4H/1D, default 1D).
Supports ``engine`` for backtest engine (daily/options, default dail... | 1,581 | 61,077 |
Vibe-Trading | agent/backtest/rebalance_notes.py | .py | """Rebalance notes: per-rebalance turnover and weight-drift detail.
The Portfolio Studio epic (#456) asks for per-rebalance reporting as the
last backend slice, alongside the shipped turnover-aware optimizer and the
risk x-ray. The notes here are computed from the target position frame, so
they work for every optimize... | 159 | 5,952 |
Vibe-Trading | agent/backtest/options_payoff.py | .py | """Deterministic payoff and scenario math for multi-leg option strategies.
The expiry summary is solved from the strategy's piecewise-linear payoff,
independently of the caller's display grid. This keeps breakevens and finite
extrema correct even when a chart grid omits one or more strikes.
"""
from __future__ import... | 497 | 18,062 |
Vibe-Trading | agent/backtest/risk_xray.py | .py | """Portfolio risk x-ray: concentration, volatility, drawdown, tail risk, and
co-movement for a weighted basket, computed from close-price panels.
This is the Portfolio Studio risk-x-ray backend (roadmap slice). Everything
here is a pure function of prices and weights — no I/O, no network, no
loader imports — so the sa... | 369 | 14,359 |
Vibe-Trading | agent/backtest/factor_costs.py | .py | """Trading-cost model for factor backtests: ADV caps, impact, borrow.
A long-short factor backtest that rebalances daily on a 500-name universe is
implicitly claiming it can trade every name, in any size, at the close, for a
flat fee. Three things break that claim, and this module prices all three:
**Capacity.** You ... | 417 | 16,136 |
Vibe-Trading | agent/backtest/metrics.py | .py | """Shared backtest metrics, extracted from daily_portfolio.py for reuse.
Provides annualisation helpers, trade statistics, and full metric calculation.
"""
from __future__ import annotations
import logging
from typing import Any, Dict, List, Optional
import numpy as np
import pandas as pd
from backtest.models impo... | 641 | 26,297 |
Vibe-Trading | agent/backtest/perpetual_evidence.py | .py | """Strict USD-M audit evidence, never read back into accounting decisions."""
from __future__ import annotations
import json
from pathlib import Path
from typing import Any, Mapping, Sequence
SCHEMA_VERSION = "1"
RESOLUTION_LIMITATION = (
"At 100x, an interval of at most 1 hour is only a resolution boundary; "
... | 85 | 3,512 |
Vibe-Trading | agent/backtest/constraints.py | .py | """Composable weight constraints applied on top of any optimizer.
Portfolio Studio step 2 (#456): per-name cap, per-name floor, and per-group
exposure caps that work with every optimizer, not only the bounds baked into
``turnover_aware``. Configured via ``constraints`` in config.json::
"constraints": [
{"... | 206 | 7,686 |
Vibe-Trading | agent/backtest/validation.py | .py | """Statistical validation for backtest results.
Three independent tools:
- Monte Carlo permutation test: is the strategy significantly better than random?
- Bootstrap Sharpe CI: how stable is the risk-adjusted return?
- Walk-Forward analysis: is performance consistent across time windows?
Usage: called automati... | 498 | 18,192 |
Vibe-Trading | agent/backtest/correlation.py | .py | """Cross-asset correlation matrix computation.
Computes pairwise Pearson or Spearman correlation of daily returns
over a configurable lookback window. Used by the /correlation API endpoint.
"""
from __future__ import annotations
import logging
from typing import Dict, Literal
import pandas as pd
import numpy as np
... | 302 | 10,796 |
Vibe-Trading | agent/backtest/run_card.py | .py | """Trust Layer run card generator for backtest runs."""
from __future__ import annotations
import hashlib
import json
import math
from datetime import datetime, timezone
from pathlib import Path
from typing import Any, Mapping, Sequence
SCHEMA_VERSION = "0.1"
BACKTEST_SUMMARY_KEYS = (
"codes",
"start_date",... | 250 | 8,276 |
Vibe-Trading | agent/backtest/engines/composite.py | .py | """Composite cross-market backtest engine.
Manages a shared capital pool across multiple market engines.
Sub-engines are used as stateless "rule books" for market-specific
calculations (commission, slippage, lot rounding, etc.).
All state (capital, positions, trades) lives in CompositeEngine.
"""
from __future__ impo... | 257 | 10,594 |
Vibe-Trading | agent/backtest/engines/china_futures.py | .py | """China futures backtest engine.
Market rules (exchange-level, CFFEX / SHFE / DCE / ZCE / INE / GFEX):
- T+0: can open and close same day (intraday trading allowed)
- Margin trading: 5%~15% by product (exchange-set minimum)
- Price limits: stock-index +-10%, bonds +-2%, commodities +-3%~8%
- Commission: per-l... | 255 | 9,166 |
Vibe-Trading | agent/backtest/engines/_market_hooks.py | .py | """Extracted per-bar market hooks and symbol-classification helpers.
Both the original engines (CryptoEngine, ForexEngine) and CompositeEngine
call these same functions. Zero duplication — one source of truth.
Also hosts symbol -> market detection helpers shared by ``runner.py`` and
``composite.py``: ``_MARKET_PATTER... | 374 | 13,016 |
Vibe-Trading | agent/backtest/engines/futures_base.py | .py | """Base class for all futures engines.
Adds contract-multiplier awareness on top of BaseEngine.
Only futures engines inherit from this; stocks/crypto/forex use BaseEngine directly.
The multiplier affects:
- PnL: direction * size * multiplier * (exit - entry)
- Margin: size * price * multiplier / leverage
- Posi... | 57 | 1,752 |
Vibe-Trading | agent/backtest/engines/options_portfolio.py | .py | """Options portfolio backtest engine (v2).
Supports European and American options via Black-Scholes model with
IV smile approximation. Synthesises theoretical option prices from
underlying prices; supports multi-leg strategies.
v2 enhancements over v1:
- American option support (early exercise heuristic for calls ... | 733 | 28,266 |
Vibe-Trading | agent/backtest/engines/__init__.py | .py | """Backtest engines.
Wave 1 (v1):
- BaseEngine: ABC for bar-by-bar execution with market rules
- ChinaAEngine: A-share (T+1, no short, price limits)
- GlobalEquityEngine: US / HK equities
- CryptoEngine: Crypto perpetuals (funding fees, liquidation)
- options_portfolio: European/American options (Black-Schol... | 31 | 1,087 |
Vibe-Trading | agent/backtest/engines/china_a.py | .py | """A-share (China mainland) backtest engine.
Market rules:
- T+1: cannot sell shares bought today
- No short selling for retail investors
- Price limits: ±10% main board, ±20% ChiNext/STAR, ±5% ST
- Minimum lot: 100 shares (odd lots can only be sold, not bought)
- Commission: ¥5 minimum, 0.025% bilateral
-... | 193 | 7,241 |
Vibe-Trading | agent/backtest/engines/global_futures.py | .py | """Global futures backtest engine (CME / ICE / Eurex).
Market rules:
- Nearly 24x5 (CME Globex: Sun 17:00 - Fri 16:00 CT, daily pause 16:00-17:00)
- Margin: initial + maintenance (exchange-set per contract)
- Limit up/down: dynamic for equity index, fixed for commodities
- Contract multiplier: per-product (ES=... | 223 | 7,301 |
Vibe-Trading | agent/backtest/engines/korea_equity.py | .py | """Korea equity (KRX: KOSPI / KOSDAQ) backtest engine.
Models the Korean cash-equity segment on daily bars. Prices are assumed to be
quoted in KRW, which KRX prints as whole won on a coarse tick grid — the grid is
modelled explicitly below because a percentage-only model produces fill prices
that cannot exist and mis-... | 317 | 13,864 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.