code stringlengths 114 1.05M | path stringlengths 3 312 | quality_prob float64 0.5 0.99 | learning_prob float64 0.2 1 | filename stringlengths 3 168 | kind stringclasses 1
value |
|---|---|---|---|---|---|
from __future__ import print_function
import argparse
from calendar import EPOCH
from re import M
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import sys
from torchvision import datasets, transforms
from torch.optim.lr_scheduler import StepLR
from qsparse import prune,... | /qsparse-2.0.1.tar.gz/qsparse-2.0.1/examples/mnist.py | 0.810179 | 0.385953 | mnist.py | pypi |
# QSS: Quadratic-Separable Solver
QSS solves problems of the form
$$\begin{equation*} \begin{array}{ll} \text{minimize} & (1/2) x^T P x + q^T x + r + g(x) \\\\ \text{subject to} & Ax = b \end{array} \end{equation*}$$
where $x \in \bf{R}^n$ is the decision variable being optimized over. The
objective is defined by a ... | /qss-0.2.2.tar.gz/qss-0.2.2/README.md | 0.533397 | 0.989551 | README.md | pypi |
import matplotlib.pyplot as plt
from matplotlib.widgets import Slider
import scipy
import scipy.ndimage
import numpy as np
from .detection import detect
def view(wave,method='real',units='Angstrom',nav_axis=2,ind=-1,
slider=False,ax=None,figsize=(6,6),cmap='gray',**kwargs):
reciprocal_space=False
... | /qstem-ase-0.1.zip/qstem-ase-0.1/qstem/wave.py | 0.41941 | 0.453806 | wave.py | pypi |
from .wave import Wave
from .util import energy2wavelength, spatial_frequencies
import matplotlib.pyplot as plt
import numpy as np
class CTF(object):
def __init__(self,array=None,defocus=0.,Cs=0.,aperture=np.float('inf'),aperture_edge=0.,
convergence_angle=0.,focal_spread=0.,aberrations={}):
... | /qstem-ase-0.1.zip/qstem-ase-0.1/qstem/imaging.py | 0.501465 | 0.398641 | imaging.py | pypi |
# Qsurface
[](https://pypi.org/project/qsurface/)

[](https://qsurface.readthedocs.io/en/... | /qsurface-0.1.5.tar.gz/qsurface-0.1.5/README.md | 0.79858 | 0.979668 | README.md | pypi |
# qsy
A quantum computer state vector/stabilizer circuit simulator and assembly
language.
## Table of Contents
* [Installation](#installation)
* [qsy](#qsy-1)
* [Example](#example)
* [qsyASM](#qsyasm)
* [Usage](#usage)
* [Example](#example-1)
* [Syntax](#syntax)
* [Operations](#operations)
*... | /qsy-0.4.4.tar.gz/qsy-0.4.4/README.md | 0.559531 | 0.9879 | README.md | pypi |
import numpy as np
import time
from collections import defaultdict
from qsy import gates, __version__
from qsy.util import format_complex
from qsy.backends import StatevectorBackend, CHPBackend
from .error import ParseError, QsyASMError
from .interpreter.parser import QsyASMParser
from .instruction import Operation
f... | /qsy-0.4.4.tar.gz/qsy-0.4.4/qsyasm/program.py | 0.47244 | 0.23535 | program.py | pypi |
import socket
QSYNC_IP = '127.0.0.1' # replace with the QSync IP address found by the discover_qsync() function
QSYNC_PORT = 9760 # QSync by default listens on TCP port 9760
DEBUG = 0
def discover_qsync():
message = bytes(1) # 1 byte of 0x00
address = ('255.255.255.255', 9720) # QSync by default listen... | /qsync_control-2.0.1.tar.gz/qsync_control-2.0.1/qsync_control/__init__.py | 0.52342 | 0.152916 | __init__.py | pypi |
# Qsynthesis
QSynthesis is a Python3 API to perform I/O based program synthesis
of bitvector expressions. It aims at facilitating code deobfuscation.
The algorithm is greybox approach combining both a blackbox I/O based
synthesis and a whitebox AST search to synthesize sub-expressions *(if
the root node cannot be synt... | /qsynthesis-0.2.0.tar.gz/qsynthesis-0.2.0/README.md | 0.486332 | 0.929696 | README.md | pypi |
from __future__ import annotations
import functools
from abc import ABC
from abc import abstractmethod
from typing import Any
from typing import AsyncIterator
from typing import Callable
from typing import Coroutine
from typing import Iterable
from typing import ParamSpec
from typing import TypeVar
Params = ParamSpe... | /qt-async-threads-0.4.0.tar.gz/qt-async-threads-0.4.0/src/qt_async_threads/_async_runner_abc.py | 0.873323 | 0.544075 | _async_runner_abc.py | pypi |
.. _`tutorial`:
========
Tutorial
========
This tutorial will show how to change the function in an existing application, that
performs a blocking operation, so it no longer freezes the UI, providing a better
user experience.
Statement of the problem
------------------------
It is common for applications to spawn c... | /qt-async-threads-0.4.0.tar.gz/qt-async-threads-0.4.0/docs/tutorial.rst | 0.928636 | 0.797714 | tutorial.rst | pypi |
from pathlib import Path
from urllib.parse import urlsplit
import requests
from examples.exception import install_except_hook
from qtpy.QtCore import pyqtSignal
from qtpy.QtCore import QObject
from qtpy.QtCore import QThread
from qtpy.QtWidgets import QApplication
from qtpy.QtWidgets import QFormLayout
from qtpy.QtWid... | /qt-async-threads-0.4.0.tar.gz/qt-async-threads-0.4.0/docs/examples/explanation_thread.py | 0.62223 | 0.168925 | explanation_thread.py | pypi |
from abc import ABCMeta, abstractmethod
from collections import deque
import parser
import re
import symbol
import token
import six
from traits.trait_base import xgetattr, xsetattr
from .binder import Binder
class AnyString(object):
""" Compare equal to any string type.
"""
def __eq__(self, other):
... | /qt_binder-0.4-py3-none-any.whl/qt_binder/binding.py | 0.723602 | 0.259345 | binding.py | pypi |
from __future__ import division
from math import exp, log
import operator
import six
from traits.api import Any, Callable, Constant, Dict, Enum, Float, Instance, \
Int, List, NO_COMPARE, Str, Tuple, Undefined, Unicode, on_trait_change
from .binder import Binder, QtDynamicProperty, Rename, Default
from .qt impo... | /qt_binder-0.4-py3-none-any.whl/qt_binder/widgets.py | 0.832237 | 0.23194 | widgets.py | pypi |
<div align="center">
[](https://github.com/Nakama3942/template_rep)
[](https://github.com/Nakama3942/qt_colored_logger/blob/master/LICEN... | /qt_colored_logger-0.4.0.1.tar.gz/qt_colored_logger-0.4.0.1/README.md | 0.443841 | 0.885681 | README.md | pypi |
from qt_colored_logger.basic.exceptions import ColorException
from qt_colored_logger.src.ansi_format import GetAnsiFormat
ColorPicker = {
# Color table
# Original: https://en.wikipedia.org/wiki/Web_colors
# Red
'MAROON': [128, 0, 0],
'DARKRED': [139, 0, 0],
'RED': [255, 0, 0],
'LIGHTRED': [255, 51, 51],
'FIREB... | /qt_colored_logger-0.4.0.1.tar.gz/qt_colored_logger-0.4.0.1/qt_colored_logger/src/color_picker.py | 0.518059 | 0.38943 | color_picker.py | pypi |
from qt_colored_logger.basic.basic_logger import BasicLogger
from qt_colored_logger.basic.exceptions import ColorException, CombinationException
from qt_colored_logger.src.color_picker import AnsiColor, Dec2Ansi
from qt_colored_logger.text.text_buffer import TextBuffer
class Logger(BasicLogger):
"""
The Logger class... | /qt_colored_logger-0.4.0.1.tar.gz/qt_colored_logger-0.4.0.1/qt_colored_logger/logger/colored_logger.py | 0.60054 | 0.307598 | colored_logger.py | pypi |
import datetime, platform, os, random
from qt_colored_logger.basic.patterns import Singleton
from qt_colored_logger.src.ansi_format import GetAnsiFormat
class BasicLogger(Singleton):
def __init__(
self,
program_name: str,
time: bool,
status: bool,
status_message: bool,
status_type: bool,
message... | /qt_colored_logger-0.4.0.1.tar.gz/qt_colored_logger-0.4.0.1/qt_colored_logger/basic/basic_logger.py | 0.528777 | 0.274099 | basic_logger.py | pypi |
from __future__ import annotations
from enum import Enum
from functools import wraps
from typing import Any, Callable, TypeVar, overload, TYPE_CHECKING
import weakref
import inspect
from ._commands import Command
from ._storage import Storage
if TYPE_CHECKING:
from ._widget import QCommandPalette
from qtpy im... | /qt_command_palette-0.0.7-py3-none-any.whl/qt_command_palette/_api.py | 0.92326 | 0.187486 | _api.py | pypi |
try:
from qtpy import QtWidgets, QtCore
from qtpy.QtCore import Qt, QSize
from qtpy.QtGui import QBrush, QColor, QPainter, QPen, QPaintEvent, QFont
except ModuleNotFoundError:
print("Please install any suitable version of QT (PyQt or PySide)")
class spiralProgressBar(QtWidgets.QWidget):
def __ini... | /QT_Custom_Widgets-0.1.6-py3-none-any.whl/Custom_Widgets/SpiralProgressBar.py | 0.600305 | 0.324209 | SpiralProgressBar.py | pypi |
import time
from epics import PV
from qtpy import QtCore, QtWidgets
class QtEpicsMotorWidget(QtWidgets.QWidget):
"""
This module provides a class library for a GUI label field widget bound to an Epics PV. The PV is monitored
and the field is updated when the PV changes
"""
changeColor = QtCore.... | /qt-epics-0.0.4.tar.gz/qt-epics-0.0.4/qt_epics/QtEpicsMotorWidget.py | 0.482185 | 0.203609 | QtEpicsMotorWidget.py | pypi |
import pickle
from typing import List, Optional
from qtpy import PYSIDE2, QT5
from qtpy.QtCore import QObject, QEvent, Signal, QMimeData, QByteArray, Qt, QPoint, QPointF
from qtpy.QtGui import QCursor, QDrag
from qtpy.QtWidgets import QWidget, QToolTip, QPushButton, QToolButton, QAbstractButton, QApplication
from qth... | /qt-handy-0.3.1.tar.gz/qt-handy-0.3.1/qthandy/filter.py | 0.764935 | 0.319201 | filter.py | pypi |
import functools
from typing import Optional, Union
from qtpy.QtCore import Qt, QObject, QSize
from qtpy.QtGui import QCursor
from qtpy.QtWidgets import QWidget, QApplication, QMessageBox, QSizePolicy, QFrame, QMenu, QLabel, QWidgetAction, \
QPushButton, QToolButton, QVBoxLayout, QHBoxLayout, QLayout, QGraphicsOpa... | /qt-handy-0.3.1.tar.gz/qt-handy-0.3.1/qthandy/__init__.py | 0.811825 | 0.18159 | __init__.py | pypi |
from typing import List, Optional
from qtpy.QtCore import QRect, Qt, QSize, QPoint
from qtpy.QtWidgets import QSizePolicy, QLayout, QLayoutItem
# based on https://doc.qt.io/qt-5/qtwidgets-layouts-flowlayout-example.html
class FlowLayout(QLayout):
def __init__(self, margin: int = 2, spacing: int = 3, parent=None)... | /qt-handy-0.3.1.tar.gz/qt-handy-0.3.1/qthandy/layout.py | 0.879419 | 0.495117 | layout.py | pypi |
from copy import deepcopy
from jsonschema.validators import validator_for
from . import widgets
from .defaults import compute_defaults
def get_widget_state(schema, state=None):
if state is None:
return compute_defaults(schema)
return state
def get_schema_type(schema: dict) -> str:
return schema... | /qt_jsonschema_form-1.0.0-py3-none-any.whl/qt_jsonschema_form/form.py | 0.574156 | 0.237764 | form.py | pypi |
from collections import defaultdict, namedtuple
from qtemplate import log, utils
Sync = namedtuple('Sync', 'qtmpl, expr, context, callback')
class DataStore(utils.Bunch):
""" Datastore used to auto update widget values. """
def __init__(self, *args, **kwargs):
super(DataStore, self).__init__(*args, ... | /qt-qtemplate-1.0.0.tar.gz/qt-qtemplate-1.0.0/qtemplate/datastore.py | 0.671363 | 0.229319 | datastore.py | pypi |
import logging
from dataclasses import dataclass
from PyQt5.QtCore import Qt, QRect, QSize, pyqtSignal
from PyQt5.QtWidgets import (QWidget, QSizePolicy)
from PyQt5.QtGui import QPainter, QBrush, QColor, QPalette
def _left_thumb_adjuster(value, min_value):
if value < min_value:
value = min_value
def _right_thum... | /qt-range-slider-0.2.7.tar.gz/qt-range-slider-0.2.7/qt_range_slider/__init__.py | 0.632616 | 0.24243 | __init__.py | pypi |
from __future__ import absolute_import, division, print_function, \
unicode_literals
from textwrap import dedent
from PyQt5.QtCore import QEvent, Qt
from PyQt5.QtGui import QKeySequence, QTextCursor
from PyQt5.QtWidgets import QDialog, QHBoxLayout, QLineEdit, QMessageBox, \
QPushButton, QShortcut, QTextEdit,... | /qt_style_sheet_inspector-0.1.0.tar.gz/qt_style_sheet_inspector-0.1.0/qt_style_sheet_inspector/_inspector.py | 0.692746 | 0.220405 | _inspector.py | pypi |
import sys
import time
import threading
import traceback
import contextlib
from collections import OrderedDict
from qtpy import QtCore, QtWidgets
__all__ = ['is_main_thread', 'ThreadUpdater']
def is_main_thread():
"""Return if the current thread is the main thread."""
return threading.current_thread() is t... | /qt_thread_updater-1.1.6.tar.gz/qt_thread_updater-1.1.6/qt_thread_updater/thread_updater.py | 0.679498 | 0.15772 | thread_updater.py | pypi |
import threading
import qtpy
from qtpy import QtWidgets
from qt_thread_updater.thread_updater import ThreadUpdater
__all__ = [
'get_updater', 'set_updater', 'cleanup_app',
'get_global_updater_mngr', 'set_global_updater_mngr', 'GlobalUpdaterManager',
'is_running', 'stop', 'start', 'unregister_continuous'... | /qt_thread_updater-1.1.6.tar.gz/qt_thread_updater-1.1.6/qt_thread_updater/global_utils.py | 0.768733 | 0.202976 | global_utils.py | pypi |
from PySide2 import QtCore, QtGui, QtWidgets
from . import util
class SlotItem(QtWidgets.QGraphicsItem):
def __init__(self, parent, slot_type):
super().__init__(parent)
# Status.
self.setAcceptHoverEvents(True)
# Storage.
self.slotType = slot_type
# Style.
... | /qt-tree-0.1.2.tar.gz/qt-tree-0.1.2/qt_tree/slot.py | 0.630457 | 0.170301 | slot.py | pypi |
# Overview
The purpose of this project is to build a library that allows us to implement Quantum Trajectories, an approach to open Markovian systems with an emphasis on the use of different unravelings. The implementation is done for Mathematica, Julia, and python.
Our python implementation is based on the complete u... | /qt_unraveling-0.2.6.tar.gz/qt_unraveling-0.2.6/README.md | 0.595845 | 0.988939 | README.md | pypi |
import numpy as np
from numba import njit, objmode, float64, complex128, int64
import qt_unraveling.usual_operators_ as op
import qt_unraveling.misc_func as misc
@njit
def dNRho(stateRho, measurement_op_list, dt, seed=0):
weight = np.zeros(np.shape(measurement_op_list)[0], dtype=np.float64)
M_index = np.zeros... | /qt_unraveling-0.2.6.tar.gz/qt_unraveling-0.2.6/qt_unraveling/jumpy_trajectory.py | 0.439266 | 0.474022 | jumpy_trajectory.py | pypi |
import numpy as np
from numba import njit, jit, complex128, float64
## Pauli matrices
sigmax = np.array([[0,1],[1,0]], dtype = np.complex128)
sigmay = np.array([[0,-1j],[1j,0]], dtype = np.complex128)
sigmaz = np.array([[1,0],[0,-1]], dtype = np.complex128)
## Lader operators
sigmap = 0.5*(sigmax + 1j*sigmay)
sigmam ... | /qt_unraveling-0.2.6.tar.gz/qt_unraveling-0.2.6/qt_unraveling/usual_operators_.py | 0.623606 | 0.772767 | usual_operators_.py | pypi |
import numpy as np
from numba import complex128
from numba.pycc import CC
cc = CC('usual_operators')
# Uncomment the following line to print out the compilation steps
# cc.verbose = True
@cc.export('Com', complex128[:,:](complex128[:,:], complex128[:,:]))
def Com(a,b):
a, b = np.ascontiguousarray(a), np.ascontigu... | /qt_unraveling-0.2.6.tar.gz/qt_unraveling-0.2.6/qt_unraveling/compile_usual_operators.py | 0.403449 | 0.71097 | compile_usual_operators.py | pypi |
import uuid
import django.contrib.auth.models
import django.db.models.deletion
import django.utils.timezone
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
("auth", "0012_alter_user_first_name_max_length"),
]
operations = [
... | /qt-users-service-0.6.tar.gz/qt-users-service-0.6/users_auth/migrations/0001_initial.py | 0.531696 | 0.152789 | 0001_initial.py | pypi |
import time
import argparse
import collections
import tkinter as Tk
import logging
import numpy as np
from matplotlib.lines import Line2D
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib.figure import Figure
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, Navig... | /qt3utils-1.0.2-py3-none-any.whl/applications/oscilloscope.py | 0.532911 | 0.271384 | oscilloscope.py | pypi |
import argparse
import tkinter as tk
import logging
import datetime
from threading import Thread
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2Tk
import matplotlib
import nidaqmx
import h5py
import qt3utils.nidaq
import qt3utils.d... | /qt3utils-1.0.2-py3-none-any.whl/applications/piezoscan.py | 0.54819 | 0.238489 | piezoscan.py | pypi |
## QT4W
[](https://travis-ci.org/Tencent/QT4W)
[](https://pypi.python.org/pypi/qt4w/)
[](https://GitHub.com/Tencent/qt4w/tags/)
[... | /qt4w-2.1.5.tar.gz/qt4w-2.1.5/README.md | 0.778733 | 0.694108 | README.md | pypi |
import math
from PyQt5.QtCore import Qt, QTime, QRect, pyqtSignal
from PyQt5.QtGui import QColor, QPainter, QFont
from PyQt5.QtWidgets import QWidget, QSizePolicy
def round_up(n, decimals=0):
multiplier = 10 ** decimals
return math.ceil(n * multiplier) / multiplier
class QLevelMeter(QWidget):
REDRAW_IN... | /qt5_levelmeter-1.17.tar.gz/qt5_levelmeter-1.17/src/__init__.py | 0.402392 | 0.203628 | __init__.py | pypi |
import qtmud
# pylint: disable=invalid-name
def commands(client, *, H=False, h=False):
""" Sends a list of the client's commands to the client.
:param client: The client issuing the command command. (That'd be
you.) This isn't part of the command you enter.
:para... | /qtMUD-0.0.11.tar.gz/qtMUD-0.0.11/qtmud/cmds.py | 0.493897 | 0.221814 | cmds.py | pypi |
from __future__ import absolute_import
import types
import six
try:
from .ply import lex, yacc
from .ply.lex import TOKEN
except ImportError:
from ply import lex, yacc
from ply.lex import TOKEN
class QPathSyntaxError(Exception):
"""QPath语法错误"""
def __init__(self, qpath_string, err_msg, lex... | /qtaf-5.6.8.tar.gz/qtaf-5.6.8/tuia/qpathparser.py | 0.54577 | 0.254709 | qpathparser.py | pypi |
import sys
from PyQt5 import Qt, QtCore, QtGui, QtWidgets
def time_to_text(t):
"""Convert time to text."""
if t <= 0:
return '--:--'
elif t < 3600:
minutes = t // 60
seconds = t % 60
return '{:02d}:{:02d}'.format(minutes, seconds)
else:
hours = t // 3600
... | /qtasktimer-0.1.3.tar.gz/qtasktimer-0.1.3/qtasktimer.py | 0.642432 | 0.185062 | qtasktimer.py | pypi |
from __future__ import annotations
import itertools
import warnings
from contextlib import contextmanager
from typing import Any, Generator
import cycler
import matplotlib.pyplot as plt
from . import colors
# Matplotlib issues quite a lot of DeprecationWarnings when calling
# rcParams, as some of the parameters are... | /qtb_plot-0.3.25-py3-none-any.whl/qtbplot/plot.py | 0.746231 | 0.347343 | plot.py | pypi |
import threading
import time
from PyQt4 import QtCore, QtGui, QtTest
import robouser
class QObj(QtCore.QObject):
# For use with sending signals when you don't have a handle on
# a calling widget
somethingHappened = QtCore.Signal()
def center(widget, view_index=None):
"""
Gets the global position... | /qtbot-0.0.1.tar.gz/qtbot-0.0.1/qtbot.py | 0.665845 | 0.393385 | qtbot.py | pypi |
from __future__ import division
import time
from numpy import sqrt
from pymouse import PyMouse
from pykeyboard import PyKeyboard
def drag(source, dest, speed=1000):
"""
Simulates a smooth mouse drag
Args:
source (int, int) : location (x,y) to start the drag, in screen
coordinates
... | /qtbot-0.0.1.tar.gz/qtbot-0.0.1/robouser.py | 0.82828 | 0.340129 | robouser.py | pypi |
# qtcodes
*Qiskit Topological Codes*
[](https://opensource.org/licenses/Apache-2.0)
[](https://github.com/yaleqc/qtcodes/releases)
[ -> None:
# Decode the bytes literal to a string
xml_string = data.decode()
# Use the xml.dom.minidom module to format the XML string
xml_data = xml.dom.minid... | /qtconfig-0.0.5-py3-none-any.whl/qconfig/_xml_tools.py | 0.804981 | 0.324516 | _xml_tools.py | pypi |
from typing import Any, Callable, Literal, Type
from PySide6.QtCore import QDate
from PySide6.QtWidgets import (QCheckBox, QComboBox, QDateEdit, QDoubleSpinBox,
QFontComboBox, QLineEdit, QPlainTextEdit,
QProgressBar, QPushButton, QSlider, QSpinBox,
... | /qtconfig-0.0.5-py3-none-any.whl/qconfig/_method_loader.py | 0.847211 | 0.260325 | _method_loader.py | pypi |
from typing import Any
from PySide6.QtWidgets import QWidget
class HookError(Exception):
"""Parent exception for all errors related to hooks"""
class InvalidHookError(HookError):
"""Raised when a key-to-widget map has an invalid pair"""
class HookedWidgetDeletedError(HookError):
"""Raised when the ho... | /qtconfig-0.0.5-py3-none-any.whl/qconfig/exceptions.py | 0.912556 | 0.264045 | exceptions.py | pypi |
from collections import namedtuple
from threading import Lock
from ._tdigest import lib as _lib
DEFAULT_COMPRESSION = 1000
Centroid = namedtuple("Centroid", ("weight", "mean"))
class RawTDigest(object):
def __init__(self, compression=DEFAULT_COMPRESSION):
if not isinstance(compression, int):
... | /qtdigest-cffi-0.5.0.tar.gz/qtdigest-cffi-0.5.0/tdigest/__init__.py | 0.847558 | 0.264578 | __init__.py | pypi |
import numpy as np
import networkx as nx
import matplotlib.pyplot as plt
import itertools as it
import qtree.optimizer as opt
import qtree.graph_model as gm
import qtree.np_framework as npfr
from numpy.compat import basestring
from numpy.core.numeric import asanyarray
einsum_symbols = 'abcdefghijklmnopqrstuvwxyzA... | /qtensor-qtree-0.1.2.tar.gz/qtensor-qtree-0.1.2/qtree/einsum.py | 0.634996 | 0.366476 | einsum.py | pypi |
import qtree.operators as ops
import qtree.optimizer as opt
import qtree.graph_model as gm
import qtree.np_framework as npfr
import qtree.utils as utils
from qtree.logger_setup import log
def get_amplitudes_from_cirq(filename, initial_state=0):
"""
Calculates amplitudes for a circuit in file filename using C... | /qtensor-qtree-0.1.2.tar.gz/qtensor-qtree-0.1.2/qtree/simulator.py | 0.822439 | 0.630344 | simulator.py | pypi |
import numpy as np
import networkx as nx
import qtree.graph_model as gm
import copy
import random
MAX_STATE_SIZE = 15
def sparse_graph_adjacency(G, max_size, node_to_row, weight='weight'):
"""Return the graph adjacency matrix as a SciPy sparse matrix.
Parameters
----------
G : graph
The Netw... | /qtensor-qtree-0.1.2.tar.gz/qtensor-qtree-0.1.2/qtree/rl_environment.py | 0.845241 | 0.656865 | rl_environment.py | pypi |
import numpy as np
def unravel_index(value, dimensions):
"""
Python analog of the numpy.unravel_index
Supports more than 32 dimensions
"""
unravel_size = np.prod(dimensions)
val = value
coords = [None, ] * len(dimensions)
for ii in range(len(dimensions) - 1, -1, -1):
if val < ... | /qtensor-qtree-0.1.2.tar.gz/qtensor-qtree-0.1.2/qtree/utils.py | 0.802826 | 0.802826 | utils.py | pypi |
import re
import time
import subprocess
import threading
import sys
ENCODING = sys.getdefaultencoding()
def run_exact_solver(data, command="tw-exact", cwd=None,
extra_args=None):
"""
Runs the exact solver and collects its output
Parameters
----------
data : str
Path... | /qtensor-qtree-0.1.2.tar.gz/qtensor-qtree-0.1.2/qtree/graph_model/pace2017_solver_api.py | 0.509276 | 0.241735 | pace2017_solver_api.py | pypi |
import sys
import lzma
import networkx as nx
ENCODING = sys.getdefaultencoding()
def generate_gr_file(graph, filename="", compressed=False):
"""
Generate a gr format input file for the graph.
This function ALWAYS expects a simple Graph without self loops
Parameters
----------
graph : network... | /qtensor-qtree-0.1.2.tar.gz/qtensor-qtree-0.1.2/qtree/graph_model/exporters.py | 0.527803 | 0.403714 | exporters.py | pypi |
from __future__ import annotations
from abc import ABC, abstractmethod
from functools import cached_property
from typing import TYPE_CHECKING, Generic, TypeVar, cast
import attrs
from attr import define
from qtgqlcodegen.core.cppref import CppAttribute, QtGqlBasesNs, QtGqlTypes
if TYPE_CHECKING:
from qtgqlcodeg... | /qtgql-0.135.2-py3-none-any.whl/qtgqlcodegen/types.py | 0.883613 | 0.224884 | types.py | pypi |
from functools import cached_property
from pathlib import Path
import graphql
from attrs import Factory, define
from qtgqlcodegen.generator import SchemaGenerator
from qtgqlcodegen.schema.definitions import CustomScalarMap
from qtgqlcodegen.types import CUSTOM_SCALARS
@define(slots=False)
class QtGqlConfig:
"""... | /qtgql-0.135.2-py3-none-any.whl/qtgqlcodegen/config.py | 0.801509 | 0.244149 | config.py | pypi |
from __future__ import annotations
from typing import TYPE_CHECKING, Callable, TypeVar
from graphql import language as gql_lang
from graphql.type import definition as gql_def
if TYPE_CHECKING:
from typing_extensions import TypeAlias
T_AST_Node = TypeVar("T_AST_Node", bound=gql_lang.Node)
SelectionsSet: TypeAlia... | /qtgql-0.135.2-py3-none-any.whl/qtgqlcodegen/core/graphql_ref.py | 0.821653 | 0.422147 | graphql_ref.py | pypi |
from __future__ import annotations
import warnings
from typing import TYPE_CHECKING, Any
import jinja2
from attrs import define
from jinja2 import Environment, PackageLoader, select_autoescape
if TYPE_CHECKING: # pragma: no cover
from qtgqlcodegen.config import QtGqlConfig
from qtgqlcodegen.generator import... | /qtgql-0.135.2-py3-none-any.whl/qtgqlcodegen/core/template.py | 0.697712 | 0.196691 | template.py | pypi |
from __future__ import annotations
from typing import TYPE_CHECKING
from attr import define
from qtgqlcodegen.core.graphql_ref import (
has_id_selection,
has_typename_selection,
inject_id_selection,
inject_typename_selection,
is_field_node,
is_inline_fragment,
)
from qtgqlcodegen.utils import... | /qtgql-0.135.2-py3-none-any.whl/qtgqlcodegen/operation/selections_injection.py | 0.77137 | 0.253532 | selections_injection.py | pypi |
from __future__ import annotations
from typing import TYPE_CHECKING
import graphql
from graphql import OperationDefinitionNode, OperationType, language as gql_lang
from graphql.language import visitor
from qtgqlcodegen.core.graphql_ref import (
SelectionsSet,
is_field_node,
is_fragment_definition_node,
... | /qtgql-0.135.2-py3-none-any.whl/qtgqlcodegen/operation/evaluation.py | 0.686265 | 0.279822 | evaluation.py | pypi |
from __future__ import annotations
from functools import cached_property
from typing import TYPE_CHECKING
from attr import Factory, define
from graphql import OperationType
from qtgqlcodegen.types import BuiltinScalars
from qtgqlcodegen.utils import cached_method, require
if TYPE_CHECKING:
from graphql.type imp... | /qtgql-0.135.2-py3-none-any.whl/qtgqlcodegen/schema/definitions.py | 0.859369 | 0.237681 | definitions.py | pypi |
from __future__ import annotations
from typing import NamedTuple
from graphql import OperationType
from graphql.type import definition as gql_def
from qtgqlcodegen.core.exceptions import QtGqlException
from qtgqlcodegen.core.graphql_ref import (
is_enum_definition,
is_input_definition,
is_interface_defin... | /qtgql-0.135.2-py3-none-any.whl/qtgqlcodegen/schema/evaluation.py | 0.747155 | 0.246227 | evaluation.py | pypi |
import asyncio
import json
import logging
import qth
from qth_ls import Ls
from qth_alias.version import __version__ # noqa
from qth_alias.alias import Alias
def has_cycle(aliases):
"""Chcek if {alias: target, ...} dictionary contains a cyclic dependency.
If there is, returns the cycle as a list of paths.... | /qth_alias-0.2.0.tar.gz/qth_alias-0.2.0/qth_alias/__init__.py | 0.759761 | 0.153803 | __init__.py | pypi |
import sys
import argparse
import qth
import asyncio
from qth_gc.version import __version__
async def get_all_topics(client, wait=3.0):
"""Gather a dictionary of all topic/message pairs received in response to a
global subscription.
"""
topics = {}
changed = [True]
def on_message(topic... | /qth_gc-0.2.0.tar.gz/qth_gc-0.2.0/qth_gc/__init__.py | 0.541894 | 0.294013 | __init__.py | pypi |
import asyncio
from itertools import chain
import qth
def path_to_subdirectories(path):
"""Given a path, generate every subdirectory that path resides within.
For example given "foo/bar/baz" generates "", "foo/" and "foo/bar/".
"""
# Always within the root
yield ""
parts = path.split("/")
... | /qth_ls-0.2.0.tar.gz/qth_ls-0.2.0/qth_ls/__init__.py | 0.76999 | 0.303158 | __init__.py | pypi |
import asyncio
import qth
import re
import datetime
import aiohttp
import aiodns
import pycares
import traceback
from collections import defaultdict, namedtuple
from .version import __version__
async def http_get_text(loop, url):
"""Perform an HTTP request returning the reponse as text."""
async with aioht... | /qth_openwrt_status-0.1.0.tar.gz/qth_openwrt_status-0.1.0/qth_openwrt_status/__init__.py | 0.662687 | 0.175256 | __init__.py | pypi |
Qth Postgres Log
================
A logging service for [Qth](https://github.com/mossblaser/qth) which stores Qth
events and properties into a PostgreSQL database.
Usage
-----
Just run:
$ qth_postgres_log
Which will create and start populating tables `qth_log` and `qth_paths` in the
database and username matc... | /qth_postgres_log-0.2.0.tar.gz/qth_postgres_log-0.2.0/README.md | 0.947575 | 0.776665 | README.md | pypi |
import logging
from collections import defaultdict
import qth
class Tree(object):
"""A recursive tree structure in a directory tree."""
def __init__(self):
self.children = defaultdict(list)
def add_topic(self, topic, description):
"""Add a new path to the tree.
Params
... | /qth_registrar-0.3.0.tar.gz/qth_registrar-0.3.0/qth_registrar/tree.py | 0.780871 | 0.266787 | tree.py | pypi |
import asyncio
import qth
from yarp import NoValue, Value
from .version import __version__
__names__ = [
"set_property",
"get_property",
"watch_event",
"send_event",
"run_forever",
"set_default_qth_client",
"get_default_qth_client",
]
_default_client = None
def set_default_qth_client(c... | /qth_yarp-0.3.0.tar.gz/qth_yarp-0.3.0/qth_yarp/__init__.py | 0.756178 | 0.174498 | __init__.py | pypi |
import libqtile
import libqtile.config
from libqtile.lazy import lazy
from libqtile.log_utils import logger
# For type hints
from libqtile.core.manager import Qtile
from libqtile.group import _Group
from libqtile.backend import base
from collections.abc import Callable
class MutableScratch(object):
"""For creati... | /qtile-mutable_scratch-0.0.2.tar.gz/qtile-mutable_scratch-0.0.2/qtile_mutable_scratch/_MutableScratch.py | 0.568536 | 0.18462 | _MutableScratch.py | pypi |
# Plasma
[](https://travis-ci.org/numirias/qtile-plasma)
[](https://codecov.io/gh/numirias/qtile-plasma)
[:
self.width = width
self.height = height
sel... | /qtile-plasma-1.5.6.tar.gz/qtile-plasma-1.5.6/plasma/debug.py | 0.637708 | 0.202187 | debug.py | pypi |
from collections import namedtuple
import time
from math import isclose
import sys
if sys.version_info >= (3, 6):
from enum import Enum, Flag, auto
else:
# Python 3.5 backport
from .enum import Enum, Flag, auto
Point = namedtuple('Point', 'x y')
Dimensions = namedtuple('Dimensions', 'x y width height')
... | /qtile-plasma-1.5.6.tar.gz/qtile-plasma-1.5.6/plasma/node.py | 0.656988 | 0.292779 | node.py | pypi |
import copy
from xcffib.xproto import StackMode
from libqtile.layout.base import Layout
from .node import Node, AddMode, NotRestorableError
class Plasma(Layout):
"""A flexible tree-based layout.
Each tree node represents a container whose children are aligned either
horizontally or vertically. Each win... | /qtile-plasma-1.5.6.tar.gz/qtile-plasma-1.5.6/plasma/layout.py | 0.791418 | 0.25696 | layout.py | pypi |
from __future__ import annotations
from typing import TYPE_CHECKING
from libqtile.command.client import InteractiveCommandClient
from libqtile.command.graph import CommandGraphCall, CommandGraphNode
from libqtile.command.interface import CommandInterface
if TYPE_CHECKING:
from typing import Iterable
from li... | /qtile-0.22.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl/libqtile/lazy.py | 0.891262 | 0.246227 | lazy.py | pypi |
import asyncio
import contextlib
from libqtile import utils
from libqtile.log_utils import logger
subscriptions = {} # type: dict
SKIPLOG = set() # type: set
def clear():
subscriptions.clear()
class Subscribe:
def __init__(self):
hooks = set([])
for i in dir(self):
if not i.... | /qtile-0.22.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl/libqtile/hook.py | 0.681303 | 0.196441 | hook.py | pypi |
from __future__ import annotations
from typing import TYPE_CHECKING
from libqtile import configurable, pangocffi
if TYPE_CHECKING:
from typing import Any
from cairocffi import ImageSurface
from libqtile.backend.base import Drawer
from libqtile.core.manager import Qtile
from libqtile.utils impo... | /qtile-0.22.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl/libqtile/popup.py | 0.78374 | 0.167934 | popup.py | pypi |
from __future__ import annotations
from typing import TYPE_CHECKING
from libqtile import config, group, hook
from libqtile.backend.base import FloatStates
from libqtile.config import Match
if TYPE_CHECKING:
from libqtile.backend.base import Window
class WindowVisibilityToggler:
"""
WindowVisibilityTog... | /qtile-0.22.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl/libqtile/scratchpad.py | 0.914668 | 0.193262 | scratchpad.py | pypi |
import io
import os
from collections import namedtuple
import cairocffi
import cairocffi.pixbuf
from libqtile.utils import scan_files
class LoadingError(Exception):
pass
_SurfaceInfo = namedtuple("_SurfaceInfo", ("surface", "file_type"))
def _decode_to_image_surface(bytes_img, width=None, height=None):
... | /qtile-0.22.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl/libqtile/images.py | 0.674158 | 0.282444 | images.py | pypi |
import collections
from libqtile import pangocffi, utils
class TextLayout:
def __init__(
self, drawer, text, colour, font_family, font_size, font_shadow, wrap=True, markup=False
):
self.drawer, self.colour = drawer, colour
layout = drawer.ctx.create_layout()
layout.set_alignm... | /qtile-0.22.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl/libqtile/drawer.py | 0.747247 | 0.165054 | drawer.py | pypi |
from __future__ import annotations
import asyncio
import fcntl
import json
import marshal
import os.path
import socket
import struct
from typing import Any
from libqtile.log_utils import logger
from libqtile.utils import get_cache_dir
HDRFORMAT = "!L"
HDRLEN = struct.calcsize(HDRFORMAT)
SOCKBASE = "qtilesocket.%s"
... | /qtile-0.22.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl/libqtile/ipc.py | 0.652795 | 0.159217 | ipc.py | pypi |
import time
from typing import Any
from urllib.parse import urlencode
from libqtile.widget.generic_poll_text import GenPollUrl
# See documentation: https://openweathermap.org/current
QUERY_URL = "http://api.openweathermap.org/data/2.5/weather?"
DEFAULT_APP_ID = "7834197c2338888258f8cb94ae14ef49"
class OpenWeatherR... | /qtile-0.22.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl/libqtile/widget/open_weather.py | 0.644896 | 0.193776 | open_weather.py | pypi |
# type: ignore
import re
from dbus_next.constants import MessageType
from libqtile.log_utils import logger
from libqtile.utils import add_signal_receiver
from libqtile.widget import base
class KeyboardKbdd(base.ThreadPoolText):
"""Widget for changing keyboard layouts per window, using kbdd
kbdd should be... | /qtile-0.22.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl/libqtile/widget/keyboardkbdd.py | 0.608012 | 0.164215 | keyboardkbdd.py | pypi |
from __future__ import annotations
from math import log
import psutil
from libqtile.log_utils import logger
from libqtile.widget import base
class Net(base.ThreadPoolText):
"""
Displays interface down and up speed
Widget requirements: psutil_.
.. _psutil: https://pypi.org/project/psutil/
""... | /qtile-0.22.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl/libqtile/widget/net.py | 0.640861 | 0.29005 | net.py | pypi |
import psutil
from libqtile.widget import base
__all__ = ["Memory"]
class Memory(base.ThreadPoolText):
"""Displays memory/swap usage
MemUsed: Returns memory in use
MemTotal: Returns total amount of memory
MemFree: Returns amount of memory free
MemPercent: Returns memory in use as a percentage
... | /qtile-0.22.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl/libqtile/widget/memory.py | 0.672332 | 0.355831 | memory.py | pypi |
import os
import subprocess
from functools import partial
from libqtile.widget import base
class Moc(base.ThreadPoolText):
"""A simple MOC widget.
Show the artist and album of now listening song and allow basic mouse
control from the bar:
- toggle pause (or play if stopped) on left click;
- sk... | /qtile-0.22.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl/libqtile/widget/moc.py | 0.568176 | 0.246315 | moc.py | pypi |
from dbus_next.aio import MessageBus
from dbus_next.constants import BusType
from libqtile.widget import base
BLUEZ = "org.bluez"
BLUEZ_PATH = "/org/bluez/hci0"
BLUEZ_ADAPTER = "org.bluez.Adapter1"
BLUEZ_DEVICE = "org.bluez.Device1"
BLUEZ_PROPERTIES = "org.freedesktop.DBus.Properties"
class Bluetooth(base._TextBox... | /qtile-0.22.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl/libqtile/widget/bluetooth.py | 0.633297 | 0.161519 | bluetooth.py | pypi |
from __future__ import annotations
import os
import platform
import re
import warnings
from abc import ABC, abstractmethod
from enum import Enum, unique
from pathlib import Path
from subprocess import CalledProcessError, check_output
from typing import TYPE_CHECKING, NamedTuple
from libqtile import bar, configurable... | /qtile-0.22.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl/libqtile/widget/battery.py | 0.785309 | 0.233018 | battery.py | pypi |
import enum
import os
import shlex
from functools import partial
from libqtile.log_utils import logger
from libqtile.widget import base
BACKLIGHT_DIR = "/sys/class/backlight"
@enum.unique
class ChangeDirection(enum.Enum):
UP = 0
DOWN = 1
class Backlight(base.InLoopPollText):
"""A simple widget to sho... | /qtile-0.22.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl/libqtile/widget/backlight.py | 0.543106 | 0.198025 | backlight.py | pypi |
import sys
import time
from datetime import datetime, timedelta, timezone
from libqtile.log_utils import logger
from libqtile.widget import base
try:
import pytz
except ImportError:
pass
try:
import dateutil.tz
except ImportError:
pass
class Clock(base.InLoopPollText):
"""A simple but flexible... | /qtile-0.22.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl/libqtile/widget/clock.py | 0.422624 | 0.191082 | clock.py | pypi |
from __future__ import annotations
from typing import TYPE_CHECKING
from libqtile import bar
from libqtile.log_utils import logger
from libqtile.widget import Systray, base
if TYPE_CHECKING:
from typing import Any
class WidgetBox(base._Widget):
"""A widget to declutter your bar.
WidgetBox is a widget ... | /qtile-0.22.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl/libqtile/widget/widgetbox.py | 0.815894 | 0.170819 | widgetbox.py | pypi |
import os
from subprocess import CalledProcessError, Popen
from libqtile.log_utils import logger
from libqtile.widget import base
# format: "Distro": ("cmd", "number of lines to subtract from output")
CMD_DICT = {
"Arch": ("pacman -Qu", 0),
"Arch_checkupdates": ("checkupdates", 0),
"Arch_Sup": ("pacman -... | /qtile-0.22.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl/libqtile/widget/check_updates.py | 0.560493 | 0.373733 | check_updates.py | pypi |
import subprocess
from functools import partial
from libqtile import pangocffi
from libqtile.widget import base
class Cmus(base.ThreadPoolText):
"""A simple Cmus widget.
Show the artist and album of now listening song and allow basic mouse
control from the bar:
- toggle pause (or play if stopp... | /qtile-0.22.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl/libqtile/widget/cmus.py | 0.549157 | 0.214147 | cmus.py | pypi |
from __future__ import annotations
from typing import Any
from libqtile import bar, hook
from libqtile.widget import base
class WindowCount(base._TextBox):
"""
A simple widget to display the number of windows in the
current group of the screen on which the widget is.
"""
defaults = [
(... | /qtile-0.22.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl/libqtile/widget/window_count.py | 0.852859 | 0.181155 | window_count.py | pypi |
import re
import subprocess
from libqtile import bar
from libqtile.widget import base
__all__ = [
"Volume",
]
re_vol = re.compile(r"\[(\d?\d?\d?)%\]")
class Volume(base._TextBox):
"""Widget that display and change volume
By default, this widget uses ``amixer`` to get and set the volume so users
w... | /qtile-0.22.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl/libqtile/widget/volume.py | 0.520009 | 0.173428 | volume.py | pypi |
import csv
import re
from libqtile.widget import base
sensors_mapping = {
"fan_speed": "fan.speed",
"perf": "pstate",
"temp": "temperature.gpu",
}
def _all_sensors_names_correct(sensors):
return all(map(lambda x: x in sensors_mapping, sensors))
class NvidiaSensors(base.ThreadPoolText):
"""Disp... | /qtile-0.22.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl/libqtile/widget/nvidia_sensors.py | 0.632503 | 0.295548 | nvidia_sensors.py | pypi |
import psutil
from libqtile.widget import base
class ThermalSensor(base.InLoopPollText):
"""Widget to display temperature sensor information
For using the thermal sensor widget you need to have lm-sensors installed.
You can get a list of the tag_sensors executing "sensors" in your terminal.
Then yo... | /qtile-0.22.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl/libqtile/widget/sensors.py | 0.749179 | 0.394784 | sensors.py | pypi |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.